From 7246ea6027a2e69b31f8c8c15d8aa2744c55a3a0 Mon Sep 17 00:00:00 2001 From: Enric Tobella Date: Tue, 28 Apr 2020 15:16:10 +0200 Subject: [PATCH] [12.0][ADD] kpi_dashboard_altair --- kpi_dashboard_altair/README.rst | 113 +++++ kpi_dashboard_altair/__init__.py | 1 + kpi_dashboard_altair/__manifest__.py | 20 + .../demo/demo_dashboard_altair.xml | 33 ++ kpi_dashboard_altair/models/__init__.py | 1 + kpi_dashboard_altair/models/kpi_kpi.py | 28 ++ kpi_dashboard_altair/readme/CONFIGURE.rst | 28 ++ kpi_dashboard_altair/readme/CONTRIBUTORS.rst | 1 + kpi_dashboard_altair/readme/DESCRIPTION.rst | 1 + .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 456 ++++++++++++++++++ .../static/lib/vega/vega-embed.min.js | 26 + .../static/lib/vega/vega-lite.min.js | 15 + .../static/lib/vega/vega.min.js | 1 + .../static/src/js/altair_widget.js | 38 ++ .../static/src/xml/dashboard.xml | 9 + .../views/webclient_templates.xml | 14 + requirements.txt | 1 + 18 files changed, 786 insertions(+) create mode 100644 kpi_dashboard_altair/README.rst create mode 100644 kpi_dashboard_altair/__init__.py create mode 100644 kpi_dashboard_altair/__manifest__.py create mode 100644 kpi_dashboard_altair/demo/demo_dashboard_altair.xml create mode 100644 kpi_dashboard_altair/models/__init__.py create mode 100644 kpi_dashboard_altair/models/kpi_kpi.py create mode 100644 kpi_dashboard_altair/readme/CONFIGURE.rst create mode 100644 kpi_dashboard_altair/readme/CONTRIBUTORS.rst create mode 100644 kpi_dashboard_altair/readme/DESCRIPTION.rst create mode 100644 kpi_dashboard_altair/static/description/icon.png create mode 100644 kpi_dashboard_altair/static/description/index.html create mode 100644 kpi_dashboard_altair/static/lib/vega/vega-embed.min.js create mode 100644 kpi_dashboard_altair/static/lib/vega/vega-lite.min.js create mode 100644 kpi_dashboard_altair/static/lib/vega/vega.min.js create mode 100644 kpi_dashboard_altair/static/src/js/altair_widget.js create mode 100644 kpi_dashboard_altair/static/src/xml/dashboard.xml create mode 100644 kpi_dashboard_altair/views/webclient_templates.xml diff --git a/kpi_dashboard_altair/README.rst b/kpi_dashboard_altair/README.rst new file mode 100644 index 00000000..9b5050d0 --- /dev/null +++ b/kpi_dashboard_altair/README.rst @@ -0,0 +1,113 @@ +==================== +Kpi Dashboard Altair +==================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github + :target: https://github.com/OCA/reporting-engine/tree/12.0/kpi_dashboard_altair + :alt: OCA/reporting-engine +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/reporting-engine-12-0/reporting-engine-12-0-kpi_dashboard_altair + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/143/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Define KPI graphs using altair + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Configure KPIs +~~~~~~~~~~~~~~ + +#. Access `Dashboards > Configuration > KPI Dashboards > Configure KPI` +#. Create a new kpi with widget `altair` + +You need to define a function like:: + + import pandas + import altair + + + class Kpi(models.Model): + _inherit = 'kpi.kpi' + + def test_demo_altair(self): + source = pandas.DataFrame( + { + "a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"], + "b": [28, 55, 43, 91, 81, 53, 19, 87, 52], + } + ) + chart = altair.Chart(source).mark_bar().encode(x="a", y="b") + return {"altair": json.loads(chart.to_json())} + + +You can use `code` in a similar way, as `pandas` and `altair` are already defined +when using `code` on an `altair` widget. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Creu Blanca + +Contributors +~~~~~~~~~~~~ + +* Enric Tobella + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-etobella| image:: https://github.com/etobella.png?size=40px + :target: https://github.com/etobella + :alt: etobella + +Current `maintainer `__: + +|maintainer-etobella| + +This module is part of the `OCA/reporting-engine `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/kpi_dashboard_altair/__init__.py b/kpi_dashboard_altair/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/kpi_dashboard_altair/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/kpi_dashboard_altair/__manifest__.py b/kpi_dashboard_altair/__manifest__.py new file mode 100644 index 00000000..0b60340c --- /dev/null +++ b/kpi_dashboard_altair/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Kpi Dashboard Altair", + "summary": """ + Create dashboards using altair""", + "version": "12.0.1.0.0", + "license": "AGPL-3", + "author": "Creu Blanca,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/reporting-engine", + "depends": ["kpi_dashboard"], + "data": ["views/webclient_templates.xml"], + "qweb": ["static/src/xml/dashboard.xml"], + "external_dependencies": { + "python": ['altair'], + }, + "demo": ["demo/demo_dashboard_altair.xml"], + "maintainers": ["etobella"], +} diff --git a/kpi_dashboard_altair/demo/demo_dashboard_altair.xml b/kpi_dashboard_altair/demo/demo_dashboard_altair.xml new file mode 100644 index 00000000..a45539a2 --- /dev/null +++ b/kpi_dashboard_altair/demo/demo_dashboard_altair.xml @@ -0,0 +1,33 @@ + + + + Altair 01 + code + altair + +source = pandas.DataFrame( +{ +"a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"], +"b": [28, 55, 43, 91, 81, 53, 19, 87, 52], +} +) +chart = altair.Chart(source, background="transparent").mark_bar().encode(x="a", y="b") +result = {"altair": json.loads(chart.to_json())} + + + + + + + Altair + + 1 + 10 + 4 + #47bbb3 + + #ffffff + + + diff --git a/kpi_dashboard_altair/models/__init__.py b/kpi_dashboard_altair/models/__init__.py new file mode 100644 index 00000000..5bb66de7 --- /dev/null +++ b/kpi_dashboard_altair/models/__init__.py @@ -0,0 +1 @@ +from . import kpi_kpi diff --git a/kpi_dashboard_altair/models/kpi_kpi.py b/kpi_dashboard_altair/models/kpi_kpi.py new file mode 100644 index 00000000..db36e47c --- /dev/null +++ b/kpi_dashboard_altair/models/kpi_kpi.py @@ -0,0 +1,28 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models +import logging +import json +logger = logging.getLogger(__name__) +try: + import pandas + import altair +except ImportError: + logger.debug('Cannot import genshi.core') + + +class KpiKpi(models.Model): + + _inherit = "kpi.kpi" + + widget = fields.Selection(selection_add=[("altair", "Altair")]) + + def _get_code_input_dict(self): + res = super()._get_code_input_dict() + if self.widget == 'altair': + res.update({ + 'json': json, + 'altair': altair, + 'pandas': pandas, + }) + return res diff --git a/kpi_dashboard_altair/readme/CONFIGURE.rst b/kpi_dashboard_altair/readme/CONFIGURE.rst new file mode 100644 index 00000000..382e3d0b --- /dev/null +++ b/kpi_dashboard_altair/readme/CONFIGURE.rst @@ -0,0 +1,28 @@ +Configure KPIs +~~~~~~~~~~~~~~ + +#. Access `Dashboards > Configuration > KPI Dashboards > Configure KPI` +#. Create a new kpi with widget `altair` + +You need to define a function like:: + + import pandas + import altair + + + class Kpi(models.Model): + _inherit = 'kpi.kpi' + + def test_demo_altair(self): + source = pandas.DataFrame( + { + "a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"], + "b": [28, 55, 43, 91, 81, 53, 19, 87, 52], + } + ) + chart = altair.Chart(source).mark_bar().encode(x="a", y="b") + return {"altair": json.loads(chart.to_json())} + + +You can use `code` in a similar way, as `pandas` and `altair` are already defined +when using `code` on an `altair` widget. diff --git a/kpi_dashboard_altair/readme/CONTRIBUTORS.rst b/kpi_dashboard_altair/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..93ec993e --- /dev/null +++ b/kpi_dashboard_altair/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Enric Tobella diff --git a/kpi_dashboard_altair/readme/DESCRIPTION.rst b/kpi_dashboard_altair/readme/DESCRIPTION.rst new file mode 100644 index 00000000..32f3baf6 --- /dev/null +++ b/kpi_dashboard_altair/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Define KPI graphs using altair diff --git a/kpi_dashboard_altair/static/description/icon.png b/kpi_dashboard_altair/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz# z-5EK$o(!F?hmX*2Yt6+coY`6jGbb7tF#6nHA zuKk=GGJ;ZwON1iAfG$E#Y7MnZVmrY|j0eVI(DN_MNFJmyZ|;w4tf@=CCDZ#5N_0K= z$;R~bbk?}TpfDjfB&aiQ$VA}s?P}xPERJG{kxk5~R`iRS(SK5d+Xs9swCozZISbnS zk!)I0>t=A<-^z(cmSFz3=jZ23u13X><0b)P)^1T_))Kr`e!-pb#q&J*Q`p+B6la%C zuVl&0duN<;uOsB3%T9Fp8t{ED108<+W(nOZd?gDnfNBC3>M8WE61$So|P zVvqH0SNtDTcsUdzaMDpT=Ty0pDHHNL@Z0w$Y`XO z2M-_r1S+GaH%pz#Uy0*w$Vdl=X=rQXEzO}d6J^R6zjM1u&c9vYLvLp?W7w(?np9x1 zE_0JSAJCPB%i7p*Wvg)pn5T`8k3-uR?*NT|J`eS#_#54p>!p(mLDvmc-3o0mX*mp_ zN*AeS<>#^-{S%W<*mz^!X$w_2dHWpcJ6^j64qFBft-o}o_Vx80o0>}Du;>kLts;$8 zC`7q$QI(dKYG`Wa8#wl@V4jVWBRGQ@1dr-hstpQL)Tl+aqVpGpbSfN>5i&QMXfiZ> zaA?T1VGe?rpQ@;+pkrVdd{klI&jVS@I5_iz!=UMpTsa~mBga?1r}aRBm1WS;TT*s0f0lY=JBl66Upy)-k4J}lh=P^8(SXk~0xW=T9v*B|gzIhN z>qsO7dFd~mgxAy4V?&)=5ieYq?zi?ZEoj)&2o)RLy=@hbCRcfT5jigwtQGE{L*8<@Yd{zg;CsL5mvzfDY}P-wos_6PfprFVaeqNE%h zKZhLtcQld;ZD+>=nqN~>GvROfueSzJD&BE*}XfU|H&(FssBqY=hPCt`d zH?@s2>I(|;fcW&YM6#V#!kUIP8$Nkdh0A(bEVj``-AAyYgwY~jB zT|I7Bf@%;7aL7Wf4dZ%VqF$eiaC38OV6oy3Z#TER2G+fOCd9Iaoy6aLYbPTN{XRPz z;U!V|vBf%H!}52L2gH_+j;`bTcQRXB+y9onc^wLm5wi3-Be}U>k_u>2Eg$=k!(l@I zcCg+flakT2Nej3i0yn+g+}%NYb?ta;R?(g5SnwsQ49U8Wng8d|{B+lyRcEDvR3+`O{zfmrmvFrL6acVP%yG98X zo&+VBg@px@i)%o?dG(`T;n*$S5*rnyiR#=wW}}GsAcfyQpE|>a{=$Hjg=-*_K;UtD z#z-)AXwSRY?OPefw^iI+ z)AXz#PfEjlwTes|_{sB?4(O@fg0AJ^g8gP}ex9Ucf*@_^J(s_5jJV}c)s$`Myn|Kd z$6>}#q^n{4vN@+Os$m7KV+`}c%4)4pv@06af4-x5#wj!KKb%caK{A&Y#Rfs z-po?Dcb1({W=6FKIUirH&(yg=*6aLCekcKwyfK^JN5{wcA3nhO(o}SK#!CINhI`-I z1)6&n7O&ZmyFMuNwvEic#IiOAwNkR=u5it{B9n2sAJV5pNhar=j5`*N!Na;c7g!l$ z3aYBqUkqqTJ=Re-;)s!EOeij=7SQZ3Hq}ZRds%IM*PtM$wV z@;rlc*NRK7i3y5BETSKuumEN`Xu_8GP1Ri=OKQ$@I^ko8>H6)4rjiG5{VBM>B|%`&&s^)jS|-_95&yc=GqjNo{zFkw%%HHhS~e=s zD#sfS+-?*t|J!+ozP6KvtOl!R)@@-z24}`9{QaVLD^9VCSR2b`b!KC#o;Ki<+wXB6 zx3&O0LOWcg4&rv4QG0)4yb}7BFSEg~=IR5#ZRj8kg}dS7_V&^%#Do==#`u zpy6{ox?jWuR(;pg+f@mT>#HGWHAJRRDDDv~@(IDw&R>9643kK#HN`!1vBJHnC+RM&yIh8{gG2q zA%e*U3|N0XSRa~oX-3EAneep)@{h2vvd3Xvy$7og(sayr@95+e6~Xvi1tUqnIxoIH zVWo*OwYElb#uyW{Imam6f2rGbjR!Y3`#gPqkv57dB6K^wRGxc9B(t|aYDGS=m$&S!NmCtrMMaUg(c zc2qC=2Z`EEFMW-me5B)24AqF*bV5Dr-M5ig(l-WPS%CgaPzs6p_gnCIvTJ=Y<6!gT zVt@AfYCzjjsMEGi=rDQHo0yc;HqoRNnNFeWZgcm?f;cp(6CNylj36DoL(?TS7eU#+ z7&mfr#y))+CJOXQKUMZ7QIdS9@#-}7y2K1{8)cCt0~-X0O!O?Qx#E4Og+;A2SjalQ zs7r?qn0H044=sDN$SRG$arw~n=+T_DNdSrarmu)V6@|?1-ZB#hRn`uilTGPJ@fqEy zGt(f0B+^JDP&f=r{#Y_wi#AVDf-y!RIXU^0jXsFpf>=Ji*TeqSY!H~AMbJdCGLhC) zn7Rx+sXw6uYj;WRYrLd^5IZq@6JI1C^YkgnedZEYy<&4(z%Q$5yv#Boo{AH8n$a zhb4Y3PWdr269&?V%uI$xMcUrMzl=;w<_nm*qr=c3Rl@i5wWB;e-`t7D&c-mcQl7x! zZWB`UGcw=Y2=}~wzrfLx=uet<;m3~=8I~ZRuzvMQUQdr+yTV|ATf1Uuomr__nDf=X zZ3WYJtHp_ri(}SQAPjv+Y+0=fH4krOP@S&=zZ-t1jW1o@}z;xk8 z(Nz1co&El^HK^NrhVHa-_;&88vTU>_J33=%{if;BEY*J#1n59=07jrGQ#IP>@u#3A z;!q+E1Rj3ZJ+!4bq9F8PXJ@yMgZL;>&gYA0%_Kbi8?S=XGM~dnQZQ!yBSgcZhY96H zrWnU;k)qy`rX&&xlDyA%(a1Hhi5CWkmg(`Gb%m(HKi-7Z!LKGRP_B8@`7&hdDy5n= z`OIxqxiVfX@OX1p(mQu>0Ai*v_cTMiw4qRt3~NBvr9oBy0)r>w3p~V0SCm=An6@3n)>@z!|o-$HvDK z|3D2ZMJkLE5loMKl6R^ez@Zz%S$&mbeoqH5`Bb){Ei21q&VP)hWS2tjShfFtGE+$z zzCR$P#uktu+#!w)cX!lWN1XU%K-r=s{|j?)Akf@q#3b#{6cZCuJ~gCxuMXRmI$nGtnH+-h z+GEi!*X=AP<|fG`1>MBdTb?28JYc=fGvAi2I<$B(rs$;eoJCyR6_bc~p!XR@O-+sD z=eH`-ye})I5ic1eL~TDmtfJ|8`0VJ*Yr=hNCd)G1p2MMz4C3^Mj?7;!w|Ly%JqmuW zlIEW^Ft%z?*|fpXda>Jr^1noFZEwFgVV%|*XhH@acv8rdGxeEX{M$(vG{Zw+x(ei@ zmfXb22}8-?Fi`vo-YVrTH*C?a8%M=Hv9MqVH7H^J$KsD?>!SFZ;ZsvnHr_gn=7acz z#W?0eCdVhVMWN12VV^$>WlQ?f;P^{(&pYTops|btm6aj>_Uz+hqpGwB)vWp0Cf5y< zft8-je~nn?W11plq}N)4A{l8I7$!ks_x$PXW-2XaRFswX_BnF{R#6YIwMhAgd5F9X zGmwdadS6(a^fjHtXg8=l?Rc0Sm%hk6E9!5cLVloEy4eh(=FwgP`)~I^5~pBEWo+F6 zSf2ncyMurJN91#cJTy_u8Y}@%!bq1RkGC~-bV@SXRd4F{R-*V`bS+6;W5vZ(&+I<9$;-V|eNfLa5n-6% z2(}&uGRF;p92eS*sE*oR$@pexaqr*meB)VhmIg@h{uzkk$9~qh#cHhw#>O%)b@+(| z^IQgqzuj~Sk(J;swEM-3TrJAPCq9k^^^`q{IItKBRXYe}e0Tdr=Huf7da3$l4PdpwWDop%^}n;dD#K4s#DYA8SHZ z&1!riV4W4R7R#C))JH1~axJ)RYnM$$lIR%6fIVA@zV{XVyx}C+a-Dt8Y9M)^KU0+H zR4IUb2CJ{Hg>CuaXtD50jB(_Tcx=Z$^WYu2u5kubqmwp%drJ6 z?Fo40g!Qd<-l=TQxqHEOuPX0;^z7iX?Ke^a%XT<13TA^5`4Xcw6D@Ur&VT&CUe0d} z1GjOVF1^L@>O)l@?bD~$wzgf(nxX1OGD8fEV?TdJcZc2KoUe|oP1#=$$7ee|xbY)A zDZq+cuTpc(fFdj^=!;{k03C69lMQ(|>uhRfRu%+!k&YOi-3|1QKB z z?n?eq1XP>p-IM$Z^C;2L3itnbJZAip*Zo0aw2bs8@(s^~*8T9go!%dHcAz2lM;`yp zD=7&xjFV$S&5uDaiScyD?B-i1ze`+CoRtz`Wn+Zl&#s4&}MO{@N!ufrzjG$B79)Y2d3tBk&)TxUTw@QS0TEL_?njX|@vq?Uz(nBFK5Pq7*xj#u*R&i|?7+6# z+|r_n#SW&LXhtheZdah{ZVoqwyT{D>MC3nkFF#N)xLi{p7J1jXlmVeb;cP5?e(=f# zuT7fvjSbjS781v?7{)-X3*?>tq?)Yd)~|1{BDS(pqC zC}~H#WXlkUW*H5CDOo<)#x7%RY)A;ShGhI5s*#cRDA8YgqG(HeKDx+#(ZQ?386dv! zlXCO)w91~Vw4AmOcATuV653fa9R$fyK8ul%rG z-wfS zihugoZyr38Im?Zuh6@RcF~t1anQu7>#lPpb#}4cOA!EM11`%f*07RqOVkmX{p~KJ9 z^zP;K#|)$`^Rb{rnHGH{~>1(fawV0*Z#)}M`m8-?ZJV<+e}s9wE# z)l&az?w^5{)`S(%MRzxdNqrs1n*-=jS^_jqE*5XDrA0+VE`5^*p3CuM<&dZEeCjoz zR;uu_H9ZPZV|fQq`Cyw4nscrVwi!fE6ciMmX$!_hN7uF;jjKG)d2@aC4ropY)8etW=xJvni)8eHi`H$%#zn^WJ5NLc-rqk|u&&4Z6fD_m&JfSI1Bvb?b<*n&sfl0^t z=HnmRl`XrFvMKB%9}>PaA`m-fK6a0(8=qPkWS5bb4=v?XcWi&hRY?O5HdulRi4?fN zlsJ*N-0Qw+Yic@s0(2uy%F@ib;GjXt01Fmx5XbRo6+n|pP(&nodMoap^z{~q ziEeaUT@Mxe3vJSfI6?uLND(CNr=#^W<1b}jzW58bIfyWTDle$mmS(|x-0|2UlX+9k zQ^EX7Nw}?EzVoBfT(-LT|=9N@^hcn-_p&sqG z&*oVs2JSU+N4ZD`FhCAWaS;>|wH2G*Id|?pa#@>tyxX`+4HyIArWDvVrX)2WAOQff z0qyHu&-S@i^MS-+j--!pr4fPBj~_8({~e1bfcl0wI1kaoN>mJL6KUPQm5N7lB(ui1 zE-o%kq)&djzWJ}ob<-GfDlkB;F31j-VHKvQUGQ3sp`CwyGJk_i!y^sD0fqC@$9|jO zOqN!r!8-p==F@ZVP=U$qSpY(gQ0)59P1&t@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/kpi_dashboard_altair/static/description/index.html b/kpi_dashboard_altair/static/description/index.html new file mode 100644 index 00000000..9aa5094a --- /dev/null +++ b/kpi_dashboard_altair/static/description/index.html @@ -0,0 +1,456 @@ + + + + + + +Kpi Dashboard Altair + + + +
+

Kpi Dashboard Altair

+ + +

Beta License: AGPL-3 OCA/reporting-engine Translate me on Weblate Try me on Runbot

+

Define KPI graphs using altair

+

Table of contents

+ +
+

Configuration

+
+

Configure KPIs

+
    +
  1. Access Dashboards > Configuration > KPI Dashboards > Configure KPI
  2. +
  3. Create a new kpi with widget altair
  4. +
+

You need to define a function like:

+
+import pandas
+import altair
+
+
+class Kpi(models.Model):
+    _inherit = 'kpi.kpi'
+
+    def test_demo_altair(self):
+        source = pandas.DataFrame(
+            {
+                "a": ["A", "B", "C", "D", "E", "F", "G", "H", "I"],
+                "b": [28, 55, 43, 91, 81, 53, 19, 87, 52],
+            }
+        )
+        chart = altair.Chart(source).mark_bar().encode(x="a", y="b")
+        return {"altair": json.loads(chart.to_json())}
+
+

You can use code in a similar way, as pandas and altair are already defined +when using code on an altair widget.

+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Creu Blanca
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

etobella

+

This module is part of the OCA/reporting-engine project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/kpi_dashboard_altair/static/lib/vega/vega-embed.min.js b/kpi_dashboard_altair/static/lib/vega/vega-embed.min.js new file mode 100644 index 00000000..21cfd6a3 --- /dev/null +++ b/kpi_dashboard_altair/static/lib/vega/vega-embed.min.js @@ -0,0 +1,26 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vega"),require("vega-lite")):"function"==typeof define&&define.amd?define(["vega","vega-lite"],t):(e=e||self).vegaEmbed=t(e.vega,e.vegaLite)}(this,(function(e,t){"use strict";var r="6.6.0"; +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ +function n(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))} +/*! + * https://github.com/Starcounter-Jack/JSON-Patch + * (c) 2017 Joachim Wester + * MIT license + */var o,i=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=Object.prototype.hasOwnProperty;function s(e,t){return a.call(e,t)}function l(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r=48&&t<=57))return!1;r++}return!0}function d(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function f(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u(e,t){var r=[e];for(var n in t){var o="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==o&&r.push(n+": "+o)}return r.join("\n")}var h=function(e){function t(t,r,n,o,i){var a=this.constructor,s=e.call(this,u(t,{name:r,index:n,operation:o,tree:i}))||this;return s.name=r,s.index=n,s.operation=o,s.tree=i,Object.setPrototypeOf(s,a.prototype),s.message=u(t,{name:r,index:n,operation:o,tree:i}),s}return i(t,e),t}(Error),v=h,g=c,m={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=b(r,this.path);n&&(n=c(n));var o=y(r,{op:"remove",path:this.from}).removed;return y(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=b(r,this.from);return y(r,{op:"add",path:this.path,value:c(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:A(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},E={add:function(e,t,r){return p(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:m.move,copy:m.copy,test:m.test,_get:m._get};function b(e,t){if(""==t)return e;var r={op:"_get",path:t};return y(e,r),r.value}function y(e,t,r,n,o,i){if(void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!0),void 0===i&&(i=0),r&&("function"==typeof r?r(t,0,e,t.path):w(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=b(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=A(e,t.value),!1===a.test)throw new v("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(r)throw new v("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}n||(e=c(e));var s=(t.path||"").split("/"),l=e,d=1,u=s.length,h=void 0,g=void 0,y=void 0;for(y="function"==typeof r?r:w;;){if(g=s[d],o&&"__proto__"==g)throw new TypeError("JSON-Patch: modifying `__proto__` 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(r&&void 0===h&&(void 0===l[g]?h=s.slice(0,d).join("/"):d==u-1&&(h=t.path),void 0!==h&&y(t,0,e,h)),d++,Array.isArray(l)){if("-"===g)g=l.length;else{if(r&&!p(g))throw new v("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",i,t,e);p(g)&&(g=~~g)}if(d>=u){if(r&&"add"===t.op&&g>l.length)throw new v("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);if(!1===(a=E[t.op].call(t,l,g,e)).test)throw new v("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(g&&-1!=g.indexOf("~")&&(g=f(g)),d>=u){if(!1===(a=m[t.op].call(t,l,g,e)).test)throw new v("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}l=l[g]}}function O(e,t,r,n,o){if(void 0===n&&(n=!0),void 0===o&&(o=!0),r&&!Array.isArray(t))throw new v("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=c(e));for(var i=new Array(t.length),a=0,s=t.length;a0)throw new v('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new v("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new v("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&function e(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var r=0,n=t.length;r0&&(e.patches=[],e.callback&&e.callback(n)),n}function S(e,t,r,n,o){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var i=l(t),a=l(e),p=!1,f=a.length-1;f>=0;f--){var u=e[v=a[f]];if(!s(t,v)||void 0===t[v]&&void 0!==u&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+d(v),value:c(u)}),r.push({op:"remove",path:n+"/"+d(v)}),p=!0):(o&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}));else{var h=t[v];"object"==typeof u&&null!=u&&"object"==typeof h&&null!=h?S(u,h,r,n+"/"+d(v),o):u!==h&&(o&&r.push({op:"test",path:n+"/"+d(v),value:c(u)}),r.push({op:"replace",path:n+"/"+d(v),value:c(h)}))}}if(p||i.length!=a.length)for(f=0;f0)return[g,r+c.join(",\n"+h),s].join("\n"+i)}return m}(e,"",0)};function F(e,t){return e(t={exports:{}},t.exports),t.exports}var P={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16};var _="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{},k=F((function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r}=P,n=(t=e.exports={}).re=[],o=t.src=[],i=t.t={};let a=0;const s=(e,t,r)=>{const s=a++;_(s,t),i[e]=s,o[s]=t,n[s]=new RegExp(t,r?"g":void 0)};s("NUMERICIDENTIFIER","0|[1-9]\\d*"),s("NUMERICIDENTIFIERLOOSE","[0-9]+"),s("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),s("MAINVERSION",`(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})\\.(${o[i.NUMERICIDENTIFIER]})`),s("MAINVERSIONLOOSE",`(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})\\.(${o[i.NUMERICIDENTIFIERLOOSE]})`),s("PRERELEASEIDENTIFIER",`(?:${o[i.NUMERICIDENTIFIER]}|${o[i.NONNUMERICIDENTIFIER]})`),s("PRERELEASEIDENTIFIERLOOSE",`(?:${o[i.NUMERICIDENTIFIERLOOSE]}|${o[i.NONNUMERICIDENTIFIER]})`),s("PRERELEASE",`(?:-(${o[i.PRERELEASEIDENTIFIER]}(?:\\.${o[i.PRERELEASEIDENTIFIER]})*))`),s("PRERELEASELOOSE",`(?:-?(${o[i.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[i.PRERELEASEIDENTIFIERLOOSE]})*))`),s("BUILDIDENTIFIER","[0-9A-Za-z-]+"),s("BUILD",`(?:\\+(${o[i.BUILDIDENTIFIER]}(?:\\.${o[i.BUILDIDENTIFIER]})*))`),s("FULLPLAIN",`v?${o[i.MAINVERSION]}${o[i.PRERELEASE]}?${o[i.BUILD]}?`),s("FULL",`^${o[i.FULLPLAIN]}$`),s("LOOSEPLAIN",`[v=\\s]*${o[i.MAINVERSIONLOOSE]}${o[i.PRERELEASELOOSE]}?${o[i.BUILD]}?`),s("LOOSE",`^${o[i.LOOSEPLAIN]}$`),s("GTLT","((?:<|>)?=?)"),s("XRANGEIDENTIFIERLOOSE",o[i.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*"),s("XRANGEIDENTIFIER",o[i.NUMERICIDENTIFIER]+"|x|X|\\*"),s("XRANGEPLAIN",`[v=\\s]*(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:\\.(${o[i.XRANGEIDENTIFIER]})(?:${o[i.PRERELEASE]})?${o[i.BUILD]}?)?)?`),s("XRANGEPLAINLOOSE",`[v=\\s]*(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[i.XRANGEIDENTIFIERLOOSE]})(?:${o[i.PRERELEASELOOSE]})?${o[i.BUILD]}?)?)?`),s("XRANGE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAIN]}$`),s("XRANGELOOSE",`^${o[i.GTLT]}\\s*${o[i.XRANGEPLAINLOOSE]}$`),s("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),s("COERCERTL",o[i.COERCE],!0),s("LONETILDE","(?:~>?)"),s("TILDETRIM",`(\\s*)${o[i.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",s("TILDE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAIN]}$`),s("TILDELOOSE",`^${o[i.LONETILDE]}${o[i.XRANGEPLAINLOOSE]}$`),s("LONECARET","(?:\\^)"),s("CARETTRIM",`(\\s*)${o[i.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",s("CARET",`^${o[i.LONECARET]}${o[i.XRANGEPLAIN]}$`),s("CARETLOOSE",`^${o[i.LONECARET]}${o[i.XRANGEPLAINLOOSE]}$`),s("COMPARATORLOOSE",`^${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]})$|^$`),s("COMPARATOR",`^${o[i.GTLT]}\\s*(${o[i.FULLPLAIN]})$|^$`),s("COMPARATORTRIM",`(\\s*)${o[i.GTLT]}\\s*(${o[i.LOOSEPLAIN]}|${o[i.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",s("HYPHENRANGE",`^\\s*(${o[i.XRANGEPLAIN]})\\s+-\\s+(${o[i.XRANGEPLAIN]})\\s*$`),s("HYPHENRANGELOOSE",`^\\s*(${o[i.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[i.XRANGEPLAINLOOSE]})\\s*$`),s("STAR","(<|>)?=?\\s*\\*"),s("GTE0","^\\s*>=\\s*0.0.0\\s*$"),s("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}));k.re,k.src,k.t,k.tildeTrimReplace,k.caretTrimReplace,k.comparatorTrimReplace;const j=/^[0-9]+$/,z=(e,t)=>{const r=j.test(e),n=j.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:ez(t,e)};const{MAX_LENGTH:B,MAX_SAFE_INTEGER:G}=P,{re:U,t:X}=k,{compareIdentifiers:V}=M;class W{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof W){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>B)throw new TypeError(`version is longer than ${B} characters`);_("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?U[X.LOOSE]:U[X.FULL]);if(!r)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>G||this.major<0)throw new TypeError("Invalid major version");if(this.minor>G||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>G||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this}}var H=W;const{MAX_LENGTH:q}=P,{re:Y,t:J}=k;var Q=(e,t)=>{if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof H)return e;if("string"!=typeof e)return null;if(e.length>q)return null;if(!(t.loose?Y[J.LOOSE]:Y[J.FULL]).test(e))return null;try{return new H(e,t)}catch(e){return null}};var Z=(e,t)=>{const r=Q(e,t);return r?r.version:null};var K=(e,t)=>{const r=Q(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var ee=(e,t,r,n)=>{"string"==typeof r&&(n=r,r=void 0);try{return new H(e,r).inc(t,n).version}catch(e){return null}};var te=(e,t,r)=>new H(e,r).compare(new H(t,r));var re=(e,t,r)=>0===te(e,t,r);var ne=(e,t)=>{if(re(e,t))return null;{const r=Q(e),n=Q(t),o=r.prerelease.length||n.prerelease.length,i=o?"pre":"",a=o?"prerelease":"";for(const e in r)if(("major"===e||"minor"===e||"patch"===e)&&r[e]!==n[e])return i+e;return a}};var oe=(e,t)=>new H(e,t).major;var ie=(e,t)=>new H(e,t).minor;var ae=(e,t)=>new H(e,t).patch;var se=(e,t)=>{const r=Q(e,t);return r&&r.prerelease.length?r.prerelease:null};var le=(e,t,r)=>te(t,e,r);var ce=(e,t)=>te(e,t,!0);var pe=(e,t,r)=>{const n=new H(e,r),o=new H(t,r);return n.compare(o)||n.compareBuild(o)};var de=(e,t)=>e.sort((e,r)=>pe(e,r,t));var fe=(e,t)=>e.sort((e,r)=>pe(r,e,t));var ue=(e,t,r)=>te(e,t,r)>0;var he=(e,t,r)=>te(e,t,r)<0;var ve=(e,t,r)=>0!==te(e,t,r);var ge=(e,t,r)=>te(e,t,r)>=0;var me=(e,t,r)=>te(e,t,r)<=0;var Ee=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return re(e,r,n);case"!=":return ve(e,r,n);case">":return ue(e,r,n);case">=":return ge(e,r,n);case"<":return he(e,r,n);case"<=":return me(e,r,n);default:throw new TypeError("Invalid operator: "+t)}};const{re:be,t:ye}=k;var Oe=(e,t)=>{if(e instanceof H)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=be[ye.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),be[ye.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;be[ye.COERCERTL].lastIndex=-1}else r=e.match(be[ye.COERCE]);return null===r?null:Q(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)};class we{constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof we)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new we(e.raw,t);if(e instanceof Xe)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=this.options.loose;e=e.trim();const r=t?Ae[Re.HYPHENRANGELOOSE]:Ae[Re.HYPHENRANGE];e=e.replace(r,Me(this.options.includePrerelease)),_("hyphen replace",e),e=e.replace(Ae[Re.COMPARATORTRIM],Ne),_("comparator trim",e,Ae[Re.COMPARATORTRIM]),e=(e=(e=e.replace(Ae[Re.TILDETRIM],$e)).replace(Ae[Re.CARETTRIM],Te)).split(/\s+/).join(" ");const n=t?Ae[Re.COMPARATORLOOSE]:Ae[Re.COMPARATOR];return e.split(" ").map(e=>Se(e,this.options)).join(" ").split(/\s+/).map(e=>ze(e,this.options)).filter(this.options.loose?e=>!!e.match(n):()=>!0).map(e=>new Xe(e,this.options))}intersects(e,t){if(!(e instanceof we))throw new TypeError("a Range is required");return this.set.some(r=>Le(r,t)&&e.set.some(e=>Le(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new H(e,this.options)}catch(e){return!1}for(let t=0;t{let r=!0;const n=e.slice();let o=n.pop();for(;r&&n.length;)r=n.every(e=>o.intersects(e,t)),o=n.pop();return r},Se=(e,t)=>(_("comp",e,t),e=Fe(e,t),_("caret",e),e=xe(e,t),_("tildes",e),e=_e(e,t),_("xrange",e),e=je(e,t),_("stars",e),e),Ce=e=>!e||"x"===e.toLowerCase()||"*"===e,xe=(e,t)=>e.trim().split(/\s+/).map(e=>De(e,t)).join(" "),De=(e,t)=>{const r=t.loose?Ae[Re.TILDELOOSE]:Ae[Re.TILDE];return e.replace(r,(t,r,n,o,i)=>{let a;return _("tilde",e,t,r,n,o,i),Ce(r)?a="":Ce(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:Ce(o)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:i?(_("replaceTilde pr",i),a=`>=${r}.${n}.${o}-${i} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${o} <${r}.${+n+1}.0-0`,_("tilde return",a),a})},Fe=(e,t)=>e.trim().split(/\s+/).map(e=>Pe(e,t)).join(" "),Pe=(e,t)=>{_("caret",e,t);const r=t.loose?Ae[Re.CARETLOOSE]:Ae[Re.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(t,r,o,i,a)=>{let s;return _("caret",e,t,r,o,i,a),Ce(r)?s="":Ce(o)?s=`>=${r}.0.0${n} <${+r+1}.0.0-0`:Ce(i)?s="0"===r?`>=${r}.${o}.0${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.0${n} <${+r+1}.0.0-0`:a?(_("replaceCaret pr",a),s="0"===r?"0"===o?`>=${r}.${o}.${i}-${a} <${r}.${o}.${+i+1}-0`:`>=${r}.${o}.${i}-${a} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${i}-${a} <${+r+1}.0.0-0`):(_("no pr"),s="0"===r?"0"===o?`>=${r}.${o}.${i}${n} <${r}.${o}.${+i+1}-0`:`>=${r}.${o}.${i}${n} <${r}.${+o+1}.0-0`:`>=${r}.${o}.${i} <${+r+1}.0.0-0`),_("caret return",s),s})},_e=(e,t)=>(_("replaceXRanges",e,t),e.split(/\s+/).map(e=>ke(e,t)).join(" ")),ke=(e,t)=>{e=e.trim();const r=t.loose?Ae[Re.XRANGELOOSE]:Ae[Re.XRANGE];return e.replace(r,(r,n,o,i,a,s)=>{_("xRange",e,r,n,o,i,a,s);const l=Ce(o),c=l||Ce(i),p=c||Ce(a),d=p;return"="===n&&d&&(n=""),s=t.includePrerelease?"-0":"",l?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(c&&(i=0),a=0,">"===n?(n=">=",c?(o=+o+1,i=0,a=0):(i=+i+1,a=0)):"<="===n&&(n="<",c?o=+o+1:i=+i+1),"<"===n&&(s="-0"),r=`${n+o}.${i}.${a}${s}`):c?r=`>=${o}.0.0${s} <${+o+1}.0.0-0`:p&&(r=`>=${o}.${i}.0${s} <${o}.${+i+1}.0-0`),_("xRange return",r),r})},je=(e,t)=>(_("replaceStars",e,t),e.trim().replace(Ae[Re.STAR],"")),ze=(e,t)=>(_("replaceGTE0",e,t),e.trim().replace(Ae[t.includePrerelease?Re.GTE0PRE:Re.GTE0],"")),Me=e=>(t,r,n,o,i,a,s,l,c,p,d,f,u)=>`${r=Ce(n)?"":Ce(o)?`>=${n}.0.0${e?"-0":""}`:Ce(i)?`>=${n}.${o}.0${e?"-0":""}`:a?">="+r:`>=${r}${e?"-0":""}`} ${l=Ce(c)?"":Ce(p)?`<${+c+1}.0.0-0`:Ce(d)?`<${c}.${+p+1}.0-0`:f?`<=${c}.${p}.${d}-${f}`:e?`<${c}.${p}.${+d+1}-0`:"<="+l}`.trim(),Be=(e,t,r)=>{for(let r=0;r0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0},Ge=Symbol("SemVer ANY");class Ue{static get ANY(){return Ge}constructor(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof Ue){if(e.loose===!!t.loose)return e;e=e.value}_("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ge?this.value="":this.value=this.operator+this.semver.version,_("comp",this)}parse(e){const t=this.options.loose?Ve[We.COMPARATORLOOSE]:Ve[We.COMPARATOR],r=e.match(t);if(!r)throw new TypeError("Invalid comparator: "+e);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new H(r[2],this.options.loose):this.semver=Ge}toString(){return this.value}test(e){if(_("Comparator.test",e,this.options.loose),this.semver===Ge||e===Ge)return!0;if("string"==typeof e)try{e=new H(e,this.options)}catch(e){return!1}return Ee(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Ue))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new Ie(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new Ie(this.value,t).test(e.semver);const r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),n=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),o=this.semver.version===e.semver.version,i=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=Ee(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=Ee(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||n||o&&i||a||s}}var Xe=Ue;const{re:Ve,t:We}=k;var He=(e,t,r)=>{try{t=new Ie(t,r)}catch(e){return!1}return t.test(e)};var qe=(e,t)=>new Ie(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "));var Ye=(e,t,r)=>{let n=null,o=null,i=null;try{i=new Ie(t,r)}catch(e){return null}return e.forEach(e=>{i.test(e)&&(n&&-1!==o.compare(e)||(n=e,o=new H(n,r)))}),n};var Je=(e,t,r)=>{let n=null,o=null,i=null;try{i=new Ie(t,r)}catch(e){return null}return e.forEach(e=>{i.test(e)&&(n&&1!==o.compare(e)||(n=e,o=new H(n,r)))}),n};var Qe=(e,t)=>{e=new Ie(e,t);let r=new H("0.0.0");if(e.test(r))return r;if(r=new H("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t{const t=new H(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":r&&!ue(r,t)||(r=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}})}return r&&e.test(r)?r:null};var Ze=(e,t)=>{try{return new Ie(e,t).range||"*"}catch(e){return null}};const{ANY:Ke}=Xe;var et=(e,t,r,n)=>{let o,i,a,s,l;switch(e=new H(e,n),t=new Ie(t,n),r){case">":o=ue,i=me,a=he,s=">",l=">=";break;case"<":o=he,i=ge,a=ue,s="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(He(e,t,n))return!1;for(let r=0;r{e.semver===Ke&&(e=new Xe(">=0.0.0")),p=p||e,d=d||e,o(e.semver,p.semver,n)?p=e:a(e.semver,d.semver,n)&&(d=e)}),p.operator===s||p.operator===l)return!1;if((!d.operator||d.operator===s)&&i(e,d.semver))return!1;if(d.operator===l&&a(e,d.semver))return!1}return!0};var tt=(e,t,r)=>et(e,t,">",r);var rt=(e,t,r)=>et(e,t,"<",r);var nt=(e,t,r)=>(e=new Ie(e,r),t=new Ie(t,r),e.intersects(t));const{ANY:ot}=Xe,it=(e,t,r)=>{if(1===e.length&&e[0].semver===ot)return 1===t.length&&t[0].semver===ot;const n=new Set;let o,i,a,s,l,c,p;for(const t of e)">"===t.operator||">="===t.operator?o=at(o,t,r):"<"===t.operator||"<="===t.operator?i=st(i,t,r):n.add(t.semver);if(n.size>1)return null;if(o&&i){if(a=te(o.semver,i.semver,r),a>0)return null;if(0===a&&(">="!==o.operator||"<="!==i.operator))return null}for(const e of n){if(o&&!He(e,String(o),r))return null;if(i&&!He(e,String(i),r))return null;for(const n of t)if(!He(e,String(n),r))return!1;return!0}for(const e of t){if(p=p||">"===e.operator||">="===e.operator,c=c||"<"===e.operator||"<="===e.operator,o)if(">"===e.operator||">="===e.operator){if(s=at(o,e,r),s===e)return!1}else if(">="===o.operator&&!He(o.semver,String(e),r))return!1;if(i)if("<"===e.operator||"<="===e.operator){if(l=st(i,e,r),l===e)return!1}else if("<="===i.operator&&!He(i.semver,String(e),r))return!1;if(!e.operator&&(i||o)&&0!==a)return!1}return!(o&&c&&!i&&0!==a)&&!(i&&p&&!o&&0!==a)},at=(e,t,r)=>{if(!e)return t;const n=te(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},st=(e,t,r)=>{if(!e)return t;const n=te(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};var lt,ct=(e,t,r)=>{e=new Ie(e,r),t=new Ie(t,r);let n=!1;e:for(const o of e.set){for(const e of t.set){const t=it(o,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0},pt={re:k.re,src:k.src,tokens:k.t,SEMVER_SPEC_VERSION:P.SEMVER_SPEC_VERSION,SemVer:H,compareIdentifiers:M.compareIdentifiers,rcompareIdentifiers:M.rcompareIdentifiers,parse:Q,valid:Z,clean:K,inc:ee,diff:ne,major:oe,minor:ie,patch:ae,prerelease:se,compare:te,rcompare:le,compareLoose:ce,compareBuild:pe,sort:de,rsort:fe,gt:ue,lt:he,eq:re,neq:ve,gte:ge,lte:me,cmp:Ee,coerce:Oe,Comparator:Xe,Range:Ie,satisfies:He,toComparators:qe,maxSatisfying:Ye,minSatisfying:Je,minVersion:Qe,validRange:Ze,outside:et,gtr:tt,ltr:rt,intersects:nt,simplifyRange:(e,t,r)=>{const n=[];let o=null,i=null;const a=e.sort((e,t)=>te(e,t,r));for(const e of a){He(e,t,r)?(i=e,o||(o=e)):(i&&n.push([o,i]),i=null,o=null)}o&&n.push([o,null]);const s=[];for(const[e,t]of n)e===t?s.push(e):t||e!==a[0]?t?e===a[0]?s.push("<="+t):s.push(`${e} - ${t}`):s.push(">="+e):s.push("*");const l=s.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.lengtht&&c(),a=t=r+1):"]"===n&&(a||Ct("Access path missing open bracket: "+e),a>0&&c(),a=0,t=r+1):r>t?c():t=r+1}return a&&Ct("Access path missing closing bracket: "+e),i&&Ct("Access path missing closing quote: "+e),r>t&&(r++,c()),o}(e),n="return _["+r.map(Pt).join("][")+"];";St(Function("_",n),[e=1===r.length?r[0]:e],t||e)})("id"),St((function(e){return e}),_t,"identity"),St((function(){return 0}),_t,"zero"),St((function(){return 1}),_t,"one"),St((function(){return!0}),_t,"true"),St((function(){return!1}),_t,"false");const kt=e=>"__proto__"!==e;function jt(...e){return e.reduce((e,t)=>{for(var r in t)if("signals"===r)e.signals=Mt(e.signals,t.signals);else{var n="legend"===r?{layout:1}:"style"===r||null;zt(e,r,t[r],n)}return e},{})}function zt(e,t,r,n){var o,i;if(kt(t))if(Dt(r)&&!xt(r))for(o in i=Dt(e[t])?e[t]:e[t]={},r)n&&(!0===n||n[o])?zt(i,o,r[o]):kt(o)&&(i[o]=r[o]);else e[t]=r}function Mt(e,t){if(null==e)return t;const r={},n=[];function o(e){r[e.name]||(r[e.name]=1,n.push(e))}return t.forEach(o),e.forEach(o),n}var Bt=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);oe?"[Object]":t.indexOf(n)>=0?"[Circular]":(t.push(n),n)}}(t))}class Ut{constructor(e){this.options=Object.assign(Object.assign({},Lt),e);const t=this.options.id;if(this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return $t.toString().replace(Tt,e)}(t);const r=document.head;r.childNodes.length>0?r.insertBefore(e,r.childNodes[0]):r.appendChild(e)}this.el=document.getElementById(t),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",t),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el))}tooltipHandler(e,t,r,n){if(null==n||""===n)return void this.el.classList.remove("visible",this.options.theme+"-theme");this.el.innerHTML=function(e,t,r){if(xt(e))return`[${e.map(e=>t(Ft(e)?e:Gt(e,r))).join(", ")}]`;if(Dt(e)){let n="";const o=e,{title:i}=o,a=Bt(o,["title"]);i&&(n+=`

${t(i)}

`);const s=Object.keys(a);if(s.length>0){n+="";for(const e of s){let o=a[e];void 0!==o&&(Dt(o)&&(o=Gt(o,r)),n+=``)}n+="
${t(e)}:${t(o)}
"}return n||"{}"}return t(e)}(n,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",this.options.theme+"-theme");const{x:o,y:i}=function(e,t,r,n){let o=e.clientX+r;o+t.width>window.innerWidth&&(o=+e.clientX-r-t.width);let i=e.clientY+n;return i+t.height>window.innerHeight&&(i=+e.clientY-n-t.height),{x:o,y:i}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style",`top: ${i}px; left: ${o}px`)}}var Xt,Vt='.vega-embed {\n position: relative;\n display: inline-block; }\n .vega-embed.has-actions {\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\n .vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n outline: none;\n cursor: pointer;\n line-height: 0px; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset; }\n .vega-embed summary svg {\n width: 14px;\n height: 14px; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n text-align: left; }\n .vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none; }\n .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: scroll;\n padding-right: 14px; }\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6); }\n to {\n opacity: 1;\n transform: scale(1); } }\n';function Wt(e,...t){for(const r of t)Ht(e,r);return e}function Ht(t,r){for(const n of Object.keys(r))e.writeConfig(t,n,r[n],!0)}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e});const qt=e;let Yt=t;const Jt="undefined"!=typeof window?window:void 0;void 0===Yt&&(null===(Xt=null==Jt?void 0:Jt.vl)||void 0===Xt?void 0:Xt.compile)&&(Yt=Jt.vl);const Qt={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},Zt={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"},Kt={vega:"Vega","vega-lite":"Vega-Lite"},er={vega:qt.version,"vega-lite":Yt?Yt.version:"not available"},tr={vega:e=>e,"vega-lite":(e,t)=>Yt.compile(e,{config:t}).spec};function rr(e,t,r,n){const o=`${t}
`,i=`
${r}`,a=window.open("");a.document.write(o+e+i),a.document.title=Kt[n]+" JSON Source"}function nr(e,t,r={}){var o,i,a;return n(this,void 0,void 0,(function*(){const s=(l=r.loader)&&"load"in l?r.loader:qt.loader(r.loader);var l;const c=Ft(t)?JSON.parse(yield s.load(t)):t,p=yield or(null!==(o=c.usermeta&&c.usermeta.embedOptions)&&void 0!==o?o:{},s),d=yield or(r,s),f=Object.assign(Object.assign({},Wt(d,p)),{config:jt(null!==(i=d.config)&&void 0!==i?i:{},null!==(a=p.config)&&void 0!==a?a:{})});return yield function(e,t,r={},o){var i,a,s,l,c,p;return n(this,void 0,void 0,(function*(){const d=r.theme?jt(Nt[r.theme],null!==(i=r.config)&&void 0!==i?i:{}):r.config,f="boolean"==typeof r.actions?r.actions:Wt({},Qt,null!==(a=r.actions)&&void 0!==a?a:{});const u=Object.assign(Object.assign({},Zt),r.i18n),h=null!==(s=r.renderer)&&void 0!==s?s:"canvas",v=null!==(l=r.logLevel)&&void 0!==l?l:qt.Warn,g=null!==(c=r.downloadFileName)&&void 0!==c?c:"visualization";if(!1!==r.defaultStyle){const e="vega-embed-style";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerText=void 0===r.defaultStyle||!0===r.defaultStyle?Vt.toString():r.defaultStyle,document.head.appendChild(t)}}const m=function(e,t){var r;if(e.$schema){const n=ft(e.$schema);t&&t!==n.library&&console.warn(`The given visualization spec is written in ${Kt[n.library]}, but mode argument sets ${null!==(r=Kt[t])&&void 0!==r?r:t}.`);const o=n.library;return pt(er[o],"^"+n.version.slice(1))||console.warn(`The input spec uses ${Kt[o]} ${n.version}, but the current version of ${Kt[o]} is v${er[o]}.`),o}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":null!=t?t:"vega"}(t,r.mode);let E=tr[m](t,d);if("vega-lite"===m&&E.$schema){const e=ft(E.$schema);pt(er.vega,"^"+e.version.slice(1))||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${er.vega}.`)}const b="string"==typeof e?document.querySelector(e):e;if(!b)throw Error(e+" does not exist");b.classList.add("vega-embed"),f&&b.classList.add("has-actions"),b.innerHTML="";const y=r.patch;y&&(E=y instanceof Function?y(E):O(E,y,!0,!1).newDocument),r.formatLocale&&qt.formatLocale(r.formatLocale),r.timeFormatLocale&&qt.timeFormatLocale(r.timeFormatLocale);const w=qt.parse(E,"vega-lite"===m?{}:d),I=new qt.View(w,{loader:o,logLevel:v,renderer:h});if(!1!==r.tooltip){let e;e="function"==typeof r.tooltip?r.tooltip:new Ut(!0===r.tooltip?{}:r.tooltip).call,I.tooltip(e)}let A,{hover:R}=r;if(void 0===R&&(R="vega"===m),R){const{hoverSet:e,updateSet:t}="boolean"==typeof R?{}:R;I.hover(e,t)}if(r&&(null!=r.width&&I.width(r.width),null!=r.height&&I.height(r.height),null!=r.padding&&I.padding(r.padding)),yield I.initialize(e).runAsync(),!1!==f){let e=b;if(!1!==r.defaultStyle){const t=document.createElement("details");t.title=u.CLICK_TO_VIEW_ACTIONS,b.append(t),e=t;const r=document.createElement("summary");r.innerHTML='\n\n \n \n \n',t.append(r),A=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",A)}const o=document.createElement("div");if(e.append(o),o.classList.add("vega-actions"),!0===f||!1!==f.export)for(const e of["svg","png"])if(!0===f||!0===f.export||f.export[e]){const t=u[e.toUpperCase()+"_ACTION"],i=document.createElement("a");i.text=t,i.href="#",i.target="_blank",i.download=`${g}.${e}`,i.addEventListener("mousedown",(function(t){return n(this,void 0,void 0,(function*(){t.preventDefault();const n=yield I.toImageURL(e,r.scaleFactor);this.href=n}))})),o.append(i)}if(!0===f||!1!==f.source){const e=document.createElement("a");e.text=u.SOURCE_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var n,o;rr(D(t),null!==(n=r.sourceHeader)&&void 0!==n?n:"",null!==(o=r.sourceFooter)&&void 0!==o?o:"",m),e.preventDefault()})),o.append(e)}if("vega-lite"===m&&(!0===f||!1!==f.compiled)){const e=document.createElement("a");e.text=u.COMPILED_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var t,n;rr(D(E),null!==(t=r.sourceHeader)&&void 0!==t?t:"",null!==(n=r.sourceFooter)&&void 0!==n?n:"","vega"),e.preventDefault()})),o.append(e)}if(!0===f||!1!==f.editor){const e=null!==(p=r.editorUrl)&&void 0!==p?p:"https://vega.github.io/editor/",n=document.createElement("a");n.text=u.EDITOR_ACTION,n.href="#",n.addEventListener("mousedown",(function(r){!function(e,t,r){const n=e.open(t);let o=40;e.addEventListener("message",(function t(r){r.source===n&&(o=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){o<=0||(n.postMessage(r,"*"),setTimeout(e,250),o-=1)}),250)}(window,e,{config:d,mode:m,renderer:h,spec:D(t)}),r.preventDefault()})),o.append(n)}}return{view:I,spec:t,vgSpec:E,finalize:function(){A&&document.removeEventListener("click",A),I.finalize()}}}))}(e,c,f,s)}))}function or(e,t){var r;return n(this,void 0,void 0,(function*(){const n=Ft(e.config)?JSON.parse(yield t.load(e.config)):null!==(r=e.config)&&void 0!==r?r:{},o=Ft(e.patch)?JSON.parse(yield t.load(e.patch)):e.patch;return Object.assign(Object.assign(Object.assign({},e),o?{patch:o}:{}),n?{config:n}:{})}))}function ir(e,t={}){var r;return n(this,void 0,void 0,(function*(){const n=document.createElement("div");n.classList.add("vega-embed-wrapper");const o=document.createElement("div");n.appendChild(o);const i=!0===t.actions||!1===t.actions?t.actions:Object.assign({export:!0,source:!1,compiled:!0,editor:!0},null!==(r=t.actions)&&void 0!==r?r:{}),a=yield nr(o,e,Object.assign({actions:i},null!=t?t:{}));return n.value=a.view,n}))}const ar=(...t)=>{return t.length>1&&(e.isString(t[0])&&!((r=t[0]).startsWith("http://")||r.startsWith("https://")||r.startsWith("//"))||t[0]instanceof HTMLElement||3===t.length)?nr(t[0],t[1],t[2]):ir(t[0],t[1]);var r};return ar.vegaLite=Yt,ar.vl=Yt,ar.container=ir,ar.embed=nr,ar.vega=qt,ar.default=nr,ar.version=r,ar})); diff --git a/kpi_dashboard_altair/static/lib/vega/vega-lite.min.js b/kpi_dashboard_altair/static/lib/vega/vega-lite.min.js new file mode 100644 index 00000000..15a7d835 --- /dev/null +++ b/kpi_dashboard_altair/static/lib/vega/vega-lite.min.js @@ -0,0 +1,15 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).vegaLite={})}(this,(function(e){"use strict";var t="4.0.2";function n(e,t,n){return e.fields=t||[],e.fname=n,e}function i(e){throw Error(e)}function r(e){var t,n,r,o=[],s=null,a=0,u=e.length,c="";function l(){o.push(c+e.substring(t,n)),c="",t=n+1}for(e+="",t=n=0;nt&&l(),a=t=n+1):"]"===r&&(a||i("Access path missing open bracket: "+e),a>0&&l(),a=0,t=n+1):n>t?l():t=n+1}return a&&i("Access path missing closing bracket: "+e),s&&i("Access path missing closing quote: "+e),n>t&&(n++,l()),o}var o=Array.isArray;function s(e){return e===Object(e)}function a(e){return"string"==typeof e}function u(e){return o(e)?"["+e.map(u)+"]":s(e)||a(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}var c=[],l=(function(e,t){var i=r(e),o="return _["+i.map(u).join("][")+"];";n(Function("_",o),[e=1===i.length?i[0]:e],t||e)}("id"),n((function(e){return e}),c,"identity"));n((function(){return 0}),c,"zero"),n((function(){return 1}),c,"one"),n((function(){return!0}),c,"true"),n((function(){return!1}),c,"false");function d(e,t,n){var i=[t].concat([].slice.call(n));console[e].apply(console,i)}var f=0,p=1,g=2,h=3,m=4;function b(...e){return e.reduce((e,t)=>{for(var n in t)if("signals"===n)e.signals=y(e.signals,t.signals);else{var i="legend"===n?{layout:1}:"style"===n||null;v(e,n,t[n],i)}return e},{})}function v(e,t,n,i){var r,a;if(s(n)&&!o(n))for(r in a=s(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?v(a,r,n[r]):a[r]=n[r];else e[t]=n}function y(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function x(e){return null!=e?o(e)?e:[e]:[]}const A=Object.prototype.hasOwnProperty;function O(e,t){return A.call(e,t)}function w(e){return"boolean"==typeof e}function F(e){return"number"==typeof e}function C(e){for(var t={},n=0,i=e.length;n$(e,t))}:E(e)?{or:e.or.map(e=>$(e,t))}:t(e)}const B=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;0!=r--;){var s=o[r];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n},N=j;function _(e,t){const n={};for(const i of t)O(e,i)&&(n[i]=e[i]);return n}function z(e,t){const n=Object.assign({},e);for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>D(e)).join(",")})`};const T=D;function P(e){if(F(e))return e;const t=a(e)?e:D(e);if(t.length<250)return t;let n=0;for(let e=0;e-1}function R(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function L(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function W(e,t){for(const n of Object.keys(t))v(e,n,t[n],!0)}function q(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 I(e,t){for(const n of e)if(t.has(n))return!0;return!1}function H(e){const t=new Set;for(const n of e){const e=r(n).map((e,t)=>0===t?e:`[${e}]`);e.map((t,n)=>e.slice(0,n+1).join("")).forEach(e=>t.add(e))}return t}function G(e,t){return void 0===e||void 0===t||I(H(e),H(t))}const Y=Object.keys;function V(e){const t=[];for(const n in e)O(e,n)&&t.push(e[n]);return t}function J(e){return!0===e||!1===e}function Q(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function X(e,t){return k(e)?"!("+X(e.not,t)+")":S(e)?"("+e.and.map(e=>X(e,t)).join(") && (")+")":E(e)?"("+e.or.map(e=>X(e,t)).join(") || (")+")":t(e)}function Z(e,t){if(0===t.length)return!0;const n=t.shift();return Z(e[n],t)&&delete e[n],0===Y(e).length}function K(e){return e.charAt(0).toUpperCase()+e.substr(1)}function ee(e,t="datum"){const n=r(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(u).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function te(e){return`${r(e).map(e=>ne(e,".","\\.")).join("\\.")}`}function ne(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function ie(e){return`${r(e).join(".")}`}function re(e){return e?r(e).length:0}function oe(...e){for(const t of e)if(void 0!==t)return t}let se=42;function ae(e){return(e%360+360)%360}const ue="area",ce="bar",le="image",de="line",fe="point",pe="rect",ge="rule",he="text",me="tick",be="trail",ve="circle",ye="square",xe="geoshape";function Ae(e){return U(["line","area","trail"],e)}function Oe(e){return U(["rect","bar","image"],e)}const we=Y({area:1,bar:1,image:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1});function Fe(e){return e.type}C(we);const Ce=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],je=["filled","color","tooltip","invalid","timeUnitBandPosition","timeUnitBand"],De={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},Ee={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function Se(e){return!!e.mark}class ke{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!Se(e)&&(Fe(t=e.mark)?t.type:t)===this.name;var t}} +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */function $e(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r1?"are":"is"} also specified.`},discreteChannelCannotEncode:function(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`},lineWithRange:function(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.`},orientOverridden:function(e,t){return`Specified orient "${e}" overridden with "${t}".`},CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:"Custom domain scale cannot be unioned with default field-based domain.",RANGE_STEP_DEPRECATED:'Scale\'s "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.',cannotUseScalePropertyWithNonColor:function(e){return`Cannot use the scale property "${e}" with non-color channel.`},unaggregateDomainHasNoEffectForRawField:function(e){return`Using unaggregated domain with raw field has no effect (${T(e)}).`},unaggregateDomainWithNonSharedDomainOp:function(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`},unaggregatedDomainWithLogScale:function(e){return`Unaggregated domain is currently unsupported for log scale (${T(e)}).`},cannotApplySizeToNonOrientedMark:function(e){return`Cannot apply size to non-oriented mark "${e}".`},scaleTypeNotWorkWithChannel:function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`},scaleTypeNotWorkWithFieldDef:function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`},scalePropertyNotWorkWithScaleType:function(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`},scaleTypeNotWorkWithMark:function(e,t){return`Scale type "${t}" does not work with mark "${e}".`},stepDropped:function(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`},mergeConflictingProperty:function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${T(n)} and ${T(i)}). Using ${T(n)}.`},mergeConflictingDomainProperty:function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${T(n)} and ${T(i)}). Using the union of the two domains.`},independentScaleMeansIndependentGuide:function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`},domainSortDropped:function(e){return`Dropping sort property ${T(e)} as unioned domains only support boolean or op "count", "min", and "max".`},UNABLE_TO_MERGE_DOMAINS:"Unable to merge domains.",MORE_THAN_ONE_SORT:"Domains that should be unioned has conflicting sort properties. Sort will be set to true.",INVALID_CHANNEL_FOR_AXIS:"Invalid channel for axis.",cannotStackRangedMark:function(e){return`Cannot stack "${e}" if there is already "${e}2".`},cannotStackNonLinearScale:function(e){return`Cannot stack non-linear scale (${e}).`},stackNonSummativeAggregate:function(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`},invalidTimeUnit:function(e,t){return`Invalid ${e}: ${T(t)}.`},dayReplacedWithDate:function(e){return`Time unit "${e}" is not supported. We are replacing it with ${ne(e,"day","date")}.`},droppedDay:function(e){return`Dropping day from datetime ${T(e)} as day cannot be combined with other units.`},errorBarCenterAndExtentAreNotNeeded:function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`},errorBarCenterIsUsedWithWrongExtent:function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`},errorBarContinuousAxisHasCustomizedAggregate:function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`},errorBarCenterIsNotNeeded:function(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`},errorBand1DNotSupport:function(e){return`1D error band does not support ${e}.`},channelRequiredForBinned:function(e){return`Channel ${e} is required for "binned" bin.`},domainRequiredForThresholdScale:function(e){return`Domain for ${e} is required for threshold scale.`}}),Gt=(Vt=g||f,{level:function(e){return arguments.length?(Vt=+e,this):Vt},error:function(){return Vt>=p&&d(Yt||"error","ERROR",arguments),this},warn:function(){return Vt>=g&&d(Yt||"warn","WARN",arguments),this},info:function(){return Vt>=h&&d(Yt||"log","INFO",arguments),this},debug:function(){return Vt>=m&&d(Yt||"log","DEBUG",arguments),this}});var Yt,Vt;let Jt=Gt;function Qt(...e){Jt.warn(...e)}const Xt=2006;function Zt(e){return!!(e&&(e.year||e.quarter||e.month||e.date||e.day||e.hours||e.minutes||e.seconds||e.milliseconds))}const Kt=["january","february","march","april","may","june","july","august","september","october","november","december"],en=Kt.map(e=>e.substr(0,3)),tn=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],nn=tn.map(e=>e.substr(0,3));function rn(e,t=!1,n=!1){const i=[];if(t&&void 0!==e.day&&Y(e).length>1&&(Qt(Ht.droppedDay(e)),delete(e=N(e)).day),void 0!==e.year?i.push(e.year):void 0!==e.day?i.push(Xt):i.push(0),void 0!==e.month){const n=t?function(e){if(F(e))return(e-1).toString();{const t=e.toLowerCase(),n=Kt.indexOf(t);if(-1!==n)return n+"";const i=t.substr(0,3),r=en.indexOf(i);if(-1!==r)return r+"";throw new Error(Ht.invalidTimeUnit("month",e))}}(e.month):e.month;i.push(n)}else if(void 0!==e.quarter){const n=t?function(e){if(F(e))return e>4&&Qt(Ht.invalidTimeUnit("quarter",e)),(e-1).toString();throw new Error(Ht.invalidTimeUnit("quarter",e))}(e.quarter):e.quarter;i.push(n+"*3")}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const n=t?function(e){if(F(e))return e%7+"";{const t=e.toLowerCase(),n=tn.indexOf(t);if(-1!==n)return n+"";const i=t.substr(0,3),r=nn.indexOf(i);if(-1!==r)return r+"";throw new Error(Ht.invalidTimeUnit("day",e))}}(e.day):e.day;i.push(n+"+1")}else i.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];i.push(void 0===n?0:n)}const r=i.join(", ");return n?e.utc?new Function(`return +new Date(Date.UTC(${r}))`)():new Function(`return +new Date(${r})`)():e.utc?`utc(${r})`:`datetime(${r})`}var on;!function(e){e.YEAR="year",e.MONTH="month",e.DAY="day",e.DATE="date",e.HOURS="hours",e.MINUTES="minutes",e.SECONDS="seconds",e.MILLISECONDS="milliseconds",e.YEARMONTH="yearmonth",e.YEARMONTHDATE="yearmonthdate",e.YEARMONTHDATEHOURS="yearmonthdatehours",e.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",e.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",e.MONTHDATE="monthdate",e.MONTHDATEHOURS="monthdatehours",e.HOURSMINUTES="hoursminutes",e.HOURSMINUTESSECONDS="hoursminutesseconds",e.MINUTESSECONDS="minutesseconds",e.SECONDSMILLISECONDS="secondsmilliseconds",e.QUARTER="quarter",e.YEARQUARTER="yearquarter",e.QUARTERMONTH="quartermonth",e.YEARQUARTERMONTH="yearquartermonth",e.UTCYEAR="utcyear",e.UTCMONTH="utcmonth",e.UTCDAY="utcday",e.UTCDATE="utcdate",e.UTCHOURS="utchours",e.UTCMINUTES="utcminutes",e.UTCSECONDS="utcseconds",e.UTCMILLISECONDS="utcmilliseconds",e.UTCYEARMONTH="utcyearmonth",e.UTCYEARMONTHDATE="utcyearmonthdate",e.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",e.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",e.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",e.UTCMONTHDATE="utcmonthdate",e.UTCMONTHDATEHOURS="utcmonthdatehours",e.UTCHOURSMINUTES="utchoursminutes",e.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",e.UTCMINUTESSECONDS="utcminutesseconds",e.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",e.UTCQUARTER="utcquarter",e.UTCYEARQUARTER="utcyearquarter",e.UTCQUARTERMONTH="utcquartermonth",e.UTCYEARQUARTERMONTH="utcyearquartermonth"}(on||(on={}));const sn={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},an=Y(sn);const un={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};const cn={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},ln=Object.assign(Object.assign({},un),cn);Object.assign(Object.assign(Object.assign(Object.assign({},sn),un),{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1}),cn);const dn={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function fn(e){return an.reduce((t,n)=>pn(e,n)?[...t,n]:t,[])}function pn(e,t){const n=e.indexOf(t);return n>-1&&(t!==on.SECONDS||0===n||"i"!==e.charAt(n-1))}function gn(e,t,{end:n}={end:!1}){const i=ee(t),r=ln[e]?"utc":"";let o;const s=an.reduce((t,n)=>(pn(e,n)&&(t[n]=function(e){return e===on.QUARTER?`(${r}quarter(${i})-1)`:`${r}${e}(${i})`}(n),o=n),t),{});return n&&(s[o]+="+1"),rn(s)}function hn(e,t,n){if(!e)return;const i=function(e){if(!e)return;const t=fn(e);return`timeUnitSpecifier(${D(t)}, ${D(dn)})`}(e);return n?`utcFormat(${t}, ${i})`:`timeFormat(${t}, ${i})`}function mn(e){return"day"!==e&&e.indexOf("day")>=0?(Qt(Ht.dayReplacedWithDate(e)),ne(e,"day","date")):e}function bn(e){return e&&!!e.field&&void 0!==e.equal}function vn(e){return e&&!!e.field&&void 0!==e.lt}function yn(e){return e&&!!e.field&&void 0!==e.lte}function xn(e){return e&&!!e.field&&void 0!==e.gt}function An(e){return e&&!!e.field&&void 0!==e.gte}function On(e){return!!(e&&e.field&&o(e.range)&&2===e.range.length)}function wn(e){return e&&!!e.field&&(o(e.oneOf)||o(e.in))}function Fn(e){return wn(e)||bn(e)||On(e)||vn(e)||xn(e)||yn(e)||An(e)}function Cn(e,t){return or(e,{timeUnit:t,time:!0})}function jn(e,t=!0){const{field:n,timeUnit:i}=e,r=i?"time("+gn(i,n)+")":Wi(e,{expr:"datum"});if(bn(e))return r+"==="+Cn(e.equal,i);if(vn(e)){return`${r}<${Cn(e.lt,i)}`}if(xn(e)){return`${r}>${Cn(e.gt,i)}`}if(yn(e)){return`${r}<=${Cn(e.lte,i)}`}if(An(e)){return`${r}>=${Cn(e.gte,i)}`}if(wn(e))return`indexof([${function(e,t){return e.map(e=>Cn(e,t))}(e.oneOf,i).join(",")}], ${r}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return Dn(r,e.valid);if(On(e)){const n=e.range[0],o=e.range[1];if(null!==n&&null!==o&&t)return"inrange("+r+", ["+Cn(n,i)+", "+Cn(o,i)+"])";const s=[];return null!==n&&s.push(`${r} >= ${Cn(n,i)}`),null!==o&&s.push(`${r} <= ${Cn(o,i)}`),s.length>0?s.join(" && "):"true"}throw new Error(`Invalid field predicate: ${JSON.stringify(e)}`)}function Dn(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function En(e){return Fn(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:mn(e.timeUnit)}):e}const Sn={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},kn="quantitative",$n="ordinal",Bn="temporal",Nn="nominal",_n="geojson";var zn;!function(e){e.LINEAR="linear",e.LOG="log",e.POW="pow",e.SQRT="sqrt",e.SYMLOG="symlog",e.TIME="time",e.UTC="utc",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.BIN_ORDINAL="bin-ordinal",e.ORDINAL="ordinal",e.POINT="point",e.BAND="band"}(zn||(zn={}));const Tn={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"},Pn=Y(Tn);function Mn(e,t){const n=Tn[e],i=Tn[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const Un={linear:0,log:1,pow:1,sqrt:1,symlog:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function Rn(e){return Un[e]}const Ln=["linear","log","pow","sqrt","symlog","time","utc"],Wn=C(Ln),qn=C(["quantile","quantize","threshold"]),In=C(Ln.concat(["quantile","quantize","threshold"])),Hn=C(["ordinal","bin-ordinal","point","band"]);function Gn(e){return e in Hn}function Yn(e){return e in In}function Vn(e){return e in Wn}function Jn(e){return e in qn}function Qn(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}const Xn=$e({type:1,domain:1,align:1,range: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","domain","range","scheme"]),Zn=Y(Xn);!function(){var e;const t={};for(const n of At)for(const i of Y(Sn))for(const r of Pn){const o=ii(n,i);ni(n,r)&&ti(r,i)&&(t[o]=null!=(e=t[o])?e:[],t[o].push(r))}}();function Kn(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!U(["point","band","identity"],e);case"bins":return!U(["point","band","identity","ordinal"],e);case"round":return Vn(e)||"band"===e||"point"===e;case"padding":return Vn(e)||U(["point","band"],e);case"paddingOuter":case"align":return U(["point","band"],e);case"paddingInner":return"band"===e;case"clamp":return Vn(e);case"nice":return Vn(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return Yn(e)&&!U(["log","time","utc","threshold","quantile"],e)}}function ei(e,t){switch(t){case"interpolate":case"scheme":return bt(e)?void 0:Ht.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"reverse":case"round":case"clamp":case"zero":return}}function ti(e,t){return U([$n,Nn],t)?void 0===e||Gn(e):t===Bn?U([zn.TIME,zn.UTC,void 0],e):t!==kn||U([zn.LOG,zn.POW,zn.SQRT,zn.SYMLOG,zn.QUANTILE,zn.QUANTIZE,zn.THRESHOLD,zn.LINEAR,void 0],e)}function ni(e,t){switch(e){case Ie:case He:return Vn(t)||U(["band","point"],t);case nt:case st:case it:case rt:case ot:return Vn(t)||Jn(t)||U(["band","point"],t);case Ze:case Ke:case et:return"band"!==t;case tt:return"ordinal"===t}return!1}function ii(e,t){return e+"_"+t}function ri(e){const{anchor:t,frame:n,offset:i,orient:r,color:o}=e,s=$e(e,["anchor","frame","offset","orient","color"]);return{mark:Object.assign(Object.assign({},s),o?{fill:o}:{}),nonMark:Object.assign(Object.assign(Object.assign(Object.assign({},t?{anchor:t}:{}),n?{frame:n}:{}),i?{offset:i}:{}),r?{orient:r}:{})}}function oi(e){return a(e)||o(e)&&a(e[0])}const si=" – ";function ai(e){var t;return[].concat(e.type,null!=(t=e.style)?t:[])}function ui(e,t,n){return oe(t[e],ci(e,t,n))}function ci(e,t,n,{vgChannel:i}={}){return oe(i?li(e,t,n.style):void 0,li(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function li(e,t,n){const i=ai(t);let r;for(const t of i){const i=n[t],o=e;i&&void 0!==i[o]&&(r=i[o])}return r}function di(e,t,n,i){if(rr(e)){const r=Ui(e)&&e.scale&&e.scale.type===zn.UTC;return{signal:mi(Wi(e,{expr:n}),e.timeUnit,t,i.timeFormat,r,!0)}}{const r=fi(e,t,i);if(cr(e.bin)){return{signal:hi(Wi(e,{expr:n}),Wi(e,{expr:n,binSuffix:"end"}),r,i)}}return"quantitative"===e.type||r?{signal:`${pi(Wi(e,{expr:n,binSuffix:"range"}),r)}`}:{signal:`''+${Wi(e,{expr:n})}`}}}function fi(e,t,n){return t||(e.type===kn?n.numberFormat:void 0)}function pi(e,t){return`format(${e}, "${t||""}")`}function gi(e,t,n){return pi(e,null!=t?t:n.numberFormat)}function hi(e,t,n,i){return`${Dn(e,!1)} ? "null" : ${gi(e,n,i)} + "${si}" + ${gi(t,n,i)}`}function mi(e,t,n,i,r,o=!1){return!t||n?(n=null!=n?n:i)||o?`${r?"utc":"time"}Format(${e}, '${n}')`:void 0:hn(t,e,r)}function bi(e,t){return x(e).reduce((e,n)=>{var i;return e.field.push(Wi(n,t)),e.order.push(null!=(i=n.sort)?i:"ascending"),e},{field:[],order:[]})}function vi(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if(B(t,e))return;n.push(e)}),n}function yi(e,t){return B(e,t)||!t?e:e?[...x(e),...x(t)].join(", "):t}function xi(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if(oi(n)&&oi(i))return{explicit:e.explicit,value:yi(n,i)};if(!oi(n)&&!oi(i))return{explicit:e.explicit,value:vi(n,i)};throw new Error("It should never reach here")}const Ai="mean",Oi={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 wi(e){return!!Oi[e]}function Fi(e){return!!e&&!!e.encoding}function Ci(e){return!(!e||"count"!==e.op&&!e.field)}function ji(e){return!!e&&o(e)}function Di(e){return!!e.row||!!e.column}function Ei(e){return void 0!==e.facet}function Si(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return Object.assign(Object.assign(Object.assign(Object.assign({},n?{timeUnit:n}:{}),i?{bin:i}:{}),r?{aggregate:r}:{}),{field:t})}function ki(e){return Ti(e)&&!!e.sort}function $i(e,t,n,i,r,{isMidPoint:o}={}){const{timeUnit:s,bin:a}=t;if(U(["x","y"],e)){if(Ri(t)&&void 0!==t.band)return t.band;if(s&&!n)return o?ci("timeUnitBandPosition",i,r):Oe(i.type)?ci("timeUnitBand",i,r):0;if(cr(a))return Oe(i.type)&&!o?1:.5}}function Bi(e,t,n,i,r){return!!(cr(t.bin)||t.timeUnit&&Ti(t)&&"temporal"===t.type)&&!!$i(e,t,n,i,r)}function Ni(e){return!!e&&!!e.condition}function _i(e){return!!e&&!!e.condition&&!o(e.condition)&&zi(e.condition)}function zi(e){return!(!e||!e.field&&"count"!==e.aggregate)}function Ti(e){return!!e&&(!!e.field&&!!e.type||"count"===e.aggregate)}function Pi(e){return zi(e)&&a(e.field)}function Mi(e){return e&&"value"in e&&void 0!==e.value}function Ui(e){return!(!e||!e.scale&&!e.sort)}function Ri(e){return!(!e||!e.axis&&!e.stack&&!e.impute&&void 0===e.band)}function Li(e){return!!e&&!!e.format}function Wi(e,t={}){var n,i,o;let s=e.field;const a=t.prefix;let c=t.suffix,l="";if(function(e){return"count"===e.aggregate}(e))s=function(e){return function(e){return 0===e.indexOf("__")}(e)?e:`__${e}`}("count");else{let r;if(!t.nofn)if(function(e){return!!e.op}(e))r=e.op;else{const{bin:a,aggregate:u,timeUnit:d}=e;cr(a)?(r=ur(a),c=(null!=(n=t.binSuffix)?n:"")+(null!=(i=t.suffix)?i:"")):u?ze(u)?(l=`.${s}`,s=`argmax_${u.argmax}`):_e(u)?(l=`.${s}`,s=`argmin_${u.argmin}`):r=String(u):d&&(r=String(d),c=(!U(["range","mid"],t.binSuffix)&&t.binSuffix||"")+(null!=(o=t.suffix)?o:""))}r&&(s=s?`${r}_${s}`:r)}return c&&(s=`${s}_${c}`),a&&(s=`${a}_${s}`),t.forAs?s:t.expr?function(e,t="datum"){return`${t}[${u(r(e).join("."))}]`}(s,t.expr)+l:te(s)+l}function qi(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"temporal":return!1}throw new Error(Ht.invalidFieldType(e.type))}function Ii(e){return!qi(e)}const Hi=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(ze(t))return`${r} for argmax(${t.argmax})`;if(_e(t))return`${r} for argmin(${t.argmin})`;const o=t||i||cr(n)&&"bin";return o?o.toUpperCase()+"("+r+")":r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(cr(i))return`${n} (binned)`;if(r){return`${n} (${fn(r).join("-")})`}return o?ze(o)?`${n} for max ${o.argmax}`:_e(o)?`${n} for min ${o.argmin}`:`${K(o)} of ${n}`:n}(e,t)}};let Gi=Hi;function Yi(e){Gi=e}function Vi(e,t,{allowDisabling:n,includeDefault:i=!0}){var r,o;const s=(null!=(r=Ji(e))?r:{}).title,a=i?Qi(e,t):void 0;return n?oe(s,e.title,a):null!=(o=null!=s?s:e.title)?o:a}function Ji(e){return Ri(e)&&e.axis?e.axis:(t=e)&&t.legend&&e.legend?e.legend:function(e){return!!e&&!!e.header}(e)&&e.header?e.header:void 0;var t}function Qi(e,t){return Gi(e,t)}function Xi(e){var t;if(Li(e)&&e.format)return e.format;return(null!=(t=Ji(e))?t:{}).format}function Zi(e){return zi(e)?e:_i(e)?e.condition:void 0}function Ki(e){return zi(e)?e:_i(e)?e.condition:void 0}function er(e,t){if(a(e)||F(e)||w(e)){const n=a(e)?"string":F(e)?"number":"boolean";return Qt(Ht.primitiveChannelDef(t,n,e)),{value:e}}return zi(e)?tr(e,t):_i(e)?Object.assign(Object.assign({},e),{condition:tr(e.condition,t)}):e}function tr(e,t){const{aggregate:n,timeUnit:i,bin:r,field:o}=e,s=Object.assign({},e);if(!n||Te(n)||ze(n)||_e(n)||(Qt(Ht.invalidAggregate(n)),delete s.aggregate),i&&(s.timeUnit=mn(i)),o&&(s.field=`${o}`),cr(r)&&(s.bin=nr(r,t)),lr(r)&&!U(Nt,t)&&Qt(`Channel ${t} should not be used with "binned" bin`),Ti(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case kn:return"quantitative";case"t":case Bn:return"temporal";case"o":case $n:return"ordinal";case"n":case Nn:return"nominal";case _n:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&Me(n)&&(Qt(Ht.invalidFieldTypeForCountAggregate(e,n)),s.type="quantitative")}else if(!Dt(t)){const e=function(e,t){if(e.timeUnit)return"temporal";if(cr(e.bin))return"quantitative";switch(It(t)){case"continuous":return"quantitative";case"discrete":case"flexible":return"nominal";default:return"quantitative"}}(s,t);Qt(Ht.missingFieldType(t,e)),s.type=e}if(Ti(s)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case"row":case"column":case"facet":return Ii(e)?{compatible:!1,warning:Ht.facetChannelShouldBeDiscrete(t)}:ir;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":case"url":return ir;case"longitude":case"longitude2":case"latitude":case"latitude2":return n!==kn?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:ir;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return"nominal"!==n||e.sort?ir:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"shape":return U(["ordinal","nominal","geojson"],e.type)?ir:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return"nominal"!==e.type||"sort"in e?ir:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+t)}(s,t);e||Qt(n)}if(ki(s)&&a(s.sort)){const{sort:e}=s;if(wi(e))return Object.assign(Object.assign({},s),{sort:{encoding:e}});const t=e.substr(1);if("-"===e.charAt(0)&&wi(t))return Object.assign(Object.assign({},s),{sort:{encoding:t,order:"descending"}})}return s}function nr(e,t){return w(e)?{maxbins:pr(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:pr(t)})}const ir={compatible:!0};function rr(e){const t=Ji(e),n=t&&t.formatType||Li(e)&&e.formatType;return"time"===n||!n&&function(e){return"temporal"===e.type||!!e.timeUnit}(e)}function or(e,{timeUnit:t,type:n,time:i,undefinedIfExprNotRequired:r}){let o;var s;return Zt(e)?o=rn(e,!0):(a(e)||F(e))&&(t||"temporal"===n)&&(o=function(e){return!!sn[e]}(t)?rn({[t]:e},!0):function(e){return!!un[e]}(t)?or(e,{timeUnit:(s=t,s.substr(3))}):`datetime(${JSON.stringify(e)})`),o?i?`time(${o})`:o:r?void 0:JSON.stringify(e)}function sr(e,t){const{timeUnit:n,type:i}=e;return t.map(e=>{const t=or(e,{timeUnit:n,type:i,undefinedIfExprNotRequired:!0});return void 0!==t?{signal:t}:e})}function ar(e,t){return cr(e.bin)?Rt(t)&&U(["ordinal","nominal"],e.type):(console.warn("Only use this method with binned field defs"),!1)}function ur(e){return w(e)&&(e=nr(e,void 0)),"bin"+Y(e).map(t=>fr(e[t])?Q(`_${t}_${Object.entries(e[t])}`):Q(`_${t}_${e[t]}`)).join("")}function cr(e){return!0===e||dr(e)&&!e.binned}function lr(e){return"binned"===e||dr(e)&&!0===e.binned}function dr(e){return s(e)}function fr(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}function pr(e){switch(e){case Le:case We:case nt:case Ze:case Ke:case et:case st:case it:case rt:case ot:case tt:return 6;default:return 10}}function gr(e,t){const n=e&&e[t];return!!n&&(o(n)?R(n,e=>!!e.field):zi(n)||_i(n))}function hr(e){return R(At,t=>{if(gr(e,t)){const n=e[t];if(o(n))return R(n,e=>!!e.aggregate);{const e=Zi(n);return e&&!!e.aggregate}}return!1})}function mr(e,t){const n=[],i=[],r=[],o=[],s={};return yr(e,(a,u)=>{if(zi(a)){const{field:c,aggregate:l,timeUnit:d,bin:f}=a,p=$e(a,["field","aggregate","timeUnit","bin"]);if(l||d||f){const e=Ji(a),g=e&&e.title;let h=Wi(a,{forAs:!0});const m=Object.assign(Object.assign(Object.assign({},g?[]:{title:Vi(a,t,{allowDisabling:!0})}),p),{field:h}),b="x"===u||"y"===u;if(l){let e;if(ze(l)?(e="argmax",h=Wi({op:"argmax",field:l.argmax},{forAs:!0}),m.field=`${h}.${c}`):_e(l)?(e="argmin",h=Wi({op:"argmin",field:l.argmin},{forAs:!0}),m.field=`${h}.${c}`):"boxplot"!==l&&"errorbar"!==l&&"errorband"!==l&&(e=l),e){const t={op:e,as:h};c&&(t.field=c),o.push(t)}}else if(n.push(h),Ti(a)&&cr(f)){if(i.push({bin:f,field:c,as:h}),n.push(Wi(a,{binSuffix:"end"})),ar(a,u)&&n.push(Wi(a,{binSuffix:"range"})),b){const e={field:h+"_end"};s[u+"2"]=e}m.bin="binned",Dt(u)||(m.type="quantitative")}else if(d){r.push({timeUnit:d,field:c,as:h});const e=Ti(a)&&a.type!==Bn&&"time";e&&("text"===u||"tooltip"===u?m.formatType=e:!function(e){return!!kt[e]}(u)?b&&(m.axis=Object.assign({formatType:e},m.axis)):m.legend=Object.assign({formatType:e},m.legend))}s[u]=m}else n.push(c),s[u]=e[u]}else s[u]=e[u]}),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:s}}function br(e,t){const n=t.type;return Y(e).reduce((i,r)=>{var s;if(!Ct(r))return Qt(Ht.invalidEncodingChannel(r)),i;if(!function(e,t,n){const i=Lt(t,n);if(!i)return!1;if("binned"===i){const n=e["x2"===t?"x":"y"];return!!(zi(n)&&zi(e[t])&&lr(n.bin))}return!0}(e,r,n))return Qt(Ht.incompatibleChannel(r,n)),i;if("size"===r&&"line"===n){if(null===(s=Ki(e[r]))||void 0===s?void 0:s.aggregate)return Qt(Ht.LINE_WITH_VARYING_SIZE),i}if("color"===r&&(t.filled?"fill"in e:"stroke"in e))return Qt(Ht.droppingColor("encoding",{fill:"fill"in e,stroke:"stroke"in e})),i;const a=e[r];if("detail"===r||"order"===r&&!o(a)&&!Mi(a)||"tooltip"===r&&o(a))a&&(i[r]=(o(a)?a:[a]).reduce((e,t)=>(zi(t)?e.push(tr(t,r)):Qt(Ht.emptyFieldDef(t,r)),e),[]));else{if("tooltip"===r&&null===a)i[r]=null;else if(!zi(a)&&!Mi(a)&&!Ni(a))return Qt(Ht.emptyFieldDef(a,r)),i;i[r]=er(a,r)}return i},{})}function vr(e){const t=[];for(const n of Y(e))if(gr(e,n)){const i=e[n],r=o(i)?i:[i];for(const e of r)zi(e)?t.push(e):_i(e)&&t.push(e.condition)}return t}function yr(e,t,n){if(e)for(const i of Y(e)){const r=e[i];o(r)?r.forEach(e=>{t.call(n,e,i)}):t.call(n,r,i)}}function xr(e,t,n,i){return e?Y(e).reduce((n,r)=>{const s=e[r];return o(s)?s.reduce((e,n)=>t.call(i,e,n,r),n):t.call(i,n,s,r)},n):n}function Ar(e,t){return Y(t).reduce((n,i)=>{switch(i){case"x":case"y":case"href":case"url":case"x2":case"y2":case"latitude":case"longitude":case"latitude2":case"longitude2":case"text":case"shape":case"tooltip":return n;case"order":if("line"===e||"trail"===e)return n;case"detail":case"key":{const e=t[i];return(o(e)||zi(e))&&(o(e)?e:[e]).forEach(e=>{e.aggregate||n.push(Wi(e,{}))}),n}case"size":if("trail"===e)return n;case"color":case"fill":case"stroke":case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":{const e=Ki(t[i]);return e&&!e.aggregate&&n.push(Wi(e,{})),n}}},[])}function Or(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:n})=>({field:e+t.field,type:t.type,title:n+(i?" of "+t.field:"")})),...vr(n)]}}function wr(e){const{axis:t,title:n,field:i}=e;return t&&void 0!==t.title?void 0:oe(n,i)}function Fr(e,t,n,i,r){const{scale:o,axis:s}=n;return({partName:u,mark:c,positionPrefix:l,endPositionPrefix:d,extraEncoding:f={}})=>{const p=wr(n);return Cr(e,u,r,{mark:c,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:l+"_"+n.field,type:n.type},void 0!==p?{title:p}:{}),void 0!==o?{scale:o}:{}),void 0!==s?{axis:s}:{})},a(d)?{[t+"2"]:{field:d+"_"+n.field,type:n.type}}:{}),i),f)})}}function Cr(e,t,n,i){const{clip:r,color:o,opacity:s}=e,a=e.type;return e[t]||void 0===e[t]&&n[t]?[Object.assign(Object.assign({},i),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n[t]),r?{clip:r}:{}),o?{color:o}:{}),s?{opacity:s}:{}),Fe(i.mark)?i.mark:{type:i.mark}),{style:`${a}-${t}`}),w(e[t])?{}:e[t])})]:[]}function jr(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],s=i[r+"2"],a=i[r+"Error"],u=i[r+"Error2"];return{continuousAxisChannelDef:Dr(o,n),continuousAxisChannelDef2:Dr(s,n),continuousAxisChannelDefError:Dr(a,n),continuousAxisChannelDefError2:Dr(u,n),continuousAxis:r}}function Dr(e,t){if(e&&e.aggregate){const{aggregate:n}=e,i=$e(e,["aggregate"]);return n!==t&&Qt(Ht.errorBarContinuousAxisHasCustomizedAggregate(n,t)),i}return e}function Er(e,t){const{mark:n,encoding:i}=e;if(zi(i.x)&&Ii(i.x)){if(zi(i.y)&&Ii(i.y)){if(void 0===i.x.aggregate&&i.y.aggregate===t)return"vertical";if(void 0===i.y.aggregate&&i.x.aggregate===t)return"horizontal";if(i.x.aggregate===t&&i.y.aggregate===t)throw new Error("Both x and y cannot have aggregate");return Fe(n)&&n.orient?n.orient:"vertical"}return"horizontal"}if(zi(i.y)&&Ii(i.y))return"vertical";throw new Error("Need a valid continuous axis for "+t+"s")}const Sr="boxplot",kr=Y({box:1,median:1,outliers:1,rule:1,ticks:1}),$r=new ke(Sr,Nr);function Br(e){return F(e)?"tukey":e}function Nr(e,{config:t}){var n,i;const{mark:r,encoding:a,selection:u,projection:c}=e,l=$e(e,["mark","encoding","selection","projection"]),d=Fe(r)?r:{type:r};u&&Qt(Ht.selectionNotSupported("boxplot"));const f=null!=(n=d.extent)?n:t.boxplot.extent,p=oe(d.size,t.boxplot.size),g=Br(f),{transform:h,continuousAxisChannelDef:m,continuousAxis:b,groupby:v,aggregate:y,encodingWithoutContinuousAxis:x,ticksOrient:A,boxOrient:O,customTooltipWithoutAggregatedField:w}=function(e,t,n){const i=Er(e,Sr),{continuousAxisChannelDef:r,continuousAxis:s}=jr(e,i,Sr),a=r.field,u=Br(t),c=[..._r(a),{op:"median",field:a,as:"mid_box_"+a},{op:"min",field:a,as:("min-max"===u?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===u?"upper_whisker_":"max_")+a}],l="min-max"===u||"tukey"===u?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:"iqr_"+a},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,as:"upper_whisker_"+a},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,as:"lower_whisker_"+a}],d=e.encoding,f=s,p=(d[f],$e(d,["symbol"==typeof f?f:f+""])),{customTooltipWithoutAggregatedField:g,filteredEncoding:h}=function(e){const{tooltip:t}=e,n=$e(e,["tooltip"]);if(!t)return{filteredEncoding:e};let i,r;return o(t)?(t.forEach(e=>{e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e))}),i&&(n.tooltip=i)):t.aggregate?n.tooltip=t:r=t,o(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(p),{bins:m,timeUnits:b,aggregate:v,groupby:y,encoding:x}=mr(h,n),A="vertical"===i?"horizontal":"vertical",O=i;return{transform:[...m,...b,{aggregate:[...v,...c],groupby:y},...l],groupby:y,aggregate:v,continuousAxisChannelDef:r,continuousAxis:s,encodingWithoutContinuousAxis:x,ticksOrient:A,boxOrient:O,customTooltipWithoutAggregatedField:g}}(e,f,t),{color:F,size:C}=x,j=$e(x,["color","size"]),D=e=>Fr(d,b,m,e,t.boxplot),E=D(j),S=D(x),k=D(Object.assign(Object.assign({},j),C?{size:C}:{})),$=Or([{fieldPrefix:"min-max"===g?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===g?"lower_whisker_":"min_",titlePrefix:"Min"}],m,x),B={type:"tick",color:"black",opacity:1,orient:A,invalid:null},N="min-max"===g?$:Or([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,x),_=[...E({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...E({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...E({partName:"ticks",mark:B,positionPrefix:"lower_whisker",extraEncoding:N}),...E({partName:"ticks",mark:B,positionPrefix:"upper_whisker",extraEncoding:N})],z=[..."tukey"!==g?_:[],...S({partName:"box",mark:Object.assign(Object.assign({type:"bar"},p?{size:p}:{}),{orient:O,invalid:null}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:$}),...k({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},s(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),p?{size:p}:{}),{orient:A}),positionPrefix:"mid_box",extraEncoding:$})];let T;if("min-max"!==g){const e=`datum["lower_box_${m.field}"]`,n=`datum["upper_box_${m.field}"]`,i=`(${n} - ${e})`,r=`${e} - ${f} * ${i}`,o=`${n} + ${f} * ${i}`,s=`datum["${m.field}"]`,a={joinaggregate:_r(m.field),groupby:v};let u=void 0;"tukey"===g&&(u={transform:[{filter:`(${r} <= ${s}) && (${s} <= ${o})`},{aggregate:[{op:"min",field:m.field,as:"lower_whisker_"+m.field},{op:"max",field:m.field,as:"upper_whisker_"+m.field},{op:"min",field:"lower_box_"+m.field,as:"lower_box_"+m.field},{op:"max",field:"upper_box_"+m.field,as:"upper_box_"+m.field},...y],groupby:v}],layer:_});const c=$e(j,["tooltip"]),{scale:l,axis:p}=m,h=wr(m),x=Cr(d,"outliers",t.boxplot,{transform:[{filter:`(${s} < ${r}) || (${s} > ${o})`}],mark:"point",encoding:Object.assign(Object.assign({[b]:Object.assign(Object.assign(Object.assign({field:m.field,type:m.type},void 0!==h?{title:h}:{}),void 0!==l?{scale:l}:{}),void 0!==p?{axis:p}:{})},c),w?{tooltip:w}:{})})[0];x&&u?T={transform:[a],layer:[x,u]}:x?(T=x,T.transform.unshift(a)):u&&(T=u,T.transform.unshift(a))}return T?Object.assign(Object.assign({},l),{layer:[T,{transform:h,layer:z}]}):Object.assign(Object.assign({},l),{transform:(i=l.transform,null!=i?i:[]).concat(h),layer:z})}function _r(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const zr="errorbar",Tr=Y({ticks:1,rule:1}),Pr=new ke(zr,Mr);function Mr(e,{config:t}){const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:s,markDef:a,outerSpec:u,tooltipEncoding:c}=Rr(e,zr,t),l=Fr(a,r,i,o,t.errorbar),d={type:"tick",orient:s};return Object.assign(Object.assign({},u),{transform:n,layer:[...l({partName:"ticks",mark:d,positionPrefix:"lower",extraEncoding:c}),...l({partName:"ticks",mark:d,positionPrefix:"upper",extraEncoding:c}),...l({partName:"rule",mark:"rule",positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})]})}function Ur(e,t){const{encoding:n}=e;if(function(e){return(zi(e.x)||zi(e.y))&&!zi(e.x2)&&!zi(e.y2)&&!zi(e.xError)&&!zi(e.xError2)&&!zi(e.yError)&&!zi(e.yError2)}(n))return{orient:Er(e,t),inputType:"raw"};const i=function(e){return zi(e.x2)||zi(e.y2)}(n),r=function(e){return zi(e.xError)||zi(e.xError2)||zi(e.yError)||zi(e.yError2)}(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 e=n.x2,i=n.y2;if(zi(e)&&zi(i))throw new Error(t+" cannot have both x2 and y2");if(zi(e)){if(zi(o)&&Ii(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in "+t)}if(zi(i)){if(zi(s)&&Ii(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")}{const e=n.xError,i=n.xError2,r=n.yError,a=n.yError2;if(zi(i)&&!zi(e))throw new Error(t+" cannot have xError2 without xError");if(zi(a)&&!zi(r))throw new Error(t+" cannot have yError2 without yError");if(zi(e)&&zi(r))throw new Error(t+" cannot have both xError and yError with both are quantiative");if(zi(e)){if(zi(o)&&Ii(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(zi(r)){if(zi(s)&&Ii(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 Rr(e,t,n){var i;const{mark:r,encoding:o,selection:s,projection:a}=e,u=$e(e,["mark","encoding","selection","projection"]),c=Fe(r)?r:{type:r};s&&Qt(Ht.selectionNotSupported(t));const{orient:l,inputType:d}=Ur(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:p,continuousAxisChannelDefError:g,continuousAxisChannelDefError2:h,continuousAxis:m}=jr(e,l,t),{errorBarSpecificAggregate:b,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:x}=function(e,t,n,i,r,o,s,a){let u=[],c=[];const l=t.field;let d,f=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":a.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Qt(Ht.errorBarCenterIsUsedWithWrongExtent(t,n,s)),"stderr"===n||"stdev"===n)u=[{op:n,field:l,as:"extent_"+l},{op:t,field:l,as:"center_"+l}],c=[{calculate:`datum["center_${l}"] + datum["extent_${l}"]`,as:"upper_"+l},{calculate:`datum["center_${l}"] - datum["extent_${l}"]`,as:"lower_"+l}],d=[{fieldPrefix:"center_",titlePrefix:K(t)},{fieldPrefix:"upper_",titlePrefix:Lr(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:Lr(t,n,"-")}],f=!0;else{let t,i,r;e.center&&e.extent&&Qt(Ht.errorBarCenterIsNotNeeded(e.extent,s)),"ci"===n?(t="mean",i="ci0",r="ci1"):(t="median",i="q1",r="q3"),u=[{op:i,field:l,as:"lower_"+l},{op:r,field:l,as:"upper_"+l},{op:t,field:l,as:"center_"+l}],d=[{fieldPrefix:"upper_",titlePrefix:Vi({field:l,aggregate:r,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Vi({field:l,aggregate:i,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Vi({field:l,aggregate:t,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Qt(Ht.errorBarCenterAndExtentAreNotNeeded(e.center,e.extent)),"aggregated-upper-lower"===o?(d=[],c=[{calculate:`datum["${n.field}"]`,as:"upper_"+l},{calculate:`datum["${l}"]`,as:"lower_"+l}]):"aggregated-error"===o&&(d=[{fieldPrefix:"",titlePrefix:l}],c=[{calculate:`datum["${l}"] + datum["${i.field}"]`,as:"upper_"+l}],r?c.push({calculate:`datum["${l}"] + datum["${r.field}"]`,as:"lower_"+l}):c.push({calculate:`datum["${l}"] - datum["${i.field}"]`,as:"lower_"+l}));for(const e of c)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:ne(ne(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:c,errorBarSpecificAggregate:u,tooltipSummary:d,tooltipTitleWithFieldName:f}}(c,f,p,g,h,d,t,n),A=m,O=(o[A],"x"===m?"x2":"y2"),w=(o[O],"x"===m?"xError":"yError"),F=(o[w],"x"===m?"xError2":"yError2"),C=(o[F],$e(o,["symbol"==typeof A?A:A+"","symbol"==typeof O?O:O+"","symbol"==typeof w?w:w+"","symbol"==typeof F?F:F+""])),{bins:j,timeUnits:D,aggregate:E,groupby:S,encoding:k}=mr(C,n),$=[...E,...b],B="raw"!==d?[]:S,N=Or(y,f,k,x);return{transform:[...(i=u.transform,null!=i?i:[]),...j,...D,...0===$.length?[]:[{aggregate:$,groupby:B}],...v],groupby:B,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:k,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:c,outerSpec:u,tooltipEncoding:N}}function Lr(e,t,n){return K(e)+" "+n+" "+t}const Wr="errorband",qr=Y({band:1,borders:1}),Ir=new ke(Wr,Hr);function Hr(e,{config:t}){const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:s,outerSpec:a,tooltipEncoding:u}=Rr(e,Wr,t),c=s,l=Fr(c,r,i,o,t.errorband),d=void 0!==e.encoding.x&&void 0!==e.encoding.y;let f={type:d?"area":"rect"},p={type:d?"line":"rule"};const g=Object.assign(Object.assign({},c.interpolate?{interpolate:c.interpolate}:{}),c.tension&&c.interpolate?{interpolate:c.tension}:{});return d?(f=Object.assign(Object.assign({},f),g),p=Object.assign(Object.assign({},p),g)):c.interpolate?Qt(Ht.errorBand1DNotSupport("interpolate")):c.tension&&Qt(Ht.errorBand1DNotSupport("tension")),Object.assign(Object.assign({},a),{transform:n,layer:[...l({partName:"band",mark:f,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...l({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:u}),...l({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:u})]})}const Gr={};function Yr(e,t,n){const i=new ke(e,t);Gr[e]={normalizer:i,parts:n}}Yr(Sr,Nr,kr),Yr(zr,Mr,Tr),Yr(Wr,Hr,qr);const Vr=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],Jr="_vgsid_",Qr={single:{on:"click",fields:[Jr],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:[Jr],toggle:"event.shiftKey",resolve:"global",empty:"all",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Xr(e){return!(!e||"legend"!==e&&!e.legend)}function Zr(e){return Xr(e)&&s(e)}function Kr(e){return void 0!==e.concat}function eo(e){return void 0!==e.vconcat}function to(e){return void 0!==e.hconcat}function no(e){return void 0!==e.repeat}function io(e){return s(e)&&void 0!==e.step}const ro=Y({align:1,bounds:1,center:1,columns:1,spacing:1});function oo(e,t){var n;return null!=(n=e[t])?n:e["width"===t?"continuousWidth":"continuousHeight"]}function so(e,t){const n=ao(e,t);return io(n)?n.step:uo}function ao(e,t){var n;return oe(null!=(n=e[t])?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const uo=20,co={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:uo},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},area:{},bar:De,circle:{},geoshape:{},image:{},line:{},point:{},rect:Ee,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},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:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},axis:{},axisX:{},axisY:{},axisLeft:{},axisRight:{},axisTop:{},axisBottom:{},axisBand:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Qr,style:{},title:{},facet:{spacing:20},repeat:{spacing:20},concat:{spacing:20}};function lo(e){return b({},co,e)}const fo=["view",...we],po=["background","padding","facet","concat","repeat","numberFormat","timeFormat","countTitle","header","scale","selection","overlay"],go=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function ho(e){e=N(e);for(const t of po)delete e[t];if(e.legend)for(const t of Vr)delete e.legend[t];if(e.mark)for(const t of je)delete e.mark[t];for(const t of fo){for(const n of je)delete e[t][n];const n=go[t];if(n)for(const i of n)delete e[t][i];mo(e,t)}for(const t of Y(Gr))delete e[t];mo(e,"title","group-title");for(const t in e)s(e[t])&&0===Y(e[t]).length&&delete e[t];return Y(e).length>0?e:void 0}function mo(e,t,n,i){const r="title"===t?ri(e.title).mark:i?e[t][i]:e[t];"view"===t&&(n="cell");const o=Object.assign(Object.assign({},r),e.style[t]);Y(o).length>0&&(e.style[null!=n?n:t]=o),i||delete e[t]}function bo(e){return void 0!==e.layer}class vo{map(e,t){return Ei(e)?this.mapFacet(e,t):no(e)?this.mapRepeat(e,t):to(e)?this.mapHConcat(e,t):eo(e)?this.mapVConcat(e,t):Kr(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(bo(e))return this.mapLayer(e,t);if(Se(e))return this.mapUnit(e,t);throw new Error(Ht.invalidSpec(e))}mapLayer(e,t){return Object.assign(Object.assign({},e),{layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))})}mapHConcat(e,t){return Object.assign(Object.assign({},e),{hconcat:e.hconcat.map(e=>this.map(e,t))})}mapVConcat(e,t){return Object.assign(Object.assign({},e),{vconcat:e.vconcat.map(e=>this.map(e,t))})}mapConcat(e,t){const{concat:n}=e,i=$e(e,["concat"]);return Object.assign(Object.assign({},i),{concat:n.map(e=>this.map(e,t))})}mapFacet(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapRepeat(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}}const yo={zero:1,center:1,normalize:1};const xo=[ce,ue,ge,fe,ve,ye,de,he,me],Ao=[ce,ue];function Oo(e,t,n={}){const i=Fe(e)?e.type:e;if(!U(xo,i))return null;const r=function(e){const t=e.x,n=e.y;if(zi(t)&&zi(n))if("quantitative"===t.type&&"quantitative"===n.type){if(t.stack)return"x";if(n.stack)return"y";if(!!t.aggregate!=!!n.aggregate)return t.aggregate?"x":"y"}else{if("quantitative"===t.type)return"x";if("quantitative"===n.type)return"y"}else{if(zi(t)&&"quantitative"===t.type)return"x";if(zi(n)&&"quantitative"===n.type)return"y"}}(t);if(!r)return null;const s=t[r],a=Pi(s)?Wi(s,{}):void 0,u="x"===r?"y":"x",c=t[u],l=Pi(c)?Wi(c,{}):void 0,d=$t.reduce((e,n)=>{if("tooltip"!==n&&gr(t,n)){const i=t[n];(o(i)?i:[i]).forEach(t=>{const i=Ki(t);if(i.aggregate)return;const r=Pi(i)?Wi(i,{}):void 0;(!r||r!==l&&r!==a)&&e.push({channel:n,fieldDef:i})})}return e},[]);let f;if(void 0!==s.stack?f=w(s.stack)?s.stack?"zero":null:s.stack:d.length>0&&U(Ao,i)&&(f="zero"),!f||!yo[f])return null;if(hr(t)&&0===d.length)return null;if(s.scale&&s.scale.type&&s.scale.type!==zn.LINEAR){if(n.disallowNonLinearStack)return null;Qt(Ht.cannotStackNonLinearScale(s.scale.type))}return gr(t,r===Ie?Ge:Ye)?(void 0!==s.stack&&Qt(Ht.cannotStackRangedMark(r)),null):(s.aggregate&&!U(Ue,s.aggregate)&&Qt(Ht.stackNonSummativeAggregate(s.aggregate)),{groupbyChannel:c?u:void 0,fieldChannel:r,impute:null!==s.impute&&Ae(i),stackBy:d,offset:f})}function wo(e){const t=$e(e,["point","line"]);return Y(t).length>1?t:t.type}function Fo(e){for(const t of["line","area","rule","trail"])e[t]&&(e=Object.assign(Object.assign({},e),{[t]:z(e[t],["point","line"])}));return e}function Co(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?s(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?s(t.point)?t.point:{}:void 0}function jo(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class Do{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(Se(e)){const{mark:n,encoding:i}=e,r=Fe(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!Co(r,t[r.type],i);case"area":return!!Co(r,t[r.type],i)||!!jo(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{selection:r,projection:o,encoding:s,mark:a}=e,u=$e(e,["selection","projection","encoding","mark"]),c=Fe(a)?a:{type:a},l=Co(c,i[c.type],s),d="area"===c.type&&jo(c,i[c.type]),f=[Object.assign(Object.assign({},r?{selection:r}:{}),{mark:wo(Object.assign(Object.assign({},c),"area"===c.type?{opacity:.7}:{})),encoding:z(s,["shape"])})],p=Oo(c,s);let g=s;if(p){const{fieldChannel:e,offset:t}=p;g=Object.assign(Object.assign({},s),{[e]:Object.assign(Object.assign({},s[e]),t?{stack:t}:{})})}return d&&f.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"line"},_(c,["clip","interpolate","tension","tooltip"])),d),encoding:g})),l&&f.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},_(c,["clip","tooltip"])),l),encoding:g})),n(Object.assign(Object.assign({},u),{layer:f}),Object.assign(Object.assign({},t),{config:Fo(i)}))}}class Eo{constructor(){this.name="RangeStep"}hasMatchingType(e){var t,n;if(Se(e)&&e.encoding)for(const i of Nt){const r=e.encoding[i];if(r&&zi(r)&&(null===(n=null===(t=r)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep))return!0}return!1}run(e){var t,n;const i={};let r=Object.assign({},e.encoding);for(const e of Nt){const o=_t(e),s=r[e];if(s&&zi(s)&&(null===(n=null===(t=s)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep)){const{scale:t}=s,n=$e(s,["scale"]),a=$e(t,["rangeStep"]);i[o]={step:t.rangeStep},Qt(Ht.RANGE_STEP_DEPRECATED),r=Object.assign(Object.assign({},r),{[e]:Object.assign(Object.assign({},n),Y(a).length>0?{scale:a}:{})})}}return Object.assign(Object.assign(Object.assign({},i),e),{encoding:r})}}class So{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(Se(e)){const{encoding:t,mark:n}=e;if("line"===n)for(const e of jt){const n=t[Et(e)];if(t[e]&&zi(n)&&!lr(n.bin))return!0}}return!1}run(e,t,n){const{encoding:i}=e;return Qt(Ht.lineWithRange(!!i.x2,!!i.y2)),n(Object.assign(Object.assign({},e),{mark:"rule"}),t)}}function ko(e){const{parentEncoding:t,encoding:n}=e;if(t&&n){const e=Y(t).reduce((e,t)=>(n[t]&&e.push(t),e),[]);e.length>0&&Qt(Ht.encodingOverridden(e))}const i=Object.assign(Object.assign({},null!=t?t:{}),null!=n?n:{});return Y(i).length>0?i:void 0}function $o(e){const{parentProjection:t,projection:n}=e;return t&&n&&Qt(Ht.projectionOverridden({parentProjection:t,projection:n})),null!=n?n:t}function Bo(e,t){void 0===t&&(t=lo(e.config));const n=function(e,t={}){return No.map(e,{config:t})}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=Se(e)||bo(e),s={};o?"container"==i&&"container"==r?(s.type="fit",s.contains="padding"):"container"==i?(s.type="fit-x",s.contains="padding"):"container"==r&&(s.type="fit-y",s.contains="padding"):("container"==i&&(Qt(Ht.containerSizeNonSingle("width")),i=void 0),"container"==r&&(Qt(Ht.containerSizeNonSingle("height")),r=void 0));const a=Object.assign(Object.assign(Object.assign({type:"pad"},s),n?_o(n.autosize):{}),_o(e.autosize));"fit"!==a.type||o||(Qt(Ht.FIT_NON_SINGLE),a.type="pad");"container"==i&&"fit"!=a.type&&"fit-x"!=a.type&&Qt(Ht.containerSizeNotCompatibleWithAutosize("width"));"container"==r&&"fit"!=a.type&&"fit-y"!=a.type&&Qt(Ht.containerSizeNotCompatibleWithAutosize("height"));if(B(a,{type:"pad"}))return;return a}(n,{width:i,height:r,autosize:e.autosize},t);return Object.assign(Object.assign({},n),o?{autosize:o}:{})}const No=new class extends vo{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[$r,Pr,Ir,new Do,new So,new Eo]}map(e,t){if(Se(e)){const n=gr(e.encoding,Le),i=gr(e.encoding,We),r=gr(e.encoding,qe);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t;if(n||i)return this.mapUnitWithParentEncodingOrProjection(e,t);const r=this.mapLayerOrUnit.bind(this);for(const n of this.nonFacetUnitNormalizers)if(n.hasMatchingType(e,t.config))return n.run(e,t,r);return e}mapRepeat(e,t){const{repeat:n}=e;return!o(n)&&e.columns&&(e=z(e,["columns"]),Qt(Ht.columnsNotSupportByRowCol("repeat"))),Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapFacet(e,t){const{facet:n}=e;return Di(n)&&e.columns&&(e=z(e,["columns"]),Qt(Ht.columnsNotSupportByRowCol("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:s}=t,a=$o({parentProjection:o,projection:i}),u=ko({parentEncoding:r,encoding:n});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),a?{projection:a}:{}),u?{encoding:u}:{}),{config:s})}mapFacetedUnit(e,t){const n=e.encoding,{row:i,column:r,facet:o}=n,s=$e(n,["row","column","facet"]),{mark:a,width:u,projection:c,height:l,selection:d,encoding:f}=e,p=$e(e,["mark","width","projection","height","selection","encoding"]),{facetMapping:g,layout:h}=this.getFacetMappingAndLayout({row:i,column:r,facet:o});return this.mapFacet(Object.assign(Object.assign(Object.assign({},p),h),{facet:g,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c?{projection:c}:{}),{mark:a}),u?{width:u}:{}),l?{height:l}:{}),{encoding:s}),d?{selection:d}:{})}),t)}getFacetMappingAndLayout(e){var t;const{row:n,column:i,facet:r}=e;if(n||i){r&&Qt(Ht.facetChannelDropped([...n?[Le]:[],...i?[We]:[]]));const o={},s={};for(const n of[Le,We]){const i=e[n];if(i){const e=$e(i,["align","center","spacing","columns"]);o[n]=e;for(const e of["align","center","spacing"])void 0!==i[e]&&(s[e]=null!=(t=s[e])?t:{},s[e][n]=i[e])}}return{facetMapping:o,layout:s}}{const{align:e,center:t,spacing:n,columns:i}=r;return{facetMapping:$e(r,["align","center","spacing","columns"]),layout:Object.assign(Object.assign(Object.assign(Object.assign({},e?{align:e}:{}),t?{center:t}:{}),n?{spacing:n}:{}),i?{columns:i}:{})}}}mapLayer(e,t){var{parentEncoding:n,parentProjection:i}=t,r=$e(t,["parentEncoding","parentProjection"]);const{encoding:o,projection:s}=e,a=$e(e,["encoding","projection"]),u=Object.assign(Object.assign({},r),{parentEncoding:ko({parentEncoding:n,encoding:o}),parentProjection:$o({parentProjection:i,projection:s})});return super.mapLayer(a,u)}};function _o(e){return a(e)?{type:e}:null!=e?e:{}}const zo=["background","padding"];function To(e){return zo.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}function Po(e){return!!e.url}function Mo(e){return!!e.values}function Uo(e){return!(!e.name||Po(e)||Mo(e)||Ro(e))}function Ro(e){return e&&(Lo(e)||Wo(e)||qo(e))}function Lo(e){return!!e.sequence}function Wo(e){return!!e.sphere}function qo(e){return!!e.graticule}const Io="main",Ho="raw";function Go(e){return void 0!==e.filter}function Yo(e){return void 0!==e.lookup}function Vo(e){return void 0!==e.pivot}function Jo(e){return void 0!==e.density}function Qo(e){return void 0!==e.quantile}function Xo(e){return void 0!==e.regression}function Zo(e){return void 0!==e.loess}function Ko(e){return void 0!==e.sample}function es(e){return void 0!==e.window}function ts(e){return void 0!==e.joinaggregate}function ns(e){return void 0!==e.flatten}function is(e){return void 0!==e.calculate}function rs(e){return!!e.bin}function os(e){return void 0!==e.impute}function ss(e){return void 0!==e.timeUnit}function as(e){return void 0!==e.aggregate}function us(e){return void 0!==e.stack}function cs(e){return void 0!==e.fold}function ls(e){return!!e.signal}function ds(e){return!!e.step}function fs(e){return!o(e)&&("field"in e&&"data"in e)}const ps=Y({opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeMiterLimit: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,x:1,y:1,x2:1,y2:1,width:1,height:1,aspect:1}),gs=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"],hs={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"},gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDash"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDash"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickWidth:{part:"ticks",vgProp:"strokeWidth"}};const ms=["domain","grid","labels","ticks","title"],bs={grid:"grid",gridColor:"grid",gridDash:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",domain:"main",domainColor:"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",labelFontWeight:"main",labelLimit:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",maxExtent:"main",minExtent:"main",offset:"main",position:"main",tickColor:"main",tickExtra:"main",tickOffset:"both",tickOpacity:"main",tickRound:"main",ticks:"main",tickSize:"main",title:"main",titleAlign:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",tickWidth:"both",tickCount:"both",values:"both",scale:"both",zindex:"both"},vs={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid: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,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand: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,values:1,translate:1,zindex:1},ys=Object.assign(Object.assign({},vs),{labelExpr:1,encoding:1});function xs(e,t,n){return As=t||ws,Os=n||Ns,zs(e.trim()).map(Ts)}var As,Os,ws="view",Fs="[",Cs="]",js="{",Ds="}",Es=":",Ss=",",ks="@",$s=">",Bs=/[[\]{}]/,Ns={"*":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};function _s(e,t,n,i,r){for(var o,s=0,a=e.length;t=0?--s:i&&i.indexOf(o)>=0&&++s}return t}function zs(e){for(var t=[],n=0,i=e.length,r=0;r' after between selector: "+e;if(t=t.map(Ts),(n=Ts(e.slice(1).trim())).between)return{between:t,stream:n};n.between=t;return n}(e):function(e){var t,n,i={source:As},r=[],o=[0,0],s=0,a=0,u=e.length,c=0;if(e[u-1]===Ds){if(!((c=e.lastIndexOf(js))>=0))throw"Unmatched right brace: "+e;try{o=function(e){var t=e.split(Ss);if(!e.length||t.length>2)throw e;return t.map((function(t){var n=+t;if(n!=n)throw e;return n}))}(e.substring(c+1,u-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,c).trim(),u=e.length,c=0}if(!u)throw e;e[0]===ks&&(s=++c);(t=_s(e,c,Es))1?(i.type=r[1],s?i.markname=r[0].slice(1):!function(e){return Os[e]}(r[0])?i.source=r[0]:i.marktype=r[0]):i.type=r[0];"!"===i.type.slice(-1)&&(i.consume=!0,i.type=i.type.slice(0,-1));null!=n&&(i.filter=n);o[0]&&(i.throttle=o[0]);o[1]&&(i.debounce=o[1]);return i}(e)}function Ps(e,t,n,i){const r=t&&t.condition,o=i(t);if(r){return{[n]:[...x(r).map(t=>{const n=i(t),r=function(e){return e.selection}(t)?Gc(e,t.selection):Vc(e,t.test);return Object.assign({test:r},n)}),...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function Ms(e){const{channel:t,channelDef:n,markDef:i,scale:r}=e,o=Is(e);return zi(n)&&!Me(n.aggregate)&&r&&Vn(r.get("type"))&&!1===r.get("zero")?Us({fieldDef:n,channel:t,markDef:i,ref:o}):o}function Us({fieldDef:e,channel:t,markDef:n,ref:i}){return Ae(n.type)?i:[Rs(e,t),i]}function Rs(e,t){const n=Ls(e,!0),i="x"===Et(t)?{value:0}:{field:{group:"height"}};return Object.assign({test:n},i)}function Ls(e,t=!0){return Dn(a(e)?e:Wi(e,{expr:"datum"}),!t)}function Ws(e,t,n,i){const r=Object.assign(Object.assign({},t?{scale:t}:{}),{field:Wi(e,n)});if(i){const{offset:e,band:t}=i;return Object.assign(Object.assign(Object.assign({},r),e?{offset:e}:{}),t?{band:t}:{})}return r}function qs({scaleName:e,fieldDef:t,fieldDef2:n,offset:i,startSuffix:r,band:o=.5}){const s=0Is({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:a}))}function Ys(e){const{markDef:t,encoding:n,config:i}=e,{filled:r,type:o}=t,s={fill:ci("fill",t,i),stroke:ci("stroke",t,i),color:ci("color",t,i)},a=U(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,u=oe(t.fill,!0===r?t.color:void 0,s.fill,!0===r?s.color:void 0,a),c=oe(t.stroke,!1===r?t.color:void 0,s.stroke,!1===r?s.color:void 0),l=r?"fill":"stroke",d=Object.assign(Object.assign({},u?{fill:{value:u}}:{}),c?{stroke:{value:c}}:{});return t.color&&(r?t.fill:t.stroke)&&Qt(Ht.droppingColor("property",{fill:"fill"in t,stroke:"stroke"in t})),Object.assign(Object.assign(Object.assign(Object.assign({},d),Gs("color",e,{vgChannel:l,defaultValue:r?u:c})),Gs("fill",e,{defaultValue:n.fill?u:void 0})),Gs("stroke",e,{defaultValue:n.stroke?c:void 0}))}function Vs(e,t="text"){const n=e.encoding[t];return Ps(e,n,t,t=>Js(t,e.config))}function Js(e,t,n="datum"){if(e){if(Mi(e))return{value:e.value};if(Ti(e))return di(e,Xi(e),n,t)}}function Qs(e,t={}){const{encoding:n,markDef:i,config:r}=e,u=n.tooltip;return o(u)?{tooltip:Xs({tooltip:u},r,t)}:Ps(e,u,"tooltip",o=>{const u=Js(o,e.config,t.reactiveGeom?"datum.datum":"datum");if(u)return u;if(null===o)return;let c=oe(i.tooltip,ci("tooltip",i,r));return!0===c&&(c={content:"encoding"}),a(c)?{value:c}:s(c)?"encoding"===c.content?Xs(n,r,t):{signal:"datum"}:void 0})}function Xs(e,t,{reactiveGeom:n}={}){const i=[],r={},o={},s=n?"datum.datum":"datum",a=[];function c(n,i){const r=Et(i),u=Ti(n)?n:Object.assign(Object.assign({},n),{type:e[r].type}),c=x(Vi(u,t,{allowDisabling:!1})).join(", ");let l=Js(u,t,s).signal;if("x"===i||"y"===i){const n="x"===i?"x2":"y2",r=Zi(e[n]);if(lr(u.bin)&&r){l=hi(Wi(u,{expr:s}),Wi(r,{expr:s}),Xi(u),t),o[n]=!0}}a.push({channel:i,key:c,value:l})}yr(e,(e,t)=>{zi(e)?c(e,t):_i(e)&&c(e.condition,t)});for(const{channel:e,key:t,value:n}of a)o[e]||r[t]||(i.push(`${u(t)}: ${n}`),r[t]=!0);return i.length>0?{signal:`{${i.join(", ")}}`}:void 0}function Zs(e,t){const n=t[e+"Offset"];if(n)return n}function Ks(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,mark:o,markDef:s,config:a,stack:u}=t,c=r[e],l=r[e===Ie?Ge:Ye],d=t.scaleName(e),f=t.getScaleComponent(e),p=Zs(e,t.markDef),g=ea({model:t,markDef:s,config:a,defaultPos:n,channel:e,scaleName:d,scale:f,mark:o,checkBarAreaWithoutZero:!l});return{[null!=i?i:e]:c||!r.latitude&&!r.longitude?function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o}=e;if(zi(n)&&r&&t===r.fieldChannel)return Ri(n)&&void 0!==n.band?qs({scaleName:i,fieldDef:n,startSuffix:"start",band:n.band,offset:0}):Ws(n,i,{suffix:"end"},{offset:o});return Ms(e)}({channel:e,channelDef:c,channel2Def:l,markDef:s,config:a,scaleName:d,scale:f,stack:u,offset:p,defaultRef:g}):{field:t.getName(e)}}}function ea({model:e,markDef:t,config:n,defaultPos:i,channel:r,scaleName:o,scale:s,mark:a,checkBarAreaWithoutZero:u}){return()=>{const c=Et(r),l=oe(t[r],ci(r,t,n));if(void 0!==l)return Hs(r,l);if("zeroOrMin"===i||"zeroOrMax"===i){if(o){const e=s.get("type");if(U([zn.LOG,zn.TIME,zn.UTC],e))!u||"bar"!==a&&"area"!==a||Qt(Ht.nonZeroScaleUsedWithLengthMark(a,c,{scaleType:e}));else{if(s.domainDefinitelyIncludesZero())return{scale:o,value:0};!u||"bar"!==a&&"area"!==a||Qt(Ht.nonZeroScaleUsedWithLengthMark(a,c,{zeroFalse:!1===s.explicit.zero}))}}return"zeroOrMin"===i?"x"===c?{value:0}:{field:{group:"height"}}:"x"===c?{field:{group:"width"}}:{value:0}}{const t=e["x"===c?"width":"height"];return Object.assign(Object.assign({},t),{mult:.5})}}}const ta={left:"x",center:"xc",right:"x2"},na={top:"y",middle:"yc",bottom:"y2"};function ia(e,t,n){const i="x"===e?"align":"baseline",r=oe(t[i],ci(i,t,n));return"x"===e?ta[null!=r?r:"center"]:na[null!=r?r:"middle"]}function ra(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?oa(e,t,{defaultPos:n,defaultPos2:i}):Ks(e,t,{defaultPos:n})}function oa(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,s="x"===e?"width":"height",a=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:s,config:a}=e,u="x2"===n?"x":"y",c="x2"===n?"width":"height",l=i[u],d=e.scaleName(u),f=e.getScaleComponent(u),p=Zs(n,e.markDef);if(!l&&(i.latitude||i.longitude))return{[n]:{field:e.getName(n)}};const g=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:c}){if(zi(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0))return Ws(t,o,{suffix:"start"},{offset:u});return Ms({channel:e,channelDef:n,scaleName:o,scale:s,stack:a,markDef:i,config:r,offset:u,defaultRef:c})}({channel:n,channelDef:l,channel2Def:i[n],markDef:o,config:a,scaleName:d,scale:f,stack:s,offset:p,defaultRef:void 0});if(void 0!==g)return{[n]:g};const h=ea({model:e,markDef:o,config:a,defaultPos:t,channel:n,scaleName:d,scale:f,mark:r,checkBarAreaWithoutZero:!i[n]})();return oe(sa(n,o),sa(n,{[n]:li(n,o,a.style),[c]:li(c,o,a.style)}),sa(n,a[r]),sa(n,a.mark),{[n]:h})}(t,i,"x"===e?"x2":"y2"),u=a[s]?ia(e,r,o):e;return Object.assign(Object.assign({},Ks(e,t,{defaultPos:n,vgChannel:u})),a)}function sa(e,t){const n="x2"===e?"width":"height";return t[e]?{[e]:Hs(e,t[e])}:t[n]?{[n]:{value:t[n]}}:void 0}function aa(e,t,n){var i,r,o,s;const{config:a,encoding:u,markDef:c}=e,l="x"===t?"x2":"y2",d="x"===t?"width":"height",f=u[t],p=u[l],g=e.getScaleComponent(t),h=g?g.get("type"):void 0,m=e.scaleName(t),b=c.orient,v=null!=(s=null!=(o=null!=(r=null!=(i=u[d])?i:u.size)?r:c[d])?o:c.size)?s:ci("size",c,a,{vgChannel:d}),y="x"===t?"vertical"===b:"horizontal"===b;if(zi(f)&&(cr(f.bin)||lr(f.bin)||f.timeUnit&&!p)&&!v&&!Gn(h)){return function({fieldDef:e,fieldDef2:t,channel:n,band:i,scaleName:r,markDef:o,spacing:s=0,reverse:a}){const u={x:a?s:0,x2:a?0:s,y:a?0:s,y2:a?s:0},c=n===Ie?Ge:Ye;return cr(e.bin)||e.timeUnit?{[c]:la({channel:n,fieldDef:e,scaleName:r,markDef:o,band:(1-i)/2,offset:u[`${n}2`]}),[n]:la({channel:n,fieldDef:e,scaleName:r,markDef:o,band:1-(1-i)/2,offset:u[n]})}:lr(e.bin)&&zi(t)?{[c]:Ws(e,r,{},{offset:u[`${n}2`]}),[n]:Ws(t,r,{},{offset:u[n]})}:void Qt(Ht.channelRequiredForBinned(c))}({fieldDef:f,fieldDef2:p,channel:t,markDef:c,scaleName:m,band:$i(t,f,void 0,c,a),spacing:oe(c.binSpacing,a[n].binSpacing),reverse:g.get("reverse")})}if((zi(f)&&Gn(h)||y)&&!p){if(zi(f)&&h===zn.BAND){return function(e,t,n,i){var r;const o=n.scaleName(t),s="x"===t?"width":"height",{markDef:a,encoding:u,config:c}=n,l={[ia(t,a,c)]:Ws(e,o,{},{band:.5})};if(u.size||null!==a.size&&void 0!==a.size){if(a.orient){if(Ki(u.size)||Mi(u.size))return Object.assign(Object.assign({},l),Gs("size",n,{vgChannel:s}));if(void 0!==a.size)return Object.assign(Object.assign({},l),{[s]:{value:a.size}})}else Qt(Ht.cannotApplySizeToNonOrientedMark(a.type))}if(void 0!==(null===(r=i)||void 0===r?void 0:r.value))return Object.assign(Object.assign({},l),{[s]:i});const{band:d=1}=e;return{[t]:Ws(e,o,{binSuffix:"range"},{band:(1-d)/2}),[s]:null!=i?i:ca(o,d)}}(f,t,e,ua(n,c,d,m,g,a,Ri(f)?f.band:void 0))}return function(e,t,n){const i="x"===e?"xc":"yc",r="x"===e?"width":"height";return Object.assign(Object.assign({},Ks(e,t,{defaultPos:"mid",vgChannel:i})),Gs("size",t,{defaultRef:n,vgChannel:r}))}(t,e,ua(n,c,d,m,g,a))}return oa(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function ua(e,t,n,i,r,o,s){const a=oe(t[n],t.size,ci("size",t,o,{vgChannel:n}));if(void 0!==a)return{value:a};if(r){const t=r.get("type");if("point"===t||"band"===t){if(void 0!==o[e].discreteBandSize)return{value:o[e].discreteBandSize};if(t===zn.POINT){const e=r.get("range");return ds(e)&&F(e.step)?{value:e.step-2}:{value:uo-2}}return ca(i,s)}return{value:o[e].continuousBandSize}}const u=so(o.view,n);return{value:oe(o[e].discreteBandSize,u-2)}}function ca(e,t=!0){return{scale:e,band:t}}function la({channel:e,fieldDef:t,scaleName:n,markDef:i,band:r,offset:o}){return Us({fieldDef:t,channel:e,markDef:i,ref:qs({scaleName:n,fieldDef:t,band:r,offset:o})})}function da(e,t){const{fill:n,stroke:i}="include"===t.color?Ys(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(e,t){return ps.reduce((n,i)=>(void 0!==e[i]&&"ignore"!==t[i]&&(n[i]={value:e[i]}),n),{})}(e.markDef,t)),fa(e,"fill",n)),fa(e,"stroke",i)),Gs("opacity",e)),Gs("fillOpacity",e)),Gs("strokeOpacity",e)),Gs("strokeWidth",e)),Qs(e)),Vs(e,"href"))}function fa(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===ui("invalid",o,i)&&n&&!Ae(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&Yn(r)&&(t[o]=!0)}return t},{}),r=Y(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ls(e,t)).join(` ${e} `)}return}(e,{invalid:!0,channels:Ut});if(i)return{[t]:[{test:i,value:null},...x(n)]}}return n?{[t]:n}:{}}function pa(e){const{config:t,markDef:n}=e;if(ui("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&Yn(r)&&(t[o]=!0)}return t},{}),r=Y(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ls(e,t)).join(` ${e} `)}return}(e,{channels:["x","y"]});if(t)return{defined:{signal:t}}}return{}}function ga(e,t){if(void 0!==t)return{[e]:{value:t}}}const ha={has:e=>"interval"!==e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName("voronoi")},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(Ae(o))return Qt(Ht.nearestNotSupportForContinuous(o)),n;const s={name:e.getName("voronoi"),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},Qs(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((t,n)=>{var i;const r=null!=(i=t.name)?i:"";r===e.component.mark[0].name?a=n:r.indexOf("voronoi")>=0&&(u=!0)}),u||n.splice(a+1,0,s),n}};class ma{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.indexOf(e)>-1?console.warn("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this),e.parent.removeChild(e),this.parent=t,e.parent=this}}class ba extends ma{constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,!this.refCounts||this._name in this.refCounts||(this.refCounts[this._name]=0)}clone(){const e=new this.constructor;return e.debugName="clone_"+this.debugName,e._source=this._source,e._name="clone_"+this._name,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${function(e){const t=++se;return e?String(e)+t:t}()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class va extends ma{constructor(e,t){super(e),this.formula=t}clone(){return new va(null,N(this.formula))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{const{timeUnit:r,field:o}=n,s=vf(t)?t.encoding[St(i)]:void 0,a=vf(t)&&Bi(i,n,s,t.markDef,t.config);if(r){const t=Wi(n,{forAs:!0});e[P({as:t,timeUnit:r,field:o})]=Object.assign({as:t,timeUnit:r,field:o},a?{band:!0}:{})}return e},{});return 0===Y(n).length?null:new va(e,n)}static makeFromTransform(e,t){const n=Object.assign({},t);return new va(e,{[P(n)]:n})}merge(e){this.formula=Object.assign({},this.formula);for(const t in e.formula)this.formula[t]&&!e.formula[t].band||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(V(this.formula).map(e=>e.as))}dependentFields(){return new Set(V(this.formula).map(e=>e.field))}hash(){return`TimeUnit ${P(this.formula)}`}assemble(){const e=[];for(const t of V(this.formula)){const{timeUnit:n,field:i,as:r}=t;e.push({field:i,type:"timeunit",units:fn(n),as:[r,`${r}_end`]})}return e}}const ya="_tuple_fields";class xa{constructor(...e){this.items=e,this.hasChannel={},this.hasField={}}}const Aa={has:e=>"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Xr(e.bind),parse:(e,t,n,i)=>{i.on||delete t.events,i.clear||delete t.clear},topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,s=t.init&&t.init[0],a=ha.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((e,r)=>{var c,l;const d=Q(`${i}_${e.field}`);n.filter(e=>e.name===d).length||n.unshift(Object.assign(Object.assign({name:d},s?{init:Ma(s[r])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${u(e.field)}] : null`}]:[],bind:(c=o[e.field],l=null!=c?c:o[e.channel],null!=l?l:o)}))}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter(e=>e.name===i+Ja)[0],s=i+ya,a=r.items.map(e=>Q(`${i}_${e.field}`)),u=a.map(e=>`${e} !== null`).join(" && ");return a.length&&(o.update=`${u} ? {fields: ${s}, values: [${a.join(", ")}]} : null`),delete o.value,delete o.on,n}},Oa={has:e=>"multi"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+"_toggle",value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Ja,i=t.name+"_toggle";return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${eu(e)}}, `)+`${i} ? ${n} : null`}},wa={has:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t,n)=>{n.clear&&(t.clear=a(n.clear)?xs(n.clear,"scope"):n.clear)},topLevelSignals:(e,t,n)=>(Aa.has(t)&&t.project.items.forEach(e=>{const i=n.findIndex(n=>n.name===Q(`${t.name}_${e.field}`));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}),n),signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)t.project.items.forEach(e=>{const t=n.findIndex(t=>t.name===e.signals.visual);if(i(t,"[0, 0]"),-1===t){i(n.findIndex(t=>t.name===e.signals.data),"null")}});else{let e=n.findIndex(e=>e.name===t.name+Ja);i(e,"null"),Oa.has(t)&&(e=n.findIndex(e=>e.name===t.name+"_toggle"),i(e,"false"))}return n}},Fa={has:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!Rt(r))continue;const o=e.getScaleComponent(r),s=o?o.get("type"):void 0;if(!o||!Yn(s)){Qt(Ht.SCALE_BINDINGS_CONTINUOUS);continue}const a={selection:t.name,field:i.field};if(o.set("selectionExtent",a,!0),n.push(i),e.repeater&&e.repeater.row===e.repeater.column){e.getScaleComponent(r===Ie?He:Ie).set("selectionExtent",a,!0)}}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(e=>0===n.filter(t=>t.name===e.signals.data).length);if(!e.parent||ja(e)||0===i.length)return n;const r=n.filter(e=>e.name===t.name)[0];let o=r.update;if(o.indexOf(Xa)>=0)r.update=`{${i.map(e=>`${u(e.field)}: ${e.signals.data}`).join(", ")}}`;else{for(const e of i){const t=`${u(e.field)}: ${e.signals.data}`;o.indexOf(t)<0&&(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!ja(e))for(const e of t.scales){const t=n.filter(t=>t.name===e.signals.data)[0];t.push="outer",delete t.value,delete t.update}return n}};function Ca(e,t){return`domain(${u(e.scaleName(t))})`}function ja(e){var t;return e.parent&&Of(e.parent)&&(null!=(t=!e.parent.parent)?t:ja(e.parent.parent))}const Da={has:e=>{const t="global"===e.resolve&&e.bind&&Xr(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==Jr;return t&&!n&&Qt(Ht.LEGEND_BINDINGS_PROJECT_LENGTH),t&&n},parse:(e,t,n,i)=>{var r;if(i.on||delete t.events,i.clear||delete t.clear,i.on||i.clear){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=x(null!=(r=n.filter)?r:[]),n.filter.indexOf(e)<0&&n.filter.push(e)}const o=Zr(t.bind)?t.bind.legend:"click",s=a(o)?xs(o,"view"):x(o);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Zr(t.bind)&&t.bind.legend,o=e=>t=>{const n=N(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const s=`${e.field}_legend`,a=`${i}_${s}`;if(0===n.filter(e=>e.name===a).length){const e=r.merge.map(o(`${s}_symbols`)).concat(r.merge.map(o(`${s}_labels`))).concat(r.merge.map(o(`${s}_entries`)));n.unshift(Object.assign(Object.assign({name:a},t.init?{}:{value:null}),{on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${a}`,force:!0}]}))}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(e=>e.name===i+Ja),s=i+ya,a=r.items.filter(e=>e.hasLegend).map(e=>Q(`${i}_${e.field}_legend`)),u=`${a.map(e=>`${e} !== null`).join(" && ")} ? {fields: ${s}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?o.on.push({events:a.map(e=>({signal:e})),update:u}):a.length>0&&(o.update=u,delete o.value,delete o.on);const c=n.find(e=>e.name===i+"_toggle"),l=Zr(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push(Object.assign(Object.assign({},c.on[0]),{events:l})):c.on[0].events=l),n}};const Ea="_translate_anchor",Sa="_translate_delta",ka={has:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Fa.has(t),o=i+Ea,{x:s,y:a}=t.project.hasChannel;let u=xs(t.translate,"scope");return r||(u=u.map(e=>(e.between[0].markname=i+La,e))),n.push({name:o,value:{},on:[{events:u.map(e=>e.between[0]),update:"{x: x(unit), y: y(unit)"+(void 0!==s?", extent_x: "+(r?Ca(e,Ie):`slice(${s.signals.visual})`):"")+(void 0!==a?", extent_y: "+(r?Ca(e,He):`slice(${a.signals.visual})`):"")+"}"}]},{name:i+Sa,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==s&&$a(e,t,s,"width",n),void 0!==a&&$a(e,t,a,"height",n),n}};function $a(e,t,n,i,r){var o;const s=t.name,a=s+Ea,u=s+Sa,c=n.channel,l=Fa.has(t),d=r.filter(e=>e.name===n.signals[l?"data":"visual"])[0],f=e.getSizeSignalRef(i).signal,p=e.getScaleComponent(c),g=p.get("type"),h=`${a}.extent_${c}`,m=`${l?"log"===g?"panLog":"pow"===g?"panPow":"panLinear":"panLinear"}(${h}, ${`${l&&c===Ie?"-":""}${u}.${c} / `+(l?`${f}`:`span(${h})`)}`+(l&&"pow"===g?`, ${o=p.get("exponent"),null!=o?o:1}`:"")+")";d.on.push({events:{signal:u},update:l?m:`clampRange(${m}, 0, ${f})`})}const Ba="_zoom_anchor",Na="_zoom_delta",_a={has:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Fa.has(t),o=i+Na,{x:s,y:a}=t.project.hasChannel,c=u(e.scaleName(Ie)),l=u(e.scaleName(He));let d=xs(t.zoom,"scope");return r||(d=d.map(e=>(e.markname=i+La,e))),n.push({name:i+Ba,on:[{events:d,update:r?"{"+[c?`x: invert(${c}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(e=>!!e).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:d,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&za(e,t,s,"width",n),void 0!==a&&za(e,t,a,"height",n),n}};function za(e,t,n,i,r){var o;const s=t.name,a=n.channel,u=Fa.has(t),c=r.filter(e=>e.name===n.signals[u?"data":"visual"])[0],l=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(a),f=d.get("type"),p=u?Ca(e,a):c.name,g=s+Na,h=`${u?"log"===f?"zoomLog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${p}, ${`${s}${Ba}.${a}`}, ${g}`+(u&&"pow"===f?`, ${o=d.get("exponent"),null!=o?o:1}`:"")+")";c.on.push({events:{signal:g},update:u?h:`clampRange(${h}, 0, ${l})`})}const Ta=[{has:()=>!0,parse:(e,t,n)=>{var i,r,s;const a=t.name,u=null!=(i=t.project)?i:t.project=new xa,c={},l={},d=new Set,f=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=Q(`${a}_${n}`);for(let e=1;d.has(i);e++)i=Q(`${a}_${n}_${e}`);return d.add(i),{[t]:i}};if(!n.fields&&!n.encodings){const t=e.config.selection[n.type];if(n.init)for(const e of x(n.init))for(const i of Y(e))Ft(i)?(n.encodings||(n.encodings=[])).push(i):"interval"===n.type?(Qt('Interval selections should be initialized using "x" and/or "y" keys.'),n.encodings=t.encodings):(n.fields||(n.fields=[])).push(i);else n.encodings=t.encodings,n.fields=t.fields}for(const e of null!=(r=n.fields)?r:[]){const t={type:"E",field:e};t.signals=Object.assign({},f(t,"data")),u.items.push(t),u.hasField[e]=t}for(const i of null!=(s=n.encodings)?s:[]){const n=e.fieldDef(i);if(n){let r=n.field;if(n.aggregate){Qt(Ht.cannotProjectAggregate(i,n.aggregate));continue}if(!r){Qt(Ht.cannotProjectOnChannelWithoutField(i));continue}if(n.timeUnit){r=e.vgField(i);const t={as:r,field:n.field,timeUnit:n.timeUnit};l[P(t)]=t}if(!c[r]){let o="E";if("interval"===t.type){Yn(e.getScaleComponent(i).get("type"))&&(o="R")}else n.bin&&(o="R-RE");const s={field:r,channel:i,type:o};s.signals=Object.assign(Object.assign({},f(s,"data")),f(s,"visual")),u.items.push(c[r]=s),u.hasField[r]=u.hasChannel[i]=c[r]}}else Qt(Ht.cannotProjectOnChannelWithoutField(i))}if(n.init){const e=e=>u.items.map(t=>void 0!==e[t.channel]?e[t.channel]:e[t.field]);if("interval"===n.type)t.init=e(n.init);else{const i=o(n.init)?n.init:[n.init];t.init=i.map(e)}}Y(l).length>0&&(u.timeUnit=new va(null,l))},signals:(e,t,n)=>{const i=t.name+ya;return n.filter(e=>e.name===i).length>0?n:n.concat({name:i,value:t.project.items.map(e=>{const t=$e(e,["signals","hasLegend"]),n=N(t);return n.field=te(n.field),n})})}},Oa,Fa,Da,ka,_a,Aa,ha,wa];function Pa(e,t){for(const n of Ta)n.has(e)&&t(n)}function Ma(e,t=!0,n=l){if(o(e)){const i=e.map(e=>Ma(e,t,n));return t?`[${i.join(", ")}]`:i}return Zt(e)?n(rn(e,!1,!t)):t?n(JSON.stringify(e)):e}function Ua(e,t){return Ka(e,(n,i)=>{t=i.marks?i.marks(e,n,t):t,Pa(n,i=>{i.marks&&(t=i.marks(e,n,t))})}),t}function Ra(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const La="_brush",Wa="_scale_trigger",qa={signals:(e,t)=>{const n=t.name,i=n+ya,r=Fa.has(t),o=[],s=[],a=[];if(t.translate&&!r){const e=`!event.item || event.item.mark.name !== ${u(n+La)}`;Ia(t,(t,n)=>{var i;const r=x(null!=(i=n.between[0].filter)?i:n.between[0].filter=[]);return r.indexOf(e)<0&&r.push(e),t})}t.project.items.forEach((n,i)=>{const r=n.channel;if(r!==Ie&&r!==He)return void Qt("Interval selections only support x and y encoding channels.");const c=t.init?t.init[i]:null,l=function(e,t,n,i){const r=n.channel,o=n.signals.visual,s=n.signals.data,a=Fa.has(t),c=u(e.scaleName(r)),l=e.getScaleComponent(r),d=l?l.get("type"):void 0,f=e=>`scale(${c}, ${e})`,p=e.getSizeSignalRef(r===Ie?"width":"height").signal,g=`${r}(unit)`,h=Ia(t,(e,t)=>[...e,{events:t.between[0],update:`[${g}, ${g}]`},{events:t,update:`[${o}[0], clamp(${g}, 0, ${p})]`}]);return h.push({events:{signal:t.name+Wa},update:Yn(d)?`[${f(`${s}[0]`)}, ${f(`${s}[1]`)}]`:"[0, 0]"}),a?[{name:s,on:[]}]:[Object.assign(Object.assign({name:o},i?{init:Ma(i,!0,f)}:{value:[]}),{on:h}),Object.assign(Object.assign({name:s},i?{init:Ma(i)}:{}),{on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${c}, ${o})`}]})]}(e,t,n,c),d=n.signals.data,f=n.signals.visual,p=u(e.scaleName(r)),g=Yn(e.getScaleComponent(r).get("type"))?"+":"";o.push(...l),s.push(d),a.push({scaleName:e.scaleName(r),expr:`(!isArray(${d}) || `+`(${g}invert(${p}, ${f})[0] === ${g}${d}[0] && `+`${g}invert(${p}, ${f})[1] === ${g}${d}[1]))`})}),r||o.push({name:n+Wa,value:{},on:[{events:a.map(e=>({scale:e.scaleName})),update:a.map(e=>e.expr).join(" && ")+` ? ${n+Wa} : {}`}]});const c=t.init,l=`unit: ${eu(e)}, fields: ${i}, values`;return o.concat(Object.assign(Object.assign({name:n+Ja},c?{init:`{${l}: ${Ma(c)}}`}:{}),{on:[{events:[{signal:s.join(" || ")}],update:s.join(" && ")+` ? {${l}: [${s}]} : null`}]}))},modifyExpr:(e,t)=>{return t.name+Ja+", "+("global"===t.resolve?"true":`{unit: ${eu(e)}}`)},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,s=r&&r.signals.visual,a=o&&o.signals.visual,c=`data(${u(t.name+Va)})`;if(Fa.has(t))return n;const l={x:void 0!==r?{signal:`${s}[0]`}:{value:0},y:void 0!==o?{signal:`${a}[0]`}:{value:0},x2:void 0!==r?{signal:`${s}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${a}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of Y(l))l[t]=[Object.assign({test:`${c}.length && ${c}[0].unit === ${eu(e)}`},l[t]),{value:0}];const d=t.mark,{fill:f,fillOpacity:p}=d,g=$e(d,["fill","fillOpacity"]),h=Y(g).reduce((e,t)=>(e[t]=[{test:[void 0!==r&&`${s}[0] !== ${s}[1]`,void 0!==o&&`${a}[0] !== ${a}[1]`].filter(e=>e).join(" && "),value:g[t]},{value:null}],e),{});return[{name:i+La+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:p}},update:l}},...n,{name:i+La,type:"rect",clip:!0,encode:{enter:{fill:{value:"transparent"}},update:Object.assign(Object.assign({},l),h)}}]}};function Ia(e,t){return e.events.reduce((e,n)=>n.between?t(e,n):(Qt(`${n} is not an ordered event stream for interval selections.`),e),[])}function Ha(e,t){const n=t.name,i=n+ya,r=t.project,o="(item().isVoronoi ? datum.datum : datum)",s=r.items.map(t=>{const n=e.fieldDef(t.channel);return n&&n.bin?`[${o}[${u(e.vgField(t.channel,{}))}], `+`${o}[${u(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${o}[${u(t.field)}]`}).join(", "),a=`unit: ${eu(e)}, fields: ${i}, values`,c=t.events;return[{name:n+Ja,on:c?[{events:c,update:`datum && item().mark.marktype !== 'group' ? {${a}: [${s}]} : null`,force:!0}]:[]}]}const Ga={signals:Ha,modifyExpr:(e,t)=>{return t.name+Ja+", "+("global"===t.resolve?"null":`{unit: ${eu(e)}}`)}},Ya={signals:Ha,modifyExpr:(e,t)=>{return t.name+Ja+", "+("global"===t.resolve?"true":`{unit: ${eu(e)}}`)}},Va="_store",Ja="_tuple",Qa="_modify",Xa="vlSelectionResolve",Za={single:Ya,multi:Ga,interval:qa};function Ka(e,t){const n=e.component.selection;if(n)for(const e in n)if(O(n,e)){const i=n[e];if(!0===t(i,Za[i.type]))break}}function eu(e,{escape:t}={escape:!0}){let n=t?u(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!yf(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of yt)e[t]&&(n+=` + '__facet_${t}_' + (facet[${u(i.vgField(t))}])`)}return n}function tu(e){let t=!1;return Ka(e,e=>{t=t||e.project.items.some(e=>e.field===Jr)}),t}var nu,iu,ru,ou,su,au="RawCode",uu="Literal",cu="Property",lu="Identifier",du="ArrayExpression",fu="BinaryExpression",pu="CallExpression",gu="ConditionalExpression",hu="LogicalExpression",mu="MemberExpression",bu="ObjectExpression",vu="UnaryExpression";function yu(e){this.type=e}yu.prototype.visit=function(e){var t,n,i;if(e(this))return 1;for(n=0,i=(t=function(e){switch(e.type){case du:return e.elements;case fu:case hu:return[e.left,e.right];case pu:var t=e.arguments.slice();return t.unshift(e.callee),t;case gu:return[e.test,e.consequent,e.alternate];case mu:return[e.object,e.property];case bu:return e.properties;case cu:return[e.key,e.value];case vu:return[e.argument];case lu:case uu:case au:default:return[]}}(this)).length;n",nu[Ou]="Identifier",nu[wu]="Keyword",nu[Fu]="Null",nu[Cu]="Numeric",nu[ju]="Punctuator",nu[Du]="String",nu[9]="RegularExpression";var Eu="ArrayExpression",Su="BinaryExpression",ku="CallExpression",$u="ConditionalExpression",Bu="Identifier",Nu="Literal",_u="LogicalExpression",zu="MemberExpression",Tu="ObjectExpression",Pu="Property",Mu="UnaryExpression",Uu="Unexpected token %0",Ru="Unexpected number",Lu="Unexpected string",Wu="Unexpected identifier",qu="Unexpected reserved word",Iu="Unexpected end of input",Hu="Invalid regular expression",Gu="Invalid regular expression: missing /",Yu="Octal literals are not allowed in strict mode.",Vu="Duplicate data property in object literal not allowed in strict mode",Ju="ILLEGAL",Qu="Disabled.",Xu=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]"),Zu=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 Ku(e,t){if(!e)throw new Error("ASSERT: "+t)}function ec(e){return e>=48&&e<=57}function tc(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function nc(e){return"01234567".indexOf(e)>=0}function ic(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function rc(e){return 10===e||13===e||8232===e||8233===e}function oc(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Xu.test(String.fromCharCode(e))}function sc(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Zu.test(String.fromCharCode(e))}var ac={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 uc(){for(var e;ru1114111||"}"!==e)&&Cc({},Uu,Ju),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function dc(){var e,t;for(e=iu.charCodeAt(ru++),t=String.fromCharCode(e),92===e&&(117!==iu.charCodeAt(ru)&&Cc({},Uu,Ju),++ru,(e=cc("u"))&&"\\"!==e&&oc(e.charCodeAt(0))||Cc({},Uu,Ju),t=e);ru>>="===(i=iu.substr(ru,4))?{type:ju,value:i,start:r,end:ru+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:ju,value:n,start:r,end:ru+=3}:s===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(s)>=0||"=>"===t?{type:ju,value:t,start:r,end:ru+=2}:"<>=!+-*%&|^/".indexOf(s)>=0?(++ru,{type:ju,value:s,start:r,end:ru}):void Cc({},Uu,Ju)}function gc(){var e,t,n;if(Ku(ec((n=iu[ru]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=ru,e="","."!==n){if(e=iu[ru++],n=iu[ru],"0"===e){if("x"===n||"X"===n)return++ru,function(e){for(var t="";ru=0&&Cc({},Hu,n),{value:n,literal:t}}(),i=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(e,t){if(parseInt(t,16)<=1114111)return"x";Cc({},Hu)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Cc({},Hu)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:ru}}function mc(){var e;return uc(),ru>=ou?{type:Au,start:ru,end:ru}:oc(e=iu.charCodeAt(ru))?fc():40===e||41===e||59===e?pc():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(Ku("'"===(e=iu[ru])||'"'===e,"String literal must starts with a quote"),t=ru,++ru;ru=0&&ru":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}return t}function Wc(){var e,t;return e=function(){var e,t,n,i,r,o,s,a,u,c;if(e=su,u=Rc(),0===(r=Lc(i=su)))return u;for(i.prec=r,bc(),t=[e,su],o=[u,i,s=Rc()];(r=Lc(su))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)s=o.pop(),a=o.pop().value,u=o.pop(),t.pop(),n=yc(a,u,s),o.push(n);(i=bc()).prec=r,o.push(i),t.push(su),n=Rc(),o.push(n)}for(n=o[c=o.length-1],t.pop();c>1;)t.pop(),n=yc(o[c-1].value,o[c-2],n),c-=2;return n}(),Ec("?")&&(bc(),t=Wc(),Dc(":"),e=function(e,t,n){var i=new yu($u);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,Wc())),e}function qc(){var e=Wc();if(Ec(","))throw new Error(Qu);return e}function Ic(e){const t=function(e){ru=0,ou=(iu=e).length,su=null,vc();var t=qc();if(su.type!==Au)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit(e=>{"MemberExpression"===e.type&&function e(t){return"MemberExpression"===t.object.type?e(t.object):"datum"===t.object.name}(e)&&n.add(function e(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...e(t.object)),n.push(...e(t.property))),n)}(e).slice(1).join("."))}),n}class Hc extends ma{constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=Vc(this.model,this.filter,this),this._dependentFields=Ic(this.expr)}clone(){return new Hc(null,this.model,N(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Gc(e,t,n,i="datum"){const r=[];const o=X(t,(function(t){const o=Q(t),s=e.getSelectionComponent(o,t),a=u(o+Va);if(s.project.timeUnit){const t=null!=n?n:e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}return"none"!==s.empty&&r.push(a),`vlSelectionTest(${a}, ${i}`+("global"===s.resolve?")":`, ${u(s.resolve)})`)}));return(r.length?"!("+r.map(e=>`length(data(${e}))`).join(" || ")+") || ":"")+`(${o})`}function Yc(e,t){const n=t.encoding;let i=t.field;if(n||i){if(n&&!i){const r=e.project.items.filter(e=>e.channel===n);!r.length||r.length>1?(i=e.project.items[0].field,Qt((r.length?"Multiple ":"No ")+`matching ${u(n)} encoding found for selection ${u(t.selection)}. `+`Using "field": ${u(i)}.`)):i=r[0].field}}else i=e.project.items[0].field,e.project.items.length>1&&Qt('A "field" or "encoding" must be specified when using a selection as a scale domain. '+`Using "field": ${u(i)}.`);return`${e.name}[${u(i)}]`}function Vc(e,t,n){return X(t,t=>a(t)?t:function(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}(t)?Gc(e,t.selection,n):jn(t))}function Jc(e,t,n,i){var r,o,s;e.encode=null!=(r=e.encode)?r:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(s=e.encode[t].update)?s:{},e.encode[t].update[n]=i}function Qc(e,t,n,i={header:!1}){var r,s;const a=e.combine(),{orient:u,scale:c,labelExpr:l,title:d,zindex:f}=a,p=$e(a,["orient","scale","labelExpr","title","zindex"]);if(Y(p).forEach(e=>{const n=bs[e],i=p[e];if(n&&n!==t&&"both"!==n)delete p[e];else if(function(e){return e.condition}(i)){const{vgProp:t,part:n}=hs[e],{condition:r,value:s}=i,a=[...(o(r)?r:[r]).map(e=>{const{value:t,test:n}=e;return{test:Vc(null,n),value:t}}),{value:s}];Jc(p,n,t,a),delete p[e]}}),"grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode=Object.assign({},e?{grid:e}:{}),0===Y(p.encode).length&&delete p.encode}return Object.assign(Object.assign({scale:c,orient:u},p),{domain:!1,labels:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:oe(f,0)})}{if(!i.header&&e.mainExtracted)return;if(void 0!==l){let e=l;(null===(s=null===(r=p.encode)||void 0===r?void 0:r.labels)||void 0===s?void 0:s.update)&&ls(p.encode.labels.update.text)&&(e=ne(l,"datum.label",p.encode.labels.update.text.signal)),Jc(p,"labels","text",{signal:e})}if(p.encode){for(const t of ms)e.hasAxisPart(t)||delete p.encode[t];0===Y(p.encode).length&&delete p.encode}const t=function(e,t){if(e)return oi(e)?e:e.map(e=>Qi(e,t)).join(", ")}(d,n);return Object.assign(Object.assign(Object.assign({scale:c,orient:u,grid:!1},t?{title:t}:{}),p),{zindex:oe(f,0)})}}function Xc(e){const{axes:t}=e.component;for(const n of Nt)if(t[n])for(const i of t[n])if(!i.get("gridScale")){const t="x"===n?"height":"width";return[{name:t,update:e.getSizeSignalRef(t).signal}]}return[]}const Zc={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"},Kc={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelLimit:"limit",labelOrient:"orient",labelPadding:"offset"},el=Y(Zc),tl=Y(Kc);function nl(e,t,n,i,r){var o;const s=[..."band"===r?["axisBand"]:[],"x"===n?"axisX":"axisY",...i?["axis"+i.substr(0,1).toUpperCase()+i.substr(1)]:[],"axis"];for(const n of s)if(void 0!==(null===(o=t[n])||void 0===o?void 0:o[e]))return t[n][e]}function il(e,t){if(void 0!==e)return e=ae(e),"top"===t||"bottom"===t?e<=45||315<=e?"top"===t?"bottom":"top":135<=e&&e<=225?"top"===t?"top":"bottom":"middle":e<=45||315<=e||135<=e&&e<=225?"middle":45<=e&&e<=135?"left"===t?"top":"bottom":"left"===t?"bottom":"top"}function rl(e,t){if(void 0!==e)return e=ae(e),"top"===t||"bottom"===t?e%180==0?"center":0{if(Ui(t)&&ji(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,s=o.map((e,t)=>`${jn({field:i,timeUnit:r,equal:e})} ? ${t} : `).join("")+o.length;e=new sl(e,{calculate:s,as:al(t,n,{forAs:!0})})}}),e}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 ${P(this.transform)}`}}function al(e,t,n){return Wi(e,Object.assign({prefix:t,suffix:"sort_index"},null!=n?n:{}))}function ul(e,t){return U(["top","bottom"],t)?"column":U(["left","right"],t)?"row":"row"===e?"row":"column"}function cl(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return oe(t&&t.header?t.header[e]:void 0,r[e],n.header[e])}function ll(e,t,n,i){const r={};for(const o of e){const e=cl(o,t,n,i);void 0!==e&&(r[o]=e)}return r}const dl=["row","column"],fl=["header","footer"];function pl(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}=ll(["titleAnchor","titleAngle","titleOrient"],r,i,t),u=ul(t,a);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:n},"row"===t?{orient:"left"}:{}),{style:"guide-title"}),hl(s,u)),gl(u,s,o)),Ol(i,r,t,el,Zc))}}function gl(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=rl(t,"row"===e?"left":"top");return i?{align:i}:{}}function hl(e,t){const n=il(e,"row"===t?"left":"top");return n?{baseline:n}:{}}function ml(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of fl)if(n[r])for(const o of n[r])i.push(yl(e,t,r,n,o));return i}function bl(e,t){var n;const{sort:i}=e;return Ci(i)?{field:Wi(i,{expr:"datum"}),order:(n=i.order,null!=n?n:"ascending")}:o(i)?{field:al(e,t,{expr:"datum"}),order:"ascending"}:{field:Wi(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function vl(e,t,n){const{format:i,labelAngle:r,labelAnchor:o,labelOrient:s,labelExpr:a}=ll(["format","labelAngle","labelAnchor","labelOrient","labelExpr"],e,n,t),u=di(e,i,"parent",n).signal,c=ul(t,s);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:a?ne(ne(a,"datum.label",u),"datum.value",Wi(e,{expr:"parent"})):u}},"row"===t?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),hl(r,c)),gl(c,r,o)),Ol(n,e,t,tl,Kc))}function yl(e,t,n,i,r){var o;if(r){let s=null;const{facetFieldDef:a}=i,u=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=ll(["labelOrient"],a,u,t);("row"===t&&!U(["top","bottom"],e)||"column"===t&&!U(["left","right"],e))&&(s=vl(a,t,u))}const c=yf(e)&&!Di(e.facet),l=r.axes,d=(null===(o=l)||void 0===o?void 0:o.length)>0;if(s||d){const o="row"===t?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`},i.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:bl(a,t)}:{}),d&&c?{from:{data:e.getName(`facet_domain_${t}`)}}:{}),s?{title:s}:{}),r.sizeSignal?{encode:{update:{[o]:r.sizeSignal}}}:{}),d?{axes:l}:{})}}return null}const xl={column:{start:0,end:1},row:{start:1,end:0}};function Al(e,t){return xl[t][e]}function Ol(e,t,n,i,r){const o={};for(const s of i){if(!r[s])continue;const i=cl(s,t,e,n);void 0!==i&&(o[r[s]]=i)}return o}function wl(e){return[...Fl(e,"width"),...Fl(e,"height")]}function Fl(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(Gn(i)&&ds(o)){const i=e.scaleName(n);if(yf(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[Cl(i,o)]}return[Cl(i,o),{name:r,update:jl(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${oo(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function Cl(e,t){return{name:e+"_step",value:t.step}}function jl(e,t,n){const i=t.get("type"),r=t.get("padding"),o=oe(t.get("paddingOuter"),r);let s=t.get("paddingInner");return s="band"===i?void 0!==s?s:r:1,`bandspace(${n}, ${s}, ${o}) * ${e}_step`}function Dl(e,t){return Y(e).reduce((n,i)=>{const r=e[i];return Object.assign(Object.assign({},n),Ps(t,r,i,e=>({value:e.value})))},{})}function El(e,t){if(Of(t)||yf(t))return"shared";if(Af(t)||xf(t))return U(Nt,e)?"independent":"shared";throw new Error("invalid model type for resolve")}function Sl(e,t){const n=e.scale[t],i=U(Nt,t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Qt(Ht.independentScaleMeansIndependentGuide(t)),"independent"):e[i][t]||"shared"}class kl{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new kl(N(this.explicit),N(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(e){return oe(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){void 0!==t.value&&this.set(e,t.value,t.explicit)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of Y(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function $l(e){return{explicit:!0,value:e}}function Bl(e){return{explicit:!1,value:e}}function Nl(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:_l(t,n,i,r)}}function _l(e,t,n,i){return e.explicit&&t.explicit&&Qt(Ht.mergeConflictingProperty(n,i,e.value,t.value)),e}function zl(e,t,n,i,r=_l){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:B(e.value,t.value)?e:r(e,t,n,i)}const Tl=Object.assign(Object.assign({},{clipHeight:1,columnPadding:1,columns:1,cornerRadius: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}),{labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),Pl=Y(Tl);class Ml extends kl{}function Ul(e){const{legend:t}=e;return oe(t.type,Rl(e))}function Rl({channel:e,timeUnit:t,scaleType:n,alwaysReturn:i}){if(bt(e)){if(U(["quarter","month","day"],t))return"symbol";if(Vn(n))return i?"gradient":void 0}return i?"symbol":void 0}function Ll({legend:e,legendConfig:t,timeUnit:n,channel:i,scaleType:r}){const o=oe(e.orient,t.orient,"right"),s=Ul({legend:e,channel:i,timeUnit:n,scaleType:r,alwaysReturn:!0});return oe(e.direction,t[s?"gradientDirection":"symbolDirection"],function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(o,s))}function Wl(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function ql(e,t,n){const i=t.getScaleComponent(n).get("type");return oe(e.get("type"),Rl({channel:n,scaleType:i,alwaysReturn:!0}))}function Il(e){return Gl(e,(e,t)=>Math.max(e,t.value))}function Hl(e){return Gl(e,(e,t)=>oe(e,t.value))}function Gl(e,t){return function(e){return!!e&&!!e.condition&&(o(e.condition)||Mi(e.condition))}(e)?(o(e.condition)?e.condition:[e.condition]).reduce(t,e.value):Mi(e)?e.value:void 0}function Yl(e,t,n){var i;const r=t.get("selections");if(!(null===(i=r)||void 0===i?void 0:i.length))return;const o=u(n.field);return r.map(e=>{return`(!length(data(${u(Q(e)+Va)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`}).join(" || ")}var Vl=Object.freeze({__proto__:null,symbols:function(e,t,n,i,r){var s,a,u,c,l;if("symbol"!==ql(r,n,i))return;let d=Object.assign(Object.assign({},function(e,t,n){for(const i of n){const n=ci(i,t.markDef,t.config);void 0!==n&&(e[i]={value:n})}return e}({},n,Ce)),Ys(n));const{markDef:f,encoding:p,config:g}=n,h=f.filled,m=null!=(s=Il(p.opacity))?s:f.opacity,b=Yl(n,r,e);if(d.fill)if("fill"===i||h&&i===Ze)delete d.fill;else if(d.fill.field)r.get("symbolFillColor")?delete d.fill:(d.fill={value:(a=g.legend.symbolBaseFillColor,null!=a?a:"black")},d.fillOpacity={value:null!=m?m:1});else if(o(d.fill)){const e=null!=(l=null!=(c=Hl(null!=(u=p.fill)?u:p.color))?c:f.fill)?l:h&&f.color;e&&(d.fill={value:e})}if(d.stroke)if("stroke"===i||!h&&i===Ze)delete d.stroke;else if(d.stroke.field)delete d.stroke;else if(o(d.stroke)){const e=oe(Hl(p.stroke||p.color),f.stroke,h?f.color:void 0);e&&(d.stroke={value:e})}return i!==it&&(b?d.opacity=[{test:b,value:null!=m?m:1},{value:g.legend.unselectedOpacity}]:m&&(d.opacity={value:m})),d=Object.assign(Object.assign({},d),t),Y(d).length>0?d:void 0},gradient:function(e,t,n,i,r){if("gradient"!==ql(r,n,i))return;let o={};const s=Il(n.encoding.opacity)||n.markDef.opacity;return s&&(o.opacity={value:s}),o=Object.assign(Object.assign({},o),t),Y(o).length>0?o:void 0},labels:function(e,t,n,i,r){const o=n.legend(i),s=n.config,a=Yl(n,r,e);let u={};if(rr(e)){const r=n.getScaleComponent(i).get("type")===zn.UTC,a=mi("datum.value",e.timeUnit,o.format,s.timeFormat,r);t=Object.assign(Object.assign({},a?{text:{signal:a}}:{}),t)}return a&&(t.opacity=[{test:a,value:1},{value:s.legend.unselectedOpacity}]),u=Object.assign(Object.assign({},u),t),Y(u).length>0?u:void 0},entries:function(e,t,n,i,r){var o;return(null===(o=r.get("selections"))||void 0===o?void 0:o.length)?{fill:{value:"transparent"}}:void 0},getFirstConditionValue:Hl});function Jl(e){vf(e)?e.component.legends=function(e){const{encoding:t}=e;return[Ze,Ke,et,st,nt,tt,it,rt,ot].reduce((n,i)=>{const r=t[i];return!e.legend(i)||!e.getScaleComponent(i)||zi(r)&&i===tt&&r.type===_n||(n[i]=function(e,t){var n;const i=e.fieldDef(t),r=e.legend(t),o=new Ml({},function(e,t){const n=e.scaleName(Ze);if("color"===t)return e.markDef.filled?{fill:n}:{stroke:n};return{[t]:e.scaleName(t)}}(e,t));!function(e,t,n){const i=e.fieldDef(t).field;Ka(e,e=>{var r,o;const s=null!=(r=e.project.hasField[i])?r:e.project.hasChannel[t];if(s&&Da.has(e)){const t=null!=(o=n.get("selections"))?o:[];t.push(e.name),n.set("selections",t,!1),s.hasLegend=!0}})}(e,t,o);for(const n of Pl){const s=Xl(n,r,t,e);if(void 0!==s){const t=Ql(s,n,r,i);(t||void 0===e.config.legend[n])&&o.set(n,s,t)}}const s=null!==(n=r.encoding)&&void 0!==n?n:{},a=o.get("selections"),u=["labels","legend","title","symbols","gradient","entries"].reduce((n,r)=>{var u,c,l;const d=Dl(null!=(u=s[r])?u:{},e),f=Vl[r]?Vl[r](i,d,e,t,o):d;return void 0!==f&&Y(f).length>0&&(n[r]=Object.assign(Object.assign(Object.assign({},(null===(c=a)||void 0===c?void 0:c.length)?{name:`${i.field}_legend_${r}`}:{}),(null===(l=a)||void 0===l?void 0:l.length)?{interactive:!!a}:{}),{update:f})),n},{});Y(u).length>0&&o.set("encode",u,!!r.encoding);return o}(e,i)),n},{})}(e):e.component.legends=function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children)Jl(i),Y(i.component.legends).forEach(r=>{n.legend[r]=Sl(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=Zl(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))});return Y(t).forEach(t=>{for(const i of e.children)i.component.legends[t]&&"shared"===n.legend[t]&&delete i.component.legends[t]}),t}(e)}function Ql(e,t,n,i){switch(t){case"values":return!!n.values;case"title":if("title"===t&&e===i.title)return!0}return e===n[t]}function Xl(e,t,n,i){const{encoding:r,mark:o}=i,s=Ki(r[n]),a=i.config.legend,{timeUnit:u}=s,c=i.getScaleComponent(n).get("type");switch(e){case"direction":return Ll({legend:t,legendConfig:a,timeUnit:u,channel:n,scaleType:c});case"format":if(rr(s))return;return fi(s,t.format,i.config);case"formatType":if(rr(s))return;return t.formatType;case"gradientLength":return oe(t.gradientLength,a.gradientLength,function({legend:e,legendConfig:t,model:n,channel:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:s,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=t;if("horizontal"===Ll({legend:e,legendConfig:t,channel:i,scaleType:r})){const i=oe(e.orient,t.orient);return"top"===i||"bottom"===i?Wl(n,"width",s,o):s}return Wl(n,"height",u,a)}({model:i,legend:t,legendConfig:a,channel:n,scaleType:c}));case"labelOverlap":return oe(t.labelOverlap,function(e){if(U(["quantile","threshold","log"],e))return"greedy"}(c));case"symbolType":return oe(t.symbolType,function(e,t,n,i){var r;if("shape"!==t){const e=null!=(r=Hl(n))?r:i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(o,n,r.shape,i.markDef.shape));case"title":return Vi(s,i.config,{allowDisabling:!0})||void 0;case"type":return Ul({legend:t,channel:n,timeUnit:u,scaleType:c,alwaysReturn:!1});case"values":return function(e,t){const n=e.values;if(n)return sr(t,n)}(t,s)}return t[e]}function Zl(e,t){var n,i,r,o,s,a;if(!e)return t.clone();const u=e.getWithExplicit("orient"),c=t.getWithExplicit("orient");if(u.explicit&&c.explicit&&u.value!==c.value)return;let l=!1;for(const n of Pl){const i=zl(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return Kl(e,t);case"title":return xi(e,t);case"type":return l=!0,Bl("symbol")}return _l(e,t,n,"legend")});e.setWithExplicit(n,i)}return l&&((null==(r=null===(i=null===(n=e.implicit)||void 0===n?void 0:n.encode)||void 0===i?void 0:i.gradient)||r)&&Z(e.implicit,["encode","gradient"]),(null==(a=null===(s=null===(o=e.explicit)||void 0===o?void 0:o.encode)||void 0===s?void 0:s.gradient)||a)&&Z(e.explicit,["encode","gradient"])),e}function Kl(e,t){return"circle"===t.value?t:e}function ed(e){const t=e.component.legends,n={};for(const i of Y(t)){const r=e.getScaleComponent(i),o=T(r.get("domains"));if(n[o])for(const e of n[o]){Zl(e,t[i])||n[o].push(t[i])}else n[o]=[t[i].clone()]}return V(n).flat().map(e=>{var t,n,i,r;const o=e.combine(),{labelExpr:s,selections:a}=o,u=$e(o,["labelExpr","selections"]);if(null===(t=u.encode)||void 0===t?void 0:t.symbols){const e=u.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||u.stroke||(e.stroke={value:"transparent"}),u.fill&&delete e.fill}if(void 0!==s){let e=s;(null===(r=null===(i=null===(n=u.encode)||void 0===n?void 0:n.labels)||void 0===i?void 0:i.update)||void 0===r?void 0:r.text)&&ls(u.encode.labels.update.text)&&(e=ne(s,"datum.label",u.encode.labels.update.text.signal)),function(e,t,n,i){var r,o,s;e.encode=null!=(r=e.encode)?r:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(s=e.encode[t].update)?s:{},e.encode[t].update[n]=i}(u,"labels","text",{signal:e})}return u})}function td(e){return Of(e)||Af(e)||xf(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),nd(e))}(e):nd(e)}function nd(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n,r=$e(n,["name"]);if(t.data){const n={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},o=t.data.reduce((t,n)=>{const i=ls(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return U(t,i)||t.push(i),t},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:i,size:n,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]}},r)]}return[Object.assign(Object.assign({name:i},{translate:{signal:"[width / 2, height / 2]"}}),r)]}const id=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class rd extends kl{constructor(e,t,n,i){super(Object.assign({},t),{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function od(e){e.component.projection=vf(e)?function(e){var t;if(e.hasProjection){const n=e.specifiedProjection,i=!(n&&(null!=n.scale||null!=n.translate)),r=i?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,o=i?function(e){const t=[];for(const n of[[Je,Ve],[Xe,Qe]])(e.channelHasField(n[0])||e.channelHasField(n[1]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(tt)&&e.fieldDef(tt).type===_n&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(Io));return t}(e):void 0;return new rd(e.projectionName(!0),Object.assign(Object.assign({},null!=(t=e.config.projection)?t:{}),null!=n?n:{}),r,o)}return}(e):function(e){if(0===e.children.length)return;let t;e.children.forEach(e=>od(e));const n=L(e.children,e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=L(id,n=>!O(e.explicit,n)&&!O(t.explicit,n)||!(!O(e.explicit,n)||!O(t.explicit,n)||T(e.get(n))!==T(t.get(n))));if(T(e.size)===T(t.size)){if(n)return e;if(T(e.explicit)===T({}))return t;if(T(t.explicit)===T({}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0});if(t&&n){const n=e.projectionName(!0),i=new rd(n,t.specifiedProjection,t.size,N(t.data));return e.children.forEach(e=>{const t=e.component.projection;t&&(t.isFit&&i.data.push(...e.component.projection.data),e.renameProjection(t.get("name"),n),t.merged=!0)}),i}return}(e)}function sd(e,t){return`${ur(e)}_${t}`}function ad(e,t,n){var i;const r=sd(null!=(i=nr(n,void 0))?i:{},t);return e.getName(`${r}_bins`)}function ud(e,t,n){let i,r;i=function(e){return"as"in e}(e)?a(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[Wi(e,{forAs:!0}),Wi(e,{binSuffix:"end",forAs:!0})];const o=Object.assign({},nr(t,void 0)),s=sd(o,e.field),{signal:u,extentSignal:c}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,s);if(fr(o.extent)){const e=o.extent,t=e.selection;r=Yc(n.getSelectionComponent(Q(t),t),e),delete o.extent}return{key:s,binComponent:Object.assign(Object.assign(Object.assign({bin:o,field:e.field,as:[i]},u?{signal:u}:{}),c?{extentSignal:c}:{}),r?{span:r}:{})}}class cd extends ma{constructor(e,t){super(e),this.bins=t}clone(){return new cd(null,N(this.bins))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{if(Ti(n)&&cr(n.bin)){const{key:r,binComponent:o}=ud(n,n.bin,t);e[r]=Object.assign(Object.assign(Object.assign({},o),e[r]),function(e,t,n,i){var r,o;if(ar(t,n)){const s=vf(e)?null!=(o=null!=(r=e.axis(n))?r:e.legend(n))?o:{}:{},a=Wi(t,{expr:"datum"}),u=Wi(t,{expr:"datum",binSuffix:"end"});return{formulaAs:Wi(t,{binSuffix:"range",forAs:!0}),formula:hi(a,u,s.format,i)}}return{}}(t,n,i,t.config))}return e},{});return 0===Y(n).length?null:new cd(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=ud(t,t.bin,n);return new cd(e,{[i]:r})}merge(e,t){for(const n of Y(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=q([...this.bins[n].as,...e.bins[n].as],P)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(V(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(V(this.bins).map(e=>e.field))}hash(){return`Bin ${P(this.bins)}`}assemble(){return V(this.bins).flatMap(e=>{const t=[],[n,...i]=e.as,r=e.bin,{extent:o}=r,s=$e(r,["extent"]),a=Object.assign(Object.assign(Object.assign({type:"bin",field:te(e.field),as:n,signal:e.signal},fr(o)?{extent:null}:{extent:o}),e.span?{span:{signal:`span(${e.span})`}}:{}),s);!o&&e.extentSignal&&(t.push({type:"extent",field:te(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:Wi({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}class ld extends ma{constructor(e){let t;if(super(null),Ro(e=null!=e?e:{name:"source"})||(t=e.format?Object.assign({},z(e.format,["parse"])):{}),Mo(e))this._data={values:e.values};else if(Po(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];U(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else Wo(e)?this._data={values:[{type:"Sphere"}]}:(Uo(e)||Ro(e))&&(this._data={});this._generator=Ro(e),e.name&&(this._name=e.name),t&&Y(t).length>0&&(this._data.format=t)}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(e){this._name=e}set parent(e){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 Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}function dd(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return console.error("Dataflow graph is inconsistent.",t,e),!1;if(!dd(t.children))return!1}return!0}class fd extends ma{constructor(e,t){super(e),this.params=t}clone(){return new fd(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${P(this.params)}`}assemble(){return Object.assign({type:"graticule"},!0===this.params?{}:this.params)}}class pd extends ma{constructor(e,t){super(e),this.params=t}clone(){return new pd(null,this.params)}dependentFields(){return new Set}producedFields(){var e;return new Set([(e=this.params.as,null!=e?e:"data")])}hash(){return`Hash ${P(this.params)}`}assemble(){return Object.assign({type:"sequence"},this.params)}}function gd(e){return e instanceof ld||e instanceof fd||e instanceof pd}class hd{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class md extends hd{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:e,mutatedFlag:t}){e&&this.setContinue(),t&&this.setMutated()}reset(){}optimizeNextFromLeaves(e){if(gd(e))return!1;const t=e.parent,{continueFlag:n}=this.run(e);return n&&this.optimizeNextFromLeaves(t),this.mutatedFlag}}class bd extends hd{}function vd(e,t,n,i){const r=vf(i)?i.encoding[St(t)]:void 0;if(Ti(n)&&vf(i)&&Bi(t,n,r,i.markDef,i.config))e.add(Wi(n,{})),e.add(Wi(n,{suffix:"end"})),ar(n,t)&&e.add(Wi(n,{binSuffix:"range"}));else if(t in gt){const n=function(e){switch(e){case Ve:return"y";case Qe:return"y2";case Je:return"x";case Xe:return"x2"}}(t);e.add(i.getName(n))}else e.add(Wi(n));return e}class yd extends ma{constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}clone(){return new yd(null,new Set(this.dimensions),N(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef(e=>{e.aggregate&&(n=!0)});const i={},r=new Set;return n?(t.forEachFieldDef((e,n)=>{var o,s,a,u;const{aggregate:c,field:l}=e;if(c)if("count"===c)i["*"]=null!=(o=i["*"])?o:{},i["*"].count=new Set([Wi(e,{forAs:!0})]);else{if(_e(c)||ze(c)){const e=_e(c)?"argmin":"argmax",t=c[e];i[t]=null!=(s=i[t])?s:{},i[t][e]=new Set([Wi({op:e,field:t},{forAs:!0})])}else i[l]=null!=(a=i[l])?a:{},i[l][c]=new Set([Wi(e,{forAs:!0})]);Rt(n)&&"unaggregated"===t.scaleDomain(n)&&(i[l]=null!=(u=i[l])?u:{},i[l].min=new Set([Wi({field:l,aggregate:"min"},{forAs:!0})]),i[l].max=new Set([Wi({field:l,aggregate:"max"},{forAs:!0})]))}else vd(r,n,e,t)}),r.size+Y(i).length===0?null:new yd(e,r,i)):null}static makeFromTransform(e,t){var n,i,r;const o=new Set,s={};for(const e of t.aggregate){const{op:t,field:r,as:o}=e;t&&("count"===t?(s["*"]=null!=(n=s["*"])?n:{},s["*"].count=new Set([o||Wi(e,{forAs:!0})])):(s[r]=null!=(i=s[r])?i:{},s[r][t]=new Set([o||Wi(e,{forAs:!0})])))}for(const e of null!=(r=t.groupby)?r:[])o.add(e);return o.size+Y(s).length===0?null:new yd(e,o,s)}merge(e){return function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(this.dimensions,e.dimensions)?(function(e,t){var n;for(const i of Y(t)){const r=t[i];for(const t of Y(r))i in e?e[i][t]=new Set([...(n=e[i][t],null!=n?n:[]),...r[t]]):e[i]={[t]:r[t]}}}(this.measures,e.measures),!0):(function(...e){Jt.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...Y(this.measures)])}producedFields(){const e=new Set;for(const t of Y(this.measures))for(const n of Y(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${P({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of Y(this.measures))for(const r of Y(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:te(i));return{type:"aggregate",groupby:[...this.dimensions],ops:e,fields:t,as:n}}}class xd extends ma{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of yt){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]=Object.assign({name:t.getName(`${e}_domain`),fields:[Wi(n),...cr(i)?[Wi(n,{binSuffix:"end"})]:[]]},Ci(r)?{sortField:r}:o(r)?{sortIndexField:al(n,e)}:{})}}this.childModel=t.child}hash(){let e="Facet";for(const t of yt)this[t]&&(e+=` ${t.charAt(0)}:${P(this[t])}`);return e}get fields(){var e;const t=[];for(const n of yt)(null===(e=this[n])||void 0===e?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of yt)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of["x","y"]){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(Gn(i)&&ds(r)){const n=Kd(ef(this.childModel,t));n?e[t]=n:Qt(`Unknown field for ${t}. Cannot calculate view size.`)}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x"}[e],r=[],o=[],s=[];n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),s.push(`distinct_${n[i]}`));const{sortField:a,sortIndexField:u}=this[e];if(a){const{op:e=Ai,field:t}=a;r.push(t),o.push(e),s.push(Wi(a,{forAs:!0}))}else u&&(r.push(u),o.push("max"),s.push(u));return{name:this[e].name,source:null!=t?t:this.data,transform:[Object.assign({type:"aggregate",groupby:this[e].fields},r.length?{fields:r,ops:o,as:s}:{})]}}assembleFacetHeaderData(e){var t,n;const{columns:i}=this.model.layout,{layoutHeaders:r}=this.model.component,o=[],s={};for(const e of dl){for(const i of fl){const o=null!=(t=r[e]&&r[e][i])?t:[];for(const t of o)if((null===(n=t.axes)||void 0===n?void 0:n.length)>0){s[e]=!0;break}}if(s[e]){const t=`length(data("${this.facet.name}"))`,n="row"===e?i?{signal:`ceil(${t} / ${i})`}:1:i?{signal:`min(${t}, ${i})`}:{signal:t};o.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:n}]})}}const{row:a,column:u}=s;return(a||u)&&o.unshift(this.assembleRowColumnHeaderData("facet",null,e)),o}assemble(){var e,t;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 o=[].concat(null!=(e=r.x)?e:[],null!=(t=r.y)?t:[]),s=o.map(()=>"distinct");n.push({name:i,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:o,ops:s}]})}for(const e of[We,Le])this[e]&&n.push(this.assembleRowColumnHeaderData(e,i,r));if(a){const e=this.assembleFacetHeaderData(r);e&&n.push(...e)}return n}}function Ad(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function Od(e){const t={};return function e(t,n){if(k(t))e(t.not,n);else if(S(t))for(const i of t.and)e(i,n);else if(E(t))for(const i of t.or)e(i,n);else n(t)}(e.filter,e=>{var n;if(Fn(e)){let i=null;bn(e)?i=e.equal:On(e)?i=e.range[0]:wn(e)&&(i=(n=e.oneOf,null!=n?n:e.in)[0]),i&&(Zt(i)?t[e.field]="date":F(i)?t[e.field]="number":a(i)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}}),t}function wd(e){const t={};function n(e){var n;rr(e)?t[e.field]="date":"quantitative"===e.type&&(a(n=e.aggregate)&&U(["min","max"],n))?t[e.field]="number":re(e.field)>1?e.field in t||(t[e.field]="flatten"):Ui(e)&&Ci(e.sort)&&re(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((vf(e)||yf(e))&&e.forEachFieldDef((t,i)=>{if(Ti(t))n(t);else{const r=Et(i),o=e.fieldDef(r);n(Object.assign(Object.assign({},t),{type:o.type}))}}),vf(e)){const{mark:n,markDef:i,encoding:r}=e;if(Ae(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];!zi(e)||"quantitative"!==e.type||e.field in t||(t[e.field]="number")}}return t}class Fd extends ma{constructor(e,t){super(e),this._parse=t}clone(){return new Fd(null,N(this._parse))}hash(){return`Parse ${P(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!Ro(r)&&r&&r.format&&r.format.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of Y(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Qt(Ht.differentParse(e,n[e],t.value)))}for(const e of Y(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Qt(Ht.differentParse(e,t[e],n)))}const r=new kl(t,n);i.copyAll(r);const o={};for(const e of Y(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===Y(o).length||i.parseNothing?null:new Fd(e,o)}get parse(){return this._parse}merge(e){this._parse=Object.assign(Object.assign({},this._parse),e.parse),e.remove()}assembleFormatParse(){const e={};for(const t of Y(this._parse)){const n=this._parse[t];1===re(t)&&(e[t]=n)}return e}producedFields(){return new Set(Y(this._parse))}dependentFields(){return new Set(Y(this._parse))}assembleTransforms(e=!1){return Y(this._parse).filter(t=>!e||re(t)>1).map(e=>{const t=function(e,t){const n=ee(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(0===t.indexOf("date:")){return`timeParse(${n},'${Ad(t.slice(5,t.length))}')`}if(0===t.indexOf("utc:")){return`utcParse(${n},'${Ad(t.slice(4,t.length))}')`}return Qt(Ht.unrecognizedParse(t)),null}(e,this._parse[e]);return t?{type:"formula",expr:t,as:ie(e)}:null}).filter(e=>null!==e)}}class Cd extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Cd(null,N(this.transform))}addDimensions(e){this.transform.groupby=q(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t=>e.add(t)),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(t=>e.add(t)),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:Wi(e)}hash(){return`JoinAggregateTransform ${P(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return Object.assign({type:"joinaggregate",as:n,ops:t,fields:e},void 0!==i?{groupby:i}:{})}}class jd extends ma{constructor(e,t){super(e),this._stack=t}clone(){return new jd(null,N(this._stack))}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:s="zero"}=t,u=[],c=[];if(void 0!==t.sort)for(const e of t.sort)u.push(e.field),c.push(oe(e.order,"ascending"));const l={field:u,order:c};let d;return d=function(e){return o(e)&&e.every(e=>a(e))&&e.length>1}(r)?r:a(r)?[r,r+"_end"]:[t.stack+"_start",t.stack+"_end"],new jd(e,{stackField:n,groupby:i,offset:s,sort:l,facetby:[],as:d})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;let r;if(n.groupbyChannel){r=Ki(i[n.groupbyChannel])}const s=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=Wi(t.fieldDef);return n&&e.push(n),e},[])}(t),a=t.encoding.order;let u;return u=o(a)||zi(a)?bi(a):s.reduce((e,t)=>(e.field.push(t),e.order.push("descending"),e),{field:[],order:[]}),new jd(e,{dimensionFieldDef:r,stackField:t.vgField(n.fieldChannel),facetby:[],stackby:s,sort:u,offset:n.offset,impute:n.impute,as:[t.vgField(n.fieldChannel,{suffix:"start",forAs:!0}),t.vgField(n.fieldChannel,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(t=>e.add(t)),this._stack.facetby.forEach(t=>e.add(t)),this._stack.sort.field.forEach(t=>e.add(t)),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${P(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[Wi(e,{binSuffix:"mid"})]:[Wi(e,{}),Wi(e,{binSuffix:"end"})]:[Wi(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:i,stackby:r,sort:o,offset:s,impute:a,as:u}=this._stack;if(a&&n){const{band:o=.5,bin:s}=n;s&&e.push({type:"formula",expr:`${o}*`+Wi(n,{expr:"datum"})+`+${1-o}*`+Wi(n,{expr:"datum",binSuffix:"end"}),as:Wi(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:i,groupby:[...r,...t],key:Wi(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:u,offset:s}),e}}class Dd extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Dd(null,N(this.transform))}addDimensions(e){this.transform.groupby=q(this.transform.groupby.concat(e),e=>e)}dependentFields(){var e,t;const n=new Set;return(e=this.transform.groupby,null!=e?e:[]).forEach(e=>n.add(e)),(t=this.transform.sort,null!=t?t:[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(e=>n.add(e)),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:Wi(e)}hash(){return`WindowTransform ${P(this.transform)}`}assemble(){var e;const t=[],n=[],i=[],r=[];for(const e of this.transform.window)n.push(e.op),i.push(this.getDefaultName(e)),r.push(void 0===e.param?null:e.param),t.push(void 0===e.field?null:e.field);const o=this.transform.frame,s=this.transform.groupby;if(o&&null===o[0]&&null===o[1]&&n.every(e=>Te(e)))return Object.assign({type:"joinaggregate",as:i,ops:n,fields:t},void 0!==s?{groupby:s}:{});const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(null!=(e=t.order)?e:"ascending");const c={field:a,order:u},l=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:r,as:i,ops:n,fields:t,sort:c},void 0!==l?{ignorePeers:l}:{}),void 0!==s?{groupby:s}:{}),void 0!==o?{frame:o}:{})}}class Ed extends ma{clone(){return new Ed(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([Jr])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:Jr}}}class Sd extends md{run(e){const t=e.parent;if(e instanceof Fd){if(gd(t))return this.flags;if(t.numChildren()>1)return this.setContinue(),this.flags;if(t instanceof Fd)this.setMutated(),t.merge(e);else{if(G(t.producedFields(),e.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),e.swapWithParent()}}return this.setContinue(),this.flags}}class kd extends bd{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map(e=>e.hash()),n={};for(let i=0;i1&&(this.setMutated(),this.mergeNodes(e,n[t]));for(const t of e.children)this.run(t);return this.mutatedFlag}}class $d extends md{run(e){return e instanceof ba||e.numChildren()>0||e instanceof xd?this.flags:(this.setMutated(),e.remove(),this.flags)}}class Bd extends md{constructor(){super(...arguments),this.fields=new Set,this.prev=null}run(e){if(this.setContinue(),e instanceof va){const t=e.producedFields();I(t,this.fields)?(this.setMutated(),this.prev.remove()):this.fields=new Set([...this.fields,...t]),this.prev=e}return this.flags}reset(){this.fields.clear()}}class Nd extends md{run(e){this.setContinue();const t=e.parent.children.filter(e=>e instanceof va),n=t.pop();for(const e of t)this.setMutated(),n.merge(e);return this.flags}}function _d(e){if(e instanceof xd)if(1!==e.numChildren()||e.children[0]instanceof ba){const n=e.model.component.data.main;!function e(t){if(t instanceof ba&&t.type===Io&&1===t.numChildren()){const n=t.children[0];n instanceof xd||(n.swapWithParent(),e(t))}}(n);const i=(t=e,function e(n){if(!(n instanceof xd)){const i=n.clone();if(i instanceof ba){const e=Ld+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof yd||i instanceof jd||i instanceof Dd||i instanceof Cd)&&i.addDimensions(t.fields);return n.children.flatMap(e).forEach(e=>e.parent=i),[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof yd||t instanceof jd||t instanceof Dd||t instanceof Cd)&&t.addDimensions(e.fields),t.swapWithParent(),_d(e)}else e.children.map(_d);var t}class zd extends bd{constructor(){super()}run(e){e instanceof ba&&!e.isRequired()&&(this.setMutated(),e.remove());for(const t of e.children)this.run(t);return this.mutatedFlag}}class Td extends bd{constructor(e){super(),this.requiresSelectionId=e&&tu(e)}run(e){e instanceof Ed&&(this.requiresSelectionId&&(gd(e.parent)||e.parent instanceof yd||e.parent instanceof Fd)||(this.setMutated(),e.remove()));for(const t of e.children)this.run(t);return this.mutatedFlag}}class Pd extends md{run(e){const t=e.parent,n=[...t.children],i=t.children.filter(e=>e instanceof Fd);if(t.numChildren()>1&&i.length>=1){const e={},r=new Set;for(const t of i){const n=t.parse;for(const t of Y(n))t in e?e[t]!==n[t]&&r.add(t):e[t]=n[t]}for(const t of r)delete e[t];if(0!==Y(e).length){this.setMutated();const i=new Fd(t,e);for(const r of n){if(r instanceof Fd)for(const t of Y(e))delete r.parse[t];t.removeChild(r),r.parent=i,r instanceof Fd&&0===Y(r.parse).length&&r.remove()}}}return this.setContinue(),this.flags}}class Md extends md{run(e){const t=e.parent,n=t.children.filter(e=>e instanceof yd),i={};for(const e of n){const t=P(e.groupBy);t in i||(i[t]=[]),i[t].push(e)}for(const e of Y(i)){const n=i[e];if(n.length>1){const e=n.pop();for(const i of n)e.merge(i)&&(t.removeChild(i),i.parent=e,i.remove(),this.setMutated())}}return this.setContinue(),this.flags}}class Ud extends md{constructor(e){super(),this.model=e}run(e){const t=e.parent,n=!(gd(t)||t instanceof Hc||t instanceof Fd||t instanceof Ed),i=[],r=[];for(const e of t.children)e instanceof cd&&(n&&!G(t.producedFields(),e.dependentFields())?i.push(e):r.push(e));if(i.length>0){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated(),t instanceof cd?t.merge(e,this.model.renameSignal.bind(this.model)):e.swapWithParent()}if(r.length>1){const e=r.pop();for(const t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated()}return this.setContinue(),this.flags}}class Rd extends md{run(e){const t=e.parent,n=[...t.children];if(!R(n,e=>e instanceof ba)||t.numChildren()<=1)return this.setContinue(),this.flags;const i=[];let r;for(const e of n)if(e instanceof ba){let n=e;for(;1===n.numChildren();){const e=n.children[0];if(!(e instanceof ba))break;n=e}i.push(...n.children),r?(t.removeChild(e),e.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setMutated()):r=n}else i.push(e);if(i.length){this.setMutated();for(const e of i)e.parent.removeChild(e),e.parent=r}return this.setContinue(),this.flags}}const Ld="scale_",Wd=5;function qd(e){const t=[];return e.forEach((function e(n){0===n.numChildren()?t.push(n):n.children.forEach(e)})),t}function Id(e){return e}function Hd(e,t){return t.map(t=>{if(e instanceof md){const n=e.optimizeNextFromLeaves(t);return e.reset(),n}return e.run(t)}).some(Id)}function Gd(e,t){let n=e.sources;const i=new Set;return i.add(Hd(new zd,n)),i.add(Hd(new Td(t),n)),n=n.filter(e=>e.numChildren()>0),i.add(Hd(new $d,qd(n))),n=n.filter(e=>e.numChildren()>0),i.add(Hd(new Sd,qd(n))),i.add(Hd(new Ud(t),qd(n))),i.add(Hd(new Bd,qd(n))),i.add(Hd(new Pd,qd(n))),i.add(Hd(new Md,qd(n))),i.add(Hd(new Nd,qd(n))),i.add(Hd(new kd,n)),i.add(Hd(new Rd,qd(n))),e.sources=n,i.has(!0)}class Yd{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new Yd(()=>e(t))}}function Vd(e){vf(e)?function(e){const t=e.component.scales;Y(t).forEach(n=>{const i=function(e,t){const n=e.getScaleComponent(t).get("type"),i=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=Xd(t,n);if(!e)return void Qt(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=Xd(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.fieldDef(t),n,e.config.scale);i!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:i}));if("x"===t&&e.channelHasField("x2"))return e.channelHasField("x")?zl(Jd(n,i,e,"x"),Jd(n,i,e,"x2"),"domain","scale",Zd):Jd(n,i,e,"x2");if("y"===t&&e.channelHasField("y2"))return e.channelHasField("y")?zl(Jd(n,i,e,"y"),Jd(n,i,e,"y2"),"domain","scale",Zd):Jd(n,i,e,"y2");return Jd(n,i,e,t)}(e,n);if(t[n].setWithExplicit("domains",i),function(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t).bin,o=Qn(i)&&i,s=dr(r)&&fr(r.extent)&&r.extent;(o||s)&&n.set("selectionExtent",null!=o?o:s,!0)}(e,n),e.component.data.isFaceted){let t=e;for(;!yf(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)fs(e)&&(e.data=Ld+e.data.replace(Ld,""))}})}(e):function(e){for(const t of e.children)Vd(t);const t=e.component.scales;Y(t).forEach(n=>{let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):zl(i,e.getWithExplicit("domains"),"domains","scale",Zd);const t=e.get("selectionExtent");r&&t&&r.selection!==t.selection&&Qt("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)})}(e)}function Jd(e,t,n,i){const r=n.fieldDef(i);if(t&&"unaggregated"!==t&&!Qn(t)){const{type:e,timeUnit:n}=r;return $l("temporal"===e||n?function(e,t,n){return e.map(e=>{return{signal:`{data: ${or(e,{timeUnit:n,type:t})}}`}})}(t,e,n):[t])}const o=n.stack;if(o&&i===o.fieldChannel){if("normalize"===o.offset)return Bl([[0,1]]);const e=n.requestDataName(Io);return Bl([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const a=Rt(i)?function(e,t,n){if(!Gn(n))return;const i=e.fieldDef(t),r=i.sort;if(ji(r))return{op:"min",field:al(i,t),order:"ascending"};const o=null!==e.stack;if(Ci(r))return Qd(r,o);if(Fi(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:a}=i;if(_e(s)||ze(s))return Qd({field:Wi(i),order:n},o);if(Te(s)||!s)return Qd({op:s,field:a,order:n},o)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(U(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if("unaggregated"===t){const e=n.requestDataName(Io),{field:t}=r;return Bl([{data:e,field:Wi({field:t,aggregate:"min"})},{data:e,field:Wi({field:t,aggregate:"max"})}])}if(cr(r.bin)){if(Gn(e))return Bl("bin-ordinal"===e?[]:[{data:J(a)?n.requestDataName(Io):n.requestDataName(Ho),field:n.vgField(i,ar(r,i)?{binSuffix:"range"}:{}),sort:!0!==a&&s(a)?a:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=r;if(cr(e)){const t=ad(n,r.field,e);return Bl([new Yd(()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return Bl([{data:n.requestDataName(Io),field:n.vgField(i,{})}])}}if(r.timeUnit&&U(["time","utc"],e)&&Bi(i,r,vf(n)?n.encoding[St(i)]:void 0,n.markDef,n.config)){const e=n.requestDataName(Io);return Bl([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return Bl(a?[{data:J(a)?n.requestDataName(Io):n.requestDataName(Ho),field:n.vgField(i),sort:a}]:[{data:n.requestDataName(Io),field:n.vgField(i)}])}function Qd(e,t){const{op:n,field:i,order:r}=e;return Object.assign(Object.assign({op:null!=n?n:t?"sum":Ai},i?{field:te(i)}:{}),r?{order:r}:{})}function Xd(e,t){const{aggregate:n,type:i}=e;return n?a(n)&&!Re[n]?{valid:!1,reason:Ht.unaggregateDomainWithNonSharedDomainOp(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:Ht.unaggregatedDomainWithLogScale(e)}:{valid:!0}:{valid:!1,reason:Ht.unaggregateDomainHasNoEffectForRawField(e)}}function Zd(e,t,n,i){return e.explicit&&t.explicit&&Qt(Ht.mergeConflictingDomainProperty(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function Kd(e){if(fs(e)&&a(e.field))return e.field;if(function(e){return!o(e)&&("fields"in e&&!("data"in e))}(e)){let t;for(const n of e.fields)if(fs(n)&&a(n.field))if(t){if(t!==n.field)return Qt("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."),t}else t=n.field;return Qt("Detected faceted independent scales that union domain of identical fields from different source detected. We will assume that this is the same field from a different fork of the same data source. However, if this is not case, the result view size maybe incorrect."),t}if(function(e){return!o(e)&&("fields"in e&&"data"in e)}(e)){Qt("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.");const t=e.fields[0];return a(t)?t:void 0}}function ef(e,t){return function(e){const t=q(e.map(e=>{if(fs(e)){return $e(e,["sort"])}return e}),P),n=q(e.map(e=>{if(fs(e)){const t=e.sort;return void 0===t||J(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),P);if(0===t.length)return;if(1===t.length){const t=e[0];if(fs(t)&&n.length>0){let e=n[0];return n.length>1&&(Qt(Ht.MORE_THAN_ONE_SORT),e=!0),Object.assign(Object.assign({},t),{sort:e})}return t}const i=q(n.map(e=>J(e)||!("op"in e)||e.op in Ne?e:(Qt(Ht.domainSortDropped(e)),!0)),P);let r;1===i.length?r=i[0]:i.length>1&&(Qt(Ht.MORE_THAN_ONE_SORT),r=!0);const o=q(e.map(e=>fs(e)?e.data:null),e=>e);if(1===o.length&&null!==o[0]){return Object.assign({data:o[0],fields:t.map(e=>e.field)},r?{sort:r}:{})}return Object.assign({fields:t},r?{sort:r}:{})}(e.component.scales[t].get("domains").map(t=>(fs(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function tf(e){return Y(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:c}=r,l=$e(r,["name","type","selectionExtent","domains","range"]),d=function(e,t,n){if(("x"===n||"y"===n)&&ds(e))return{step:{signal:t+"_step"}};return e}(r.range,o,n);let f;a&&(f=function(e,t){const n=t.selection;return{signal:Yc(e.getSelectionComponent(n,Q(n)),t)}}(e,a));const p=ef(e,n);return t.push(Object.assign(Object.assign(Object.assign(Object.assign({name:o,type:s},p?{domain:p}:{}),f?{domainRaw:f}:{}),{range:d}),l)),t},[])}class nf extends kl{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||R(this.get("domains"),e=>o(e)&&2===e.length&&e[0]<=0&&e[1]>=0)}}const rf=["range","scheme"];function of(e){return"x"===e?"width":"y"===e?"height":void 0}function sf(e){const t=e.component.scales;Ut.forEach(n=>{const i=t[n];if(!i)return;const r=function(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const t of rf)if(void 0!==n[t]){const i=Kn(r,t),o=ei(e,t);if(i)if(o)Qt(o);else switch(t){case"range":return $l(n[t]);case"scheme":return $l(uf(n[t]))}else Qt(Ht.scalePropertyNotWorkWithScaleType(r,t,e))}if(e===Ie||e===He){const t=e===Ie?"width":"height",n=i[t];if(io(n)){if(Gn(r))return $l({step:n.step});Qt(Ht.stepDropped(t))}}return Bl(function(e,t){const{size:n,config:i,mark:r}=t,s=t.getSignalName.bind(t),{type:a}=t.fieldDef(e),u=t.getScaleComponent(e).get("type"),{domain:c}=t.specifiedScales[e];switch(e){case Ie:case He:{if(U(["point","band"],u))if(e!==Ie||n.width){if(e===He&&!n.height){const e=ao(i.view,"height");if(io(e))return e}}else{const e=ao(i.view,"width");if(io(e))return e}const r=of(e),o=t.getName(r);return e===He&&Yn(u)?[Yd.fromName(s,o),0]:[0,Yd.fromName(s,o)]}case nt:{const s=t.component.scales[e].get("zero"),a=function(e,t,n){if(t)return 0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(Ht.incompatibleChannel("size",e))}(r,s,i),l=function(e,t,n,i){const r={x:af(n,"x"),y:af(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=lf(t,r,i.view);return F(e)?e-1:new Yd(()=>`${e.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 e=lf(t,r,i.view);return F(e)?Math.pow(cf*e,2):new Yd(()=>`pow(${cf} * ${e.signal}, 2)`)}}throw new Error(Ht.incompatibleChannel("size",e))}(r,n,t,i);return Jn(u)?function(e,t,n){const i=()=>{const i=`(${ls(t)?t.signal:t} - ${e}) / (${n} - 1)`;return`sequence(${e}, ${t} + ${i}, ${i})`};return ls(t)?new Yd(i):{signal:i()}}(a,l,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&o(n)?n.length+1:(Qt(Ht.domainRequiredForThresholdScale(i)),3)}}(u,i,c,e)):[a,l]}case st:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case tt:return"symbol";case Ze:case Ke:case et:return"ordinal"===u?"nominal"===a?"category":"ordinal":"rect"===r||"geoshape"===r?"heatmap":"ramp";case it:case rt:case ot:return[i.scale.minOpacity,i.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${e}`)}(e,t))}(n,e);i.setWithExplicit("range",r)})}function af(e,t){const n=e.fieldDef(t);if(n&&n.bin&&cr(n.bin)){const i=ad(e,n.field,n.bin),r=of(t),o=e.getName(r);return new Yd(()=>{const t=e.getSignalName(i),n=`(${t}.stop - ${t}.start) / ${t}.step`;return`${e.getSignalName(o)} / (${n})`})}}function uf(e){return function(e){return!a(e)&&!!e.name}(e)?Object.assign({scheme:e.name},z(e,["name"])):{scheme:e}}const cf=.95;function lf(e,t,n){const i=io(e.width)?e.width.step:so(n,"width"),r=io(e.height)?e.height.step:so(n,"height");return t.x||t.y?new Yd(()=>{return`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`}):Math.min(i,r)}function df(e,t){vf(e)?function(e,t){const n=e.component.scales;Y(n).forEach(i=>{const r=e.specifiedScales[i],s=n[i],a=e.getScaleComponent(i),u=e.fieldDef(i),c=e.config,l=r[t],d=a.get("type"),f=Kn(d,t),p=ei(i,t);if(void 0!==l&&(f?p&&Qt(p):Qt(Ht.scalePropertyNotWorkWithScaleType(d,t,i))),f&&void 0===p)if(void 0!==l)s.copyKeyFromObject(t,r);else{const n=function(e,t,n,i,r,s,a,u,c,l){const d=l.scale,{type:f,sort:p}=i;switch(e){case"bins":return function(e,t){const n=t.bin;if(cr(n)){const i=ad(e,t.field,n);return new Yd(()=>e.getSignalName(i))}if(lr(n)&&dr(n)&&void 0!==n.step)return{step:n.step};return}(t,i);case"interpolate":return function(e,t){if(U([Ze,Ke,et],e)&&"nominal"!==t)return"hcl";return}(n,f);case"nice":return function(e,t,n){if(n.bin||U([zn.TIME,zn.UTC],e))return;return!!U([Ie,He],t)||void 0}(r,n,i);case"padding":return function(e,t,n,i,r,o){if(U([Ie,He],e)){if(Vn(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:s}=r;if("bar"===t&&!i.bin&&!i.timeUnit&&("vertical"===s&&"x"===e||"horizontal"===s&&"y"===e))return o.continuousBandSize}if(t===zn.POINT)return n.pointPadding}return}(n,r,d,i,c,l.bar);case"paddingInner":return function(e,t,n,i){if(void 0!==e)return;if(U([Ie,He],t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r}=i;return oe(e,"bar"===n?t:r)}return}(s,n,c.type,d);case"paddingOuter":return function(e,t,n,i,r,o){if(void 0!==e)return;if(U([Ie,He],t)&&n===zn.BAND){const{bandPaddingOuter:e}=o;return oe(e,r/2)}return}(s,n,r,c.type,a,d);case"reverse":return function(e,t){if(Yn(e)&&"descending"===t)return!0;return}(r,p);case"zero":return function(e,t,n,i,r){if(n&&"unaggregated"!==n&&Yn(r)){if(o(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!Jn(r))return!0;if(!t.bin&&U([Ie,He],e)){const{orient:t,type:n}=i;return!U(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(n,i,u,c,r)}return d[e]}(t,e,i,u,a.get("type"),a.get("padding"),a.get("paddingInner"),r.domain,e.markDef,c);void 0!==n&&s.set(t,n,!1)}})}(e,t):pf(e,t)}function ff(e){vf(e)?sf(e):pf(e,"range")}function pf(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?ff(n):df(n,t);Y(n).forEach(i=>{let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=zl(r,e.getWithExplicit(t),t,"scale",Nl((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0}))}}n[i].setWithExplicit(t,r)})}function gf(e,t,n,i){const r=function(e,t,n){switch(t.type){case"nominal":case"ordinal":return bt(e)||"discrete"===It(e)?("shape"===e&&"ordinal"===t.type&&Qt(Ht.discreteChannelCannotEncode(e,"ordinal")),"ordinal"):U(["x","y"],e)&&U(["rect","bar","image","rule"],n)?"band":"point";case"temporal":return bt(e)?"time":"discrete"===It(e)?(Qt(Ht.discreteChannelCannotEncode(e,"temporal")),"ordinal"):"time";case"quantitative":return bt(e)?cr(t.bin)?"bin-ordinal":"linear":"discrete"===It(e)?(Qt(Ht.discreteChannelCannotEncode(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(Ht.invalidFieldType(t.type))}(t,n,i),{type:o}=e;return Rt(t)?void 0!==o?ni(t,o)?ti(o,n.type)?o:(Qt(Ht.scaleTypeNotWorkWithFieldDef(o,r)),r):(Qt(Ht.scaleTypeNotWorkWithChannel(t,o,r)),r):r:null}function hf(e){vf(e)?e.component.scales=function(e){const{encoding:t,mark:n}=e;return Ut.reduce((i,r)=>{let o,s;const a=t[r];if(zi(a)&&n===xe&&r===tt&&a.type===_n)return i;if(zi(a)?(o=a,s=a.scale):_i(a)&&(o=a.condition,s=a.condition.scale),o&&null!==s&&!1!==s){s=null!=s?s:{};const t=gf(s,r,o,n);i[r]=new nf(e.scaleName(r+"",!0),{value:t,explicit:s.type===t})}return i},{})}(e):e.component.scales=function(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const t of e.children)hf(t),Y(t.component.scales).forEach(r=>{var o;if(i.scale[r]=null!=(o=i.scale[r])?o:El(r,e),"shared"===i.scale[r]){const e=n[r],o=t.component.scales[r].getWithExplicit("type");e?Mn(e.value,o.value)?n[r]=zl(e,o,"type","scale",mf):(i.scale[r]="independent",delete n[r]):n[r]=o}});for(const i of Y(n)){const r=e.scaleName(i,!0),o=n[i];t[i]=new nf(r,o);for(const t of e.children){const e=t.component.scales[i];e&&(t.renameScale(e.get("name"),r),e.merged=!0)}}return t}(e)}const mf=Nl((e,t)=>Rn(e)-Rn(t));class bf{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function vf(e){var t;return"unit"===(null===(t=e)||void 0===t?void 0:t.type)}function yf(e){var t;return"facet"===(null===(t=e)||void 0===t?void 0:t.type)}function xf(e){var t;return"repeat"===(null===(t=e)||void 0===t?void 0:t.type)}function Af(e){var t;return"concat"===(null===(t=e)||void 0===t?void 0:t.type)}function Of(e){var t;return"layer"===(null===(t=e)||void 0===t?void 0:t.type)}class wf{constructor(e,t,n,i,r,s,a,u){var c,l;this.type=t,this.parent=n,this.config=r,this.repeater=s,this.view=u,this.children=[],this.correctDataNames=e=>(e.from&&e.from.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.repeater=s,this.name=null!=(c=e.name)?c:i,this.title=oi(e.title)?{text:e.title}:e.title,this.scaleNameMap=n?n.scaleNameMap:new bf,this.projectionNameMap=n?n.projectionNameMap:new bf,this.signalNameMap=n?n.signalNameMap:new bf,this.data=e.data,this.description=e.description,this.transforms=(l=e.transform,(null!=l?l:[]).map(e=>Go(e)?{filter:$(e.filter,En)}:e)),this.layout=Se(e)||bo(e)?{}:function(e,t,n){var i,r;const s=n[t],a={},{spacing:u,columns:c}=s;void 0!==u&&(a.spacing=u),void 0!==c&&(Ei(e)&&!Di(e.facet)||no(e)&&o(e.repeat)||Kr(e))&&(a.columns=c);for(const t of ro)if(void 0!==e[t])if("spacing"===t){const n=e[t];a[t]=F(n)?n:{row:(i=n.row,null!=i?i:u),column:(r=n.column,null!=r?r:u)}}else a[t]=e[t];return a}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:Ei(e)||n&&n.component.data.isFaceted&&void 0===e.data},layoutSize:new kl,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},a?N(a):{}),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(){!function(e,{ignoreRange:t}={}){hf(e),Vd(e);for(const t of Zn)df(e,t);t||ff(e)}(this)}parseProjection(){od(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){Jl(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!=(t=null===(e=this.view)||void 0===e?void 0:e.style)?t:"cell"}assembleEncodeFromView(e){const t=$e(e,["style"]),n={};for(const e in t)if(O(t,e)){const i=t[e];void 0!==i&&(n[e]={value:i})}return n}assembleGroupEncodeEntry(e){let t=void 0;return this.view&&(t=this.assembleEncodeFromView(this.view)),e||"unit"!==this.type&&"layer"!==this.type?t:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},null!=t?t:{})}assembleLayout(){if(!this.layout)return;const e=this.layout,{spacing:t}=e,n=$e(e,["spacing"]),{component:i,config:r}=this,o=function(e,t){var n;const i={};for(const r of yt){const o=e[r];if(null===(n=o)||void 0===n?void 0:n.facetFieldDef){const{titleAnchor:e,titleOrient:n}=ll(["titleAnchor","titleOrient"],o.facetFieldDef,t,r),s=ul(r,n),a=Al(e,s);void 0!==a&&(i[s]=a)}}return Y(i).length>0?i:void 0}(i.layoutHeaders,r);return Object.assign(Object.assign(Object.assign({padding:t},this.assembleDefaultLayout()),n),o?{titleBand:o}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of yt)e[n].title&&t.push(pl(this,n));for(const e of dl)t=t.concat(ml(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(e=>Qc(e,"grid",t)),...i.map(e=>Qc(e,"grid",t)),...n.map(e=>Qc(e,"main",t)),...i.map(e=>Qc(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return ed(this)}assembleProjections(){return td(this)}assembleTitle(){var e,t,n;const i=null!=(e=this.title)?e:{},{encoding:r}=i,o=$e(i,["encoding"]),s=Object.assign(Object.assign(Object.assign({},ri(this.config.title).nonMark),o),r?{encode:{update:r}}:{});if(s.text)return U(["unit","layer"],this.type)?U(["middle",void 0],s.anchor)&&(s.frame=null!=(t=s.frame)?t:"group"):s.anchor=null!=(n=s.anchor)?n:"start",Y(s).length>0?s:void 0}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||yf(this.parent)?function e(t){return Of(t)||Af(t)||xf(t)?t.children.reduce((t,n)=>t.concat(e(n)),tf(t)):tf(t)}(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}hasDescendantWithFieldOnChannel(e){for(const t of this.children)if(vf(t)){if(t.channelHasField(e))return!0}else if(t.hasDescendantWithFieldOnChannel(e))return!0;return!1}getName(e){return Q((this.name?this.name+"_":"")+e)}requestDataName(e){var t;const n=this.getName(e),i=this.component.data.outputNodeRefCounts;return i[n]=(null!=(t=i[n])?t:0)+1,n}getSizeSignalRef(e){if(yf(this.parent)){const t=zt(e),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(Gn(e)&&ds(i)){const e=n.get("name"),i=Kd(ef(this,t));if(i){return{signal:jl(e,n,Wi({aggregate:"distinct",field:i},{expr:"datum"}))}}return Qt(`Unknown field for ${t}. Cannot calculate view size.`),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):Ct(e)&&Rt(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(Ht.selectionNotFound(t));return n}}class Ff extends wf{vgField(e,t={}){const n=this.fieldDef(e);if(n)return Wi(n,t)}reduceFieldDef(e,t){return xr(this.getMapping(),(t,n,i)=>{const r=Zi(n);return r?e(t,r,i):t},t)}forEachFieldDef(e,t){yr(this.getMapping(),(t,n)=>{const i=Zi(t);i&&e(i,n)},t)}}class Cf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:"value"),(r=o[1],null!=r?r:"density")]}clone(){return new Cf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.density,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${P(this.transform)}`}assemble(){const e=this.transform,{density:t}=e,n=$e(e,["density"]);return Object.assign({type:"kde",field:t},n)}}class jf extends ma{constructor(e,t){super(e),this.filter=t}clone(){return new jf(null,Object.assign({},this.filter))}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==ui("invalid",r,n))return null;const o=t.reduceFieldDef((e,n,r)=>{const o=Rt(r)&&t.getScaleComponent(r);if(o){!Yn(o.get("type"))||n.aggregate||Ae(i)||(e[n.field]=n)}return e},{});return Y(o).length?new jf(e,o):null}dependentFields(){return new Set(Y(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${P(this.filter)}`}assemble(){const e=Y(this.filter).reduce((e,t)=>{const n=this.filter[t],i=Wi(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class Df extends ma{constructor(e,t){super(e),this.transform=t,this.transform=N(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map((e,t)=>{var n;return null!=(n=i[t])?n:e})}clone(){return new Df(this.parent,N(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${P(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Ef extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:"key"),(r=o[1],null!=r?r:"value")]}clone(){return new Ef(null,N(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${P(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Sf extends ma{constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}clone(){return new Sf(null,N(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[Je,Ve],[Xe,Qe]]){const r=i.map(e=>t.channelHasField(e)?t.fieldDef(e).field:Mi(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0);(r[0]||r[1])&&(e=new Sf(e,r,null,t.getName(`geojson_${n++}`)))}if(t.channelHasField(tt)){const i=t.fieldDef(tt);i.type===_n&&(e=new Sf(e,null,i.field,t.getName(`geojson_${n++}`)))}return e}dependentFields(){var e;const t=(e=this.fields,null!=e?e:[]).filter(a);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${P(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class kf extends ma{constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}clone(){return new kf(null,this.projection,N(this.fields),N(this.as))}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[Je,Ve],[Xe,Qe]]){const i=n.map(e=>t.channelHasField(e)?t.fieldDef(e).field:Mi(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0),r=n[0]===Xe?"2":"";(i[0]||i[1])&&(e=new kf(e,t.projectionName(),i,[t.getName("x"+r),t.getName("y"+r)]))}return e}dependentFields(){return new Set(this.fields.filter(a))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${P(this.fields)} ${P(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class $f extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new $f(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new $f(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(zi(i)&&zi(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const s=i.impute?r:r.impute?i:void 0,{method:a,value:u,frame:c,keyvals:l}=o.impute,d=Ar(t.mark,n);return new $f(e,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:o.field,key:s.field},a?{method:a}:{}),void 0!==u?{value:u}:{}),c?{frame:c}:{}),void 0!==l?{keyvals:l}:{}),d.length?{groupby:d}:{}))}return null}hash(){return`Impute ${P(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:s=[null,null]}=this.transform,a=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:e,key:t},n?{keyvals:(u=n,void 0!==(null===(c=u)||void 0===c?void 0:c.stop)?this.processSequence(n):n)}:{}),{method:"value"}),r?{groupby:r}:{}),{value:null});var u,c;let l;if(i&&"value"!==i){l=[Object.assign({type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:s,ignorePeers:!1},r?{groupby:r}:{}),{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}else{l=[{type:"formula",expr:`datum.${e} === null ? ${o} : datum.${e}`,as:e}]}return[a,...l]}}class Bf extends kl{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}class Nf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:t.on),(r=o[1],null!=r?r:t.loess)]}clone(){return new Nf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${P(this.transform)}`}assemble(){const e=this.transform,{loess:t,on:n}=e,i=$e(e,["loess","on"]);return Object.assign({type:"loess",x:n,y:t},i)}}class _f extends ma{constructor(e,t,n){super(e),this.transform=t,this.secondary=n}clone(){return new _f(null,N(this.transform),this.secondary)}static make(e,t,n,i){var r;const o=t.component.data.sources,{from:s}=n;let a=null;if(function(e){return void 0!==e.data}(s)){let e=np(s.data,o);e||(e=new ld(s.data),o.push(e));const n=t.getName(`lookup_${i}`);a=new ba(e,n,"lookup",t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return void 0!==e.selection}(s)){const e=s.selection;if(n.as=null!=(r=n.as)?r:e,a=t.getSelectionComponent(Q(e),e).materialized,!a)throw new Error(Ht.noSameUnitLookup(e))}return new _f(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?x(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${P({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e=Object.assign({values:this.transform.from.fields},this.transform.as?{as:x(this.transform.as)}:{});else{let t=this.transform.as;a(t)||(Qt(Ht.NO_FIELDS_NEEDS_AS),t="_lookup"),e={as:[t]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e),this.transform.default?{default:this.transform.default}:{})}}class zf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:"prob"),(r=o[1],null!=r?r:"value")]}clone(){return new zf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.quantile,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${P(this.transform)}`}assemble(){const e=this.transform,{quantile:t}=e,n=$e(e,["quantile"]);return Object.assign({type:"quantile",field:t},n)}}class Tf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:t.on),(r=o[1],null!=r?r:t.regression)]}clone(){return new Tf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${P(this.transform)}`}assemble(){const e=this.transform,{regression:t,on:n}=e,i=$e(e,["regression","on"]);return Object.assign({type:"regression",x:n,y:t},i)}}class Pf extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Pf(null,N(this.transform))}addDimensions(e){var t;this.transform.groupby=q((t=this.transform.groupby,null!=t?t:[]).concat(e),e=>e)}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...(e=this.transform.groupby,null!=e?e:[])])}hash(){return`PivotTransform ${P(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:e,value:t},void 0!==i?{limit:i}:{}),void 0!==r?{op:r}:{}),void 0!==n?{groupby:n}:{})}}class Mf extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Mf(null,N(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${P(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function Uf(e){let t=0;return function n(i,r){var o;if(i instanceof ld&&!i.isGenerator&&!Po(i.data)){e.push(r),r={name:null,source:r.name,transform:[]}}if(i instanceof Fd&&(i.parent instanceof ld&&!r.source?(r.format=Object.assign(Object.assign({},null!=(o=r.format)?o:{}),{parse:i.assembleFormatParse()}),r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof xd)return r.name||(r.name=`data_${t++}`),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void i.assemble().forEach(t=>e.push(t));if((i instanceof fd||i instanceof pd||i instanceof jf||i instanceof Hc||i instanceof sl||i instanceof kf||i instanceof Sf||i instanceof yd||i instanceof _f||i instanceof Dd||i instanceof Cd||i instanceof Ef||i instanceof Df||i instanceof Cf||i instanceof Nf||i instanceof zf||i instanceof Tf||i instanceof Ed||i instanceof Mf||i instanceof Pf)&&r.transform.push(i.assemble()),(i instanceof cd||i instanceof va||i instanceof $f||i instanceof jd)&&r.transform.push(...i.assemble()),i instanceof ba)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof ba)i.setSource(r.name);else if(r.name||(r.name=`data_${t++}`),i.setSource(r.name),1===i.numChildren()){e.push(r),r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof ba&&(!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,i.children.forEach(e=>{n(e,{name:null,source:o,transform:[]})});break}}}}function Rf(e){return"top"===e||"left"===e?"header":"footer"}function Lf(e,t){var n;if(e.channelHasField(t)){const i=e.facet[t],r=cl("title",null,e.config,t);let s=Vi(i,e.config,{allowDisabling:!0,includeDefault:void 0===r||!!r});e.child.component.layoutHeaders[t].title&&(s=o(s)?s.join(", "):s,s+=" / "+e.child.component.layoutHeaders[t].title,e.child.component.layoutHeaders[t].title=null);const a=cl("labelOrient",i,e.config,t),u=oe((null!=(n=i.header)?n:{}).labels,!0),c=U(["bottom","right"],a)?"footer":"header";e.component.layoutHeaders[t]={title:s,facetFieldDef:i,[c]:"facet"===t?[]:[Wf(e,t,u)]}}}function Wf(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function qf(e,t){var n;const{child:i}=e;if(i.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=Sl(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",s=r[o];for(const r of i.component.axes[t]){const t=Rf(r.get("orient"));s[t]=null!=(n=s[t])?n:[Wf(e,o,!1)];const i=Qc(r,"main",e.config,{header:!0});s[t][0].axes.push(i),r.mainExtracted=!0}}}}function If(e){Yf(e);const t=e.component.layoutSize;t.setWithExplicit("width",Vf(e,"width")),t.setWithExplicit("height",Vf(e,"height"))}const Hf=If,Gf={vconcat:"width",hconcat:"height"};function Yf(e){for(const t of e.children)t.parseLayoutSize()}function Vf(e,t){const n="width"===t?"x":"y",i=e.component.resolve;let r;for(const o of e.children){const e=o.component.layoutSize.getWithExplicit(t),s=i.scale[n];if("independent"===s&&"step"===e.value){r=void 0;break}if(r){if("independent"===s&&r.value!==e.value){r=void 0;break}r=zl(r,e,t,"")}else r=e}if(r){for(const n of e.children)e.renameSignal(n.getName(t),e.getName(t)),n.component.layoutSize.set(t,"merged",!1);return r}return{explicit:!1,value:void 0}}function Jf(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(Gn(e)){const e=ao(i.view,t);return ds(n)||io(e)?"step":e}return oo(i.view,t)}if(e.hasProjection)return oo(i.view,t);{const e=ao(i.view,t);return io(e)?e.step:e}}function Qf(e,t){return function(e){return e&&!a(e)&&"repeat"in e}(e.field)?e.field.repeat in t?Object.assign(Object.assign({},e),{field:t[e.field.repeat]}):void Qt(Ht.noSuchRepeatedValue(e.field.repeat)):e}function Xf(e,t){if(void 0!==(e=Qf(e,t))){if(null===e)return null;if(ki(e)&&Ci(e.sort)){const n=Qf(e.sort,t);e=Object.assign(Object.assign({},e),n?{sort:n}:{})}return e}}function Zf(e,t){if(!zi(e)){if(_i(e)){const n=Xf(e.condition,t);if(n)return Object.assign(Object.assign({},e),{condition:n});return $e(e,["condition"])}return e}{const n=Xf(e,t);if(n)return n;if(Ni(e))return{condition:e.condition}}}function Kf(e,t){const n={};for(const i in e)if(O(e,i)){const r=e[i];if(o(r))n[i]=r.map(e=>Zf(e,t)).filter(e=>e);else{const e=Zf(r,t);void 0!==e&&(n[i]=e)}}return n}function ep(e,t,n){return Wi(t,Object.assign({suffix:`by_${Wi(e)}`},null!=n?n:{}))}class tp extends Ff{constructor(e,t,n,i,r){super(e,"facet",t,n,r,i,e.resolve),this.child=jp(e.spec,this,this.getName("child"),void 0,i,r),this.children=[this.child];const o=function(e,t){return Di(e)?Kf(e,t):Xf(e,t)}(e.facet,i);this.facet=this.initFacet(o)}initFacet(e){return Di(e)?xr(e,(e,t,n)=>U([Le,We],n)?void 0===t.field?(Qt(Ht.emptyFieldDef(t,n)),e):(e[n]=er(t,n),e):(Qt(Ht.incompatibleChannel(n,"facet")),e),{}):{facet:er(e,"facet")}}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=rp(this),this.child.parseData()}parseLayoutSize(){Yf(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of yt)Lf(e,t);qf(e,"x"),qf(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){var e,t,n,i;const r={};for(const o of yt)for(const s of fl){const a=this.component.layoutHeaders[o],u=a[s],{facetFieldDef:c}=a;if(c){const t=cl("titleOrient",c,this.config,o);if(U(["right","bottom"],t)){const n=ul(o,t);r.titleAnchor=null!=(e=r.titleAnchor)?e:{},r.titleAnchor[n]="end"}}if(null===(t=u)||void 0===t?void 0:t[0]){const e="row"===o?"height":"width",t="header"===s?"headerBand":"footerBand";"facet"===o||this.child.component.layoutSize.get(e)||(r[t]=null!=(n=r[t])?n:{},r[t][o]=.5),a.title&&(r.offset=null!=(i=r.offset)?i:{},r.offset["row"===o?"rowTitle":"columnTitle"]=10)}}return r}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),n?{columns:n}:{}),{bounds:"full",align:i})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof tp)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof tp?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:Wi(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(e)):super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof tp){if(this.child.channelHasField("column")){const i=Wi(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of["x","y"]){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),s=r.get("range");if(Gn(o)&&ds(s)){const r=Kd(ef(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):Qt(`Unknown field for ${i}. Cannot calculate view size.`)}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:s,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const e of yt){const t=this.facet[e];if(t){u.push(Wi(t));const{bin:c,sort:l}=t;if(cr(c)&&u.push(Wi(t,{binSuffix:"end"})),Ci(l)){const{field:e,op:o=Ai}=l,u=ep(t,l);n&&i?(r.push(u),s.push("max"),a.push(u)):(r.push(e),s.push(o),a.push(u))}else if(o(l)){const n=al(t,e);r.push(n),s.push("max"),a.push(n)}}}const c=!!n&&!!i;return Object.assign({name:e,data:t,groupby:u},c||r.length>0?{aggregate:Object.assign(Object.assign({},c?{cross:c}:{}),r.length?{fields:r,ops:s,as:a}:{})}:{})}facetSortFields(e){const{facet:t}=this,n=t[e];return n?Ci(n.sort)?[ep(n,n.sort,{expr:"datum"})]:o(n.sort)?[al(n,e,{expr:"datum"})]:[Wi(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(Ci(e)?e.order:!o(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return vl(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of dl)if(e[i]){const r=cl("labelOrient",e[i],t,i);if(U(n[i],r))return vl(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Uf(t);return e.children.forEach(t=>n(t,{source:e.name,name:null,transform:[]})),t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},i?{title:i}:{}),r?{style:r}:{}),{from:{facet:this.assembleFacet()},sort:{field:yt.map(e=>this.facetSortFields(e)).flat(),order:yt.map(e=>this.facetSortOrder(e)).flat()}}),t.length>0?{data:t}:{}),n?{encode:{update:n}}:{}),e.assembleGroup(function(e,t){if(e.component.selection&&Y(e.component.selection).length){const n=u(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:xs("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return Ra(t)}(this,[])))]}getMapping(){return this.facet}}function np(e,t){var n,i,r,o,s,a,u,c,l,d;for(const f of t){const t=f.data;if((!e.name||!f.hasName()||e.name===f.dataName)&&!((null===(n=e.format)||void 0===n?void 0:n.mesh)&&(null===(i=t.format)||void 0===i?void 0:i.feature)||((null===(r=e.format)||void 0===r?void 0:r.feature)||(null===(o=t.format)||void 0===o?void 0:o.feature))&&(null===(s=e.format)||void 0===s?void 0:s.feature)!==(null===(a=t.format)||void 0===a?void 0:a.feature)||((null===(u=e.format)||void 0===u?void 0:u.mesh)||(null===(c=t.format)||void 0===c?void 0:c.mesh))&&(null===(l=e.format)||void 0===l?void 0:l.mesh)!==(null===(d=t.format)||void 0===d?void 0:d.mesh)))if(Mo(e)&&Mo(t)){if(B(e.values,t.values))return f}else if(Po(e)&&Po(t)){if(e.url===t.url)return f}else if(Uo(e)&&e.name===f.dataName)return f}return null}function ip(e,t){if(e.data||!e.parent){if(null===e.data){const e=new ld([]);return t.push(e),e}const n=np(e.data,t);if(n)return Ro(e.data)||(n.data.format=function(e,...t){for(const n of t)W(e,null!=n?n:{});return e}({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new ld(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function rp(e){var t,n,i,r,o,s,a,u,c,l,d;let f=ip(e,e.component.data.sources);const{outputNodes:p,outputNodeRefCounts:g}=e.component.data,h=e.parent?e.parent.component.data.ancestorParse.clone():new Bf,m=e.data;Ro(m)?(Lo(m)?f=new pd(f,m.sequence):qo(m)&&(f=new fd(f,m.graticule)),h.parseNothing=!0):null===(null===(n=null===(t=m)||void 0===t?void 0:t.format)||void 0===n?void 0:n.parse)&&(h.parseNothing=!0),f=null!=(i=Fd.makeExplicit(f,e,h))?i:f,f=new Ed(f);const b=e.parent&&Of(e.parent);(vf(e)||yf(e))&&b&&(f=null!=(r=cd.makeFromEncoding(f,e))?r:f),e.transforms.length>0&&(f=function(e,t,n){var i,r;let o=0;for(const s of t.transforms){let a,u=void 0;if(is(s))a=e=new sl(e,s),u="derived";else if(Go(s)){const r=Od(s);a=e=null!=(i=Fd.makeWithAncestors(e,{},r,n))?i:e,e=new Hc(e,t,s.filter)}else if(rs(s))a=e=cd.makeFromTransform(e,s,t),u="number";else if(ss(s)){u="date",void 0===n.getWithExplicit(s.field).value&&(e=new Fd(e,{[s.field]:u}),n.set(s.field,u,!1)),a=e=va.makeFromTransform(e,s)}else if(as(s))a=e=yd.makeFromTransform(e,s),u="number",tu(t)&&(e=new Ed(e));else if(Yo(s))a=e=_f.make(e,t,s,o++),u="derived";else if(es(s))a=e=new Dd(e,s),u="number";else if(ts(s))a=e=new Cd(e,s),u="number";else if(us(s))a=e=jd.makeFromTransform(e,s),u="derived";else if(cs(s))a=e=new Ef(e,s),u="derived";else if(ns(s))a=e=new Df(e,s),u="derived";else if(Vo(s))a=e=new Pf(e,s),u="derived";else if(Ko(s))e=new Mf(e,s);else if(os(s))a=e=$f.makeFromTransform(e,s),u="derived";else if(Jo(s))a=e=new Cf(e,s),u="derived";else if(Qo(s))a=e=new zf(e,s),u="derived";else if(Xo(s))a=e=new Tf(e,s),u="derived";else{if(!Zo(s)){Qt(Ht.invalidTransformIgnored(s));continue}a=e=new Nf(e,s),u="derived"}if(a&&void 0!==u)for(const e of null!=(r=a.producedFields())?r:[])n.set(e,u,!1)}return e}(f,e,h));const v=function(e){const t={};if(vf(e)&&e.component.selection)for(const n of Y(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&re(e.field)>1&&(t[e.field]="flatten")}return t}(e),y=wd(e);f=null!=(o=Fd.makeWithAncestors(f,{},Object.assign(Object.assign({},v),y),h))?o:f,vf(e)&&(f=Sf.parseAll(f,e),f=kf.parseAll(f,e)),(vf(e)||yf(e))&&(b||(f=null!=(s=cd.makeFromEncoding(f,e))?s:f),f=null!=(a=va.makeFromEncoding(f,e))?a:f,f=sl.parseAllForSortIndex(f,e));const x=e.getName(Ho),A=new ba(f,x,Ho,g);if(p[x]=A,f=A,vf(e)){const t=yd.makeFromEncoding(f,e);t&&(f=t,tu(e)&&(f=new Ed(f))),f=null!=(u=$f.makeFromEncoding(f,e))?u:f,f=null!=(c=jd.makeFromEncoding(f,e))?c:f}vf(e)&&(f=null!=(l=jf.make(f,e))?l:f);const O=e.getName(Io),w=new ba(f,O,Io,g);p[O]=w,f=w,vf(e)&&function(e,t){Ka(e,n=>{const i=n.name,r=e.getName(`lookup_${i}`);e.component.data.outputNodes[r]=n.materialized=new ba(new Hc(t,e,{selection:i}),r,"lookup",e.component.data.outputNodeRefCounts)})}(e,w);let F=null;if(yf(e)){const t=e.getName("facet");f=sl.parseAllForSortIndex(f,e),f=null!=(d=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(Ci(r.sort)){const{field:n,op:i=Ai}=r.sort;e=t=new Cd(e,{joinaggregate:[{op:i,field:n,as:ep(r,r.sort,{forAs:!0})}],groupby:[Wi(r)]})}return t}return null}(f,e.facet))?d:f,F=new xd(f,e,t,w.getSource()),p[t]=F,f=F}return Object.assign(Object.assign({},e.component.data),{outputNodes:p,outputNodeRefCounts:g,raw:A,main:w,facetRoot:F,ancestorParse:h})}class op extends wf{constructor(e,t,n,i,r,o,s){super(e,t,n,i,r,o,s)}parseData(){this.component.data=rp(this),this.children.forEach(e=>{e.parseData()})}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),Y(e.component.selection).forEach(t=>{this.component.selection[t]=e.component.selection[t]})}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){return this.children.reduce((e,t)=>[...e,...t.assembleLayoutSignals()],wl(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:e.getName("group")},t?{title:t}:{}),n?{style:n}:{}),i?{encode:{update:i}}:{}),e.assembleGroup())})}}class sp extends op{constructor(e,t,n,i,r){var o,s,a,u;super(e,"concat",t,n,r,i,e.resolve),"shared"!==(null===(s=null===(o=e.resolve)||void 0===o?void 0:o.axis)||void 0===s?void 0:s.x)&&"shared"!==(null===(u=null===(a=e.resolve)||void 0===a?void 0:a.axis)||void 0===u?void 0:u.y)||Qt(Ht.CONCAT_CANNOT_SHARE_AXIS),this.concatType=eo(e)?"vconcat":to(e)?"hconcat":"concat",this.children=this.getChildren(e).map((e,t)=>jp(e,this,this.getName("concat_"+t),void 0,i,r))}getChildren(e){return eo(e)?e.vconcat:to(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Yf(e);const t=e.component.layoutSize,n=Gf[e.concatType];n&&t.setWithExplicit(n,Vf(e,n))}(this)}parseAxisGroup(){return null}assembleDefaultLayout(){return Object.assign(Object.assign({},"vconcat"===this.concatType?{columns:1}:{}),{bounds:"full",align:"each"})}}const ap=Object.assign(Object.assign({gridScale:1,scale:1},vs),{labelExpr:1,encode:1}),up=Y(ap);class cp extends kl{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new cp(N(this.explicit),N(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}}const lp={bottom:"top",top:"bottom",left:"right",right:"left"};function dp(e,t){if(!e)return t.map(e=>e.clone());{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return xi(e,t);case"gridScale":return{explicit:e.explicit,value:oe(e.value,t.value)}}return _l(e,t,n,"axis")});e.setWithExplicit(n,i)}return e}function pp(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,s=r?r.title:void 0;return o&&s?yi(o,s):o||(s||(void 0!==o?o:void 0!==s?s:void 0))}function gp(e,t){var n;const i=t.axis(e),r=new cp;up.forEach(n=>{const o=function(e,t,n,i){const r=i.fieldDef(n),o=function(e,t,n,i){if(void 0!==t.labelAngle)return ae(t.labelAngle);{const t=nl("labelAngle",e.config,n,ol(n),e.getScaleComponent(n).get("type"));return void 0!==t?ae(t):n===Ie&&U([Nn,$n],i.type)?270:void 0}}(i,t,n,r),s=oe(t.orient,ol(n)),{mark:a,config:u}=i;switch(e){case"scale":return i.scaleName(n);case"gridScale":return function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}(i,n);case"format":if(rr(r))return;return fi(r,t.format,u);case"formatType":if(rr(r))return;return t.formatType;case"grid":if(lr(i.fieldDef(n).bin))return!1;{const e=i.getScaleComponent(n).get("type");return oe(t.grid,function(e,t){return!Gn(e)&&!cr(t.bin)}(e,r))}case"labelAlign":return oe(t.labelAlign,rl(o,s));case"labelAngle":return o;case"labelBaseline":return oe(t.labelBaseline,il(o,s));case"labelFlush":return oe(t.labelFlush,function(e,t){if("x"===t&&U(["quantitative","temporal"],e.type))return!0}(r,n));case"labelOverlap":{const e=i.getScaleComponent(n).get("type");return oe(t.labelOverlap,function(e,t){if("nominal"!==e.type)return"log"!==t||"greedy"}(r,e))}case"orient":return s;case"tickCount":{const e=i.getScaleComponent(n).get("type"),o="x"===n?"width":"y"===n?"height":void 0,s=o?i.getSizeSignalRef(o):void 0;return oe(t.tickCount,function({fieldDef:e,scaleType:t,size:n}){if(!Gn(t)&&"log"!==t&&!U(["month","hours","day","quarter"],e.timeUnit))return cr(e.bin)?{signal:`ceil(${n.signal}/10)`}:{signal:`ceil(${n.signal}/40)`}}({fieldDef:r,scaleType:e,size:s}))}case"title":{const e="x"===n?"x2":"y2",o=i.fieldDef(e);return oe(t.title,pp(i,n),vi([Si(r)],o?[Si(o)]:[]))}case"values":return function(e,t,n){const i=e.values;if(i)return sr(n,i)}(t,0,r);case"zindex":return oe(t.zindex,function(e,t){return"rect"===e&&qi(t)?1:0}(a,r))}return c=e,ys[c]?t[e]:void 0;var c}(n,i,e,t);if(void 0!==o){const s=function(e,t,n,i,r){switch(t){case"titleAngle":case"labelAngle":return e===ae(n[t]);case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===pp(i,r))return!0}return e===n[t]}(o,n,i,t,e),a=nl(n,t.config,e,r.get("orient"),t.getScaleComponent(e).get("type"));s||void 0===a?r.set(n,o,s):U(["grid","orient"],n)&&a&&r.set(n,a,!1)}});const o=null!=(n=i.encoding)?n:{},s=ms.reduce((n,i)=>{var s;if(!r.hasAxisPart(i))return n;const a=Dl(null!=(s=o[i])?s:{},t),u="labels"===i?function(e,t,n){var i;const r=null!=(i=e.fieldDef(t))?i:"x"===t?e.fieldDef("x2"):"y"===t?e.fieldDef("y2"):void 0,o=e.axis(t);let s={};if(rr(r)){const n=e.getScaleComponent(t).get("type")===zn.UTC,i=mi("datum.value",r.timeUnit,o.format,null,n);i&&(s.text={signal:i})}return s=Object.assign(Object.assign({},s),n),0===Y(s).length?void 0:s}(t,e,a):a;return void 0!==u&&Y(u).length>0&&(n[i]={update:u}),n},{});return Y(s).length>0&&r.set("encode",s,!!i.encoding||void 0!==i.labelAngle),r}function hp(e,t,n,{graticule:i}){var r,o;const s=Fe(e)?Object.assign({},e):{type:e},a=null!=(r=s.orient)?r:ci("orient",s,n);return s.orient=function(e,t,n){switch(e){case fe:case ve:case ye:case he:case pe:case le:return}const{x:i,y:r,x2:o,y2:s}=t;switch(e){case ce:if(zi(i)&&(lr(i.bin)||zi(r)&&r.aggregate&&!i.aggregate))return"vertical";if(zi(r)&&(lr(r.bin)||zi(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(s||o){if(n)return n;if(!o&&zi(i)&&i.type===kn&&!cr(i.bin))return"horizontal";if(!s&&zi(r)&&r.type===kn&&!cr(r.bin))return"vertical"}case ge:if(o&&s)return;case ue:if(s)return zi(r)&&lr(r.bin)?"horizontal":"vertical";if(o)return zi(i)&&lr(i.bin)?"vertical":"horizontal";if(e===ge){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case de:case me:{const t=zi(i)&&Ii(i),o=zi(r)&&Ii(r);if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o){const t=i,o=r,s=t.type===Bn,a=o.type===Bn;return s&&!a?"tick"!==e?"vertical":"horizontal":!s&&a?"tick"!==e?"horizontal":"vertical":!t.aggregate&&o.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!o.aggregate?"tick"!==e?"horizontal":"vertical":n||"vertical"}return n||void 0}}return"vertical"}(s.type,t,a),void 0!==a&&a!==s.orient&&Qt(Ht.orientOverridden(s.orient,a)),void 0===oe(s.opacity,ci("opacity",s,n))&&(s.opacity=function(e,t){if(U([fe,me,ve,ye],e)&&!hr(t))return.7;return}(s.type,t)),void 0===s.filled&&(s.filled=!i&&function(e,t){const n=ci("filled",e,t),i=e.type;return oe(n,i!==fe&&i!==de&&i!==ge)}(s,n)),void 0===(null!=(o=s.cursor)?o:ci("cursor",s,n))&&(s.cursor=function(e,t,n){if(t.href||e.href||ci("href",e,n))return"pointer";return e.cursor}(s,t,n)),s}function mp(e,t){const{config:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Gs("size",e)),function(e,t,n){if(n)return{shape:{value:n}};return Gs("shape",e)}(e,0,t))}function bp(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),s=oe(n[r],n.size,ci("size",n,t,{vgChannel:r}),t.tick.bandSize);if(void 0!==s)return s;{const e=o?o.get("range"):void 0;return e&&ds(e)&&F(e.step)?3*e.step/4:3*so(t.view,r)/4}}const vp={area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore"})),ra("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient})),ra("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient})),pa(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),aa(e,"x","bar")),aa(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>mp(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},n&&zi(n)&&n.type===_n?{field:Wi(n,{expr:"datum"})}:{})]}},image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore"})),aa(e,"x","image")),aa(e,"y","image")),Vs(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Gs("size",e,{vgChannel:"strokeWidth"})),pa(e))},point:{vgMark:"symbol",encodeEntry:e=>mp(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),aa(e,"x","rect")),aa(e,"y","rect"))},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),ra("x",e,{defaultPos:"horizontal"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"vertical"!==n})),ra("y",e,{defaultPos:"vertical"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"horizontal"!==n})),Gs("size",e,{vgChannel:"strokeWidth"})):{}}},square:{vgMark:"symbol",encodeEntry:e=>mp(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Vs(e)),Gs("size",e,{vgChannel:"fontSize"})),ga("align",function(e,t,n){var i;if(void 0===(null!==(i=e.align)&&void 0!==i?i:ci("align",e,n)))return"center";return}(e.markDef,0,t))),ga("baseline",function(e,t,n){var i;if(void 0===(null!==(i=e.baseline)&&void 0!==i?i:ci("baseline",e,n)))return"middle";return}(e.markDef,0,t)))}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),Ks("x",e,{defaultPos:"mid",vgChannel:"xc"})),Ks("y",e,{defaultPos:"mid",vgChannel:"yc"})),Gs("size",e,{defaultValue:bp(e),vgChannel:r})),{[o]:{value:oe(n.thickness,t.tick.thickness)}})}},trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Gs("size",e)),pa(e))}};function yp(e){return U([de,ue,be],e.mark)?function(e){const t=Ar(e.mark,e.encoding),n=Op(e,{fromPrefix:t.length>0?xp:""});return t.length>0?[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:xp+e.requestDataName(Io),data:e.requestDataName(Io),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:n}]:n}(e):U([ce],e.mark)?function(e){var t;const n=gs.some(t=>e.markDef[t]||ci(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&n){const[n]=Op(e,{fromPrefix:Ap}),i=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(e,t)=>{return`${e}(${[r({prefix:"min",suffix:"start",expr:t}),r({prefix:"max",suffix:"start",expr:t}),r({prefix:"min",suffix:"end",expr:t}),r({prefix:"max",suffix:"end",expr:t})].map(e=>`scale('${i}',${e})`).join(",")})`};let s,a;"x"===e.stack.fieldChannel?(s=Object.assign(Object.assign({},_(n.encode.update,["y","yc","y2","height",...gs])),{x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}}),a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update=Object.assign(Object.assign({},z(n.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(s=Object.assign(Object.assign({},_(n.encode.update,["x","xc","x2","width"])),{y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}}),a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update=Object.assign(Object.assign({},z(n.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const t of gs){const i=ci(t,e.markDef,e.config);n.encode.update[t]?(s[t]=n.encode.update[t],delete n.encode.update[t]):i&&(s[t]={value:i}),i&&(n.encode.update[t]={value:0})}const u=e.vgField(e.stack.groupbyChannel)?[e.vgField(e.stack.groupbyChannel)]:[];return(null===(t=e.fieldDef(e.stack.groupbyChannel))||void 0===t?void 0:t.bin)&&u.push(e.vgField(e.stack.groupbyChannel,{binSuffix:"end"})),s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((t,i)=>{if(n.encode.update[i])return Object.assign(Object.assign({},t),{[i]:n.encode.update[i]});{const n=ci(i,e.markDef,e.config);return void 0!==n?Object.assign(Object.assign({},t),{[i]:{value:n}}):t}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Io),name:Ap+e.requestDataName(Io),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:a},marks:[n]}]}]}return Op(e)}(e):Op(e)}const xp="faceted_path_";const Ap="stack_group_";function Op(e,t={fromPrefix:""}){const n=e.mark,i=oe(e.markDef.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(t&&t.get("selectionExtent")||n&&n.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),r=ai(e.markDef),s=e.encoding.key,a=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:s}=e,a=t.order;if(!(!o(a)&&Mi(a)&&M(a.value)||!a&&M(r.order)||M(ci("order",r,s)))){if((o(a)||zi(a))&&!n)return bi(a,{expr:"datum"});if(Ae(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(zi(i)){const t=i.sort;if(o(t))return{field:Wi(i,{prefix:n,suffix:"sort_index",expr:"datum"})};if(Ci(t))return{field:Wi({aggregate:hr(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})};if(Fi(t)){return{field:Wi(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}}return{field:Wi(i,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}}else;}}(e),u=function(e){if(!e.component.selection)return null;const t=Y(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=Y(i.component.selection).length,i=i.parent;return n?{interactive:t>0}:null}(e),c=vp[n].postEncodingTransform?vp[n].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:vp[n].vgMark},i?{clip:!0}:{}),r?{style:r}:{}),s?{key:s.field}:{}),a?{sort:a}:{}),u||{}),{from:{data:t.fromPrefix+e.requestDataName(Io)},encode:{update:vp[n].encodeEntry(e)}}),c?{transform:c}:{})]}class wp extends Ff{constructor(e,t,n,i={},r,o){var s;super(e,"unit",t,n,o,r,void 0,e.view),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const a=Fe(e.mark)?e.mark.type:e.mark,u=function(e,t){return Kf(e,t)}(null!=(s=e.encoding)?s:{},r);this.markDef=hp(e.mark,u,o,{graticule:e.data&&qo(e.data)});const c=this.encoding=br(u,this.markDef);this.size=function({encoding:e,size:t}){for(const n of Nt){const i=_t(n),r=Zi(e[n]);io(t[i])&&r&&Ii(r)&&(delete t[i],Qt(Ht.stepDropped(i)))}return t}({encoding:c,size:Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{})}),this.stack=Oo(a,c),this.specifiedScales=this.initScales(a,c),this.specifiedAxes=this.initAxes(c),this.specifiedLegends=this.initLegend(c),this.specifiedProjection=e.projection,this.selection=e.selection}get hasProjection(){const{encoding:e}=this,t=this.mark===xe,n=e&&ht.some(t=>zi(e[t]));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return Ut.reduce((e,n)=>{let i,r;const o=t[n];return zi(o)?(i=o,r=o.scale):_i(o)&&(i=o.condition,r=o.condition.scale),i&&(e[n]=null!=r?r:{}),e},{})}initAxes(e){return[Ie,He].reduce((t,n)=>{const i=e[n];if(zi(i)||n===Ie&&zi(e.x2)||n===He&&zi(e.y2)){const e=zi(i)?i.axis:null;null!==e&&(t[n]=Object.assign({},e))}return t},{})}initLegend(e){return Pt.reduce((t,n)=>{const i=e[n];if(i){const e=zi(i)?i.legend:_i(i)?i.condition.legend:null;null!==e&&!1!==e&&function(e){switch(e){case Ze:case Ke:case et:case nt:case tt:case it:case st:return!0;case rt:case ot:return!1}}(n)&&(t[n]=Object.assign({},e))}return t},{})}parseData(){this.component.data=rp(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Nt){const r=_t(i);if(t[r]){const e=t[r];n.layoutSize.set(r,io(e)?"step":e,!0)}else{const t=Jf(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){var n;const i={},r=e.config.selection;for(const o in t){if(!O(t,o))continue;const s=N(t[o]),u=$e(r[s.type],["fields","encodings"]);for(const e in u)"encodings"===e&&s.fields||"fields"===e&&s.encodings||("mark"===e&&(s[e]=Object.assign(Object.assign({},u[e]),s[e])),void 0!==s[e]&&!0!==s[e]||(s[e]=null!=(n=u[e])?n:s[e]));const c=Q(o),l=i[c]=Object.assign(Object.assign({},s),{name:c,events:a(s.on)?xs(s.on,"scope"):N(s.on)});Pa(l,n=>{n.has(l)&&n.parse&&n.parse(e,l,s,t[o])})}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=yp(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Nt.reduce((t,n)=>(e.component.scales[n]&&e.axis(n)&&(t[n]=[gp(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;if(Ka(e,(i,r)=>{const o=i.name,s=u(o+Va);if(0===t.filter(e=>e.name===o).length){const e="global"===i.resolve?"union":i.resolve,n="multi"===i.type?", true)":")";t.push({name:i.name,update:`${Xa}(${s}, ${u(e)}${n}`})}n=!0,r.topLevelSignals&&(t=r.topLevelSignals(e,i,t)),Pa(i,n=>{n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))})}),n){0===t.filter(e=>"unit"===e.name).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return Ra(t)}(this,e)}assembleSignals(){return[...Xc(this),...(e=this,t=[],Ka(e,(n,i)=>{const r=n.name;let o=i.modifyExpr(e,n);t.push(...i.signals(e,n)),Pa(n,i=>{i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(o=i.modifyExpr(e,n,o))}),t.push({name:r+Qa,on:[{events:{signal:n.name+Ja},update:`modify(${u(n.name+Va)}, ${o})`}]})}),Ra(t))];var e,t}assembleSelectionData(e){return function(e,t){const n=[...t];return Ka(e,t=>{const i={name:t.name+Va};if(t.init){const n=t.project.items.map(e=>{return $e(e,["signals"])}),r=t.init.map(e=>Ma(e,!1));i.values="interval"===t.type?[{unit:eu(e,{escape:!1}),fields:n,values:r}]:r.map(t=>({unit:eu(e,{escape:!1}),fields:n,values:t}))}n.filter(e=>e.name===t.name+Va).length||n.push(i)}),n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return wl(this)}assembleMarks(){var e;let t=null!=(e=this.component.mark)?e:[];return this.parent&&Of(this.parent)||(t=Ua(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return gr(this.encoding,e)}fieldDef(e){return Ki(this.encoding[e])}}class Fp extends wf{constructor(e,t,n,i,r,o){super(e,"layer",t,n,o,r,e.resolve,e.view);const s=Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{});this.children=e.layer.map((e,t)=>{if(bo(e))return new Fp(e,this,this.getName("layer_"+t),s,r,o);if(Se(e))return new wp(e,this,this.getName("layer_"+t),s,r,o);throw new Error(Ht.invalidSpec(e))})}parseData(){this.component.data=rp(this);for(const e of this.children)e.parseData()}parseLayoutSize(){If(this)}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),Y(e.component.selection).forEach(t=>{this.component.selection[t]=e.component.selection[t]})}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){var t;const{axes:n,resolve:i}=e.component,r={top:0,bottom:0,right:0,left:0};for(const t of e.children){t.parseAxesAndHeaders();for(const r of Y(t.component.axes))i.axis[r]=Sl(e.component.resolve,r),"shared"===i.axis[r]&&(n[r]=dp(n[r],t.component.axes[r]),n[r]||(i.axis[r]="independent",delete n[r]))}for(const o of[Ie,He]){for(const s of e.children)if(s.component.axes[o]){if("independent"===i.axis[o]){n[o]=(t=n[o],null!=t?t:[]).concat(s.component.axes[o]);for(const e of s.component.axes[o]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(r[t]>0&&!n){const n=lp[t];r[t]>r[n]&&e.set("orient",n,!1)}r[t]++}}delete s.component.axes[o]}if("independent"===i.axis[o]&&n[o]&&n[o].length>1)for(const e of n[o])e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),Xc(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),wl(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)vf(n)&&(t=Ua(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),ed(this))}}class Cp extends op{constructor(e,t,n,i,r){super(e,"repeat",t,n,r,i,e.resolve),e.resolve&&e.resolve.axis&&("shared"===e.resolve.axis.x||"shared"===e.resolve.axis.y)&&Qt(Ht.REPEAT_CANNOT_SHARE_AXIS),this.repeat=e.repeat,this.children=this._initChildren(e,this.repeat,i,r)}_initChildren(e,t,n,i){const r=[],s=!o(t)&&t.row||[n?n.row:null],a=!o(t)&&t.column||[n?n.column:null],u=o(t)&&t||[n?n.repeat:null];for(const t of u)for(const n of s)for(const o of a){const s=(t?`__repeat_repeat_${t}`:"")+(n?`__repeat_row_${n}`:"")+(o?`__repeat_column_${o}`:""),a={repeat:t,row:n,column:o};r.push(jp(e.spec,this,this.getName("child"+s),void 0,a,i))}return r}parseLayoutSize(){Hf(this)}assembleDefaultLayout(){const{repeat:e}=this,t=o(e)?void 0:e.column?e.column.length:1;return Object.assign(Object.assign({},t?{columns:t}:{}),{bounds:"full",align:"all"})}}function jp(e,t,n,i,r,o){if(Ei(e))return new tp(e,t,n,r,o);if(bo(e))return new Fp(e,t,n,i,r,o);if(Se(e))return new wp(e,t,n,i,r,o);if(no(e))return new Cp(e,t,n,r,o);if(function(e){return eo(e)||to(e)||Kr(e)}(e))return new sp(e,t,n,r,o);throw new Error(Ht.invalidSpec(e))}const Dp=new class extends vo{mapUnit(e,{config:t}){if(e.encoding){const{encoding:n,transform:i}=e,{bins:r,timeUnits:o,aggregate:s,groupby:a,encoding:u}=mr(n,t),c=[...i||[],...r,...o,...0===s.length?[]:[{aggregate:s,groupby:a}]];return Object.assign(Object.assign(Object.assign({},e),c.length>0?{transform:c}:{}),{encoding:u})}return e}};const Ep=t;e.compile=function(e,t={}){var n;t.logger&&(n=t.logger,Jt=n),t.fieldTitle&&Yi(t.fieldTitle);try{const n=lo(b({},t.config,e.config)),i=Bo(e,n),r=jp(i,null,"",void 0,void 0,n);return r.parse(),function(e,t){dd(e.sources);let n=0,i=0;for(let i=0;i{e.hasName()||(e.dataName=`source_${s++}`);const t=e.assemble();o(e,t)}),r.forEach(e=>{0===e.transform.length&&delete e.transform});let a=0;for(const[e,t]of r.entries())0!==(n=t.transform,null!=n?n:[]).length||t.source||r.splice(a++,0,r.splice(e,1)[0]);for(const t of r)for(const n of null!=(i=t.transform)?i:[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of r)e.name in t&&(e.values=t[e.name]);return r}(e.component.data,n)),s=e.assembleProjections(),a=e.assembleTitle(),u=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let l=e.assembleLayoutSignals();return l=l.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},e.description?{description:e.description}:{}),t),a?{title:a}:{}),u?{style:u}:{}),c?{encode:{update:c}}:{}),{data:o}),s.length>0?{projections:s}:{}),e.assembleGroup([...l,...e.assembleSelectionTopLevelSignals([])])),r?{config:r}:{}),i?{usermeta:i}:{})}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");void 0===t?t={type:"pad"}:a(t)&&(t={type:t});if(r&&o&&(s=t.type,"fit"===s||"fit-x"===s||"fit-y"===s))if("step"===r&&"step"===o)Qt(Ht.droppingFit()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";Qt(Ht.droppingFit(zt(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${zt(e)}`:"fit"}(n)}var s;return Object.assign(Object.assign(Object.assign({},1===Y(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t}),To(n)),To(e))}(e,i.autosize,n,r),e.datasets,e.usermeta),normalized:i}}finally{t.logger&&(Jt=Gt),t.fieldTitle&&Yi(Hi)}},e.extractTransforms=function(e,t){return Dp.map(e,{config:t})},e.normalize=Bo,e.version=Ep,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/kpi_dashboard_altair/static/lib/vega/vega.min.js b/kpi_dashboard_altair/static/lib/vega/vega.min.js new file mode 100644 index 00000000..0e600f6f --- /dev/null +++ b/kpi_dashboard_altair/static/lib/vega/vega.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).vega={})}(this,(function(t){"use strict";function e(t,e,n){return t.fields=e||[],t.fname=n,t}function n(t){return null==t?null:t.fname}function r(t){return null==t?null:t.fields}function i(t){throw Error(t)}function a(t){var e,n,r,a=[],u=null,o=0,s=t.length,l="";function c(){a.push(l+t.substring(e,n)),l="",e=n+1}for(t+="",e=n=0;ne&&c(),o=e=n+1):"]"===r&&(o||i("Access path missing open bracket: "+t),o>0&&c(),o=0,e=n+1):n>e?c():e=n+1}return o&&i("Access path missing closing bracket: "+t),u&&i("Access path missing closing quote: "+t),n>e&&(n++,c()),a}var u=Array.isArray;function o(t){return t===Object(t)}function s(t){return"string"==typeof t}function l(t){return u(t)?"["+t.map(l)+"]":o(t)||s(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function c(t,n){var r=a(t),i="return _["+r.map(l).join("][")+"];";return e(Function("_",i),[t=1===r.length?r[0]:t],n||t)}var f=[],h=c("id"),d=e((function(t){return t}),f,"identity"),p=e((function(){return 0}),f,"zero"),g=e((function(){return 1}),f,"one"),m=e((function(){return!0}),f,"true"),v=e((function(){return!1}),f,"false");function y(t,e,n){var r=[e].concat([].slice.call(n));console[t].apply(console,r)}function _(t,e){var n=t||0;return{level:function(t){return arguments.length?(n=+t,this):n},error:function(){return n>=1&&y(e||"error","ERROR",arguments),this},warn:function(){return n>=2&&y(e||"warn","WARN",arguments),this},info:function(){return n>=3&&y(e||"log","INFO",arguments),this},debug:function(){return n>=4&&y(e||"log","DEBUG",arguments),this}}}const x=t=>"__proto__"!==t;function b(...t){return t.reduce((t,e)=>{for(var n in e)if("signals"===n)t.signals=A(t.signals,e.signals);else{var r="legend"===n?{layout:1}:"style"===n||null;w(t,n,e[n],r)}return t},{})}function w(t,e,n,r){var i,a;if(x(e))if(o(n)&&!u(n))for(i in a=o(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?w(a,i,n[i]):x(i)&&(a[i]=n[i]);else t[e]=n}function A(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function k(t){return t[t.length-1]}function M(t){return null==t||""===t?null:+t}function E(t){return function(e){return t*Math.exp(e)}}function D(t){return function(e){return Math.log(t*e)}}function C(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function F(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function S(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function B(t,e,n,r){var i=n(t[0]),a=n(k(t)),u=(a-i)*e;return[r(i-u),r(a-u)]}function z(t,e){return B(t,e,M,d)}function T(t,e){var n=Math.sign(t[0]);return B(t,e,D(n),E(n))}function N(t,e,n){return B(t,e,S(n),S(1/n))}function O(t,e,n){return B(t,e,C(n),F(n))}function R(t,e,n,r,i){var a=r(t[0]),u=r(k(t)),o=null!=e?r(e):(a+u)/2;return[i(o+(a-o)*n),i(o+(u-o)*n)]}function q(t,e,n){return R(t,e,n,M,d)}function U(t,e,n){var r=Math.sign(t[0]);return R(t,e,n,D(r),E(r))}function L(t,e,n,r){return R(t,e,n,S(r),S(1/r))}function P(t,e,n,r){return R(t,e,n,C(r),F(r))}function $(t){return 1+~~(new Date(t).getMonth()/3)}function j(t){return 1+~~(new Date(t).getUTCMonth()/3)}function I(t){return null!=t?u(t)?t:[t]:[]}function H(t,e,n){var r,i=t[0],a=t[1];return a=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function W(t){return"function"==typeof t}function Y(t,n){var i,u,o,s,c,f,h,d,p,g=[],m=(t=I(t)).map((function(t,e){return null==t?null:(g.push(e),W(t)?t:a(t).map(l).join("]["))})),v=g.length-1,y=I(n),_="var u,v;return ";if(v<0)return null;for(u=0;u<=v;++u)W(o=m[i=g[u]])?(s="(u=this."+(f="f"+i)+"(a))",c="(v=this."+f+"(b))",(h=h||{})[f]=o):(s="(u=a["+o+"])",c="(v=b["+o+"])"),f="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==y[i]?(p=1,d=-1):(p=-1,d=1),_+="("+s+"<"+c+"||u==null)&&v!=null?"+d+":(u>v||v==null)&&u!=null?"+p+":"+f+"!==u&&v===v?"+d+":v!==v&&u===u?"+p+(ia&&(a=r))}else{for(r=e(t[u]);ua&&(a=r))}return[i,a]}function Z(t,e){var n,r,i,a,u,o=-1,s=t.length;if(null==e){for(;++o=r){n=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++or&&(n=r,a=o),i=r){n=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++or&&(n=r,a=o),iu&&(i=a,a=u,u=i),r=void 0===r||r,((n=void 0===n||n)?a<=t:a{e={},n={},r=0},a=(i,a)=>(++r>t&&(n=e,e={},r=1),e[i]=a);return i(),{clear:i,has:t=>K(e,t)||K(n,t),get:t=>K(e,t)?e[t]:K(n,t)?a(t,n[t]):void 0,set:(t,n)=>K(e,t)?e[t]=n:a(t,n)}}function ht(t,e,n,r){var i=e.length,a=n.length;if(!a)return e;if(!i)return n;for(var u=r||new e.constructor(i+a),o=0,s=0,l=0;o0?n[s++]:e[o++];for(;o=0;)n+=t;return n}function pt(t,e,n,r){var i=n||" ",a=t+"",u=e-a.length;return u<=0?a:"left"===r?dt(i,u)+a:"center"===r?dt(i,~~(u/2))+a+dt(i,Math.ceil(u/2)):a+dt(i,u)}function gt(t){return t&&k(t)-t[0]||0}function mt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}function vt(t){return ot(t)||ut(t)?t:Date.parse(t)}function yt(t,e){return e=e||vt,null==t||""===t?null:e(t)}function _t(t){return null==t||""===t?null:t+""}function xt(t){for(var e={},n=0,r=t.length;n=0&&n.splice(i,1)),n},n}async function kt(t,e){try{await e(t)}catch(e){t.error(e)}}var Mt=Symbol("vega_id"),Et=1;function Dt(t){return!(!t||!Ct(t))}function Ct(t){return t[Mt]}function Ft(t,e){return t[Mt]=e,t}function St(t){var e=t===Object(t)?t:{data:t};return Ct(e)?e:Ft(e,Et++)}function Bt(t){return zt(t,St({}))}function zt(t,e){for(var n in t)e[n]=t[n];return e}function Tt(t,e){return Ft(e,Ct(t))}function Nt(t,e){return t?e?(n,r)=>t(n,r)||Ct(e(n))-Ct(e(r)):(e,n)=>t(e,n)||Ct(e)-Ct(n):null}function Ot(t){return t&&t.constructor===Rt}function Rt(){var t=[],e=[],n=[],r=[],i=[],a=!1;return{constructor:Rt,insert:function(e){for(var n=I(e),r=0,i=n.length;r0&&(m(h,f,c.value),u.modifies(f));for(s=0,l=i.length;s0&&m(t,c.field,c.value)})),u.modifies(c.field);if(a)u.mod=e.length||r.length?o.filter((function(t){return p[Ct(t)]>0})):o.slice();else for(d in g)u.mod.push(g[d]);return u}}}var qt="_:mod:_";function Ut(){Object.defineProperty(this,qt,{writable:!0,value:{}})}var Lt=Ut.prototype;Lt.set=function(t,e,n,r){var i=this,a=i[t],o=i[qt];return null!=e&&e>=0?(a[e]!==n||r)&&(a[e]=n,o[e+":"+t]=-1,o[t]=-1):(a!==n||r)&&(i[t]=n,o[t]=u(n)?1+n.length:-1),i},Lt.modified=function(t,e){var n,r=this[qt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(u(t)){for(n=0;n=0?e+1t?(e=n,1):0}))},Gt.debounce=function(t){var e=Vt();return this.targets().add(Vt(null,null,G(t,(function(t){var n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},Gt.between=function(t,e){var n=!1;return t.targets().add(Vt(null,null,(function(){n=!0}))),e.targets().add(Vt(null,null,(function(){n=!1}))),this.filter((function(){return n}))};const Xt=/^([A-Za-z]+:)?\/\//,Jt=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Zt=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Qt(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e)}async function Kt(t,e){e=X({},this.options,e);const n=this.fileAccess,r={href:null};let a,u,o;const s=Jt.test(t.replace(Zt,""));null!=t&&"string"==typeof t&&s||i("Sanitize failure, invalid URI: "+l(t));const c=Xt.test(t);return(o=e.baseURL)&&!c&&(t.startsWith("/")||"/"===o[o.length-1]||(t="/"+t),t=o+t),u=(a=t.startsWith("file://"))||"file"===e.mode||"http"!==e.mode&&!c&&n,a?t=t.slice("file://".length):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),u=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!u}),r.href=t,e.target&&(r.target=e.target+""),e.rel&&(r.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(r.crossOrigin=e.crossOrigin+""),r}function te(t){return t?function(e){return new Promise((function(n,r){t.readFile(e,(function(t,e){t?r(t):n(e)}))}))}:ee}async function ee(){i("No file system access.")}function ne(t){return t?async function(e,n){const r=X({},this.options.http,n),a=n&&n.response,u=await t(e,r);return u.ok?W(u[a])?u[a]():u.text():i(u.status+""+u.statusText)}:re}async function re(){i("No HTTP fetch method available.")}var ie={boolean:mt,integer:M,number:M,date:yt,string:_t,unknown:d},ae=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return le(t)&&Number.isInteger(+t)},le,function(t){return!Number.isNaN(Date.parse(t))}],ue=["boolean","integer","number","date"];function oe(t,e){if(!t||!t.length)return"unknown";var n,r,i,a,u=0,o=t.length,s=ae.length,l=ae.map((function(t,e){return e+1}));for(r=0,o=t.length;r9999?"+"+pe(t,6):pe(t,4)}(t.getUTCFullYear())+"-"+pe(t.getUTCMonth()+1,2)+"-"+pe(t.getUTCDate(),2)+(i?"T"+pe(e,2)+":"+pe(n,2)+":"+pe(r,2)+"."+pe(i,3)+"Z":r?"T"+pe(e,2)+":"+pe(n,2)+":"+pe(r,2)+"Z":n||e?"T"+pe(e,2)+":"+pe(n,2)+"Z":"")}function me(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],a=t.length,u=0,o=0,s=a<=0,l=!1;function c(){if(s)return fe;if(l)return l=!1,ce;var e,r,i=u;if(34===t.charCodeAt(i)){for(;u++=a?s=!0:10===(r=t.charCodeAt(u++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(u)&&++u),t.slice(i+1,e-1).replace(/""/g,'"')}for(;u1)r=De(t,e,n);else for(i=0,r=new Array(a=t.arcs.length);it!==e,exterior:(t,e)=>t===e};function Fe(t,e){let n,r,a,u;return t=_e(t,e),e&&e.feature?(n=be,a=e.feature):e&&e.mesh?(n=Me,a=e.mesh,u=Ce[e.filter]):i("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[a])?n(t,r,u):i("Invalid TopoJSON object: "+a),r&&r.features||[r]}Fe.responseType="json";const Se={dsv:ye,csv:ve(","),tsv:ve("\t"),json:_e,topojson:Fe};function Be(t,e){return arguments.length>1?(Se[t]=e,this):K(Se,t)?Se[t]:null}function ze(t){const e=Be(t);return e&&e.responseType||"text"}var Te=new Date,Ne=new Date;function Oe(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e0))return o;do{o.push(u=new Date(+n)),e(n,a),t(n)}while(u=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Te.setTime(+e),Ne.setTime(+r),t(Te),t(Ne),Math.floor(n(Te,Ne))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var Re=Oe((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));Re.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Oe((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):Re:null};var qe=Oe((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+1e3*e)}),(function(t,e){return(e-t)/1e3}),(function(t){return t.getUTCSeconds()})),Ue=Oe((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getMinutes()})),Le=Oe((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getHours()})),Pe=Oe((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}));function $e(t){return Oe((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var je=$e(0),Ie=$e(1),He=($e(2),$e(3),$e(4)),We=($e(5),$e(6),Oe((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),Ye=Oe((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Ye.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Oe((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var Ve=Oe((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+6e4*e)}),(function(t,e){return(e-t)/6e4}),(function(t){return t.getUTCMinutes()})),Ge=Oe((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+36e5*e)}),(function(t,e){return(e-t)/36e5}),(function(t){return t.getUTCHours()})),Xe=Oe((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/864e5}),(function(t){return t.getUTCDate()-1}));function Je(t){return Oe((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/6048e5}))}var Ze=Je(0),Qe=Je(1),Ke=(Je(2),Je(3),Je(4)),tn=(Je(5),Je(6),Oe((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),en=Oe((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function nn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function rn(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function an(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}en.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Oe((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var un,on,sn,ln,cn,fn={"-":"",_:" ",0:"0"},hn=/^\s*\d+/,dn=/^%/,pn=/[\\^$*+?|[\]().{}]/g;function gn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a68?1900:2e3),n+r[0].length):-1}function En(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Dn(t,e,n){var r=hn.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Cn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Fn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Sn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Bn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Tn(t,e,n){var r=hn.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Nn(t,e,n){var r=hn.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function On(t,e,n){var r=hn.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Rn(t,e,n){var r=dn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function qn(t,e,n){var r=hn.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Un(t,e,n){var r=hn.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ln(t,e){return gn(t.getDate(),e,2)}function Pn(t,e){return gn(t.getHours(),e,2)}function $n(t,e){return gn(t.getHours()%12||12,e,2)}function jn(t,e){return gn(1+Pe.count(Ye(t),t),e,3)}function In(t,e){return gn(t.getMilliseconds(),e,3)}function Hn(t,e){return In(t,e)+"000"}function Wn(t,e){return gn(t.getMonth()+1,e,2)}function Yn(t,e){return gn(t.getMinutes(),e,2)}function Vn(t,e){return gn(t.getSeconds(),e,2)}function Gn(t){var e=t.getDay();return 0===e?7:e}function Xn(t,e){return gn(je.count(Ye(t)-1,t),e,2)}function Jn(t,e){var n=t.getDay();return t=n>=4||0===n?He(t):He.ceil(t),gn(He.count(Ye(t),t)+(4===Ye(t).getDay()),e,2)}function Zn(t){return t.getDay()}function Qn(t,e){return gn(Ie.count(Ye(t)-1,t),e,2)}function Kn(t,e){return gn(t.getFullYear()%100,e,2)}function tr(t,e){return gn(t.getFullYear()%1e4,e,4)}function er(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+gn(e/60|0,"0",2)+gn(e%60,"0",2)}function nr(t,e){return gn(t.getUTCDate(),e,2)}function rr(t,e){return gn(t.getUTCHours(),e,2)}function ir(t,e){return gn(t.getUTCHours()%12||12,e,2)}function ar(t,e){return gn(1+Xe.count(en(t),t),e,3)}function ur(t,e){return gn(t.getUTCMilliseconds(),e,3)}function or(t,e){return ur(t,e)+"000"}function sr(t,e){return gn(t.getUTCMonth()+1,e,2)}function lr(t,e){return gn(t.getUTCMinutes(),e,2)}function cr(t,e){return gn(t.getUTCSeconds(),e,2)}function fr(t){var e=t.getUTCDay();return 0===e?7:e}function hr(t,e){return gn(Ze.count(en(t)-1,t),e,2)}function dr(t,e){var n=t.getUTCDay();return t=n>=4||0===n?Ke(t):Ke.ceil(t),gn(Ke.count(en(t),t)+(4===en(t).getUTCDay()),e,2)}function pr(t){return t.getUTCDay()}function gr(t,e){return gn(Qe.count(en(t)-1,t),e,2)}function mr(t,e){return gn(t.getUTCFullYear()%100,e,2)}function vr(t,e){return gn(t.getUTCFullYear()%1e4,e,4)}function yr(){return"+0000"}function _r(){return"%"}function xr(t){return+t}function br(t){return Math.floor(+t/1e3)}function wr(t){return un=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,a=t.days,u=t.shortDays,o=t.months,s=t.shortMonths,l=vn(i),c=yn(i),f=vn(a),h=yn(a),d=vn(u),p=yn(u),g=vn(o),m=yn(o),v=vn(s),y=yn(s),_={a:function(t){return u[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:Ln,e:Ln,f:Hn,H:Pn,I:$n,j:jn,L:In,m:Wn,M:Yn,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:xr,s:br,S:Vn,u:Gn,U:Xn,V:Jn,w:Zn,W:Qn,x:null,X:null,y:Kn,Y:tr,Z:er,"%":_r},x={a:function(t){return u[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:nr,e:nr,f:or,H:rr,I:ir,j:ar,L:ur,m:sr,M:lr,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:xr,s:br,S:cr,u:fr,U:hr,V:dr,w:pr,W:gr,x:null,X:null,y:mr,Y:vr,Z:yr,"%":_r},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return k(t,e,n,r)},d:Fn,e:Fn,f:On,H:Bn,I:Bn,j:Sn,L:Nn,m:Cn,M:zn,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:Dn,Q:qn,s:Un,S:Tn,u:xn,U:bn,V:wn,w:_n,W:An,x:function(t,e,r){return k(t,n,e,r)},X:function(t,e,n){return k(t,r,e,n)},y:Mn,Y:kn,Z:En,"%":Rn};function w(t,e){return function(n){var r,i,a,u=[],o=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++o53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=rn(an(a.y,0,1))).getUTCDay(),r=i>4||0===i?Qe.ceil(r):Qe(r),r=Xe.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=nn(an(a.y,0,1))).getDay(),r=i>4||0===i?Ie.ceil(r):Ie(r),r=Pe.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?rn(an(a.y,0,1)).getUTCDay():nn(an(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,rn(a)):nn(a)}}function k(t,e,n,r){for(var i,a,u=0,o=e.length,s=n.length;u=s)return-1;if(37===(i=e.charCodeAt(u++))){if(i=e.charAt(u++),!(a=b[i in fn?e.charAt(u++):i])||(r=a(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=w(n,_),_.X=w(r,_),_.c=w(e,_),x.x=w(n,x),x.X=w(r,x),x.c=w(e,x),{format:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=A(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=A(t+="",!0);return e.toString=function(){return t},e}}}(t),on=un.format,sn=un.parse,ln=un.utcFormat,cn=un.utcParse,un}function Ar(t,e,n){const r=Be((e=e||{}).type||"json");return r||i("Unknown data format type: "+e.type),t=r(t,e),e.parse&&function(t,e,n){if(!t.length)return;n=n||sn;var r,i,a,u,o,s,l,c=t.columns||Object.keys(t[0]);"auto"===e&&(e=se(t,c));for(c=Object.keys(e),r=c.map((function(t){var r,i,a=e[t];if(a&&(a.startsWith("date:")||a.startsWith("utc:")))return("'"===(i=(r=a.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?cn(i):n(i);if(!ie[a])throw Error("Illegal format pattern: "+t+":"+a);return ie[a]})),u=0,s=t.length,l=c.length;ut.touch(n(e)):W(r)?(o=new jt(null,r,i,!1),u=e=>{o.evaluate(e);const r=n(e),i=o.value;Ot(i)?t.pulse(r,i,a):t.update(r,i,s)}):u=e=>t.update(n(e),r,s),e.apply(u)}function Cr(t,e,n,r,i,a){if(void 0===r)e.targets().add(n);else{const u=a||{},o=new jt(null,function(t,e){return e=W(e)?e:V(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);o.modified(u.force),o.rank=e.rank,e.targets().add(o),n&&(o.skip(!0),o.value=n.value,o.targets().add(n),t.connect(n,[o]))}}var Fr={};function Sr(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}var Br=Sr.prototype;function zr(t,e){return t?function(n,r){return t(n,r)&&e(n,r)}:e}function Tr(t,e){var n=[];return wt(t,e,(function(t){n.push(t)})),n}function Nr(t,e){var n={};return t.visit(e,(function(t){n[Ct(t)]=1})),function(t){return n[Ct(t)]?null:t}}function Or(t,e,n,r){var i,a,u,o,s,l=this,c=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n,u=0,o=n.length;ue[t]=!0):e[t]=!0,this},Br.modified=function(t,e){var n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?u(t)?t.some((function(t){return n[t]})):n[t]:!!n)},Br.filter=function(t,e){var n=this;return 1&t&&(n.addF=zr(n.addF,e)),2&t&&(n.remF=zr(n.remF,e)),4&t&&(n.modF=zr(n.modF,e)),16&t&&(n.srcF=zr(n.srcF,e)),n},Br.materialize=function(t){var e=this;return 1&(t=t||7)&&e.addF&&(e.add=Tr(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Tr(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Tr(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},Br.visit=function(t,e){var n,r,i=this,a=e;return 16&t?(wt(i.source,i.srcF,a),i):(1&t&&wt(i.add,i.addF,a),2&t&&wt(i.rem,i.remF,a),4&t&&wt(i.mod,i.modF,a),8&t&&(n=i.source)&&((r=i.add.length+i.mod.length)===n.length||wt(n,r?Nr(i,5):i.srcF,a)),i)};var Rr=rt(Or,Sr);function qr(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Rr.fork=function(t){var e=new Sr(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(function(t){return e.add.push(t)})),t&e.REM&&this.visit(e.REM,(function(t){return e.rem.push(t)})),t&e.MOD&&this.visit(e.MOD,(function(t){return e.mod.push(t)}))),e},Rr.changed=function(t){return this.changes&t},Rr.modified=function(t){var e=this,n=e.fields;return n&&e.changes&e.MOD?u(t)?t.some((function(t){return n[t]})):n[t]:0},Rr.filter=function(){i("MultiPulse does not support filtering.")},Rr.materialize=function(){i("MultiPulse does not support materialization.")},Rr.visit=function(t,e){var n=this,r=n.pulses,i=r.length,a=0;if(t&n.SOURCE)for(;ae=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),Pr(e,0,e.length-1,t)),pop:()=>{var n,r=e.pop();return e.length?(n=e[0],e[0]=r,function(t,e,n){var r,i=e,a=t.length,u=t[e],o=1+(e<<1);for(;o=0&&(o=r),t[e]=t[o],o=1+((e=o)<<1);t[e]=u,Pr(t,i,e,n)}(e,0,t)):n=r,n}}}function Pr(t,e,n,r){var i,a,u;for(i=t[n];n>e&&r(i,a=t[u=n-1>>1])<0;)t[n]=a,n=u;return t[n]=i}function $r(){this.logger(_()),this.logLevel(1),this._clock=0,this._rank=0;try{this._loader=kr()}catch(t){}this._touched=At(h),this._input={},this._pulse=null,this._heap=Lr((t,e)=>t.qrank-e.qrank),this._postrun=[]}var jr=$r.prototype;function Ir(t){return function(){return this._log[t].apply(this,arguments)}}function Hr(t,e){jt.call(this,t,null,e)}jr.stamp=function(){return this._clock},jr.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},jr.cleanThreshold=1e4,jr.add=function(t,e,n,r){var i,a=1;return t instanceof jt?i=t:t&&t.prototype instanceof jt?i=new t:W(t)?i=new jt(null,t):(a=0,i=new jt(t,e)),this.rank(i),a&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},jr.connect=function(t,e){var n,r,i=t.rank;for(n=0,r=e.length;n=0;)a.push(e=n[r]),e===t&&i("Cycle detected in dataflow graph.")},jr.pulse=function(t,e,n){this.touch(t,n||Ur);var r=new Sr(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},jr.touch=function(t,e){var n=e||Ur;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},jr.update=function(t,e,n){var r=n||Ur;return(t.set(e)||r.force)&&this.touch(t,r),this},jr.changeset=Rt,jr.ingest=function(t,e,n){return this.pulse(t,this.changeset().insert(Mr(e,n)))},jr.parse=Mr,jr.preload=async function(t,e,n){const r=this,i=r._pending||function(t){var e,n=new Promise((function(t){e=t}));return n.requests=0,n.done=function(){0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const a=await r.request(e,n);return r.pulse(t,r.changeset().remove(m).insert(a.data||[])),i.done(),a},jr.request=async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:ze(e&&e.type)});try{r=Mr(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},jr.events=function(t,e,n,r){for(var i,a=this,u=Vt(n,r),o=function(t){t.dataflow=a;try{u.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,l=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):I(t)).length;s=3&&(s=Date.now(),r.debug("-- START PROPAGATION ("+c+") -----")),r._touched.forEach(t=>r._enqueue(t,!0)),r._touched=At(h);try{for(;r._heap.size()>0;)u=r._heap.pop(),u.rank===u.qrank?(o=u.run(r._getPulse(u,t)),o.then?o=await o:o.async&&(a.push(o.async),o=Fr),i>=4&&r.debug(u.id,o===Fr?"STOP":o,u),o!==Fr&&u._targets&&u._targets.forEach(t=>r._enqueue(t)),++f):r._enqueue(u,!0)}catch(t){r._heap.clear(),l=t}if(r._input={},r._pulse=null,i>=3&&(s=Date.now()-s,r.info("> Pulse "+c+": "+f+" operators; "+s+"ms")),l&&(r._postrun=[],r.error(l)),r._postrun.length){const t=r._postrun.sort((t,e)=>e.priority-t.priority);r._postrun=[];for(let e=0;er.runAsync(null,()=>{t.forEach(t=>{try{t(r)}catch(t){r.error(t)}})})),r},jr.run=function(t,e,n){return this._pulse?qr(this):(this.evaluate(t,e,n),this)},jr.runAsync=async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},jr.runAfter=function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},jr._enqueue=function(t,e){var n=t.stampt.pulse),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==Fr&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)},jr.logger=function(t){return arguments.length?(this._log=t,this):this._log},jr.error=Ir("error"),jr.warn=Ir("warn"),jr.info=Ir("info"),jr.debug=Ir("debug"),jr.logLevel=Ir("level");var Wr=rt(Hr,jt);Wr.run=function(t){return t.stampthis.pulse=t):e!==t.StopPropagation&&(this.pulse=e),e);var e},Wr.evaluate=function(t){var e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},Wr.transform=function(){};var Yr={};function Vr(t){var e=Gr(t);return e&&e.Definition||null}function Gr(t){return t=t&&t.toLowerCase(),K(Yr,t)?Yr[t]:null}function Xr(t){return t&&t.length?1===t.length?t[0]:(e=t,function(t){for(var n=e.length,r=1,i=String(e[0](t));r 1 ? this.dev / (this.valid-1) : undefined",req:["mean"],idx:1}),variancep:ti({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : undefined",req:["variance"],idx:2}),stdev:ti({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined",req:["variance"],idx:2}),stdevp:ti({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined",req:["variance"],idx:2}),stderr:ti({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined",req:["variance"],idx:2}),distinct:ti({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:ti({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:ti({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:ti({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:ti({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:ti({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:ti({name:"argmin",init:"this.argmin = undefined;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = undefined;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:ti({name:"argmax",init:"this.argmax = undefined;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = undefined;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:ti({name:"min",init:"this.min = undefined;",add:"if (v < this.min || this.min === undefined) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (Number.isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:ti({name:"max",init:"this.max = undefined;",add:"if (v > this.max || this.max === undefined) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (Number.isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},Qr=Object.keys(Zr);function Kr(t,e){return Zr[t](e)}function ti(t){return function(e){var n=X({init:"",add:"",rem:"",idx:0},t);return n.out=e||t.name,n}}function ei(t,e){return t.idx-e.idx}function ni(t,e){var n=e||d,r=function(t,e){var n,r=t.reduce((function t(n,r){function i(e){n[e]||t(n,n[e]=Zr[e]())}return r.req&&r.req.forEach(i),e&&r.str&&r.str.forEach(i),n}),t.reduce((function(t,e){return t[e.name]=e,t}),{})),i=[];for(n in r)i.push(r[n]);return i.sort(ei)}(t,!0),i="var cell = this.cell; this.valid = 0; this.missing = 0;",a="this.cell = cell; this.init();",u="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",o="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return r.forEach((function(t){i+=t.init,u+=t.add,o+=t.rem})),t.slice().sort(ei).forEach((function(t){s+="t["+l(t.out)+"]="+t.set+";"})),s+="return t;",(a=Function("cell",a)).prototype.init=Function(i),a.prototype.add=Function("v","t",u),a.prototype.rem=Function("v","t",o),a.prototype.set=Function("t",s),a.prototype.get=n,a.fields=t.map((function(t){return t.out})),a}function*ri(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}function ii(t,e){return te?1:t>=e?0:NaN}function ai(t){var e;return 1===t.length&&(e=t,t=function(t,n){return ii(e(t),n)}),{left:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[a],n)<0?r=a+1:i=a}return r},right:function(e,n,r,i){for(null==r&&(r=0),null==i&&(i=e.length);r>>1;t(e[a],n)>0?i=a:r=a+1}return r}}}var ui=ai(ii),oi=ui.right,si=ui.left;function li(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r0)return[t];if((r=e0)for(t=Math.ceil(t/u),e=Math.floor(e/u),a=new Array(i=Math.ceil(e-t+1));++o=0?(a>=ci?10:a>=fi?5:a>=hi?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=ci?10:a>=fi?5:a>=hi?2:1)}function gi(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=ci?i*=10:a>=fi?i*=5:a>=hi&&(i*=2),e=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function vi(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function yi(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function _i(t){return null===t?NaN:+t}function xi(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return vi(t);if(e>=1)return mi(t);var r,i=(r-1)*e,a=Math.floor(i),u=mi(function t(e,n,r=0,i=e.length-1,a=ii){for(;i>r;){if(i-r>600){const u=i-r+1,o=n-r+1,s=Math.log(u),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(u-l)/u)*(o-u/2<0?-1:1);t(e,n,Math.max(r,Math.floor(n-o*l/u+c)),Math.min(i,Math.floor(n+(u-o)*l/u+c)),a)}const u=e[n];let o=r,s=i;for(yi(e,r,n),a(e[i],u)>0&&yi(e,r,i);o0;)--s}0===a(e[r],u)?yi(e,r,s):(++s,yi(e,s,i)),s<=n&&(r=s+1),n<=s&&(i=s-1)}return e}(t,a).subarray(0,a+1));return u+(vi(t.subarray(a+1))-u)*(i-a)}}function bi(t,e){return xi(t,.5,e)}function wi(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function Ai(t,e,n){var r=Float64Array.from(ri(t,n));return r.sort(ii),e.map(t=>function(t,e,n=_i){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,a=Math.floor(i),u=+n(t[a],a,t);return u+(+n(t[a+1],a+1,t)-u)*(i-a)}}(r,t))}function ki(t,e){return Ai(t,[.25,.5,.75],e)}function Mi(t,e){var n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,a=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,a+=n*(e-i));else{let u=-1;for(let o of t)null!=(o=e(o,++u,t))&&(o=+o)>=o&&(n=o-i,i+=n/++r,a+=n*(o-i))}if(r>1)return a/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=ki(t,e),a=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function Ei(t){var e,n,r,i,a,u,o,s,l=t.maxbins||20,c=t.base||10,f=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],g=t.span||p-d||Math.abs(d)||1;if(t.step)e=t.step;else if(t.steps){for(a=g/l,u=0,o=t.steps.length;ul;)e*=c;for(u=0,o=h.length;u=r&&g/a<=l&&(e=a)}return i=(a=Math.log(e))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(d=d<(a=Math.floor(d/e+s)*e)?a-e:a,p=Math.ceil(p/e)*e),{start:d,stop:p===d?d+e:p,step:e}}function Di(e,n,r,i){if(!e.length)return[void 0,void 0];var a,u,o,s,l=Float64Array.from(ri(e,i)),c=l.length,f=n;for(o=0,s=Array(f);ot);let i,a=0,u=1,o=t.length,s=new Float64Array(o),l=r(t[0]),c=l,f=l+e;for(;u=f){for(c=(l+c)/2;a>1);ru;)t[r--]=t[a]}a=u,u=n}return t}(s,e+e/4):s}t.random=Math.random;const Fi=Math.sqrt(2*Math.PI),Si=Math.SQRT2;let Bi=NaN;function zi(e,n){e=e||0,n=null==n?1:n;let r,i,a=0,u=0;if(Bi==Bi)a=Bi,Bi=NaN;else{do{a=2*t.random()-1,u=2*t.random()-1,r=a*a+u*u}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),a*=i,Bi=u*i}return e+a*n}function Ti(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*Fi)}function Ni(t,e,n){let r,i=(t-(e=e||0))/(n=null==n?1:n),a=Math.abs(i);if(a>37)r=0;else{let t,e=Math.exp(-a*a/2);a<7.07106781186547?(t=.0352624965998911*a+.700383064443688,t=t*a+6.37396220353165,t=t*a+33.912866078383,t=t*a+112.079291497871,t=t*a+221.213596169931,t=t*a+220.206867912376,r=e*t,t=.0883883476483184*a+1.75566716318264,t=t*a+16.064177579207,t=t*a+86.7807322029461,t=t*a+296.564248779674,t=t*a+637.333633378831,t=t*a+793.826512519948,t=t*a+440.413735824752,r/=t):(t=a+.65,t=a+4/t,t=a+3/t,t=a+2/t,t=a+1/t,r=e/t/2.506628274631)}return i>0?1-r:r}function Oi(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*Si*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function Ri(t,e){var n,r,i={mean:function(t){return arguments.length?(n=t||0,i):n},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>zi(n,r),pdf:t=>Ti(t,n,r),cdf:t=>Ni(t,n,r),icdf:t=>Oi(t,n,r)};return i.mean(t).stdev(e)}function qi(e,n){var r=Ri(),i={},a=0;return i.data=function(t){return arguments.length?(e=t,a=t?t.length:0,i.bandwidth(n)):e},i.bandwidth=function(t){return arguments.length?(!(n=t)&&e&&(n=Mi(e)),i):n},i.sample=function(){return e[~~(t.random()*a)]+n*r.sample()},i.pdf=function(t){for(var i=0,u=0;uUi(n,r),pdf:t=>Li(t,n,r),cdf:t=>Pi(t,n,r),icdf:t=>$i(t,n,r)};return i.mean(t).stdev(e)}function Ii(e,n){var r,i={},a=0;function u(t){var e,n=[],r=0;for(e=0;e=e&&t<=n?1/(n-e):0}function Yi(t,e,n){return null==n&&(n=null==e?1:e,e=0),tn?1:(t-e)/(n-e)}function Vi(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Gi(t,e){var n,r,i={min:function(t){return arguments.length?(n=t||0,i):n},max:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Hi(n,r),pdf:t=>Wi(t,n,r),cdf:t=>Yi(t,n,r),icdf:t=>Vi(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Xi(t,e,n,r){const i=r-t*t,a=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-a*t,a]}function Ji(t,e,n,r){t=t.filter(t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&t.sort((t,n)=>e(t)-e(n));const i=t.length,a=new Float64Array(i),u=new Float64Array(i);let o,s,l,c=0,f=0,h=0;for(l of t)a[c]=o=+e(l),u[c]=s=+n(l),++c,f+=(o-f)/c,h+=(s-h)/c;for(c=0;c=i&&null!=a&&(a=+a)>=a&&r(i,a,++u)}function Qi(t,e,n,r,i){let a=0,u=0;return Zi(t,e,n,(t,e)=>{const n=e-i(t),o=e-r;a+=n*n,u+=o*o}),1-a/u}function Ki(t,e,n){let r=0,i=0,a=0,u=0,o=0;Zi(t,e,n,(t,e)=>{++o,r+=(t-r)/o,i+=(e-i)/o,a+=(t*e-a)/o,u+=(t*t-u)/o});const s=Xi(r,i,a,u),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:Qi(t,e,n,i,l)}}function ta(t,e,n){let r=0,i=0,a=0,u=0,o=0;Zi(t,e,n,(t,e)=>{++o,t=Math.log(t),r+=(t-r)/o,i+=(e-i)/o,a+=(t*e-a)/o,u+=(t*t-u)/o});const s=Xi(r,i,a,u),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:Qi(t,e,n,i,l)}}function ea(t,e,n){const[r,i,a,u]=Ji(t,e,n);let o,s,l,c=0,f=0,h=0,d=0,p=0;Zi(t,e,n,(t,e)=>{o=r[p++],s=Math.log(e),l=o*e,c+=(e*s-c)/p,f+=(l-f)/p,h+=(l*s-h)/p,d+=(o*l-d)/p});const[g,m]=Xi(f/u,c/u,h/u,d/u),v=t=>Math.exp(g+m*(t-a));return{coef:[Math.exp(g-m*a),m],predict:v,rSquared:Qi(t,e,n,u,v)}}function na(t,e,n){let r=0,i=0,a=0,u=0,o=0,s=0;Zi(t,e,n,(t,e)=>{const n=Math.log(t),l=Math.log(e);++s,r+=(n-r)/s,i+=(l-i)/s,a+=(n*l-a)/s,u+=(n*n-u)/s,o+=(e-o)/s});const l=Xi(r,i,a,u),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Qi(t,e,n,o,c)}}function ra(t,e,n){const[r,i,a,u]=Ji(t,e,n),o=r.length;let s,l,c,f,h=0,d=0,p=0,g=0,m=0;for(s=0;s_*(t-=a)*t+x*t+b+u;return{coef:[b-x*a+_*a*a+u,x-2*_*a,_],predict:w,rSquared:Qi(t,e,n,u,w)}}function ia(t,e,n,r){if(1===r)return Ki(t,e,n);if(2===r)return ra(t,e,n);const[i,a,u,o]=Ji(t,e,n),s=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;hMath.abs(t[r][u])&&(u=i);for(a=r;a=r;a--)t[a][i]-=t[a][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(o=0,a=i+1;a{t-=u;let e=o+v[0]+v[1]*t+v[2]*t*t;for(h=3;h=0;--a)for(o=e[a],s=1,i[a]+=o,u=1;u<=a;++u)s*=(a+1-u)/u,i[a-u]+=o*Math.pow(n,u)*s;return i[0]+=r,i}function ua(t,e,n,r){const[i,a,u,o]=Ji(t,e,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;ti[u]-n?r:u;let s=0,l=0,d=0,p=0,g=0,m=1/Math.abs(i[o]-n||1);for(let t=r;t<=u;++t){const e=i[t],r=a[t],u=oa(Math.abs(n-e)*m)*h[t],o=e*u;s+=u,l+=o,d+=r*u,p+=r*o,g+=e*o}const[v,y]=Xi(l/s,d/s,p/s,g/s);c[t]=v+y*n,f[t]=Math.abs(a[t]-c[t]),sa(i,t+1,e)}if(2===t)break;const n=bi(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,a=[];let u,o=0,s=0,l=[];for(;o=t.length))for(;e>i&&t[a]-r<=r-t[i];)n[0]=++i,n[1]=a,++a}const la=.1*Math.PI/180;function ca(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],a=e[0],u=e[1],o=u-a,s=o/r,l=[i(a)],c=[];if(n===r){for(let t=1;t0;)c.push(i(a+t/n*o));let f=l[0],h=c[c.length-1];for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&fa(f,t,h)>la?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function fa(t,e,n){const r=Math.atan2(n[1]-t[1],n[0]-t[0]),i=Math.atan2(e[1]-t[1],e[0]-t[0]);return Math.abs(r-i)}function ha(t){this._key=t?c(t):Ct,this.reset()}var da=ha.prototype;function pa(t){Hr.call(this,null,t),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}da.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},da.add=function(t){this._add.push(t)},da.rem=function(t){this._rem.push(t)},da.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,n,r=this._add,i=this._rem,a=this._key,u=r.length,o=i.length,s=Array(u-o),l={};for(t=0;t=0;)K(i,e=t(n[r])+"")||(i[e]=1,++a);return a},da.extent=function(t){if(this._get!==t||!this._ext){var e=this.values(),n=Z(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},da.argmin=function(t){return this.extent(t)[0]||{}},da.argmax=function(t){return this.extent(t)[1]||{}},da.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):void 0},da.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):void 0},da.quartile=function(t){return this._get===t&&this._q||(this._q=ki(this.values(),t),this._get=t),this._q},da.q1=function(t){return this.quartile(t)[0]},da.q2=function(t){return this.quartile(t)[1]},da.q3=function(t){return this.quartile(t)[2]},da.ci=function(t){return this._get===t&&this._ci||(this._ci=Di(this.values(),1e3,.05,t),this._get=t),this._ci},da.ci0=function(t){return this.ci(t)[0]},da.ci1=function(t){return this.ci(t)[1]},pa.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Qr},{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"}]};var ga=rt(pa,Hr);ga.transform=function(t,e){var n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):{},e.visit(e.SOURCE,t=>n.add(t))):(n.value=n.value||n.init(t),e.visit(e.REM,t=>n.rem(t)),e.visit(e.ADD,t=>n.add(t))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),n.changes(r)},ga.cross=function(){var t=this,e=t.value,n=t._dnames,r=n.map((function(){return{}})),i=n.length;function a(t){var e,a,u,o;for(e in t)for(u=t[e].tuple,a=0;ac?1/0:(e=Math.max(l,Math.min(+e,c-s)),l+s*Math.floor(1e-14+(e-l)/s))};return f.start=l,f.stop=o.stop,f.step=s,this.value=e(f,r(u),t.name||"bin_"+n(u))},_a.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},rt(_a,Hr).transform=function(t,e){var n=e.fork(e.ALL),r=ya(Ct,this.value,n.materialize(n.ADD).add),i=t.sort,a=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(Nt(i),a),e.source&&e.source.root&&(this.value.root=e.source.root),n},rt(xa,jt),wa.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"]}]};var Aa=rt(wa,Hr);function ka(t){Hr.call(this,null,t)}Aa.transform=function(t,e){function n(e){return function(n){for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(o(n),t.case,a)||[],s=0,l=i.length;s{var e={};return e[s[0]]=t[0],e[s[1]]=t[1],St(e)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n};function Ba(t){Hr.call(this,null,t)}function za(t){jt.call(this,null,Ta,t),this.modified(!0)}function Ta(t){var i=t.expr;return this.value&&!t.modified("expr")?this.value:e(e=>i(e,t),r(i),n(i))}function Na(t){Hr.call(this,[void 0,void 0],t)}function Oa(t,e){jt.call(this,t),this.parent=e}Ba.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:"bin"}]},rt(Ba,Hr).transform=function(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=Sa(e.source,t.groupby,d),i=t.smooth||!1,a=t.field,u=t.step||function(t,e){return gt(J(t,e))/30}(n,a),o=Nt((t,e)=>a(t)-a(e)),s=t.as||"bin",l=r.length;let c,f=1/0,h=-1/0,p=0;for(;ph&&(h=e),t[++c][s]=e}return this.value={start:f,stop:h,step:u},e.reflow(!0).modifies(s)},rt(za,jt),Na.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},rt(Na,Hr).transform=function(t,e){var r,i=this.value,a=t.field,u=i[0],o=i[1];if(((r=e.changed()||e.modified(a.fields)||t.modified("field"))||null==u)&&(u=1/0,o=-1/0),e.visit(r?e.SOURCE:e.ADD,(function(t){var e=a(t);null!=e&&((e=+e)o&&(o=e))})),!Number.isFinite(u)||!Number.isFinite(o)){let t=n(a);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${u}, ${o}]`),u=o=void 0}this.value=[u,o]};var Ra=rt(Oa,jt);function qa(t){Hr.call(this,{},t),this._keys=et();var e=this._targets=[];e.active=0,e.forEach=function(t){for(var n=0,r=e.active;nn.cleanThreshold&&n.runAfter(u.clean),e},rt(La,jt),$a.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},rt($a,Hr).transform=function(t,e){var n=e.dataflow,r=this.value,i=e.fork(),a=i.add,u=i.rem,o=i.mod,s=t.expr,l=!0;function c(e){var n=Ct(e),i=s(e,t),c=r.get(n);i&&c?(r.delete(n),a.push(e)):i||c?l&&i&&!c&&o.push(e):(r.set(n,1),u.push(e))}return e.visit(e.REM,(function(t){var e=Ct(t);r.has(e)?r.delete(e):u.push(t)})),e.visit(e.ADD,(function(e){s(e,t)?a.push(e):r.set(Ct(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i},ja.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}]},rt(ja,Hr).transform=function(t,e){var n=e.fork(e.NO_SOURCE),r=t.fields,i=Fa(r,t.as||[]),a=t.index||null,u=i.length;return n.rem=this.value,e.visit(e.SOURCE,(function(t){for(var e,o,s,l=r.map(e=>e(t)),c=l.reduce((t,e)=>Math.max(t,e.length),0),f=0;fe[r]=n(e,t))},rt(Wa,Hr).transform=function(t,e){var n,r,i,a=this.value,u=e.fork(e.ALL),o=t.size-a.length,s=t.generator;if(o>0){for(n=[];--o>=0;)n.push(i=St(s(t))),a.push(i);u.add=u.add.length?u.materialize(u.ADD).add.concat(n):n}else r=a.slice(0,-o),u.rem=u.rem.length?u.materialize(u.REM).rem.concat(r):r,a=a.slice(-o);return u.source=this.value=a,u};var Ya={value:"value",median:bi,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let a of t)null!=(a=e(a,++i,t))&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n},min:vi,max:mi},Va=[];function Ga(t){Hr.call(this,[],t)}function Xa(t){pa.call(this,t)}Ga.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}]},rt(Ga,Hr).transform=function(t,e){var r,a,u,o,s,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||Ya.value;if(null!=Ya[n])return n===Ya.value?(e=void 0!==t.value?t.value:0,function(){return e}):Ya[n];i("Unrecognized imputation method: "+n)}(t),m=function(t){var e=t.field;return function(t){return t?e(t):NaN}}(t),v=n(t.field),y=n(t.key),_=(t.groupby||[]).map(n),x=function(t,e,n,r){var i,a,u,o,s,l,c,f,h=function(t){return t(f)},d=[],p=r?r.slice():[],g={},m={};for(p.forEach((function(t,e){g[t]=e+1})),o=0,c=t.length;oa&&(a=r[1]);return[i,a]}function au(t){jt.call(this,null,uu,t)}function uu(t){return this.value&&!t.modified()?this.value:t.values.reduce((function(t,e){return t.concat(e)}),[])}function ou(t){Hr.call(this,null,t)}function su(t){pa.call(this,t)}Ja.transform=function(t,e){var n,r=this,i=t.modified();return r.value&&(i||e.modified(r._inputs,!0))?(n=r.value=i?r.init(t):{},e.visit(e.SOURCE,(function(t){r.add(t)}))):(n=r.value=r.value||this.init(t),e.visit(e.REM,(function(t){r.rem(t)})),e.visit(e.ADD,(function(t){r.add(t)}))),r.changes(),e.visit(e.SOURCE,(function(t){X(t,n[r.cellkey(t)].tuple)})),e.reflow(i).modifies(this._outputs)},Ja.changes=function(){var t,e,n=this._adds,r=this._mods;for(t=0,e=this._alen;t{const n=qi(e,s)[l],r=t.counts?e.length:1;ca(n,h||J(e),d,p).forEach(t=>{const n={};for(let t=0;t(this._pending=I(t.data),t=>t.touch(this)))}}return n.request(t.url,t.format).then(t=>eu(this,e,I(t.data)))},nu.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}]},rt(nu,Hr).transform=function(t,e){var r,a,u=e,o=t.as,s=t.fields,l=t.index,c=t.values,f=null==t.default?null:t.default,h=t.modified(),d=h?e.SOURCE:e.ADD,p=s.length;return c?(a=c.length,p>1&&!o&&i('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==p*a&&i('The "as" parameter has too few output field names.'),o=o||c.map(n),r=function(t){for(var e,n,r=0,i=0;re||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0)})),e?i.slice(0,e):i}(i,t.limit||0,n);n.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:s.map((function(){return u})),fields:s.map((function(t){return function(t,n,r,i){return e((function(e){return n(e)===t?r(e):NaN}),i,t+"")}(t,i,a,o)})),as:s.map((function(t){return t+""})),modified:t.modified.bind(t)}}(t,n),n)},rt(cu,qa).transform=function(t,e){var n=this,a=t.subflow,u=t.field;return(t.modified("field")||u&&e.modified(r(u)))&&i("PreFacet does not support field modification."),this._targets.active=0,e.visit(e.MOD,(function(t){var r=n.subflow(Ct(t),a,e,t);u?u(t).forEach((function(t){r.mod(t)})):r.mod(t)})),e.visit(e.ADD,(function(t){var r=n.subflow(Ct(t),a,e,t);u?u(t).forEach((function(t){r.add(St(t))})):r.add(t)})),e.visit(e.REM,(function(t){var r=n.subflow(Ct(t),a,e,t);u?u(t).forEach((function(t){r.rem(t)})):r.rem(t)})),e},fu.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},rt(fu,Hr).transform=function(t,e){var n,r,i=t.fields,a=Fa(t.fields,t.as||[]),u=i?function(t,e){return function(t,e,n,r){for(var i=0,a=n.length;i{const e=Ai(t,l);for(let n=0;n{var e=Ct(t);n.rem.push(r[e]),r[e]=null}),e.visit(e.ADD,t=>{var e=Bt(t);r[Ct(t)]=e,n.add.push(e)}),e.visit(e.MOD,t=>{var e,i=r[Ct(t)];for(e in t)i[e]=t[e],n.modifies(e);n.mod.push(i)})),n},mu.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},rt(mu,Hr).transform=function(e,n){var r=n.fork(n.NO_SOURCE),i=e.modified("size"),a=e.size,u=this.value,o=this.count,s=0,l=u.reduce((function(t,e){return t[Ct(e)]=1,t}),{});function c(e){var n,i;u.length=s&&(n=u[i],l[Ct(n)]&&r.rem.push(n),u[i]=e),++o}if(n.rem.length&&(n.visit(n.REM,(function(t){var e=Ct(t);l[e]&&(l[e]=-1,r.rem.push(t)),--o})),u=u.filter((function(t){return-1!==l[Ct(t)]}))),(n.rem.length||i)&&u.lengtha){for(var f=0,h=u.length-a;f(t[e]=1+n,t),{});function Su(t){const e=I(t).slice(),n={};return e.length||i("Missing time unit."),e.forEach(t=>{K(Fu,t)?n[t]=1:i(`Invalid time unit: ${t}.`)}),(n[wu]||n[ku])&&(n[xu]||n[bu]||n[Au])&&i(`Incompatible time units: ${t}`),e.sort((t,e)=>Fu[t]-Fu[e]),e}const Bu=new Date;function zu(t,e,n,r,i){const a=e||1,u=k(t),o=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===u&&a,e),s=new Date,l=xt(t),c=l[_u]?o(_u):V(2012),f=l[bu]?o(bu):l[xu]?o(xu):p,h=l[wu]&&l[ku]?o(ku,1,wu+ku):l[wu]?o(wu,1):l[ku]?o(ku,1):l[Au]?o(Au,1):g,d=l[Mu]?o(Mu):p,m=l[Eu]?o(Eu):p,v=l[Du]?o(Du):p,y=l[Cu]?o(Cu):p;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),h(s,e),d(s),m(s),v(s),y(s))}}function Tu(t,e,n){return e+7*t-(n+6)%7}const Nu={[_u]:t=>t.getFullYear(),[xu]:t=>Math.floor(t.getMonth()/3),[bu]:t=>t.getMonth(),[Au]:t=>t.getDate(),[Mu]:t=>t.getHours(),[Eu]:t=>t.getMinutes(),[Du]:t=>t.getSeconds(),[Cu]:t=>t.getMilliseconds(),[wu]:t=>qu(t),[wu+ku]:(t,e)=>Tu(qu(t),t.getDay(),Uu(e)),[ku]:(t,e)=>Tu(1,t.getDay(),Uu(e))},Ou={[xu]:t=>3*t,[wu]:(t,e)=>Tu(t,0,Uu(e))};function Ru(t){return Bu.setFullYear(t),Bu.setMonth(0),Bu.setDate(1),Bu.setHours(0,0,0,0),Bu}function qu(t){return je.count(Ru(t.getFullYear())-1,t)}function Uu(t){return Ru(t).getDay()}function Lu(t,e,n,r,i,a,u){if(0<=t&&t<100){var o=new Date(-1,e,n,r,i,a,u);return o.setFullYear(t),o}return new Date(t,e,n,r,i,a,u)}function Pu(t,e){return zu(t,e||1,Nu,Ou,Lu)}const $u={[_u]:t=>t.getUTCFullYear(),[xu]:t=>Math.floor(t.getUTCMonth()/3),[bu]:t=>t.getUTCMonth(),[Au]:t=>t.getUTCDate(),[Mu]:t=>t.getUTCHours(),[Eu]:t=>t.getUTCMinutes(),[Du]:t=>t.getUTCSeconds(),[Cu]:t=>t.getUTCMilliseconds(),[wu]:t=>Iu(t),[ku]:(t,e)=>Tu(1,t.getUTCDay(),Hu(e)),[wu+ku]:(t,e)=>Tu(Iu(t),t.getUTCDay(),Hu(e))},ju={[xu]:t=>3*t,[wu]:(t,e)=>Tu(t,0,Hu(e))};function Iu(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Ze.count(e-1,t)}function Hu(t){return Bu.setTime(Date.UTC(t,0,1)),Bu.getUTCDay()}function Wu(t,e,n,r,i,a,u){if(0<=t&&t<100){var o=new Date(Date.UTC(-1,e,n,r,i,a,u));return o.setUTCFullYear(n.y),o}return new Date(Date.UTC(t,e,n,r,i,a,u))}function Yu(t,e){return zu(t,e||1,$u,ju,Wu)}const Vu={[_u]:Ye,[xu]:We.every(3),[bu]:We,[wu]:je,[Au]:Pe,[ku]:Pe,[Mu]:Le,[Eu]:Ue,[Du]:qe,[Cu]:Re},Gu={[_u]:en,[xu]:tn.every(3),[bu]:tn,[wu]:Ze,[Au]:Xe,[ku]:Xe,[Mu]:Ge,[Eu]:Ve,[Du]:qe,[Cu]:Re};function Xu(t){return Vu[t]}function Ju(t){return Gu[t]}function Zu(t,e,n){return t?t.offset(e,n):void 0}function Qu(t,e,n){return Zu(Xu(t),e,n)}function Ku(t,e,n){return Zu(Ju(t),e,n)}function to(t,e,n,r){return t?t.range(e,n,r):void 0}function eo(t,e,n,r){return to(Xu(t),e,n,r)}function no(t,e,n,r){return to(Ju(t),e,n,r)}const ro={[_u]:"%Y ",[xu]:"Q%q ",[bu]:"%b ",[Au]:"%d ",[wu]:"W%U ",[ku]:"%a ",[Mu]:"%H:00",[Eu]:"00:%M",[Du]:":%S",[Cu]:".%L",[`${_u}-${bu}`]:"%Y-%m ",[`${_u}-${bu}-${Au}`]:"%Y-%m-%d ",[`${Mu}-${Eu}`]:"%H:%M"};function io(t,e){const n=X({},ro,e),r=Su(t),i=r.length;let a,u,o="",s=0;for(s=0;ss;--a)if(u=r.slice(s,a).join("-"),null!=n[u]){o+=n[u],s=a;break}return o.trim()}function ao(t){return oo(on,Xu,t)}function uo(t){return oo(ln,Ju,t)}function oo(t,e,n){return s(n)?t(n):function(t,e,n){o(n=n||{})||i(`Invalid time multi-format specifier: ${n}`);const r=e(Du),a=e(Eu),u=e(Mu),s=e(Au),l=e(wu),c=e(bu),f=e(xu),h=e(_u),d=t(n[Cu]||".%L"),p=t(n[Du]||":%S"),g=t(n[Eu]||"%I:%M"),m=t(n[Mu]||"%I %p"),v=t(n[Au]||n[ku]||"%a %d"),y=t(n[wu]||"%b %d"),_=t(n[bu]||"%B"),x=t(n[xu]||"%B"),b=t(n[_u]||"%Y");return function(t){return(r(t)t[2]).right(mo,r);return u===mo.length?(i=go,a=gi(e[0]/31536e6,e[1]/31536e6,n)):u?(u=mo[r/mo[u-1][2]h&&(h=r))})),u.start=f,u.stop=h,e.modifies(i?s:l)},xo._floor=function(t,e){const n="utc"===t.timezone;let{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:vo({extent:t.extent||J(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins});r=Su(r);const a=this.value||{},u=(n?Yu:Pu)(r,i);return u.unit=k(r),u.units=r,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u},rt(bo,Hr).transform=function(t,e){var n=e.dataflow,r=t.field,i=this.value,a=!0;function u(t){i.set(r(t),t)}return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,u)):e.changed()?(e.visit(e.REM,(function(t){i.delete(r(t))})),e.visit(e.ADD,u)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()},rt(wo,Hr).transform=function(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(Nt(t.sort)):e.source).map(t.field))};const Ao={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{let n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){let t=Ao.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{let n=e.index,r=e.data,i=e.compare;if(t0||i("ntile num must be greater than zero.");let n=Ao.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{let r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{let r=n.index+e,i=n.data;return rt(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||i("nth_value nth must be greater than zero."),{next:n=>{let r=n.i0+(e-1);return re=null,next:n=>{let r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{let i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;nf[t]=1)}v(t.sort),a.forEach((function(t,e){let r=u[e],a=n(r),f=Jr(t,a,s[e]);if(v(r),l.push(f),K(Ao,t))c.push(function(t,e,n,r){let i=Ao[t](e,n);return{init:i.init||p,update:function(t,e){e[r]=i.next(t)}}}(t,u[e],o[e],f));else{if(null==r&&"count"!==t&&i("Null aggregate field specified."),"count"===t)return void g.push(f);d=!1;let e=h[a];e||(e=h[a]=[],e.field=r,m.push(e)),e.push(Kr(t,f))}})),(g.length||m.length)&&(e.cell=function(t,e,n){t=t.map(t=>ni(t,t.field));let r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,a=r.agg=Array(i),u=0;ut.init()),this.cell&&this.cell.init()},Eo.update=function(t,e){let n,r=this.cell,i=this.windows,a=t.data,u=i&&i.length;if(r){for(n=t.p0;n0&&!i(a[n],a[n-1])&&(t.i0=e.left(a,a[n])),rthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},Lo.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},Lo.round=function(){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},Lo.scale=function(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},Lo.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},Lo.rotate=function(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},Lo.rotatedPoints=function(t,e,n){var{x1:r,y1:i,x2:a,y2:u}=this,o=Math.cos(t),s=Math.sin(t),l=e-e*o+n*s,c=n-e*s-n*o;return[o*r-s*i+l,s*r+o*i+c,o*r-s*u+l,s*r+o*u+c,o*a-s*i+l,s*a+o*i+c,o*a-s*u+l,s*a+o*u+c]},Lo.union=function(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},Lo.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},Lo.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},Lo.intersects=function(t){return t&&!(this.x2t.x2||this.y2t.y2)},Lo.contains=function(t,e){return!(tthis.x2||ethis.y2)},Lo.width=function(){return this.x2-this.x1},Lo.height=function(){return this.y2-this.y1};var Po=0;function $o(t){return t&&t.gradient}function jo(t,e,n){let r=t.id,i=t.gradient,a="radial"===i?"p_":"";return r||(r=t.id="gradient_"+Po++,"radial"===i?(t.x1=Io(t.x1,.5),t.y1=Io(t.y1,.5),t.r1=Io(t.r1,0),t.x2=Io(t.x2,.5),t.y2=Io(t.y2,.5),t.r2=Io(t.r2,.5),a="p_"):(t.x1=Io(t.x1,0),t.y1=Io(t.y1,0),t.x2=Io(t.x2,1),t.y2=Io(t.y2,0))),e[r]=t,"url("+(n||"")+"#"+a+r+")"}function Io(t,e){return null!=t?t:e}function Ho(t,e){var n,r=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}}function Wo(t){this.mark=t,this.bounds=this.bounds||new Uo}function Yo(t){Wo.call(this,t),this.items=this.items||[]}function Vo(t,e){if("undefined"!=typeof document&&document.createElement){var n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}function Go(){return"undefined"!=typeof Image?Image:null}function Xo(t){this._pending=0,this._loader=t||kr()}rt(Yo,Wo);var Jo=Xo.prototype;function Zo(t){t._pending+=1}function Qo(t){t._pending-=1}Jo.pending=function(){return this._pending},Jo.sanitizeURL=function(t){var e=this;return Zo(e),e._loader.sanitize(t,{context:"href"}).then((function(t){return Qo(e),t})).catch((function(){return Qo(e),null}))},Jo.loadImage=function(t){const e=this,n=Go();return Zo(e),e._loader.sanitize(t,{context:"image"}).then((function(t){const r=t.href;if(!r||!n)throw{url:r};const i=new n,a=K(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=a&&(i.crossOrigin=a),i.onload=()=>Qo(e),i.onerror=()=>Qo(e),i.src=r,i})).catch((function(t){return Qo(e),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},Jo.ready=function(){var t=this;return new Promise((function(e){!function n(r){t.pending()?setTimeout((function(){n(!0)}),10):e(r)}(!1)}))};var Ko=Math.PI,ts=2*Ko,es=ts-1e-6;function ns(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function rs(){return new ns}function is(t){return function(){return t}}ns.prototype=rs.prototype={constructor:ns,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var a=this._x1,u=this._y1,o=n-t,s=r-e,l=a-t,c=u-e,f=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>1e-6)if(Math.abs(c*o-s*l)>1e-6&&i){var h=n-a,d=r-u,p=o*o+s*s,g=h*h+d*d,m=Math.sqrt(p),v=Math.sqrt(f),y=i*Math.tan((Ko-Math.acos((p+f-g)/(2*m*v)))/2),_=y/v,x=y/m;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*l)+","+(e+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*o)+","+(this._y1=e+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,a){t=+t,e=+e,a=!!a;var u=(n=+n)*Math.cos(r),o=n*Math.sin(r),s=t+u,l=e+o,c=1^a,f=a?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%ts+ts),f>es?this._+="A"+n+","+n+",0,1,"+c+","+(t-u)+","+(e-o)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=Ko)+","+c+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var as=Math.abs,us=Math.atan2,os=Math.cos,ss=Math.max,ls=Math.min,cs=Math.sin,fs=Math.sqrt,hs=Math.PI,ds=hs/2,ps=2*hs;function gs(t){return t>1?0:t<-1?hs:Math.acos(t)}function ms(t){return t>=1?ds:t<=-1?-ds:Math.asin(t)}function vs(t){return t.innerRadius}function ys(t){return t.outerRadius}function _s(t){return t.startAngle}function xs(t){return t.endAngle}function bs(t){return t&&t.padAngle}function ws(t,e,n,r,i,a,u,o){var s=n-t,l=r-e,c=u-i,f=o-a,h=f*s-c*l;if(!(h*h<1e-12))return[t+(h=(c*(e-a)-f*(t-i))/h)*s,e+h*l]}function As(t,e,n,r,i,a,u){var o=t-n,s=e-r,l=(u?a:-a)/fs(o*o+s*s),c=l*s,f=-l*o,h=t+c,d=e+f,p=n+c,g=r+f,m=(h+p)/2,v=(d+g)/2,y=p-h,_=g-d,x=y*y+_*_,b=i-a,w=h*g-p*d,A=(_<0?-1:1)*fs(ss(0,b*b*x-w*w)),k=(w*_-y*A)/x,M=(-w*y-_*A)/x,E=(w*_+y*A)/x,D=(-w*y+_*A)/x,C=k-m,F=M-v,S=E-m,B=D-v;return C*C+F*F>S*S+B*B&&(k=E,M=D),{cx:k,cy:M,x01:-c,y01:-f,x11:k*(i/b-1),y11:M*(i/b-1)}}function ks(t){this._context=t}function Ms(t){return new ks(t)}function Es(t){return t[0]}function Ds(t){return t[1]}function Cs(){var t=Es,e=Ds,n=is(!0),r=null,i=Ms,a=null;function u(u){var o,s,l,c=u.length,f=!1;for(null==r&&(a=i(l=rs())),o=0;o<=c;++o)!(o=c;--f)o.point(m[f],v[f]);o.lineEnd(),o.areaEnd()}g&&(m[l]=+t(h,l,s),v[l]=+n(h,l,s),o.point(e?+e(h,l,s):m[l],r?+r(h,l,s):v[l]))}if(d)return o=null,d+""||null}function l(){return Cs().defined(i).curve(u).context(a)}return s.x=function(n){return arguments.length?(t="function"==typeof n?n:is(+n),e=null,s):t},s.x0=function(e){return arguments.length?(t="function"==typeof e?e:is(+e),s):t},s.x1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:is(+t),s):e},s.y=function(t){return arguments.length?(n="function"==typeof t?t:is(+t),r=null,s):n},s.y0=function(t){return arguments.length?(n="function"==typeof t?t:is(+t),s):n},s.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:is(+t),s):r},s.lineX0=s.lineY0=function(){return l().x(t).y(n)},s.lineY1=function(){return l().x(t).y(r)},s.lineX1=function(){return l().x(e).y(n)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:is(!!t),s):i},s.curve=function(t){return arguments.length?(u=t,null!=a&&(o=u(a)),s):u},s.context=function(t){return arguments.length?(null==t?a=o=null:o=u(a=t),s):a},s}ks.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Ss={draw:function(t,e){var n=Math.sqrt(e/hs);t.moveTo(n,0),t.arc(0,0,n,0,ps)}};function Bs(){}function zs(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Ts(t){this._context=t}function Ns(t){this._context=t}function Os(t){this._context=t}function Rs(t,e){this._basis=new Ts(t),this._beta=e}Ts.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:zs(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:zs(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Ns.prototype={areaStart:Bs,areaEnd:Bs,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:zs(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Os.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:zs(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Rs.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],a=e[0],u=t[n]-i,o=e[n]-a,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*u),this._beta*e[s]+(1-this._beta)*(a+r*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var qs=function t(e){function n(t){return 1===e?new Ts(t):new Rs(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Us(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Ls(t,e){this._context=t,this._k=(1-e)/6}Ls.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Us(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ps=function t(e){function n(t){return new Ls(t,e)}return n.tension=function(e){return t(+e)},n}(0);function $s(t,e){this._context=t,this._k=(1-e)/6}$s.prototype={areaStart:Bs,areaEnd:Bs,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var js=function t(e){function n(t){return new $s(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Is(t,e){this._context=t,this._k=(1-e)/6}Is.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Us(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Hs=function t(e){function n(t){return new Is(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ws(t,e,n){var r=t._x1,i=t._y1,a=t._x2,u=t._y2;if(t._l01_a>1e-12){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>1e-12){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*l+t._x1*t._l23_2a-e*t._l12_2a)/c,u=(u*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,a,u,t._x2,t._y2)}function Ys(t,e){this._context=t,this._alpha=e}Ys.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Ws(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Vs=function t(e){function n(t){return e?new Ys(t,e):new Ls(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Gs(t,e){this._context=t,this._alpha=e}Gs.prototype={areaStart:Bs,areaEnd:Bs,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Ws(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Xs=function t(e){function n(t){return e?new Gs(t,e):new $s(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Js(t,e){this._context=t,this._alpha=e}Js.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ws(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Zs=function t(e){function n(t){return e?new Js(t,e):new Is(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Qs(t){this._context=t}function Ks(t){return t<0?-1:1}function tl(t,e,n){var r=t._x1-t._x0,i=e-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),u=(n-t._y1)/(i||r<0&&-0),o=(a*i+u*r)/(r+i);return(Ks(a)+Ks(u))*Math.min(Math.abs(a),Math.abs(u),.5*Math.abs(o))||0}function el(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function nl(t,e,n){var r=t._x0,i=t._y0,a=t._x1,u=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*e,a-o,u-o*n,a,u)}function rl(t){this._context=t}function il(t){this._context=new al(t)}function al(t){this._context=t}function ul(t){this._context=t}function ol(t){var e,n,r=t.length-1,i=new Array(r),a=new Array(r),u=new Array(r);for(i[0]=0,a[0]=2,u[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(u[e]-i[e+1])/a[e];for(a[r-1]=(t[r]+i[r-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var ll={basis:{curve:function(t){return new Ts(t)}},"basis-closed":{curve:function(t){return new Ns(t)}},"basis-open":{curve:function(t){return new Os(t)}},bundle:{curve:qs,tension:"beta",value:.85},cardinal:{curve:Ps,tension:"tension",value:0},"cardinal-open":{curve:Hs,tension:"tension",value:0},"cardinal-closed":{curve:js,tension:"tension",value:0},"catmull-rom":{curve:Vs,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Xs,tension:"alpha",value:.5},"catmull-rom-open":{curve:Zs,tension:"alpha",value:.5},linear:{curve:Ms},"linear-closed":{curve:function(t){return new Qs(t)}},monotone:{horizontal:function(t){return new il(t)},vertical:function(t){return new rl(t)}},natural:{curve:function(t){return new ul(t)}},step:{curve:function(t){return new sl(t,.5)}},"step-after":{curve:function(t){return new sl(t,1)}},"step-before":{curve:function(t){return new sl(t,0)}}};function cl(t,e,n){var r=K(ll,t)&&ll[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}var fl={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},hl=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function dl(t){var e,n,r,i,a,u,o,s,l,c,f,h=[];for(s=0,c=(e=t.slice().replace(hl[0],"###$1").split(hl[1]).slice(1)).length;so)for(l=1,f=i.length;l1&&(n*=g=Math.sqrt(g),r*=g);var m=h/n,v=f/n,y=-f/r,_=h/r,x=m*o+v*s,b=y*o+_*s,w=m*t+v*e,A=y*t+_*e,k=(w-x)*(w-x)+(A-b)*(A-b),M=1/k-.25;M<0&&(M=0);var E=Math.sqrt(M);a==i&&(E=-E);var D=.5*(x+w)-E*(A-b),C=.5*(b+A)+E*(w-x),F=Math.atan2(b-C,x-D),S=Math.atan2(A-C,w-D),B=S-F;B<0&&1===a?B+=ml:B>0&&0===a&&(B-=ml);for(var z=Math.ceil(Math.abs(B/(gl+.001))),T=[],N=0;N+t}function Rl(t,e,n){return Math.max(e,Math.min(t,n))}function ql(){var t=Bl,e=zl,n=Tl,r=Nl,i=Ol(0),a=i,u=i,o=i,s=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+e.call(this,l),g=+n.call(this,l),m=+r.call(this,l),v=Math.min(g,m)/2,y=Rl(+i.call(this,l),0,v),_=Rl(+a.call(this,l),0,v),x=Rl(+u.call(this,l),0,v),b=Rl(+o.call(this,l),0,v);if(s||(s=h=rs()),y<=0&&_<=0&&x<=0&&b<=0)s.rect(d,p,g,m);else{var w=d+g,A=p+m;s.moveTo(d+y,p),s.lineTo(w-_,p),s.bezierCurveTo(w-Sl*_,p,w,p+Sl*_,w,p+_),s.lineTo(w,A-b),s.bezierCurveTo(w,A-Sl*b,w-Sl*b,A,w-b,A),s.lineTo(d+x,A),s.bezierCurveTo(d+Sl*x,A,d,A-Sl*x,d,A-x),s.lineTo(d,p+y),s.bezierCurveTo(d,p+Sl*y,d+Sl*y,p,d+y,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(e){return arguments.length?(t=Ol(e),l):t},l.y=function(t){return arguments.length?(e=Ol(t),l):e},l.width=function(t){return arguments.length?(n=Ol(t),l):n},l.height=function(t){return arguments.length?(r=Ol(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Ol(t),a=null!=e?Ol(e):i,o=null!=n?Ol(n):i,u=null!=r?Ol(r):a,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Ul(){var t,e,n,r,i,a,u,o,s=null;function l(t,e,n){var r=n/2;if(i){var l=u-e,c=t-a;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*o,d=(c/=f)*o,p=Math.atan2(c,l);s.moveTo(a-h,u-d),s.lineTo(t-l*r,e-c*r),s.arc(t,e,r,p-Math.PI,p),s.lineTo(a+h,u+d),s.arc(a,u,o,p,p+Math.PI)}else s.arc(t,e,r,0,ml);s.closePath()}else i=1;a=t,u=e,o=r}function c(a){var u,o,c,f=a.length,h=!1;for(null==s&&(s=c=rs()),u=0;u<=f;++u)!(ut.x||0,$l=t=>t.y||0,jl=t=>!(!1===t.defined),Il=function(){var t=vs,e=ys,n=is(0),r=null,i=_s,a=xs,u=bs,o=null;function s(){var s,l,c=+t.apply(this,arguments),f=+e.apply(this,arguments),h=i.apply(this,arguments)-ds,d=a.apply(this,arguments)-ds,p=as(d-h),g=d>h;if(o||(o=s=rs()),f1e-12)if(p>ps-1e-12)o.moveTo(f*os(h),f*cs(h)),o.arc(0,0,f,h,d,!g),c>1e-12&&(o.moveTo(c*os(d),c*cs(d)),o.arc(0,0,c,d,h,g));else{var m,v,y=h,_=d,x=h,b=d,w=p,A=p,k=u.apply(this,arguments)/2,M=k>1e-12&&(r?+r.apply(this,arguments):fs(c*c+f*f)),E=ls(as(f-c)/2,+n.apply(this,arguments)),D=E,C=E;if(M>1e-12){var F=ms(M/c*cs(k)),S=ms(M/f*cs(k));(w-=2*F)>1e-12?(x+=F*=g?1:-1,b-=F):(w=0,x=b=(h+d)/2),(A-=2*S)>1e-12?(y+=S*=g?1:-1,_-=S):(A=0,y=_=(h+d)/2)}var B=f*os(y),z=f*cs(y),T=c*os(b),N=c*cs(b);if(E>1e-12){var O,R=f*os(_),q=f*cs(_),U=c*os(x),L=c*cs(x);if(p1e-12?C>1e-12?(m=As(U,L,B,z,f,C,g),v=As(R,q,T,N,f,C,g),o.moveTo(m.cx+m.x01,m.cy+m.y01),C1e-12&&w>1e-12?D>1e-12?(m=As(T,N,R,q,c,-D,g),v=As(B,z,U,L,c,-D,g),o.lineTo(m.cx+m.x01,m.cy+m.y01),Dt.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),Hl=Fs().x(Pl).y1($l).y0(t=>(t.y||0)+(t.height||0)).defined(jl),Wl=Fs().y($l).x1(Pl).x0(t=>(t.x||0)+(t.width||0)).defined(jl),Yl=Cs().x(Pl).y($l).defined(jl),Vl=ql().x(Pl).y($l).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>Ll(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>Ll(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>Ll(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>Ll(t.cornerRadiusBottomLeft,t.cornerRadius)||0),Gl=function(){var t=is(Ss),e=is(64),n=null;function r(){var r;if(n||(n=r=rs()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(e){return arguments.length?(t="function"==typeof e?e:is(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:is(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r}().type(t=>Cl(t.shape||"circle")).size(t=>Ll(t.size,64)),Xl=Ul().x(Pl).y($l).defined(jl).size(t=>t.size||1);function Jl(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Zl(t,e,n,r){return Vl.context(t)(e,n,r)}function Ql(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(r+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,r):0))}return t}var Kl,tc,ec,nc=ml-1e-8;function rc(t){return Kl=t,rc}function ic(){}function ac(t,e){Kl.add(t,e)}function uc(t,e){ac(tc=t,ec=e)}function oc(t){ac(t,Kl.y1)}function sc(t){ac(Kl.x1,t)}function lc(t,e,n,r){const i=(t-e)/(t+n-2*e);01e-14?(s=u*u+o*a,s>=0&&(s=Math.sqrt(s),l=(-u+s)/a,c=(-u-s)/a)):l=.5*o/u,0nc)ac(t-n,e-n),ac(t+n,e+n);else{const u=r=>ac(n*Math.cos(r)+t,n*Math.sin(r)+e);let o,s;if(u(r),u(i),i!==r)if((r%=ml)<0&&(r+=ml),(i%=ml)<0&&(i+=ml),ii;++s,o-=gl)u(o);else for(o=r-r%gl+gl,s=0;s<4&&om)return!1;d>g&&(g=d)}else if(f>0){if(d0&&(t.globalAlpha=n,t.fillStyle=wc(t,e,e.fill),!0)}var kc=[];function Mc(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=wc(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||kc),t.lineDashOffset=e.strokeDashOffset||0),!0))}function Ec(t,e){return t.zindex-e.zindex||t.index-e.index}function Dc(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,a=[];for(n=0,r=i.length;n=0;)if(n=e(i[r]))return n;if(i===a)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Sc(t){return function(e,n,r){Cc(n,(function(n){r&&!r.intersects(n.bounds)||zc(t,e,n,n)}))}}function Bc(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||zc(t,e,n.items[0],n.items)}}function zc(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(_c(e,n),n.fill&&Ac(e,n,i)&&e.fill(),n.stroke&&Mc(e,n,i)&&e.stroke()))}function Tc(t){return t=t||m,function(e,n,r,i,a,u){return r*=e.pixelRatio,i*=e.pixelRatio,Fc(n,(function(n){var o=n.bounds;if((!o||o.contains(a,u))&&o)return t(e,n,r,i,a,u)?n:void 0}))}}function Nc(t,e){return function(n,r,i,a){var u,o,s=Array.isArray(r)?r[0]:r,l=null==e?s.fill:e,c=s.stroke&&n.isPointInStroke;return c&&(u=s.strokeWidth,o=s.strokeCap,n.lineWidth=null!=u?u:1,n.lineCap=null!=o?o:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,a)||c&&n.isPointInStroke(i,a))}}function Oc(t){return Tc(Nc(t))}function Rc(t,e){return"translate("+t+","+e+")"}function qc(t){return"rotate("+t+")"}function Uc(t){return Rc(t.x||0,t.y||0)}function Lc(t){return Rc(t.x||0,t.y||0)+(t.angle?" "+qc(t.angle):"")+(t.scaleX||t.scaleY?" "+(e=t.scaleX||1,n=t.scaleY||1,"scale("+e+","+n+")"):"");var e,n}function Pc(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,a=n.angle||0;t.translate(r,i),a&&t.rotate(a*=pl),t.beginPath(),e(t,n),a&&t.rotate(-a),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",Lc(n)),t("d",e(null,n))},bound:function(t,n){var r=n.x||0,i=n.y||0;return e(rc(t),n),Ql(t,n).translate(r,i),n.angle&&t.rotate(n.angle*pl,r,i),t},draw:Sc(r),pick:Oc(r),isect:n||pc(r)}}var $c=Pc("arc",(function(t,e){return Il.context(t)(e)}));function jc(t,e,n){function r(t,n){t.beginPath(),e(t,n)}var i=Nc(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(rc(t),r),Ql(t,r[0]))},draw:Bc(r),pick:function(t,e,n,r,a,u){var o=e.items,s=e.bounds;return!o||!o.length||s&&!s.contains(a,u)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,o,n,r)?o[0]:null)},isect:gc,tip:n}}var Ic=jc("area",(function(t,e){var n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Wl:Hl).curve(cl(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],a="horizontal"===t[0].orient?"y":"x",u=t.length,o=1/0;--u>=0;)!1!==t[u].defined&&(r=Math.abs(t[u][a]-i)).5&&e<1.5?.5-Math.abs(e-1):0}function Gc(t,e){var n=Vc(e);t("d",Zl(null,e,n,n))}function Xc(t,e,n,r){var i=Vc(e);t.beginPath(),Zl(t,e,(n||0)+i,(r||0)+i)}var Jc=Nc(Xc),Zc=Nc(Xc,!1);var Qc={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Uc(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,r=0,i=n.length;rg||am)))return t.save(),t.translate(d,p),d=i-d,p=a-p,y&&Jl(l)&&!Jc(t,l,o,s)?(t.restore(),null):(f=l.strokeForeground,(h=!1!==e.interactive)&&f&&l.stroke&&Zc(t,l,o,s)?(t.restore(),l):(!(c=Fc(l,(function(t){return function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,d,p)?u.pick(t,n,r,d,p):null})))&&h&&(l.fill||!f&&l.stroke)&&Jc(t,l,o,s)&&(c=l),t.restore(),c||null))}))},isect:mc,content:function(t,e,n){t("clip-path",e.clip?Yc(n,e,e):null)},background:function(t,e){t("class","background"),Gc(t,e)},foreground:function(t,e){t("class","foreground"),e.strokeForeground?Gc(t,e):t("d","")}};function Kc(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then(e=>{t.image=e,t.image.url=t.url})),n}function tf(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function ef(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function nf(t,e){return"center"===t?e/2:"right"===t?e:0}function rf(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var af={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var r=Kc(e,n),i=e.x||0,a=e.y||0,u=tf(e,r),o=ef(e,r),s=!1===e.aspect?"none":"xMidYMid";i-=nf(e.align,u),a-=rf(e.baseline,o),!r.src&&r.toDataURL?t("href",r.toDataURL(),"http://www.w3.org/1999/xlink","xlink:href"):t("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Rc(i,a)),t("width",u),t("height",o),t("preserveAspectRatio",s)},bound:function(t,e){var n=e.image,r=e.x||0,i=e.y||0,a=tf(e,n),u=ef(e,n);return r-=nf(e.align,a),i-=rf(e.baseline,u),t.set(r,i,r+a,i+u)},draw:function(t,e,n){var r=this;Cc(e,(function(e){if(!n||n.intersects(e.bounds)){var i,a,u,o,s=Kc(e,r),l=e.x||0,c=e.y||0,f=tf(e,s),h=ef(e,s);l-=nf(e.align,f),c-=rf(e.baseline,h),!1!==e.aspect&&(a=s.width/s.height,u=e.width/e.height,a==a&&u==u&&a!==u&&(u=0;)if(!1!==t[a].defined&&(n=t[a].x-e[0])*n+(r=t[a].y-e[1])*r1?e:e[0]:e;var e}function Mf(t){const e=kf(t);return(u(e)?e.length-1:0)*Af(t)}function Ef(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(mf.width===xf){const e=Cf(t);return t=>bf(t,e)}{const e=wf(t);return t=>_f(t,e)}}(t);if(r(e)>>1,r(e.slice(i))>n?o=i+1:s=i;return a+e.slice(o)}for(;o>>1),r(e.slice(0,i))Math.max(t,mf.width(e,n)),0)):r=mf.width(e,h),"center"===a?c-=r/2:"right"===a&&(c-=r),t.set(c+=s,f+=l,c+r,f+i),e.angle&&!n)t.rotate(e.angle*pl,s,l);else if(2===n)return t.rotatedPoints(e.angle*pl,s,l);return t}var Nf={arc:$c,area:Ic,group:Qc,image:af,line:uf,path:sf,rect:cf,rule:hf,shape:df,symbol:pf,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Ff(e),a=zf(e),u=a.x1,o=a.y1,s=e.angle||0;t("text-anchor",Sf[e.align]||"start"),s?(n=Rc(u,o)+" "+qc(s),(r||i)&&(n+=" "+Rc(r,i))):n=Rc(u+r,o+i),t("transform",n)},bound:Tf,draw:function(t,e,n){Cc(e,(function(e){var r,i,a,o,s,l,c,f=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===f||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=Cf(e),t.textAlign=e.align||"left",i=(r=zf(e)).x1,a=r.y1,e.angle&&(t.save(),t.translate(i,a),t.rotate(e.angle*pl),i=a=0),i+=e.dx||0,a+=(e.dy||0)+Ff(e),l=kf(e),_c(t,e),u(l))for(s=Af(e),o=0;o=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null}))};function Of(t,e,n){var r=Nf[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Uo),t,n)}var Rf={mark:null};function qf(t,e,n){var r,i,a,u,o=Nf[t.marktype],s=o.bound,l=t.items,c=l&&l.length;if(o.nested)return c?a=l[0]:(Rf.mark=t,a=Rf),u=Of(a,s,n),e=e&&e.union(u)||u;if(e=e||t.bounds&&t.bounds.clear()||new Uo,c)for(r=0,i=l.length;re;)t.removeChild(n[--r]);return t}function Gf(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Xf(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Jf(t,e){this._active=null,this._handlers={},this._loader=t||kr(),this._tooltip=e||Zf}function Zf(t,e,n,r){t.element().setAttribute("title",r||"")}jf.toJSON=function(t){return Lf(this.root,t||0)},jf.mark=function(t,e,n){var r=If(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r};var Qf=Jf.prototype;function Kf(t){this._el=null,this._bgcolor=null,this._loader=new Xo(t)}Qf.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Qf.element=function(){return this._el},Qf.canvas=function(){return this._el&&this._el.firstChild},Qf.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Qf.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Qf.on=function(){},Qf.off=function(){},Qf._handlerIndex=function(t,e,n){for(var r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},Qf.handlers=function(t){var e,n=this._handlers,r=[];if(t)r.push.apply(r,n[this.eventName(t)]);else for(e in n)r.push.apply(r,n[e]);return r},Qf.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Qf.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then((function(e){var n=new MouseEvent(t.type,t),r=Hf(null,"a");for(var i in e)r.setAttribute(i,e[i]);r.dispatchEvent(n)})).catch((function(){}))},Qf.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,a,u=t&&t.mark;if(u&&(i=Nf[u.marktype]).tip){for((a=Xf(e,n))[0]-=r[0],a[1]-=r[1];t=t.mark.group;)a[0]-=t.x||0,a[1]-=t.y||0;t=i.tip(u.items,a)}return t}(e,t,this.canvas(),this._origin);var r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},Qf.getItemBoundingClientRect=function(t){if(e=this.canvas()){for(var e,n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,a=i.x1+r[0]+n.left,u=i.y1+r[1]+n.top,o=i.width(),s=i.height();t.mark&&(t=t.mark.group);)a+=t.x||0,u+=t.y||0;return{x:a,y:u,width:o,height:s,left:a,top:u,right:a+o,bottom:u+s}}};var th=Kf.prototype;th.initialize=function(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},th.element=function(){return this._el},th.canvas=function(){return this._el&&this._el.firstChild},th.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},th.resize=function(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},th.dirty=function(){},th.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},th._render=function(){},th.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then((function(){return e})):Promise.resolve(e)},th._load=function(t,e){var n=this,r=n._loader[t](e);if(!n._ready){var i=n._call;n._ready=n._loader.ready().then((function(t){t&&i(),n._ready=null}))}return r},th.sanitizeURL=function(t){return this._load("sanitizeURL",t)},th.loadImage=function(t){return this._load("loadImage",t)};function eh(t,e){Jf.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var nh=rt(eh,Jf);function rh(t,e,n){return function(r){var i=this._active,a=this.pickEvent(r);a===i||(i&&i.exit||this.fire(n,r),this._active=a,this.fire(e,r)),this.fire(t,r)}}function ih(t){return function(e){this.fire(t,e),this._active=null}}nh.initialize=function(t,e,n){var r=this._canvas=t&&Wf(t,"canvas");if(r){var i=this;this.events.forEach((function(t){r.addEventListener(t,(function(e){nh[t]?nh[t].call(i,e):i.fire(t,e)}))}))}return Jf.prototype.initialize.call(this,t,e,n)},nh.canvas=function(){return this._canvas},nh.context=function(){return this._canvas.getContext("2d")},nh.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],nh.DOMMouseScroll=function(t){this.fire("mousewheel",t)},nh.mousemove=rh("mousemove","mouseover","mouseout"),nh.dragover=rh("dragover","dragenter","dragleave"),nh.mouseout=ih("mouseout"),nh.dragleave=ih("dragleave"),nh.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},nh.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},nh.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},nh.touchmove=function(t){this.fire("touchmove",t,!0)},nh.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},nh.fire=function(t,e,n){var r,i,a=n?this._touch:this._active,u=this._handlers[t];if(e.vegaType=t,"click"===t&&a&&a.href?this.handleHref(e,a,a.href):"mousemove"!==t&&"mouseout"!==t||this.handleTooltip(e,a,"mouseout"!==t),u)for(r=0,i=u.length;r=0&&r.splice(i,1),this},nh.pickEvent=function(t){var e=Xf(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},nh.pick=function(t,e,n,r,i){var a=this.context();return Nf[t.marktype].pick.call(this,a,t,e,n,r,i)};var ah="undefined"!=typeof window&&window.devicePixelRatio||1;function uh(t){Kf.call(this,t),this._redraw=!1,this._dirty=new Uo}var oh=rt(uh,Kf),sh=Kf.prototype,lh=new Uo;function ch(t,e,n){return lh.set(0,0,e,n).translate(-t[0],-t[1])}function fh(t,e){Jf.call(this,t,e);var n=this;n._hrefHandler=dh(n,(function(t,e){e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=dh(n,(function(t,e){n.handleTooltip(t,e,"mouseout"!==t.type)}))}oh.initialize=function(t,e,n,r,i,a){return this._options=a,this._canvas=Vo(1,1,a&&a.type),t&&(Vf(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),sh.initialize.call(this,t,e,n,r,i)},oh.resize=function(t,e,n,r){return sh.resize.call(this,t,e,n,r),function(t,e,n,r,i,a){const u="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,o=t.getContext("2d"),s=u?ah:i;t.width=e*s,t.height=n*s;for(const t in a)o[t]=a[t];u&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),o.pixelRatio=s,o.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},oh.canvas=function(){return this._canvas},oh.context=function(){return this._canvas?this._canvas.getContext("2d"):null},oh.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=lh.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},oh._render=function(t){var e=this.context(),n=this._origin,r=this._width,i=this._height,a=this._dirty;return e.save(),this._redraw||a.empty()?(this._redraw=!1,a=ch(n,r,i).expand(1)):a=function(t,e,n){return e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,a.intersect(ch(n,r,i)),n),this.clear(-n[0],-n[1],r,i),this.draw(e,t,a),e.restore(),this._dirty.clear(),this},oh.draw=function(t,e,n){var r=Nf[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),W(n)?(t.beginPath(),n(t),t.clip()):Hc(t,e.group)}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},oh.clear=function(t,e,n,r){var i=this.context();i.clearRect(t,e,n,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(t,e,n,r))};var hh=rt(fh,Jf);function dh(t,e){return function(n){var r=n.target.__data__;n.vegaType=n.type,r=Array.isArray(r)?r[0]:r,e.call(t._obj,n,r)}}function ph(t,e,n){var r,i,a="<"+t;if(e)for(r in e)null!=(i=e[r])&&(a+=" "+r+'="'+i+'"');return n&&(a+=" "+n),a+">"}function gh(t){return""}hh.initialize=function(t,e,n){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mousemove",this._tooltipHandler),r.removeEventListener("mouseout",this._tooltipHandler)),this._svg=r=t&&Wf(t,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mousemove",this._tooltipHandler),r.addEventListener("mouseout",this._tooltipHandler)),Jf.prototype.initialize.call(this,t,e,n)},hh.canvas=function(){return this._svg},hh.on=function(t,e){var n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){var i={type:t,handler:e,listener:dh(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},hh.off=function(t,e){var n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this};var mh={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},vh={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",blend:"mix-blend-mode"},yh=Object.keys(vh),_h=mh.xmlns;function xh(t){Kf.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var bh=rt(xh,Kf),wh=Kf.prototype;function Ah(t,e,n){var r,i,a;if("radial"===e.gradient){var u=Yf(t,n++,"pattern",_h);u.setAttribute("id","p_"+e.id),u.setAttribute("viewBox","0,0,1,1"),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("preserveAspectRatio","xMidYMid slice"),(u=Yf(u,0,"rect",_h)).setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","url("+zh()+"#"+e.id+")"),(t=Yf(t,n++,"radialGradient",_h)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=Yf(t,n++,"linearGradient",_h)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(r=0,i=e.stops.length;r1&&t.previousSibling!=e}(u,n))&&e.insertBefore(u,n?n.nextSibling:e.firstChild),u}bh.initialize=function(t,e,n,r){return t&&(this._svg=Yf(t,0,"svg",_h),this._svg.setAttribute("class","marks"),Vf(t,1),this._root=Yf(this._svg,0,"g",_h),Vf(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),wh.initialize.call(this,t,e,n,r)},bh.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),wh.background.apply(this,arguments)},bh.resize=function(t,e,n,r){return wh.resize.call(this,t,e,n,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},bh.canvas=function(){return this._svg},bh.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in mh)t[e]=mh[e];var n=this._bgcolor?ph("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+gh("rect"):"";return ph("svg",t)+n+this._svg.innerHTML+gh("svg")},bh._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Vf(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},bh.updateDefs=function(){var t,e=this._svg,n=this._defs,r=n.el,i=0;for(t in n.gradient)r||(n.el=r=Yf(e,0,"defs",_h)),i=Ah(r,n.gradient[t],i);for(t in n.clipping)r||(n.el=r=Yf(e,0,"defs",_h)),i=kh(r,n.clipping[t],i);r&&(0===i?(e.removeChild(r),n.el=null):Vf(r,i))},bh._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},bh.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},bh.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},bh._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var e,n,r,i,a,u,o,s=++this._dirtyID;for(a=0,u=t.length;aEf(n,t))).join("\n"))!==Ch.text&&(Vf(e,0),a=e.ownerDocument,o=Af(n),i.forEach((t,r)=>{const i=Hf(a,"tspan",_h);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",o)),e.appendChild(i)}),Ch.text=r):(i=Ef(n,s))!==Ch.text&&(e.textContent=i,Ch.text=i),Sh(e,"font-family",Df(n)),Sh(e,"font-size",wf(n)+"px"),Sh(e,"font-style",n.fontStyle),Sh(e,"font-variant",n.fontVariant),Sh(e,"font-weight",n.fontWeight)}};function Sh(t,e,n){n!==Ch[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),Ch[e]=n)}function Bh(t,e,n){e!==Ch[t]&&(null!=e?n?Dh.setAttributeNS(n,t,e):Dh.setAttribute(t,e):n?Dh.removeAttributeNS(n,t):Dh.removeAttribute(t),Ch[t]=e)}function zh(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function Th(t){Kf.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}bh._update=function(t,e,n){Dh=e,Ch=e.__values__,t.attr(Bh,n,this);var r=Fh[t.type];r&&r.call(this,t,e,n),Dh&&this.style(Dh,n)},bh.style=function(t,e){var n,r,i,a,u;if(null!=e)for(n=0,r=yh.length;n/g,">")}Oh.resize=function(t,e,n,r){Rh.resize.call(this,t,e,n,r);var i=this._origin,a=this._text,u={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var o in mh)u[o]=mh[o];a.head=ph("svg",u);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?ph("rect",{width:this._width,height:this._height,style:"fill: "+s+";"})+gh("rect"):"",a.root=ph("g",{transform:"translate("+i+")"}),a.foot=gh("g")+gh("svg"),this},Oh.background=function(){var t=Rh.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},Oh.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},Oh._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},Oh.buildDefs=function(){var t,e,n,r,i,a=this._defs,u="";for(e in a.gradient){for(i=(n=a.gradient[e]).stops,"radial"===n.gradient?(u+=ph(r="pattern",{id:"p_"+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),u+=ph("rect",{width:"1",height:"1",fill:"url(#"+e+")"})+gh("rect"),u+=gh(r),u+=ph(r="radialGradient",{id:e,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):u+=ph(r="linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t0?ph("defs")+u+gh("defs"):""},Oh.attributes=function(t,e){return Nh={},t(qh,e,this),Nh},Oh.href=function(t){var e,n=this,r=t.href;if(r){if(e=n._hrefs&&n._hrefs[r])return e;n.sanitizeURL(r).then((function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[r]=t}))}return null},Oh.mark=function(t){var e,n=this,r=Nf[t.marktype],i=r.tag,a=this._defs,o="";function s(s){var l=n.href(s);if(l&&(o+=ph("a",l)),e="g"!==i?Uh(s,t,i,a):null,o+=ph(i,n.attributes(r.attr,s),e),"text"===i){const t=kf(s);if(u(t)){const e={x:0,dy:Af(s)};for(let n=0;n1?($h[t]=e,this):$h[t]}function Ih(t,e,n){const r=[],a=(new Uo).union(e),u=t.marktype;return u?Hh(t,a,n,r):"group"===u?Wh(t,a,n,r):i("Intersect scene must be mark node or group item.")}function Hh(t,e,n,r){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const i=t.items,a=t.marktype,u=i.length;let o=0;if("group"===a)for(;o=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(n=i[r],!Xh(t[n],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function Jh(t,e){return Xh(dl(t),dl(e))}function Zh(t){Hr.call(this,null,t)}function Qh(t,e,n){return e(t.bounds.clear(),t,n)}rt(Zh,Hr).transform=function(t,e){var n,r=e.dataflow,i=t.mark,a=i.marktype,u=Nf[a],o=u.bound,s=i.bounds;if(u.nested)i.items.length&&r.dirty(i.items[0]),s=Qh(i,o),i.items.forEach((function(t){t.bounds.clear().union(s)}));else if("group"===a||t.modified())switch(e.visit(e.MOD,(function(t){r.dirty(t)})),s.clear(),i.items.forEach((function(t){s.union(Qh(t,o))})),i.role){case"axis":case"legend":case"title":e.reflow()}else n=e.changed(e.REM),e.visit(e.ADD,(function(t){s.union(Qh(t,o))})),e.visit(e.MOD,(function(t){n=n||s.alignsWith(t.bounds),r.dirty(t),s.union(Qh(t,o))})),n&&(s.clear(),i.items.forEach((function(t){s.union(t.bounds)})));return Gh(i),e.modifies("bounds")};function Kh(t){Hr.call(this,0,t)}function td(t){Hr.call(this,null,t)}function ed(t){Hr.call(this,null,t)}Kh.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},rt(Kh,Hr).transform=function(t,e){var n=function(t){var e=t._signals[":vega_identifier:"];e||(t._signals[":vega_identifier:"]=e=t.add(0));return e}(e.dataflow),r=n.value,i=t.as;return e.visit(e.ADD,(function(t){t[i]||(t[i]=++r)})),n.set(this.value=r),e},rt(td,Hr).transform=function(t,e){var n=this.value;n||((n=e.dataflow.scenegraph().mark(t.markdef,function(t){var e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);var r="group"===n.marktype?Yo:Wo;return e.visit(e.ADD,(function(t){r.call(t,n)})),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e};var nd=rt(ed,Hr),rd={parity:function(t){return t.filter((t,e)=>e%2?t.opacity=0:1)},greedy:function(t,e){var n;return t.filter((t,r)=>r&&id(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1))}};function id(t,e,n){return n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function ad(t,e){for(var n,r=1,i=t.length,a=t[0].bounds;r1&&e.height()>1}function od(t){return t.forEach(t=>t.opacity=1),t}function sd(t,e){return t.reflow(e.modified()).modifies("opacity")}function ld(t){Hr.call(this,null,t)}nd.transform=function(t,e){var n,r,i,a=rd[t.method]||rd.parity,u=e.materialize(e.SOURCE).source,o=t.separation||0;if(u&&u.length){if(!t.method)return t.modified("method")&&(od(u),e=sd(e,t)),e;if((u=u.filter(ud)).length){if(t.sort&&(u=u.slice().sort(t.sort)),n=od(u),e=sd(e,t),n.length>=3&&ad(n,o)){do{n=a(n,o)}while(n.length>=3&&ad(n,o));n.length<3&&!k(u).opacity&&(n.length>1&&(k(n).opacity=0),k(u).opacity=1)}return t.boundScale&&t.boundTolerance>=0&&(r=function(t,e,n){var r=t.range(),i=new Uo;return e===To||"bottom"===e?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)}(t.boundScale,t.boundOrient,+t.boundTolerance),u.forEach(t=>{r(t)||(t.opacity=0)})),i=n[0].mark.bounds.clear(),u.forEach(t=>{t.opacity&&i.union(t.bounds)}),e}}},rt(ld,Hr).transform=function(t,e){var n=e.dataflow;if(e.visit(e.ALL,(function(t){n.dirty(t)})),e.fields&&e.fields.zindex){var r=e.source&&e.source[0];r&&(r.mark.zdirty=!0)}};const cd=new Uo;function fd(t,e,n){return t[e]===n?0:(t[e]=n,1)}function hd(t){var e=t.items[0].datum.orient;return e===No||e===Oo}function dd(t,e,n,r){var i,a,u=e.items[0],o=u.datum,s=o.orient,l=null!=o.translate?o.translate:.5,c=function(t){var e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(o),f=u.range,h=u.offset,d=u.position,p=u.minExtent,g=u.maxExtent,m=o.title&&u.items[c[2]].items[0],v=u.titlePadding,y=u.bounds,_=m&&Mf(m),x=0,b=0;switch(cd.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(u.items[i].bounds),(i=c[1])>-1&&y.union(u.items[i].bounds),s){case To:x=d||0,b=-h,a=Math.max(p,Math.min(g,-y.y1)),y.add(0,-a).add(f,0),m&&pd(t,m,a,v,_,0,-1,y);break;case No:x=-h,b=d||0,a=Math.max(p,Math.min(g,-y.x1)),y.add(-a,0).add(0,f),m&&pd(t,m,a,v,_,1,-1,y);break;case Oo:x=n+h,b=d||0,a=Math.max(p,Math.min(g,y.x2)),y.add(0,0).add(a,f),m&&pd(t,m,a,v,_,1,1,y);break;case"bottom":x=d||0,b=r+h,a=Math.max(p,Math.min(g,y.y2)),y.add(0,0).add(f,a),m&&pd(t,m,a,v,0,0,1,y);break;default:x=u.x,b=u.y}return Ql(y.translate(x,b),u),fd(u,"x",x+l)|fd(u,"y",b+l)&&(u.bounds=cd,t.dirty(u),u.bounds=y,t.dirty(u)),u.mark.bounds.clear().union(y)}function pd(t,e,n,r,i,a,u,o){const s=e.bounds;if(e.auto){const o=u*(n+i+r);let l=0,c=0;t.dirty(e),a?l=(e.x||0)-(e.x=o):c=(e.y||0)-(e.y=o),e.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(e)}o.union(s)}function gd(t){return(new Uo).set(0,0,t.width||0,t.height||0)}function md(t){var e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function vd(t,e,n){var r=o(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function yd(t){return t<0?Math.ceil(-t):0}function _d(t,e,n){var r,i,a,u,o,s,l,c,f,h,d,p=!n.nodirty,g="flush"===n.bounds?gd:md,m=cd.set(0,0,0,0),v=vd(n.align,"column"),y=vd(n.align,qo),_=vd(n.padding,"column"),x=vd(n.padding,qo),b=n.columns||e.length,w=b<0?1:Math.ceil(e.length/b),A=e.length,k=Array(A),M=Array(b),E=0,D=Array(A),C=Array(w),F=0,S=Array(A),B=Array(A),z=Array(A);for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(y&&vd(n.center,qo)&&1!==b)for(i=0;i0&&(B[i]+=h/2);for(i=0;ii&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),k+=a,g=0,v=e.length;g=0&&null==(x=n[m]);m-=h);o?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=k):(b=k,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),y.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=u(M,y[l])}return M}function Md(t,e,n,r,i,a){if(e){t.dirty(e);var u=n,o=n;r?u=Math.round(i.x1+a*i.width()):o=Math.round(i.y1+a*i.height()),e.bounds.translate(u-(e.x||0),o-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=u,e.y=o,t.dirty(e)}}function Ed(t,e,n,r,i,a,u){const o=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),s=function(t,e){var n=-1/0;return t.forEach(t=>{null!=t.offset&&(n=Math.max(n,t.offset))}),n>-1/0?n:e}(t,o("offset",0)),l=o("anchor","start"),c=l===Ro?1:"middle"===l?.5:0,f={align:"each",bounds:o("bounds","flush"),columns:"vertical"===o("direction")?1:t.length,padding:o("margin",8),center:o("center"),nodirty:!0};switch(e){case No:f.anchor={x:Math.floor(r.x1)-s,column:Ro,y:c*(u||r.height()+2*r.y1),row:l};break;case Oo:f.anchor={x:Math.ceil(r.x2)+s,y:c*(u||r.height()+2*r.y1),row:l};break;case To:f.anchor={y:Math.floor(i.y1)-s,row:Ro,x:c*(a||i.width()+2*i.x1),column:l};break;case"bottom":f.anchor={y:Math.ceil(i.y2)+s,x:c*(a||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:a-s,y:s,column:Ro};break;case"bottom-left":f.anchor={x:s,y:u-s,row:Ro};break;case"bottom-right":f.anchor={x:a-s,y:u-s,column:Ro,row:Ro}}return f}function Dd(t,e){var n,r,i,a,u=e.items[0],o=u.datum,s=u.orient,l=u.bounds,c=u.x,f=u.y;return u._bounds?u._bounds.clear().union(l):u._bounds=l.clone(),l.clear(),function(t,e,n){var r=e.padding,i=r-n.x,a=r-n.y;if(e.datum.title){var u=e.items[1].items[0],o=u.anchor,s=e.titlePadding||0,l=r-u.x,c=r-u.y;switch(u.orient){case No:i+=Math.ceil(u.bounds.width())+s;break;case Oo:case"bottom":break;default:a+=u.bounds.height()+s}switch((i||a)&&Fd(t,n,i,a),u.orient){case No:c+=Cd(e,n,u,o,1,1);break;case Oo:l+=Cd(e,n,u,Ro,0,0)+s,c+=Cd(e,n,u,o,1,1);break;case"bottom":l+=Cd(e,n,u,o,0,0),c+=Cd(e,n,u,Ro,-1,0,1)+s;break;default:l+=Cd(e,n,u,o,0,0)}(l||c)&&Fd(t,u,l,c),(l=Math.round(u.bounds.x1-r))<0&&(Fd(t,n,-l,0),Fd(t,u,-l,0))}else(i||a)&&Fd(t,n,i,a)}(t,u,u.items[0].items[0]),l=function(t,e){return t.items.forEach(t=>e.union(t.bounds)),e.x1=t.padding,e.y1=t.padding,e}(u,l),n=2*u.padding,r=2*u.padding,l.empty()||(n=Math.ceil(l.width()+n),r=Math.ceil(l.height()+r)),"symbol"===o.type&&(i=u.items[0].items[0].items[0].items,a=i.reduce((function(t,e){return t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t}),{}),i.forEach((function(t){t.width=a[t.column],t.height=t.bounds.y2-t.y}))),"none"!==s&&(u.x=c=0,u.y=f=0),u.width=n,u.height=r,Ql(l.set(c,f,c+n,f+r),u),u.mark.bounds.clear().union(l),u}function Cd(t,e,n,r,i,a,u){const o="symbol"!==t.datum.type,s=n.datum.vgrad,l=(!o||!a&&s||u?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&a?l:0,f=s&&a?0:l,h=i<=0?0:Mf(n);return Math.round("start"===r?c:r===Ro?f-h:.5*(l-h))}function Fd(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function Sd(t){Hr.call(this,null,t)}rt(Sd,Hr).transform=function(t,e){var n=e.dataflow;return t.mark.items.forEach((function(e){t.layout&&function(t,e,n){var r,i,a,u,o,s,l,c=function(t){for(var e,n,r=t.items,i=r.length,a=0,u={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a{"none"!==(a=t.orient||Oo)&&(e[a]||(e[a]=[])).push(t)});for(let r in e){const i=e[r];_d(t,i,Ed(i,r,n.legends,h,d,l,c))}p.forEach(e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),n.autosize&&"fit"===n.autosize.type)switch(e.orient){case No:case Oo:f.add(r.x1,0).add(r.x2,0);break;case To:case"bottom":f.add(0,r.y1).add(0,r.y2)}else f.union(r)})}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var a,u=e.items[0],o=u.frame,s=u.orient,l=u.anchor,c=u.offset,f=u.padding,h=u.items[0].items[0],d=u.items[1]&&u.items[1].items[0],p=s===No||s===Oo?r:n,g=0,m=0,v=0,y=0,_=0;if("group"!==o?s===No?(g=i.y2,p=i.y1):s===Oo?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===No&&(g=r,p=0),a="start"===l?g:l===Ro?p:(g+p)/2,d&&d.text){switch(s){case To:case"bottom":_=h.bounds.height()+f;break;case No:y=h.bounds.width()+f;break;case Oo:y=-h.bounds.width()-f}cd.clear().union(d.bounds),cd.translate(y-(d.x||0),_-(d.y||0)),fd(d,"x",y)|fd(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(cd),d.mark.bounds.clear().union(cd),t.dirty(d)),cd.clear().union(d.bounds)}else cd.clear();switch(cd.union(h.bounds),s){case To:m=a,v=i.y1-cd.height()-c;break;case No:m=i.x1-cd.width()-c,v=a;break;case Oo:m=i.x2+cd.width()+c,v=a;break;case"bottom":m=a,v=i.y2+c;break;default:m=u.x,v=u.y}return fd(u,"x",m)|fd(u,"y",v)&&(cd.translate(m,v),t.dirty(u),u.bounds.clear().union(cd),e.bounds.clear().union(cd),t.dirty(u)),u.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},a=i.type;if(t._autosize<1||!a)return;let u=t._width,o=t._height,s=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,Math.ceil(n.x2-s)),f=Math.max(0,e.height||0),h=Math.max(0,Math.ceil(-n.y1)),d=Math.max(0,Math.ceil(n.y2-f));if("padding"===i.contains){const e=t.padding();u-=e.left+e.right,o-=e.top+e.bottom}"none"===a?(l=0,h=0,s=u,f=o):"fit"===a?(s=Math.max(0,u-l-c),f=Math.max(0,o-h-d)):"fit-x"===a?(s=Math.max(0,u-l-c),o=f+h+d):"fit-y"===a?(u=s+l+c,f=Math.max(0,o-h-d)):"pad"===a&&(u=s+l+c,o=f+h+d);t._resizeView(u,o,s,f,[l,h],i.resize)}(t,e,f,n)}(n,e,t)})),t.modified()&&e.reflow(),e};var Bd=Object.freeze({__proto__:null,bound:Zh,identifier:Kh,mark:td,overlap:ed,render:ld,viewlayout:Sd});function zd(t,e,n){var r=t-e+2*n;return t?r>0?r:1:0}const Td="log",Nd="utc",Od="continuous";function Rd(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function qd(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Ud=Symbol("implicit");function Ld(){var t=new Map,e=[],n=[],r=Ud;function i(i){var a=i+"",u=t.get(a);if(!u){if(r!==Ud)return r;t.set(a,u=e.push(i))}return n[(u-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Ld(e,n).unknown(r)},Rd.apply(i,arguments),i}function Pd(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function $d(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function jd(){}var Id="\\s*([+-]?\\d+)\\s*",Hd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wd="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Yd=/^#([0-9a-f]{3,8})$/,Vd=new RegExp("^rgb\\("+[Id,Id,Id]+"\\)$"),Gd=new RegExp("^rgb\\("+[Wd,Wd,Wd]+"\\)$"),Xd=new RegExp("^rgba\\("+[Id,Id,Id,Hd]+"\\)$"),Jd=new RegExp("^rgba\\("+[Wd,Wd,Wd,Hd]+"\\)$"),Zd=new RegExp("^hsl\\("+[Hd,Wd,Wd]+"\\)$"),Qd=new RegExp("^hsla\\("+[Hd,Wd,Wd,Hd]+"\\)$"),Kd={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function tp(){return this.rgb().formatHex()}function ep(){return this.rgb().formatRgb()}function np(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Yd.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?rp(e):3===n?new op(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?new op(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?new op(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Vd.exec(t))?new op(e[1],e[2],e[3],1):(e=Gd.exec(t))?new op(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Xd.exec(t))?ip(e[1],e[2],e[3],e[4]):(e=Jd.exec(t))?ip(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Zd.exec(t))?fp(e[1],e[2]/100,e[3]/100,1):(e=Qd.exec(t))?fp(e[1],e[2]/100,e[3]/100,e[4]):Kd.hasOwnProperty(t)?rp(Kd[t]):"transparent"===t?new op(NaN,NaN,NaN,0):null}function rp(t){return new op(t>>16&255,t>>8&255,255&t,1)}function ip(t,e,n,r){return r<=0&&(t=e=n=NaN),new op(t,e,n,r)}function ap(t){return t instanceof jd||(t=np(t)),t?new op((t=t.rgb()).r,t.g,t.b,t.opacity):new op}function up(t,e,n,r){return 1===arguments.length?ap(t):new op(t,e,n,null==r?1:r)}function op(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function sp(){return"#"+cp(this.r)+cp(this.g)+cp(this.b)}function lp(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function cp(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function fp(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new pp(t,e,n,r)}function hp(t){if(t instanceof pp)return new pp(t.h,t.s,t.l,t.opacity);if(t instanceof jd||(t=np(t)),!t)return new pp;if(t instanceof pp)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=Math.max(e,n,r),u=NaN,o=a-i,s=(a+i)/2;return o?(u=e===a?(n-r)/o+6*(n0&&s<1?0:u,new pp(u,o,s,t.opacity)}function dp(t,e,n,r){return 1===arguments.length?hp(t):new pp(t,e,n,null==r?1:r)}function pp(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function gp(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Pd(jd,np,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:tp,formatHex:tp,formatHsl:function(){return hp(this).formatHsl()},formatRgb:ep,toString:ep}),Pd(op,up,$d(jd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new op(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new op(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:sp,formatHex:sp,formatRgb:lp,toString:lp})),Pd(pp,dp,$d(jd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new pp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new pp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new op(gp(t>=240?t-240:t+120,i,r),gp(t,i,r),gp(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var mp=Math.PI/180,vp=180/Math.PI,yp=6/29*3*(6/29);function _p(t){if(t instanceof bp)return new bp(t.l,t.a,t.b,t.opacity);if(t instanceof Cp)return Fp(t);t instanceof op||(t=ap(t));var e,n,r=Mp(t.r),i=Mp(t.g),a=Mp(t.b),u=wp((.2225045*r+.7168786*i+.0606169*a)/1);return r===i&&i===a?e=n=u:(e=wp((.4360747*r+.3850649*i+.1430804*a)/.96422),n=wp((.0139322*r+.0971045*i+.7141733*a)/.82521)),new bp(116*u-16,500*(e-u),200*(u-n),t.opacity)}function xp(t,e,n,r){return 1===arguments.length?_p(t):new bp(t,e,n,null==r?1:r)}function bp(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function wp(t){return t>6/29*(6/29)*(6/29)?Math.pow(t,1/3):t/yp+4/29}function Ap(t){return t>6/29?t*t*t:yp*(t-4/29)}function kp(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Mp(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ep(t){if(t instanceof Cp)return new Cp(t.h,t.c,t.l,t.opacity);if(t instanceof bp||(t=_p(t)),0===t.a&&0===t.b)return new Cp(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],a=t[r+1],u=r>0?t[r-1]:2*i-a,o=r180||n<-180?n-360*Math.round(n/360):n):Hp(isNaN(t)?e:t)}function Vp(t){return 1==(t=+t)?Gp:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Hp(isNaN(e)?n:e)}}function Gp(t,e){var n=e-t;return n?Wp(t,n):Hp(isNaN(t)?e:t)}Pd(Pp,Lp,$d(jd,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Pp(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Pp(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*mp,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new op(255*(e+n*(Sp*r+Bp*i)),255*(e+n*(zp*r+Tp*i)),255*(e+n*(Np*r)),this.opacity)}}));var Xp=function t(e){var n=Vp(e);function r(t,e){var r=n((t=up(t)).r,(e=up(e)).r),i=n(t.g,e.g),a=n(t.b,e.b),u=Gp(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=a(e),t.opacity=u(e),t+""}}return r.gamma=t,r}(1);function Jp(t){return function(e){var n,r,i=e.length,a=new Array(i),u=new Array(i),o=new Array(i);for(n=0;na&&(i=e.slice(a,i),o[u]?o[u]+=i:o[++u]=i),(n=n[0])===(r=r[0])?o[u]?o[u]+=r:o[++u]=r:(o[++u]=null,s.push({i:u,x:rg(n,r)})),a=ug.lastIndex;return a180?e+=360:e-t>180&&(t+=360),a.push({i:n.push(i(n)+"rotate(",null,r)-2,x:rg(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(a.rotate,u.rotate,o,s),function(t,e,n,a){t!==e?a.push({i:n.push(i(n)+"skewX(",null,r)-2,x:rg(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(a.skewX,u.skewX,o,s),function(t,e,n,r,a,u){if(t!==n||e!==r){var o=a.push(i(a)+"scale(",null,",",null,")");u.push({i:o-4,x:rg(t,n)},{i:o-2,x:rg(e,r)})}else 1===n&&1===r||a.push(i(a)+"scale("+n+","+r+")")}(a.scaleX,a.scaleY,u.scaleX,u.scaleY,o,s),a=u=null,function(t){for(var e,n=-1,r=s.length;++ne&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(u[0],u[t-1])),r=t>2?Ug:qg,i=a=null,f}function f(e){return isNaN(e=+e)?n:(i||(i=r(u.map(t),o,s)))(t(l(e)))}return f.invert=function(n){return l(e((a||(a=r(o,u.map(t),rg)))(n)))},f.domain=function(t){return arguments.length?(u=Array.from(t,Tg),c()):u.slice()},f.range=function(t){return arguments.length?(o=Array.from(t),c()):o.slice()},f.rangeRound=function(t){return o=Array.from(t),s=lg,c()},f.clamp=function(t){return arguments.length?(l=!!t||Og,c()):l!==Og},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}function $g(){return Pg()(Og,Og)}function jg(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ig(t){return(t=jg(Math.abs(t)))?t[1]:NaN}var Hg,Wg=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Yg(t){if(!(e=Wg.exec(t)))throw new Error("invalid format: "+t);var e;return new Vg({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Vg(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Gg(t,e){var n=jg(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Yg.prototype=Vg.prototype,Vg.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Xg={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return Gg(100*t,e)},r:Gg,s:function(t,e){var n=jg(t,e);if(!n)return t+"";var r=n[0],i=n[1],a=i-(Hg=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return a===u?r:a>u?r+new Array(a-u+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+jg(t,Math.max(0,e+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Jg(t){return t}var Zg,Qg,Kg,tm=Array.prototype.map,em=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function nm(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Jg:(e=tm.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,a=[],u=0,o=e[0],s=0;i>0&&o>0&&(s+o+1>r&&(o=Math.max(1,r-s)),a.push(t.substring(i-=o,i+o)),!((s+=o+1)>r));)o=e[u=(u+1)%e.length];return a.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",u=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?Jg:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(tm.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=Yg(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):Xg[y]||(void 0===m&&(m=12),v=!0,y="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===h?a:/[%p]/.test(y)?s:"",b=Xg[y],w=/[defgprs%]/.test(y);function A(t){var i,a,s,h=_,A=x;if("c"===y)A=b(t)+A,t="";else{var k=(t=+t)<0;if(t=isNaN(t)?c:b(Math.abs(t),m),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&(k=!1),h=(k?"("===f?f:l:"-"===f||"("===f?"":f)+h,A=("s"===y?em[8+Hg/3]:"")+A+(k&&"("===f?")":""),w)for(i=-1,a=t.length;++i(s=t.charCodeAt(i))||s>57){A=(46===s?u+t.slice(i+1):t.slice(i))+A,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+A.length,E=M>1)+h+t+A+E.slice(M);break;default:t=E+h+t+A}return o(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),A.toString=function(){return t+""},A}return{format:f,formatPrefix:function(t,e){var n=f(((t=Yg(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Ig(e)/3))),i=Math.pow(10,-r),a=em[8+r/3];return function(t){return n(i*t)+a}}}}function rm(t){return Zg=nm(t),Qg=Zg.format,Kg=Zg.formatPrefix,Zg}function im(t,e,n,r){var i,a=gi(t,e,n);switch((r=Yg(null==r?",f":r)).type){case"s":var u=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=function(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ig(e)/3)))-Ig(Math.abs(t)))}(a,u))||(r.precision=i),Kg(r,u);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ig(e)-Ig(t))+1}(a,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Ig(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return Qg(r)}function am(t){var e=t.domain;return t.ticks=function(t){var n=e();return di(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return im(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i=e(),a=0,u=i.length-1,o=i[a],s=i[u];return s0?r=pi(o=Math.floor(o/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=pi(o=Math.ceil(o*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[a]=Math.floor(o/r)*r,i[u]=Math.ceil(s/r)*r,e(i)):r<0&&(i[a]=Math.ceil(o*r)/r,i[u]=Math.floor(s*r)/r,e(i)),t},t}function um(t,e){var n,r=0,i=(t=t.slice()).length-1,a=t[r],u=t[i];return u0){for(;h<=d;++h)for(c=1,l=n(h);cs)break;g.push(f)}}else for(;h<=d;++h)for(c=a-1,l=n(h);c>=1;--c)if(!((f=l*c)s)break;g.push(f)}2*g.lengtha[1-c])))return n=Math.max(0,oi(f,s)-1),u=s===l?n:oi(f,l)-1,s-f[n]>e+1e-10&&++n,c&&(o=n,n=h-u,u=h-o),n>u?void 0:r().slice(n,u+1)}},n.invert=function(t){var e=n.invertRange([t,t]);return e?e[0]:e},n.copy=function(){return Bm().domain(r()).range(a).round(u).paddingInner(o).paddingOuter(s).align(l)},c()}var zm=Array.prototype.map;function Tm(t){return zm.call(t,(function(t){return+t}))}var Nm=Array.prototype.slice;const Om={};function Rm(t,e,n){const r=function(){var n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){var n,r=e[0],i=e[1];return i=o&&u[i]<=s&&(l<0&&(l=i),n=i);if(!(l<0))return o=t.invertExtent(u[l]),s=t.invertExtent(u[n]),[void 0===o[0]?o[1]:o[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=t,n};return r.metadata=xt(I(n)),r}function qm(t,e,n){return arguments.length>1?(Om[t]=Rm(t,e,n),this):Um(t)?Om[t]:void 0}function Um(t){return K(Om,t)}function Lm(t,e){const n=Om[t];return n&&n.metadata[e]}function Pm(t){return Lm(t,Od)}function $m(t){return Lm(t,"discrete")}function jm(t){return Lm(t,"discretizing")}function Im(t){return Lm(t,Td)}function Hm(t){return Lm(t,"interpolating")}function Wm(t){return Lm(t,"quantile")}qm("identity",(function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Tg),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,Tg):[0,1],am(r)})),qm("linear",(function t(){var e=$g();return e.copy=function(){return Lg(e,t())},Rd.apply(e,arguments),am(e)}),Od),qm(Td,(function t(){var e=dm(Pg()).domain([1,10]);return e.copy=function(){return Lg(e,t()).base(e.base())},Rd.apply(e,arguments),e}),[Od,Td]),qm("pow",bm,Od),qm("sqrt",(function(){return bm.apply(null,arguments).exponent(.5)}),Od),qm("symlog",(function t(){var e=mm(Pg());return e.copy=function(){return Lg(e,t()).constant(e.constant())},Rd.apply(e,arguments)}),Od),qm("time",(function(){return Rd.apply(km(Ye,We,je,Pe,Le,Ue,qe,Re,on).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Od,"temporal"]),qm(Nd,(function(){return Rd.apply(km(en,tn,Ze,Xe,Ge,Ve,qe,Re,ln).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Od,"temporal"]),qm("sequential",Dm,[Od,"interpolating"]),qm("sequential-linear",Dm,[Od,"interpolating"]),qm("sequential-log",(function t(){var e=dm(Mm()).domain([1,10]);return e.copy=function(){return Em(e,t()).base(e.base())},qd.apply(e,arguments)}),[Od,"interpolating",Td]),qm("sequential-pow",Cm,[Od,"interpolating"]),qm("sequential-sqrt",(function(){return Cm.apply(null,arguments).exponent(.5)}),[Od,"interpolating"]),qm("sequential-symlog",(function t(){var e=mm(Mm());return e.copy=function(){return Em(e,t()).constant(e.constant())},qd.apply(e,arguments)}),[Od,"interpolating"]),qm("diverging-linear",(function t(){var e=am(Fm()(Og));return e.copy=function(){return Em(e,t())},qd.apply(e,arguments)}),[Od,"interpolating"]),qm("diverging-log",(function t(){var e=dm(Fm()).domain([.1,1,10]);return e.copy=function(){return Em(e,t()).base(e.base())},qd.apply(e,arguments)}),[Od,"interpolating",Td]),qm("diverging-pow",Sm,[Od,"interpolating"]),qm("diverging-sqrt",(function(){return Sm.apply(null,arguments).exponent(.5)}),[Od,"interpolating"]),qm("diverging-symlog",(function t(){var e=mm(Fm());return e.copy=function(){return Em(e,t()).constant(e.constant())},qd.apply(e,arguments)}),[Od,"interpolating"]),qm("quantile",(function t(){var e,n=[],r=[],i=[];function a(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t0?i[e-1]:n[0],e=i?[a[i-1],r]:[a[e-1],a[e]]},o.unknown=function(t){return arguments.length?(e=t,o):o},o.thresholds=function(){return a.slice()},o.copy=function(){return t().domain([n,r]).range(u).unknown(e)},Rd.apply(am(o),arguments)}),"discretizing"),qm("threshold",(function t(){var e,n=[.5],r=[0,1],i=1;function a(t){return t<=t?r[oi(n,t,0,i)]:e}return a.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),a):n.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},a.unknown=function(t){return arguments.length?(e=t,a):e},a.copy=function(){return t().domain(n).range(r).unknown(e)},Rd.apply(a,arguments)}),"discretizing"),qm("bin-ordinal",(function t(){var e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(oi(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=Tm(t),r):e.slice()},r.range=function(t){return arguments.length?(n=Nm.call(t),r):n.slice()},r.tickFormat=function(t,n){return im(e[0],k(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),["discrete","discretizing"]),qm("ordinal",Ld,"discrete"),qm("band",Bm,"discrete"),qm("point",(function(){return function t(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return t(n())},e}(Bm().paddingInner(1))}),"discrete");const Ym=["clamp","base","constant","exponent"];function Vm(t,e){var n=e[0],r=k(e)-n;return function(e){return t(n+e*r)}}function Gm(t,e,n){return Bg(Zm(e||"rgb",n),t)}function Xm(t,e){for(var n=new Array(e),r=e+1,i=0;it[e]?a[e](t[e]()):0),a):V(.5)}function Zm(t,e){var n=zg[function(t){return"interpolate"+t.toLowerCase().split("-").map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function Qm(t){for(var e=t.length/6|0,n=new Array(e),r=0;r1?(tv[t]=e,this):tv[t]}Km({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Qm),Km({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",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",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"},t=>Gm(Qm(t)));const nv=t=>u(t)?t.map(t=>String(t)):String(t);function rv(t,e,n){var r;return ot(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,~~(gt(t.domain())/n)||1))),o(e)&&(r=e.step,e=e.interval),s(e)&&(e="time"===t.type?Xu(e):t.type==Nd?Ju(e):i("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function iv(t,e,n){var r=t.range(),i=Math.floor(r[0]),a=Math.ceil(k(r));if(i>a&&(r=a,a=i,i=r),e=e.filter((function(e){return e=t(e),i<=e&&e<=a})),n>0&&e.length>1){for(var u=[e[0],k(e)];e.length>n&&e.length>=3;)e=e.filter((function(t,e){return!(e%2)}));e.length<3&&(e=u)}return e}function av(t,e){return t.bins?iv(t,t.bins):t.ticks?t.ticks(e):t.domain()}function uv(t,e,n,r,i){var a,u,o=t.type,s="time"===o||"time"===r?ao(n):o===Nd||r===Nd?uo(n):t.tickFormat?t.tickFormat(e,n):n?Qg(n):nv;if(Im(o)){var l=function(t){var e=Yg(t||",");if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return function(t,e){return function(n){var r,i,a=t(n),u=a.indexOf(e);if(u<0)return a;for(i=(r=function(t,e){var n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if((n=t.charCodeAt(r))>=48&&n<=57)return r+1}(a,u))u;)if("0"!==a[r]){++r;break}return a.slice(0,r)+i}}(Qg(e),Qg(".1f")(1)[1])}return Qg(e)}(n);s=i||t.bins?l:(a=s,u=l,t=>a(t)?u(t):"")}return s}function ov(t){Hr.call(this,null,t)}function sv(t){Hr.call(this,null,t)}function lv(){return St({})}function cv(t){return t.exit}function fv(t){Hr.call(this,null,t)}rt(ov,Hr).transform=function(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=this.value,i=t.scale,a=rv(i,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||uv(i,a,t.formatSpecifier,t.formatType,!!t.values),o=t.values?iv(i,t.values,a):av(i,a);return r&&(n.rem=r),r=o.map((function(t,e){return St({index:e/(o.length-1||1),value:t,label:u(t)})})),t.extra&&r.length&&r.push(St({index:-1,extra:{value:r[0].value},label:""})),n.source=r,n.add=r,this.value=r,n},rt(sv,Hr).transform=function(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),a=t.item||lv,o=t.key||Ct,s=this.value;return u(r.encode)&&(r.encode=null),s&&(t.modified("key")||e.modified(o))&&i("DataJoin does not support modified key function or fields."),s||(e=e.addAll(),this.value=s=et().test(cv),s.lookup=function(t){return s.get(o(t))}),e.visit(e.ADD,(function(t){var e=o(t),n=s.get(e);n?n.exit?(s.empty--,r.add.push(n)):r.mod.push(n):(s.set(e,n=a(t)),r.add.push(n)),n.datum=t,n.exit=!1})),e.visit(e.MOD,(function(t){var e=o(t),n=s.get(e);n&&(n.datum=t,r.mod.push(n))})),e.visit(e.REM,(function(t){var e=o(t),n=s.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++s.empty)})),e.changed(e.ADD_MOD)&&r.modifies("datum"),t.clean&&s.empty>n.cleanThreshold&&n.runAfter(s.clean),r},rt(fv,Hr).transform=function(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,a=e.encode;if(u(a)){if(!n.changed()&&!a.every((function(t){return i[t]})))return e.StopPropagation;a=a[0],n.encode=null}var o="enter"===a,s=i.update||v,l=i.enter||v,c=i.exit||v,f=(a&&!o?i[a]:s)||v;if(e.changed(e.ADD)&&(e.visit(e.ADD,(function(e){l(e,t),s(e,t)})),n.modifies(l.output),n.modifies(s.output),f!==v&&f!==s&&(e.visit(e.ADD,(function(e){f(e,t)})),n.modifies(f.output))),e.changed(e.REM)&&c!==v&&(e.visit(e.REM,(function(e){c(e,t)})),n.modifies(c.output)),o||f!==v){var h=e.MOD|(t.modified()?e.REFLOW:0);o?(e.visit(h,(function(e){var i=l(e,t)||r;(f(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(l.output)):e.visit(h,(function(e){(f(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(f.output)}return n.changed()?n:e.StopPropagation};const hv={quantile:"quantiles",quantize:"thresholds",threshold:"domain"},dv={quantile:"quantiles",quantize:"domain"};function pv(t,e){return t.bins?function(t){const e=t.slice(0,-1);return e.max=k(t),e}(t.bins):t.type===Td?function(t,e){var n=av(t,e),r=t.base(),i=Math.log(r),a=Math.max(1,r*e/n.length);return n.filter(t=>{var e=t/Math.pow(r,Math.round(Math.log(t)/i));return e*r1?r[1]-r[0]:r[0];for(n=1;nf?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),s=g.slice(0,f-1),u=!0):s=g,W(i=t.size)?(t.values||0!==c(s[0])||(s=s.slice(1)),a=s.reduce((function(e,n){return Math.max(e,i(n,t))}),0)):i=V(a=i||8),s=s.map((function(e,n){return St({index:n,label:p(e,n,s),value:e,offset:a,size:i(e,t)})})),u&&(u=g[s.length],s.push(St({index:s.length,label:`…${g.length-s.length} entries`,value:u,offset:a,size:i(u,t)})))):"gradient"===l?(n=c.domain(),r=Jm(c,n[0],k(n)),g.length<3&&!t.values&&n[0]!==k(n)&&(g=[n[0],k(n)]),s=g.map((function(t,e){return St({index:e,label:p(t,e,g),value:t,perc:r(t)})}))):(i=g.length-1,r=function(t){var e=t.domain(),n=e.length-1,r=+e[0],i=+k(e),a=i-r;if("threshold"===t.type){var u=n?a/n:.1;a=(i+=u)-(r-=u)}return function(t){return(t-r)/a}}(c),s=g.map((function(t,e){return St({index:e,label:p(t,e,g),value:t,perc:e?r(t):0,perc2:e===i?1:r(g[e+1])})}))),o.source=s,o.add=s,this.value=s,o};var _v=et({line:Mv,"line-radial":function(t,e,n,r){return Mv(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},arc:Ev,"arc-radial":function(t,e,n,r){return Ev(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},curve:Dv,"curve-radial":function(t,e,n,r){return Dv(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n))},"orthogonal-horizontal":function(t,e,n,r){return"M"+t+","+e+"V"+r+"H"+n},"orthogonal-vertical":function(t,e,n,r){return"M"+t+","+e+"H"+n+"V"+r},"orthogonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(n),o=Math.sin(n),s=Math.abs(n-t)>Math.PI?n<=t:n>t;return"M"+e*i+","+e*a+"A"+e+","+e+" 0 0,"+(s?1:0)+" "+e*u+","+e*o+"L"+r*u+","+r*o},"diagonal-horizontal":function(t,e,n,r){var i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":function(t,e,n,r){var i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":function(t,e,n,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(n),o=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*a+"C"+s*i+","+s*a+" "+s*u+","+s*o+" "+r*u+","+r*o}});function xv(t){return t.source.x}function bv(t){return t.source.y}function wv(t){return t.target.x}function Av(t){return t.target.y}function kv(t){Hr.call(this,{},t)}function Mv(t,e,n,r){return"M"+t+","+e+"L"+n+","+r}function Ev(t,e,n,r){var i=n-t,a=r-e,u=Math.sqrt(i*i+a*a)/2;return"M"+t+","+e+"A"+u+","+u+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+n+","+r}function Dv(t,e,n,r){var i=n-t,a=r-e,u=.2*(i+a),o=.2*(a-i);return"M"+t+","+e+"C"+(t+u)+","+(e+o)+" "+(n+o)+","+(r-u)+" "+n+","+r}function Cv(t){Hr.call(this,null,t)}kv.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"}]},rt(kv,Hr).transform=function(t,e){var n=t.sourceX||xv,r=t.sourceY||bv,a=t.targetX||wv,u=t.targetY||Av,o=t.as||"path",s=t.orient||"vertical",l=t.shape||"line",c=_v.get(l+"-"+s)||_v.get(l);return c||i("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(function(t){t[o]=c(n(t),r(t),a(t),u(t))})),e.reflow(t.modified()).modifies(o)},Cv.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"]}]},rt(Cv,Hr).transform=function(t,e){var n,r,i,a=t.as||["startAngle","endAngle"],u=a[0],o=a[1],s=t.field||g,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(s),d=h.length,p=l,m=(c-l)/wi(h),v=li(d);for(t.sort&&v.sort((function(t,e){return h[t]-h[e]})),n=0;n0?1:0)}),0))!==e.length&&n.warn("Log scale domain includes zero: "+l(e)));return e}function Tv(t,e,n){return W(t)&&(e||n)?Vm(t,Nv(e||[0,1],n)):t}function Nv(t,e){return e?t.slice().reverse():t}function Ov(t){Hr.call(this,null,t)}rt(Bv,Hr).transform=function(t,e){var n=e.dataflow,r=this.value,a=function(t){var e,n=t.type,r="";if("sequential"===n)return"sequential-linear";(function(t){const e=t.type;return Pm(e)&&"time"!==e&&e!==Nd&&(t.scheme||t.range&&t.range.length&&t.range.every(s))})(t)&&(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0,r=2===e?"sequential-":3===e?"diverging-":"");return(r+n||"linear").toLowerCase()}(t);for(a in r&&a===r.type||(this.value=r=qm(a)()),t)if(!Sv[a]){if("padding"===a&&Fv(r.type))continue;W(r[a])?r[a](t[a]):n.warn("Unsupported scale property: "+a)}return function(t,e,n){var r=t.type,a=e.round||!1,o=e.range;if(null!=e.rangeStep)o=function(t,e,n){"band"!==t&&"point"!==t&&i("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,a="point"===t?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*zd(n,a,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,a,o=e.schemeExtent;u(e.scheme)?a=Gm(e.scheme,e.interpolate,e.interpolateGamma):(r=e.scheme.toLowerCase(),(a=ev(r))||i(`Unrecognized scheme name: ${e.scheme}`));return n="threshold"===t?n+1:"bin-ordinal"===t?n-1:"quantile"===t||"quantize"===t?+e.schemeCount||5:n,Hm(t)?Tv(a,o,e.reverse):W(a)?Xm(Tv(a,o),n):"ordinal"===t?a:a.slice(0,n)}(r,e,n),W(o))){if(t.interpolator)return t.interpolator(o);i(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&Hm(r))return t.interpolator(Gm(Nv(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate(Zm(e.interpolate,e.interpolateGamma)):W(t.round)?t.round(a):W(t.rangeRound)&&t.interpolate(a?lg:sg);o&&t.range(Nv(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!u(r)){let e=t.domain(),n=e[0],a=k(e),u=null==r.start?n:r.start,o=null==r.stop?a:r.stop,s=r.step;s||i("Scale bins parameter missing step property."),ua&&(o=s*Math.floor(a/s)),r=li(u,o+s/2,s)}r?t.bins=r:t.bins&&delete t.bins;"bin-ordinal"===t.type&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){var r=function(t,e,n){return e?(t.domain(zv(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,a,u=e.domain,o=t.type,s=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&("linear"===e||"pow"===e||"sqrt"===e)}(t);if(!u)return 0;Fv(o)&&e.padding&&u[0]!==k(u)&&(u=function(t,e,n,r,i,a){var u=Math.abs(k(n)-n[0]),o=u/(u-2*r),s=t===Td?U(e,null,o):"sqrt"===t?L(e,null,o,.5):"pow"===t?L(e,null,o,i||1):"symlog"===t?P(e,null,o,a||1):q(e,null,o);return(e=e.slice())[0]=s[0],e[e.length-1]=s[1],e}(o,u,e.range,e.padding,e.exponent,e.constant));(s||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(u=u.slice()).length-1||1,s&&(u[0]>0&&(u[0]=0),u[i]<0&&(u[i]=0)),null!=e.domainMin&&(u[0]=e.domainMin),null!=e.domainMax&&(u[i]=e.domainMax),null!=e.domainMid&&(((a=e.domainMid)u[i])&&n.warn("Scale domainMid exceeds domain min or max.",a),u.splice(i,0,a)));t.domain(zv(o,u,n)),"ordinal"===o&&t.unknown(e.domainImplicit?Ud:void 0);e.nice&&t.nice&&t.nice(!0!==e.nice&&rv(t,e.nice)||null);return u.length}(r,t,n))),e.fork(e.NO_SOURCE|e.NO_FIELDS)},rt(Ov,Hr).transform=function(t,e){var n=t.modified("sort")||e.changed(e.ADD)||e.modified(t.sort.fields)||e.modified("datum");return n&&e.source.sort(Nt(t.sort)),this.modified(n),e};var Rv=["y0","y1"];function qv(t){Hr.call(this,null,t)}function Uv(t,e,n,r,i){for(var a,u=(e-t.sum)/2,o=t.length,s=0;sh&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,a=n.max;ra(t,e))}function a(r,i){var a=[],o=[];return function(n,r,i){var a,o,s,l,c,f,h=new Array,d=new Array;a=o=-1,l=n[0]>=r,Iv[l<<1].forEach(p);for(;++a=r,Iv[s|l<<1].forEach(p);Iv[l<<0].forEach(p);for(;++o=r,c=n[o*t]>=r,Iv[l<<1|c<<2].forEach(p);++a=r,f=c,c=n[o*t+a+1]>=r,Iv[s|l<<1|c<<2|f<<3].forEach(p);Iv[l|c<<3].forEach(p)}a=-1,c=n[o*t]>=r,Iv[c<<2].forEach(p);for(;++a=r,Iv[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+a,t[0][1]+o],s=[t[1][0]+a,t[1][1]+o],l=u(r),c=u(s);(e=d[l])?(n=h[c])?(delete d[e.end],delete h[n.start],e===n?(e.ring.push(s),i(e.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(s),d[e.end=c]=e):(e=h[c])?(n=d[l])?(delete h[e.start],delete d[n.end],e===n?(e.ring.push(s),i(e.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(r),h[e.start=l]=e):h[l]=d[c]={start:l,end:c,ring:[r,s]}}Iv[c<<3].forEach(p)}(r,i,(function(t){n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e0?a.push([t]):o.push(t)})),o.forEach((function(t){for(var e,n=0,r=a.length;n0&&u0&&o0&&u>0||i("invalid size"),t=a,e=u,r},r.smooth=function(t){return arguments.length?(n=t?o:jv,r):n===o},r}function Wv(t,e){for(var n,r=-1,i=e.length;++rr!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function Vv(t,e,n){var r,i,a,u;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],a=n[r],u=e[r],i<=a&&a<=u||u<=a&&a<=i)}function Gv(t,e,n){return function(r){var i=J(r),a=n?Math.min(i[0],0):i[0],u=i[1],o=u-a,s=e?gi(a,u,t):o/(t+1);return li(s,u,s)}}function Xv(t){Hr.call(this,null,t)}function Jv(t,e,n,r,i){const a=t.x1||0,u=t.y1||0,o=e*n<0;function s(t){t.forEach(l)}function l(t){o&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-a)*e+r,t[1]=(t[1]-u)*n+i}return function(t){return t.coordinates.forEach(s),t}}function Zv(t,e,n){const r=t>=0?t:Mi(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function Qv(t){return W(t)?t:V(+t)}function Kv(){var t=t=>t[0],e=t=>t[1],n=g,r=[-1,-1],a=960,u=500,o=2;function s(i,s){const l=Zv(r[0],i,t)>>o,c=Zv(r[1],i,e)>>o,f=l?l+2:0,h=c?c+2:0,d=2*f+(a>>o),p=2*h+(u>>o),g=new Float32Array(d*p),m=new Float32Array(d*p);let v=g;i.forEach(r=>{const i=f+(+t(r)>>o),a=h+(+e(r)>>o);i>=0&&i=0&&a0&&c>0?(ty(d,p,g,m,l),ey(d,p,m,g,c),ty(d,p,g,m,l),ey(d,p,m,g,c),ty(d,p,g,m,l),ey(d,p,m,g,c)):l>0?(ty(d,p,g,m,l),ty(d,p,m,g,l),ty(d,p,g,m,l),v=m):c>0&&(ey(d,p,g,m,c),ey(d,p,m,g,c),ey(d,p,g,m,c),v=m);let y=s?Math.pow(2,-2*o):1/wi(v);for(let t=0,e=d*p;t>o),y2:h+(u>>o)}}return s.x=function(e){return arguments.length?(t=Qv(e),s):t},s.y=function(t){return arguments.length?(e=Qv(t),s):e},s.weight=function(t){return arguments.length?(n=Qv(t),s):n},s.size=function(t){if(!arguments.length)return[a,u];var e=Math.ceil(t[0]),n=Math.ceil(t[1]);return e>=0||e>=0||i("invalid size"),a=e,u=n,s},s.cellSize=function(t){return arguments.length?((t=+t)>=1||i("invalid cell size"),o=Math.floor(Math.log(t)/Math.LN2),s):1<=i&&(e>=a&&(o-=n[e-a+u*t]),r[e-i+u*t]=o/Math.min(e+1,t-1+a-e,a))}function ey(t,e,n,r,i){const a=1+(i<<1);for(let u=0;u=i&&(o>=a&&(s-=n[u+(o-a)*t]),r[u+(o-i)*t]=s/Math.min(o+1,e-1+a-o,a))}function ny(t){Hr.call(this,null,t)}Xv.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"}]},rt(Xv,Hr).transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||d,a=Hv().smooth(!1!==t.smooth),o=t.thresholds||function(t,e,n){const r=Gv(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map(t=>mi(e(t).values)))}(r,i,t),s=null===t.as?null:t.as||"contour",l=[];return r.forEach(e=>{const n=i(e),r=a.size([n.width,n.height])(n.values,u(o)?o:o(n.values));!function(t,e,n,r){let i=r.scale||e.scale,a=r.translate||e.translate;W(i)&&(i=i(n,r));W(a)&&(a=a(n,r));if((1===i||null==i)&&!a)return;const u=(ot(i)?i:i[0])||1,o=(ot(i)?i:i[1])||1,s=a&&a[0]||0,l=a&&a[1]||0;t.forEach(Jv(e,u,o,s,l))}(r,n,e,t),r.forEach(t=>{l.push(zt(e,St(null!=s?{[s]:t}:t)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=l,n},ny.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"}]};var ry=rt(ny,Hr);const iy=["x","y","weight","size","cellSize","bandwidth"];function ay(t,e){return iy.forEach(n=>null!=e[n]?t[n](e[n]):0),t}function uy(t){Hr.call(this,null,t)}ry.transform=function(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),a=function(t,e){var n,r,i,a,u,o,s=[],l=t=>t(a);if(null==e)s.push(t);else for(n={},r=0,i=t.length;rSt(function(t,e){for(let n=0;n0?1:t<0?-1:0},Cy=Math.sqrt,Fy=Math.tan;function Sy(t){return t>1?0:t<-1?hy:Math.acos(t)}function By(t){return t>1?dy:t<-1?-dy:Math.asin(t)}function zy(){}function Ty(t,e){t&&Oy.hasOwnProperty(t.type)&&Oy[t.type](t,e)}var Ny={Feature:function(t,e){Ty(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,a=by(e=(e*=vy)/2+py),u=Ey(e),o=Iy*u,s=jy*a+o*by(i),l=o*r*Ey(i);Hy.add(xy(l,s)),$y=t,jy=a,Iy=u}function Zy(t){return[xy(t[1],t[0]),By(t[2])]}function Qy(t){var e=t[0],n=t[1],r=by(n);return[r*by(e),r*Ey(e),Ey(n)]}function Ky(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function t_(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function e_(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function n_(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function r_(t){var e=Cy(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var i_,a_,u_,o_,s_,l_,c_,f_,h_,d_,p_,g_,m_,v_,y_,__,x_,b_,w_,A_,k_,M_,E_,D_,C_,F_,S_=sy(),B_={point:z_,lineStart:N_,lineEnd:O_,polygonStart:function(){B_.point=R_,B_.lineStart=q_,B_.lineEnd=U_,S_.reset(),Yy.polygonStart()},polygonEnd:function(){Yy.polygonEnd(),B_.point=z_,B_.lineStart=N_,B_.lineEnd=O_,Hy<0?(i_=-(u_=180),a_=-(o_=90)):S_>1e-6?o_=90:S_<-1e-6&&(a_=-90),d_[0]=i_,d_[1]=u_},sphere:function(){i_=-(u_=180),a_=-(o_=90)}};function z_(t,e){h_.push(d_=[i_=t,u_=t]),eo_&&(o_=e)}function T_(t,e){var n=Qy([t*vy,e*vy]);if(f_){var r=t_(f_,n),i=t_([r[1],-r[0],0],r);r_(i),i=Zy(i);var a,u=t-s_,o=u>0?1:-1,s=i[0]*my*o,l=yy(u)>180;l^(o*s_o_&&(o_=a):l^(o*s_<(s=(s+360)%360-180)&&so_&&(o_=e)),l?tL_(i_,u_)&&(u_=t):L_(t,u_)>L_(i_,u_)&&(i_=t):u_>=i_?(tu_&&(u_=t)):t>s_?L_(i_,t)>L_(i_,u_)&&(u_=t):L_(t,u_)>L_(i_,u_)&&(i_=t)}else h_.push(d_=[i_=t,u_=t]);eo_&&(o_=e),f_=n,s_=t}function N_(){B_.point=T_}function O_(){d_[0]=i_,d_[1]=u_,B_.point=z_,f_=null}function R_(t,e){if(f_){var n=t-s_;S_.add(yy(n)>180?n+(n>0?360:-360):n)}else l_=t,c_=e;Yy.point(t,e),T_(t,e)}function q_(){Yy.lineStart()}function U_(){R_(l_,c_),Yy.lineEnd(),yy(S_)>1e-6&&(i_=-(u_=180)),d_[0]=i_,d_[1]=u_,f_=null}function L_(t,e){return(e-=t)<0?e+360:e}function P_(t,e){return t[0]-e[0]}function $_(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ehy?t+Math.round(-t/gy)*gy:t,e]}function ex(t,e,n){return(t%=gy)?e||n?K_(rx(t),ix(e,n)):rx(t):e||n?ix(e,n):tx}function nx(t){return function(e,n){return[(e+=t)>hy?e-gy:e<-hy?e+gy:e,n]}}function rx(t){var e=nx(t);return e.invert=nx(-t),e}function ix(t,e){var n=by(t),r=Ey(t),i=by(e),a=Ey(e);function u(t,e){var u=by(e),o=by(t)*u,s=Ey(t)*u,l=Ey(e),c=l*n+o*r;return[xy(s*i-c*a,o*n-l*r),By(c*i+s*a)]}return u.invert=function(t,e){var u=by(e),o=by(t)*u,s=Ey(t)*u,l=Ey(e),c=l*i-s*a;return[xy(s*i+l*a,o*n+c*r),By(c*n-o*r)]},u}function ax(t,e){(e=Qy(e))[0]-=t,r_(e);var n=Sy(-e[1]);return((-e[2]<0?-n:n)+gy-1e-6)%gy}function ux(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:zy,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function ox(t,e){return yy(t[0]-e[0])<1e-6&&yy(t[1]-e[1])<1e-6}function sx(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function lx(t,e,n,r,i){var a,u,o=[],s=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],u=t[e];if(ox(r,u)){for(i.lineStart(),a=0;a=0;--a)i.point((c=l[a])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function cx(t){if(e=t.length){for(var e,n,r=0,i=t[0];++re?1:t>=e?0:NaN}!function(t){var e;1===t.length&&(e=t,t=function(t,n){return dx(e(t),n)})}(dx);function px(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),a=new Array(i);++r=0;)for(e=(r=t[i]).length;--e>=0;)n[--u]=r[e];return n}function mx(t,e,n,r){return function(i){var a,u,o,s=e(i),l=ux(),c=e(l),f=!1,h={point:d,lineStart:g,lineEnd:m,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=_,u=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=m,u=gx(u);var t=function(t,e){var n=hx(e),r=e[1],i=Ey(r),a=[Ey(n),-by(n),0],u=0,o=0;fx.reset(),1===i?r=dy+1e-6:-1===i&&(r=-dy-1e-6);for(var s=0,l=t.length;s=0?1:-1,M=k*A,E=M>hy,D=g*b;if(fx.add(xy(D*k*Ey(M),m*w+D*by(M))),u+=E?A+k*gy:A,E^d>=n^_>=n){var C=t_(Qy(h),Qy(y));r_(C);var F=t_(a,C);r_(F);var S=(E^A>=0?-1:1)*By(F[2]);(r>S||r===S&&(C[0]||C[1]))&&(o+=E^A>=0?1:-1)}}return(u<-1e-6||u<1e-6&&fx<-1e-6)^1&o}(a,r);u.length?(f||(i.polygonStart(),f=!0),lx(u,yx,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),u=a=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){s.point(t,e)}function g(){h.point=p,s.lineStart()}function m(){h.point=d,s.lineEnd()}function v(t,e){o.push([t,e]),c.point(t,e)}function y(){c.lineStart(),o=[]}function _(){v(o[0][0],o[0][1]),c.lineEnd();var t,e,n,r,s=c.clean(),h=l.result(),d=h.length;if(o.pop(),a.push(o),o=null,d)if(1&s){if((e=(n=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t1&&2&s&&h.push(h.pop().concat(h.shift())),u.push(h.filter(vx))}return h}}function vx(t){return t.length>1}function yx(t,e){return((t=t.x)[0]<0?t[1]-dy-1e-6:dy-t[1])-((e=e.x)[0]<0?e[1]-dy-1e-6:dy-e[1])}var _x=mx((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,u){var o=a>0?hy:-hy,s=yy(a-n);yy(s-hy)<1e-6?(t.point(n,r=(r+u)/2>0?dy:-dy),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(a,r),e=0):i!==o&&s>=hy&&(yy(n-i)<1e-6&&(n-=1e-6*i),yy(a-o)<1e-6&&(a-=1e-6*o),r=function(t,e,n,r){var i,a,u=Ey(t-n);return yy(u)>1e-6?_y((Ey(e)*(a=by(r))*Ey(n)-Ey(r)*(i=by(e))*Ey(t))/(i*a*u)):(e+r)/2}(n,r,a,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),e=0),t.point(n=a,r=u),i=o},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*dy,r.point(-hy,i),r.point(0,i),r.point(hy,i),r.point(hy,0),r.point(hy,-i),r.point(0,-i),r.point(-hy,-i),r.point(-hy,0),r.point(-hy,i);else if(yy(t[0]-e[0])>1e-6){var a=t[0]0,i=yy(e)>1e-6;function a(t,n){return by(t)*by(n)>e}function u(t,n,r){var i=[1,0,0],a=t_(Qy(t),Qy(n)),u=Ky(a,a),o=a[0],s=u-o*o;if(!s)return!r&&t;var l=e*u/s,c=-e*o/s,f=t_(i,a),h=n_(i,l);e_(h,n_(a,c));var d=f,p=Ky(h,d),g=Ky(d,d),m=p*p-g*(Ky(h,h)-1);if(!(m<0)){var v=Cy(m),y=n_(d,(-p-v)/g);if(e_(y,h),y=Zy(y),!r)return y;var _,x=t[0],b=n[0],w=t[1],A=n[1];b0^y[1]<(yy(y[0]-x)<1e-6?w:A):w<=y[1]&&y[1]<=A:k>hy^(x<=y[0]&&y[0]<=b)){var E=n_(d,(-p+v)/g);return e_(E,h),[y,Zy(E)]}}}function o(e,n){var i=r?t:hy-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return mx(a,(function(t){var e,n,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],g=a(f,h),m=r?g?0:o(f,h):g?o(f+(f<0?hy:-hy),h):0;if(!e&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=u(e,p))||ox(e,d)||ox(p,d))&&(p[0]+=1e-6,p[1]+=1e-6,g=a(p[0],p[1])),g!==s)c=0,g?(t.lineStart(),d=u(p,e),t.point(d[0],d[1])):(d=u(e,p),t.point(d[0],d[1]),t.lineEnd()),e=d;else if(i&&e&&r^g){var v;m&n||!(v=u(p,e,!0))||(c=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!g||e&&ox(e,p)||t.point(p[0],p[1]),e=p,s=g,n=m},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return c|(l&&s)<<1}}}),(function(e,r,i,a){!function(t,e,n,r,i,a){if(n){var u=by(e),o=Ey(e),s=r*n;null==i?(i=e+r*gy,a=e-s/2):(i=ax(u,i),a=ax(u,a),(r>0?ia)&&(i+=r*gy));for(var l,c=i;r>0?c>a:c0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+o+4)%4)!==f);else l.point(a[0],a[1])}function u(r,i){return yy(r[0]-t)<1e-6?i>0?0:3:yy(r[0]-n)<1e-6?i>0?2:1:yy(r[1]-e)<1e-6?i>0?1:0:i>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var n=u(t,1),r=u(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(u){var s,l,c,f,h,d,p,g,m,v,y,_=u,x=ux(),b={point:w,lineStart:function(){b.point=A,l&&l.push(c=[]);v=!0,m=!1,p=g=NaN},lineEnd:function(){s&&(A(f,h),d&&m&&x.rejoin(),s.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],y=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(h-a)*(r-u)>(d-u)*(t-a)&&++e:d<=r&&(h-a)*(r-u)<(d-u)*(t-a)&&--e;return e}(),n=y&&e,i=(s=gx(s)).length;(n||i)&&(u.polygonStart(),n&&(u.lineStart(),a(null,null,1,u),u.lineEnd()),i&&lx(s,o,e,a,u),u.polygonEnd());_=u,s=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function A(a,u){var o=i(a,u);if(l&&c.push([a,u]),v)f=a,h=u,d=o,v=!1,o&&(_.lineStart(),_.point(a,u));else if(o&&m)_.point(a,u);else{var s=[p=Math.max(-1e9,Math.min(1e9,p)),g=Math.max(-1e9,Math.min(1e9,g))],x=[a=Math.max(-1e9,Math.min(1e9,a)),u=Math.max(-1e9,Math.min(1e9,u))];!function(t,e,n,r,i,a){var u,o=t[0],s=t[1],l=0,c=1,f=e[0]-o,h=e[1]-s;if(u=n-o,f||!(u>0)){if(u/=f,f<0){if(u0){if(u>c)return;u>l&&(l=u)}if(u=i-o,f||!(u<0)){if(u/=f,f<0){if(u>c)return;u>l&&(l=u)}else if(f>0){if(u0)){if(u/=h,h<0){if(u0){if(u>c)return;u>l&&(l=u)}if(u=a-s,h||!(u<0)){if(u/=h,h<0){if(u>c)return;u>l&&(l=u)}else if(h>0){if(u0&&(t[0]=o+l*f,t[1]=s+l*h),c<1&&(e[0]=o+c*f,e[1]=s+c*h),!0}}}}}(s,x,t,e,n,r)?o&&(_.lineStart(),_.point(a,u),y=!1):(m||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),o||_.lineEnd(),y=!1)}p=a,g=u,m=o}return b}}function wx(t,e,n){var r=px(t,e-1e-6,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function Ax(t,e,n){var r=px(t,e-1e-6,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}function kx(t){return t}var Mx,Ex,Dx,Cx,Fx=sy(),Sx=sy(),Bx={point:zy,lineStart:zy,lineEnd:zy,polygonStart:function(){Bx.lineStart=zx,Bx.lineEnd=Ox},polygonEnd:function(){Bx.lineStart=Bx.lineEnd=Bx.point=zy,Fx.add(yy(Sx)),Sx.reset()},result:function(){var t=Fx/2;return Fx.reset(),t}};function zx(){Bx.point=Tx}function Tx(t,e){Bx.point=Nx,Mx=Dx=t,Ex=Cx=e}function Nx(t,e){Sx.add(Cx*t-Dx*e),Dx=t,Cx=e}function Ox(){Nx(Mx,Ex)}var Rx=1/0,qx=Rx,Ux=-Rx,Lx=Ux,Px={point:function(t,e){tUx&&(Ux=t);eLx&&(Lx=e)},lineStart:zy,lineEnd:zy,polygonStart:zy,polygonEnd:zy,result:function(){var t=[[Rx,qx],[Ux,Lx]];return Ux=Lx=-(qx=Rx=1/0),t}};var $x,jx,Ix,Hx,Wx=0,Yx=0,Vx=0,Gx=0,Xx=0,Jx=0,Zx=0,Qx=0,Kx=0,tb={point:eb,lineStart:nb,lineEnd:ab,polygonStart:function(){tb.lineStart=ub,tb.lineEnd=ob},polygonEnd:function(){tb.point=eb,tb.lineStart=nb,tb.lineEnd=ab},result:function(){var t=Kx?[Zx/Kx,Qx/Kx]:Jx?[Gx/Jx,Xx/Jx]:Vx?[Wx/Vx,Yx/Vx]:[NaN,NaN];return Wx=Yx=Vx=Gx=Xx=Jx=Zx=Qx=Kx=0,t}};function eb(t,e){Wx+=t,Yx+=e,++Vx}function nb(){tb.point=rb}function rb(t,e){tb.point=ib,eb(Ix=t,Hx=e)}function ib(t,e){var n=t-Ix,r=e-Hx,i=Cy(n*n+r*r);Gx+=i*(Ix+t)/2,Xx+=i*(Hx+e)/2,Jx+=i,eb(Ix=t,Hx=e)}function ab(){tb.point=eb}function ub(){tb.point=sb}function ob(){lb($x,jx)}function sb(t,e){tb.point=lb,eb($x=Ix=t,jx=Hx=e)}function lb(t,e){var n=t-Ix,r=e-Hx,i=Cy(n*n+r*r);Gx+=i*(Ix+t)/2,Xx+=i*(Hx+e)/2,Jx+=i,Zx+=(i=Hx*t-Ix*e)*(Ix+t),Qx+=i*(Hx+e),Kx+=3*i,eb(Ix=t,Hx=e)}function cb(t){this._context=t}cb.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,gy)}},result:zy};var fb,hb,db,pb,gb,mb=sy(),vb={point:zy,lineStart:function(){vb.point=yb},lineEnd:function(){fb&&_b(hb,db),vb.point=zy},polygonStart:function(){fb=!0},polygonEnd:function(){fb=null},result:function(){var t=+mb;return mb.reset(),t}};function yb(t,e){vb.point=_b,hb=pb=t,db=gb=e}function _b(t,e){pb-=t,gb-=e,mb.add(Cy(pb*pb+gb*gb)),pb=t,gb=e}function xb(){this._string=[]}function bb(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function wb(t,e){var n,r,i=4.5;function a(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),Uy(t,n(r))),r.result()}return a.area=function(t){return Uy(t,n(Bx)),Bx.result()},a.measure=function(t){return Uy(t,n(vb)),vb.result()},a.bounds=function(t){return Uy(t,n(Px)),Px.result()},a.centroid=function(t){return Uy(t,n(tb)),tb.result()},a.projection=function(e){return arguments.length?(n=null==e?(t=null,kx):(t=e).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(e=null,new xb):new cb(e=t),"function"!=typeof i&&r.pointRadius(i),a):e},a.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),a):i},a.projection(t).context(e)}function Ab(t){return function(e){var n=new kb;for(var r in t)n[r]=t[r];return n.stream=e,n}}function kb(){}function Mb(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Uy(n,t.stream(Px)),e(Px.result()),null!=r&&t.clipExtent(r),t}function Eb(t,e,n){return Mb(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),u=+e[0][0]+(r-a*(n[1][0]+n[0][0]))/2,o=+e[0][1]+(i-a*(n[1][1]+n[0][1]))/2;t.scale(150*a).translate([u,o])}),n)}function Db(t,e,n){return Eb(t,[[0,0],e],n)}function Cb(t,e,n){return Mb(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,u=-i*n[0][1];t.scale(150*i).translate([a,u])}),n)}function Fb(t,e,n){return Mb(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],u=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([a,u])}),n)}xb.prototype={_radius:4.5,_circle:bb(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=bb(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},kb.prototype={constructor:kb,point:function(t,e){this.stream.point(t,e)},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()}};var Sb=by(30*vy);function Bb(t,e){return+e?function(t,e){function n(r,i,a,u,o,s,l,c,f,h,d,p,g,m){var v=l-r,y=c-i,_=v*v+y*y;if(_>4*e&&g--){var x=u+h,b=o+d,w=s+p,A=Cy(x*x+b*b+w*w),k=By(w/=A),M=yy(yy(w)-1)<1e-6||yy(a-f)<1e-6?(a+f)/2:xy(b,x),E=t(M,k),D=E[0],C=E[1],F=D-r,S=C-i,B=y*F-v*S;(B*B/_>e||yy((v*F+y*S)/_-.5)>.3||u*h+o*d+s*p2?t[2]%360*vy:0,D()):[m*my,v*my,y*my]},M.angle=function(t){return arguments.length?(_=t%360*vy,D()):_*my},M.precision=function(t){return arguments.length?(u=Bb(o,k=t*t),C()):Cy(k)},M.fitExtent=function(t,e){return Eb(M,t,e)},M.fitSize=function(t,e){return Db(M,t,e)},M.fitWidth=function(t,e){return Cb(M,t,e)},M.fitHeight=function(t,e){return Fb(M,t,e)},function(){return e=t.apply(this,arguments),M.invert=e.invert&&E,D()}}function qb(t){var e=0,n=hy/3,r=Rb(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*vy,n=t[1]*vy):[e*my,n*my]},i}function Ub(t,e){var n=Ey(t),r=(n+Ey(e))/2;if(yy(r)<1e-6)return function(t){var e=by(t);function n(t,n){return[t*e,Ey(n)/e]}return n.invert=function(t,n){return[t/e,By(n*e)]},n}(t);var i=1+n*(2*r-n),a=Cy(i)/r;function u(t,e){var n=Cy(i-2*r*Ey(e))/r;return[n*Ey(t*=r),a-n*by(t)]}return u.invert=function(t,e){var n=a-e;return[xy(t,yy(n))/r*Dy(n),By((i-(t*t+n*n)*r*r)/(2*r))]},u}function Lb(){return qb(Ub).scale(155.424).center([0,33.6442])}function Pb(){return Lb().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function $b(t){return function(e,n){var r=by(e),i=by(n),a=t(r*i);return[a*i*Ey(e),a*Ey(n)]}}function jb(t){return function(e,n){var r=Cy(e*e+n*n),i=t(r),a=Ey(i),u=by(i);return[xy(e*a,r*u),By(r&&n*a/r)]}}var Ib=$b((function(t){return Cy(2/(1+t))}));Ib.invert=jb((function(t){return 2*By(t/2)}));var Hb=$b((function(t){return(t=Sy(t))&&t/Ey(t)}));function Wb(t,e){return[t,ky(Fy((dy+e)/2))]}function Yb(t){var e,n,r,i=Ob(t),a=i.center,u=i.scale,o=i.translate,s=i.clipExtent,l=null;function c(){var a=hy*u(),o=i(function(t){function e(e){return(e=t(e[0]*vy,e[1]*vy))[0]*=my,e[1]*=my,e}return t=ex(t[0]*vy,t[1]*vy,t.length>2?t[2]*vy:0),e.invert=function(e){return(e=t.invert(e[0]*vy,e[1]*vy))[0]*=my,e[1]*=my,e},e}(i.rotate()).invert([0,0]));return s(null==l?[[o[0]-a,o[1]-a],[o[0]+a,o[1]+a]]:t===Wb?[[Math.max(o[0]-a,l),e],[Math.min(o[0]+a,n),r]]:[[l,Math.max(o[1]-a,e)],[n,Math.min(o[1]+a,r)]])}return i.scale=function(t){return arguments.length?(u(t),c()):u()},i.translate=function(t){return arguments.length?(o(t),c()):o()},i.center=function(t){return arguments.length?(a(t),c()):a()},i.clipExtent=function(t){return arguments.length?(null==t?l=e=n=r=null:(l=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,e],[n,r]]},c()}function Vb(t){return Fy((dy+t)/2)}function Gb(t,e){var n=by(t),r=t===e?Ey(t):ky(n/by(e))/ky(Vb(e)/Vb(t)),i=n*My(Vb(t),r)/r;if(!r)return Wb;function a(t,e){i>0?e<1e-6-dy&&(e=1e-6-dy):e>dy-1e-6&&(e=dy-1e-6);var n=i/My(Vb(e),r);return[n*Ey(r*t),i-n*by(r*t)]}return a.invert=function(t,e){var n=i-e,a=Dy(r)*Cy(t*t+n*n);return[xy(t,yy(n))/r*Dy(n),2*_y(My(i/a,1/r))-dy]},a}function Xb(t,e){return[t,e]}function Jb(t,e){var n=by(t),r=t===e?Ey(t):(n-by(e))/(e-t),i=n/r+t;if(yy(r)<1e-6)return Xb;function a(t,e){var n=i-e,a=r*t;return[n*Ey(a),i-n*by(a)]}return a.invert=function(t,e){var n=i-e;return[xy(t,yy(n))/r*Dy(n),i-Dy(r)*Cy(t*t+n*n)]},a}Hb.invert=jb((function(t){return t})),Wb.invert=function(t,e){return[t,2*_y(Ay(e))-dy]},Xb.invert=Xb;var Zb=1.340264,Qb=-.081106,Kb=893e-6,tw=.003796,ew=Cy(3)/2;function nw(t,e){var n=By(ew*Ey(e)),r=n*n,i=r*r*r;return[t*by(n)/(ew*(Zb+3*Qb*r+i*(7*Kb+9*tw*r))),n*(Zb+Qb*r+i*(Kb+tw*r))]}function rw(t,e){var n=by(e),r=by(t)*n;return[n*Ey(t)/r,Ey(e)/r]}function iw(t,e,n,r){return 1===t&&1===e&&0===n&&0===r?kx:Ab({point:function(i,a){this.stream.point(i*t+n,a*e+r)}})}function aw(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function uw(t,e){return[by(e)*Ey(t),Ey(e)]}function ow(t,e){var n=by(e),r=1+by(t)*n;return[n*Ey(t)/r,Ey(e)/r]}function sw(t,e){return[ky(Fy((dy+e)/2)),-t]}nw.invert=function(t,e){for(var n,r=e,i=r*r,a=i*i*i,u=0;u<12&&(a=(i=(r-=n=(r*(Zb+Qb*i+a*(Kb+tw*i))-e)/(Zb+3*Qb*i+a*(7*Kb+9*tw*i)))*r)*i*i,!(yy(n)<1e-12));++u);return[ew*t*(Zb+3*Qb*i+a*(7*Kb+9*tw*i))/by(r),By(Ey(r)/ew)]},rw.invert=jb(_y),aw.invert=function(t,e){var n,r=e,i=25;do{var a=r*r,u=a*a;r-=n=(r*(1.007226+a*(.015085+u*(.028874*a-.044475-.005916*u)))-e)/(1.007226+a*(.045255+u*(.259866*a-.311325-.005916*11*u)))}while(yy(n)>1e-6&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},uw.invert=jb(By),ow.invert=jb((function(t){return 2*_y(t)})),sw.invert=function(t,e){return[-e,2*_y(Ay(t))-dy]};var lw=Math.abs,cw=Math.cos,fw=Math.sin,hw=Math.PI,dw=hw/2,pw=function(t){return t>0?Math.sqrt(t):0}(2);function gw(t){return t>1?dw:t<-1?-dw:Math.asin(t)}function mw(t,e){var n,r=t*fw(e),i=30;do{e-=n=(e+fw(e)-r)/(1+cw(e))}while(lw(n)>1e-6&&--i>0);return e/2}var vw=function(t,e,n){function r(r,i){return[t*r*cw(i=mw(n,i)),e*fw(i)]}return r.invert=function(r,i){return i=gw(i/e),[r/(t*cw(i)),gw((2*i+fw(2*i))/n)]},r}(pw/dw,pw,hw);var yw=wb(),_w=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function xw(t,e){return function n(){var r=e();return r.type=t,r.path=wb().projection(r),r.copy=r.copy||function(){var t=n();return _w.forEach((function(e){r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function bw(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(Aw[t]=xw(t,e),this):Aw[t]||null}function ww(t){return t&&t.path||yw}var Aw={albers:Pb,albersusa:function(){var t,e,n,r,i,a,u=Pb(),o=Lb().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Lb().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){a=[t,e]}};function c(t){var e=t[0],u=t[1];return a=null,n.point(e,u),a||(r.point(e,u),a)||(i.point(e,u),a)}function f(){return t=e=null,c}return c.invert=function(t){var e=u.scale(),n=u.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:u).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[u.stream(e=n),o.stream(n),s.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(var kw in Aw)bw(kw,Aw[kw]);function Mw(t){Hr.call(this,null,t)}function Ew(t){Hr.call(this,null,t)}function Dw(t){Hr.call(this,null,t)}function Cw(t){Hr.call(this,[],t),this.generator=function(){var t,e,n,r,i,a,u,o,s,l,c,f,h=10,d=h,p=90,g=360,m=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return px(wy(r/p)*p,n,p).map(c).concat(px(wy(o/g)*g,u,g).map(f)).concat(px(wy(e/h)*h,t,h).filter((function(t){return yy(t%p)>1e-6})).map(s)).concat(px(wy(a/d)*d,i,d).filter((function(t){return yy(t%g)>1e-6})).map(l))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(u).slice(1),c(n).reverse().slice(1),f(o).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],o=+t[0][1],u=+t[1][1],r>n&&(t=r,r=n,n=t),o>u&&(t=o,o=u,u=t),v.precision(m)):[[r,o],[n,u]]},v.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],a=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),a>i&&(n=a,a=i,i=n),v.precision(m)):[[e,a],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],v):[p,g]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(m=+h,s=wx(a,i,90),l=Ax(e,t,m),c=wx(o,u,90),f=Ax(r,n,m),v):m},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Fw(t){Hr.call(this,null,t)}function Sw(t){if(!W(t))return!1;const e=xt(r(t));return e.$x||e.$y||e.$value||e.$max}function Bw(t){Hr.call(this,null,t),this.modified(!0)}function zw(t,e,n){W(t[e])&&t[e](n)}Mw.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"}]},rt(Mw,Hr).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||d,a=t.as||"path",u=n.SOURCE;!r||t.modified()?(this.value=r=ww(t.projection),n.materialize().reflow()):u=i===d||e.modified(i.fields)?n.ADD_MOD:n.ADD;var o=function(t,e){var n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(u,(function(t){t[a]=r(i(t))})),r.pointRadius(o),n.modifies(a)},Ew.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"]}]},rt(Ew,Hr).transform=function(t,e){var n,r=t.projection,i=t.fields[0],a=t.fields[1],u=t.as||["x","y"],o=u[0],s=u[1];function l(t){var e=r([i(t),a(t)]);e?(t[o]=e[0],t[s]=e[1]):(t[o]=void 0,t[s]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(a.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(u)},Dw.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"}]},rt(Dw,Hr).transform=function(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",a=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){var r=null==n?function(n){return t(e(n))}:function(r){var i=t.pointRadius(),a=t.pointRadius(n)(e(r));return t.pointRadius(i),a};return r.context=function(e){return t.context(e),r},r}(ww(t.projection),t.field||c("datum"),t.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,(function(t){t[i]=r})),n.modifies(i)},Cw.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}]},rt(Cw,Hr).transform=function(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(var a in t)W(i[a])&&i[a](t[a]);return n=i(),r.length?e.mod.push(Tt(r[0],n)):e.add.push(St(n)),r[0]=n,e},Fw.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"}]},rt(Fw,Hr).transform=function(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||d,a=function(t,e){let n;W(t)?(n=n=>t(n,e),n.dep=Sw(t)):t?n=V(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),u=function(t,e){let n;W(t)?(n=n=>up(t(n,e)),n.dep=Sw(t)):n=V(up(t||"#888"));return n}(t.color,t),o=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?mi(n.map(t=>mi(i(t).values))):0};return n.forEach(t=>{const e=i(t),n=X({},t,s);r||(n.$max=mi(e.values||[])),t[o]=function(t,e,n,r){const i=t.width,a=t.height,u=t.x1||0,o=t.y1||0,s=t.x2||i,l=t.y2||a,c=t.values,f=c?t=>c[t]:p,h=Vo(s-u,l-o),d=h.getContext("2d"),g=d.getImageData(0,0,s-u,l-o),m=g.data;for(let t=o,a=0;tt.concat(function(t){return"FeatureCollection"===t.type?t.features:I(t).filter(t=>null!=t).map(t=>"Feature"===t.type?t:{type:"Feature",geometry:t})}(e)),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)};var Tw=Object.freeze({__proto__:null,contour:uy,geojson:oy,geopath:Mw,geopoint:Ew,geoshape:Dw,graticule:Cw,heatmap:Fw,isocontour:Xv,kde2d:ny,projection:Bw});function Nw(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,a,u,o,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(a=(g+v)/2))?g=a:v=a,(c=n>=(u=(m+y)/2))?m=u:y=u,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(o=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===o&&n===s)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e>=(a=(g+v)/2))?g=a:v=a,(c=n>=(u=(m+y)/2))?m=u:y=u}while((f=c<<1|l)==(h=(s>=u)<<1|o>=a));return i[h]=d,i[f]=p,t}function Ow(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function Rw(t){return t[0]}function qw(t){return t[1]}function Uw(t,e,n){var r=new Lw(null==e?Rw:e,null==n?qw:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function Lw(t,e,n,r,i,a){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function Pw(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var $w=Uw.prototype=Lw.prototype;function jw(t){return function(){return t}}function Iw(){return 1e-6*(Math.random()-.5)}function Hw(t){return t.x+t.vx}function Ww(t){return t.y+t.vy}function Yw(t){return t.index}function Vw(t,e){var n=t.get(e);if(!n)throw new Error("missing: "+e);return n}$w.copy=function(){var t,e,n=new Lw(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=Pw(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=Pw(e));return n},$w.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return Nw(this.cover(e,n),e,n,t)},$w.addAll=function(t){var e,n,r,i,a=t.length,u=new Array(a),o=new Array(a),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=r),if&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;nt||t>=i||r>e||e>=a;)switch(o=(eh||(a=s.y0)>d||(u=s.x1)=v)<<1|t>=m)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var y=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=y*y+_*_;if(x=(o=(p+m)/2))?p=o:m=o,(c=u>=(s=(g+v)/2))?g=s:v=s,e=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},$w.removeAll=function(t){for(var e=0,n=t.length;e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function Qw(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),a=0;a=0&&e._call.call(null,t),e=e._next;--nA}()}finally{nA=0,function(){var t,e,n=tA,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:tA=e);eA=t,mA(r)}(),uA=0}}function gA(){var t=sA.now(),e=t-aA;e>1e3&&(oA-=e,aA=t)}function mA(t){nA||(rA&&(rA=clearTimeout(rA)),t-uA>24?(t<1/0&&(rA=setTimeout(pA,t-sA.now()-oA)),iA&&(iA=clearInterval(iA))):(iA||(aA=sA.now(),iA=setInterval(gA,1e3)),nA=1,lA(pA)))}function vA(t){return t.x}function yA(t){return t.y}hA.prototype=dA.prototype={constructor:hA,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?cA():+n)+(null==e?0:+e),this._next||eA===this||(eA?eA._next=this:tA=this,eA=this),this._call=t,this._time=n,mA()},stop:function(){this._call&&(this._call=null,this._time=1/0,mA())}};var _A=Math.PI*(3-Math.sqrt(5));var xA={center:function(t,e){var n;function r(){var r,i,a=n.length,u=0,o=0;for(r=0;rs+d||il+d||ao.index){var p=s-u.x-u.vx,g=l-u.y-u.vy,m=p*p+g*g;mt.r&&(t.r=t[e].r)}function o(){if(e){var r,i,a=e.length;for(n=new Array(a),r=0;r=u)){(t.data!==e||t.next)&&(0===c&&(d+=(c=Iw())*c),0===f&&(d+=(f=Iw())*f),d[u(t,e,r),t]));for(o=0,i=new Array(l);o1?(null==n?o.delete(t):o.set(t,d(n)),e):o.get(t)},find:function(e,n,r){var i,a,u,o,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(t,n),e):l.on(t)}}}(t),r=!1,i=n.stop,a=n.restart;return n.stopped=function(){return r},n.restart=function(){return r=!1,a()},n.stop=function(){return r=!0,i()},EA(n,e,!0).on("end",(function(){r=!0}))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,function(){n.touch(r).run()})),t.static||(a=!0,i.tick()),e.modifies("index")),u||a||t.modified(wA)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/o)),t.static)for(i.stop();--o>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return e.StopPropagation;return this.finish(t,e)},MA.finish=function(t,e){for(var n,r=e.dataflow,i=this._argops,a=0,u=i.length;a=0;)e+=n[r].value;else e=1;t.value=e}function RA(t,e){var n,r,i,a,u,o=new PA(t),s=+t.value&&(o.value=t.value),l=[o];for(null==e&&(e=qA);n=l.pop();)if(s&&(n.value=+n.data.value),(i=e(n.data))&&(u=i.length))for(n.children=new Array(u),a=u-1;a>=0;--a)l.push(r=n.children[a]=new PA(i[a])),r.parent=n,r.depth=n.depth+1;return o.eachBefore(LA)}function qA(t){return t.children}function UA(t){t.data=t.data.data}function LA(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function PA(t){this.data=t,this.depth=this.height=0,this.parent=null}PA.prototype=RA.prototype={constructor:PA,count:function(){return this.eachAfter(OA)},each:function(t){var e,n,r,i,a=this,u=[a];do{for(e=u.reverse(),u=[];a=e.pop();)if(t(a),n=a.children)for(r=0,i=n.length;r=0;--n)i.push(e[n]);return this},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){var t=[];return this.each((function(e){t.push(e)})),t},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return RA(this).eachBefore(UA)}};var $A=Array.prototype.slice;function jA(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}($A.call(t))).length,a=[];r0&&n*n>r*r+i*i}function YA(t,e){for(var n=0;n(u*=u)?(r=(l+u-i)/(2*l),a=Math.sqrt(Math.max(0,u/l-r*r)),n.x=t.x-r*o-a*s,n.y=t.y-r*s+a*o):(r=(l+i-u)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*o-a*s,n.y=e.y+r*s+a*o)):(n.x=e.x+n.r,n.y=e.y)}function ZA(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function QA(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,a=(e.y*n.r+n.y*e.r)/r;return i*i+a*a}function KA(t){this._=t,this.next=null,this.previous=null}function tk(t){return null==t?null:ek(t)}function ek(t){if("function"!=typeof t)throw new Error;return t}function nk(){return 0}function rk(t){return function(){return t}}function ik(t){return Math.sqrt(t.value)}function ak(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function uk(t,e){return function(n){if(r=n.children){var r,i,a,u=r.length,o=t(n)*e||0;if(o)for(i=0;i1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;JA(n,e,r=t[2]),e=new KA(e),n=new KA(n),r=new KA(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(o=3;o0)throw new Error("cycle");return a}return n.id=function(e){return arguments.length?(t=ek(e),n):t},n.parentId=function(t){return arguments.length?(e=ek(t),n):e},n}function gk(t,e){return t.parent===e.parent?1:2}function mk(t){var e=t.children;return e?e[0]:t.t}function vk(t){var e=t.children;return e?e[e.length-1]:t.t}function yk(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function _k(t,e,n){return t.a.parent===e.parent?t.a:n}function xk(t,e){this._=t,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=e}function bk(t,e,n,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(i-n)/t.value;++oh&&(h=o),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=o;break}p=d}v.push(u={value:c,dice:s1?e:1)},n}(wk);var Mk=function t(e){function n(t,n,r,i,a){if((u=t._squarify)&&u.ratio===e)for(var u,o,s,l,c,f=-1,h=u.length,d=t.value;++f1?e:1)},n}(wk);function Ek(t){Hr.call(this,null,t)}function Dk(t){return t.values}function Ck(){var t,e=[];return t={entries:t=>function t(n,r){if(++r>e.length)return n;var i,a=[];for(i in n)a.push({key:i,values:t(n[i],r)});return a}(function t(n,r){if(r>=e.length)return n;for(var i,a,u,o=-1,s=n.length,l=e[r++],c={},f={};++o(e.push(n),t)}}function Fk(t){Hr.call(this,null,t)}function Sk(t,e){return t.parent===e.parent?1:2}Ek.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},rt(Ek,Hr).transform=function(t,e){e.source||i("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),a=e.clone(),u=this.value;return(!u||r||e.changed())&&(u&&u.each(t=>{t.children&&Dt(t.data)&&a.rem.push(t.data)}),this.value=u=RA({values:I(t.keys).reduce((t,e)=>(t.key(e),t),Ck()).entries(a.source)},Dk),n&&u.each(t=>{t.children&&(t=St(t.data),a.add.push(t),a.source.push(t))}),BA(u,Ct,Ct)),a.source.root=u,a},rt(Fk,Hr).transform=function(t,e){e.source&&e.source.root||i(this.constructor.name+" transform requires a backing tree data source.");var n=this.layout(t.method),r=this.fields,a=e.source.root,u=t.as||r;t.field?a.sum(t.field):a.count(),t.sort&&a.sort(Nt(t.sort,t=>t.data)),function(t,e,n){for(var r,i=0,a=e.length;i=0;--i)o.push(n=e.children[i]=new xk(r[i],i)),n.parent=e;return(u.parent=new xk(null,0)).children=[u],u}(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(u),r)i.eachBefore(o);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.xc.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function a(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,a=i.length;--a>=0;)(e=i[a]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var a=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-a):e.z=a}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,a=e,u=e,o=n,s=a.parent.children[0],l=a.m,c=u.m,f=o.m,h=s.m;o=vk(o),a=mk(a),o&&a;)s=mk(s),(u=vk(u)).a=e,(i=o.z+f-a.z-l+t(o._,a._))>0&&(yk(_k(o,e,r),e,i),l+=i,c+=i),f+=o.m,l+=a.m,h+=s.m,c+=u.m;o&&!vk(u)&&(u.t=o,u.m+=f-c),a&&!mk(s)&&(s.t=a,s.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function o(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=zA,e=1,n=1,r=!1;function i(i){var a,u=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(TA,0)/t.length}(n),e.y=function(t){return 1+t.reduce(NA,0)}(n)):(e.x=a?u+=t(e,a):0,e.y=0,a=e)}));var o=function(t){for(var e;e=t.children;)t=e[0];return t}(i),s=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=o.x-t(o,s)/2,c=s.x+t(s,o)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},Lk=["x","y","depth","children"];function Pk(t){Fk.call(this,t)}Pk.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:Lk.length,default:Lk}]};var $k=rt(Pk,Fk);function jk(t){Hr.call(this,[],t)}$k.layout=function(t){var e=t||"tidy";if(K(Uk,e))return Uk[e]();i("Unrecognized Tree layout method: "+e)},$k.params=["size","nodeSize"],$k.fields=Lk,jk.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},rt(jk,Hr).transform=function(t,e){var n=this.value,r=e.source&&e.source.root,a=e.fork(e.NO_SOURCE),u={};return r||i("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(a.rem=n,e.visit(e.SOURCE,(function(t){u[Ct(t)]=1})),r.each((function(t){var e=t.data,n=t.parent&&t.parent.data;n&&u[Ct(e)]&&u[Ct(n)]&&a.add.push(St({source:n,target:e}))})),this.value=a.add):e.changed(e.MOD)&&(e.visit(e.MOD,(function(t){u[Ct(t)]=1})),n.forEach((function(t){(u[Ct(t.source)]||u[Ct(t.target)])&&a.mod.push(t)}))),a};var Ik={binary:function(t,e,n,r,i){var a,u,o=t.children,s=o.length,l=new Array(s+1);for(l[0]=u=a=0;a=n-1){var c=o[e];return c.x0=i,c.y0=a,c.x1=u,void(c.y1=s)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d>>1;l[g]s-a){var y=(i*v+u*m)/r;t(e,d,m,i,a,y,s),t(d,n,v,y,a,u,s)}else{var _=(a*v+s*m)/r;t(e,d,m,i,a,u,_),t(d,n,v,i,_,u,s)}}(0,s,t.value,e,n,r,i)},dice:lk,slice:bk,slicedice:function(t,e,n,r,i){(1&t.depth?bk:lk)(t,e,n,r,i)},squarify:kk,resquarify:Mk},Hk=["x0","y0","x1","y1","depth","children"];function Wk(t){Fk.call(this,t)}Wk.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:Hk.length,default:Hk}]};var Yk=rt(Wk,Fk);Yk.layout=function(){var t=function(){var t=kk,e=!1,n=1,r=1,i=[0],a=nk,u=nk,o=nk,s=nk,l=nk;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(sk),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f{ua(e,t.x,t.y,t.bandwidth||.3).forEach(t=>{const n={};for(let t=0;t{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,s);if(t.params)return void h.push(St({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||J(n,t.x),a=t=>{const e={};for(let t=0;ta([t,r.predict(t)])):ca(r.predict,i,25,200).forEach(a)}),this.value&&(r.rem=this.value),this.value=r.add=r.source=h}return r};var Qk=Object.freeze({__proto__:null,loess:Xk,regression:Zk});const Kk=Math.pow(2,-52),tM=new Uint32Array(512);class eM{static from(t,e=lM,n=cM){const r=t.length,i=new Float64Array(2*r);for(let a=0;a>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,a=t.length>>1;let u=1/0,o=1/0,s=-1/0,l=-1/0;for(let e=0;es&&(s=n),r>l&&(l=r),this._ids[e]=e}const c=(u+s)/2,f=(o+l)/2;let h,d,p,g=1/0;for(let e=0;e0&&(d=e,g=n)}let y=t[2*d],_=t[2*d+1],x=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(iM(m,v,y,_,b,w)){const t=d,e=y,n=_;d=p,y=b,_=w,p=t,b=e,w=n}const A=function(t,e,n,r,i,a){const u=n-t,o=r-e,s=i-t,l=a-e,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s);return{x:t+(l*c-o*f)*h,y:e+(u*f-s*c)*h}}(m,v,y,_,b,w);this._cx=A.x,this._cy=A.y;for(let e=0;e0&&Math.abs(l-a)<=Kk&&Math.abs(c-u)<=Kk)continue;if(a=l,u=c,s===h||s===d||s===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,a=0;for(;;){const u=n[t],o=t-t%3;if(a=o+(t+2)%3,-1===u){if(0===i)break;t=tM[--i];continue}const s=u-u%3,l=o+(t+1)%3,c=s+(u+2)%3,f=e[a],h=e[t],d=e[l],p=e[c];if(aM(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[u]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(u,n[a]),this._link(a,c);const o=s+(u+1)%3;i=33306690738754716e-32*Math.abs(u+o)?u-o:0}function iM(t,e,n,r,i,a){return(rM(i,a,t,e,n,r)||rM(t,e,n,r,i,a)||rM(n,r,i,a,t,e))<0}function aM(t,e,n,r,i,a,u,o){const s=t-u,l=e-o,c=n-u,f=r-o,h=i-u,d=a-o,p=c*c+f*f,g=h*h+d*d;return s*(f*g-p*d)-l*(c*g-p*h)+(s*s+l*l)*(c*d-f*h)<0}function uM(t,e,n,r,i,a){const u=n-t,o=r-e,s=i-t,l=a-e,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s),d=(l*c-o*f)*h,p=(u*f-s*c)*h;return d*d+p*p}function oM(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],a=e[r];let u=i-1;for(;u>=n&&e[t[u]]>a;)t[u+1]=t[u--];t[u+1]=r}else{let i=n+1,a=r;sM(t,n+r>>1,i),e[t[n]]>e[t[r]]&&sM(t,n,r),e[t[i]]>e[t[r]]&&sM(t,i,r),e[t[n]]>e[t[i]]&&sM(t,n,i);const u=t[i],o=e[u];for(;;){do{i++}while(e[t[i]]o);if(a=a-n?(oM(t,e,i,r),oM(t,e,n,a-1)):(oM(t,e,n,a-1),oM(t,e,i,r))}}function sM(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function lM(t){return t[0]}function cM(t){return t[1]}class fM{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>1e-6||Math.abs(this._y1-i)>1e-6)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class hM{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class dM{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,a=0,u=0,o=n.length;a1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}}const pM=2*Math.PI;function gM(t){return t[0]}function mM(t){return t[1]}function vM(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class yM{static from(t,e=gM,n=mM,r){return new yM("length"in t?function(t,e,n,r){const i=t.length,a=new Float64Array(2*i);for(let u=0;u2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.sqrt((r[3]-r[1])**2+(r[2]-r[0])**2);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],a[r[0]]=1,2===r.length&&(a[r[1]]=0))}voronoi(t){return new dM(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:a,collinear:u}=this;if(u){const e=u.indexOf(t);return e>0&&(yield u[e-1]),void(e=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:a,halfedges:u,triangles:o,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=(e-s[2*t])**2+(n-s[2*t+1])**2;const f=r[t];let h=f;do{let r=o[h];const f=(e-s[2*r])**2+(n-s[2*r+1])**2;if(f=f));)if(e.x=u+i,e.y=l+a,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>o[0]||e.y+e.y1>o[1])&&(!n||!DM(e,t,o[0]))&&(!n||FM(e,n))){for(var g,m=e.sprite,v=e.width>>5,y=o[0]>>5,_=e.x-(v<<4),x=127&_,b=32-x,w=e.y1-e.y0,A=(e.y+e.y0)*y+(_>>5),k=0;k>>x:0);A+=y}return e.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=2048/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(Vo()),f=function(t){var e=[],n=-1;for(;++n>5)*o[1]),d=null,p=l.length,g=-1,m=[],v=l.map((function(o){return{text:t(o),font:e(o),style:r(o),weight:i(o),rotate:a(o),size:~~(n(o)+1e-14),padding:u(o),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:o}})).sort((function(t,e){return e.size-t.size}));++g>1,y.y=o[1]*(c()+.5)>>1,EM(s,y,v,g),y.hasText&&h(f,y,d)&&(m.push(y),d?CM(d,y):d=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=o[0]>>1,y.y-=o[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(o=[+t[0],+t[1]],f):o},f.font=function(t){return arguments.length?(e=BM(t),f):e},f.fontStyle=function(t){return arguments.length?(r=BM(t),f):r},f.fontWeight=function(t){return arguments.length?(i=BM(t),f):i},f.rotate=function(t){return arguments.length?(a=BM(t),f):a},f.text=function(e){return arguments.length?(t=BM(e),f):t},f.spiral=function(t){return arguments.length?(s=zM[t]||t,f):s},f.fontSize=function(t){return arguments.length?(n=BM(t),f):n},f.padding=function(t){return arguments.length?(u=BM(t),f):u},f.random=function(t){return arguments.length?(c=t,f):c},f}function EM(t,e,n,r){if(!e.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,2048/a,2048/a);var u,o,s,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else u=u+31>>5<<5;if(s>d&&(d=s),f+u>=2048&&(f=0,h+=d,d=0),h+s>=2048)break;i.translate((f+(u>>1))/a,(h+(s>>1))/a),e.rotate&&i.rotate(e.rotate*kM),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=u,e.height=s,e.xoff=f,e.yoff=h,e.x1=u>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=u}for(var b=i.getImageData(0,0,2048/a,2048/a).data,w=[];--r>=0;)if((e=n[r]).hasText){for(o=(u=e.width)>>5,s=e.y1-e.y0,l=0;l>5),E=b[2048*(h+c)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,A|=E}A?k=c:(e.y0++,s--,c--,h++)}e.y1=e.y0+k,e.sprite=w.slice(0,(e.y1-e.y0)*o)}}}function DM(t,e,n){n>>=5;for(var r,i=t.sprite,a=t.width>>5,u=t.x-(a<<4),o=127&u,s=32-o,l=t.y1-t.y0,c=(t.y+t.y0)*n+(u>>5),f=0;f>>o:0))&e[c+h])return!0;c+=n}return!1}function CM(t,e){var n=t[0],r=t[1];e.x+e.x0r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function FM(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0>1,v=g[1]>>1,y=0,_=p.length;y<_;++y)(d=(h=p[y]).datum)[s[0]]=h.x+m,d[s[1]]=h.y+v,d[s[2]]=h.font,d[s[3]]=h.size,d[s[4]]=h.style,d[s[5]]=h.weight,d[s[6]]=h.rotate;return n.reflow(r).modifies(s)}};var RM=Object.freeze({__proto__:null,wordcloud:OM});function qM(t){return new Uint8Array(t)}function UM(t){return new Uint16Array(t)}function LM(t){return new Uint32Array(t)}function PM(t,e,n){var r=(e<257?qM:e<65537?UM:LM)(t);return n&&r.set(n),r}function $M(t,e,n){var r=1<i?1:0})),function(t,e){return Array.from(e,e=>t[e])}(t,e)}(f,h),l)u=e,o=t,e=Array(l+c),t=LM(l+c),function(t,e,n,r,i,a,u,o,s){var l,c=0,f=0;for(l=0;c0)for(s=0;s=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length)},add:function(t){for(var n,r=0,i=e.length,a=t.length;rr.length||n>t)&&(t=Math.max(n,t),r=PM(e,t,r),i=PM(e,t))}}}(),t),this._indices=null,this._dims=null}IM.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}}]};var HM=rt(IM,Hr);function WM(t){Hr.call(this,null,t)}HM.transform=function(t,e){return this._dims?t.modified("fields")||t.fields.some((function(t){return e.modified(t.fields)}))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},HM.init=function(t,e){for(var n,r,i=t.fields,a=t.query,u=this._indices={},o=this._dims=[],s=a.length,l=0;lm)for(i=m,a=Math.min(p,v);iv)for(i=Math.max(p,v),a=g;id)for(i=d,a=Math.min(f,p);ip)for(i=Math.max(f,p),a=h;i+t||0;function yE(t){return o(t)?{top:vE(t.top),bottom:vE(t.bottom),left:vE(t.left),right:vE(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(vE(t))}async function _E(t,e,n,r){const a=jh(e),u=a&&a.headless;return u||i("Unrecognized renderer type: "+e),await t.runAsync(),pE(t,null,null,u,n,r).renderAsync(t._scenegraph.root)}var xE,bE,wE,AE,kE;function ME(t){this.type=t}ME.prototype.visit=function(t){var e,n,r;if(t(this))return 1;for(n=0,r=(e=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case"CallExpression":var e=t.arguments.slice();return e.unshift(t.callee),e;case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];case"Identifier":case"Literal":case"RawCode":default:return[]}}(this)).length;n",xE[3]="Identifier",xE[4]="Keyword",xE[5]="Null",xE[6]="Numeric",xE[7]="Punctuator",xE[8]="String",xE[9]="RegularExpression";var EE="ILLEGAL",DE=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]"),CE=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 FE(t,e){if(!t)throw new Error("ASSERT: "+e)}function SE(t){return t>=48&&t<=57}function BE(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function zE(t){return"01234567".indexOf(t)>=0}function TE(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function NE(t){return 10===t||13===t||8232===t||8233===t}function OE(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&DE.test(String.fromCharCode(t))}function RE(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&CE.test(String.fromCharCode(t))}var qE={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 UE(){for(var t;wE1114111||"}"!==t)&&eD({},"Unexpected token %0",EE),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function $E(){var t,e;for(t=bE.charCodeAt(wE++),e=String.fromCharCode(t),92===t&&(117!==bE.charCodeAt(wE)&&eD({},"Unexpected token %0",EE),++wE,(t=LE("u"))&&"\\"!==t&&OE(t.charCodeAt(0))||eD({},"Unexpected token %0",EE),e=t);wE>>="===(r=bE.substr(wE,4))?{type:7,value:r,start:i,end:wE+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:wE+=3}:u===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(u)>=0||"=>"===e?{type:7,value:e,start:i,end:wE+=2}:"<>=!+-*%&|^/".indexOf(u)>=0?{type:7,value:u,start:i,end:++wE}:void eD({},"Unexpected token %0",EE)}function HE(){var t,e,n;if(FE(SE((n=bE[wE]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=wE,t="","."!==n){if(t=bE[wE++],n=bE[wE],"0"===t){if("x"===n||"X"===n)return++wE,function(t){for(var e="";wE=0&&eD({},"Invalid regular expression",n),{value:n,literal:e}}(),r=function(t,e){var n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(t,e){if(parseInt(e,16)<=1114111)return"x";eD({},"Invalid regular expression")})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){eD({},"Invalid regular expression")}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:wE}}function YE(){var t;return UE(),wE>=AE?{type:2,start:wE,end:wE}:OE(t=bE.charCodeAt(wE))?jE():40===t||41===t||59===t?IE():39===t||34===t?function(){var t,e,n,r,i="",a=!1;for(FE("'"===(t=bE[wE])||'"'===t,"String literal must starts with a quote"),e=wE,++wE;wE=0&&wE":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function yD(){var t,e;return t=function(){var t,e,n,r,i,a,u,o,s,l;if(t=kE,s=mD(),0===(i=vD(r=kE)))return s;for(r.prec=i,VE(),e=[t,kE],a=[s,r,u=mD()];(i=vD(kE))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)u=a.pop(),o=a.pop().value,s=a.pop(),e.pop(),n=XE(o,s,u),a.push(n);(r=VE()).prec=i,a.push(r),e.push(kE),n=mD(),a.push(n)}for(n=a[l=a.length-1],e.pop();l>1;)e.pop(),n=XE(a[l-1].value,a[l-2],n),l-=2;return n}(),iD("?")&&(VE(),e=yD(),rD(":"),t=function(t,e,n){var r=new ME("ConditionalExpression");return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,yD())),t}function _D(){var t=yD();if(iD(","))throw new Error("Disabled.");return t}var xD={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 bD(t){function e(e,n,r){return function(i){return function(e,n,r,i){var a=t(n[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}}var n="new Date";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",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(e){e.length<3&&i("Missing arguments to clamp function."),e.length>3&&i("Too many arguments to clamp function.");var n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),join:e("join",null),indexof:e("indexOf",null),lastindexof:e("lastIndexOf",null),slice:e("slice",null),reverse:function(e){return"("+t(e[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase","String",0),lower:e("toLowerCase","String",0),substring:e("substring","String"),split:e("split","String"),replace:e("replace","String"),trim:e("trim","String",0),regexp:"RegExp",test:e("test","RegExp"),if:function(e){e.length<3&&i("Missing arguments to if function."),e.length>3&&i("Too many arguments to if function.");var n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function wD(t,e){for(var n,r,i=e.fields,a=e.values,o=i.length,s=0;s=0})):e},R_union:function(t,e){var n=M(e[0]),r=M(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]r&&(n=e[1],r=e[0]),t.length?rr&&(t[1]=r),t):[n,r]}};function kD(t,e,n,r){"Literal"!==e[0].type&&i("First argument to selection functions must be a string literal.");const a=e[0].value,u=":"+a;"intersect"!==(e.length>=2&&k(e).value)||K(r,"@unit")||(r["@unit"]=n.getData(a).indataRef(n,"unit")),K(r,u)||(r[u]=n.getData(a).tuplesRef())}function MD(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ED(t){const e=up(t);return.2126*MD(e.r)+.7152*MD(e.g)+.0722*MD(e.b)}function DD(t){const e=this.context.data[t];return e?e.values.value:[]}const CD={};function FD(t,e,n){let r=t+":"+n,i=CD[r];return i&&i[0]===e||(CD[r]=i=[e,e(n)]),i[1]}function SD(t,e){return FD("timeFormat",ao,e)(t)}var BD=new Date(2e3,0,1);function zD(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(BD.setYear(2e3),BD.setMonth(t),BD.setDate(e),SD(BD,n)):""}function TD(t,e){let n;return W(t)?t:s(t)?(n=e.scales[t])&&n.value:void 0}function ND(t,e){return function(n,r,i){if(n){const e=TD(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const OD=ND("area",(function(t){return Wy.reset(),Uy(t,Yy),2*Wy})),RD=ND("bounds",(function(t){var e,n,r,i,a,u,o;if(o_=u_=-(i_=a_=1/0),h_=[],Uy(t,B_),n=h_.length){for(h_.sort(P_),e=1,a=[r=h_[0]];eL_(r[0],r[1])&&(r[1]=i[1]),L_(i[0],r[1])>L_(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(u=-1/0,e=0,r=a[n=a.length-1];e<=n;r=i,++e)i=a[e],(o=L_(r[1],i[0]))>u&&(u=o,i_=i[0],u_=r[1])}return h_=d_=null,i_===1/0||a_===1/0?[[NaN,NaN],[NaN,NaN]]:[[i_,a_],[u_,o_]]})),qD=ND("centroid",(function(t){p_=g_=m_=v_=y_=__=x_=b_=w_=A_=k_=0,Uy(t,j_);var e=w_,n=A_,r=k_,i=e*e+n*n+r*r;return i<1e-12&&(e=__,n=x_,r=b_,g_<1e-6&&(e=m_,n=v_,r=y_),(i=e*e+n*n+r*r)<1e-12)?[NaN,NaN]:[xy(n,e)*my,By(r/Cy(i))*my]}));function UD(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function LD(t,e){return t===e||t!=t&&e!=e||(u(t)?!(!u(e)||t.length!==e.length)&&function(t,e){for(let n=0,r=t.length;nPD(t,e)}const jD={};function ID(t){return t.data}function HD(t,e){const n=DD.call(e,t);return n.root&&n.root.lookup||jD}const WD="undefined"!=typeof window&&window||null;function YD(t,e,n,r){"Literal"!==e[0].type&&i("First argument to data functions must be a string literal.");const a=e[0].value,u=":"+a;if(!K(u,r))try{r[u]=n.getData(a).tuplesRef()}catch(t){}}function VD(t,e,n,r){if("Literal"===e[0].type)GD(n,r,e[0].value);else if("Identifier"===e[0].type)for(t in n.scales)GD(n,r,t)}function GD(t,e,n){const r="%"+n;if(!K(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}const XD={random:function(){return t.random()},cumulativeNormal:Ni,cumulativeLogNormal:Pi,cumulativeUniform:Yi,densityNormal:Ti,densityLogNormal:Li,densityUniform:Wi,quantileNormal:Oi,quantileLogNormal:$i,quantileUniform:Vi,sampleNormal:zi,sampleLogNormal:Ui,sampleUniform:Hi,isArray:u,isBoolean:at,isDate:ut,isDefined:function(t){return void 0!==t},isNumber:ot,isObject:o,isRegExp:st,isString:s,isTuple:Dt,isValid:function(t){return null!=t&&t==t},toBoolean:mt,toDate:yt,toNumber:M,toString:_t,flush:nt,lerp:ct,merge:function(){var t=[].slice.call(arguments);return t.unshift({}),X.apply(null,t)},pad:pt,peek:k,span:gt,inrange:it,truncate:bt,rgb:up,lab:xp,hcl:Dp,hsl:dp,luminance:ED,contrast:function(t,e){const n=ED(t),r=ED(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:li,format:function(t,e){return FD("format",Qg,e)(t)},utcFormat:function(t,e){return FD("utcFormat",uo,e)(t)},utcParse:function(t,e){return FD("utcParse",cn,e)(t)},utcOffset:Ku,utcSequence:no,timeFormat:SD,timeParse:function(t,e){return FD("timeParse",sn,e)(t)},timeOffset:Qu,timeSequence:eo,timeUnitSpecifier:io,monthFormat:function(t){return zD(t,1,"%B")},monthAbbrevFormat:function(t){return zD(t,1,"%b")},dayFormat:function(t){return zD(0,2+t,"%A")},dayAbbrevFormat:function(t){return zD(0,2+t,"%a")},quarter:$,utcquarter:j,warn:function(){return UD(this.context.dataflow,"warn",arguments)},info:function(){return UD(this.context.dataflow,"info",arguments)},debug:function(){return UD(this.context.dataflow,"debug",arguments)},extent:J,inScope:function(t){let e=this.context.group,n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:function(t,e,n){if(!t)return[];const[r,i]=t,a=(new Uo).set(r[0],r[1],i[0],i[1]);return Ih(n||this.context.dataflow.scenegraph().root,a,function(t){let e=null;if(t){const n=I(t.marktype),r=I(t.markname);e=t=>(!n.length||n.some(e=>t.marktype===e))&&(!r.length||r.some(e=>t.name===e))}return e}(e))},clampRange:H,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){return WD?WD.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){return WD?[WD.innerWidth,WD.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return zd(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(m).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?kl(n,e=e||dl(t)):t}},panLinear:z,panLog:T,panPow:N,panSymlog:O,zoomLinear:q,zoomLog:U,zoomPow:L,zoomSymlog:P,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,a){let o,s,l=this.context.dataflow,c=this.context.data[t],f=c.input,h=c.changes,d=l.stamp();if(!1===l._trigger||!(f.value.length||e||r))return 0;if((!h||h.stampa.stop(l(e),t(e))),a}),VD),QD("geoArea",OD,VD),QD("geoBounds",RD,VD),QD("geoCentroid",qD,VD),QD("geoShape",(function(t,e,n){const r=TD(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),VD),QD("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){"Literal"!==e[0].type&&i("First argument to indata must be a string literal."),"Literal"!==e[1].type&&i("Second argument to indata must be a string literal.");const a=e[0].value,u=e[1].value,o="@"+u;K(o,r)||(r[o]=n.getData(a).indataRef(n,u))})),QD("data",DD,YD),QD("treePath",(function(t,e,n){const r=HD(t,this),i=r[e],a=r[n];return i&&a?i.path(a).map(ID):void 0}),YD),QD("treeAncestors",(function(t,e){const n=HD(t,this)[e];return n?n.ancestors().map(ID):void 0}),YD),QD("vlSelectionTest",(function(t,e,n){for(var r,i,a,u,o,s=this.context.data[t],l=s?s.values.value:[],c=s?s["index:unit"]&&s["index:unit"].value:void 0,f="intersect"===n,h=l.length,d=0;d(t[i[n].field]=e,t),{}))}return e=e||"union",Object.keys(m).forEach((function(t){m[t]=Object.keys(m[t]).map(e=>m[t][e]).reduce((n,r)=>void 0===n?r:AD[y[t]+"_"+e](n,r))})),g=Object.keys(v),n&&g.length&&(m.vlMulti="union"===e?{or:g.reduce((t,e)=>(t.push.apply(t,v[e]),t),[])}:{and:g.map(t=>({or:v[t]}))}),m}),kD);const KD={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(t){return"_["+l("$"+t)+"]"},functions:function(t){const e=bD(t);JD.forEach(t=>e[t]="event.vega."+t);for(let t in XD)e[t]="this."+t;return e},constants:xD,visitors:ZD};var tC=function(t){var e=(t=t||{}).whitelist?xt(t.whitelist):{},n=t.blacklist?xt(t.blacklist):{},r=t.constants||xD,a=(t.functions||bD)(d),u=t.globalvar,o=t.fieldvar,l={},c={},f=0,h=W(u)?u:function(t){return u+'["'+t+'"]'};function d(t){if(s(t))return t;var e=p[t.type];return null==e&&i("Unsupported type: "+t.type),e(t)}var p={Literal:function(t){return t.raw},Identifier:function(t){var a=t.name;return f>0?a:K(n,a)?i("Illegal identifier: "+a):K(r,a)?r[a]:K(e,a)?a:(l[a]=1,h(a))},MemberExpression:function(t){var e=!t.computed,n=d(t.object);e&&(f+=1);var r=d(t.property);return n===o&&(c[function(t){var e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&i("Illegal callee type: "+t.callee.type);var e=t.callee.name,n=t.arguments,r=K(a,e)&&a[e];return r||i("Unrecognized function: "+e),W(r)?r(n):r+"("+n.map(d).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(d).join(",")+"]"},BinaryExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+d(t.argument)+")"},ConditionalExpression:function(t){return"("+d(t.test)+"?"+d(t.consequent)+":"+d(t.alternate)+")"},LogicalExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(d).join(",")+"}"},Property:function(t){f+=1;var e=d(t.key);return f-=1,e+":"+d(t.value)}};function g(t){var e={code:d(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},e}return g.functions=a,g.constants=r,g}(KD);function eC(t,e,n){";"!==e[e.length-1]&&(e="return("+e+");");var r=Function.apply(null,t.concat(e));return n&&n.functions?r.bind(n.functions):r}function nC(t,e){return eC(["event"],t,e)}function rC(t,e){return eC(["item","_"],t,e)}function iC(t,e,n){var r,i;for(r in n=n||{},t)i=t[r],n[r]=u(i)?i.map((function(t){return aC(t,e,n)})):aC(i,e,n);return n}function aC(t,e,n){if(!t||!o(t))return t;for(var r,i=0,a=uC.length;i{e.forEach(e=>{u(t[e])&&(t[e]=xt(t[e]))})};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig);var r=function(t,e,n){return cC(e,hC(t,Yr,n||XD))}(this,t,e.functions);this._runtime=r,this._signals=r.signals,this._bind=(t.bindings||[]).map((function(t){return{state:null,param:X({},t)}})),r.root&&r.root.set(n),n.source=r.data.root.input,this.pulse(r.data.root.input,this.changeset().insert(n.items)),this._width=this.width(),this._height=this.height(),this._viewWidth=mC(this,this._width),this._viewHeight=vC(this,this._height),this._origin=[0,0],this._resize=0,this._autosize=1,function(t){var e=t._signals,n=e.width,r=e.height,i=e.padding;function a(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(function(e){t._width=e.size,t._viewWidth=mC(t,e.size),a()}),{size:n}),t._resizeHeight=t.add(null,(function(e){t._height=e.size,t._viewHeight=vC(t,e.size),a()}),{size:r});var u=t.add(null,a,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,u.rank=i.rank+1}(this),function(t){t.add(null,e=>(t._background=e.bg,t._resize=1,e.bg),{bg:t._signals.background})}(this),GM(this),this.description(t.description),e.hover&&this.hover(),e.container&&this.initialize(e.container,e.bind)}var kC=rt(AC,$r);function MC(t,e){return K(t._signals,e)?t._signals[e]:i("Unrecognized signal name: "+l(e))}function EC(t,e){var n=(t._targets||[]).filter((function(t){var n=t._update;return n&&n.handler===e}));return n.length?n[0]:null}function DC(t,e,n,r){var i=EC(n,r);return i||((i=gE(this,(function(){r(e,n.value)}))).handler=r,t.on(n,null,i)),t}function CC(t,e,n){var r=EC(e,n);return r&&e._targets.remove(r),t}function FC(t){return o(t)?t:{type:t||"pad"}}kC.evaluate=async function(t,e,n){if(await $r.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=KM(t),n=ZM(t),r=QM(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((function(e){try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&kt(this,n),this},kC.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},kC.description=function(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&VM(this._el,this._desc=e),this}return this._desc},kC.container=function(){return this._el},kC.scenegraph=function(){return this._scenegraph},kC.origin=function(){return this._origin.slice()},kC.signal=function(t,e,n){var r=MC(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},kC.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},kC.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},kC.padding=function(t){return arguments.length?this.signal("padding",yE(t)):yE(this.signal("padding"))},kC.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},kC.background=function(t){return arguments.length?this.signal("background",t):this.signal("background")},kC.renderer=function(t){return arguments.length?(jh(t)||i("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},kC.tooltip=function(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},kC.loader=function(t){return arguments.length?(t!==this._loader&&($r.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},kC.resize=function(){return this._autosize=1,this.touch(MC(this,"autosize"))},kC._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},kC._resizeView=function(t,e,n,r,i,a){this.runAfter((function(u){var o=0;u._autosize=0,u.width()!==n&&(o=1,u.signal("width",n,gC),u._resizeWidth.skip(!0)),u.height()!==r&&(o=1,u.signal("height",r,gC),u._resizeHeight.skip(!0)),u._viewWidth!==t&&(u._resize=1,u._viewWidth=t),u._viewHeight!==e&&(u._resize=1,u._viewHeight=e),u._origin[0]===i[0]&&u._origin[1]===i[1]||(u._resize=1,u._origin=i),o&&u.run("enter"),a&&u.runAfter(t=>t.resize())}),!1,1)},kC.addEventListener=function(t,e,n){var r=e;return n&&!1===n.trap||((r=gE(this,e)).raw=e),this._handler.on(t,r),this},kC.removeEventListener=function(t,e){for(var n,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,n=i[a].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},kC.addResizeListener=function(t){var e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},kC.removeResizeListener=function(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},kC.addSignalListener=function(t,e){return DC(this,t,MC(this,t),e)},kC.removeSignalListener=function(t,e){return CC(this,MC(this,t),e)},kC.addDataListener=function(t,e){return DC(this,t,XM(this,t).values,e)},kC.removeDataListener=function(t,e){return CC(this,XM(this,t).values,e)},kC.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},kC.timer=function(t,e){this._timers.push(function(t,e,n){var r=new hA,i=e;return null==e?(r.restart(t,e,n),r):(e=+e,n=null==n?cA():+n,r.restart((function a(u){u+=i,r.restart(a,i+=e,n),t(u)}),e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},kC.events=function(t,e,n){var r,i=this,a=new Yt(n),u=function(n,r){i.runAsync(null,()=>{"view"===t&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),a.receive(tE(i,n,r))})};if("timer"===t)nE(i,"timer",e)&&i.timer(u,e);else if("view"===t)nE(i,"view",e)&&i.addEventListener(e,u,eE);else if("window"===t?nE(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&nE(i,"selector",e)&&(r=document.querySelectorAll(t)),r){for(var o=0,s=r.length;o=0;)i[t].stop();for(t=a.length;--t>=0;)for(e=(n=a[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},kC.hover=function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",rE),iE,aE(t)),this.on(this.events("view","mouseout",rE),iE,aE(e)),this},kC.data=function(t,e){return arguments.length<2?XM(this,t).values.value:JM.call(this,t,Rt().remove(m).insert(e))},kC.change=JM,kC.insert=function(t,e){return JM.call(this,t,Rt().insert(e))},kC.remove=function(t,e){return JM.call(this,t,Rt().remove(e))},kC.scale=function(t){var e=this._runtime.scales;return K(e,t)||i("Unrecognized scale or projection: "+t),e[t].value},kC.initialize=function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,a=jh(r);t=n._el=t?mE(n,t):null,function(t){const e=t.container();e&&(e.setAttribute("role","figure"),VM(e,t.description()))}(n),a||n.error("Unrecognized renderer type: "+r);const u=a.handler||eh,o=t?a.renderer:a.headless;return n._renderer=o?pE(n,n._renderer,t,o):null,n._handler=function(t,e,n,r){var i=new r(t.loader(),gE(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,KM(t),t);return e&&e.handlers().forEach((function(t){i.on(t.type,t.handler)})),i}(n,n._handler,t,u),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=mE(n,e):t.appendChild(uE("div",{class:"vega-bindings"})),n._bind.forEach((function(t){t.param.element&&"container"!==i&&(t.element=mE(n,t.param.element))})),n._bind.forEach((function(t){oE(n,t.element||e,t)}))),n},kC.toImageURL=async function(t,e){t!==Ph.Canvas&&t!==Ph.SVG&&t!==Ph.PNG&&i("Unrecognized image type: "+t);const n=await _E(this,t,e);return t===Ph.SVG?function(t,e){var n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},kC.toCanvas=async function(t,e){return(await _E(this,Ph.Canvas,t,e)).canvas()},kC.toSVG=async function(t){return(await _E(this,Ph.SVG,t)).svg()},kC.getState=function(t){return this._runtime.getState(t||{data:yC,signals:_C,recurse:!0})},kC.setState=function(t){return this.runAsync(null,e=>{e._trigger=!1,e._runtime.setState(t)},t=>{t._trigger=!0}),this};const SC=t=>+t||0;function BC(t){return o(t)?t.signal?t:{top:SC(t.top),bottom:SC(t.bottom),left:SC(t.left),right:SC(t.right)}:{top:e=SC(t),bottom:e,left:e,right:e};var e}var zC=["value","update","init","react","bind"];function TC(t,e){i(t+' for "outer" push: '+l(e))}function NC(t,e){var n=t.name;if("outer"===t.push)e.signals[n]||TC("No prior signal definition",n),zC.forEach((function(e){void 0!==t[e]&&TC("Invalid property ",e)}));else{var r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function OC(t,e,n){var r,a,u={};try{r=function(t){wE=0,AE=(bE=t).length,kE=null,GE();var e=_D();if(2!==kE.type)throw new Error("Unexpect token after expression.");return e}(t=s(t)?t:l(t)+"")}catch(e){i("Expression parse error: "+t)}return r.visit((function(t){if("CallExpression"===t.type){var n=t.callee.name,r=KD.visitors[n];r&&r(n,t.arguments,e,u)}})),(a=tC(r)).globals.forEach((function(t){var n="$"+t;!K(u,n)&&e.getSignal(t)&&(u[n]=e.signalRef(t))})),{$expr:n?n+"return("+a.code+");":a.code,$fields:a.fields,$params:u}}function RC(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function qC(t,e,n,r){return new RC(t,e,n,r)}function UC(t,e){return qC("operator",t,e)}function LC(t){var e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function PC(t,e){return e?{$field:t,$name:e}:{$field:t}}var $C=PC("key");function jC(t,e){return{$compare:t,$order:e}}function IC(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}function HC(t){return t&&t.signal}function WC(t){if(HC(t))return!0;if(o(t))for(var e in t)if(WC(t[e]))return!0;return!1}function YC(t,e){return null!=t?t:e}function VC(t){return t&&t.signal||t}function GC(t,e){return(t.merge?XC:t.stream?JC:t.type?ZC:i("Invalid stream specification: "+l(t)))(t,e)}function XC(t,e){var n=QC({merge:t.merge.map(t=>GC(t,e))},t,e);return e.addStream(n).id}function JC(t,e){var n=QC({stream:GC(t.stream,e)},t,e);return e.addStream(n).id}function ZC(t,e){var n,r;return"timer"===t.type?(n=e.event("timer",t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return"scope"===t?"view":t||"view"}(t.source),t.type),r=QC({stream:n},t,e),1===Object.keys(r).length?n:e.addStream(r).id}function QC(t,e,n){var r=e.between;return r&&(2!==r.length&&i('Stream "between" parameter must have 2 entries: '+l(e)),t.between=[GC(r[0],n),GC(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){var r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),"scope"===e.source&&r.push("inScope(event.item)"),r.length&&(t.filter=OC("("+r.join(")&&(")+")").$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}var KC,tF,eF="view",nF=/[[\]{}]/,rF={"*":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};function iF(t,e,n,r,i){for(var a,u=0,o=t.length;e=0?--u:r&&r.indexOf(a)>=0&&++u}return e}function aF(t){for(var e=[],n=0,r=t.length,i=0;i"!==(t=t.slice(i+1).trim())[0])throw"Expected '>' after between selector: "+t;if(e=e.map(uF),(n=uF(t.slice(1).trim())).between)return{between:e,stream:n};n.between=e;return n}(t):function(t){var e,n,r={source:KC},i=[],a=[0,0],u=0,o=0,s=t.length,l=0;if("}"===t[s-1]){if(!((l=t.lastIndexOf("{"))>=0))throw"Unmatched right brace: "+t;try{a=function(t){var e=t.split(",");if(!t.length||e.length>2)throw t;return e.map((function(e){var n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,s-1))}catch(e){throw"Invalid throttle specification: "+t}t=t.slice(0,l).trim(),s=t.length,l=0}if(!s)throw t;"@"===t[0]&&(u=++l);(e=iF(t,l,":"))1?(r.type=i[1],u?r.markname=i[0].slice(1):!function(t){return tF[t]}(i[0])?r.source=i[0]:r.marktype=i[0]):r.type=i[0];"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=n&&(r.filter=n);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}var oF="var datum=event.item&&event.item.datum;";function sF(t,e,n){var r=t.events,a=t.update,u=t.encode,o=[],c={target:n};r||i("Signal update missing events specification."),s(r)&&(r=function(t,e,n){return KC=e||eF,tF=n||rF,aF(t.trim()).map(uF)}(r,e.isSubscope()?"scope":"view")),r=I(r).filter(t=>t.signal||t.scale?(o.push(t),0):1),o.length>1&&(o=[lF(o)]),r.length&&o.push(r.length>1?{merge:r}:r[0]),null!=u&&(a&&i("Signal encode and update are mutually exclusive."),a="encode(item(),"+l(u)+")"),c.update=s(a)?OC(a,e,oF):null!=a.expr?OC(a.expr,e,oF):null!=a.value?a.value:null!=a.signal?{$expr:"_.value",$params:{value:e.signalRef(a.signal)}}:i("Invalid signal update specification."),t.force&&(c.options={force:!0}),o.forEach((function(t){e.addUpdate(X(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):GC(t,e)}}(t,e),c))}))}function lF(t){return{signal:"["+t.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function cF(t){return function(e,n,r){return qC(t,n,e||void 0,r)}}var fF=cF("aggregate"),hF=cF("axisticks"),dF=cF("bound"),pF=cF("collect"),gF=cF("compare"),mF=cF("datajoin"),vF=cF("encode"),yF=cF("expression"),_F=cF("facet"),xF=cF("field"),bF=cF("key"),wF=cF("legendentries"),AF=cF("load"),kF=cF("mark"),MF=cF("multiextent"),EF=cF("multivalues"),DF=cF("overlap"),CF=cF("params"),FF=cF("prefacet"),SF=cF("projection"),BF=cF("proxy"),zF=cF("relay"),TF=cF("render"),NF=cF("scale"),OF=cF("sieve"),RF=cF("sortitems"),qF=cF("viewlayout"),UF=cF("values"),LF=0,PF={min:"min",max:"max",count:"sum"};function $F(t,e){var n,r=e.getScale(t.name).params;for(n in r.domain=WF(t.domain,t,e),null!=t.range&&(r.range=function t(e,n,r){var a=e.range,o=n.config.range;if(a.signal)return n.signalRef(a.signal);if(s(a)){if(o&&K(o,a))return e=X({},e,{range:o[a]}),t(e,n,r);"width"===a?a=[0,{signal:"width"}]:"height"===a?a=$m(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:i("Unrecognized scale range value: "+l(a))}else{if(a.scheme)return r.scheme=u(a.scheme)?IF(a.scheme,n):jF(a.scheme,n),a.extent&&(r.schemeExtent=IF(a.extent,n)),void(a.count&&(r.schemeCount=jF(a.count,n)));if(a.step)return void(r.rangeStep=jF(a.step,n));if($m(e.type)&&!u(a))return WF(a,e,n);u(a)||i("Unsupported range type: "+l(a))}return a.map(t=>(u(t)?IF:jF)(t,n))}(t,e,r)),null!=t.interpolate&&function(t,e){e.interpolate=jF(t.type||t),null!=t.gamma&&(e.interpolateGamma=jF(t.gamma))}(t.interpolate,r),null!=t.nice&&(r.nice=function(t){return o(t)?{interval:jF(t.interval),step:jF(t.step)}:jF(t)}(t.nice)),null!=t.bins&&(r.bins=function(t,e){return t.signal||u(t)?IF(t,e):e.objectProperty(t)}(t.bins,e)),t)K(r,n)||"name"===n||(r[n]=jF(t[n],e))}function jF(t,e){return o(t)?t.signal?e.signalRef(t.signal):i("Unsupported object: "+l(t)):t}function IF(t,e){return t.signal?e.signalRef(t.signal):t.map(t=>jF(t,e))}function HF(t){i("Can not find data set: "+l(t))}function WF(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(u(t)?YF:t.fields?GF:VF)(t,e,n);null==e.domainMin&&null==e.domainMax||i("No scale domain defined for domainMin/domainMax to override.")}function YF(t,e,n){return t.map((function(t){return jF(t,n)}))}function VF(t,e,n){var r=n.getData(t.data);return r||HF(t.data),$m(e.type)?r.valuesRef(n,t.field,JF(t.sort,!1)):Wm(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function GF(t,e,n){var r=t.data,i=t.fields.reduce((function(t,e){return e=s(e)?{data:r,field:e}:u(e)||e.signal?function(t,e){var n="_:vega:_"+LF++,r=pF({});if(u(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+l(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,OF({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t}),[]);return($m(e.type)?XF:Wm(e.type)?ZF:QF)(t,n,i)}function XF(t,e,n){var r,i,a,u,o,s=JF(t.sort,!0);return r=n.map((function(t){var n=e.getData(t.data);return n||HF(t.data),n.countsRef(e,t.field,s)})),i={groupby:$C,pulse:r},s&&(a=s.op||"count",o=s.field?IC(a,s.field):"count",i.ops=[PF[a]],i.fields=[e.fieldRef(o)],i.as=[o]),a=e.add(fF(i)),u=e.add(pF({pulse:LC(a)})),o=e.add(UF({field:$C,sort:e.sortRef(s),pulse:LC(u)})),LC(o)}function JF(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!PF[t.op]&&i("Multiple domain scales can not be sorted using "+t.op):i("No field provided for sort aggregate op: "+t.op):o(t)?t.field="key":t={field:"key"}),t}function ZF(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||HF(t.data),n.domainRef(e,t.field)}));return LC(e.add(EF({values:r})))}function QF(t,e,n){var r=n.map((function(t){var n=e.getData(t.data);return n||HF(t.data),n.extentRef(e,t.field)}));return LC(e.add(MF({extents:r})))}function KF(t,e,n){return u(t)?t.map((function(t){return KF(t,e,n)})):o(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:i("Unsupported parameter object: "+l(t)):t}const tS="value",eS=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],nS={name:1,style:1,interactive:1},rS={value:0},iS={value:1};var aS=xt(["rule"]),uS=xt(["group","image","rect"]);function oS(t,e,n,r){var i=OC(t,e);return i.$fields.forEach((function(t){r[t]=1})),X(n,i.$params),i.$expr}function sS(t,e,n,r){return function t(e,n,r,u){var o,c,f;if(e.signal)o="datum",f=oS(e.signal,n,r,u);else if(e.group||e.parent){for(c=Math.max(1,e.level||1),o="item";c-- >0;)o+=".mark.group";e.parent?(f=e.parent,o+=".datum"):f=e.group}else e.datum?(o="datum",f=e.datum):i("Invalid field reference: "+l(e));e.signal||(s(f)?(u[f]=1,f=a(f).map(l).join("][")):f=t(f,n,r,u));return o+"["+f+"]"}(o(t)?t:{datum:t},e,n,r)}function lS(t,e,n,r){return o(t)?"("+hS(null,t,e,n,r)+")":t}function cS(t,e,n,r,i){var a,u,o,l=fS(t.scale,n,r,i);return null!=t.range?(u=l+".range()",e=0===(a=+t.range)?u+"[0]":"($="+u+","+(1===a?"$[$.length-1]":"$[0]+"+a+"*($[$.length-1]-$[0])")+")"):(void 0!==e&&(e=l+"("+e+")"),t.band&&(o=function(t,e){if(!s(t))return-1;var n=e.scaleType(t);return"band"===n||"point"===n?1:0}(t.scale,n))&&(u=l+".bandwidth",a=t.band.signal?u+"()*"+lS(t.band,n,r,i):u+"()"+(1===(a=+t.band)?"":"*"+a),o<0&&(a="("+u+"?"+a+":0)"),e=(e?e+"+":"")+a,t.extra&&(e="(datum.extra?"+l+"(datum.extra.value):"+e+")")),null==e&&(e="0")),e}function fS(t,e,n,r){var i;if(s(t))K(n,i="%"+t)||(n[i]=e.scaleRef(t)),i=l(i);else{for(i in e.scales)n["%"+i]=e.scaleRef(i);i=l("%")+"+"+(t.signal?"("+oS(t.signal,e,n,r)+")":sS(t,e,n,r))}return"_["+i+"]"}function hS(t,e,n,r,i){if(null!=e.gradient)return function(t,e,n,r){return"this.gradient("+fS(t.gradient,e,n,r)+","+l(t.start)+","+l(t.stop)+","+l(t.count)+")"}(e,n,r,i);var a=e.signal?oS(e.signal,n,r,i):e.color?function(t,e,n,r){function i(t,i,a,u){return"this."+t+"("+[hS(null,i,e,n,r),hS(null,a,e,n,r),hS(null,u,e,n,r)].join(",")+").toString()"}return t.c?i("hcl",t.h,t.c,t.l):t.h||t.s?i("hsl",t.h,t.s,t.l):t.l||t.a?i("lab",t.l,t.a,t.b):t.r||t.g||t.b?i("rgb",t.r,t.g,t.b):null}(e.color,n,r,i):null!=e.field?sS(e.field,n,r,i):void 0!==e.value?l(e.value):void 0;return null!=e.scale&&(a=cS(e,a,n,r,i)),void 0===a&&(a=null),null!=e.exponent&&(a="Math.pow("+a+","+lS(e.exponent,n,r,i)+")"),null!=e.mult&&(a+="*"+lS(e.mult,n,r,i)),null!=e.offset&&(a+="+"+lS(e.offset,n,r,i)),e.round&&(a="Math.round("+a+")"),a}function dS(t,e,n){const r=t+"["+l(e)+"]";return`$=${n};if(${r}!==$)${r}=$,m=1;`}function pS(t,e,n,r,i){var a="";return e.forEach((function(t){var e=hS(0,t,n,r,i);a+=t.test?oS(t.test,n,r,i)+"?"+e+":":e})),":"===k(a)&&(a+="null"),dS("o",t,a)}function gS(t,e,n,r){var i,a,o={},s="var o=item,datum=o.datum,m=0,$;";for(i in t)a=t[i],u(a)?s+=pS(i,a,r,n,o):s+=dS("o",i,hS(0,a,r,n,o));return s+=function(t,e){var n="";return aS[e]||(t.x2&&(t.x?(uS[e]&&(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);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(uS[e]&&(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);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(t,e),{$expr:s+="return m;",$fields:Object.keys(o),$output:Object.keys(t)}}function mS(t){return o(t)&&!u(t)?X({},t):{value:t}}function vS(t,e,n,r){return null!=n?(o(n)&&!u(n)?t.update[e]=n:t[r||"enter"][e]={value:n},1):0}function yS(t,e,n){for(let n in e)vS(t,n,e[n]);for(let e in n)vS(t,e,n[e],"update")}function _S(t,e,n){for(var r in e)n&&K(n,r)||(t[r]=X(t[r]||{},e[r]));return t}function xS(t,e,n,r,i,a){var u,o;for(o in(a=a||{}).encoders={$encode:u={}},t=function(t,e,n,r,i){var a,u,o,s={},l={};u="lineBreak","text"!==e||null==i[u]||wS(u,t)||bS(s,u,i[u]);("legend"==n||String(n).startsWith("axis"))&&(n=null);for(u in o="frame"===n?i.group:"mark"===n?X({},i.mark,i[e]):null)wS(u,t)||("fill"===u||"stroke"===u)&&(wS("fill",t)||wS("stroke",t))||bS(s,u,o[u]);for(u in I(r).forEach((function(e){var n=i.style&&i.style[e];for(var r in n)wS(r,t)||bS(s,r,n[r])})),t=X({},t),s)(o=s[u]).signal?(a=a||{})[u]=o:l[u]=o;t.enter=X(l,t.enter),a&&(t.update=X(a,t.update));return t}(t,e,n,r,i.config))u[o]=gS(t[o],e,a,i);return a}function bS(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}function wS(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}function AS(t,e,n,r,i,a,u){return{type:t,name:u?u.name:void 0,role:e,style:u&&u.style||n,key:r,from:i,interactive:!(!u||!u.interactive),encode:_S(a,u,nS)}}function kS(t,e){const n=(n,r)=>YC(t[n],YC(e[n],r));return n.isVertical=n=>"vertical"===YC(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>YC(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>YC(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>YC(t.columns,YC(e.columns,+n.isVertical(!0))),n}function MS(t,e){var n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function ES(t,e,n){return`item.anchor === "start" ? ${t} : item.anchor === "end" ? ${e} : ${n}`}const DS=ES(l("left"),l("right"),l("center"));function CS(t,e){return e?t?o(t)?{...t,offset:CS(t.offset,e)}:{value:t,offset:e}:e:t}function FS(t,e,n,r){var i,a,u,o,s,l,c=kS(t,n),f=c.isVertical(),h=c.gradientThickness(),d=c.gradientLength();return f?(u=[0,1],o=[0,0],s=h,l=d):(u=[0,0],o=[1,0],s=d,l=h),yS(i={enter:a={opacity:rS,x:rS,y:rS,width:mS(s),height:mS(l)},update:X({},a,{opacity:iS,fill:{gradient:e,start:u,stop:o}}),exit:{opacity:rS}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),AS("rect","legend-gradient",null,void 0,void 0,i,r)}function SS(t,e,n,r,i){var a,u,o,s,l,c,f=kS(t,n),h=f.isVertical(),d=f.gradientThickness(),p=f.gradientLength(),g="";return h?(o="y",l="y2",s="x",c="width",g="1-"):(o="x",l="x2",s="y",c="height"),(u={opacity:rS,fill:{scale:e,field:tS}})[o]={signal:g+"datum.perc",mult:p},u[s]=rS,u[l]={signal:g+"datum.perc2",mult:p},u[c]=mS(d),yS(a={enter:u,update:X({},u,{opacity:iS}),exit:{opacity:rS}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),AS("rect","legend-band",null,tS,i,a,r)}function BS(t,e,n,r){var i,a,u,o,s,l=kS(t,e),c=l.isVertical(),f=mS(l.gradientThickness()),h=l.gradientLength(),d=l("labelOverlap"),p=l("labelSeparation"),g="";return yS(i={enter:a={opacity:rS},update:u={opacity:iS,text:{field:"label"}},exit:{opacity:rS}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:YC(t.labelLimit,e.gradientLabelLimit)}),c?(a.align={value:"left"},a.baseline=u.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},o="y",s="x",g="1-"):(a.align=u.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},a.baseline={value:"top"},o="x",s="y"),a[o]=u[o]={signal:g+"datum.perc",mult:h},a[s]=u[s]=f,f.offset=YC(t.labelOffset,e.gradientLabelOffset)||0,t=AS("text","legend-label","guide-label",tS,r,i,n),d&&(t.overlap={separation:p,method:d,order:"datum.index"}),t}function zS(t,e,n,r,i,a,u,o){return{type:"group",name:n,role:t,style:e,from:r,interactive:i||!1,encode:a,marks:u,layout:o}}function TS(t,e,n,r,i){var a,u,o,s,l,c,f,h=kS(t,e),d=n.entries,p=!(!d||!d.interactive),g=d?d.name:void 0,m=h("clipHeight"),v=h("symbolOffset"),y={data:"value"},_={},x=`(${i}) ? datum.offset : datum.size`,b=m?mS(m):{field:"size"},w="datum.index",A=`max(1, ${i})`;b.mult=.5,_={enter:a={opacity:rS,x:{signal:x,mult:.5,offset:v},y:b},update:u={opacity:iS,x:a.x,y:a.y},exit:{opacity:rS}};var k=null,M=null;return t.fill||(k=e.symbolBaseFillColor,M=e.symbolBaseStrokeColor),yS(_,{fill:h("symbolFillColor",k),shape:h("symbolType"),size:h("symbolSize"),stroke:h("symbolStrokeColor",M),strokeDash:h("symbolDash"),strokeDashOffset:h("symbolDashOffset"),strokeWidth:h("symbolStrokeWidth")},{opacity:h("symbolOpacity")}),eS.forEach((function(e){t[e]&&(u[e]=a[e]={scale:t[e],field:tS})})),s=AS("symbol","legend-symbol",null,tS,y,_,n.symbols),m&&(s.clip=!0),(o=mS(v)).offset=h("labelOffset"),yS(_={enter:a={opacity:rS,x:{signal:x,offset:o},y:b},update:u={opacity:iS,text:{field:"label"},x:a.x,y:a.y},exit:{opacity:rS}},{align:h("labelAlign"),baseline:h("labelBaseline"),fill:h("labelColor"),fillOpacity:h("labelOpacity"),font:h("labelFont"),fontSize:h("labelFontSize"),fontStyle:h("labelFontStyle"),fontWeight:h("labelFontWeight"),limit:h("labelLimit")}),l=AS("text","legend-label","guide-label",tS,y,_,n.labels),_={enter:{noBound:{value:!m},width:rS,height:m?mS(m):rS,opacity:rS},exit:{opacity:rS},update:u={opacity:iS,row:{signal:null},column:{signal:null}}},h.isVertical(!0)?(c=`ceil(item.mark.items.length / ${A})`,u.row.signal=`${w}%${c}`,u.column.signal=`floor(${w} / ${c})`,f={field:["row",w]}):(u.row.signal=`floor(${w} / ${A})`,u.column.signal=`${w} % ${A}`,f={field:w}),u.column.signal=`(${i})?${u.column.signal}:${w}`,(t=zS("scope",null,g,r={facet:{data:r,name:"value",groupby:"index"}},p,_S(_,d,nS),[s,l])).sort=f,t}const NS='item.orient === "left"',OS='item.orient === "right"',RS=`(${NS} || ${OS})`,qS=`datum.vgrad && ${RS}`,US=ES('"top"','"bottom"','"middle"'),LS=`datum.vgrad && ${OS} ? (${ES('"right"','"left"','"center"')}) : (${RS} && !(datum.vgrad && ${NS})) ? "left" : ${DS}`,PS=`item._anchor || (${RS} ? "middle" : "start")`,$S=`${qS} ? (${NS} ? -90 : 90) : 0`,jS=`${RS} ? (datum.vgrad ? (${OS} ? "bottom" : "top") : ${US}) : "top"`;function IS(t,e){var n;return o(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+HS(t.path)+")":t.sphere&&(n="geoShape("+HS(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function HS(t){return o(t)&&t.signal?t.signal:l(t)}function WS(t){var e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")&&e.indexOf("title")?"group"===t.type?"scope":e||"mark":e}function YS(t){return{marktype:t.type,name:t.name||void 0,role:t.role||WS(t),zindex:+t.zindex||void 0}}function VS(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function GS(t,e){var n=Vr(t.type);n||i("Unrecognized transform type: "+l(t.type));var r=qC(n.type.toLowerCase(),null,XS(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function XS(t,e,n){var r,i,a,u={};for(i=0,a=t.params.length;iNC(t,e)),I(t.projections).forEach(t=>function(t,e){var n=e.config.projection||{},r={};for(var i in t)"name"!==i&&(r[i]=KF(t[i],i,e));for(i in n)null==r[i]&&(r[i]=KF(n[i],i,e));e.addProjection(t.name,r)}(t,e)),a.forEach(t=>function(t,e){var n=t.type||"linear";Um(n)||i("Unrecognized scale type: "+l(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e)),I(t.data).forEach(t=>dB(t,e)),a.forEach(t=>$F(t,e)),(n||r).forEach(t=>function(t,e){var n=e.getSignal(t.name),r=t.update;t.init&&(r?i("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=OC(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((function(t){sF(t,e,n.id)}))}(t,e)),I(t.axes).forEach(t=>_B(t,e)),I(t.marks).forEach(t=>lB(t,e)),I(t.legends).forEach(t=>cB(t,e)),t.title&&hB(t.title,e),e.parseLambdas(),e}function bB(t,e){var n,r,i,a,u,o,s=e.config;return u=LC(e.root=e.add(UC())),(o=function(t,e){const n=n=>YC(t[n],e[n]),r=[wB("background",n("background")),wB("autosize",FC(n("autosize"))),wB("padding",BC(n("padding"))),wB("width",n("width")||0),wB("height",n("height")||0)],i=r.reduce((t,e)=>(t[e.name]=e,t),{}),a={};return I(t.signals).forEach(t=>{K(i,t.name)?t=X(i[t.name],t):r.push(t),a[t.name]=t}),I(e.signals).forEach(t=>{K(a,t.name)||K(i,t.name)||r.push(t)}),r}(t,s)).forEach(t=>NC(t,e)),e.description=t.description||s.description,e.eventConfig=s.events,e.legends=e.objectProperty(s.legend&&s.legend.layout),r=e.add(pF()),i=_S({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t.encode),i=e.add(vF(xS(i,"group","frame",t.style,e,{pulse:LC(r)}))),a=e.add(qF({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:u,pulse:LC(i)})),e.operators.pop(),e.pushState(LC(i),LC(a),null),xB(t,e,o),e.operators.push(a),n=e.add(dF({mark:u,pulse:LC(a)})),n=e.add(TF({pulse:LC(n)})),n=e.add(OF({pulse:LC(n)})),e.addData("root",new rB(e,r,r,n)),e}function wB(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function AB(t){this.config=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._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function kB(t){this.config=t.config,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}var MB=AB.prototype=kB.prototype;function EB(t){return(u(t)?DB:CB)(t)}function DB(t){for(var e,n="[",r=0,i=t.length;r0?",":"")+(o(e=t[r])?e.signal||EB(e):l(e));return n+"]"}function CB(t){var e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+l(e)+":"+(o(n)?n.signal||EB(n):l(n));return r+"}"}MB.fork=function(){return new kB(this)},MB.isSubscope=function(){return this._subid>0},MB.toRuntime=function(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},MB.id=function(){return(this._subid?this._subid+":":0)+this._id++},MB.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((function(e){e.$ref=t.id})),t.refs=null),t},MB.proxy=function(t){var e=t instanceof RC?LC(t):t;return this.add(BF({value:e}))},MB.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},MB.addUpdate=function(t){return this.updates.push(t),t},MB.finish=function(){var t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){var r;t&&((r=t.data||(t.data={}))[e]||(r[e]=[])).push(n)}for(t in this.data)for(var r in n((e=this.data[t]).input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values"),e.index)n(e.index[r],t,"index:"+r);return this},MB.pushState=function(t,e,n){this._encode.push(LC(this.add(OF({pulse:t})))),this._parent.push(e),this._lookup.push(n?LC(this.proxy(n)):null),this._markpath.push(-1)},MB.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},MB.parent=function(){return k(this._parent)},MB.encode=function(){return k(this._encode)},MB.lookup=function(){return k(this._lookup)},MB.markpath=function(){var t=this._markpath;return++t[t.length-1]},MB.fieldRef=function(t,e){if(s(t))return PC(t,e);t.signal||i("Unsupported field reference: "+l(t));var n,r=t.signal,a=this.field[r];return a||(n={name:this.signalRef(r)},e&&(n.as=e),this.field[r]=a=LC(this.add(xF(n)))),a},MB.compareRef=function(t){function e(t){return HC(t)?(r=!0,n.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(r=!0,n.exprRef(t.expr)):t}var n=this,r=!1,i=I(t.field).map(e),a=I(t.order).map(e);return r?LC(this.add(gF({fields:i,orders:a}))):jC(i,a)},MB.keyRef=function(t,e){var n=this.signals,r=!1;return t=I(t).map((function(t){return HC(t)?(r=!0,LC(n[t.signal])):t})),r?LC(this.add(bF({fields:t,flat:e}))):function(t,e){var n={$key:t};return e&&(n.$flat=!0),n}(t,e)},MB.sortRef=function(t){if(!t)return t;var e=IC(t.op,t.field),n=t.order||"ascending";return n.signal?LC(this.add(gF({fields:e,orders:this.signalRef(n.signal)}))):jC(e,n)},MB.event=function(t,e){var n=t+":"+e;if(!this.events[n]){var r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},MB.hasOwnSignal=function(t){return K(this.signals,t)},MB.addSignal=function(t,e){this.hasOwnSignal(t)&&i("Duplicate signal name: "+l(t));var n=e instanceof RC?e:this.add(UC(e));return this.signals[t]=n},MB.getSignal=function(t){return this.signals[t]||i("Unrecognized signal name: "+l(t)),this.signals[t]},MB.signalRef=function(t){return this.signals[t]?LC(this.signals[t]):(K(this.lambdas,t)||(this.lambdas[t]=this.add(UC(null))),LC(this.lambdas[t]))},MB.parseLambdas=function(){for(var t=Object.keys(this.lambdas),e=0,n=t.length;e=r&&t=i?1:(e-r+1)/a},u.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},u.min(e).max(n)},t.randomKDE=qi,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=ji,t.randomMixture=Ii,t.randomNormal=Ri,t.randomUniform=Gi,t.read=Ar,t.regressionExp=ea,t.regressionLinear=Ki,t.regressionLoess=ua,t.regressionLog=ta,t.regressionPoly=ia,t.regressionPow=na,t.regressionQuad=ra,t.renderModule=jh,t.repeat=dt,t.resetSVGClipId=function(){Wc=1},t.responseType=ze,t.runtime=cC,t.runtimeContext=hC,t.sampleCurve=ca,t.sampleLogNormal=Ui,t.sampleNormal=zi,t.sampleUniform=Hi,t.scale=qm,t.sceneEqual=Xh,t.sceneFromJSON=Pf,t.scenePickVisit=Fc,t.sceneToJSON=Lf,t.sceneVisit=Cc,t.sceneZOrder=Dc,t.scheme=ev,t.setRandom=function(e){t.random=e},t.span=gt,t.splitAccessPath=a,t.stringValue=l,t.textMetrics=mf,t.timeBin=vo,t.timeFloor=Pu,t.timeFormat=ao,t.timeFormatLocale=wr,t.timeInterval=Xu,t.timeOffset=Qu,t.timeSequence=eo,t.timeUnitSpecifier=io,t.timeUnits=Su,t.toBoolean=mt,t.toDate=yt,t.toNumber=M,t.toSet=xt,t.toString=_t,t.transform=Gr,t.transforms=Yr,t.truncate=bt,t.truthy=m,t.tupleid=Ct,t.typeParsers=ie,t.utcFloor=Yu,t.utcFormat=uo,t.utcInterval=Ju,t.utcOffset=Ku,t.utcSequence=no,t.utcquarter=j,t.version="5.10.1",t.visitArray=wt,t.writeConfig=w,t.zero=p,t.zoomLinear=q,t.zoomLog=U,t.zoomPow=L,t.zoomSymlog=P,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/kpi_dashboard_altair/static/src/js/altair_widget.js b/kpi_dashboard_altair/static/src/js/altair_widget.js new file mode 100644 index 00000000..e63159a4 --- /dev/null +++ b/kpi_dashboard_altair/static/src/js/altair_widget.js @@ -0,0 +1,38 @@ +odoo.define('kpi_dashboard.AltairWidget', function (require) { + "use strict"; + + var AbstractWidget = require('kpi_dashboard.AbstractWidget'); + var registry = require('kpi_dashboard.widget_registry'); + + var AltairWidget = AbstractWidget.extend({ + template: 'kpi_dashboard.altair', + fillWidget: function (values) { + var widget = this.$el.find('[data-bind="value"]'); + widget.css('width', this.widget_size_x-20); + widget.css('height', this.widget_size_y-90); + var data = $.extend({ + height: this.widget_size_y - 90, + width: this.widget_size_x - 20, + autosize: { + type: "fit", + contains: "padding" + }, + }, values.value.altair); + vegaEmbed( + widget[0], + data, + this.altairOptions(values) + ); + }, + altairOptions: function () { + return { + actions: false, + height: this.widget_size_y - 90, + width: this.widget_size_x - 40, + }; + }, + }); + + registry.add('altair', AltairWidget); + return AltairWidget; +}); diff --git a/kpi_dashboard_altair/static/src/xml/dashboard.xml b/kpi_dashboard_altair/static/src/xml/dashboard.xml new file mode 100644 index 00000000..81264b89 --- /dev/null +++ b/kpi_dashboard_altair/static/src/xml/dashboard.xml @@ -0,0 +1,9 @@ + + diff --git a/kpi_dashboard_altair/views/webclient_templates.xml b/kpi_dashboard_altair/views/webclient_templates.xml new file mode 100644 index 00000000..bf792b9c --- /dev/null +++ b/kpi_dashboard_altair/views/webclient_templates.xml @@ -0,0 +1,14 @@ + + + +