@marimo-team/frontend 0.13.7-dev4 → 0.13.7-dev40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/ConnectedDataExplorerComponent-DitZV915.js +19 -0
- package/dist/assets/VegaLite-CyMkw5mT.js +189 -0
- package/dist/assets/_baseEach-BHxFGjHn.js +1 -0
- package/dist/assets/_baseMap-CYny-jsC.js +1 -0
- package/dist/assets/_baseUniq-BvRyuEBi.js +1 -0
- package/dist/assets/_createAggregator-YXL_ohbQ.js +1 -0
- package/dist/assets/{any-language-editor-CvayEMT-.js → any-language-editor-DRk8Nv_E.js} +3 -1
- package/dist/assets/apl-CXdQSnD-.js +1 -1
- package/dist/assets/arc-Cuwikxov.js +1 -1
- package/dist/assets/architectureDiagram-IEHRJDOE-1HVXFYlA.js +36 -0
- package/dist/assets/asciiarmor-D5V0T9Cu.js +1 -1
- package/dist/assets/asn1-DWPaVWf6.js +1 -1
- package/dist/assets/asterisk-B46aRdXb.js +1 -1
- package/dist/assets/blockDiagram-JOT3LUYC-h_ITwFSr.js +121 -0
- package/dist/assets/brainfuck-CtZaYBKt.js +1 -1
- package/dist/assets/c4Diagram-VJAJSXHY-Boop0PiK.js +10 -0
- package/dist/assets/channel-BU4cmCtw.js +1 -0
- package/dist/assets/chunk-4BMEZGHF-BZJ_R74h.js +1 -0
- package/dist/assets/chunk-A2AXSNBT-D4_Td4nw.js +164 -0
- package/dist/assets/chunk-AEK57VVT-CVuN-VFk.js +220 -0
- package/dist/assets/chunk-D6G4REZN-CBQa4ZSo.js +1 -0
- package/dist/assets/chunk-RZ5BOZE2-CciOZN_x.js +1 -0
- package/dist/assets/chunk-XZIHB7SX-DH_nhKM-.js +1 -0
- package/dist/assets/{circle-play-jjMzEKbf.js → circle-play-0wo_D4hL.js} +1 -2
- package/dist/assets/classDiagram-GIVACNV2-yfcdIQW4.js +1 -0
- package/dist/assets/classDiagram-v2-COTLJTTW-yfcdIQW4.js +1 -0
- package/dist/assets/clike-BgBwzOhw.js +1 -1
- package/dist/assets/clojure-DR_hEDJv.js +1 -1
- package/dist/assets/clone-DQp2i25Y.js +1 -0
- package/dist/assets/cmake-DXn5xaP-.js +1 -1
- package/dist/assets/cobol-stawOqaz.js +1 -1
- package/dist/assets/coffeescript-BTDxI-eT.js +1 -1
- package/dist/assets/colors-bszWmPJw.js +1 -1
- package/dist/assets/commonlisp-vq6DHwts.js +1 -1
- package/dist/assets/compile-BERwWmDn.js +10 -0
- package/dist/assets/crystal-CRzZ78HM.js +1 -1
- package/dist/assets/css-ZjFoif2m.js +1 -1
- package/dist/assets/cypher-gJDei3ni.js +1 -1
- package/dist/assets/cytoscape.esm-C5gjFiAL.js +10 -0
- package/dist/assets/d-BShv7fp-.js +1 -1
- package/dist/assets/dagre-OKDRZEBW-Cz3-cNDE.js +4 -0
- package/dist/assets/data-editor-3xICsu3E.js +142 -0
- package/dist/assets/diagram-SSKATNLV-DEXXgyjk.js +43 -0
- package/dist/assets/diagram-VNBRO52H-DRIVuL5r.js +24 -0
- package/dist/assets/diff-UJJ5BM9S.js +1 -1
- package/dist/assets/dockerfile-knGOOxt4.js +1 -1
- package/dist/assets/dtd-DI9Herc-.js +1 -1
- package/dist/assets/dylan-CHJ5qNM_.js +1 -1
- package/dist/assets/ebnf-B-Df8AvO.js +1 -1
- package/dist/assets/ecl-DPFc0Uaf.js +1 -1
- package/dist/assets/edit-page-hbtlL7Lg.js +134 -0
- package/dist/assets/eiffel-DR5c0IrL.js +1 -1
- package/dist/assets/elm-D7xaZ7Da.js +1 -1
- package/dist/assets/erDiagram-Q7BY3M3F-BH0Oa2r0.js +60 -0
- package/dist/assets/erlang-BuqgqA5h.js +1 -1
- package/dist/assets/fcl-CVaBTCzQ.js +1 -1
- package/dist/assets/flowDiagram-4HSFHLVR-CKS73LC7.js +161 -0
- package/dist/assets/forth-Dri_5nFc.js +1 -1
- package/dist/assets/fortran-DL7KluxX.js +1 -1
- package/dist/assets/ganttDiagram-APWFNJXF-Cv8wji_H.js +257 -0
- package/dist/assets/gas-5kEe4nk0.js +1 -1
- package/dist/assets/gherkin-B6X1vGSW.js +1 -1
- package/dist/assets/gitGraphDiagram-7IBYFJ6S-DkcQxvBy.js +65 -0
- package/dist/assets/graph-Bko0d97M.js +1 -0
- package/dist/assets/groovy-DnIzCrpZ.js +1 -1
- package/dist/assets/haskell-CmdsSjFB.js +1 -1
- package/dist/assets/haxe-D25e-2l-.js +1 -1
- package/dist/assets/home-page-D832iGMU.js +9 -0
- package/dist/assets/http-BKJkqRj4.js +1 -1
- package/dist/assets/idl-pcmmZuaN.js +1 -1
- package/dist/assets/index-8J1484E7.js +7 -0
- package/dist/assets/index-B6iTZJCy.js +1 -0
- package/dist/assets/index-BJcc61I9.js +1 -0
- package/dist/assets/index-BT2D5Kh3.js +476 -0
- package/dist/assets/index-C13hJdUs.js +1 -0
- package/dist/assets/index-CJJb8nrt.js +1 -0
- package/dist/assets/index-CZoFNto9.js +1 -0
- package/dist/assets/index-CwDkYzH5.js +1 -0
- package/dist/assets/index-D06uCJV3.js +1 -0
- package/dist/assets/index-D6cDKbm2.js +1 -0
- package/dist/assets/index-DKPnCnoa.js +19 -0
- package/dist/assets/index-DMUPkki0.css +1 -0
- package/dist/assets/index-DcJeXd87.js +1 -0
- package/dist/assets/index-EOfUy6In.js +1 -0
- package/dist/assets/index-KmxuDZRt.js +1 -0
- package/dist/assets/index-TlhNIFoS.js +1 -0
- package/dist/assets/index-aATRtiB6.js +1 -0
- package/dist/assets/index-ndjaWLEu.js +1 -0
- package/dist/assets/index-oq2mmpGs.js +1 -0
- package/dist/assets/index-sw4a-uGY.js +1 -0
- package/dist/assets/infoDiagram-PH2N3AL5-BJlnJwM9.js +2 -0
- package/dist/assets/init-DLRA0X12.js +1 -1
- package/dist/assets/javascript-D48wDJXV.js +1 -1
- package/dist/assets/jinja2-DhgKlfW7.js +1 -1
- package/dist/assets/journeyDiagram-U35MCT3I-aeMHYkXG.js +138 -0
- package/dist/assets/julia-DjdwvFuI.js +1 -1
- package/dist/assets/kanban-definition-NDS4AKOZ-155efCjK.js +88 -0
- package/dist/assets/katex-BsnJiHtx.js +261 -0
- package/dist/assets/layout-DLmcevZJ.js +1 -0
- package/dist/assets/linear-DmR_fw_i.js +1 -0
- package/dist/assets/livescript-HO6ttBFx.js +1 -1
- package/dist/assets/loro_wasm_bg-DHBNbovs.wasm +0 -0
- package/dist/assets/lua-8DXOpKDz.js +1 -1
- package/dist/assets/mathematica-IIbmv7SK.js +1 -1
- package/dist/assets/mbox-z_N2Mo3d.js +1 -0
- package/dist/assets/mermaid-BWIx1JLS.js +152 -0
- package/dist/assets/mhchem-C_nT2J_7.js +1 -0
- package/dist/assets/min-C1h4RdZs.js +1 -0
- package/dist/assets/mindmap-definition-ALO5MXBD-A2Ipw8gz.js +95 -0
- package/dist/assets/mirc-DkvFAiy5.js +1 -1
- package/dist/assets/mllike-3c2dg9RT.js +1 -1
- package/dist/assets/modelica-DSrSSXCg.js +1 -1
- package/dist/assets/mscgen-B2igx18G.js +1 -1
- package/dist/assets/mumps-zvxmGV4l.js +1 -1
- package/dist/assets/nginx-B4hAVlXN.js +1 -1
- package/dist/assets/ntriples-FFvkTduk.js +1 -1
- package/dist/assets/octave-C4hdQ5Hf.js +1 -1
- package/dist/assets/ordinal-DDUp3AbE.js +1 -1
- package/dist/assets/oz-qQq7irPq.js +1 -1
- package/dist/assets/pascal-CafrKXZF.js +1 -1
- package/dist/assets/perl-tdMlh9QA.js +1 -1
- package/dist/assets/pieDiagram-IB7DONF6-Sq9rWZdC.js +30 -0
- package/dist/assets/pig-CwGJVRC4.js +1 -1
- package/dist/assets/powershell-D1ly3AHC.js +1 -1
- package/dist/assets/properties-_nPj978X.js +1 -1
- package/dist/assets/protobuf-B4y9do6W.js +1 -1
- package/dist/assets/pug-_kJOm_E2.js +1 -1
- package/dist/assets/puppet-Bc-yJKzi.js +1 -1
- package/dist/assets/python-DD-Q2bae.js +1 -1
- package/dist/assets/q-B0kTJ4cI.js +1 -1
- package/dist/assets/quadrantDiagram-7GDLP6J5-DXCtQw02.js +7 -0
- package/dist/assets/r-BA4EbLKE.js +1 -1
- package/dist/assets/radar-MK3ICKWK-Cq34BeW5.js +126 -0
- package/dist/assets/range-CtcPcB_L.js +1 -1
- package/dist/assets/react-plotly-BinWDR5O.js +4074 -0
- package/dist/assets/requirementDiagram-KVF5MWMF-3pKChIvp.js +64 -0
- package/dist/assets/rpm-DI_rRufH.js +1 -1
- package/dist/assets/ruby-CR-u2WLS.js +1 -1
- package/dist/assets/run-page-CrgK4Rlf.js +1 -0
- package/dist/assets/sankeyDiagram-QLVOVGJD-vNRVDAW6.js +10 -0
- package/dist/assets/sas-Bqaci40L.js +1 -1
- package/dist/assets/save-worker-D7xNPs7e.js +1 -0
- package/dist/assets/scheme-qjP0V5Ag.js +1 -1
- package/dist/assets/sequenceDiagram-X6HHIX6F-DWiVNDJf.js +122 -0
- package/dist/assets/shell-BLav31RL.js +1 -1
- package/dist/assets/sieve-r025o_jW.js +1 -1
- package/dist/assets/simple-mode-C3vEBAcb.js +1 -1
- package/dist/assets/slides-component-mfQMptmj.js +1 -0
- package/dist/assets/smalltalk-C7J3IyEP.js +1 -1
- package/dist/assets/solr-78MBEUkU.js +1 -1
- package/dist/assets/sortBy-BHiIWp3-.js +1 -0
- package/dist/assets/sparql-BRLJFz69.js +1 -1
- package/dist/assets/spreadsheet-CGlWr0eM.js +1 -1
- package/dist/assets/sql-B3SPsWL6.js +1 -1
- package/dist/assets/stateDiagram-DGXRK772-BYk6v-j7.js +1 -0
- package/dist/assets/stateDiagram-v2-YXO3MK2T-D4vZtdjn.js +1 -0
- package/dist/assets/step-BwsUM5iJ.js +1 -1
- package/dist/assets/stylus-OdhglgkO.js +1 -1
- package/dist/assets/swift-B_XXVlXX.js +1 -1
- package/dist/assets/tcl-B2fODqDH.js +1 -1
- package/dist/assets/terminal-WqMRJt5Z.css +1 -0
- package/dist/assets/terminal-i5dUsc3X.js +9 -0
- package/dist/assets/textile-BuVhTOzU.js +1 -1
- package/dist/assets/tiddlywiki-BgR6AEZu.js +1 -1
- package/dist/assets/tiki-CI-ztowC.js +1 -1
- package/dist/assets/time-BUN_Mgk5.js +1 -0
- package/dist/assets/timeline-definition-BDJGKUSR-DaruHy2o.js +61 -0
- package/dist/assets/timer-DFzT7np-.js +1 -1
- package/dist/assets/toml-BQXy8elZ.js +1 -1
- package/dist/assets/tracing-QRDkN0bC.js +2 -0
- package/dist/assets/transform-Cyp0GDF-.js +1 -0
- package/dist/assets/tree-CO9Ev0F3.js +17 -0
- package/dist/assets/troff-Ce85hlLp.js +1 -1
- package/dist/assets/ttcn-BxnYHtq8.js +1 -1
- package/dist/assets/ttcn-cfg-CKJxb-l2.js +1 -1
- package/dist/assets/turtle-BkSuIpt-.js +1 -1
- package/dist/assets/useMarimoWebSocket-dfmeW0YP.js +27 -0
- package/dist/assets/vb-BHgjm0DN.js +1 -1
- package/dist/assets/vbscript-Dawdd5GZ.js +1 -1
- package/dist/assets/vega-component-Aj2Zq01k.js +1 -0
- package/dist/assets/velocity-BdD_26Jv.js +1 -1
- package/dist/assets/verilog-B4LBqg_1.js +1 -1
- package/dist/assets/vhdl-CWWH2SUo.js +1 -1
- package/dist/assets/web-vitals-Buym0gfC.js +1 -0
- package/dist/assets/webidl-CGwyPRYs.js +1 -1
- package/dist/assets/worker-BWN2kUSa.js +1 -0
- package/dist/assets/worker-D-UG5-wL.js +1 -0
- package/dist/assets/xquery-CVDBqZPY.js +1 -1
- package/dist/assets/xychartDiagram-VJFVF3MP-mZV_rpra.js +7 -0
- package/dist/assets/yacas-I8QjZlxf.js +1 -1
- package/dist/assets/z80-D8p3gKXp.js +1 -1
- package/dist/assets/zoom-COrs4lFh.js +1 -1
- package/dist/index.html +2 -2
- package/package.json +5 -4
- package/dist/assets/ConnectedDataExplorerComponent-fkwjF_oq.js +0 -22
- package/dist/assets/VegaLite-Dr9nVXts.js +0 -11
- package/dist/assets/_baseEach-P3p1hw0O.js +0 -1
- package/dist/assets/_baseMap-CMvHKsR9.js +0 -1
- package/dist/assets/_baseUniq-Bkm0IZrS.js +0 -1
- package/dist/assets/_createAggregator-vC-2tf4_.js +0 -1
- package/dist/assets/architectureDiagram-IEHRJDOE-CcWyZkO2.js +0 -1
- package/dist/assets/blockDiagram-JOT3LUYC-DF26tlqR.js +0 -1
- package/dist/assets/c4Diagram-VJAJSXHY-YroCHEVd.js +0 -1
- package/dist/assets/channel-B_K3wJTl.js +0 -1
- package/dist/assets/chunk-4BMEZGHF-5v6PGvPH.js +0 -1
- package/dist/assets/chunk-A2AXSNBT-BVeZ640P.js +0 -1
- package/dist/assets/chunk-AEK57VVT-C9hDEWIM.js +0 -1
- package/dist/assets/chunk-D6G4REZN-Bj40BtC7.js +0 -1
- package/dist/assets/chunk-RZ5BOZE2-DXUIS5Ng.js +0 -1
- package/dist/assets/chunk-XZIHB7SX-lDI7m6aZ.js +0 -1
- package/dist/assets/classDiagram-GIVACNV2-BHTxHW71.js +0 -1
- package/dist/assets/classDiagram-v2-COTLJTTW-BHTxHW71.js +0 -1
- package/dist/assets/clone-B-op5z9A.js +0 -1
- package/dist/assets/compile-Db91qzUb.js +0 -1
- package/dist/assets/cytoscape.esm-bH-fs5wT.js +0 -9
- package/dist/assets/dagre-OKDRZEBW-BwkFTbNR.js +0 -1
- package/dist/assets/data-editor-CFVtUBgQ.js +0 -1
- package/dist/assets/diagram-SSKATNLV-Cv8jpHzQ.js +0 -1
- package/dist/assets/diagram-VNBRO52H-DCHaCQor.js +0 -1
- package/dist/assets/edit-page-BzUvShyW.js +0 -8
- package/dist/assets/erDiagram-Q7BY3M3F-CMOTNFiD.js +0 -1
- package/dist/assets/flowDiagram-4HSFHLVR-CQFWSy_k.js +0 -1
- package/dist/assets/ganttDiagram-APWFNJXF-BsgVXsqF.js +0 -1
- package/dist/assets/gitGraphDiagram-7IBYFJ6S-B560jito.js +0 -1
- package/dist/assets/graph-AeMIzpf1.js +0 -1
- package/dist/assets/home-page-KqDpdERR.js +0 -7
- package/dist/assets/index-4L2BV8NY.js +0 -1
- package/dist/assets/index-B3D-uA1N.js +0 -1
- package/dist/assets/index-BI7QpmL3.js +0 -1
- package/dist/assets/index-C-lM9c3Z.css +0 -1
- package/dist/assets/index-C5ELXaxf.js +0 -1
- package/dist/assets/index-CCTBp10h.js +0 -1
- package/dist/assets/index-CDBNCwx6.js +0 -1
- package/dist/assets/index-CIDvop30.js +0 -1
- package/dist/assets/index-C_SvR4xD.js +0 -1
- package/dist/assets/index-CnBJX8vR.js +0 -87
- package/dist/assets/index-Cw-UPnI9.js +0 -1
- package/dist/assets/index-D0Os4d0x.js +0 -1
- package/dist/assets/index-DDwZR-UT.js +0 -1
- package/dist/assets/index-Dbr_qElY.js +0 -1
- package/dist/assets/index-DdGbxLnb.js +0 -1
- package/dist/assets/index-DekJljTx.js +0 -1
- package/dist/assets/index-FrTjQQ-n.js +0 -1
- package/dist/assets/index-O9MVf66F.js +0 -1
- package/dist/assets/index-kGs5nYlG.js +0 -1
- package/dist/assets/index-r181vTuW.js +0 -1
- package/dist/assets/infoDiagram-PH2N3AL5-BXPvmR81.js +0 -1
- package/dist/assets/journeyDiagram-U35MCT3I-B0S_SgVK.js +0 -1
- package/dist/assets/kanban-definition-NDS4AKOZ-UUQ6q8Vg.js +0 -1
- package/dist/assets/katex-Blph-pX_.js +0 -1
- package/dist/assets/layout-B6OElfH3.js +0 -1
- package/dist/assets/linear-71qVJqzE.js +0 -1
- package/dist/assets/mbox-DoeuZPxA.js +0 -1
- package/dist/assets/mermaid-BKvupWB0.js +0 -7
- package/dist/assets/mhchem-9pkdwevO.js +0 -1
- package/dist/assets/min-o9PQCIYY.js +0 -1
- package/dist/assets/mindmap-definition-ALO5MXBD-r9NCPgW2.js +0 -1
- package/dist/assets/pieDiagram-IB7DONF6-Dmq3_UTw.js +0 -1
- package/dist/assets/quadrantDiagram-7GDLP6J5-D3XIPN3p.js +0 -1
- package/dist/assets/radar-MK3ICKWK-DMsqSlzj.js +0 -1
- package/dist/assets/react-plotly-D0H8qIDi.js +0 -71
- package/dist/assets/requirementDiagram-KVF5MWMF-nMbD5UXj.js +0 -1
- package/dist/assets/run-page-DqwwqtBw.js +0 -1
- package/dist/assets/sankeyDiagram-QLVOVGJD-CHcwi6do.js +0 -1
- package/dist/assets/save-worker-CQvBUha3.js +0 -1
- package/dist/assets/sequenceDiagram-X6HHIX6F-D_Tk-O8S.js +0 -1
- package/dist/assets/slides-component-BKNzEggW.js +0 -1
- package/dist/assets/sortBy-Cxz_qN5n.js +0 -1
- package/dist/assets/stateDiagram-DGXRK772-B6F0-yMC.js +0 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-DEYCyNdv.js +0 -1
- package/dist/assets/terminal-DVzybcfs.css +0 -1
- package/dist/assets/terminal-DgvuopHs.js +0 -1
- package/dist/assets/time-DVhNtfw7.js +0 -1
- package/dist/assets/timeline-definition-BDJGKUSR-wZ6E2B7F.js +0 -1
- package/dist/assets/tracing-Qs-WYY01.js +0 -8
- package/dist/assets/transform-DjHZbYKP.js +0 -1
- package/dist/assets/tree-BRrL0gYK.js +0 -8
- package/dist/assets/useMarimoWebSocket-DhxiOkxx.js +0 -15
- package/dist/assets/vega-component-BAwXbAnn.js +0 -1
- package/dist/assets/web-vitals-rCWRSGQR.js +0 -1
- package/dist/assets/worker-DMKWnagd.js +0 -1
- package/dist/assets/worker-DXe6aoib.js +0 -1
- package/dist/assets/xychartDiagram-VJFVF3MP-mbHTJRBl.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{co as e,gl as t,gm as n,gn as i,go as r,gp as o,gq as a,gr as s,gs as u,gt as l,gu as c,cy as f,gv as d,gw as h,gx as p,gy as m,gz as g,gA as y,gB as v,gC as b,gD as x,gE as w,gF as _,gG as A,gH as k,gI as D,gJ as F,gK as C,gL as E,gM as $,gN as S,gO as M,gP as B,aP as z,gQ as O,gR as N,gS as R,gT as T,gU as P,gV as j,gW as L,gX as q,gY as U,cv as I,cp as W,cu as H,gZ as G,aQ as V,b4 as Y,b5 as X,g_ as J,b7 as K,b8 as Q,b9 as Z,g$ as ee,h0 as te,cA as ne,cz as ie,h1 as re,h2 as oe,h3 as ae,h4 as se,h5 as ue,h6 as le,h7 as ce,h8 as fe,aY as de,h9 as he,ha as pe,hb as me,hc as ge,hd as ye,he as ve,hf as be,hg as xe,hh as we,hi as _e,hj as Ae,hk as ke,hl as De,hm as Fe,hn as Ce,ho as Ee,hp as $e,hq as Se,hr as Me,hs as Be,ht as ze,hu as Oe,hv as Ne,hw as Re,hx as Te,cC as Pe,hy as je,hz as Le,cB as qe,hA as Ue,hB as Ie,hC as We,hD as He,hE as Ge,hF as Ve,hG as Ye,hH as Xe,hI as Je,hJ as Ke,hK as Qe,hL as Ze,hM as et,hN as tt,hO as nt,hP as it,hQ as rt,hR as ot,aF as at,hS as st,hT as ut,hU as lt,hV as ct,hW as ft,hX as dt,hY as ht,cD as pt}from"./index-CnBJX8vR.js";import{m as mt,a as gt,d as yt,r as vt,l as bt,i as xt,h as wt,n as _t,c as At,u as kt,b as Dt,t as Ft,e as Ct}from"./time-DVhNtfw7.js";import{n as Et,b as $t,i as St,d as Mt,e as Bt,f as zt,o as Ot,g as Nt,h as Rt,j as Tt,t as Pt,a as jt,k as Lt,m as qt,l as Ut,p as It,q as Wt}from"./linear-71qVJqzE.js";import{r as Ht}from"./range-CtcPcB_L.js";import{R as Gt,r as Vt,d as Yt,e as Xt,m as Jt,o as Kt,C as Qt,h as Zt,p as en,n as tn,q as nn,s as rn,i as on,a as an,u as sn,v as un,b as ln,k as cn,j as fn,T as dn,l as hn,w as pn,t as mn,g as gn}from"./timer-DFzT7np-.js";import{i as yn}from"./zoom-COrs4lFh.js";import{i as vn,a as bn}from"./init-DLRA0X12.js";import{I as xn,o as wn,i as _n}from"./ordinal-DDUp3AbE.js";import{c as An}from"./colors-bszWmPJw.js";import{d as kn}from"./arc-Cuwikxov.js";import{w as Dn,n as Fn,z as Cn,a as En,J as $n,K as Sn,l as Mn,b as Bn,t as zn,p as On,L as Nn,o as Rn,q as Tn,r as Pn,u as jn,x as Ln,v as qn,y as Un,B as In,C as Wn,A as Hn,F as Gn,E as Vn,D as Yn,G as Xn,H as Jn,I as Kn,k as Qn}from"./step-BwsUM5iJ.js";class Zn{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const t=this._partials;let n=0;for(let i=0;i<this._n&&i<32;i++){const r=t[i],o=e+r,a=Math.abs(e)<Math.abs(r)?e-(o-r):r-(o-e);a&&(t[n++]=a),e=o}return t[n]=e,this._n=n+1,this}valueOf(){const e=this._partials;let t,n,i,r=this._n,o=0;if(r>0){for(o=e[--r];r>0&&(t=o,n=e[--r],o=t+n,i=n-(o-t),!i););r>0&&(i<0&&e[r-1]<0||i>0&&e[r-1]>0)&&(n=2*i,t=o+n,n==t-o&&(o=t))}return o}}function ei(e,t){return(null==e||!(e>=e))-(null==t||!(t>=t))||(e<t?-1:e>t?1:0)}function ti(t,n,i=0,r=1/0,o){if(n=Math.floor(n),i=Math.floor(Math.max(0,i)),r=Math.floor(Math.min(t.length-1,r)),!(i<=n&&n<=r))return t;for(o=void 0===o?ei:function(t=e){if(t===e)return ei;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,n)=>{const i=t(e,n);return i||0===i?i:(0===t(n,n))-(0===t(e,e))}}(o);r>i;){if(r-i>600){const e=r-i+1,a=n-i+1,s=Math.log(e),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(e-u)/e)*(a-e/2<0?-1:1);ti(t,n,Math.max(i,Math.floor(n-a*u/e+l)),Math.min(r,Math.floor(n+(e-a)*u/e+l)),o)}const e=t[n];let a=i,s=r;for(ni(t,i,n),o(t[r],e)>0&&ni(t,i,r);a<s;){for(ni(t,a,s),++a,--s;o(t[a],e)<0;)++a;for(;o(t[s],e)>0;)--s}0===o(t[i],e)?ni(t,i,s):(++s,ni(t,s,r)),s<=n&&(i=s+1),n<=s&&(r=s-1)}return t}function ni(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function ii(e,t,n){if((i=(e=Float64Array.from(Et(e,n))).length)&&!isNaN(t=+t)){if(t<=0||i<2)return mt(e);if(t>=1)return gt(e);var i,r=(i-1)*t,o=Math.floor(r),a=gt(ti(e,o).subarray(0,o+1));return a+(mt(e.subarray(o+1))-a)*(r-o)}}function ri(e,t,n=$t){if((i=e.length)&&!isNaN(t=+t)){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,o=Math.floor(r),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(r-o)}}function oi(e,t){return ii(e,.5,t)}function ai(e){return Array.from(function*(e){for(const t of e)yield*t}(e))}function si(e,t){let n=0;for(let i of e)(i=+i)&&(n+=i);return n}function ui(e){return e instanceof xn?e:new xn(e)}var li=-.14861,ci=1.78277,fi=-.29227,di=-.90649,hi=1.97294,pi=hi*di,mi=hi*ci,gi=ci*fi-di*li;function yi(e,t,n,i){return 1===arguments.length?function(e){if(e instanceof vi)return new vi(e.h,e.s,e.l,e.opacity);e instanceof Gt||(e=Vt(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(gi*i+pi*t-mi*n)/(gi+pi-mi),o=i-r,a=(hi*(n-r)-fi*o)/di,s=Math.sqrt(a*a+o*o)/(hi*r*(1-r)),u=s?Math.atan2(a,o)*yt-120:NaN;return new vi(u<0?u+360:u,s,r,e.opacity)}(e):new vi(e,t,n,null==i?1:i)}function vi(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}function bi(e){return function(t,n){var i=e((t=en(t)).h,(n=en(n)).h),r=tn(t.s,n.s),o=tn(t.l,n.l),a=tn(t.opacity,n.opacity);return function(e){return t.h=i(e),t.s=r(e),t.l=o(e),t.opacity=a(e),t+""}}}Yt(vi,yi,Xt(Qt,{brighter(e){return e=null==e?Kt:Math.pow(Kt,e),new vi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Jt:Math.pow(Jt,e),new vi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*vt,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new Gt(255*(t+n*(li*i+ci*r)),255*(t+n*(fi*i+di*r)),255*(t+n*(hi*i)),this.opacity)}}));const xi=bi(Zt);var wi=bi(tn);function _i(e){return function t(n){function i(t,i){var r=e((t=yi(t)).h,(i=yi(i)).h),o=tn(t.s,i.s),a=tn(t.l,i.l),s=tn(t.opacity,i.opacity);return function(e){return t.h=r(e),t.s=o(e),t.l=a(Math.pow(e,n)),t.opacity=s(e),t+""}}return n=+n,i.gamma=t,i}(1)}const Ai=_i(Zt);var ki=_i(tn);function Di(e,t){void 0===t&&(t=e,e=St);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);n<i;)o[n]=e(r,r=t[++n]);return function(e){var t=Math.max(0,Math.min(i-1,Math.floor(e*=i)));return o[t](e-t)}}const Fi=Object.freeze(Object.defineProperty({__proto__:null,interpolate:St,interpolateArray:Mt,interpolateBasis:nn,interpolateBasisClosed:rn,interpolateCubehelix:Ai,interpolateCubehelixLong:ki,interpolateDate:Bt,interpolateDiscrete:function(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}},interpolateHcl:xt,interpolateHclLong:wt,interpolateHsl:xi,interpolateHslLong:wi,interpolateHue:function(e,t){var n=Zt(+e,+t);return function(e){var t=n(e);return t-360*Math.floor(t/360)}},interpolateLab:function(e,t){var n=tn((e=bt(e)).l,(t=bt(t)).l),i=tn(e.a,t.a),r=tn(e.b,t.b),o=tn(e.opacity,t.opacity);return function(t){return e.l=n(t),e.a=i(t),e.b=r(t),e.opacity=o(t),e+""}},interpolateNumber:on,interpolateNumberArray:zt,interpolateObject:Ot,interpolateRgb:an,interpolateRgbBasis:sn,interpolateRgbBasisClosed:un,interpolateRound:Nt,interpolateString:ln,interpolateTransformCss:cn,interpolateTransformSvg:fn,interpolateZoom:yn,piecewise:Di,quantize:function(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}},Symbol.toStringTag,{value:"Module"}));function Ci(e){const t=e||l,n=[],i={};return n.add=e=>{const r=t(e);return i[r]||(i[r]=1,n.push(e)),n},n.remove=e=>{const r=t(e);if(i[r]){i[r]=0;const t=n.indexOf(e);t>=0&&n.splice(t,1)}return n},n}async function Ei(e,t){try{await t(e)}catch(n){e.error(n)}}const $i=Symbol("vega_id");let Si=1;function Mi(e){return!(!e||!Bi(e))}function Bi(e){return e[$i]}function zi(e,t){return e[$i]=t,e}function Oi(e){const t=e===Object(e)?e:{data:e};return Bi(t)?t:zi(t,Si++)}function Ni(e){return Ri(e,Oi({}))}function Ri(e,t){for(const n in e)t[n]=e[n];return t}function Ti(e,t){return zi(t,Bi(e))}function Pi(e,t){return e?t?(n,i)=>e(n,i)||Bi(t(n))-Bi(t(i)):(t,n)=>e(t,n)||Bi(t)-Bi(n):null}function ji(e){return e&&e.constructor===Li}function Li(){const e=[],t=[],n=[],i=[],r=[];let o=null,l=!1;return{constructor:Li,insert(t){const n=u(t),i=n.length;for(let r=0;r<i;++r)e.push(n[r]);return this},remove(e){const n=a(e)?i:t,r=u(e),o=r.length;for(let t=0;t<o;++t)n.push(r[t]);return this},modify(e,t,i){const o={field:t,value:s(i)};return a(e)?(o.filter=e,r.push(o)):(o.tuple=e,n.push(o)),this},encode(e,t){return a(e)?r.push({filter:e,field:t}):n.push({tuple:e,field:t}),this},clean(e){return o=e,this},reflow(){return l=!0,this},pulse(a,s){const u={},c={};let f,d,h,p,m,g;for(f=0,d=s.length;f<d;++f)u[Bi(s[f])]=1;for(f=0,d=t.length;f<d;++f)m=t[f],u[Bi(m)]=-1;for(f=0,d=i.length;f<d;++f)p=i[f],s.forEach((e=>{p(e)&&(u[Bi(e)]=-1)}));for(f=0,d=e.length;f<d;++f)m=e[f],g=Bi(m),u[g]?u[g]=1:a.add.push(Oi(e[f]));for(f=0,d=s.length;f<d;++f)m=s[f],u[Bi(m)]<0&&a.rem.push(m);function y(e,t,n){n?e[t]=n(e):a.encode=t,l||(c[Bi(e)]=e)}for(f=0,d=n.length;f<d;++f)h=n[f],m=h.tuple,p=h.field,g=u[Bi(m)],g>0&&(y(m,p,h.value),a.modifies(p));for(f=0,d=r.length;f<d;++f)h=r[f],p=h.filter,s.forEach((e=>{p(e)&&u[Bi(e)]>0&&y(e,h.field,h.value)})),a.modifies(h.field);if(l)a.mod=t.length||i.length?s.filter((e=>u[Bi(e)]>0)):s.slice();else for(g in c)a.mod.push(c[g]);return(o||null==o&&(t.length||i.length))&&a.clean(!0),a}}}const qi="_:mod:_";function Ui(){Object.defineProperty(this,qi,{writable:!0,value:{}})}Ui.prototype={set(e,t,n,i){const r=this,o=r[e],a=r[qi];return null!=t&&t>=0?(o[t]!==n||i)&&(o[t]=n,a[t+":"+e]=-1,a[e]=-1):(o!==n||i)&&(r[e]=n,a[e]=f(n)?1+n.length:-1),r},modified(e,t){const n=this[qi];if(!arguments.length){for(const e in n)if(n[e])return!0;return!1}if(f(e)){for(let t=0;t<e.length;++t)if(n[e[t]])return!0;return!1}return null!=t&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[qi]={},this}};let Ii=0;const Wi=new Ui;function Hi(e,t,n,i){this.id=++Ii,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,i)}function Gi(e){return function(t){const n=this.flags;return 0===arguments.length?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Hi.prototype={targets(){return this._targets||(this._targets=Ci(h))},set(e){return this.value!==e?(this.value=e,1):0},skip:Gi(1),modified:Gi(2),parameters(e,t,n){t=!1!==t;const i=this._argval=this._argval||new Ui,r=this._argops=this._argops||[],o=[];let a,s,l,c;const h=(e,n,a)=>{a instanceof Hi?(a!==this&&(t&&a.targets().add(this),o.push(a)),r.push({op:a,name:e,index:n})):i.set(e,n,a)};for(a in e)if(s=e[a],"pulse"===a)u(s).forEach((e=>{e instanceof Hi?e!==this&&(e.targets().add(this),o.push(e)):d("Pulse parameters must be operator instances.")})),this.source=s;else if(f(s))for(i.set(a,-1,Array(l=s.length)),c=0;c<l;++c)h(a,c,s[c]);else h(a,-1,s);return this.marshall().clear(),n&&(r.initonly=!0),o},marshall(e){const t=this._argval||Wi,n=this._argops;let i,r,o,a;if(n){const s=n.length;for(r=0;r<s;++r)i=n[r],o=i.op,a=o.modified()&&o.stamp===e,t.set(i.name,i.index,o.value,a);if(n.initonly){for(r=0;r<s;++r)i=n[r],i.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,n,i,r;if(e)for(t=0,n=e.length;t<n;++t)i=e[t],r=i.op,r._targets&&r._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const n=this.marshall(e.stamp),i=t.call(this,n,e);if(n.clear(),i!==this.value)this.value=i;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};let Vi=0;function Yi(e,t,n){this.id=++Vi,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Xi(e,t,n){return new Yi(e,t,n)}Yi.prototype={_filter:p,_apply:l,targets(){return this._targets||(this._targets=Ci(h))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),n=this._targets,i=n?n.length:0;for(let e=0;e<i;++e)n[e].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Xi(e);return this.targets().add(t),t},apply(e){const t=Xi(null,e);return this.targets().add(t),t},merge(){const e=Xi();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter((()=>{const n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){const t=Xi();return this.targets().add(Xi(null,null,b(e,(e=>{const n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},between(e,t){let n=!1;return e.targets().add(Xi(null,null,(()=>n=!0))),t.targets().add(Xi(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=p,this._targets=null}};const Ji={skip:!0};function Ki(e,t,n,i,r,o){const u=v({},o,Ji);let l,c;a(n)||(n=s(n)),void 0===i?l=t=>e.touch(n(t)):a(i)?(c=new Hi(null,i,r,!1),l=t=>{c.evaluate(t);const i=n(t),r=c.value;ji(r)?e.pulse(i,r,o):e.update(i,r,u)}):l=t=>e.update(n(t),i,u),t.apply(l)}function Qi(e,t,n,i,r,o){if(void 0===i)t.targets().add(n);else{const u=o||{},l=new Hi(null,function(e,t){return t=a(t)?t:s(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}(n,i),r,!1);l.modified(u.force),l.rank=t.rank,t.targets().add(l),n&&(l.skip(!0),l.value=n.value,l.targets().add(n),e.connect(n,[l]))}}const Zi={};function er(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function tr(e,t){const n=[];return m(e,t,(e=>n.push(e))),n}function nr(e,t){const n={};return e.visit(t,(e=>{n[Bi(e)]=1})),e=>n[Bi(e)]?null:e}function ir(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}function rr(e,t,n,i){const r=this;let o=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const a of n)if(a.stamp===t){if(a.fields){const e=r.fields||(r.fields={});for(const t in a.fields)e[t]=1}a.changed(r.ADD)&&(o|=r.ADD),a.changed(r.REM)&&(o|=r.REM),a.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}function or(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}er.prototype={StopPropagation:Zi,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new er(this.dataflow).init(this,e)},clone(){const e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new er(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,nr(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return f(e)?e.forEach((e=>t[e]=!0)):t[e]=!0,this},modified(e,t){const n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?f(e)?e.some((e=>n[e])):n[e]:!!n)},filter(e,t){const n=this;return 1&e&&(n.addF=ir(n.addF,t)),2&e&&(n.remF=ir(n.remF,t)),4&e&&(n.modF=ir(n.modF,t)),16&e&&(n.srcF=ir(n.srcF,t)),n},materialize(e){const t=this;return 1&(e=e||7)&&t.addF&&(t.add=tr(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=tr(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=tr(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(16&e)return m(n.source,n.srcF,i),n;1&e&&m(n.add,n.addF,i),2&e&&m(n.rem,n.remF,i),4&e&&m(n.mod,n.modF,i);const r=n.source;if(8&e&&r){const e=n.add.length+n.mod.length;e===r.length||m(r,e?nr(n,5):n.srcF,i)}return n}},t(rr,er,{fork(e){const t=new er(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(e=>t.add.push(e))),e&t.REM&&this.visit(t.REM,(e=>t.rem.push(e))),e&t.MOD&&this.visit(t.MOD,(e=>t.mod.push(e)))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?f(e)?e.some((e=>n[e])):n[e]:0},filter(){d("MultiPulse does not support filtering.")},materialize(){d("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let o=0;if(e&n.SOURCE)for(;o<r;++o)i[o].visit(e,t);else for(;o<r;++o)i[o].stamp===n.stamp&&i[o].visit(e,t);return n}});const ar={skip:!1,force:!1};function sr(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),ur(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,function(e,t,n){const i=t,r=e.length,o=e[t];let a,s=1+(t<<1);for(;s<r;)a=s+1,a<r&&n(e[s],e[a])>=0&&(s=a),e[t]=e[s],s=1+((t=s)<<1);e[t]=o,ur(e,i,t,n)}(t,0,e)):i=n,i}}}function ur(e,t,n,i){let r,o;const a=e[n];for(;n>t&&(o=n-1>>1,r=e[o],i(a,r)<0);)e[n]=r,n=o;return e[n]=a}function lr(){this.logger(n()),this.logLevel(i),this._clock=0,this._rank=0,this._locale=r();try{this._loader=o()}catch(e){}this._touched=Ci(h),this._input={},this._pulse=null,this._heap=sr(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function cr(e){return function(){return this._log[e].apply(this,arguments)}}function fr(e,t){Hi.call(this,e,null,t)}lr.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:cr("error"),warn:cr("warn"),info:cr("info"),debug:cr("debug"),logLevel:cr("level"),cleanThreshold:1e4,add:function(e,t,n,i){let r,o=1;return e instanceof Hi?r=e:e&&e.prototype instanceof Hi?r=new e:a(e)?r=new Hi(null,e):(o=0,r=new Hi(e,t)),this.rank(r),o&&(i=n,n=t),n&&this.connect(r,r.parameters(n,i)),this.touch(r),r},connect:function(e,t){const n=e.rank,i=t.length;for(let r=0;r<i;++r)if(n<t[r].rank)return void this.rerank(e)},rank:function(e){e.rank=++this._rank},rerank:function(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&d("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||ar);const i=new er(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this},touch:function(e,t){const n=t||ar;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){const i=n||ar;return(e.set(t)||i.force)&&this.touch(e,i),this},changeset:Li,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){const n=this.locale();return y(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){const i=this,r=i._pending||function(e){let t;const n=new Promise((e=>t=e));return n.requests=0,n.done=()=>{0==--n.requests&&(e._pending=null,t(e))},e._pending=n}(i);r.requests+=1;const o=await i.request(t,n);return i.pulse(e,i.changeset().remove(p).insert(o.data||[])),r.done(),o},request:async function(e,t){const n=this;let i,r=0;try{i=await n.loader().load(e,{context:"dataflow",response:g(t&&t.type)});try{i=n.parse(i,t)}catch(o){r=-2,n.warn("Data ingestion failed",e,o)}}catch(o){r=-1,n.warn("Loading failed",e,o)}return{data:i,status:r}},events:function(e,t,n,i){const r=this,o=Xi(n,i),a=function(e){e.dataflow=r;try{o.receive(e)}catch(t){r.error(t)}finally{r.run()}};let s;s="string"==typeof e&&"undefined"!=typeof document?document.querySelectorAll(e):u(e);const l=s.length;for(let u=0;u<l;++u)s[u].addEventListener(t,a);return o},on:function(e,t,n,i,r){return(e instanceof Hi?Qi:Ki)(this,e,t,n,i,r),this},evaluate:async function(e,t,n){const i=this,r=[];if(i._pulse)return or(i);if(i._pending&&await i._pending,t&&await Ei(i,t),!i._touched.length)return i.debug("Dataflow invoked, but nothing to do."),i;const o=++i._clock;i._pulse=new er(i,o,e),i._touched.forEach((e=>i._enqueue(e,!0))),i._touched=Ci(h);let a,s,u,l=0;try{for(;i._heap.size()>0;)a=i._heap.pop(),a.rank===a.qrank?(s=a.run(i._getPulse(a,e)),s.then?s=await s:s.async&&(r.push(s.async),s=Zi),s!==Zi&&a._targets&&a._targets.forEach((e=>i._enqueue(e))),++l):i._enqueue(a,!0)}catch(c){i._heap.clear(),u=c}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${l} operators`),u&&(i._postrun=[],i.error(u)),i._postrun.length){const e=i._postrun.sort(((e,t)=>t.priority-e.priority));i._postrun=[];for(let t=0;t<e.length;++t)await Ei(i,e[t].callback)}return n&&await Ei(i,n),r.length&&Promise.all(r).then((e=>i.runAsync(null,(()=>{e.forEach((e=>{try{e(i)}catch(c){i.error(c)}}))})))),i},run:function(e,t,n){return this._pulse?or(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(i){this.error(i)}},_enqueue:function(e,t){const n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))},_getPulse:function(e,t){const n=e.source,i=this._clock;return n&&f(n)?new rr(this,i,n.map((e=>e.pulse)),t):this._input[e.id]||function(e,t){if(t&&t.stamp===e.stamp)return t;e=e.fork(),t&&t!==Zi&&(e.source=t.source);return e}(this._pulse,n&&n.pulse)}},t(fr,Hi,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then((e=>this.pulse=e)):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const dr={};function hr(e){const t=pr(e);return t&&t.Definition||null}function pr(e){return e=e&&e.toLowerCase(),c(dr,e)?dr[e]:null}function*mr(e,t){if(null==t)for(let n of e)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let n=-1;for(let i of e)i=t(i,++n,e),null!=i&&""!==i&&(i=+i)>=i&&(yield i)}}function gr(t,n,i){const r=Float64Array.from(mr(t,i));return r.sort(e),n.map((e=>ri(r,e)))}function yr(e,t){return gr(e,[.25,.5,.75],t)}function vr(e,t){const n=e.length,i=function(e,t){const n=function(e,t){let n,i=0,r=0,o=0;if(void 0===t)for(let a of e)null!=a&&(a=+a)>=a&&(n=a-r,r+=n/++i,o+=n*(a-r));else{let a=-1;for(let s of e)null!=(s=t(s,++a,e))&&(s=+s)>=s&&(n=s-r,r+=n/++i,o+=n*(s-r))}if(i>1)return o/(i-1)}(e,t);return n?Math.sqrt(n):n}(e,t),r=yr(e,t),o=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,o)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function br(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o,a,s,u,l,c,f=e.extent[0],d=e.extent[1];const h=e.span||d-f||Math.abs(f)||1;if(e.step)o=e.step;else if(e.steps){for(u=h/t,l=0,c=e.steps.length;l<c&&e.steps[l]<u;++l);o=e.steps[Math.max(0,l-1)]}else{for(a=Math.ceil(Math.log(t)/i),s=e.minstep||0,o=Math.max(s,Math.pow(n,Math.round(Math.log(h)/i)-a));Math.ceil(h/o)>t;)o*=n;for(l=0,c=r.length;l<c;++l)u=o/r[l],u>=s&&h/u<=t&&(o=u)}u=Math.log(o);const p=u>=0?0:1+~~(-u/i),m=Math.pow(n,-p-1);return(e.nice||void 0===e.nice)&&(u=Math.floor(f/o+m)*o,f=f<u?u-o:u,d=Math.ceil(d/o)*o),{start:f,stop:d===f?f+o:d,step:o}}var xr=Math.random;function wr(t,n,i,r){if(!t.length)return[void 0,void 0];const o=Float64Array.from(mr(t,r)),a=o.length,s=n;let u,l,c,f;for(c=0,f=Array(s);c<s;++c){for(u=0,l=0;l<a;++l)u+=o[~~(xr()*a)];f[c]=u/a}return f.sort(e),[ii(f,i/2),ii(f,1-i/2)]}function _r(e,t,n,i){i=i||(e=>e);const r=e.length,o=new Float64Array(r);let a,s=0,u=1,l=i(e[0]),c=l,f=l+t;for(;u<r;++u){if(a=i(e[u]),a>=f){for(c=(l+c)/2;s<u;++s)o[s]=c;f=a+t,l=a}c=a}for(c=(l+c)/2;s<u;++s)o[s]=c;return n?function(e,t){const n=e.length;let i,r,o=0,a=1;for(;e[o]===e[a];)++a;for(;a<n;){for(i=a+1;e[a]===e[i];)++i;if(e[a]-e[a-1]<t){for(r=a+(o+i-a-a>>1);r<a;)e[r++]=e[a];for(;r>a;)e[r--]=e[o]}o=a,a=i}return e}(o,t+t/4):o}const Ar=Math.sqrt(2*Math.PI),kr=Math.SQRT2;let Dr=NaN;function Fr(e,t){e=e||0,t=null==t?1:t;let n,i,r=0,o=0;if(Dr==Dr)r=Dr,Dr=NaN;else{do{r=2*xr()-1,o=2*xr()-1,n=r*r+o*o}while(0===n||n>1);i=Math.sqrt(-2*Math.log(n)/n),r*=i,Dr=o*i}return e+r*t}function Cr(e,t,n){const i=(e-(t||0))/(n=null==n?1:n);return Math.exp(-.5*i*i)/(n*Ar)}function Er(e,t,n){const i=(e-(t=t||0))/(n=null==n?1:n),r=Math.abs(i);let o;if(r>37)o=0;else{const e=Math.exp(-r*r/2);let t;r<7.07106781186547?(t=.0352624965998911*r+.700383064443688,t=t*r+6.37396220353165,t=t*r+33.912866078383,t=t*r+112.079291497871,t=t*r+221.213596169931,t=t*r+220.206867912376,o=e*t,t=.0883883476483184*r+1.75566716318264,t=t*r+16.064177579207,t=t*r+86.7807322029461,t=t*r+296.564248779674,t=t*r+637.333633378831,t=t*r+793.826512519948,t=t*r+440.413735824752,o/=t):(t=r+.65,t=r+4/t,t=r+3/t,t=r+2/t,t=r+1/t,o=e/t/2.506628274631)}return i>0?1-o:o}function $r(e,t,n){return e<0||e>1?NaN:(t||0)+(null==n?1:n)*kr*function(e){let t,n=-Math.log((1-e)*(1+e));n<6.25?(n-=3.125,t=-364441206401782e-35,t=t*n-16850591381820166e-35,t=128584807152564e-32+t*n,t=11157877678025181e-33+t*n,t=t*n-1333171662854621e-31,t=20972767875968562e-33+t*n,t=6637638134358324e-30+t*n,t=t*n-4054566272975207e-29,t=t*n-8151934197605472e-29,t=26335093153082323e-28+t*n,t=t*n-12975133253453532e-27,t=t*n-5415412054294628e-26,t=1.0512122733215323e-9+t*n,t=t*n-4.112633980346984e-9,t=t*n-2.9070369957882005e-8,t=4.2347877827932404e-7+t*n,t=t*n-13654692000834679e-22,t=t*n-13882523362786469e-21,t=.00018673420803405714+t*n,t=t*n-.000740702534166267,t=t*n-.006033670871430149,t=.24015818242558962+t*n,t=1.6536545626831027+t*n):n<16?(n=Math.sqrt(n)-3.25,t=2.2137376921775787e-9,t=9.075656193888539e-8+t*n,t=t*n-2.7517406297064545e-7,t=1.8239629214389228e-8+t*n,t=15027403968909828e-22+t*n,t=t*n-4013867526981546e-21,t=29234449089955446e-22+t*n,t=12475304481671779e-21+t*n,t=t*n-47318229009055734e-21,t=6828485145957318e-20+t*n,t=24031110387097894e-21+t*n,t=t*n-.0003550375203628475,t=.0009532893797373805+t*n,t=t*n-.0016882755560235047,t=.002491442096107851+t*n,t=t*n-.003751208507569241,t=.005370914553590064+t*n,t=1.0052589676941592+t*n,t=3.0838856104922208+t*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,t=-27109920616438573e-27,t=t*n-2.555641816996525e-10,t=1.5076572693500548e-9+t*n,t=t*n-3.789465440126737e-9,t=7.61570120807834e-9+t*n,t=t*n-1.496002662714924e-8,t=2.914795345090108e-8+t*n,t=t*n-6.771199775845234e-8,t=2.2900482228026655e-7+t*n,t=t*n-9.9298272942317e-7,t=4526062597223154e-21+t*n,t=t*n-1968177810553167e-20,t=7599527703001776e-20+t*n,t=t*n-.00021503011930044477,t=t*n-.00013871931833623122,t=1.0103004648645344+t*n,t=4.849906401408584+t*n):t=1/0;return t*e}(2*e-1)}function Sr(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Fr(n,i),pdf:e=>Cr(e,n,i),cdf:e=>Er(e,n,i),icdf:e=>$r(e,n,i)};return r.mean(e).stdev(t)}function Mr(e,t){const n=Sr();let i=0;const r={data(n){return arguments.length?(e=n,i=n?n.length:0,r.bandwidth(t)):e},bandwidth(n){return arguments.length?(!(t=n)&&e&&(t=vr(e)),r):t},sample:()=>e[~~(xr()*i)]+t*n.sample(),pdf(r){let o=0,a=0;for(;a<i;++a)o+=n.pdf((r-e[a])/t);return o/t/i},cdf(r){let o=0,a=0;for(;a<i;++a)o+=n.cdf((r-e[a])/t);return o/i},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function Br(e,t){return e=e||0,t=null==t?1:t,Math.exp(e+Fr()*t)}function zr(e,t,n){if(e<=0)return 0;t=t||0,n=null==n?1:n;const i=(Math.log(e)-t)/n;return Math.exp(-.5*i*i)/(n*Ar*e)}function Or(e,t,n){return Er(Math.log(e),t,n)}function Nr(e,t,n){return Math.exp($r(e,t,n))}function Rr(e,t){let n,i;const r={mean(e){return arguments.length?(n=e||0,r):n},stdev(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Br(n,i),pdf:e=>zr(e,n,i),cdf:e=>Or(e,n,i),icdf:e=>Nr(e,n,i)};return r.mean(e).stdev(t)}function Tr(e,t){let n,i=0;const r={weights(e){return arguments.length?(n=function(e){const t=[];let n,r=0;for(n=0;n<i;++n)r+=t[n]=null==e[n]?1:+e[n];for(n=0;n<i;++n)t[n]/=r;return t}(t=e||[]),r):t},distributions(n){return arguments.length?(n?(i=n.length,e=n):(i=0,e=[]),r.weights(t)):e},sample(){const t=xr();let r=e[i-1],o=n[0],a=0;for(;a<i-1;o+=n[++a])if(t<o){r=e[a];break}return r.sample()},pdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].pdf(t);return r},cdf(t){let r=0,o=0;for(;o<i;++o)r+=n[o]*e[o].cdf(t);return r},icdf(){throw Error("Mixture icdf not supported.")}};return r.distributions(e).weights(t)}function Pr(e,t){return null==t&&(t=null==e?1:e,e=0),e+(t-e)*xr()}function jr(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=t&&e<=n?1/(n-t):0}function Lr(e,t,n){return null==n&&(n=null==t?1:t,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function qr(e,t,n){return null==n&&(n=null==t?1:t,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Ur(e,t){let n,i;const r={min(e){return arguments.length?(n=e||0,r):n},max(e){return arguments.length?(i=null==e?1:e,r):i},sample:()=>Pr(n,i),pdf:e=>jr(e,n,i),cdf:e=>Lr(e,n,i),icdf:e=>qr(e,n,i)};return null==t&&(t=null==e?1:e,e=0),r.min(e).max(t)}function Ir(e,t,n){let i=0,r=0;for(const o of e){const e=n(o);null==t(o)||null==e||isNaN(e)||(i+=(e-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function Wr(e,t,n,i){const r=i-e*e,o=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-o*e,o]}function Hr(e,t,n,i){e=e.filter((e=>{let i=t(e),r=n(e);return null!=i&&(i=+i)>=i&&null!=r&&(r=+r)>=r})),i&&e.sort(((e,n)=>t(e)-t(n)));const r=e.length,o=new Float64Array(r),a=new Float64Array(r);let s,u,l,c=0,f=0,d=0;for(l of e)o[c]=s=+t(l),a[c]=u=+n(l),++c,f+=(s-f)/c,d+=(u-d)/c;for(c=0;c<r;++c)o[c]-=f,a[c]-=d;return[o,a,f,d]}function Gr(e,t,n,i){let r,o,a=-1;for(const s of e)r=t(s),o=n(s),null!=r&&(r=+r)>=r&&null!=o&&(o=+o)>=o&&i(r,o,++a)}function Vr(e,t,n,i,r){let o=0,a=0;return Gr(e,t,n,((e,t)=>{const n=t-r(e),s=t-i;o+=n*n,a+=s*s})),1-o/a}function Yr(e,t,n){let i=0,r=0,o=0,a=0,s=0;Gr(e,t,n,((e,t)=>{++s,i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const u=Wr(i,r,o,a),l=e=>u[0]+u[1]*e;return{coef:u,predict:l,rSquared:Vr(e,t,n,r,l)}}function Xr(e,t,n){let i=0,r=0,o=0,a=0,s=0;Gr(e,t,n,((e,t)=>{++s,e=Math.log(e),i+=(e-i)/s,r+=(t-r)/s,o+=(e*t-o)/s,a+=(e*e-a)/s}));const u=Wr(i,r,o,a),l=e=>u[0]+u[1]*Math.log(e);return{coef:u,predict:l,rSquared:Vr(e,t,n,r,l)}}function Jr(e,t,n){const[i,r,o,a]=Hr(e,t,n);let s,u,l,c=0,f=0,d=0,h=0,p=0;Gr(e,t,n,((e,t)=>{s=i[p++],u=Math.log(t),l=s*t,c+=(t*u-c)/p,f+=(l-f)/p,d+=(l*u-d)/p,h+=(s*l-h)/p}));const[m,g]=Wr(f/a,c/a,d/a,h/a),y=e=>Math.exp(m+g*(e-o));return{coef:[Math.exp(m-g*o),g],predict:y,rSquared:Vr(e,t,n,a,y)}}function Kr(e,t,n){let i=0,r=0,o=0,a=0,s=0,u=0;Gr(e,t,n,((e,t)=>{const n=Math.log(e),l=Math.log(t);++u,i+=(n-i)/u,r+=(l-r)/u,o+=(n*l-o)/u,a+=(n*n-a)/u,s+=(t-s)/u}));const l=Wr(i,r,o,a),c=e=>l[0]*Math.pow(e,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Vr(e,t,n,s,c)}}function Qr(e,t,n){const[i,r,o,a]=Hr(e,t,n),s=i.length;let u,l,c,f,d=0,h=0,p=0,m=0,g=0;for(u=0;u<s;)l=i[u],c=r[u++],f=l*l,d+=(f-d)/u,h+=(f*l-h)/u,p+=(f*f-p)/u,m+=(l*c-m)/u,g+=(f*c-g)/u;const y=p-d*d,v=d*y-h*h,b=(g*d-m*h)/v,x=(m*y-g*h)/v,w=-b*d,_=e=>b*(e-=o)*e+x*e+w+a;return{coef:[w-x*o+b*o*o+a,x-2*b*o,b],predict:_,rSquared:Vr(e,t,n,a,_)}}function Zr(e,t,n,i){if(0===i)return Ir(e,t,n);if(1===i)return Yr(e,t,n);if(2===i)return Qr(e,t,n);const[r,o,a,s]=Hr(e,t,n),u=r.length,l=[],c=[],f=i+1;let d,h,p,m,g;for(d=0;d<f;++d){for(p=0,m=0;p<u;++p)m+=Math.pow(r[p],d)*o[p];for(l.push(m),g=new Float64Array(f),h=0;h<f;++h){for(p=0,m=0;p<u;++p)m+=Math.pow(r[p],d+h);g[h]=m}c.push(g)}c.push(l);const y=function(e){const t=e.length-1,n=[];let i,r,o,a,s;for(i=0;i<t;++i){for(a=i,r=i+1;r<t;++r)Math.abs(e[i][r])>Math.abs(e[i][a])&&(a=r);for(o=i;o<t+1;++o)s=e[o][i],e[o][i]=e[o][a],e[o][a]=s;for(r=i+1;r<t;++r)for(o=t;o>=i;o--)e[o][r]-=e[o][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(s=0,o=r+1;o<t;++o)s+=e[o][r]*n[o];n[r]=(e[t][r]-s)/e[r][r]}return n}(c),v=e=>{e-=a;let t=s+y[0]+y[1]*e+y[2]*e*e;for(d=3;d<f;++d)t+=y[d]*Math.pow(e,d);return t};return{coef:eo(f,y,-a,s),predict:v,rSquared:Vr(e,t,n,s,v)}}function eo(e,t,n,i){const r=Array(e);let o,a,s,u;for(o=0;o<e;++o)r[o]=0;for(o=e-1;o>=0;--o)for(s=t[o],u=1,r[o]+=s,a=1;a<=o;++a)u*=(o+1-a)/a,r[o-a]+=s*Math.pow(n,a)*u;return r[0]+=i,r}function to(e,t,n,i){const[r,o,a,s]=Hr(e,t,n,!0),u=r.length,l=Math.max(2,~~(i*u)),c=new Float64Array(u),f=new Float64Array(u),d=new Float64Array(u).fill(1);for(let h=-1;++h<=2;){const e=[0,l-1];for(let n=0;n<u;++n){const t=r[n],i=e[0],a=e[1],s=t-r[i]>r[a]-t?i:a;let u=0,l=0,h=0,p=0,m=0;const g=1/Math.abs(r[s]-t||1);for(let e=i;e<=a;++e){const n=r[e],i=o[e],a=no(Math.abs(t-n)*g)*d[e],s=n*a;u+=a,l+=s,h+=i*a,p+=i*s,m+=n*s}const[y,v]=Wr(l/u,h/u,p/u,m/u);c[n]=y+v*t,f[n]=Math.abs(o[n]-c[n]),io(r,n+1,e)}if(2===h)break;const t=oi(f);if(Math.abs(t)<1e-12)break;for(let n,i,r=0;r<u;++r)n=f[r]/(6*t),d[r]=n>=1?1e-12:(i=1-n*n)*i}return function(e,t,n,i){const r=e.length,o=[];let a,s=0,u=0,l=[];for(;s<r;++s)a=e[s]+n,l[0]===a?l[1]+=(t[s]-l[1])/++u:(u=0,l[1]+=i,l=[a,t[s]],o.push(l));return l[1]+=i,o}(r,c,a,s)}function no(e){return(e=1-e*e*e)*e*e}function io(e,t,n){const i=e[t];let r=n[0],o=n[1]+1;if(!(o>=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}const ro=.5*Math.PI/180;function oo(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=t=>[t,e(t)],o=t[0],a=t[1],s=a-o,u=s/i,l=[r(o)],c=[];if(n===i){for(let e=1;e<i;++e)l.push(r(o+e/n*s));return l.push(r(a)),l}c.push(r(a));for(let m=n;--m>0;)c.push(r(o+m/n*s));let f=l[0],d=c[c.length-1];const h=1/s,p=function(e,t){let n=e,i=e;const r=t.length;for(let o=0;o<r;++o){const e=t[o][1];e<n&&(n=e),e>i&&(i=e)}return 1/(i-n)}(f[1],c);for(;d;){const e=r((f[0]+d[0])/2);e[0]-f[0]>=u&&ao(f,e,d,h,p)>ro?c.push(e):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function ao(e,t,n,i,r){const o=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),a=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(o-a)}function so(e){return e&&e.length?1===e.length?e[0]:(t=e,e=>{const n=t.length;let i=1,r=String(t[0](e));for(;i<n;++i)r+="|"+t[i](e);return r}):function(){return""};var t}function uo(e,t,n){return n||e+(t?"_"+t:"")}const lo=()=>{},co={init:lo,add:lo,rem:lo,idx:0},fo={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t<e.min||void 0===e.min)&&(e.min=t)},rem:(e,t)=>{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||void 0===e.max)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t<e.min&&(e.argmin=n)},rem:(e,t)=>{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},ho=Object.keys(fo).filter((e=>"__count__"!==e));function po(e,t,n){return fo[e](n,t)}function mo(e,t){return e.idx-t.idx}function go(){this.valid=0,this.missing=0,this._ops.forEach((e=>null==e.aggregate_param?e.init(this):e.init(this,e.aggregate_param)))}function yo(e,t){null!=e&&""!==e?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function vo(e,t){null!=e&&""!==e?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function bo(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function xo(e,t){const n=t||l,i=function(e){const t={};e.forEach((e=>t[e.name]=e));const n=e=>{e.req&&e.req.forEach((e=>{t[e]||n(t[e]=fo[e]())}))};return e.forEach(n),Object.values(t).sort(mo)}(e),r=e.slice().sort(mo);function o(e){this._ops=i,this._out=r,this.cell=e,this.init()}return o.prototype.init=go,o.prototype.add=yo,o.prototype.rem=vo,o.prototype.set=bo,o.prototype.get=n,o.fields=e.map((e=>e.out)),o}function wo(e){this._key=e?O(e):Bi,this.reset()}[...ho,"__count__"].forEach((e=>{fo[e]=function(e,t){return(n,i)=>v({name:e,aggregate_param:i,out:n||e},co,t)}(e,fo[e])}));const _o=wo.prototype;function Ao(e){fr.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}_o.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},_o.add=function(e){this._add.push(e)},_o.rem=function(e){this._rem.push(e)},_o.values=function(){if(this._get=null,0===this._rem.length)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,o=Array(i-r),a={};let s,u,l;for(s=0;s<r;++s)a[n(t[s])]=1;for(s=0,u=0;s<i;++s)a[n(l=e[s])]?a[n(l)]=0:o[u++]=l;return this._rem=[],this._add=o},_o.distinct=function(e){const t=this.values(),n={};let i,r=t.length,o=0;for(;--r>=0;)i=e(t[r])+"",c(n,i)||(n[i]=1,++o);return o},_o.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=q(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},_o.argmin=function(e){return this.extent(e)[0]||{}},_o.argmax=function(e){return this.extent(e)[1]||{}},_o.min=function(e){const t=this.extent(e)[0];return null!=t?e(t):void 0},_o.max=function(e){const t=this.extent(e)[1];return null!=t?e(t):void 0},_o.quartile=function(e){return this._get===e&&this._q||(this._q=yr(this.values(),e),this._get=e),this._q},_o.q1=function(e){return this.quartile(e)[0]},_o.q2=function(e){return this.quartile(e)[1]},_o.q3=function(e){return this.quartile(e)[2]},_o.ci=function(e){return this._get===e&&this._ci||(this._ci=wr(this.values(),1e3,.05,e),this._get=e),this._ci},_o.ci0=function(e){return this.ci(e)[0]},_o.ci1=function(e){return this.ci(e)[1]},Ao.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:ho},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},t(Ao,fr,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,(e=>n.add(e)))):(n.value=n.value||n.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),i.modifies(n._outputs),n._drop=!1!==e.drop,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter((()=>this.clean())),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map((()=>({}))),r=n.length;function o(e){let t,o,a,s;for(t in e)for(a=e[t].tuple,o=0;o<r;++o)i[o][s=a[n[o]]]=s}o(e._prev),o(t),function o(a,s,u){const l=n[u],c=i[u++];for(const n in c){const i=a?a+"|"+n:n;s[l]=c[n],u<r?o(i,s,u):t[i]||e.cell(i,s)}}("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],i={};function r(e){const n=u(w(e)),r=n.length;let o,a=0;for(;a<r;++a)i[o=n[a]]||(i[o]=1,t.push(o))}this._dims=u(e.groupby),this._dnames=this._dims.map((e=>{const t=x(e);return r(e),n.push(t),t})),this.cellkey=e.key?e.key:so(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],a=e.ops||["count"],s=e.aggregate_params||[null],l=e.as||[],c=o.length,f={};let h,p,m,g,y,v,b;for(c!==a.length&&d("Unmatched number of fields and aggregate ops."),b=0;b<c;++b)h=o[b],p=a[b],m=s[b]||null,null==h&&"count"!==p&&d("Null aggregate field specified."),y=x(h),v=uo(p,y,l[b]),n.push(v),"count"!==p?(g=f[y],g||(r(h),g=f[y]=[],g.field=h,this._measures.push(g)),"count"!==p&&(this._countOnly=!1),g.push(po(p,m,v))):this._counts.push(v);return this._measures=this._measures.map((e=>xo(e,e.field))),Object.create(null)},cellkey:so(),cell(e,t){let n=this.value[e];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){const n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const e=this._measures,t=e.length;n.agg=Array(t);for(let i=0;i<t;++i)n.agg[i]=new e[i](n)}return n.store&&(n.data=new wo),n},newtuple(e,t){const n=this._dnames,i=this._dims,r=i.length,o={};for(let a=0;a<r;++a)o[n[a]]=i[a](e);return t?Ti(t.tuple,o):Oi(o)},clean(){const e=this.value;for(const t in e)0===e[t].num&&delete e[t]},add(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);const i=n.agg;for(let r=0,o=i.length;r<o;++r)i[r].add(i[r].get(e),e)},rem(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);const i=n.agg;for(let r=0,o=i.length;r<o;++r)i[r].rem(i[r].get(e),e)},celltuple(e){const t=e.tuple,n=this._counts;e.store&&e.data.values();for(let i=0,r=n.length;i<r;++i)t[n[i]]=e.num;if(!this._countOnly){const n=e.agg;for(let e=0,i=n.length;e<i;++e)n[e].set(t)}return t},changes(e){const t=this._adds,n=this._mods,i=this._prev,r=this._drop,o=e.add,a=e.rem,s=e.mod;let u,l,c,f;if(i)for(l in i)u=i[l],r&&!u.num||a.push(u.tuple);for(c=0,f=this._alen;c<f;++c)o.push(this.celltuple(t[c])),t[c]=null;for(c=0,f=this._mlen;c<f;++c)u=n[c],(0===u.num&&r?a:s).push(this.celltuple(u)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}});function ko(e){fr.call(this,null,e)}function Do(e,t,n){const i=e;let r=t||[],o=n||[],a={},s=0;return{add:e=>o.push(e),remove:e=>a[i(e)]=++s,size:()=>r.length,data:(e,t)=>(s&&(r=r.filter((e=>!a[i(e)])),a={},s=0),t&&e&&r.sort(e),o.length&&(r=e?N(e,r,o.sort(e)):r.concat(o),o=[]),r)}}function Fo(e){fr.call(this,[],e)}function Co(e){Hi.call(this,null,Eo,e)}function Eo(e){return this.value&&!e.modified()?this.value:P(e.fields,e.orders)}function $o(e){fr.call(this,null,e)}function So(e){fr.call(this,null,e)}ko.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},t(ko,fr,{transform(e,t){const n=!1!==e.interval,i=this._bins(e),r=i.start,o=i.step,a=e.as||["bin0","bin1"],s=a[0],u=a[1];let l;return l=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(w(e.field))?t.ADD_MOD:t.ADD,t.visit(l,n?e=>{const t=i(e);e[s]=t,e[u]=null==t?null:r+o*(1+(t-r)/o)}:e=>e[s]=i(e)),t.modifies(n?a:s)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=br(e),i=n.step;let r,o,a=n.start,s=a+Math.ceil((n.stop-a)/i)*i;null!=(r=e.anchor)&&(o=r-(a+i*Math.floor((r-a)/i)),a+=o,s+=o);const u=function(e){let n=A(t(e));return null==n?null:n<a?-1/0:n>s?1/0:(n=Math.max(a,Math.min(n,s-i)),a+i*Math.floor(1e-14+(n-a)/i))};return u.start=a,u.stop=n.stop,u.step=i,this.value=_(u,w(t),e.name||"bin_"+x(t))}}),Fo.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},t(Fo,fr,{transform(e,t){const n=t.fork(t.ALL),i=Do(Bi,this.value,n.materialize(n.ADD).add),r=e.sort,o=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(o),this.value=n.source=i.data(Pi(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),t(Co,Hi),$o.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"]}]},t($o,fr,{transform(e,t){const n=t=>n=>{for(var i,r=function(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase()}return e.match(n)}(s(n),e.case,o)||[],u=0,l=r.length;u<l;++u)a.test(i=r[u])||t(i)},i=this._parameterCheck(e,t),r=this._counts,o=this._match,a=this._stop,s=e.field,u=e.as||["text","count"],l=n((e=>r[e]=1+(r[e]||0))),c=n((e=>r[e]-=1));return i?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],o=t[1],a=e.fork(e.NO_SOURCE|e.NO_FIELDS);let s,u,l;for(s in n)u=i[s],l=n[s]||0,!u&&l?(i[s]=u=Oi({}),u[r]=s,u[o]=l,a.add.push(u)):0===l?(u&&a.rem.push(u),n[s]=null,i[s]=null):u[o]!==l&&(u[o]=l,a.mod.push(u));return a.modifies(t)}}),So.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},t(So,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],o=i[1],a=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=t.materialize(t.SOURCE).source,n.add=this.value=function(e,t,n,i){for(var r,o,a=[],s={},u=e.length,l=0;l<u;++l)for(s[t]=o=e[l],r=0;r<u;++r)s[n]=e[r],i(s)&&(a.push(Oi(s)),(s={})[t]=o);return a}(s,r,o,e.filter||p)):n.mod=s,n.source=this.value,n.modifies(i)}});const Mo={kde:Mr,mixture:Tr,normal:Sr,lognormal:Rr,uniform:Ur},Bo="function";function zo(e,t){const n=e[Bo];c(Mo,n)||d("Unknown distribution function: "+n);const i=Mo[n]();for(const r in e)"field"===r?i.data((e.from||t()).map(e[r])):"distributions"===r?i[r](e[r].map((e=>zo(e,t)))):typeof i[r]===Bo&&i[r](e[r]);return i}function Oo(e){fr.call(this,null,e)}const No=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Ro={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:No},{name:"weights",type:"number",array:!0}]};function To(e,t){return e?e.map(((e,n)=>t[n]||x(e))):null}function Po(e,t,n){const i=[],r=e=>e(u);let o,a,s,u,l,c;if(null==t)i.push(e.map(n));else for(o={},a=0,s=e.length;a<s;++a)u=e[a],l=t.map(r),c=o[l],c||(o[l]=c=[],c.dims=l,i.push(c)),c.push(n(u));return i}Oo.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:No.concat(Ro)},{name:"as",type:"string",array:!0,default:["value","density"]}]},t(Oo,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=zo(e.distribution,function(e){return()=>e.materialize(e.SOURCE).source}(t)),r=e.steps||e.minsteps||25,o=e.steps||e.maxsteps||200;let a=e.method||"pdf";"pdf"!==a&&"cdf"!==a&&d("Invalid density method: "+a),e.extent||i.data||d("Missing density extent parameter."),a=i[a];const s=e.as||["value","density"],u=oo(a,e.extent||k(i.data()),r,o).map((e=>{const t={};return t[s[0]]=e[0],t[s[1]]=e[1],Oi(t)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});function jo(e){fr.call(this,null,e)}jo.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"}]};function Lo(e){Hi.call(this,null,qo,e),this.modified(!0)}function qo(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:_((n=>t(n,e)),w(t),x(t))}function Uo(e){fr.call(this,[void 0,void 0],e)}function Io(e,t){Hi.call(this,e),this.parent=t,this.count=0}function Wo(e){fr.call(this,{},e),this._keys=T();const t=this._targets=[];t.active=0,t.forEach=e=>{for(let n=0,i=t.active;n<i;++n)e(t[n],n,t)}}function Ho(e){Hi.call(this,null,Go,e)}function Go(e){return this.value&&!e.modified()?this.value:f(e.name)?u(e.name).map((e=>O(e))):O(e.name,e.as)}function Vo(e){fr.call(this,T(),e)}function Yo(e){fr.call(this,[],e)}function Xo(e){fr.call(this,[],e)}function Jo(e){fr.call(this,null,e)}function Ko(e){fr.call(this,[],e)}t(jo,fr,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;const n=t.materialize(t.SOURCE).source,i=Po(t.source,e.groupby,l),r=e.smooth||!1,o=e.field,a=e.step||((e,t)=>R(k(e,t))/30)(n,o),s=Pi(((e,t)=>o(e)-o(t))),u=e.as||"bin",c=i.length;let f,d=1/0,h=-1/0,p=0;for(;p<c;++p){const e=i[p].sort(s);f=-1;for(const t of _r(e,a,r,o))t<d&&(d=t),t>h&&(h=t),e[++f][u]=t}return this.value={start:d,stop:h,step:a},t.reflow(!0).modifies(u)}}),t(Lo,Hi),Uo.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},t(Uo,fr,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let o=n[0],a=n[1];if((r||null==o)&&(o=1/0,a=-1/0),t.visit(r?t.SOURCE:t.ADD,(e=>{const t=A(i(e));null!=t&&(t<o&&(o=t),t>a&&(a=t))})),!Number.isFinite(o)||!Number.isFinite(a)){let e=x(i);e&&(e=` for field "${e}"`),t.dataflow.warn(`Infinite extent${e}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),t(Io,Hi,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),t(Wo,fr,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o,a,s=c(r,e)&&r[e];return s?s.value.stamp<n.stamp&&(s.init(n),this.activate(s)):(a=i||(a=this._group[e])&&a.tuple,o=n.dataflow,s=new Io(n.fork(n.NO_SOURCE),this),o.add(s).connect(t(o,e,a)),r[e]=s,this.activate(s)),s},clean(){const e=this.value;let t=0;for(const n in e)if(0===e[n].count){const i=e[n].detachSubflow;i&&i(),delete e[n],++t}if(t){const e=this._targets.filter((e=>e&&e.count>0));this.initTargets(e)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;r<i;++r)t[r]=e[r];for(;r<n&&null!=t[r];++r)t[r]=null;t.active=i},transform(e,t){const n=t.dataflow,i=e.key,r=e.subflow,o=this._keys,a=e.modified("key"),s=e=>this.subflow(e,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(e=>{const t=Bi(e),n=o.get(t);void 0!==n&&(o.delete(t),s(n).rem(e))})),t.visit(t.ADD,(e=>{const t=i(e);o.set(Bi(e),t),s(t).add(e)})),a||t.modified(i.fields)?t.visit(t.MOD,(e=>{const t=Bi(e),n=o.get(t),r=i(e);n===r?s(r).mod(e):(o.set(t,r),s(n).rem(e),s(r).add(e))})):t.changed(t.MOD)&&t.visit(t.MOD,(e=>{s(o.get(Bi(e))).mod(e)})),a&&t.visit(t.REFLOW,(e=>{const t=Bi(e),n=o.get(t),r=i(e);n!==r&&(o.set(t,r),s(n).rem(e),s(r).add(e))})),t.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),t}}),t(Ho,Hi),Vo.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},t(Vo,fr,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,a=r.rem,s=r.mod,u=e.expr;let l=!0;function c(t){const n=Bi(t),r=u(t,e),c=i.get(n);r&&c?(i.delete(n),o.push(t)):r||c?l&&r&&!c&&s.push(t):(i.set(n,1),a.push(t))}return t.visit(t.REM,(e=>{const t=Bi(e);i.has(t)?i.delete(t):a.push(e)})),t.visit(t.ADD,(t=>{u(t,e)?o.push(t):i.set(Bi(t),1)})),t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}}),Yo.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}]},t(Yo,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=To(i,e.as||[]),o=e.index||null,a=r.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{const t=i.map((t=>t(e))),s=t.reduce(((e,t)=>Math.max(e,t.length)),0);let u,l,c,f=0;for(;f<s;++f){for(l=Ni(e),u=0;u<a;++u)l[r[u]]=null==(c=t[u][f])?null:c;o&&(l[o]=f),n.add.push(l)}})),this.value=n.source=n.add,o&&n.modifies(o),n.modifies(r)}}),Xo.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},t(Xo,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=i.map(x),o=e.as||["key","value"],a=o[0],s=o[1],u=i.length;return n.rem=this.value,t.visit(t.SOURCE,(e=>{for(let t,o=0;o<u;++o)t=Ni(e),t[a]=r[o],t[s]=i[o](e),n.add.push(t)})),this.value=n.source=n.add,n.modifies(o)}}),Jo.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},t(Jo,fr,{transform(e,t){const n=e.expr,i=e.as,r=e.modified(),o=e.initonly?t.ADD:r?t.SOURCE:t.modified(n.fields)||t.modified(i)?t.ADD_MOD:t.ADD;return r&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(i),t.visit(o,(t=>t[i]=n(t,e)))}}),t(Ko,fr,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r,o,a,s=this.value,u=e.size-s.length;if(u>0){for(r=[];--u>=0;)r.push(a=Oi(i(e))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else o=s.slice(0,-u),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-u);return n.source=this.value=s,n}});const Qo={value:"value",median:oi,mean:function(e,t){let n=0,i=0;if(void 0===t)for(let r of e)null!=r&&(r=+r)>=r&&(++n,i+=r);else{let r=-1;for(let o of e)null!=(o=t(o,++r,e))&&(o=+o)>=o&&(++n,i+=o)}if(n)return i/n},min:mt,max:gt},Zo=[];function ea(e){fr.call(this,[],e)}function ta(e){Ao.call(this,e)}function na(e){fr.call(this,null,e)}function ia(e){Hi.call(this,null,ra,e)}function ra(e){return this.value&&!e.modified()?this.value:j(e.fields,e.flat)}function oa(e){fr.call(this,[],e),this._pending=null}function aa(e,t,n){n.forEach(Oi);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function sa(e){fr.call(this,{},e)}function ua(e){Hi.call(this,null,la,e)}function la(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i,r,o=1/0,a=-1/0;for(i=0;i<n;++i)r=t[i],r[0]<o&&(o=r[0]),r[1]>a&&(a=r[1]);return[o,a]}function ca(e){Hi.call(this,null,fa,e)}function fa(e){return this.value&&!e.modified()?this.value:e.values.reduce(((e,t)=>e.concat(t)),[])}function da(e){fr.call(this,null,e)}function ha(e){Ao.call(this,e)}function pa(e){Wo.call(this,e)}function ma(e){fr.call(this,null,e)}function ga(e){fr.call(this,null,e)}function ya(e){fr.call(this,null,e)}ea.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}]},t(ea,fr,{transform(e,t){var n,i,r,o,a,s,u,l,c,f,h=t.fork(t.ALL),p=function(e){var t,n=e.method||Qo.value;if(null!=Qo[n])return n===Qo.value?(t=void 0!==e.value?e.value:0,()=>t):Qo[n];d("Unrecognized imputation method: "+n)}(e),m=function(e){const t=e.field;return e=>e?t(e):NaN}(e),g=x(e.field),y=x(e.key),v=(e.groupby||[]).map(x),b=function(e,t,n,i){var r,o,a,s,u,l,c,f,d=e=>e(f),h=[],p=i?i.slice():[],m={},g={};for(p.forEach(((e,t)=>m[e]=t+1)),s=0,c=e.length;s<c;++s)l=n(f=e[s]),u=m[l]||(m[l]=p.push(l)),(a=g[o=(r=t?t.map(d):Zo)+""])||(a=g[o]=[],h.push(a),a.values=r),a[u-1]=f;return h.domain=p,h}(t.source,e.groupby,e.key,e.keyvals),w=[],_=this.value,A=b.domain.length;for(a=0,l=b.length;a<l;++a)for(r=(n=b[a]).values,i=NaN,u=0;u<A;++u)if(null==n[u]){for(o=b.domain[u],f={_impute:!0},s=0,c=r.length;s<c;++s)f[v[s]]=r[s];f[y]=o,f[g]=Number.isNaN(i)?i=p(n,m):i,w.push(Oi(f))}return w.length&&(h.add=h.materialize(h.ADD).add.concat(w)),_.length&&(h.rem=h.materialize(h.REM).rem.concat(_)),this.value=w,h}}),ta.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:ho},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},t(ta,Ao,{transform(e,t){const n=this,i=e.modified();let r;return n.value&&(i||t.modified(n._inputs,!0))?(r=n.value=i?n.init(e):{},t.visit(t.SOURCE,(e=>n.add(e)))):(r=n.value=n.value||this.init(e),t.visit(t.REM,(e=>n.rem(e))),t.visit(t.ADD,(e=>n.add(e)))),n.changes(),t.visit(t.SOURCE,(e=>{v(e,r[n.cellkey(e)].tuple)})),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n<i;++n)this.celltuple(e[n]),e[n]=null;for(n=0,i=this._mlen;n<i;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}}),na.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},t(na,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=Po(i,e.groupby,e.field),o=(e.groupby||[]).map(x),a=e.bandwidth,s=e.cumulative?"cdf":"pdf",u=e.as||["value","density"],l=[];let c=e.extent,f=e.steps||e.minsteps||25,h=e.steps||e.maxsteps||200;"pdf"!==s&&"cdf"!==s&&d("Invalid density method: "+s),"shared"===e.resolve&&(c||(c=k(i,e.field)),f=h=e.steps||h),r.forEach((t=>{const n=Mr(t,a)[s],i=e.counts?t.length:1;oo(n,c||k(t),f,h).forEach((e=>{const n={};for(let i=0;i<o.length;++i)n[o[i]]=t.dims[i];n[u[0]]=e[0],n[u[1]]=e[1]*i,l.push(Oi(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}}),t(ia,Hi),t(oa,fr,{transform(e,t){const n=t.dataflow;if(this._pending)return aa(this,t,this._pending);if(function(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}(e))return t.StopPropagation;if(e.values)return aa(this,t,n.parse(e.values,e.format));if(e.async){return{async:n.request(e.url,e.format).then((e=>(this._pending=u(e.data),e=>e.touch(this))))}}return n.request(e.url,e.format).then((e=>aa(this,t,u(e.data))))}}),sa.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}]},t(sa,fr,{transform(e,t){const n=e.fields,i=e.index,r=e.values,o=null==e.default?null:e.default,a=e.modified(),s=n.length;let u,l,c,f=a?t.SOURCE:t.ADD,h=t,p=e.as;return r?(l=r.length,s>1&&!p&&d('Multi-field lookup requires explicit "as" parameter.'),p&&p.length!==s*l&&d('The "as" parameter has too few output field names.'),p=p||r.map(x),u=function(e){for(var t,a,u=0,c=0;u<s;++u)if(null==(a=i.get(n[u](e))))for(t=0;t<l;++t,++c)e[p[c]]=o;else for(t=0;t<l;++t,++c)e[p[c]]=r[t](a)}):(p||d("Missing output field names."),u=function(e){for(var t,r=0;r<s;++r)t=i.get(n[r](e)),e[p[r]]=null==t?o:t}),a?h=t.reflow(!0):(c=n.some((e=>t.modified(e.fields))),f|=c?t.MOD:0),t.visit(f,u),h.modifies(p)}}),t(ua,Hi),t(ca,Hi),t(da,fr,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),ha.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:ho,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},t(ha,Ao,{_transform:Ao.prototype.transform,transform(e,t){return this._transform(function(e,t){const n=e.field,i=e.value,r=("count"===e.op?"__count__":e.op)||"sum",o=w(n).concat(w(i)),a=function(e,t,n){const i={},r=[];return n.visit(n.SOURCE,(t=>{const n=e(t);i[n]||(i[n]=1,r.push(n))})),r.sort(D),t?r.slice(0,t):r}(n,e.limit||0,t);t.changed()&&e.set("__pivot__",null,null,!0);return{key:e.key,groupby:e.groupby,ops:a.map((()=>r)),fields:a.map((e=>function(e,t,n,i){return _((i=>t(i)===e?n(i):NaN),i,e+"")}(e,n,i,o))),as:a.map((e=>e+"")),modified:e.modified.bind(e)}}(e,t),t)}}),t(pa,Wo,{transform(e,t){const n=e.subflow,i=e.field,r=e=>this.subflow(Bi(e),n,t,e);return(e.modified("field")||i&&t.modified(w(i)))&&d("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,(e=>{const t=r(e);i(e).forEach((e=>t.mod(e)))})),t.visit(t.ADD,(e=>{const t=r(e);i(e).forEach((e=>t.add(Oi(e))))})),t.visit(t.REM,(e=>{const t=r(e);i(e).forEach((e=>t.rem(e)))}))):(t.visit(t.MOD,(e=>r(e).mod(e))),t.visit(t.ADD,(e=>r(e).add(e))),t.visit(t.REM,(e=>r(e).rem(e)))),t.clean()&&t.runAfter((()=>this.clean())),t}}),ma.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},t(ma,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=To(e.fields,e.as||[]),o=i?(e,t)=>function(e,t,n,i){for(let r=0,o=n.length;r<o;++r)t[i[r]]=n[r](e);return t}(e,t,i,r):Ri;let a;return this.value?a=this.value:(t=t.addAll(),a=this.value={}),t.visit(t.REM,(e=>{const t=Bi(e);n.rem.push(a[t]),a[t]=null})),t.visit(t.ADD,(e=>{const t=o(e,Oi({}));a[Bi(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{n.mod.push(o(e,a[Bi(e)]))})),n}}),t(ga,fr,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),ya.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function va(e){fr.call(this,null,e)}function ba(e){fr.call(this,[],e),this.count=0}function xa(e){fr.call(this,null,e)}function wa(e){fr.call(this,null,e),this.modified(!0)}function _a(e){fr.call(this,null,e)}t(ya,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=Po(t.materialize(t.SOURCE).source,e.groupby,e.field),o=(e.groupby||[]).map(x),a=[],s=e.step||.01,u=e.probs||Ht(s/2,1-1e-14,s),l=u.length;return r.forEach((e=>{const t=gr(e,u);for(let n=0;n<l;++n){const r={};for(let t=0;t<o.length;++t)r[o[t]]=e.dims[t];r[i[0]]=u[n],r[i[1]]=t[n],a.push(Oi(r))}})),this.value&&(n.rem=this.value),this.value=n.add=n.source=a,n}}),t(va,fr,{transform(e,t){let n,i;return this.value?i=this.value:(n=t=t.addAll(),i=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,(e=>{const t=Bi(e);n.rem.push(i[t]),i[t]=null})),t.visit(t.ADD,(e=>{const t=Ni(e);i[Bi(e)]=t,n.add.push(t)})),t.visit(t.MOD,(e=>{const t=i[Bi(e)];for(const i in e)t[i]=e[i],n.modifies(i);n.mod.push(t)}))),n}}),ba.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},t(ba,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce(((e,t)=>(e[Bi(t)]=1,e)),{});let a=this.value,s=this.count,u=0;function l(e){let t,i;a.length<r?a.push(e):(i=~~((s+1)*xr()),i<a.length&&i>=u&&(t=a[i],o[Bi(t)]&&n.rem.push(t),a[i]=e)),++s}if(t.rem.length&&(t.visit(t.REM,(e=>{const t=Bi(e);o[t]&&(o[t]=-1,n.rem.push(e)),--s})),a=a.filter((e=>-1!==o[Bi(e)]))),(t.rem.length||i)&&a.length<r&&t.source&&(u=s=a.length,t.visit(t.SOURCE,(e=>{o[Bi(e)]||l(e)})),u=-1),i&&a.length>r){const e=a.length-r;for(let t=0;t<e;++t)o[Bi(a[t])]=-1,n.rem.push(a[t]);a=a.slice(e)}return t.mod.length&&t.visit(t.MOD,(e=>{o[Bi(e)]&&n.mod.push(e)})),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=a.filter((e=>!o[Bi(e)]))),this.count=s,this.value=n.source=a,n}}),xa.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},t(xa,fr,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Ht(e.start,e.stop,e.step||1).map((e=>{const t={};return t[i]=e,Oi(t)})),n.add=t.add.concat(this.value),n}}),t(wa,fr,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});const Aa=["unit0","unit1"];function ka(e){fr.call(this,T(),e)}function Da(e){fr.call(this,null,e)}_a.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:U,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Aa}]},t(_a,fr,{transform(e,t){const n=e.field,i=!1!==e.interval,r="utc"===e.timezone,o=this._floor(e,t),a=(r?M:B)(o.unit).offset,s=e.as||Aa,u=s[0],l=s[1],c=o.step;let f=o.start||1/0,d=o.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(w(n)))&&(h=(t=t.reflow(!0)).SOURCE,f=1/0,d=-1/0),t.visit(h,(e=>{const t=n(e);let r,s;null==t?(e[u]=null,i&&(e[l]=null)):(e[u]=r=s=o(t),i&&(e[l]=s=a(r,c)),r<f&&(f=r),s>d&&(d=s))})),o.start=f,o.stop=d,t.modifies(i?s:u)},_floor(e,t){const n="utc"===e.timezone,{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:F({extent:e.extent||k(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=C(i),a=this.value||{},s=(n?E:$)(o,r);return s.unit=S(o),s.units=o,s.step=r,s.start=a.start,s.stop=a.stop,this.value=s}}),t(ka,fr,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,o=e=>r.set(i(e),e);let a=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,o)):t.changed()?(t.visit(t.REM,(e=>r.delete(i(e)))),t.visit(t.ADD,o)):a=!1,this.modified(a),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),t(Da,fr,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(Pi(e.sort)):t.source).map(e.field))}});const Fa={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=Fa.rank(),t=e.next;return{init:e.init,next:e=>(t(e)-1)/(e.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e<r){for(;r+1<n.length&&!i(n[r],n[r+1]);)++r;e=r}return(1+e)/n.length}}},ntile:function(e,t){(t=+t)>0||d("ntile num must be greater than zero.");const n=Fa.cume_dist(),i=n.next;return{init:n.init,next:e=>Math.ceil(t*i(e))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return i<r.length?e(r[i]):null}}},first_value:function(e){return{next:t=>e(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||d("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return i<n.i1?e(n.data[i]):null}}},prev_value:function(e){let t;return{init:()=>t=null,next:n=>{const i=e(n.data[n.index]);return null!=i?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=function(e,t,n){for(let i=t.length;n<i;++n){if(null!=e(t[n]))return n}return-1}(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}};const Ca=Object.keys(Fa);function Ea(e){const t=u(e.ops),n=u(e.fields),i=u(e.params),r=u(e.aggregate_params),o=u(e.as),a=this.outputs=[],s=this.windows=[],l={},f={},h=[],p=[];let m=!0;function g(e){u(w(e)).forEach((e=>l[e]=1))}g(e.sort),t.forEach(((e,t)=>{const u=n[t],l=i[t],y=r[t]||null,v=x(u),b=uo(e,v,o[t]);if(g(u),a.push(b),c(Fa,e))s.push(function(e,t,n,i){const r=Fa[e](t,n);return{init:r.init||L,update:function(e,t){t[i]=r.next(e)}}}(e,u,l,b));else{if(null==u&&"count"!==e&&d("Null aggregate field specified."),"count"===e)return void h.push(b);m=!1;let t=f[v];t||(t=f[v]=[],t.field=u,p.push(t)),t.push(po(e,y,b))}})),(h.length||p.length)&&(this.cell=function(e,t,n){e=e.map((e=>xo(e,e.field)));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,o=i.agg=Array(r),a=0;a<r;++a)o[a]=new e[a](i);if(i.store)var s=i.data=new wo;return i.add=function(e){if(i.num+=1,!n){s&&s.add(e);for(let t=0;t<r;++t)o[t].add(o[t].get(e),e)}},i.rem=function(e){if(i.num-=1,!n){s&&s.rem(e);for(let t=0;t<r;++t)o[t].rem(o[t].get(e),e)}},i.set=function(e){let r,a;for(s&&s.values(),r=0,a=t.length;r<a;++r)e[t[r]]=i.num;if(!n)for(r=0,a=o.length;r<a;++r)o[r].set(e)},i.init=function(){i.num=0,s&&s.reset();for(let e=0;e<r;++e)o[e].init()},i}(p,h,m)),this.inputs=Object.keys(l)}const $a=Ea.prototype;function Sa(e){fr.call(this,{},e),this._mlen=0,this._mods=[]}function Ma(e,t,n,i){const r=i.sort,o=r&&!i.ignorePeers,a=i.frame||[null,0],u=e.data(n),l=u.length,c=o?z(r):null,f={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:r||s(-1)};t.init();for(let s=0;s<l;++s)Ba(f,a,s,l),o&&za(f,c),t.update(f,u[s])}function Ba(e,t,n,i){e.p0=e.i0,e.p1=e.i1,e.i0=null==t[0]?0:Math.max(0,n-Math.abs(t[0])),e.i1=null==t[1]?i:Math.min(i,n+Math.abs(t[1])+1),e.index=n}function za(e,t){const n=e.i0,i=e.i1-1,r=e.compare,o=e.data,a=o.length-1;n>0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),i<a&&!r(o[i],o[i+1])&&(e.i1=t.right(o,o[i]))}$a.init=function(){this.windows.forEach((e=>e.init())),this.cell&&this.cell.init()},$a.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,o=i&&i.length;let a;if(n){for(a=e.p0;a<e.i0;++a)n.rem(r[a]);for(a=e.p1;a<e.i1;++a)n.add(r[a]);n.set(t)}for(a=0;a<o;++a)i[a].update(e,t)},Sa.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ca.concat(ho)},{name:"params",type:"number",null:!0,array:!0},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},t(Sa,fr,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),i=Pi(e.sort),r=so(e.groupby),o=e=>this.group(r(e));let a=this.state;a&&!n||(a=this.state=new Ea(e)),n||t.modified(a.inputs)?(this.value={},t.visit(t.SOURCE,(e=>o(e).add(e)))):(t.visit(t.REM,(e=>o(e).remove(e))),t.visit(t.ADD,(e=>o(e).add(e))));for(let s=0,u=this._mlen;s<u;++s)Ma(this._mods[s],a,i,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(a.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=Do(Bi),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}});const Oa=Object.freeze(Object.defineProperty({__proto__:null,aggregate:Ao,bin:ko,collect:Fo,compare:Co,countpattern:$o,cross:So,density:Oo,dotbin:jo,expression:Lo,extent:Uo,facet:Wo,field:Ho,filter:Vo,flatten:Yo,fold:Xo,formula:Jo,generate:Ko,impute:ea,joinaggregate:ta,kde:na,key:ia,load:oa,lookup:sa,multiextent:ua,multivalues:ca,params:da,pivot:ha,prefacet:pa,project:ma,proxy:ga,quantile:ya,relay:va,sample:ba,sequence:xa,sieve:wa,subflow:Io,timeunit:_a,tupleindex:ka,values:Da,window:Sa},Symbol.toStringTag,{value:"Module"}));function Na(e,t,n){var i=null,r=En(!0),o=null,a=Cn,s=null,u=Dn(l);function l(l){var c,f,d,h,p,m=(l=Fn(l)).length,g=!1,y=new Array(m),v=new Array(m);for(null==o&&(s=a(p=u())),c=0;c<=m;++c){if(!(c<m&&r(h=l[c],c,l))===g)if(g=!g)f=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),d=c-1;d>=f;--d)s.point(y[d],v[d]);s.lineEnd(),s.areaEnd()}g&&(y[c]=+e(h,c,l),v[c]=+t(h,c,l),s.point(i?+i(h,c,l):y[c],n?+n(h,c,l):v[c]))}if(p)return s=null,p+""||null}function c(){return Mn().defined(r).curve(a).context(o)}return e="function"==typeof e?e:void 0===e?$n:En(+e),t="function"==typeof t?t:En(void 0===t?0:+t),n="function"==typeof n?n:void 0===n?Sn:En(+n),l.x=function(t){return arguments.length?(e="function"==typeof t?t:En(+t),i=null,l):e},l.x0=function(t){return arguments.length?(e="function"==typeof t?t:En(+t),l):e},l.x1=function(e){return arguments.length?(i=null==e?null:"function"==typeof e?e:En(+e),l):i},l.y=function(e){return arguments.length?(t="function"==typeof e?e:En(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t="function"==typeof e?e:En(+e),l):t},l.y1=function(e){return arguments.length?(n=null==e?null:"function"==typeof e?e:En(+e),l):n},l.lineX0=l.lineY0=function(){return c().x(e).y(t)},l.lineY1=function(){return c().x(e).y(n)},l.lineX1=function(){return c().x(i).y(t)},l.defined=function(e){return arguments.length?(r="function"==typeof e?e:En(!!e),l):r},l.curve=function(e){return arguments.length?(a=e,null!=o&&(s=a(o)),l):a},l.context=function(e){return arguments.length?(null==e?o=s=null:s=a(o=e),l):o},l}const Ra={draw(e,t){const n=Bn(t/On);e.moveTo(n,0),e.arc(0,0,n,0,zn)}};function Ta(e,t){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}function Pa(e){return Math.log(e)}function ja(e){return Math.exp(e)}function La(e){return-Math.log(-e)}function qa(e){return-Math.exp(-e)}function Ua(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Ia(e){return(t,n)=>-e(-t,n)}function Wa(e){const t=e(Pa,ja),n=t.domain;let i,r,o=10;function a(){return i=function(e){return e===Math.E?Math.log:10===e&&Math.log10||2===e&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}(o),r=function(e){return 10===e?Ua:e===Math.E?Math.exp:t=>Math.pow(e,t)}(o),n()[0]<0?(i=Ia(i),r=Ia(r),e(La,qa)):e(Pa,ja),t}return t.base=function(e){return arguments.length?(o=+e,a()):o},t.domain=function(e){return arguments.length?(n(e),a()):n()},t.ticks=e=>{const t=n();let a=t[0],s=t[t.length-1];const u=s<a;u&&([a,s]=[s,a]);let l,c,f=i(a),d=i(s);const h=null==e?10:+e;let p=[];if(!(o%1)&&d-f<h){if(f=Math.floor(f),d=Math.ceil(d),a>0){for(;f<=d;++f)for(l=1;l<o;++l)if(c=f<0?l/r(-f):l*r(f),!(c<a)){if(c>s)break;p.push(c)}}else for(;f<=d;++f)for(l=o-1;l>=1;--l)if(c=f>0?l/r(-f):l*r(f),!(c<a)){if(c>s)break;p.push(c)}2*p.length<h&&(p=I(a,s,h))}else p=I(f,d,Math.min(d-f,h)).map(r);return u?p.reverse():p},t.tickFormat=(e,n)=>{if(null==e&&(e=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=W(n)).precision||(n.trim=!0),n=H(n)),e===1/0)return n;const a=Math.max(1,o*e/t.ticks().length);return e=>{let t=e/r(Math.round(i(e)));return t*o<o-.5&&(t*=o),t<=a?n(e):""}},t.nice=()=>n(_t(n(),{floor:e=>r(Math.floor(i(e))),ceil:e=>r(Math.ceil(i(e)))})),t}function Ha(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Ga(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Va(e){var t=1,n=e(Ha(t),Ga(t));return n.constant=function(n){return arguments.length?e(Ha(t=+n),Ga(t)):t},Tt(n)}function Ya(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Xa(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Ja(e){return e<0?-e*e:e*e}function Ka(e){var t=e(Lt,Lt),n=1;return t.exponent=function(t){return arguments.length?1===(n=+t)?e(Lt,Lt):.5===n?e(Xa,Ja):e(Ya(n),Ya(1/n)):n},Tt(t)}function Qa(){var e=Ka(Pt());return e.copy=function(){return jt(e,Qa()).exponent(e.exponent())},vn.apply(e,arguments),e}function Za(){var e,t,n,i,r,o=0,a=1,s=Lt,u=!1;function l(t){return null==t||isNaN(t=+t)?r:s(0===n?.5:(t=(i(t)-e)*n,u?Math.max(0,Math.min(1,t)):t))}function c(e){return function(t){var n,i;return arguments.length?([n,i]=t,s=e(n,i),l):[s(0),s(1)]}}return l.domain=function(r){return arguments.length?([o,a]=r,e=i(o=+o),t=i(a=+a),n=e===t?0:1/(t-e),l):[o,a]},l.clamp=function(e){return arguments.length?(u=!!e,l):u},l.interpolator=function(e){return arguments.length?(s=e,l):s},l.range=c(St),l.rangeRound=c(Nt),l.unknown=function(e){return arguments.length?(r=e,l):r},function(r){return i=r,e=r(o),t=r(a),n=e===t?0:1/(t-e),l}}function es(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ts(){var e=Tt(Za()(Lt));return e.copy=function(){return es(e,ts())},bn.apply(e,arguments)}function ns(){var e=Ka(Za());return e.copy=function(){return es(e,ns()).exponent(e.exponent())},bn.apply(e,arguments)}function is(){var e,t,n,i,r,o,a,s=0,u=.5,l=1,c=1,f=Lt,d=!1;function h(e){return isNaN(e=+e)?a:(e=.5+((e=+o(e))-t)*(c*e<c*t?i:r),f(d?Math.max(0,Math.min(1,e)):e))}function p(e){return function(t){var n,i,r;return arguments.length?([n,i,r]=t,f=Di(e,[n,i,r]),h):[f(0),f(.5),f(1)]}}return h.domain=function(a){return arguments.length?([s,u,l]=a,e=o(s=+s),t=o(u=+u),n=o(l=+l),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h):[s,u,l]},h.clamp=function(e){return arguments.length?(d=!!e,h):d},h.interpolator=function(e){return arguments.length?(f=e,h):f},h.range=p(St),h.rangeRound=p(Nt),h.unknown=function(e){return arguments.length?(a=e,h):a},function(a){return o=a,e=a(s),t=a(u),n=a(l),i=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),c=t<e?-1:1,h}}function rs(){var e=Ka(is());return e.copy=function(){return es(e,rs()).exponent(e.exponent())},bn.apply(e,arguments)}const os=An("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),as=An("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),ss=An("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),us=An("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),ls=An("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),cs=An("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),fs=An("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),ds=An("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),hs=An("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),ps=An("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function ms(e,t,n){const i=e-t+2*n;return e?i>0?i:1:0}const gs="linear",ys="log",vs="pow",bs="sqrt",xs="symlog",ws="time",_s="utc",As="sequential",ks="diverging",Ds="quantile",Fs="quantize",Cs="threshold",Es="ordinal",$s="point",Ss="band",Ms="bin-ordinal",Bs="continuous",zs="discrete",Os="discretizing",Ns="interpolating",Rs="temporal";function Ts(){const e=wn().unknown(void 0),t=e.domain,n=e.range;let i,r,o=[0,1],a=!1,s=0,u=0,l=.5;function c(){const e=t().length,c=o[1]<o[0],f=o[1-c],d=ms(e,s,u);let h=o[c-0];i=(f-h)/(d||1),a&&(i=Math.floor(i)),h+=(f-h-i*(e-s))*l,r=i*(1-s),a&&(h=Math.round(h),r=Math.round(r));const p=Ht(e).map((e=>h+i*e));return n(c?p.reverse():p)}return delete e.unknown,e.domain=function(e){return arguments.length?(t(e),c()):t()},e.range=function(e){return arguments.length?(o=[+e[0],+e[1]],c()):o.slice()},e.rangeRound=function(e){return o=[+e[0],+e[1]],a=!0,c()},e.bandwidth=function(){return r},e.step=function(){return i},e.round=function(e){return arguments.length?(a=!!e,c()):a},e.padding=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),s=u,c()):s},e.paddingInner=function(e){return arguments.length?(s=Math.max(0,Math.min(1,e)),c()):s},e.paddingOuter=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),c()):u},e.align=function(e){return arguments.length?(l=Math.max(0,Math.min(1,e)),c()):l},e.invertRange=function(e){if(null==e[0]||null==e[1])return;const i=o[1]<o[0],a=i?n().reverse():n(),s=a.length-1;let u,l,c,f=+e[0],d=+e[1];return f!=f||d!=d||(d<f&&(c=f,f=d,d=c),d<a[0]||f>o[1-i])?void 0:(u=Math.max(0,qt(a,f)-1),l=f===d?u:qt(a,d)-1,f-a[u]>r+1e-10&&++u,i&&(c=u,u=s-l,l=s-c),u>l?void 0:t().slice(u,l+1))},e.invert=function(t){const n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Ts().domain(t()).range(o).round(a).paddingInner(s).paddingOuter(u).align(l)},c()}function Ps(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Ps(t())},e}var js=Array.prototype.map;const Ls=Array.prototype.slice;const qs=new Map,Us=Symbol("vega_scale");function Is(e){return e[Us]=!0,e}function Ws(e){return e&&!0===e[Us]}function Hs(e,t,n){return arguments.length>1?(qs.set(e,function(e,t,n){const i=function(){const n=t();return n.invertRange||(n.invertRange=n.invert?function(e){return function(t){let n,i=t[0],r=t[1];return r<i&&(n=i,i=r,r=n),[e.invert(i),e.invert(r)]}}(n):n.invertExtent?function(e){return function(t){const n=e.range();let i,r,o,a,s=t[0],u=t[1],l=-1;for(u<s&&(r=s,s=u,u=r),o=0,a=n.length;o<a;++o)n[o]>=s&&n[o]<=u&&(l<0&&(l=o),i=o);if(!(l<0))return s=e.invertExtent(n[l]),u=e.invertExtent(n[i]),[void 0===s[0]?s[1]:s[0],void 0===u[1]?u[0]:u[1]]}}(n):void 0),n.type=e,Is(n)};return i.metadata=ee(u(n)),i}(e,t,n)),this):Gs(e)?qs.get(e):void 0}function Gs(e){return qs.has(e)}function Vs(e,t){const n=qs.get(e);return n&&n.metadata[t]}function Ys(e){return Vs(e,Bs)}function Xs(e){return Vs(e,zs)}function Js(e){return Vs(e,Os)}function Ks(e){return Vs(e,ys)}function Qs(e){return Vs(e,Ns)}function Zs(e){return Vs(e,Ds)}Hs("identity",(function e(t){var n;function i(e){return null==e||isNaN(e=+e)?n:e}return i.invert=i,i.domain=i.range=function(e){return arguments.length?(t=Array.from(e,Rt),i):t.slice()},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,Rt):[0,1],Tt(i)})),Hs(gs,Ut,Bs),Hs(ys,(function e(){const t=Wa(Pt()).domain([1,10]);return t.copy=()=>jt(t,e()).base(t.base()),vn.apply(t,arguments),t}),[Bs,ys]),Hs(vs,Qa,Bs),Hs(bs,(function(){return Qa.apply(null,arguments).exponent(.5)}),Bs),Hs(xs,(function e(){var t=Va(Pt());return t.copy=function(){return jt(t,e()).constant(t.constant())},vn.apply(t,arguments)}),Bs),Hs(ws,Ft,[Bs,Rs]),Hs(_s,(function(){return vn.apply(At(Dt,kt,Z,Q,K,J,X,Y,V,G).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Bs,Rs]),Hs(As,ts,[Bs,Ns]),Hs(`${As}-${gs}`,ts,[Bs,Ns]),Hs(`${As}-${ys}`,(function e(){var t=Wa(Za()).domain([1,10]);return t.copy=function(){return es(t,e()).base(t.base())},bn.apply(t,arguments)}),[Bs,Ns,ys]),Hs(`${As}-${vs}`,ns,[Bs,Ns]),Hs(`${As}-${bs}`,(function(){return ns.apply(null,arguments).exponent(.5)}),[Bs,Ns]),Hs(`${As}-${xs}`,(function e(){var t=Va(Za());return t.copy=function(){return es(t,e()).constant(t.constant())},bn.apply(t,arguments)}),[Bs,Ns]),Hs(`${ks}-${gs}`,(function e(){var t=Tt(is()(Lt));return t.copy=function(){return es(t,e())},bn.apply(t,arguments)}),[Bs,Ns]),Hs(`${ks}-${ys}`,(function e(){var t=Wa(is()).domain([.1,1,10]);return t.copy=function(){return es(t,e()).base(t.base())},bn.apply(t,arguments)}),[Bs,Ns,ys]),Hs(`${ks}-${vs}`,rs,[Bs,Ns]),Hs(`${ks}-${bs}`,(function(){return rs.apply(null,arguments).exponent(.5)}),[Bs,Ns]),Hs(`${ks}-${xs}`,(function e(){var t=Va(is());return t.copy=function(){return es(t,e()).constant(t.constant())},bn.apply(t,arguments)}),[Bs,Ns]),Hs(Ds,(function t(){var n,i=[],r=[],o=[];function a(){var e=0,t=Math.max(1,r.length);for(o=new Array(t-1);++e<t;)o[e-1]=ri(i,e/t);return s}function s(e){return null==e||isNaN(e=+e)?n:r[qt(o,e)]}return s.invertExtent=function(e){var t=r.indexOf(e);return t<0?[NaN,NaN]:[t>0?o[t-1]:i[0],t<o.length?o[t]:i[i.length-1]]},s.domain=function(t){if(!arguments.length)return i.slice();i=[];for(let e of t)null==e||isNaN(e=+e)||i.push(e);return i.sort(e),a()},s.range=function(e){return arguments.length?(r=Array.from(e),a()):r.slice()},s.unknown=function(e){return arguments.length?(n=e,s):n},s.quantiles=function(){return o.slice()},s.copy=function(){return t().domain(i).range(r).unknown(n)},vn.apply(s,arguments)}),[Os,Ds]),Hs(Fs,(function e(){var t,n=0,i=1,r=1,o=[.5],a=[0,1];function s(e){return null!=e&&e<=e?a[qt(o,e,0,r)]:t}function u(){var e=-1;for(o=new Array(r);++e<r;)o[e]=((e+1)*i-(e-r)*n)/(r+1);return s}return s.domain=function(e){return arguments.length?([n,i]=e,n=+n,i=+i,u()):[n,i]},s.range=function(e){return arguments.length?(r=(a=Array.from(e)).length-1,u()):a.slice()},s.invertExtent=function(e){var t=a.indexOf(e);return t<0?[NaN,NaN]:t<1?[n,o[0]]:t>=r?[o[r-1],i]:[o[t-1],o[t]]},s.unknown=function(e){return arguments.length?(t=e,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return e().domain([n,i]).range(a).unknown(t)},vn.apply(Tt(s),arguments)}),Os),Hs(Cs,(function e(){var t,n=[.5],i=[0,1],r=1;function o(e){return null!=e&&e<=e?i[qt(n,e,0,r)]:t}return o.domain=function(e){return arguments.length?(n=Array.from(e),r=Math.min(n.length,i.length-1),o):n.slice()},o.range=function(e){return arguments.length?(i=Array.from(e),r=Math.min(n.length,i.length-1),o):i.slice()},o.invertExtent=function(e){var t=i.indexOf(e);return[n[t-1],n[t]]},o.unknown=function(e){return arguments.length?(t=e,o):t},o.copy=function(){return e().domain(n).range(i).unknown(t)},vn.apply(o,arguments)}),Os),Hs(Ms,(function e(){let t=[],n=[];function i(e){return null==e||e!=e?void 0:n[(qt(t,e)-1)%n.length]}return i.domain=function(e){return arguments.length?(t=function(e){return js.call(e,A)}(e),i):t.slice()},i.range=function(e){return arguments.length?(n=Ls.call(e),i):n.slice()},i.tickFormat=function(e,n){return It(t[0],S(t),null==e?10:e,n)},i.copy=function(){return e().domain(i.domain()).range(i.range())},i}),[zs,Os]),Hs(Es,wn,zs),Hs(Ss,Ts,zs),Hs($s,(function(){return Ps(Ts().paddingInner(1))}),zs);const eu=["clamp","base","constant","exponent"];function tu(e,t){const n=t[0],i=S(t)-n;return function(t){return e(n+t*i)}}function nu(e,t,n){return Di(ou(t||"rgb",n),e)}function iu(e,t){const n=new Array(t),i=t+1;for(let r=0;r<t;)n[r]=e(++r/i);return n}function ru(e,t,n){const i=n-t;let r,o,a;return i&&Number.isFinite(i)?(r=(o=e.type).indexOf("-"),o=r<0?o:o.slice(r+1),a=Hs(o)().domain([t,n]).range([0,1]),eu.forEach((t=>e[t]?a[t](e[t]()):0)),a):s(.5)}function ou(e,t){const n=Fi[function(e){return"interpolate"+e.toLowerCase().split("-").map((e=>e[0].toUpperCase()+e.slice(1))).join("")}(e)];return null!=t&&n&&n.gamma?n.gamma(t):n}function au(e){if(f(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(6*i,6*++i);return n}function su(e,t){for(const n in e)lu(n,t(e[n]))}const uu={};function lu(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(uu[e]=t,this):uu[e]}su({accent:as,category10:os,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:ss,observable10:us,paired:ls,pastel1:cs,pastel2:fs,set1:ds,set2:hs,set3:ps,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},au),su({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(e=>nu(au(e))));const cu="symbol",fu=e=>f(e)?e.map((e=>String(e))):String(e),du=(e,t)=>e[1]-t[1],hu=(e,t)=>t[1]-e[1];function pu(e,t,n){let i;return te(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),null!=n&&(t=Math.min(t,Math.floor(R(e.domain())/n||1)+1))),ne(t)&&(i=t.step,t=t.interval),ie(t)&&(t=e.type===ws?B(t):e.type==_s?M(t):d("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function mu(e,t,n){let i=e.range(),r=i[0],o=S(i),a=du;if(r>o&&(i=o,o=r,r=i,a=hu),r=Math.floor(r),o=Math.ceil(o),t=t.map((t=>[t,e(t)])).filter((e=>r<=e[1]&&e[1]<=o)).sort(a).map((e=>e[0])),n>0&&t.length>1){const e=[t[0],S(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((e,t)=>!(t%2)));t.length<3&&(t=e)}return t}function gu(e,t){return e.bins?mu(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function yu(e,t,n,i,r,o){const a=t.type;let s=fu;if(a===ws||r===ws)s=e.timeFormat(i);else if(a===_s||r===_s)s=e.utcFormat(i);else if(Ks(a)){const r=e.formatFloat(i);if(o||t.bins)s=r;else{const e=vu(t,n,!1);s=t=>e(t)?r(t):""}}else if(t.tickFormat){const r=t.domain();s=e.formatSpan(r[0],r[r.length-1],n,i)}else i&&(s=e.format(i));return s}function vu(e,t,n){const i=gu(e,t),r=e.base(),o=Math.log(r),a=Math.max(1,r*t/i.length),s=e=>{let t=e/Math.pow(r,Math.round(Math.log(e)/o));return t*r<r-.5&&(t*=r),t<=a};return n?i.filter(s):s}const bu={[Ds]:"quantiles",[Fs]:"thresholds",[Cs]:"domain"},xu={[Ds]:"quantiles",[Fs]:"domain"};function wu(e,t){return e.bins?function(e){const t=e.slice(0,-1);return t.max=S(e),t}(e.bins):e.type===ys?vu(e,t,!0):bu[e.type]?function(e){const t=[-1/0].concat(e);return t.max=1/0,t}(e[bu[e.type]]()):gu(e,t)}function _u(e,t,n,i,r,o,a){const s=xu[t.type]&&o!==ws&&o!==_s?function(e,t,n){const i=t[xu[t.type]](),r=i.length;let o,a=r>1?i[1]-i[0]:i[0];for(o=1;o<r;++o)a=Math.min(a,i[o]-i[o-1]);return e.formatSpan(0,a,30,n)}(e,t,r):yu(e,t,n,r,o,a);return i===cu&&(e=>bu[e.type]||e.bins)(t)?Au(s):"discrete"===i?Du(s):Fu(s)}const Au=e=>(t,n,i)=>{const r=ku(i[n+1],ku(i.max,1/0)),o=Cu(t,e),a=Cu(r,e);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},ku=(e,t)=>null!=e?e:t,Du=e=>(t,n)=>n?e(t):null,Fu=e=>t=>e(t),Cu=(e,t)=>Number.isFinite(e)?t(e):null;function Eu(e,t,n,i){const r=i||t.type;return ie(n)&&Vs(r,Rs)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==ws?n||r!==_s?_u(e,t,5,null,n,i,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function $u(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=Eu(e,t,n.format,n.formatType);if(Js(t.type)){const e=wu(t).slice(1).map(r),n=e.length;return`${n} boundar${1===n?"y":"ies"}: ${e.join(", ")}`}if(Xs(t.type)){const e=t.domain(),n=e.length;return`${n} value${1===n?"":"s"}: ${n>i?e.slice(0,i-2).map(r).join(", ")+", ending with "+e.slice(-1).map(r):e.map(r).join(", ")}`}{const e=t.domain();return`values from ${r(e[0])} to ${r(S(e))}`}}let Su=0;const Mu="p_";function Bu(e){return e&&e.gradient}function zu(e,t,n){const i=e.gradient;let r=e.id,o="radial"===i?Mu:"";return r||(r=e.id="gradient_"+Su++,"radial"===i?(e.x1=Ou(e.x1,.5),e.y1=Ou(e.y1,.5),e.r1=Ou(e.r1,0),e.x2=Ou(e.x2,.5),e.y2=Ou(e.y2,.5),e.r2=Ou(e.r2,.5),o=Mu):(e.x1=Ou(e.x1,0),e.y1=Ou(e.y1,0),e.x2=Ou(e.x2,1),e.y2=Ou(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function Ou(e,t){return null!=e?e:t}function Nu(e,t){var n,i=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:i,stop:function(e,t){return i.push({offset:e,color:t}),n}}}const Ru={basis:{curve:Qn},"basis-closed":{curve:Kn},"basis-open":{curve:Jn},bundle:{curve:Xn,tension:"beta",value:.85},cardinal:{curve:Yn,tension:"tension",value:0},"cardinal-open":{curve:Vn,tension:"tension",value:0},"cardinal-closed":{curve:Gn,tension:"tension",value:0},"catmull-rom":{curve:Hn,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Wn,tension:"alpha",value:.5},"catmull-rom-open":{curve:In,tension:"alpha",value:.5},linear:{curve:Cn},"linear-closed":{curve:Un},monotone:{horizontal:qn,vertical:Ln},natural:{curve:jn},step:{curve:Pn},"step-after":{curve:Tn},"step-before":{curve:Rn}};function Tu(e,t,n){var i=c(Ru,e)&&Ru[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}const Pu={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},ju=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Lu=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,qu=/^((\s+,?\s*)|(,\s*))/,Uu=/^[01]/;function Iu(e){const t=[];return(e.match(ju)||[]).forEach((e=>{let n=e[0];const i=n.toLowerCase(),r=Pu[i],o=function(e,t,n){const i=[];for(let r=0;t&&r<n.length;)for(let o=0;o<t;++o){const t="a"!==e||3!==o&&4!==o?Lu:Uu,a=n.slice(r).match(t);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");r+=a[0].length,i.push(+a[0]);const s=n.slice(r).match(qu);null!==s&&(r+=s[0].length)}return i}(i,r,e.slice(1).trim()),a=o.length;if(a<r||a&&a%r!=0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([n,...o.slice(0,r)]),a!==r){"m"===i&&(n="M"===n?"L":"l");for(let e=r;e<a;e+=r)t.push([n,...o.slice(e,e+r)])}})),t}const Wu=Math.PI/180,Hu=Math.PI/2,Gu=2*Math.PI,Vu=Math.sqrt(3)/2;var Yu={},Xu={},Ju=[].join;function Ku(e){const t=Ju.call(e);if(Xu[t])return Xu[t];var n=e[0],i=e[1],r=e[2],o=e[3],a=e[4],s=e[5],u=e[6],l=e[7];const c=l*a,f=-u*s,d=u*a,h=l*s,p=Math.cos(r),m=Math.sin(r),g=Math.cos(o),y=Math.sin(o),v=.5*(o-r),b=Math.sin(.5*v),x=8/3*b*b/Math.sin(v),w=n+p-x*m,_=i+m+x*p,A=n+g,k=i+y,D=A+x*y,F=k-x*g;return Xu[t]=[c*w+f*_,d*w+h*_,c*D+f*F,d*D+h*F,c*A+f*k,d*A+h*k]}const Qu=["l",0,0,0,0,0,0,0];function Zu(e,t,n){const i=Qu[0]=e[0];if("a"===i||"A"===i)Qu[1]=t*e[1],Qu[2]=n*e[2],Qu[3]=e[3],Qu[4]=e[4],Qu[5]=e[5],Qu[6]=t*e[6],Qu[7]=n*e[7];else if("h"===i||"H"===i)Qu[1]=t*e[1];else if("v"===i||"V"===i)Qu[1]=n*e[1];else for(var r=1,o=e.length;r<o;++r)Qu[r]=(r%2==1?t:n)*e[r];return Qu}function el(e,t,n,i,r,o){var a,s,u,l,c,f=null,d=0,h=0,p=0,m=0,g=0,y=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==o&&(o=r),e.beginPath&&e.beginPath();for(var v=0,b=t.length;v<b;++v){switch(a=t[v],1===r&&1===o||(a=Zu(a,r,o)),a[0]){case"l":d+=a[1],h+=a[2],e.lineTo(d+n,h+i);break;case"L":d=a[1],h=a[2],e.lineTo(d+n,h+i);break;case"h":d+=a[1],e.lineTo(d+n,h+i);break;case"H":d=a[1],e.lineTo(d+n,h+i);break;case"v":h+=a[1],e.lineTo(d+n,h+i);break;case"V":h=a[1],e.lineTo(d+n,h+i);break;case"m":g=d+=a[1],y=h+=a[2],e.moveTo(d+n,h+i);break;case"M":g=d=a[1],y=h=a[2],e.moveTo(d+n,h+i);break;case"c":s=d+a[5],u=h+a[6],p=d+a[3],m=h+a[4],e.bezierCurveTo(d+a[1]+n,h+a[2]+i,p+n,m+i,s+n,u+i),d=s,h=u;break;case"C":d=a[5],h=a[6],p=a[3],m=a[4],e.bezierCurveTo(a[1]+n,a[2]+i,p+n,m+i,d+n,h+i);break;case"s":s=d+a[3],u=h+a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,d+a[1]+n,h+a[2]+i,s+n,u+i),p=d+a[1],m=h+a[2],d=s,h=u;break;case"S":s=a[3],u=a[4],p=2*d-p,m=2*h-m,e.bezierCurveTo(p+n,m+i,a[1]+n,a[2]+i,s+n,u+i),d=s,h=u,p=a[1],m=a[2];break;case"q":s=d+a[3],u=h+a[4],p=d+a[1],m=h+a[2],e.quadraticCurveTo(p+n,m+i,s+n,u+i),d=s,h=u;break;case"Q":s=a[3],u=a[4],e.quadraticCurveTo(a[1]+n,a[2]+i,s+n,u+i),d=s,h=u,p=a[1],m=a[2];break;case"t":s=d+a[1],u=h+a[2],null===f[0].match(/[QqTt]/)?(p=d,m=h):"t"===f[0]?(p=2*d-l,m=2*h-c):"q"===f[0]&&(p=2*d-p,m=2*h-m),l=p,c=m,e.quadraticCurveTo(p+n,m+i,s+n,u+i),h=u,p=(d=s)+a[1],m=h+a[2];break;case"T":s=a[1],u=a[2],p=2*d-p,m=2*h-m,e.quadraticCurveTo(p+n,m+i,s+n,u+i),d=s,h=u;break;case"a":tl(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+d+n,a[7]+h+i]),d+=a[6],h+=a[7];break;case"A":tl(e,d+n,h+i,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+i]),d=a[6],h=a[7];break;case"z":case"Z":d=g,h=y,e.closePath()}f=a}}function tl(e,t,n,i){const r=function(e,t,n,i,r,o,a,s,u){const l=Ju.call(arguments);if(Yu[l])return Yu[l];const c=a*Wu,f=Math.sin(c),d=Math.cos(c),h=d*(s-e)*.5+f*(u-t)*.5,p=d*(u-t)*.5-f*(s-e)*.5;let m=h*h/((n=Math.abs(n))*n)+p*p/((i=Math.abs(i))*i);m>1&&(m=Math.sqrt(m),n*=m,i*=m);const g=d/n,y=f/n,v=-f/i,b=d/i,x=g*s+y*u,w=v*s+b*u,_=g*e+y*t,A=v*e+b*t;let k=1/((_-x)*(_-x)+(A-w)*(A-w))-.25;k<0&&(k=0);let D=Math.sqrt(k);o==r&&(D=-D);const F=.5*(x+_)-D*(A-w),C=.5*(w+A)+D*(_-x),E=Math.atan2(w-C,x-F);let $=Math.atan2(A-C,_-F)-E;$<0&&1===o?$+=Gu:$>0&&0===o&&($-=Gu);const S=Math.ceil(Math.abs($/(Hu+.001))),M=[];for(let B=0;B<S;++B){const e=E+B*$/S,t=E+(B+1)*$/S;M[B]=[F,C,e,t,n,i,f,d]}return Yu[l]=M}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let o=0;o<r.length;++o){const t=Ku(r[o]);e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}}const nl=.5773502691896257,il={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Gu)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/2.5;e.moveTo(-n,-i),e.lineTo(-n,i),e.lineTo(-i,i),e.lineTo(-i,n),e.lineTo(i,n),e.lineTo(i,i),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(i,-i),e.lineTo(i,-n),e.lineTo(-i,-n),e.lineTo(-i,-i),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/7,r=n/2.5,o=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-o),e.lineTo(r,-o),e.lineTo(0,-n),e.lineTo(-r,-o),e.lineTo(-i,-o),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Vu*n,r=i-n*nl,o=n/4;e.moveTo(0,-i-r),e.lineTo(-o,i-r),e.lineTo(o,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Vu*n,r=i-n*nl;e.moveTo(0,-i-r),e.lineTo(-n,i-r),e.lineTo(n,i-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Vu*n;e.moveTo(0,-i),e.lineTo(-n,i),e.lineTo(n,i),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Vu*n;e.moveTo(0,i),e.lineTo(-n,-i),e.lineTo(n,-i),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Vu*n;e.moveTo(i,0),e.lineTo(-i,-n),e.lineTo(-i,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Vu*n;e.moveTo(-i,0),e.lineTo(i,-n),e.lineTo(i,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function rl(e){return c(il,e)?il[e]:function(e){if(!c(ol,e)){const t=Iu(e);ol[e]={draw:function(e,n){el(e,t,0,0,Math.sqrt(n)/2)}}}return ol[e]}(e)}var ol={};const al=.448084975506;function sl(e){return e.x}function ul(e){return e.y}function ll(e){return e.width}function cl(e){return e.height}function fl(e){return"function"==typeof e?e:()=>+e}function dl(e,t,n){return Math.max(t,Math.min(e,n))}function hl(){var e=sl,t=ul,n=ll,i=cl,r=fl(0),o=r,a=r,s=r,u=null;function l(l,c,f){var d,h=null!=c?c:+e.call(this,l),p=null!=f?f:+t.call(this,l),m=+n.call(this,l),g=+i.call(this,l),y=Math.min(m,g)/2,v=dl(+r.call(this,l),0,y),b=dl(+o.call(this,l),0,y),x=dl(+a.call(this,l),0,y),w=dl(+s.call(this,l),0,y);if(u||(u=d=Nn()),v<=0&&b<=0&&x<=0&&w<=0)u.rect(h,p,m,g);else{var _=h+m,A=p+g;u.moveTo(h+v,p),u.lineTo(_-b,p),u.bezierCurveTo(_-al*b,p,_,p+al*b,_,p+b),u.lineTo(_,A-w),u.bezierCurveTo(_,A-al*w,_-al*w,A,_-w,A),u.lineTo(h+x,A),u.bezierCurveTo(h+al*x,A,h,A-al*x,h,A-x),u.lineTo(h,p+v),u.bezierCurveTo(h,p+al*v,h+al*v,p,h+v,p),u.closePath()}if(d)return u=null,d+""||null}return l.x=function(t){return arguments.length?(e=fl(t),l):e},l.y=function(e){return arguments.length?(t=fl(e),l):t},l.width=function(e){return arguments.length?(n=fl(e),l):n},l.height=function(e){return arguments.length?(i=fl(e),l):i},l.cornerRadius=function(e,t,n,i){return arguments.length?(r=fl(e),o=null!=t?fl(t):r,s=null!=n?fl(n):r,a=null!=i?fl(i):o,l):r},l.context=function(e){return arguments.length?(u=null==e?null:e,l):u},l}function pl(){var e,t,n,i,r,o,a,s,u=null;function l(e,t,n){const i=n/2;if(r){var l=a-t,c=e-o;if(l||c){var f=Math.hypot(l,c),d=(l/=f)*s,h=(c/=f)*s,p=Math.atan2(c,l);u.moveTo(o-d,a-h),u.lineTo(e-l*i,t-c*i),u.arc(e,t,i,p-Math.PI,p),u.lineTo(o+d,a+h),u.arc(o,a,s,p,p+Math.PI)}else u.arc(e,t,i,0,Gu);u.closePath()}else r=1;o=e,a=t,s=i}function c(o){var a,s,c,f=o.length,d=!1;for(null==u&&(u=c=Nn()),a=0;a<=f;++a)!(a<f&&i(s=o[a],a,o))===d&&(d=!d)&&(r=0),d&&l(+e(s,a,o),+t(s,a,o),+n(s,a,o));if(c)return u=null,c+""||null}return c.x=function(t){return arguments.length?(e=t,c):e},c.y=function(e){return arguments.length?(t=e,c):t},c.size=function(e){return arguments.length?(n=e,c):n},c.defined=function(e){return arguments.length?(i=e,c):i},c.context=function(e){return arguments.length?(u=null==e?null:e,c):u},c}function ml(e,t){return null!=e?e:t}const gl=e=>e.x||0,yl=e=>e.y||0,vl=e=>!(!1===e.defined),bl=kn().startAngle((e=>e.startAngle||0)).endAngle((e=>e.endAngle||0)).padAngle((e=>e.padAngle||0)).innerRadius((e=>e.innerRadius||0)).outerRadius((e=>e.outerRadius||0)).cornerRadius((e=>e.cornerRadius||0)),xl=Na().x(gl).y1(yl).y0((e=>(e.y||0)+(e.height||0))).defined(vl),wl=Na().y(yl).x1(gl).x0((e=>(e.x||0)+(e.width||0))).defined(vl),_l=Mn().x(gl).y(yl).defined(vl),Al=hl().x(gl).y(yl).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>ml(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>ml(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>ml(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>ml(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),kl=function(e,t){let n=null,i=Dn(r);function r(){let r;if(n||(n=r=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return e="function"==typeof e?e:En(e||Ra),t="function"==typeof t?t:En(void 0===t?64:+t),r.type=function(t){return arguments.length?(e="function"==typeof t?t:En(t),r):e},r.size=function(e){return arguments.length?(t="function"==typeof e?e:En(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r}().type((e=>rl(e.shape||"circle"))).size((e=>ml(e.size,64))),Dl=pl().x(gl).y(yl).defined(vl).size((e=>e.size||1));function Fl(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Cl(e,t,n,i){return Al.context(e)(t,n,i)}var El=1;function $l(){El=1}function Sl(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+El++),s=r.clipping[o]||(r.clipping[o]={id:o});return a(i)?s.path=i(null):Fl(n)?s.path=Cl(null,n,0,0):(s.width=n.width||0,s.height=n.height||0),"url(#"+o+")"}function Ml(e){this.clear(),e&&this.union(e)}function Bl(e){this.mark=e,this.bounds=this.bounds||new Ml}function zl(e){Bl.call(this,e),this.items=this.items||[]}Ml.prototype={clone(){return new Ml(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),i<t?(this.y2=t,this.y1=i):(this.y1=t,this.y2=i),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:o,y2:a}=this,s=Math.cos(e),u=Math.sin(e),l=t-t*s+n*u,c=n-t*u-n*s;return[s*i-u*r+l,u*i+s*r+c,s*i-u*a+l,u*i+s*a+c,s*o-u*r+l,u*o+s*r+c,s*o-u*a+l,u*o+s*a+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},t(zl,Bl);class Ol{constructor(e){this._pending=0,this._loader=e||o()}pending(){return this._pending}sanitizeURL(e){const t=this;return Nl(t),t._loader.sanitize(e,{context:"href"}).then((e=>(Rl(t),e))).catch((()=>(Rl(t),null)))}loadImage(e){const t=this,n="undefined"!=typeof Image?Image:null;return Nl(t),t._loader.sanitize(e,{context:"image"}).then((e=>{const i=e.href;if(!i||!n)throw{url:i};const r=new n,o=c(e,"crossOrigin")?e.crossOrigin:"anonymous";return null!=o&&(r.crossOrigin=o),r.onload=()=>Rl(t),r.onerror=()=>Rl(t),r.src=i,r})).catch((e=>(Rl(t),{complete:!1,width:0,height:0,src:e&&e.url||""})))}ready(){const e=this;return new Promise((t=>{!function n(i){e.pending()?setTimeout((()=>{n(!0)}),10):t(i)}(!1)}))}}function Nl(e){e._pending+=1}function Rl(e){e._pending-=1}function Tl(e,t,n){if(t.stroke&&0!==t.opacity&&0!==t.strokeOpacity){const i=null!=t.strokeWidth?+t.strokeWidth:1;e.expand(i+(n?function(e,t){return e.strokeJoin&&"miter"!==e.strokeJoin?0:t}(t,i):0))}return e}const Pl=Gu-1e-8;let jl,Ll,ql,Ul,Il,Wl,Hl,Gl;const Vl=(e,t)=>jl.add(e,t),Yl=(e,t)=>Vl(Ll=e,ql=t),Xl=e=>Vl(e,jl.y1),Jl=e=>Vl(jl.x1,e),Kl=(e,t)=>Il*e+Hl*t,Ql=(e,t)=>Wl*e+Gl*t,Zl=(e,t)=>Vl(Kl(e,t),Ql(e,t)),ec=(e,t)=>Yl(Kl(e,t),Ql(e,t));function tc(e,t){return jl=e,t?(Ul=t*Wu,Il=Gl=Math.cos(Ul),Wl=Math.sin(Ul),Hl=-Wl):(Il=Gl=1,Ul=Wl=Hl=0),nc}const nc={beginPath(){},closePath(){},moveTo:ec,lineTo:ec,rect(e,t,n,i){Ul?(Zl(e+n,t),Zl(e+n,t+i),Zl(e,t+i),ec(e,t)):(Vl(e+n,t+i),Yl(e,t))},quadraticCurveTo(e,t,n,i){const r=Kl(e,t),o=Ql(e,t),a=Kl(n,i),s=Ql(n,i);ic(Ll,r,a,Xl),ic(ql,o,s,Jl),Yl(a,s)},bezierCurveTo(e,t,n,i,r,o){const a=Kl(e,t),s=Ql(e,t),u=Kl(n,i),l=Ql(n,i),c=Kl(r,o),f=Ql(r,o);rc(Ll,a,u,c,Xl),rc(ql,s,l,f,Jl),Yl(c,f)},arc(e,t,n,i,r,o){if(i+=Ul,r+=Ul,Ll=n*Math.cos(r)+e,ql=n*Math.sin(r)+t,Math.abs(r-i)>Pl)Vl(e-n,t-n),Vl(e+n,t+n);else{const a=i=>Vl(n*Math.cos(i)+e,n*Math.sin(i)+t);let s,u;if(a(i),a(r),r!==i)if((i%=Gu)<0&&(i+=Gu),(r%=Gu)<0&&(r+=Gu),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=Gu,s=i-i%Hu,u=0;u<4&&s>r;++u,s-=Hu)a(s);else for(s=i-i%Hu+Hu,u=0;u<4&&s<r;++u,s+=Hu)a(s)}}};function ic(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function rc(e,t,n,i,r){const o=i-e+3*t-3*n,a=e+n-2*t,s=e-t;let u,l=0,c=0;Math.abs(o)>1e-14?(u=a*a+s*o,u>=0&&(u=Math.sqrt(u),l=(-a+u)/o,c=(-a-u)/o)):l=.5*s/a,0<l&&l<1&&r(oc(l,e,t,n,i)),0<c&&c<1&&r(oc(c,e,t,n,i))}function oc(e,t,n,i,r){const o=1-e,a=o*o,s=e*e;return a*o*t+3*a*e*n+3*o*s*i+s*e*r}var ac=(ac=Ta(1,1))?ac.getContext("2d"):null;const sc=new Ml;function uc(e){return function(t,n){if(!ac)return!0;e(ac,t),sc.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:a}=sc;for(let e=r;e<=a;++e)for(let t=i;t<=o;++t)if(ac.isPointInPath(t,e))return!0;return!1}}function lc(e,t){return t.contains(e.x||0,e.y||0)}function cc(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,o=e.height||0;return t.intersects(sc.set(n,i,n+r,i+o))}function fc(e,t){const n=e.x||0,i=e.y||0;return dc(t,n,i,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i)}function dc(e,t,n,i,r){const{x1:o,y1:a,x2:s,y2:u}=e,l=i-t,c=r-n;let f,d,h,p,m=0,g=1;for(p=0;p<4;++p){if(0===p&&(f=-l,d=-(o-t)),1===p&&(f=l,d=s-t),2===p&&(f=-c,d=-(a-n)),3===p&&(f=c,d=u-n),Math.abs(f)<1e-10&&d<0)return!1;if(h=d/f,f<0){if(h>g)return!1;h>m&&(m=h)}else if(f>0){if(h<m)return!1;h<g&&(g=h)}}return!0}function hc(e,t){e.globalCompositeOperation=t.blend||"source-over"}function pc(e,t){return null==e?t:e}function mc(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function gc(e,t,n){return Bu(n)?function(e,t,n){const i=n.width(),r=n.height();let o;if("radial"===t.gradient)o=e.createRadialGradient(n.x1+pc(t.x1,.5)*i,n.y1+pc(t.y1,.5)*r,Math.max(i,r)*pc(t.r1,0),n.x1+pc(t.x2,.5)*i,n.y1+pc(t.y2,.5)*r,Math.max(i,r)*pc(t.r2,.5));else{const a=pc(t.x1,0),s=pc(t.y1,0),u=pc(t.x2,1),l=pc(t.y2,0);if(a!==u&&s!==l&&i!==r){const n=Ta(Math.ceil(i),Math.ceil(r)),o=n.getContext("2d");return o.scale(i,r),o.fillStyle=mc(o.createLinearGradient(a,s,u,l),t.stops),o.fillRect(0,0,i,r),e.createPattern(n,"no-repeat")}o=e.createLinearGradient(n.x1+a*i,n.y1+s*r,n.x1+u*i,n.y1+l*r)}return mc(o,t.stops)}(e,n,t.bounds):n}function yc(e,t,n){return(n*=null==t.fillOpacity?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=gc(e,t,t.fill),!0)}var vc=[];function bc(e,t,n){var i=null!=(i=t.strokeWidth)?i:1;return!(i<=0)&&((n*=null==t.strokeOpacity?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=gc(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||vc),e.lineDashOffset=t.strokeDashOffset||0),!0))}function xc(e,t){return e.zindex-t.zindex||e.index-t.index}function wc(e){if(!e.zdirty)return e.zitems;var t,n,i,r=e.items,o=[];for(n=0,i=r.length;n<i;++n)(t=r[n]).index=n,t.zindex&&o.push(t);return e.zdirty=!1,e.zitems=o.sort(xc)}function _c(e,t){var n,i,r=e.items;if(!r||!r.length)return;const o=wc(e);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||t(r[n]);r=o}for(n=0,i=r.length;n<i;++n)t(r[n])}function Ac(e,t){var n,i,r=e.items;if(!r||!r.length)return null;const o=wc(e);for(o&&o.length&&(r=o),i=r.length;--i>=0;)if(n=t(r[i]))return n;if(r===o)for(i=(r=e.items).length;--i>=0;)if(!r[i].zindex&&(n=t(r[i])))return n;return null}function kc(e){return function(t,n,i){_c(n,(n=>{i&&!i.intersects(n.bounds)||Dc(e,t,n,n)}))}}function Dc(e,t,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(e(t,i)||(hc(t,n),n.fill&&yc(t,n,r)&&t.fill(),n.stroke&&bc(t,n,r)&&t.stroke()))}function Fc(e){return e=e||p,function(t,n,i,r,o,a){return i*=t.pixelRatio,r*=t.pixelRatio,Ac(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return e(t,n,i,r,o,a)?n:void 0}))}}function Cc(e,t){return function(n,i,r,o){var a,s,u=Array.isArray(i)?i[0]:i,l=null==t?u.fill:t,c=u.stroke&&n.isPointInStroke;return c&&(a=u.strokeWidth,s=u.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!e(n,i)&&(l&&n.isPointInPath(r,o)||c&&n.isPointInStroke(r,o))}}function Ec(e){return Fc(Cc(e))}function $c(e,t){return"translate("+e+","+t+")"}function Sc(e){return"rotate("+e+")"}function Mc(e){return $c(e.x||0,e.y||0)}function Bc(e,t,n){function i(e,n){var i=n.x||0,r=n.y||0,o=n.angle||0;e.translate(i,r),o&&e.rotate(o*=Wu),e.beginPath(),t(e,n),o&&e.rotate(-o),e.translate(-i,-r)}return{type:e,tag:"path",nested:!1,attr:function(e,n){e("transform",function(e){return $c(e.x||0,e.y||0)+(e.angle?" "+Sc(e.angle):"")}(n)),e("d",t(null,n))},bound:function(e,n){return t(tc(e,n.angle),n),Tl(e,n).translate(n.x||0,n.y||0)},draw:kc(i),pick:Ec(i),isect:n||uc(i)}}var zc=Bc("arc",(function(e,t){return bl.context(e)(t)}));function Oc(e,t,n){function i(e,n){e.beginPath(),t(e,n)}const r=Cc(i);return{type:e,tag:"path",nested:!0,attr:function(e,n){var i=n.mark.items;i.length&&e("d",t(null,i))},bound:function(e,n){var i=n.items;return 0===i.length?e:(t(tc(e),i),Tl(e,i[0]))},draw:(o=i,function(e,t,n){!t.items.length||n&&!n.intersects(t.bounds)||Dc(o,e,t.items[0],t.items)}),pick:function(e,t,n,i,o,a){var s=t.items,u=t.bounds;return!s||!s.length||u&&!u.contains(o,a)?null:(n*=e.pixelRatio,i*=e.pixelRatio,r(e,s,n,i)?s[0]:null)},isect:lc,tip:n};var o}var Nc=Oc("area",(function(e,t){const n=t[0],i=n.interpolate||"linear";return("horizontal"===n.orient?wl:xl).curve(Tu(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r="horizontal"===e[0].orient?t[1]:t[0],o="horizontal"===e[0].orient?"y":"x",a=e.length,s=1/0;--a>=0;)!1!==e[a].defined&&(i=Math.abs(e[a][o]-r))<s&&(s=i,n=e[a]);return n}));function Rc(e,t){e.beginPath(),Fl(t)?Cl(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function Tc(e){const t=pc(e.strokeWidth,1);return null!=e.strokeOffset?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function Pc(e,t){const n=Tc(t);e("d",Cl(null,t,n,n))}function jc(e,t,n,i){const r=Tc(t);e.beginPath(),Cl(e,t,(n||0)+r,(i||0)+r)}const Lc=Cc(jc),qc=Cc(jc,!1),Uc=Cc(jc,!0);var Ic={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",Mc(t))},bound:function(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let t=0;t<i;++t)e.union(n[t].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),Tl(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n,i){_c(t,(t=>{const r=t.x||0,o=t.y||0,a=t.strokeForeground,s=null==t.opacity?1:t.opacity;(t.stroke||t.fill)&&s&&(jc(e,t,r,o),hc(e,t),t.fill&&yc(e,t,s)&&e.fill(),t.stroke&&!a&&bc(e,t,s)&&e.stroke()),e.save(),e.translate(r,o),t.clip&&Rc(e,t),n&&n.translate(-r,-o),_c(t,(t=>{("group"===t.marktype||null==i||i.includes(t.marktype))&&this.draw(e,t,n,i)})),n&&n.translate(r,o),e.restore(),a&&t.stroke&&s&&(jc(e,t,r,o),hc(e,t),bc(e,t,s)&&e.stroke())}))},pick:function(e,t,n,i,r,o){if(t.bounds&&!t.bounds.contains(r,o)||!t.items)return null;const a=n*e.pixelRatio,s=i*e.pixelRatio;return Ac(t,(u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(r,o))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),p=f+(u.height||0),m=u.clip;if(m&&(r<c||r>h||o<f||o>p))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,m&&Fl(u)&&!Uc(e,u,a,s))return e.restore(),null;const g=u.strokeForeground,y=!1!==t.interactive;return y&&g&&u.stroke&&qc(e,u,a,s)?(e.restore(),u):(l=Ac(u,(e=>function(e,t,n){return(!1!==e.interactive||"group"===e.marktype)&&e.bounds&&e.bounds.contains(t,n)}(e,c,f)?this.pick(e,n,i,c,f):null)),!l&&y&&(u.fill||!g&&u.stroke)&&Lc(e,u,a,s)&&(l=u),e.restore(),l||null)}))},isect:cc,content:function(e,t,n){e("clip-path",t.clip?Sl(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),Pc(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?Pc(e,t):e("d","")}},Wc={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Hc(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((t=>{e.image=t,e.image.url=e.url}))),n}function Gc(e,t){return null!=e.width?e.width:t&&t.width?!1!==e.aspect&&e.height?e.height*t.width/t.height:t.width:0}function Vc(e,t){return null!=e.height?e.height:t&&t.height?!1!==e.aspect&&e.width?e.width*t.height/t.width:t.height:0}function Yc(e,t){return"center"===e?t/2:"right"===e?t:0}function Xc(e,t){return"middle"===e?t/2:"bottom"===e?t:0}var Jc={type:"image",tag:"image",nested:!1,attr:function(e,t,n){const i=Hc(t,n),r=Gc(t,i),o=Vc(t,i),a=(t.x||0)-Yc(t.align,r),s=(t.y||0)-Xc(t.baseline,o);e("href",!i.src&&i.toDataURL?i.toDataURL():i.src||"",Wc["xmlns:xlink"],"xlink:href"),e("transform",$c(a,s)),e("width",r),e("height",o),e("preserveAspectRatio",!1===t.aspect?"none":"xMidYMid")},bound:function(e,t){const n=t.image,i=Gc(t,n),r=Vc(t,n),o=(t.x||0)-Yc(t.align,i),a=(t.y||0)-Xc(t.baseline,r);return e.set(o,a,o+i,a+r)},draw:function(e,t,n){_c(t,(t=>{if(n&&!n.intersects(t.bounds))return;const i=Hc(t,this);let r=Gc(t,i),o=Vc(t,i);if(0===r||0===o)return;let a,s,u,l,c=(t.x||0)-Yc(t.align,r),f=(t.y||0)-Xc(t.baseline,o);!1!==t.aspect&&(s=i.width/i.height,u=t.width/t.height,s==s&&u==u&&s!==u&&(u<s?(l=r/s,f+=(o-l)/2,o=l):(l=o*s,c+=(r-l)/2,r=l))),(i.complete||i.toDataURL)&&(hc(e,t),e.globalAlpha=null!=(a=t.opacity)?a:1,e.imageSmoothingEnabled=!1!==t.smooth,e.drawImage(i,c,f,r,o))}))},pick:Fc(),isect:p,get:Hc,xOffset:Yc,yOffset:Xc},Kc=Oc("line",(function(e,t){const n=t[0],i=n.interpolate||"linear";return _l.curve(Tu(i,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,i,r=Math.pow(e[0].strokeWidth||1,2),o=e.length;--o>=0;)if(!1!==e[o].defined&&(n=e[o].x-t[0])*n+(i=e[o].y-t[1])*i<r)return e[o];return null}));function Qc(e,t){var n=t.path;if(null==n)return!0;var i=t.x||0,r=t.y||0,o=t.scaleX||1,a=t.scaleY||1,s=(t.angle||0)*Wu,u=t.pathCache;u&&u.path===n||((t.pathCache=u=Iu(n)).path=n),s&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(s),el(e,u,0,0,o,a),e.rotate(-s),e.translate(-i,-r)):el(e,u,i,r,o,a)}var Zc={type:"path",tag:"path",nested:!1,attr:function(e,t){var n=t.scaleX||1,i=t.scaleY||1;1===n&&1===i||e("vector-effect","non-scaling-stroke"),e("transform",function(e){return $c(e.x||0,e.y||0)+(e.angle?" "+Sc(e.angle):"")+(e.scaleX||e.scaleY?" "+(t=e.scaleX||1,n=e.scaleY||1,"scale("+t+","+n+")"):"");var t,n}(t)),e("d",t.path)},bound:function(e,t){return Qc(tc(e,t.angle),t)?e.set(0,0,0,0):Tl(e,t,!0)},draw:kc(Qc),pick:Ec(Qc),isect:uc(Qc)};function ef(e,t){e.beginPath(),Cl(e,t)}var tf={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",Cl(null,t))},bound:function(e,t){var n,i;return Tl(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)},draw:kc(ef),pick:Ec(ef),isect:cc};function nf(e,t,n){var i,r,o,a;return!(!t.stroke||!bc(e,t,n))&&(i=t.x||0,r=t.y||0,o=null!=t.x2?t.x2:i,a=null!=t.y2?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(o,a),!0)}var rf={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",Mc(t)),e("x2",null!=t.x2?t.x2-(t.x||0):0),e("y2",null!=t.y2?t.y2-(t.y||0):0)},bound:function(e,t){var n,i;return Tl(e.set(n=t.x||0,i=t.y||0,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i),t)},draw:function(e,t,n){_c(t,(t=>{if(!n||n.intersects(t.bounds)){var i=null==t.opacity?1:t.opacity;i&&nf(e,t,i)&&(hc(e,t),e.stroke())}}))},pick:Fc((function(e,t,n,i){return!!e.isPointInStroke&&(nf(e,t,1)&&e.isPointInStroke(n,i))})),isect:fc},of=Bc("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),af=Bc("symbol",(function(e,t){return kl.context(e)(t)}),lc);const sf=re();var uf={height:pf,measureWidth:df,estimateWidth:cf,width:cf,canvas:lf};function lf(e){uf.width=e&&ac?df:cf}function cf(e,t){return ff(vf(e,t),pf(e))}function ff(e,t){return~~(.8*e.length*t)}function df(e,t){return pf(e)<=0||!(t=vf(e,t))?0:hf(t,xf(e))}function hf(e,t){const n=`(${t}) ${e}`;let i=sf.get(n);return void 0===i&&(ac.font=t,i=ac.measureText(e).width,sf.set(n,i)),i}function pf(e){return null!=e.fontSize?+e.fontSize||0:11}function mf(e){return null!=e.lineHeight?e.lineHeight:pf(e)+2}function gf(e){return t=e.lineBreak&&e.text&&!f(e.text)?e.text.split(e.lineBreak):e.text,f(t)?t.length>1?t:t[0]:t;var t}function yf(e){const t=gf(e);return(f(t)?t.length-1:0)*mf(e)}function vf(e,t){const n=null==t?"":(t+"").trim();return e.limit>0&&n.length?function(e,t){var n=+e.limit,i=function(e){if(uf.width===df){const t=xf(e);return e=>hf(e,t)}if(uf.width===cf){const t=pf(e);return e=>ff(e,t)}return t=>uf.width(e,t)}(e);if(i(t)<n)return t;var r,o=e.ellipsis||"…",a="rtl"===e.dir,s=0,u=t.length;if(n-=i(o),a){for(;s<u;)r=s+u>>>1,i(t.slice(r))>n?s=r+1:u=r;return o+t.slice(s)}for(;s<u;)r=1+(s+u>>>1),i(t.slice(0,r))<n?s=r:u=r-1;return t.slice(0,s)+o}(e,n):n}function bf(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function xf(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+pf(e)+"px "+bf(e,t)}function wf(e){var t=e.baseline,n=pf(e);return Math.round("top"===t?.79*n:"middle"===t?.3*n:"bottom"===t?-.21*n:"line-top"===t?.29*n+.5*mf(e):"line-bottom"===t?.29*n-.5*mf(e):0)}lf(!0);const _f={left:"start",center:"middle",right:"end"},Af=new Ml;function kf(e){var t,n=e.x||0,i=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-Hu,n+=r*Math.cos(t),i+=r*Math.sin(t)),Af.x1=n,Af.y1=i,Af}function Df(e,t,n){var i,r=uf.height(t),o=t.align,a=kf(t),s=a.x1,u=a.y1,l=t.dx||0,c=(t.dy||0)+wf(t)-Math.round(.8*r),d=gf(t);if(f(d)?(r+=mf(t)*(d.length-1),i=d.reduce(((e,n)=>Math.max(e,uf.width(t,n))),0)):i=uf.width(t,d),"center"===o?l-=i/2:"right"===o&&(l-=i),e.set(l+=s,c+=u,l+i,c+r),t.angle&&!n)e.rotate(t.angle*Wu,s,u);else if(2===n)return e.rotatedPoints(t.angle*Wu,s,u);return e}var Ff={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,i=t.dx||0,r=(t.dy||0)+wf(t),o=kf(t),a=o.x1,s=o.y1,u=t.angle||0;e("text-anchor",_f[t.align]||"start"),u?(n=$c(a,s)+" "+Sc(u),(i||r)&&(n+=" "+$c(i,r))):n=$c(a+i,s+r),e("transform",n)},bound:Df,draw:function(e,t,n){_c(t,(t=>{var i,r,o,a,s,u,l,c=null==t.opacity?1:t.opacity;if(!(n&&!n.intersects(t.bounds)||0===c||t.fontSize<=0||null==t.text||0===t.text.length)){if(e.font=xf(t),e.textAlign=t.align||"left",r=(i=kf(t)).x1,o=i.y1,t.angle&&(e.save(),e.translate(r,o),e.rotate(t.angle*Wu),r=o=0),r+=t.dx||0,o+=(t.dy||0)+wf(t),u=gf(t),hc(e,t),f(u))for(s=mf(t),a=0;a<u.length;++a)l=vf(t,u[a]),t.fill&&yc(e,t,c)&&e.fillText(l,r,o),t.stroke&&bc(e,t,c)&&e.strokeText(l,r,o),o+=s;else l=vf(t,u),t.fill&&yc(e,t,c)&&e.fillText(l,r,o),t.stroke&&bc(e,t,c)&&e.strokeText(l,r,o);t.angle&&e.restore()}}))},pick:Fc((function(e,t,n,i,r,o){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var a=kf(t),s=a.x1,u=a.y1,l=Df(Af,t,1),c=-t.angle*Wu,f=Math.cos(c),d=Math.sin(c),h=f*r-d*o+(s-f*s+d*u),p=d*r+f*o+(u-d*s-f*u);return l.contains(h,p)})),isect:function(e,t){const n=Df(Af,e,2);return dc(t,n[0],n[1],n[2],n[3])||dc(t,n[0],n[1],n[4],n[5])||dc(t,n[4],n[5],n[6],n[7])||dc(t,n[2],n[3],n[6],n[7])}},Cf={arc:zc,area:Nc,group:Ic,image:Jc,line:Kc,path:Zc,rect:tf,rule:rf,shape:of,symbol:af,text:Ff,trail:Oc("trail",(function(e,t){return Dl.context(e)(t)}),(function(e,t){for(var n,i,r=e.length;--r>=0;)if(!1!==e[r].defined&&(n=e[r].x-t[0])*n+(i=e[r].y-t[1])*i<(n=e[r].size||1)*n)return e[r];return null}))};function Ef(e,t,n){var i=Cf[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new Ml),e,n)}var $f={mark:null};function Sf(e,t,n){var i,r,o,a,s=Cf[e.marktype],u=s.bound,l=e.items,c=l&&l.length;if(s.nested)return c?o=l[0]:($f.mark=e,o=$f),a=Ef(o,u,n),t=t&&t.union(a)||a;if(t=t||e.bounds&&e.bounds.clear()||new Ml,c)for(i=0,r=l.length;i<r;++i)t.union(Ef(l[i],u,n));return e.bounds=t}const Mf=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function Bf(e,t){return JSON.stringify(e,Mf,t)}function zf(e){return Of("string"==typeof e?JSON.parse(e):e)}function Of(e){var t,n,i,r=e.marktype,o=e.items;if(o)for(n=0,i=o.length;n<i;++n)t=r?"mark":"group",o[n][t]=e,o[n].zindex&&(o[n][t].zdirty=!0),"group"===(r||t)&&Of(o[n]);return r&&Sf(e),e}class Nf{constructor(e){arguments.length?this.root=zf(e):(this.root=Rf({marktype:"group",name:"root",role:"frame"}),this.root.items=[new zl(this.root)])}toJSON(e){return Bf(this.root,e||0)}mark(e,t,n){const i=Rf(e,t=t||this.root.items[0]);return t.items[n]=i,i.zindex&&(i.group.zdirty=!0),i}}function Rf(e,t){const n={bounds:new Ml,clip:!!e.clip,group:t,interactive:!1!==e.interactive,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return null!=e.aria&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function Tf(e,t,n){return!e&&"undefined"!=typeof document&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function Pf(e,t){t=t.toLowerCase();for(var n=e.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===t)return n[i]}function jf(e,t,n,i){var r,o=e.childNodes[t];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=Tf(e.ownerDocument,n,i),e.insertBefore(o,r)),o}function Lf(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function qf(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Uf(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}class If{constructor(e,t){this._active=null,this._handlers={},this._loader=e||o(),this._tooltip=t||Wf}initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()}scene(e){return arguments.length?(this._scene=e,this):this._scene}on(){}off(){}_handlerIndex(e,t,n){for(let i=e?e.length:0;--i>=0;)if(e[i].type===t&&(!n||e[i].handler===n))return i;return-1}handlers(e){const t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(const i in t)n.push(...t[i]);return n}eventName(e){const t=e.indexOf(".");return t<0?e:e.slice(0,t)}handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then((t=>{const n=new MouseEvent(e.type,e),i=Tf(null,"a");for(const e in t)i.setAttribute(e,t[e]);i.dispatchEvent(n)})).catch((()=>{}))}handleTooltip(e,t,n){if(t&&null!=t.tooltip){t=function(e,t,n,i){var r,o,a=e&&e.mark;if(a&&(r=Cf[a.marktype]).tip){for((o=Uf(t,n))[0]-=i[0],o[1]-=i[1];e=e.mark.group;)o[0]-=e.x||0,o[1]-=e.y||0;e=r.tip(a.items,o)}return e}(t,e,this.canvas(),this._origin);const i=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,i)}}getItemBoundingClientRect(e){const t=this.canvas();if(!t)return;const n=t.getBoundingClientRect(),i=this._origin,r=e.bounds,o=r.width(),a=r.height();let s=r.x1+i[0]+n.left,u=r.y1+i[1]+n.top;for(;e.mark&&(e=e.mark.group);)s+=e.x||0,u+=e.y||0;return{x:s,y:u,width:o,height:a,left:s,top:u,right:s+o,bottom:u+a}}}function Wf(e,t,n,i){e.element().setAttribute("title",i||"")}class Hf{constructor(e){this._el=null,this._bgcolor=null,this._loader=new Ol(e)}initialize(e,t,n,i,r){return this._el=e,this.resize(t,n,i,r)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(e){return 0===arguments.length?this._bgcolor:(this._bgcolor=e,this)}resize(e,t,n,i){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=i||1,this}dirty(){}render(e,t){const n=this;return n._call=function(){n._render(e,t)},n._call(),n._call=null,n}_render(){}renderAsync(e,t){const n=this.render(e,t);return this._ready?this._ready.then((()=>n)):Promise.resolve(n)}_load(e,t){var n=this,i=n._loader[e](t);if(!n._ready){const e=n._call;n._ready=n._loader.ready().then((t=>{t&&e(),n._ready=null}))}return i}sanitizeURL(e){return this._load("sanitizeURL",e)}loadImage(e){return this._load("loadImage",e)}}const Gf="dragenter",Vf="dragleave",Yf="dragover",Xf="pointerdown",Jf="pointermove",Kf="pointerout",Qf="pointerover",Zf="mousedown",ed="mousemove",td="mouseout",nd="mouseover",id="click",rd="mousewheel",od="touchstart",ad="touchmove",sd="touchend",ud=["keydown","keypress","keyup",Gf,Vf,Yf,Xf,"pointerup",Jf,Kf,Qf,Zf,"mouseup",ed,td,nd,id,"dblclick","wheel",rd,od,ad,sd],ld=Jf,cd=td,fd=id;class dd extends If{constructor(e,t){super(e,t),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=ud,this.pointermove=gd([Jf,ed],[Qf,nd],[Kf,td]),this.dragover=gd([Yf],[Gf],[Vf]),this.pointerout=yd([Kf,td]),this.dragleave=yd([Vf])}initialize(e,t,n){return this._canvas=e&&Pf(e,"canvas"),[id,Zf,Xf,Jf,Kf,Vf].forEach((e=>pd(this,e))),super.initialize(e,t,n)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(e){this.fire(rd,e)}pointerdown(e){this._down=this._active,this.fire(Xf,e)}mousedown(e){this._down=this._active,this.fire(Zf,e)}click(e){this._down===this._active&&(this.fire(id,e),this._down=null)}touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(od,e,!0)}touchmove(e){this.fire(ad,e,!0)}touchend(e){this.fire(sd,e,!0),this._touch=null}fire(e,t,n){const i=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===fd&&i&&i.href?this.handleHref(t,i,i.href):e!==ld&&e!==cd||this.handleTooltip(t,i,e!==cd),r)for(let o=0,a=r.length;o<a;++o)r[o].handler.call(this._obj,t,i)}on(e,t){const n=this.eventName(e),i=this._handlers;return this._handlerIndex(i[n],e,t)<0&&(pd(this,e),(i[n]||(i[n]=[])).push({type:e,handler:t})),this}off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&i.splice(r,1),this}pickEvent(e){const t=Uf(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])}pick(e,t,n,i,r){const o=this.context();return Cf[e.marktype].pick.call(this,o,e,t,n,i,r)}}const hd=e=>e===od||e===ad||e===sd?[od,ad,sd]:[e];function pd(e,t){hd(t).forEach((t=>function(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?n=>e[t](n):n=>e.fire(t,n)))}(e,t)))}function md(e,t,n){t.forEach((t=>e.fire(t,n)))}function gd(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r||(r&&r.exit||md(this,n,i),this._active=o,md(this,t,i)),md(this,e,i)}}function yd(e){return function(t){md(this,e,t),this._active=null}}function vd(e,t,n,i,r,o){const a="undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&null!=e.parentNode,s=e.getContext("2d"),u=a?"undefined"!=typeof window&&window.devicePixelRatio||1:r;e.width=t*u,e.height=n*u;for(const l in o)s[l]=o[l];return a&&1!==u&&(e.style.width=t+"px",e.style.height=n+"px"),s.pixelRatio=u,s.setTransform(u,0,0,u,u*i[0],u*i[1]),e}class bd extends Hf{constructor(e){super(e),this._options={},this._redraw=!1,this._dirty=new Ml,this._tempb=new Ml}initialize(e,t,n,i,r,o){return this._options=o||{},this._canvas=this._options.externalContext?null:Ta(1,1,this._options.type),e&&this._canvas&&(Lf(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(e,t,n,i,r)}resize(e,t,n,i){if(super.resize(e,t,n,i),this._canvas)vd(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const e=this._options.externalContext;e||d("CanvasRenderer is missing a valid canvas or context"),e.scale(this._scale,this._scale),e.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(e){const t=this._tempb.clear().union(e.bounds);let n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)}_render(e,t){const n=this.context(),i=this._origin,r=this._width,o=this._height,a=this._dirty,s=xd(i,r,o);n.save();const u=this._redraw||a.empty()?(this._redraw=!1,s.expand(1)):function(e,t,n){t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio);return t.translate(-n[0]%1,-n[1]%1),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}(n,s.intersect(a),i);return this.clear(-i[0],-i[1],r,o),this.draw(n,e,u,t),n.restore(),a.clear(),this}draw(e,t,n,i){if("group"!==t.marktype&&null!=i&&!i.includes(t.marktype))return;const r=Cf[t.marktype];t.clip&&function(e,t){var n=t.clip;e.save(),a(n)?(e.beginPath(),n(e),e.clip()):Rc(e,t.group)}(e,t),r.draw.call(this,e,t,n,i),t.clip&&e.restore()}clear(e,t,n,i){const r=this._options,o=this.context();"pdf"===r.type||r.externalContext||o.clearRect(e,t,n,i),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(e,t,n,i))}}const xd=(e,t,n)=>(new Ml).set(0,0,t,n).translate(-e[0],-e[1]);class wd extends If{constructor(e,t){super(e,t);const n=this;n._hrefHandler=_d(n,((e,t)=>{t&&t.href&&n.handleHref(e,t,t.href)})),n._tooltipHandler=_d(n,((e,t)=>{n.handleTooltip(e,t,e.type!==cd)}))}initialize(e,t,n){let i=this._svg;return i&&(i.removeEventListener(fd,this._hrefHandler),i.removeEventListener(ld,this._tooltipHandler),i.removeEventListener(cd,this._tooltipHandler)),this._svg=i=e&&Pf(e,"svg"),i&&(i.addEventListener(fd,this._hrefHandler),i.addEventListener(ld,this._tooltipHandler),i.addEventListener(cd,this._tooltipHandler)),super.initialize(e,t,n)}canvas(){return this._svg}on(e,t){const n=this.eventName(e),i=this._handlers;if(this._handlerIndex(i[n],e,t)<0){const r={type:e,handler:t,listener:_d(this,t)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this}off(e,t){const n=this.eventName(e),i=this._handlers[n],r=this._handlerIndex(i,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this}}const _d=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)},Ad="aria-hidden",kd="aria-label",Dd="role",Fd="aria-roledescription",Cd="graphics-object",Ed="graphics-symbol",$d=(e,t,n)=>({[Dd]:e,[Fd]:t,[kd]:n||void 0}),Sd=ee(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Md={axis:{desc:"axis",caption:function(e){const t=e.datum,n=e.orient,i=t.title?Rd(e):null,r=e.context,o=r.scales[t.scale].value,a=r.dataflow.locale(),s=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(i?` titled '${i}'`:"")+` for a ${Xs(s)?"discrete":s} scale with ${$u(a,o,e)}`}},legend:{desc:"legend",caption:function(e){const t=e.datum,n=t.title?Rd(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),a=e.context,s=a.scales[r[o[0]]].value,u=a.dataflow.locale();return l=i,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+` for ${function(e){return e=e.map((e=>e+("fill"===e||"stroke"===e?" color":""))),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+S(e)}(o)} with ${$u(u,s,e)}`;var l}},"title-text":{desc:"title",caption:e=>`Title text '${Nd(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${Nd(e)}'`}},Bd={ariaRole:Dd,ariaRoleDescription:Fd,description:kd};function zd(e,t){const n=!1===t.aria;if(e(Ad,n||void 0),n||null==t.description)for(const i in Bd)e(Bd[i],void 0);else{const n=t.mark.marktype;e(kd,t.description),e(Dd,t.ariaRole||("group"===n?Cd:Ed)),e(Fd,t.ariaRoleDescription||`${n} mark`)}}function Od(e){return!1===e.aria?{[Ad]:!0}:Sd[e.role]?null:Md[e.role]?function(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return $d(t.role||Ed,t.desc,n.description||i(n))}catch(n){return null}}(e,Md[e.role]):function(e){const t=e.marktype,n="group"===t||"text"===t||e.items.some((e=>null!=e.description&&!1!==e.aria));return $d(n?Cd:Ed,`${t} mark container`,e.description)}(e)}function Nd(e){return u(e.text).join(" ")}function Rd(e){try{return u(S(e.items).items[0].text).join(" ")}catch(t){return null}}const Td=e=>(e+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function Pd(){let e="",t="",n="";const i=[],r=()=>t=n="",o=(e,n)=>{var i;return null!=n&&(t+=` ${e}="${i=n,Td(i).replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
")}"`),a},a={open(s){(o=>{t&&(e+=`${t}>${n}`,r()),i.push(o)})(s),t="<"+s;for(var u=arguments.length,l=new Array(u>1?u-1:0),c=1;c<u;c++)l[c-1]=arguments[c];for(const e of l)for(const t in e)o(t,e[t]);return a},close(){const o=i.pop();return e+=t?t+(n?`>${n}</${o}>`:"/>"):`</${o}>`,r(),a},attr:o,text:e=>(n+=Td(e),a),toString:()=>e};return a}const jd=e=>Ld(Pd(),e)+"";function Ld(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let t=0;t<i;++t)e.attr(n[t].name,n[t].value)}if(t.hasChildNodes()){const n=t.childNodes;for(const t of n)3===t.nodeType?e.text(t.nodeValue):Ld(e,t)}return e.close()}const qd={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"},Ud={blend:"mix-blend-mode"},Id={fill:"none","stroke-miterlimit":10},Wd="http://www.w3.org/2000/xmlns/",Hd=Wc.xmlns;class Gd extends Hf{constructor(e){super(e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(e,t,n,i,r){return this._defs={},this._clearDefs(),e&&(this._svg=jf(e,0,"svg",Hd),this._svg.setAttributeNS(Wd,"xmlns",Hd),this._svg.setAttributeNS(Wd,"xmlns:xlink",Wc["xmlns:xlink"]),this._svg.setAttribute("version",Wc.version),this._svg.setAttribute("class","marks"),Lf(e,1),this._root=jf(this._svg,0,"g",Hd),nh(this._root,Id),Lf(this._svg,1)),this.background(this._bgcolor),super.initialize(e,t,n,i,r)}background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),super.background(...arguments)}resize(e,t,n,i){return super.resize(e,t,n,i),this._svg&&(nh(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=jf(e,0,"rect",Hd),nh(n,{width:this._width,height:this._height,fill:t}));const i=jd(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),i}_render(e,t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e,void 0,t),Lf(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))}isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const e=this._dirty;if(!e.length||!this._dirtyID)return!0;const t=++this._dirtyID;let n,i,r,o,a,s,u;for(a=0,s=e.length;a<s;++a)n=e[a],i=n.mark,i.marktype!==r&&(r=i.marktype,o=Cf[r]),i.zdirty&&i.dirty!==t&&(this._dirtyAll=!1,Vd(n,t),i.items.forEach((e=>{e.dirty=t}))),i.zdirty||(n.exit?(o.nested&&i.items.length?(u=i.items[0],u._svg&&this._update(o,u._svg,u)):n._svg&&(u=n._svg.parentNode,u&&u.removeChild(n._svg)),n._svg=null):(n=o.nested?i.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,Vd(n,t)),n._update=t)));return!this._dirtyAll}mark(e,t,n,i){if(!this.isDirty(t))return t._svg;const r=this._svg,o=t.marktype,a=Cf[o],s=!1===t.interactive?"none":null,u="g"===a.tag,l=Jd(t,e,n,"g",r);if("group"!==o&&null!=i&&!i.includes(o))return Lf(l,0),t._svg;l.setAttribute("class",qf(t));const c=Od(t);for(const p in c)ih(l,p,c[p]);u||ih(l,"pointer-events",s),ih(l,"clip-path",t.clip?Sl(this,t,t.group):null);let f=null,d=0;const h=e=>{const t=this.isDirty(e),n=Jd(e,l,f,a.tag,r);t&&(this._update(a,n,e),u&&function(e,t,n,i){t=t.lastChild.previousSibling;let r,o=0;_c(n,(n=>{r=e.mark(t,n,r,i),++o})),Lf(t,1+o)}(this,n,e,i)),f=n,++d};return a.nested?t.items.length&&h(t.items[0]):_c(t,h),Lf(l,d),l}_update(e,t,n){Kd=t,Qd=t.__values__,zd(eh,n),e.attr(eh,n,this);const i=Zd[e.type];i&&i.call(this,e,t,n),Kd&&this.style(Kd,n)}style(e,t){if(null!=t){for(const n in qd){let i="font"===n?bf(t):t[n];if(i===Qd[n])continue;const r=qd[n];null==i?e.removeAttribute(r):(Bu(i)&&(i=zu(i,this._defs.gradient,rh())),e.setAttribute(r,i+"")),Qd[n]=i}for(const n in Ud)th(e,Ud[n],t[n])}}defs(){const e=this._svg,t=this._defs;let n=t.el,i=0;for(const r in t.gradient)n||(t.el=n=jf(e,1,"defs",Hd)),i=Yd(n,t.gradient[r],i);for(const r in t.clipping)n||(t.el=n=jf(e,1,"defs",Hd)),i=Xd(n,t.clipping[r],i);n&&(0===i?(e.removeChild(n),t.el=null):Lf(n,i))}_clearDefs(){const e=this._defs;e.gradient={},e.clipping={}}}function Vd(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function Yd(e,t,n){let i,r,o;if("radial"===t.gradient){let i=jf(e,n++,"pattern",Hd);nh(i,{id:Mu+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),i=jf(i,0,"rect",Hd),nh(i,{width:1,height:1,fill:`url(${rh()}#${t.id})`}),nh(e=jf(e,n++,"radialGradient",Hd),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else nh(e=jf(e,n++,"linearGradient",Hd),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i<r;++i)o=jf(e,i,"stop",Hd),o.setAttribute("offset",t.stops[i].offset),o.setAttribute("stop-color",t.stops[i].color);return Lf(e,i),n}function Xd(e,t,n){let i;return(e=jf(e,n,"clipPath",Hd)).setAttribute("id",t.id),t.path?(i=jf(e,0,"path",Hd),i.setAttribute("d",t.path)):(i=jf(e,0,"rect",Hd),nh(i,{x:0,y:0,width:t.width,height:t.height})),Lf(e,1),n+1}function Jd(e,t,n,i,r){let o,a=e._svg;if(!a&&(o=t.ownerDocument,a=Tf(o,i,Hd),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:"default"},"g"===i))){const t=Tf(o,"path",Hd);a.appendChild(t),t.__data__=e;const n=Tf(o,"g",Hd);a.appendChild(n),n.__data__=e;const i=Tf(o,"path",Hd);a.appendChild(i),i.__data__=e,i.__values__={fill:"default"}}return(a.ownerSVGElement!==r||function(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}let Kd=null,Qd=null;const Zd={group(e,t,n){const i=Kd=t.childNodes[2];Qd=i.__values__,e.foreground(eh,n,this),Qd=t.__values__,Kd=t.childNodes[1],e.content(eh,n,this);const r=Kd=t.childNodes[0];e.background(eh,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==Qd.events&&(ih(i,"pointer-events",o),ih(r,"pointer-events",o),Qd.events=o),n.strokeForeground&&n.stroke){const e=n.fill;ih(i,"display",null),this.style(r,n),ih(r,"stroke",null),e&&(n.fill=null),Qd=i.__values__,this.style(i,n),e&&(n.fill=e),Kd=null}else ih(i,"display","none")},image(e,t,n){!1===n.smooth?(th(t,"image-rendering","optimizeSpeed"),th(t,"image-rendering","pixelated")):th(t,"image-rendering",null)},text(e,t,n){const i=gf(n);let r,o,a,s;f(i)?(o=i.map((e=>vf(n,e))),r=o.join("\n"),r!==Qd.text&&(Lf(t,0),a=t.ownerDocument,s=mf(n),o.forEach(((e,i)=>{const r=Tf(a,"tspan",Hd);r.__data__=n,r.textContent=e,i&&(r.setAttribute("x",0),r.setAttribute("dy",s)),t.appendChild(r)})),Qd.text=r)):(o=vf(n,i),o!==Qd.text&&(t.textContent=o,Qd.text=o)),ih(t,"font-family",bf(n)),ih(t,"font-size",pf(n)+"px"),ih(t,"font-style",n.fontStyle),ih(t,"font-variant",n.fontVariant),ih(t,"font-weight",n.fontWeight)}};function eh(e,t,n){t!==Qd[e]&&(n?function(e,t,n,i){null!=n?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}(Kd,e,t,n):ih(Kd,e,t),Qd[e]=t)}function th(e,t,n){n!==Qd[t]&&(null==n?e.style.removeProperty(t):e.style.setProperty(t,n+""),Qd[t]=n)}function nh(e,t){for(const n in t)ih(e,n,t[n])}function ih(e,t,n){null!=n?e.setAttribute(t,n):e.removeAttribute(t)}function rh(){let e;return"undefined"==typeof window?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class oh extends Hf{constructor(e){super(e),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(e){const t=Pd();t.open("svg",v({},Wc,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",Id,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this}mark(e,t){const n=Cf[t.marktype],i=n.tag,r=[zd,n.attr];e.open("g",{class:qf(t),"clip-path":t.clip?Sl(this,t,t.group):null},Od(t),{"pointer-events":"g"!==i&&!1===t.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&e.open("a",a),e.open(i,this.attr(t,o,r,"g"!==i?i:null)),"text"===i){const t=gf(o);if(f(t)){const n={x:0,dy:mf(o)};for(let i=0;i<t.length;++i)e.open("tspan",i?n:null).text(vf(o,t[i])).close()}else e.text(vf(o,t))}else if("g"===i){const i=o.strokeForeground,r=o.fill,a=o.stroke;i&&a&&(o.stroke=null),e.open("path",this.attr(t,o,n.background,"bgrect")).close(),e.open("g",this.attr(t,o,n.content)),_c(o,(t=>this.mark(e,t))),e.close(),i&&a?(r&&(o.fill=null),o.stroke=a,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),r&&(o.fill=r)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),a&&e.close()};return n.nested?t.items&&t.items.length&&o(t.items[0]):_c(t,o),e.close()}href(e){const t=e.href;let n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((e=>{e["xlink:href"]=e.href,e.href=null,(this._hrefs||(this._hrefs={}))[t]=e}))}return null}attr(e,t,n,i){const r={},o=(e,t,n,i)=>{r[i||e]=t};return Array.isArray(n)?n.forEach((e=>e(o,t,this))):n(o,t,this),i&&function(e,t,n,i,r){let o;if(null==t)return e;"bgrect"===i&&!1===n.interactive&&(e["pointer-events"]="none");if("bgfore"===i&&(!1===n.interactive&&(e["pointer-events"]="none"),e.display="none",null!==t.fill))return e;"image"===i&&!1===t.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===i&&(e["font-family"]=bf(t),e["font-size"]=pf(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const a in qd){let n=t[a];const i=qd[a];("transparent"!==n||"fill"!==i&&"stroke"!==i)&&null!=n&&(Bu(n)&&(n=zu(n,r.gradient,"")),e[i]=n)}for(const a in Ud){const e=t[a];null!=e&&(o=o||[],o.push(`${Ud[a]}: ${e};`))}o&&(e.style=o.join(" "))}(r,t,e,i,this._defs),r}defs(e){const t=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(t).length+Object.keys(n).length){e.open("defs");for(const n in t){const i=t[n],r=i.stops;"radial"===i.gradient?(e.open("pattern",{id:Mu+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),e.close(),e.open("radialGradient",{id:n,fx:i.x1,fy:i.y1,fr:i.r1,cx:i.x2,cy:i.y2,r:i.r2})):e.open("linearGradient",{id:n,x1:i.x1,x2:i.x2,y1:i.y1,y2:i.y2});for(let t=0;t<r.length;++t)e.open("stop",{offset:r[t].offset,"stop-color":r[t].color}).close();e.close()}for(const t in n){const i=n[t];e.open("clipPath",{id:t}),i.path?e.open("path",{d:i.path}).close():e.open("rect",{x:0,y:0,width:i.width,height:i.height}).close(),e.close()}e.close()}}}const ah={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class sh extends Hf{constructor(e){super(e),this._svgRenderer=new Gd(e),this._canvasRenderer=new bd(e)}initialize(e,t,n,i,r){this._root_el=jf(e,0,"div");const o=jf(this._root_el,0,"div"),a=jf(this._root_el,1,"div");return this._root_el.style.position="relative",ah.debug||(o.style.height="100%",a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.height="100%",a.style.width="100%"),this._svgEl=ah.svgOnTop?a:o,this._canvasEl=ah.svgOnTop?o:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,t,n,i,r),this._svgRenderer.initialize(this._svgEl,t,n,i,r),super.initialize(e,t,n,i,r)}dirty(e){return ah.svgMarkTypes.includes(e.mark.marktype)?this._svgRenderer.dirty(e):this._canvasRenderer.dirty(e),this}_render(e,t){const n=(t??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter((e=>!ah.svgMarkTypes.includes(e)));this._svgRenderer.render(e,ah.svgMarkTypes),this._canvasRenderer.render(e,n)}resize(e,t,n,i){return super.resize(e,t,n,i),this._svgRenderer.resize(e,t,n,i),this._canvasRenderer.resize(e,t,n,i),this}background(e){return ah.svgOnTop?this._canvasRenderer.background(e):this._svgRenderer.background(e),this}}class uh extends dd{constructor(e,t){super(e,t)}initialize(e,t,n){const i=jf(jf(e,0,"div"),ah.svgOnTop?0:1,"div");return super.initialize(i,t,n)}}const lh="canvas",ch="hybrid",fh="none",dh={Canvas:lh,PNG:"png",SVG:"svg",Hybrid:ch,None:fh},hh={};function ph(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(hh[e]=t,this):hh[e]}function mh(e,t,n){const i=[],r=(new Ml).union(t),o=e.marktype;return o?gh(e,r,n,i):"group"===o?yh(e,r,n,i):d("Intersect scene must be mark node or group item.")}function gh(e,t,n,i){if(function(e,t,n){return e.bounds&&t.intersects(e.bounds)&&("group"===e.marktype||!1!==e.interactive&&(!n||n(e)))}(e,t,n)){const r=e.items,o=e.marktype,a=r.length;let s=0;if("group"===o)for(;s<a;++s)yh(r[s],t,n,i);else for(const e=Cf[o].isect;s<a;++s){const n=r[s];vh(n,t,e)&&i.push(n)}}return i}function yh(e,t,n,i){n&&n(e.mark)&&vh(e,t,Cf.group.isect)&&i.push(e);const r=e.items,o=r&&r.length;if(o){const a=e.x||0,s=e.y||0;t.translate(-a,-s);for(let e=0;e<o;++e)gh(r[e],t,n,i);t.translate(a,s)}return i}function vh(e,t,n){const i=e.bounds;return t.encloses(i)||t.intersects(i)&&n(e,t)}hh[lh]=hh.png={renderer:bd,headless:bd,handler:dd},hh.svg={renderer:Gd,headless:oh,handler:wd},hh[ch]={renderer:sh,headless:sh,handler:uh},hh[fh]={};const bh=new Ml;function xh(e){const t=e.clip;if(a(t))t(tc(bh.clear()));else{if(!t)return;bh.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(bh)}function wh(e,t,n){return e===t||("path"===n?_h(e,t):e instanceof Date&&t instanceof Date?+e==+t:te(e)&&te(t)?Math.abs(e-t)<=1e-9:e&&t&&(ne(e)||ne(t))?function(e,t){var n,i,r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(!wh(e[n=r[i]],t[n],n))return!1;return typeof e==typeof t}(e,t):e==t)}function _h(e,t){return wh(Iu(e),Iu(t))}const Ah="top",kh="left",Dh="right",Fh="bottom",Ch="start",Eh="middle",$h="end",Sh="group",Mh="axis",Bh="title",zh="frame",Oh="scope",Nh="legend",Rh="row-header",Th="row-footer",Ph="row-title",jh="column-header",Lh="column-footer",qh="column-title",Uh="padding",Ih="fit",Wh="fit-x",Hh="fit-y",Gh="none",Vh="all",Yh="each",Xh="flush",Jh="column",Kh="row";function Qh(e){fr.call(this,null,e)}function Zh(e,t,n){return t(e.bounds.clear(),e,n)}t(Qh,fr,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=Cf[r],a=o.bound;let s,u=i.bounds;if(o.nested)i.items.length&&n.dirty(i.items[0]),u=Zh(i,a),i.items.forEach((e=>{e.bounds.clear().union(u)}));else if(r===Sh||e.modified())switch(t.visit(t.MOD,(e=>n.dirty(e))),u.clear(),i.items.forEach((e=>u.union(Zh(e,a)))),i.role){case Mh:case Nh:case Bh:t.reflow()}else s=t.changed(t.REM),t.visit(t.ADD,(e=>{u.union(Zh(e,a))})),t.visit(t.MOD,(e=>{s=s||u.alignsWith(e.bounds),n.dirty(e),u.union(Zh(e,a))})),s&&(u.clear(),i.items.forEach((e=>u.union(e.bounds))));return xh(i),t.modifies("bounds")}});const ep=":vega_identifier:";function tp(e){fr.call(this,0,e)}function np(e){fr.call(this,null,e)}function ip(e){fr.call(this,null,e)}tp.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},t(tp,fr,{transform(e,t){const n=(r=t.dataflow)._signals[ep]||(r._signals[ep]=r.add(0)),i=e.as;var r;let o=n.value;return t.visit(t.ADD,(e=>e[i]=e[i]||++o)),n.set(this.value=o),t}}),t(np,fr,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,function(e){const t=e.groups,n=e.parent;return t&&1===t.size?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===Sh?zl:Bl;return t.visit(t.ADD,(e=>i.call(e,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});const rp={parity:e=>e.filter(((e,t)=>t%2?e.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((e,i)=>i&&op(n.bounds,e.bounds,t)?e.opacity=0:(n=e,1)))}},op=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),ap=(e,t)=>{for(var n,i=1,r=e.length,o=e[0].bounds;i<r;o=n,++i)if(op(o,n=e[i].bounds,t))return!0},sp=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},up=e=>(e.forEach((e=>e.opacity=1)),e),lp=(e,t)=>e.reflow(t.modified()).modifies("opacity");function cp(e){fr.call(this,null,e)}t(ip,fr,{transform(e,t){const n=rp[e.method]||rp.parity,i=e.separation||0;let r,o,a=t.materialize(t.SOURCE).source;if(!a||!a.length)return;if(!e.method)return e.modified("method")&&(up(a),t=lp(t,e)),t;if(a=a.filter(sp),!a.length)return;if(e.sort&&(a=a.slice().sort(e.sort)),r=up(a),t=lp(t,e),r.length>=3&&ap(r,i)){do{r=n(r,i)}while(r.length>=3&&ap(r,i));r.length<3&&!S(a).opacity&&(r.length>1&&(S(r).opacity=0),S(a).opacity=1)}var s,u,l,c,f;e.boundScale&&e.boundTolerance>=0&&(s=e.boundScale,u=e.boundOrient,l=+e.boundTolerance,c=s.range(),f=new Ml,u===Ah||u===Fh?f.set(c[0],-1/0,c[1],1/0):f.set(-1/0,c[0],1/0,c[1]),f.expand(l||1),o=e=>f.encloses(e.bounds),a.forEach((e=>{o(e)||(e.opacity=0)})));const d=r[0].mark.bounds.clear();return a.forEach((e=>{e.opacity&&d.union(e.bounds)})),t}}),t(cp,fr,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,(e=>n.dirty(e))),t.fields&&t.fields.zindex){const e=t.source&&t.source[0];e&&(e.mark.zdirty=!0)}}});const fp=new Ml;function dp(e,t,n){return e[t]===n?0:(e[t]=n,1)}function hp(e){var t=e.items[0].orient;return t===kh||t===Dh}function pp(e,t,n,i){var r,o,a=t.items[0],s=a.datum,u=null!=a.translate?a.translate:.5,l=a.orient,c=function(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}(s),f=a.range,d=a.offset,h=a.position,p=a.minExtent,m=a.maxExtent,g=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,b=g&&yf(g),x=0,w=0;switch(fp.clear().union(v),v.clear(),(r=c[0])>-1&&v.union(a.items[r].bounds),(r=c[1])>-1&&v.union(a.items[r].bounds),l){case Ah:x=h||0,w=-d,o=Math.max(p,Math.min(m,-v.y1)),v.add(0,-o).add(f,0),g&&mp(e,g,o,y,b,0,-1,v);break;case kh:x=-d,w=h||0,o=Math.max(p,Math.min(m,-v.x1)),v.add(-o,0).add(0,f),g&&mp(e,g,o,y,b,1,-1,v);break;case Dh:x=n+d,w=h||0,o=Math.max(p,Math.min(m,v.x2)),v.add(0,0).add(o,f),g&&mp(e,g,o,y,b,1,1,v);break;case Fh:x=h||0,w=i+d,o=Math.max(p,Math.min(m,v.y2)),v.add(0,0).add(f,o),g&&mp(e,g,o,y,0,0,1,v);break;default:x=a.x,w=a.y}return Tl(v.translate(x,w),a),dp(a,"x",x+u)|dp(a,"y",w+u)&&(a.bounds=fp,e.dirty(a),a.bounds=v,e.dirty(a)),a.mark.bounds.clear().union(v)}function mp(e,t,n,i,r,o,a,s){const u=t.bounds;if(t.auto){const s=a*(n+r+i);let l=0,c=0;e.dirty(t),o?l=(t.x||0)-(t.x=s):c=(t.y||0)-(t.y=s),t.mark.bounds.clear().union(u.translate(-l,-c)),e.dirty(t)}s.union(u)}const gp=(e,t)=>Math.floor(Math.min(e,t)),yp=(e,t)=>Math.ceil(Math.max(e,t));function vp(e){return(new Ml).set(0,0,e.width||0,e.height||0)}function bp(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function xp(e,t,n){const i=ne(e)?e[t]:e;return null!=i?i:void 0!==n?n:0}function wp(e){return e<0?Math.ceil(-e):0}function _p(e,t,n){var i,r,o,a,s,u,l,c,f,d,h,p=!n.nodirty,m=n.bounds===Xh?vp:bp,g=fp.set(0,0,0,0),y=xp(n.align,Jh),v=xp(n.align,Kh),b=xp(n.padding,Jh),x=xp(n.padding,Kh),w=n.columns||t.length,_=w<=0?1:Math.ceil(t.length/w),A=t.length,k=Array(A),D=Array(w),F=0,C=Array(A),E=Array(_),$=0,S=Array(A),M=Array(A),B=Array(A);for(r=0;r<w;++r)D[r]=0;for(r=0;r<_;++r)E[r]=0;for(r=0;r<A;++r)u=t[r],s=B[r]=m(u),u.x=u.x||0,S[r]=0,u.y=u.y||0,M[r]=0,o=r%w,a=~~(r/w),F=Math.max(F,l=Math.ceil(s.x2)),$=Math.max($,c=Math.ceil(s.y2)),D[o]=Math.max(D[o],l),E[a]=Math.max(E[a],c),k[r]=b+wp(s.x1),C[r]=x+wp(s.y1),p&&e.dirty(t[r]);for(r=0;r<A;++r)r%w==0&&(k[r]=0),r<w&&(C[r]=0);if(y===Yh)for(o=1;o<w;++o){for(h=0,r=o;r<A;r+=w)h<k[r]&&(h=k[r]);for(r=o;r<A;r+=w)k[r]=h+D[o-1]}else if(y===Vh){for(h=0,r=0;r<A;++r)r%w&&h<k[r]&&(h=k[r]);for(r=0;r<A;++r)r%w&&(k[r]=h+F)}else for(y=!1,o=1;o<w;++o)for(r=o;r<A;r+=w)k[r]+=D[o-1];if(v===Yh)for(a=1;a<_;++a){for(h=0,i=(r=a*w)+w;r<i;++r)h<C[r]&&(h=C[r]);for(r=a*w;r<i;++r)C[r]=h+E[a-1]}else if(v===Vh){for(h=0,r=w;r<A;++r)h<C[r]&&(h=C[r]);for(r=w;r<A;++r)C[r]=h+$}else for(v=!1,a=1;a<_;++a)for(i=(r=a*w)+w;r<i;++r)C[r]+=E[a-1];for(f=0,r=0;r<A;++r)f=k[r]+(r%w?f:0),S[r]+=f-t[r].x;for(o=0;o<w;++o)for(d=0,r=o;r<A;r+=w)d+=C[r],M[r]+=d-t[r].y;if(y&&xp(n.center,Jh)&&_>1)for(r=0;r<A;++r)(f=(s=y===Vh?F:D[r%w])-B[r].x2-t[r].x-S[r])>0&&(S[r]+=f/2);if(v&&xp(n.center,Kh)&&1!==w)for(r=0;r<A;++r)(d=(s=v===Vh?$:E[~~(r/w)])-B[r].y2-t[r].y-M[r])>0&&(M[r]+=d/2);for(r=0;r<A;++r)g.union(B[r].translate(S[r],M[r]));switch(f=xp(n.anchor,"x"),d=xp(n.anchor,"y"),xp(n.anchor,Jh)){case $h:f-=g.width();break;case Eh:f-=g.width()/2}switch(xp(n.anchor,Kh)){case $h:d-=g.height();break;case Eh:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),r=0;r<A;++r)t[r].mark.bounds.clear();for(r=0;r<A;++r)(u=t[r]).x+=S[r]+=f,u.y+=M[r]+=d,g.union(u.mark.bounds.union(u.bounds.translate(S[r],M[r]))),p&&e.dirty(u);return g}function Ap(e,t,n){var i,r,o,a,s,u,l,c=function(e){var t,n,i=e.items,r=i.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<r;++o)if(n=(t=i[o]).items,t.marktype===Sh)switch(t.role){case Mh:case Nh:case Bh:break;case Rh:a.rowheaders.push(...n);break;case Th:a.rowfooters.push(...n);break;case jh:a.colheaders.push(...n);break;case Lh:a.colfooters.push(...n);break;case Ph:a.rowtitle=n[0];break;case qh:a.coltitle=n[0];break;default:a.marks.push(...n)}return a}(t),f=c.marks,d=n.bounds===Xh?kp:Dp,h=n.offset,p=n.columns||f.length,m=p<=0?1:Math.ceil(f.length/p),g=m*p;const y=_p(e,f,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(u=xp(n.headerBand,Kh,null),i=Fp(e,c.rowheaders,f,p,m,-xp(h,"rowHeader"),gp,0,d,"x1",0,p,1,u)),c.colheaders&&(u=xp(n.headerBand,Jh,null),r=Fp(e,c.colheaders,f,p,p,-xp(h,"columnHeader"),gp,1,d,"y1",0,1,p,u)),c.rowfooters&&(u=xp(n.footerBand,Kh,null),o=Fp(e,c.rowfooters,f,p,m,xp(h,"rowFooter"),yp,0,d,"x2",p-1,p,1,u)),c.colfooters&&(u=xp(n.footerBand,Jh,null),a=Fp(e,c.colfooters,f,p,p,xp(h,"columnFooter"),yp,1,d,"y2",g-p,1,p,u)),c.rowtitle&&(s=xp(n.titleAnchor,Kh),l=xp(h,"rowTitle"),l=s===$h?o+l:i-l,u=xp(n.titleBand,Kh,.5),Cp(e,c.rowtitle,l,0,y,u)),c.coltitle&&(s=xp(n.titleAnchor,Jh),l=xp(h,"columnTitle"),l=s===$h?a+l:r-l,u=xp(n.titleBand,Jh,.5),Cp(e,c.coltitle,l,1,y,u))}function kp(e,t){return"x1"===t?e.x||0:"y1"===t?e.y||0:"x2"===t?(e.x||0)+(e.width||0):"y2"===t?(e.y||0)+(e.height||0):void 0}function Dp(e,t){return e.bounds[t]}function Fp(e,t,n,i,r,o,a,s,u,l,c,f,d,h){var p,m,g,y,v,b,x,w,_,A=n.length,k=0,D=0;if(!A)return k;for(p=c;p<A;p+=f)n[p]&&(k=a(k,u(n[p],l)));if(!t.length)return k;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),k+=o,m=0,y=t.length;m<y;++m)e.dirty(t[m]),t[m].mark.bounds.clear();for(p=c,m=0,y=t.length;m<y;++m,p+=f){for(v=(b=t[m]).mark.bounds,g=p;g>=0&&null==(x=n[g]);g-=d);s?(w=null==h?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),_=k):(w=k,_=null==h?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),v.union(b.bounds.translate(w-(b.x||0),_-(b.y||0))),b.x=w,b.y=_,e.dirty(b),D=a(D,v[l])}return D}function Cp(e,t,n,i,r,o){if(t){e.dirty(t);var a=n,s=n;i?a=Math.round(r.x1+o*r.width()):s=Math.round(r.y1+o*r.height()),t.bounds.translate(a-(t.x||0),s-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=a,t.y=s,e.dirty(t)}}function Ep(e,t,n,i,r,o,a){const s=function(e,t){const n=e[t]||{};return(t,i)=>null!=n[t]?n[t]:null!=e[t]?e[t]:i}(n,t),u=function(e,t){let n=-1/0;return e.forEach((e=>{null!=e.offset&&(n=Math.max(n,e.offset))})),n>-1/0?n:t}(e,s("offset",0)),l=s("anchor",Ch),c=l===$h?1:l===Eh?.5:0,f={align:Yh,bounds:s("bounds",Xh),columns:"vertical"===s("direction")?1:e.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(t){case kh:f.anchor={x:Math.floor(i.x1)-u,column:$h,y:c*(a||i.height()+2*i.y1),row:l};break;case Dh:f.anchor={x:Math.ceil(i.x2)+u,y:c*(a||i.height()+2*i.y1),row:l};break;case Ah:f.anchor={y:Math.floor(r.y1)-u,row:$h,x:c*(o||r.width()+2*r.x1),column:l};break;case Fh:f.anchor={y:Math.ceil(r.y2)+u,x:c*(o||r.width()+2*r.x1),column:l};break;case"top-left":f.anchor={x:u,y:u};break;case"top-right":f.anchor={x:o-u,y:u,column:$h};break;case"bottom-left":f.anchor={x:u,y:a-u,row:$h};break;case"bottom-right":f.anchor={x:o-u,y:a-u,column:$h,row:$h}}return f}function $p(e,t){var n,i,r=t.items[0],o=r.datum,a=r.orient,s=r.bounds,u=r.x,l=r.y;return r._bounds?r._bounds.clear().union(s):r._bounds=s.clone(),s.clear(),function(e,t,n){var i=t.padding,r=i-n.x,o=i-n.y;if(t.datum.title){var a=t.items[1].items[0],s=a.anchor,u=t.titlePadding||0,l=i-a.x,c=i-a.y;switch(a.orient){case kh:r+=Math.ceil(a.bounds.width())+u;break;case Dh:case Fh:break;default:o+=a.bounds.height()+u}switch((r||o)&&Mp(e,n,r,o),a.orient){case kh:c+=Sp(t,n,a,s,1,1);break;case Dh:l+=Sp(t,n,a,$h,0,0)+u,c+=Sp(t,n,a,s,1,1);break;case Fh:l+=Sp(t,n,a,s,0,0),c+=Sp(t,n,a,$h,-1,0,1)+u;break;default:l+=Sp(t,n,a,s,0,0)}(l||c)&&Mp(e,a,l,c),(l=Math.round(a.bounds.x1-i))<0&&(Mp(e,n,-l,0),Mp(e,a,-l,0))}else(r||o)&&Mp(e,n,r,o)}(e,r,r.items[0].items[0]),s=function(e,t){return e.items.forEach((e=>t.union(e.bounds))),t.x1=e.padding,t.y1=e.padding,t}(r,s),n=2*r.padding,i=2*r.padding,s.empty()||(n=Math.ceil(s.width()+n),i=Math.ceil(s.height()+i)),"symbol"===o.type&&function(e){const t=e.reduce(((e,t)=>(e[t.column]=Math.max(t.bounds.x2-t.x,e[t.column]||0),e)),{});e.forEach((e=>{e.width=t[e.column],e.height=e.bounds.y2-e.y}))}(r.items[0].items[0].items[0].items),a!==Gh&&(r.x=u=0,r.y=l=0),r.width=n,r.height=i,Tl(s.set(u,l,u+n,l+i),r),r.mark.bounds.clear().union(s),r}function Sp(e,t,n,i,r,o,a){const s="symbol"!==e.datum.type,u=n.datum.vgrad,l=(!s||!o&&u||a?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,c=u&&o?l:0,f=u&&o?0:l,d=r<=0?0:yf(n);return Math.round(i===Ch?c:i===$h?f-d:.5*(l-d))}function Mp(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function Bp(e){fr.call(this,null,e)}t(Bp,fr,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach((t=>{e.layout&&Ap(n,t,e.layout),function(e,t,n){var i,r,o,a,s,u=t.items,l=Math.max(0,t.width||0),c=Math.max(0,t.height||0),f=(new Ml).set(0,0,l,c),d=f.clone(),h=f.clone(),p=[];for(a=0,s=u.length;a<s;++a)switch((r=u[a]).role){case Mh:(hp(r)?d:h).union(pp(e,r,l,c));break;case Bh:i=r;break;case Nh:p.push($p(e,r));break;case zh:case Oh:case Rh:case Th:case Ph:case jh:case Lh:case qh:d.union(r.bounds),h.union(r.bounds);break;default:f.union(r.bounds)}if(p.length){const t={};p.forEach((e=>{(o=e.orient||Dh)!==Gh&&(t[o]||(t[o]=[])).push(e)}));for(const i in t){const r=t[i];_p(e,r,Ep(r,i,n.legends,d,h,l,c))}p.forEach((t=>{const i=t.bounds;if(i.equals(t._bounds)||(t.bounds=t._bounds,e.dirty(t),t.bounds=i,e.dirty(t)),!n.autosize||n.autosize.type!==Ih&&n.autosize.type!==Wh&&n.autosize.type!==Hh)f.union(i);else switch(t.orient){case kh:case Dh:f.add(i.x1,0).add(i.x2,0);break;case Ah:case Fh:f.add(0,i.y1).add(0,i.y2)}}))}f.union(d).union(h),i&&f.union(function(e,t,n,i,r){var o,a=t.items[0],s=a.frame,u=a.orient,l=a.anchor,c=a.offset,f=a.padding,d=a.items[0].items[0],h=a.items[1]&&a.items[1].items[0],p=u===kh||u===Dh?i:n,m=0,g=0,y=0,v=0,b=0;if(s!==Sh?u===kh?(m=r.y2,p=r.y1):u===Dh?(m=r.y1,p=r.y2):(m=r.x1,p=r.x2):u===kh&&(m=i,p=0),o=l===Ch?m:l===$h?p:(m+p)/2,h&&h.text){switch(u){case Ah:case Fh:b=d.bounds.height()+f;break;case kh:v=d.bounds.width()+f;break;case Dh:v=-d.bounds.width()-f}fp.clear().union(h.bounds),fp.translate(v-(h.x||0),b-(h.y||0)),dp(h,"x",v)|dp(h,"y",b)&&(e.dirty(h),h.bounds.clear().union(fp),h.mark.bounds.clear().union(fp),e.dirty(h)),fp.clear().union(h.bounds)}else fp.clear();switch(fp.union(d.bounds),u){case Ah:g=o,y=r.y1-fp.height()-c;break;case kh:g=r.x1-fp.width()-c,y=o;break;case Dh:g=r.x2+fp.width()+c,y=o;break;case Fh:g=o,y=r.y2+c;break;default:g=a.x,y=a.y}return dp(a,"x",g)|dp(a,"y",y)&&(fp.translate(g,y),e.dirty(a),a.bounds.clear().union(fp),t.bounds.clear().union(fp),e.dirty(a)),a.bounds}(e,i,l,c,f));t.clip&&f.set(0,0,t.width||0,t.height||0);!function(e,t,n,i){const r=i.autosize||{},o=r.type;if(e._autosize<1||!o)return;let a=e._width,s=e._height,u=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-u)),h=Math.max(0,Math.ceil(n.y2-c));if(r.contains===Uh){const t=e.padding();a-=t.left+t.right,s-=t.top+t.bottom}o===Gh?(l=0,f=0,u=a,c=s):o===Ih?(u=Math.max(0,a-l-d),c=Math.max(0,s-f-h)):o===Wh?(u=Math.max(0,a-l-d),s=c+f+h):o===Hh?(a=u+l+d,c=Math.max(0,s-f-h)):"pad"===o&&(a=u+l+d,s=c+f+h);e._resizeView(a,s,u,c,[l,f],r.resize)}(e,t,f,n)}(n,t,e)})),(i=e.mark.group)&&"legend-entry"!==i.mark.role?t.reflow():t;var i}});const zp=Object.freeze(Object.defineProperty({__proto__:null,bound:Qh,identifier:tp,mark:np,overlap:ip,render:cp,viewlayout:Bp},Symbol.toStringTag,{value:"Module"}));function Op(e){fr.call(this,null,e)}function Np(e){fr.call(this,null,e)}function Rp(){return Oi({})}function Tp(e){fr.call(this,null,e)}function Pp(e){fr.call(this,[],e)}t(Op,fr,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.scale,a=pu(o,null==e.count?e.values?e.values.length:10:e.count,e.minstep),s=e.format||yu(n,o,a,e.formatSpecifier,e.formatType,!!e.values),u=e.values?mu(o,e.values,a):gu(o,a);return r&&(i.rem=r),r=u.map(((e,t)=>Oi({index:t/(u.length-1||1),value:e,label:s(e)}))),e.extra&&r.length&&r.push(Oi({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}}),t(Np,fr,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||Rp,o=e.key||Bi,a=this.value;return f(i.encode)&&(i.encode=null),a&&(e.modified("key")||t.modified(o))&&d("DataJoin does not support modified key function or fields."),a||(t=t.addAll(),this.value=a=function(e){const t=T().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(o)),t.visit(t.ADD,(e=>{const t=o(e);let n=a.get(t);n?n.exit?(a.empty--,i.add.push(n)):i.mod.push(n):(n=r(e),a.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),t.visit(t.MOD,(e=>{const t=o(e),n=a.get(t);n&&(n.datum=e,i.mod.push(n))})),t.visit(t.REM,(e=>{const t=o(e),n=a.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++a.empty)})),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),i}}),t(Tp,fr,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(f(o)){if(!n.changed()&&!o.every((e=>r[e])))return t.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,s=r.update||oe,u=r.enter||oe,l=r.exit||oe,c=(o&&!a?r[o]:s)||oe;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{u(t,e),s(t,e)})),n.modifies(u.output),n.modifies(s.output),c!==oe&&c!==s&&(t.visit(t.ADD,(t=>{c(t,e)})),n.modifies(c.output))),t.changed(t.REM)&&l!==oe&&(t.visit(t.REM,(t=>{l(t,e)})),n.modifies(l.output)),a||c!==oe){const r=t.MOD|(e.modified()?t.REFLOW:0);a?(t.visit(r,(t=>{const r=u(t,e)||i;(c(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(u.output)):t.visit(r,(t=>{(c(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}}),t(Pp,fr,{transform(e,t){if(null!=this.value&&!e.modified())return t.StopPropagation;var n,i,r,o,u,l=t.dataflow.locale(),c=t.fork(t.NO_SOURCE|t.NO_FIELDS),f=this.value,d=e.type||cu,h=e.scale,p=+e.limit,m=pu(h,null==e.count?5:e.count,e.minstep),g=!!e.values||d===cu,y=e.format||_u(l,h,m,d,e.formatSpecifier,e.formatType,g),v=e.values||wu(h,m);return f&&(c.rem=f),d===cu?(p&&v.length>p?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),f=v.slice(0,p-1),u=!0):f=v,a(r=e.size)?(e.values||0!==h(f[0])||(f=f.slice(1)),o=f.reduce(((t,n)=>Math.max(t,r(n,e))),0)):r=s(o=r||8),f=f.map(((t,n)=>Oi({index:n,label:y(t,n,f),value:t,offset:o,size:r(t,e)}))),u&&(u=v[f.length],f.push(Oi({index:f.length,label:`…${v.length-f.length} entries`,value:u,offset:o,size:r(u,e)})))):"gradient"===d?(n=h.domain(),i=ru(h,n[0],S(n)),v.length<3&&!e.values&&n[0]!==S(n)&&(v=[n[0],S(n)]),f=v.map(((e,t)=>Oi({index:t,label:y(e,t,v),value:e,perc:i(e)})))):(r=v.length-1,i=function(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+S(t),o=r-i;if(e.type===Cs){const e=n?o/n:.1;i-=e,r+=e,o=r-i}return e=>(e-i)/o}(h),f=v.map(((e,t)=>Oi({index:t,label:y(e,t,v),value:e,perc:t?i(e):0,perc2:t===r?1:i(v[t+1])})))),c.source=f,c.add=f,this.value=f,c}});const jp=e=>e.source.x,Lp=e=>e.source.y,qp=e=>e.target.x,Up=e=>e.target.y;function Ip(e){fr.call(this,{},e)}Ip.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"}]},t(Ip,fr,{transform(e,t){var n=e.sourceX||jp,i=e.sourceY||Lp,r=e.targetX||qp,o=e.targetY||Up,a=e.as||"path",s=e.orient||"vertical",u=e.shape||"line",l=Vp.get(u+"-"+s)||Vp.get(u);return l||d("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[a]=l(n(e),i(e),r(e),o(e))})),t.reflow(e.modified()).modifies(a)}});const Wp=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,Hp=(e,t,n,i)=>{var r=n-e,o=i-t,a=Math.hypot(r,o)/2;return"M"+e+","+t+"A"+a+","+a+" "+180*Math.atan2(o,r)/Math.PI+" 0 1 "+n+","+i},Gp=(e,t,n,i)=>{const r=n-e,o=i-t,a=.2*(r+o),s=.2*(o-r);return"M"+e+","+t+"C"+(e+a)+","+(t+s)+" "+(n+s)+","+(i-a)+" "+n+","+i},Vp=T({line:Wp,"line-radial":(e,t,n,i)=>Wp(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),arc:Hp,"arc-radial":(e,t,n,i)=>Hp(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),curve:Gp,"curve-radial":(e,t,n,i)=>Gp(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),"orthogonal-horizontal":(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,"orthogonal-vertical":(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,"orthogonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n);return"M"+t*r+","+t*o+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*a+","+t*s+"L"+i*a+","+i*s},"diagonal-horizontal":(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},"diagonal-vertical":(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},"diagonal-radial":(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),a=Math.cos(n),s=Math.sin(n),u=(t+i)/2;return"M"+t*r+","+t*o+"C"+u*r+","+u*o+" "+u*a+","+u*s+" "+i*a+","+i*s}});function Yp(e){fr.call(this,null,e)}Yp.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"]}]},t(Yp,fr,{transform(e,t){var n,i,r,o=e.as||["startAngle","endAngle"],a=o[0],s=o[1],u=e.field||ae,l=e.startAngle||0,c=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,d=f.map(u),h=d.length,p=l,m=(c-l)/si(d),g=Ht(h);for(e.sort&&g.sort(((e,t)=>d[e]-d[t])),n=0;n<h;++n)r=d[g[n]],(i=f[g[n]])[a]=p,i[s]=p+=r*m;return this.value=d,t.reflow(e.modified()).modifies(o)}});function Xp(e){return Ys(e)&&e!==As}const Jp=ee(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function Kp(e){fr.call(this,null,e),this.modified(!0)}function Qp(e,t,n){Ks(e)&&(Math.abs(t.reduce(((e,t)=>e+(t<0?-1:t>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+fe(t)));return t}function Zp(e,t,n){return a(e)&&(t||n)?tu(e,em(t||[0,1],n)):e}function em(e,t){return t?e.slice().reverse():e}function tm(e){fr.call(this,null,e)}t(Kp,fr,{transform(e,t){var n=t.dataflow,i=this.value,r=function(e){var t,n=e.type,i="";if(n===As)return As+"-"+gs;(function(e){const t=e.type;return Ys(t)&&t!==ws&&t!==_s&&(e.scheme||e.range&&e.range.length&&e.range.every(ie))})(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?As+"-":3===t?ks+"-":"");return(i+n||gs).toLowerCase()}(e);for(r in i&&r===i.type||(this.value=i=Hs(r)()),e)if(!Jp[r]){if("padding"===r&&Xp(i.type))continue;a(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return function(e,t,n){var i=e.type,r=t.round||!1,o=t.range;if(null!=t.rangeStep)o=function(e,t,n){e!==Ss&&e!==$s&&d("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,r=e===$s?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*ms(n,r,i)]}(i,t,n);else if(t.scheme&&(o=function(e,t,n){var i,r=t.schemeExtent;f(t.scheme)?i=nu(t.scheme,t.interpolate,t.interpolateGamma):(i=lu(t.scheme.toLowerCase()))||d(`Unrecognized scheme name: ${t.scheme}`);return n=e===Cs?n+1:e===Ms?n-1:e===Ds||e===Fs?+t.schemeCount||5:n,Qs(e)?Zp(i,r,t.reverse):a(i)?iu(Zp(i,r),n):e===Es?i:i.slice(0,n)}(i,t,n),a(o))){if(e.interpolator)return e.interpolator(o);d(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&Qs(i))return e.interpolator(nu(em(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(ou(t.interpolate,t.interpolateGamma)):a(e.round)?e.round(r):a(e.rangeRound)&&e.interpolate(r?Nt:St);o&&e.range(em(o,t.reverse))}(i,e,function(e,t,n){let i=t.bins;if(i&&!f(i)){const t=e.domain(),n=t[0],r=S(t),o=i.step;let a=null==i.start?n:i.start,s=null==i.stop?r:i.stop;o||d("Scale bins parameter missing step property."),a<n&&(a=o*Math.ceil(n/o)),s>r&&(s=o*Math.floor(r/o)),i=Ht(a,s+o/2,o)}i?e.bins=i:e.bins&&delete e.bins;e.type===Ms&&(i?t.domain||t.domainRaw||(e.domain(i),n=i.length):e.bins=e.domain());return n}(i,e,function(e,t,n){const i=function(e,t,n){return t?(e.domain(Qp(e.type,t,n)),t.length):-1}(e,t.domainRaw,n);if(i>-1)return i;var r,o,a=t.domain,s=e.type,u=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===gs||t===vs||t===bs)}(e);if(!a)return 0;if((u||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(r=(a=a.slice()).length-1||1,u&&(a[0]>0&&(a[0]=0),a[r]<0&&(a[r]=0)),null!=t.domainMin&&(a[0]=t.domainMin),null!=t.domainMax&&(a[r]=t.domainMax),null!=t.domainMid)){const e=(o=t.domainMid)>a[r]?r+1:o<a[0]?0:r;e!==r&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(e,0,o)}Xp(s)&&t.padding&&a[0]!==S(a)&&(a=function(e,t,n,i,r,o){var a=Math.abs(S(n)-n[0]),s=a/(a-2*i),u=e===ys?se(t,null,s):e===bs?ue(t,null,s,.5):e===vs?ue(t,null,s,r||1):e===xs?le(t,null,s,o||1):ce(t,null,s);return t=t.slice(),t[0]=u[0],t[t.length-1]=u[1],t}(s,a,t.range,t.padding,t.exponent,t.constant));e.domain(Qp(s,a,n)),s===Es&&e.unknown(t.domainImplicit?_n:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&pu(e,t.nice)||null);return a.length}(i,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),t(tm,fr,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(Pi(e.sort)),this.modified(n),t}});const nm="zero",im="center",rm="normalize",om=["y0","y1"];function am(e){fr.call(this,null,e)}function sm(e,t,n,i,r){for(var o,a=(t-e.sum)/2,s=e.length,u=0;u<s;++u)(o=e[u])[i]=a,o[r]=a+=Math.abs(n(o))}function um(e,t,n,i,r){for(var o,a=1/e.sum,s=0,u=e.length,l=0,c=0;l<u;++l)(o=e[l])[i]=s,o[r]=s=a*(c+=Math.abs(n(o)))}function lm(e,t,n,i,r){for(var o,a,s=0,u=0,l=e.length,c=0;c<l;++c)(o=+n(a=e[c]))<0?(a[i]=u,a[r]=u+=o):(a[i]=s,a[r]=s+=o)}am.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:nm,values:[nm,im,rm]},{name:"as",type:"string",array:!0,length:2,default:om}]},t(am,fr,{transform(e,t){var n,i,r,o,a=e.as||om,s=a[0],u=a[1],l=Pi(e.sort),c=e.field||ae,f=e.offset===im?sm:e.offset===rm?um:lm;for(n=function(e,t,n,i){var r,o,a,s,u,l,c,f,d,h=[],p=e=>e(u);if(null==t)h.push(e.slice());else for(r={},o=0,a=e.length;o<a;++o)u=e[o],(c=r[l=t.map(p)])||(r[l]=c=[],h.push(c)),c.push(u);for(l=0,d=0,s=h.length;l<s;++l){for(o=0,f=0,a=(c=h[l]).length;o<a;++o)f+=Math.abs(i(c[o]));c.sum=f,f>d&&(d=f),n&&c.sort(n)}return h.max=d,h}(t.source,e.groupby,l,c),i=0,r=n.length,o=n.max;i<r;++i)f(n[i],o,c,s,u);return t.reflow(e.modified()).modifies(a)}});const cm=Object.freeze(Object.defineProperty({__proto__:null,axisticks:Op,datajoin:Np,encode:Tp,legendentries:Pp,linkpath:Ip,pie:Yp,scale:Kp,sortitems:tm,stack:am},Symbol.toStringTag,{value:"Module"}));var fm=1e-6,dm=1e-12,hm=Math.PI,pm=hm/2,mm=hm/4,gm=2*hm,ym=180/hm,vm=hm/180,bm=Math.abs,xm=Math.atan,wm=Math.atan2,_m=Math.cos,Am=Math.ceil,km=Math.exp,Dm=Math.hypot,Fm=Math.log,Cm=Math.pow,Em=Math.sin,$m=Math.sign||function(e){return e>0?1:e<0?-1:0},Sm=Math.sqrt,Mm=Math.tan;function Bm(e){return e>1?0:e<-1?hm:Math.acos(e)}function zm(e){return e>1?pm:e<-1?-pm:Math.asin(e)}function Om(){}function Nm(e,t){e&&Tm.hasOwnProperty(e.type)&&Tm[e.type](e,t)}var Rm={Feature:function(e,t){Nm(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i<r;)Nm(n[i].geometry,t)}},Tm={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)e=n[i],t.point(e[0],e[1],e[2])},LineString:function(e,t){Pm(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)Pm(n[i],t,0)},Polygon:function(e,t){jm(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)jm(n[i],t)},GeometryCollection:function(e,t){for(var n=e.geometries,i=-1,r=n.length;++i<r;)Nm(n[i],t)}};function Pm(e,t,n){var i,r=-1,o=e.length-n;for(t.lineStart();++r<o;)i=e[r],t.point(i[0],i[1],i[2]);t.lineEnd()}function jm(e,t){var n=-1,i=e.length;for(t.polygonStart();++n<i;)Pm(e[n],t,1);t.polygonEnd()}function Lm(e,t){e&&Rm.hasOwnProperty(e.type)?Rm[e.type](e,t):Nm(e,t)}var qm,Um,Im,Wm,Hm,Gm,Vm,Ym,Xm,Jm,Km,Qm,Zm,eg,tg,ng,ig=new Zn,rg=new Zn,og={point:Om,lineStart:Om,lineEnd:Om,polygonStart:function(){ig=new Zn,og.lineStart=ag,og.lineEnd=sg},polygonEnd:function(){var e=+ig;rg.add(e<0?gm+e:e),this.lineStart=this.lineEnd=this.point=Om},sphere:function(){rg.add(gm)}};function ag(){og.point=ug}function sg(){lg(qm,Um)}function ug(e,t){og.point=lg,qm=e,Um=t,Im=e*=vm,Wm=_m(t=(t*=vm)/2+mm),Hm=Em(t)}function lg(e,t){var n=(e*=vm)-Im,i=n>=0?1:-1,r=i*n,o=_m(t=(t*=vm)/2+mm),a=Em(t),s=Hm*a,u=Wm*o+s*_m(r),l=s*i*Em(r);ig.add(wm(l,u)),Im=e,Wm=o,Hm=a}function cg(e){return[wm(e[1],e[0]),zm(e[2])]}function fg(e){var t=e[0],n=e[1],i=_m(n);return[i*_m(t),i*Em(t),Em(n)]}function dg(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function hg(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function pg(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function mg(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function gg(e){var t=Sm(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var yg,vg,bg,xg,wg,_g,Ag,kg,Dg,Fg,Cg,Eg,$g,Sg,Mg,Bg,zg={point:Og,lineStart:Rg,lineEnd:Tg,polygonStart:function(){zg.point=Pg,zg.lineStart=jg,zg.lineEnd=Lg,eg=new Zn,og.polygonStart()},polygonEnd:function(){og.polygonEnd(),zg.point=Og,zg.lineStart=Rg,zg.lineEnd=Tg,ig<0?(Gm=-(Ym=180),Vm=-(Xm=90)):eg>fm?Xm=90:eg<-1e-6&&(Vm=-90),ng[0]=Gm,ng[1]=Ym},sphere:function(){Gm=-(Ym=180),Vm=-(Xm=90)}};function Og(e,t){tg.push(ng=[Gm=e,Ym=e]),t<Vm&&(Vm=t),t>Xm&&(Xm=t)}function Ng(e,t){var n=fg([e*vm,t*vm]);if(Zm){var i=hg(Zm,n),r=hg([i[1],-i[0],0],i);gg(r),r=cg(r);var o,a=e-Jm,s=a>0?1:-1,u=r[0]*ym*s,l=bm(a)>180;l^(s*Jm<u&&u<s*e)?(o=r[1]*ym)>Xm&&(Xm=o):l^(s*Jm<(u=(u+360)%360-180)&&u<s*e)?(o=-r[1]*ym)<Vm&&(Vm=o):(t<Vm&&(Vm=t),t>Xm&&(Xm=t)),l?e<Jm?qg(Gm,e)>qg(Gm,Ym)&&(Ym=e):qg(e,Ym)>qg(Gm,Ym)&&(Gm=e):Ym>=Gm?(e<Gm&&(Gm=e),e>Ym&&(Ym=e)):e>Jm?qg(Gm,e)>qg(Gm,Ym)&&(Ym=e):qg(e,Ym)>qg(Gm,Ym)&&(Gm=e)}else tg.push(ng=[Gm=e,Ym=e]);t<Vm&&(Vm=t),t>Xm&&(Xm=t),Zm=n,Jm=e}function Rg(){zg.point=Ng}function Tg(){ng[0]=Gm,ng[1]=Ym,zg.point=Og,Zm=null}function Pg(e,t){if(Zm){var n=e-Jm;eg.add(bm(n)>180?n+(n>0?360:-360):n)}else Km=e,Qm=t;og.point(e,t),Ng(e,t)}function jg(){og.lineStart()}function Lg(){Pg(Km,Qm),og.lineEnd(),bm(eg)>fm&&(Gm=-(Ym=180)),ng[0]=Gm,ng[1]=Ym,Zm=null}function qg(e,t){return(t-=e)<0?t+360:t}function Ug(e,t){return e[0]-t[0]}function Ig(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var Wg={sphere:Om,point:Hg,lineStart:Vg,lineEnd:Jg,polygonStart:function(){Wg.lineStart=Kg,Wg.lineEnd=Qg},polygonEnd:function(){Wg.lineStart=Vg,Wg.lineEnd=Jg}};function Hg(e,t){e*=vm;var n=_m(t*=vm);Gg(n*_m(e),n*Em(e),Em(t))}function Gg(e,t,n){++yg,bg+=(e-bg)/yg,xg+=(t-xg)/yg,wg+=(n-wg)/yg}function Vg(){Wg.point=Yg}function Yg(e,t){e*=vm;var n=_m(t*=vm);Sg=n*_m(e),Mg=n*Em(e),Bg=Em(t),Wg.point=Xg,Gg(Sg,Mg,Bg)}function Xg(e,t){e*=vm;var n=_m(t*=vm),i=n*_m(e),r=n*Em(e),o=Em(t),a=wm(Sm((a=Mg*o-Bg*r)*a+(a=Bg*i-Sg*o)*a+(a=Sg*r-Mg*i)*a),Sg*i+Mg*r+Bg*o);vg+=a,_g+=a*(Sg+(Sg=i)),Ag+=a*(Mg+(Mg=r)),kg+=a*(Bg+(Bg=o)),Gg(Sg,Mg,Bg)}function Jg(){Wg.point=Hg}function Kg(){Wg.point=Zg}function Qg(){ey(Eg,$g),Wg.point=Hg}function Zg(e,t){Eg=e,$g=t,e*=vm,t*=vm,Wg.point=ey;var n=_m(t);Sg=n*_m(e),Mg=n*Em(e),Bg=Em(t),Gg(Sg,Mg,Bg)}function ey(e,t){e*=vm;var n=_m(t*=vm),i=n*_m(e),r=n*Em(e),o=Em(t),a=Mg*o-Bg*r,s=Bg*i-Sg*o,u=Sg*r-Mg*i,l=Dm(a,s,u),c=zm(l),f=l&&-c/l;Dg.add(f*a),Fg.add(f*s),Cg.add(f*u),vg+=c,_g+=c*(Sg+(Sg=i)),Ag+=c*(Mg+(Mg=r)),kg+=c*(Bg+(Bg=o)),Gg(Sg,Mg,Bg)}function ty(e,t){function n(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,i){return(n=t.invert(n,i))&&e.invert(n[0],n[1])}),n}function ny(e,t){return bm(e)>hm&&(e-=Math.round(e/gm)*gm),[e,t]}function iy(e,t,n){return(e%=gm)?t||n?ty(oy(e),ay(t,n)):oy(e):t||n?ay(t,n):ny}function ry(e){return function(t,n){return bm(t+=e)>hm&&(t-=Math.round(t/gm)*gm),[t,n]}}function oy(e){var t=ry(e);return t.invert=ry(-e),t}function ay(e,t){var n=_m(e),i=Em(e),r=_m(t),o=Em(t);function a(e,t){var a=_m(t),s=_m(e)*a,u=Em(e)*a,l=Em(t),c=l*n+s*i;return[wm(u*r-c*o,s*n-l*i),zm(c*r+u*o)]}return a.invert=function(e,t){var a=_m(t),s=_m(e)*a,u=Em(e)*a,l=Em(t),c=l*r-u*o;return[wm(u*r+l*o,s*n+c*i),zm(c*n-s*i)]},a}function sy(e,t){(t=fg(t))[0]-=e,gg(t);var n=Bm(-t[1]);return((-t[2]<0?-n:n)+gm-fm)%gm}function uy(){var e,t=[];return{point:function(t,n,i){e.push([t,n,i])},lineStart:function(){t.push(e=[])},lineEnd:Om,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function ly(e,t){return bm(e[0]-t[0])<fm&&bm(e[1]-t[1])<fm}function cy(e,t,n,i){this.x=e,this.z=t,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function fy(e,t,n,i,r){var o,a,s=[],u=[];if(e.forEach((function(e){if(!((t=e.length-1)<=0)){var t,n,i=e[0],a=e[t];if(ly(i,a)){if(!i[2]&&!a[2]){for(r.lineStart(),o=0;o<t;++o)r.point((i=e[o])[0],i[1]);return void r.lineEnd()}a[0]+=2e-6}s.push(n=new cy(i,e,null,!0)),u.push(n.o=new cy(i,null,n,!1)),s.push(n=new cy(a,e,null,!1)),u.push(n.o=new cy(a,null,n,!0))}})),s.length){for(u.sort(t),dy(s),dy(u),o=0,a=u.length;o<a;++o)u[o].e=n=!n;for(var l,c,f=s[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;l=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,a=l.length;o<a;++o)r.point((c=l[o])[0],c[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(h)for(l=d.p.z,o=l.length-1;o>=0;--o)r.point((c=l[o])[0],c[1]);else i(d.x,d.p.x,-1,r);d=d.p}l=(d=d.o).z,h=!h}while(!d.v);r.lineEnd()}}}function dy(e){if(t=e.length){for(var t,n,i=0,r=e[0];++i<t;)r.n=n=e[i],n.p=r,r=n;r.n=n=e[0],n.p=r}}function hy(e){return bm(e[0])<=hm?e[0]:$m(e[0])*((bm(e[0])+hm)%gm-hm)}function py(e,t,n,i){return function(r){var o,a,s,u=t(r),l=uy(),c=t(l),f=!1,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=v,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,a=ai(a);var e=function(e,t){var n=hy(t),i=t[1],r=Em(i),o=[Em(n),-_m(n),0],a=0,s=0,u=new Zn;1===r?i=pm+fm:-1===r&&(i=-pm-fm);for(var l=0,c=e.length;l<c;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=hy(h),m=h[1]/2+mm,g=Em(m),y=_m(m),v=0;v<d;++v,p=x,g=_,y=A,h=b){var b=f[v],x=hy(b),w=b[1]/2+mm,_=Em(w),A=_m(w),k=x-p,D=k>=0?1:-1,F=D*k,C=F>hm,E=g*_;if(u.add(wm(E*D*Em(F),y*A+E*_m(F))),a+=C?k+D*gm:k,C^p>=n^x>=n){var $=hg(fg(h),fg(b));gg($);var S=hg(o,$);gg(S);var M=(C^k>=0?-1:1)*zm(S[2]);(i>M||i===M&&($[0]||$[1]))&&(s+=C^k>=0?1:-1)}}return(a<-1e-6||a<fm&&u<-1e-12)^1&s}(o,i);a.length?(f||(r.polygonStart(),f=!0),fy(a,gy,e,n,r)):e&&(f||(r.polygonStart(),f=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),f&&(r.polygonEnd(),f=!1),a=o=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function h(t,n){e(t,n)&&r.point(t,n)}function p(e,t){u.point(e,t)}function m(){d.point=p,u.lineStart()}function g(){d.point=h,u.lineEnd()}function y(e,t){s.push([e,t]),c.point(e,t)}function v(){c.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),c.lineEnd();var e,t,n,i,u=c.clean(),d=l.result(),h=d.length;if(s.pop(),o.push(s),s=null,h)if(1&u){if((t=(n=d[0]).length-1)>0){for(f||(r.polygonStart(),f=!0),r.lineStart(),e=0;e<t;++e)r.point((i=n[e])[0],i[1]);r.lineEnd()}}else h>1&&2&u&&d.push(d.pop().concat(d.shift())),a.push(d.filter(my))}return d}}function my(e){return e.length>1}function gy(e,t){return((e=e.x)[0]<0?e[1]-pm-fm:pm-e[1])-((t=t.x)[0]<0?t[1]-pm-fm:pm-t[1])}ny.invert=ny;const yy=py((function(){return!0}),(function(e){var t,n=NaN,i=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var s=o>0?hm:-hm,u=bm(o-n);bm(u-hm)<fm?(e.point(n,i=(i+a)/2>0?pm:-pm),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),e.point(o,i),t=0):r!==s&&u>=hm&&(bm(n-r)<fm&&(n-=r*fm),bm(o-s)<fm&&(o-=s*fm),i=function(e,t,n,i){var r,o,a=Em(e-n);return bm(a)>fm?xm((Em(t)*(o=_m(i))*Em(n)-Em(i)*(r=_m(t))*Em(e))/(r*o*a)):(t+i)/2}(n,i,o,a),e.point(r,i),e.lineEnd(),e.lineStart(),e.point(s,i),t=0),e.point(n=o,i=a),r=s},lineEnd:function(){e.lineEnd(),n=i=NaN},clean:function(){return 2-t}}}),(function(e,t,n,i){var r;if(null==e)r=n*pm,i.point(-hm,r),i.point(0,r),i.point(hm,r),i.point(hm,0),i.point(hm,-r),i.point(0,-r),i.point(-hm,-r),i.point(-hm,0),i.point(-hm,r);else if(bm(e[0]-t[0])>fm){var o=e[0]<t[0]?hm:-hm;r=n*o/2,i.point(-o,r),i.point(0,r),i.point(o,r)}else i.point(t[0],t[1])}),[-hm,-pm]);function vy(e){var t=_m(e),n=2*vm,i=t>0,r=bm(t)>fm;function o(e,n){return _m(e)*_m(n)>t}function a(e,n,i){var r=[1,0,0],o=hg(fg(e),fg(n)),a=dg(o,o),s=o[0],u=a-s*s;if(!u)return!i&&e;var l=t*a/u,c=-t*s/u,f=hg(r,o),d=mg(r,l);pg(d,mg(o,c));var h=f,p=dg(d,h),m=dg(h,h),g=p*p-m*(dg(d,d)-1);if(!(g<0)){var y=Sm(g),v=mg(h,(-p-y)/m);if(pg(v,d),v=cg(v),!i)return v;var b,x=e[0],w=n[0],_=e[1],A=n[1];w<x&&(b=x,x=w,w=b);var k=w-x,D=bm(k-hm)<fm;if(!D&&A<_&&(b=_,_=A,A=b),D||k<fm?D?_+A>0^v[1]<(bm(v[0]-x)<fm?_:A):_<=v[1]&&v[1]<=A:k>hm^(x<=v[0]&&v[0]<=w)){var F=mg(h,(-p+y)/m);return pg(F,d),[v,cg(F)]}}}function s(t,n){var r=i?e:hm-e,o=0;return t<-r?o|=1:t>r&&(o|=2),n<-r?o|=4:n>r&&(o|=8),o}return py(o,(function(e){var t,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(f,d){var h,p=[f,d],m=o(f,d),g=i?m?0:s(f,d):m?s(f+(f<0?hm:-hm),d):0;if(!t&&(l=u=m)&&e.lineStart(),m!==u&&(!(h=a(t,p))||ly(t,h)||ly(p,h))&&(p[2]=1),m!==u)c=0,m?(e.lineStart(),h=a(p,t),e.point(h[0],h[1])):(h=a(t,p),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(r&&t&&i^m){var y;g&n||!(y=a(p,t,!0))||(c=0,i?(e.lineStart(),e.point(y[0][0],y[0][1]),e.point(y[1][0],y[1][1]),e.lineEnd()):(e.point(y[1][0],y[1][1]),e.lineEnd(),e.lineStart(),e.point(y[0][0],y[0][1],3)))}!m||t&&ly(t,p)||e.point(p[0],p[1]),t=p,u=m,n=g},lineEnd:function(){u&&e.lineEnd(),t=null},clean:function(){return c|(l&&u)<<1}}}),(function(t,i,r,o){!function(e,t,n,i,r,o){if(n){var a=_m(t),s=Em(t),u=i*n;null==r?(r=t+i*gm,o=t-u/2):(r=sy(a,r),o=sy(a,o),(i>0?r<o:r>o)&&(r+=i*gm));for(var l,c=r;i>0?c>o:c<o;c-=u)l=cg([a,-s*_m(c),-s*Em(c)]),e.point(l[0],l[1])}}(o,e,n,r,t,i)}),i?[0,-e]:[-hm,e-hm])}var by=1e9,xy=-1e9;function wy(e,t,n,i){function r(r,o){return e<=r&&r<=n&&t<=o&&o<=i}function o(r,o,s,l){var c=0,f=0;if(null==r||(c=a(r,s))!==(f=a(o,s))||u(r,o)<0^s>0)do{l.point(0===c||3===c?e:n,c>1?i:t)}while((c=(c+s+4)%4)!==f);else l.point(o[0],o[1])}function a(i,r){return bm(i[0]-e)<fm?r>0?0:3:bm(i[0]-n)<fm?r>0?2:1:bm(i[1]-t)<fm?r>0?1:0:r>0?3:2}function s(e,t){return u(e.x,t.x)}function u(e,t){var n=a(e,1),i=a(t,1);return n!==i?n-i:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var u,l,c,f,d,h,p,m,g,y,v,b=a,x=uy(),w={point:_,lineStart:function(){w.point=A,l&&l.push(c=[]);y=!0,g=!1,p=m=NaN},lineEnd:function(){u&&(A(f,d),h&&g&&x.rejoin(),u.push(x.result()));w.point=_,g&&b.lineEnd()},polygonStart:function(){b=x,u=[],l=[],v=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,r=l.length;n<r;++n)for(var o,a,s=l[n],u=1,c=s.length,f=s[0],d=f[0],h=f[1];u<c;++u)o=d,a=h,d=(f=s[u])[0],h=f[1],a<=i?h>i&&(d-o)*(i-a)>(h-a)*(e-o)&&++t:h<=i&&(d-o)*(i-a)<(h-a)*(e-o)&&--t;return t}(),n=v&&t,r=(u=ai(u)).length;(n||r)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),r&&fy(u,s,t,o,a),a.polygonEnd());b=a,u=l=c=null}};function _(e,t){r(e,t)&&b.point(e,t)}function A(o,a){var s=r(o,a);if(l&&c.push([o,a]),y)f=o,d=a,h=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&g)b.point(o,a);else{var u=[p=Math.max(xy,Math.min(by,p)),m=Math.max(xy,Math.min(by,m))],x=[o=Math.max(xy,Math.min(by,o)),a=Math.max(xy,Math.min(by,a))];!function(e,t,n,i,r,o){var a,s=e[0],u=e[1],l=0,c=1,f=t[0]-s,d=t[1]-u;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a<l)return;a<c&&(c=a)}else if(f>0){if(a>c)return;a>l&&(l=a)}if(a=r-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a<l)return;a<c&&(c=a)}if(a=i-u,d||!(a>0)){if(a/=d,d<0){if(a<l)return;a<c&&(c=a)}else if(d>0){if(a>c)return;a>l&&(l=a)}if(a=o-u,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>l&&(l=a)}else if(d>0){if(a<l)return;a<c&&(c=a)}return l>0&&(e[0]=s+l*f,e[1]=u+l*d),c<1&&(t[0]=s+c*f,t[1]=u+c*d),!0}}}}}(u,x,e,t,n,i)?s&&(b.lineStart(),b.point(o,a),v=!1):(g||(b.lineStart(),b.point(u[0],u[1])),b.point(x[0],x[1]),s||b.lineEnd(),v=!1)}p=o,m=a,g=s}return w}}function _y(e,t,n){var i=Ht(e,t-fm,n).concat(t);return function(e){return i.map((function(t){return[e,t]}))}}function Ay(e,t,n){var i=Ht(e,t-fm,n).concat(t);return function(e){return i.map((function(t){return[t,e]}))}}const ky=e=>e;var Dy,Fy,Cy,Ey,$y=new Zn,Sy=new Zn,My={point:Om,lineStart:Om,lineEnd:Om,polygonStart:function(){My.lineStart=By,My.lineEnd=Ny},polygonEnd:function(){My.lineStart=My.lineEnd=My.point=Om,$y.add(bm(Sy)),Sy=new Zn},result:function(){var e=$y/2;return $y=new Zn,e}};function By(){My.point=zy}function zy(e,t){My.point=Oy,Dy=Cy=e,Fy=Ey=t}function Oy(e,t){Sy.add(Ey*e-Cy*t),Cy=e,Ey=t}function Ny(){Oy(Dy,Fy)}var Ry=1/0,Ty=Ry,Py=-Ry,jy=Py,Ly={point:function(e,t){e<Ry&&(Ry=e);e>Py&&(Py=e);t<Ty&&(Ty=t);t>jy&&(jy=t)},lineStart:Om,lineEnd:Om,polygonStart:Om,polygonEnd:Om,result:function(){var e=[[Ry,Ty],[Py,jy]];return Py=jy=-(Ty=Ry=1/0),e}};var qy,Uy,Iy,Wy,Hy=0,Gy=0,Vy=0,Yy=0,Xy=0,Jy=0,Ky=0,Qy=0,Zy=0,ev={point:tv,lineStart:nv,lineEnd:ov,polygonStart:function(){ev.lineStart=av,ev.lineEnd=sv},polygonEnd:function(){ev.point=tv,ev.lineStart=nv,ev.lineEnd=ov},result:function(){var e=Zy?[Ky/Zy,Qy/Zy]:Jy?[Yy/Jy,Xy/Jy]:Vy?[Hy/Vy,Gy/Vy]:[NaN,NaN];return Hy=Gy=Vy=Yy=Xy=Jy=Ky=Qy=Zy=0,e}};function tv(e,t){Hy+=e,Gy+=t,++Vy}function nv(){ev.point=iv}function iv(e,t){ev.point=rv,tv(Iy=e,Wy=t)}function rv(e,t){var n=e-Iy,i=t-Wy,r=Sm(n*n+i*i);Yy+=r*(Iy+e)/2,Xy+=r*(Wy+t)/2,Jy+=r,tv(Iy=e,Wy=t)}function ov(){ev.point=tv}function av(){ev.point=uv}function sv(){lv(qy,Uy)}function uv(e,t){ev.point=lv,tv(qy=Iy=e,Uy=Wy=t)}function lv(e,t){var n=e-Iy,i=t-Wy,r=Sm(n*n+i*i);Yy+=r*(Iy+e)/2,Xy+=r*(Wy+t)/2,Jy+=r,Ky+=(r=Wy*e-Iy*t)*(Iy+e),Qy+=r*(Wy+t),Zy+=3*r,tv(Iy=e,Wy=t)}function cv(e){this._context=e}cv.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,gm)}},result:Om};var fv,dv,hv,pv,mv,gv=new Zn,yv={point:Om,lineStart:function(){yv.point=vv},lineEnd:function(){fv&&bv(dv,hv),yv.point=Om},polygonStart:function(){fv=!0},polygonEnd:function(){fv=null},result:function(){var e=+gv;return gv=new Zn,e}};function vv(e,t){yv.point=bv,dv=pv=e,hv=mv=t}function bv(e,t){pv-=e,mv-=t,gv.add(Sm(pv*pv+mv*mv)),pv=e,mv=t}let xv,wv,_v,Av;class kv{constructor(e){this._append=null==e?Dv:function(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Dv;if(t!==xv){const e=10**t;xv=t,wv=function(t){let n=1;this._+=t[0];for(const i=t.length;n<i;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return wv}(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==_v||this._append!==wv){const e=this._radius,t=this._;this._="",this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,_v=e,wv=this._append,Av=this._,this._=t}this._+=Av}}result(){const e=this._;return this._="",e.length?e:null}}function Dv(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Fv(e,t){let n,i,r=3,o=4.5;function a(e){return e&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),Lm(e,n(i))),i.result()}return a.area=function(e){return Lm(e,n(My)),My.result()},a.measure=function(e){return Lm(e,n(yv)),yv.result()},a.bounds=function(e){return Lm(e,n(Ly)),Ly.result()},a.centroid=function(e){return Lm(e,n(ev)),ev.result()},a.projection=function(t){return arguments.length?(n=null==t?(e=null,ky):(e=t).stream,a):e},a.context=function(e){return arguments.length?(i=null==e?(t=null,new kv(r)):new cv(t=e),"function"!=typeof o&&i.pointRadius(o),a):t},a.pointRadius=function(e){return arguments.length?(o="function"==typeof e?e:(i.pointRadius(+e),+e),a):o},a.digits=function(e){if(!arguments.length)return r;if(null==e)r=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);r=t}return null===t&&(i=new kv(r)),a},a.projection(e).digits(r).context(t)}function Cv(e){return function(t){var n=new Ev;for(var i in e)n[i]=e[i];return n.stream=t,n}}function Ev(){}function $v(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=i&&e.clipExtent(null),Lm(n,e.stream(Ly)),t(Ly.result()),null!=i&&e.clipExtent(i),e}function Sv(e,t,n){return $v(e,(function(n){var i=t[1][0]-t[0][0],r=t[1][1]-t[0][1],o=Math.min(i/(n[1][0]-n[0][0]),r/(n[1][1]-n[0][1])),a=+t[0][0]+(i-o*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(r-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,s])}),n)}function Mv(e,t,n){return Sv(e,[[0,0],t],n)}function Bv(e,t,n){return $v(e,(function(n){var i=+t,r=i/(n[1][0]-n[0][0]),o=(i-r*(n[1][0]+n[0][0]))/2,a=-r*n[0][1];e.scale(150*r).translate([o,a])}),n)}function zv(e,t,n){return $v(e,(function(n){var i=+t,r=i/(n[1][1]-n[0][1]),o=-r*n[0][0],a=(i-r*(n[1][1]+n[0][1]))/2;e.scale(150*r).translate([o,a])}),n)}Ev.prototype={constructor:Ev,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Ov=_m(30*vm);function Nv(e,t){return+t?function(e,t){function n(i,r,o,a,s,u,l,c,f,d,h,p,m,g){var y=l-i,v=c-r,b=y*y+v*v;if(b>4*t&&m--){var x=a+d,w=s+h,_=u+p,A=Sm(x*x+w*w+_*_),k=zm(_/=A),D=bm(bm(_)-1)<fm||bm(o-f)<fm?(o+f)/2:wm(w,x),F=e(D,k),C=F[0],E=F[1],$=C-i,S=E-r,M=v*$-y*S;(M*M/b>t||bm((y*$+v*S)/b-.5)>.3||a*d+s*h+u*p<Ov)&&(n(i,r,o,a,s,u,C,E,D,x/=A,w/=A,_,m,g),g.point(C,E),n(C,E,D,x,w,_,l,c,f,d,h,p,m,g))}}return function(t){var i,r,o,a,s,u,l,c,f,d,h,p,m={point:g,lineStart:y,lineEnd:b,polygonStart:function(){t.polygonStart(),m.lineStart=x},polygonEnd:function(){t.polygonEnd(),m.lineStart=y}};function g(n,i){n=e(n,i),t.point(n[0],n[1])}function y(){c=NaN,m.point=v,t.lineStart()}function v(i,r){var o=fg([i,r]),a=e(i,r);n(c,f,l,d,h,p,c=a[0],f=a[1],l=i,d=o[0],h=o[1],p=o[2],16,t),t.point(c,f)}function b(){m.point=g,t.lineEnd()}function x(){y(),m.point=w,m.lineEnd=_}function w(e,t){v(i=e,t),r=c,o=f,a=d,s=h,u=p,m.point=v}function _(){n(c,f,l,d,h,p,r,o,i,a,s,u,16,t),m.lineEnd=b,b()}return m}}(e,t):function(e){return Cv({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}(e)}var Rv=Cv({point:function(e,t){this.stream.point(e*vm,t*vm)}});function Tv(e,t,n,i,r,o){if(!o)return function(e,t,n,i,r){function o(o,a){return[t+e*(o*=i),n-e*(a*=r)]}return o.invert=function(o,a){return[(o-t)/e*i,(n-a)/e*r]},o}(e,t,n,i,r);var a=_m(o),s=Em(o),u=a*e,l=s*e,c=a/e,f=s/e,d=(s*n-a*t)/e,h=(s*t+a*n)/e;function p(e,o){return[u*(e*=i)-l*(o*=r)+t,n-l*e-u*o]}return p.invert=function(e,t){return[i*(c*e-f*t+d),r*(h-f*e-c*t)]},p}function Pv(e){return jv((function(){return e}))()}function jv(e){var t,n,i,r,o,a,s,u,l,c,f=150,d=480,h=250,p=0,m=0,g=0,y=0,v=0,b=0,x=1,w=1,_=null,A=yy,k=null,D=ky,F=.5;function C(e){return u(e[0]*vm,e[1]*vm)}function E(e){return(e=u.invert(e[0],e[1]))&&[e[0]*ym,e[1]*ym]}function $(){var e=Tv(f,0,0,x,w,b).apply(null,t(p,m)),i=Tv(f,d-e[0],h-e[1],x,w,b);return n=iy(g,y,v),s=ty(t,i),u=ty(n,s),a=Nv(s,F),S()}function S(){return l=c=null,C}return C.stream=function(e){return l&&c===e?l:l=Rv(function(e){return Cv({point:function(t,n){var i=e(t,n);return this.stream.point(i[0],i[1])}})}(n)(A(a(D(c=e)))))},C.preclip=function(e){return arguments.length?(A=e,_=void 0,S()):A},C.postclip=function(e){return arguments.length?(D=e,k=i=r=o=null,S()):D},C.clipAngle=function(e){return arguments.length?(A=+e?vy(_=e*vm):(_=null,yy),S()):_*ym},C.clipExtent=function(e){return arguments.length?(D=null==e?(k=i=r=o=null,ky):wy(k=+e[0][0],i=+e[0][1],r=+e[1][0],o=+e[1][1]),S()):null==k?null:[[k,i],[r,o]]},C.scale=function(e){return arguments.length?(f=+e,$()):f},C.translate=function(e){return arguments.length?(d=+e[0],h=+e[1],$()):[d,h]},C.center=function(e){return arguments.length?(p=e[0]%360*vm,m=e[1]%360*vm,$()):[p*ym,m*ym]},C.rotate=function(e){return arguments.length?(g=e[0]%360*vm,y=e[1]%360*vm,v=e.length>2?e[2]%360*vm:0,$()):[g*ym,y*ym,v*ym]},C.angle=function(e){return arguments.length?(b=e%360*vm,$()):b*ym},C.reflectX=function(e){return arguments.length?(x=e?-1:1,$()):x<0},C.reflectY=function(e){return arguments.length?(w=e?-1:1,$()):w<0},C.precision=function(e){return arguments.length?(a=Nv(s,F=e*e),S()):Sm(F)},C.fitExtent=function(e,t){return Sv(C,e,t)},C.fitSize=function(e,t){return Mv(C,e,t)},C.fitWidth=function(e,t){return Bv(C,e,t)},C.fitHeight=function(e,t){return zv(C,e,t)},function(){return t=e.apply(this,arguments),C.invert=t.invert&&E,$()}}function Lv(e){var t=0,n=hm/3,i=jv(e),r=i(t,n);return r.parallels=function(e){return arguments.length?i(t=e[0]*vm,n=e[1]*vm):[t*ym,n*ym]},r}function qv(e,t){var n=Em(e),i=(n+Em(t))/2;if(bm(i)<fm)return function(e){var t=_m(e);function n(e,n){return[e*t,Em(n)/t]}return n.invert=function(e,n){return[e/t,zm(n*t)]},n}(e);var r=1+n*(2*i-n),o=Sm(r)/i;function a(e,t){var n=Sm(r-2*i*Em(t))/i;return[n*Em(e*=i),o-n*_m(e)]}return a.invert=function(e,t){var n=o-t,a=wm(e,bm(n))*$m(n);return n*i<0&&(a-=hm*$m(e)*$m(n)),[a/i,zm((r-(e*e+n*n)*i*i)/(2*i))]},a}function Uv(){return Lv(qv).scale(155.424).center([0,33.6442])}function Iv(){return Uv().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Wv(e){return function(t,n){var i=_m(t),r=_m(n),o=e(i*r);return o===1/0?[2,0]:[o*r*Em(t),o*Em(n)]}}function Hv(e){return function(t,n){var i=Sm(t*t+n*n),r=e(i),o=Em(r),a=_m(r);return[wm(t*o,i*a),zm(i&&n*o/i)]}}var Gv=Wv((function(e){return Sm(2/(1+e))}));Gv.invert=Hv((function(e){return 2*zm(e/2)}));var Vv=Wv((function(e){return(e=Bm(e))&&e/Em(e)}));function Yv(e,t){return[e,Fm(Mm((pm+t)/2))]}function Xv(e){var t,n,i,r=Pv(e),o=r.center,a=r.scale,s=r.translate,u=r.clipExtent,l=null;function c(){var o=hm*a(),s=r(function(e){function t(t){return(t=e(t[0]*vm,t[1]*vm))[0]*=ym,t[1]*=ym,t}return e=iy(e[0]*vm,e[1]*vm,e.length>2?e[2]*vm:0),t.invert=function(t){return(t=e.invert(t[0]*vm,t[1]*vm))[0]*=ym,t[1]*=ym,t},t}(r.rotate()).invert([0,0]));return u(null==l?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:e===Yv?[[Math.max(s[0]-o,l),t],[Math.min(s[0]+o,n),i]]:[[l,Math.max(s[1]-o,t)],[n,Math.min(s[1]+o,i)]])}return r.scale=function(e){return arguments.length?(a(e),c()):a()},r.translate=function(e){return arguments.length?(s(e),c()):s()},r.center=function(e){return arguments.length?(o(e),c()):o()},r.clipExtent=function(e){return arguments.length?(null==e?l=t=n=i=null:(l=+e[0][0],t=+e[0][1],n=+e[1][0],i=+e[1][1]),c()):null==l?null:[[l,t],[n,i]]},c()}function Jv(e){return Mm((pm+e)/2)}function Kv(e,t){var n=_m(e),i=e===t?Em(e):Fm(n/_m(t))/Fm(Jv(t)/Jv(e)),r=n*Cm(Jv(e),i)/i;if(!i)return Yv;function o(e,t){r>0?t<-pm+fm&&(t=-pm+fm):t>pm-fm&&(t=pm-fm);var n=r/Cm(Jv(t),i);return[n*Em(i*e),r-n*_m(i*e)]}return o.invert=function(e,t){var n=r-t,o=$m(i)*Sm(e*e+n*n),a=wm(e,bm(n))*$m(n);return n*i<0&&(a-=hm*$m(e)*$m(n)),[a/i,2*xm(Cm(r/o,1/i))-pm]},o}function Qv(e,t){return[e,t]}function Zv(e,t){var n=_m(e),i=e===t?Em(e):(n-_m(t))/(t-e),r=n/i+e;if(bm(i)<fm)return Qv;function o(e,t){var n=r-t,o=i*e;return[n*Em(o),r-n*_m(o)]}return o.invert=function(e,t){var n=r-t,o=wm(e,bm(n))*$m(n);return n*i<0&&(o-=hm*$m(e)*$m(n)),[o/i,r-$m(i)*Sm(e*e+n*n)]},o}Vv.invert=Hv((function(e){return e})),Yv.invert=function(e,t){return[e,2*xm(km(t))-pm]},Qv.invert=Qv;var eb=1.340264,tb=-.081106,nb=893e-6,ib=.003796,rb=Sm(3)/2;function ob(e,t){var n=zm(rb*Em(t)),i=n*n,r=i*i*i;return[e*_m(n)/(rb*(eb+3*tb*i+r*(7*nb+9*ib*i))),n*(eb+tb*i+r*(nb+ib*i))]}function ab(e,t){var n=_m(t),i=_m(e)*n;return[n*Em(e)/i,Em(t)/i]}function sb(e,t){var n=t*t,i=n*n;return[e*(.8707-.131979*n+i*(i*(.003971*n-.001529*i)-.013791)),t*(1.007226+n*(.015085+i*(.028874*n-.044475-.005916*i)))]}function ub(e,t){return[_m(t)*Em(e),Em(t)]}function lb(e,t){var n=_m(t),i=1+_m(e)*n;return[n*Em(e)/i,Em(t)/i]}function cb(e,t){return[Fm(Mm((pm+t)/2)),-e]}ob.invert=function(e,t){for(var n,i=t,r=i*i,o=r*r*r,a=0;a<12&&(o=(r=(i-=n=(i*(eb+tb*r+o*(nb+ib*r))-t)/(eb+3*tb*r+o*(7*nb+9*ib*r)))*i)*r*r,!(bm(n)<dm));++a);return[rb*e*(eb+3*tb*r+o*(7*nb+9*ib*r))/_m(i),zm(Em(i)/rb)]},ab.invert=Hv(xm),sb.invert=function(e,t){var n,i=t,r=25;do{var o=i*i,a=o*o;i-=n=(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-t)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(bm(n)>fm&&--r>0);return[e/(.8707+(o=i*i)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),i]},ub.invert=Hv(zm),lb.invert=Hv((function(e){return 2*xm(e)})),cb.invert=function(e,t){return[-t,2*xm(km(e))-pm]};var fb,db=Math.abs,hb=Math.cos,pb=Math.sin,mb=Math.PI,gb=mb/2,yb=(fb=2)>0?Math.sqrt(fb):0;function vb(e){return e>1?gb:e<-1?-gb:Math.asin(e)}function bb(e,t){var n,i=e*pb(t),r=30;do{t-=n=(t+pb(t)-i)/(1+hb(t))}while(db(n)>1e-6&&--r>0);return t/2}var xb=function(e,t,n){function i(i,r){return[e*i*hb(r=bb(n,r)),t*pb(r)]}return i.invert=function(i,r){return r=vb(r/t),[i/(e*hb(r)),vb((2*r+pb(2*r))/n)]},i}(yb/gb,yb,mb);const wb=Fv(),_b=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ab(e,t){if(!e||"string"!=typeof e)throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Db[e]=function(e,t){return function n(){const i=t();return i.type=e,i.path=Fv().projection(i),i.copy=i.copy||function(){const e=n();return _b.forEach((t=>{i[t]&&e[t](i[t]())})),e.path.pointRadius(i.path.pointRadius()),e},Is(i)}}(e,t),this):Db[e]||null}function kb(e){return e&&e.path||wb}const Db={albers:Iv,albersusa:function(){var e,t,n,i,r,o,a=Iv(),s=Uv().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=Uv().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(e,t){o=[e,t]}};function c(e){var t=e[0],a=e[1];return o=null,n.point(t,a),o||(i.point(t,a),o)||(r.point(t,a),o)}function f(){return e=t=null,c}return c.invert=function(e){var t=a.scale(),n=a.translate(),i=(e[0]-n[0])/t,r=(e[1]-n[1])/t;return(r>=.12&&r<.234&&i>=-.425&&i<-.214?s:r>=.166&&r<.234&&i>=-.214&&i<-.115?u:a).invert(e)},c.stream=function(n){return e&&t===n?e:(i=[a.stream(t=n),s.stream(n),u.stream(n)],r=i.length,e={point:function(e,t){for(var n=-1;++n<r;)i[n].point(e,t)},sphere:function(){for(var e=-1;++e<r;)i[e].sphere()},lineStart:function(){for(var e=-1;++e<r;)i[e].lineStart()},lineEnd:function(){for(var e=-1;++e<r;)i[e].lineEnd()},polygonStart:function(){for(var e=-1;++e<r;)i[e].polygonStart()},polygonEnd:function(){for(var e=-1;++e<r;)i[e].polygonEnd()}});var i,r},c.precision=function(e){return arguments.length?(a.precision(e),s.precision(e),u.precision(e),f()):a.precision()},c.scale=function(e){return arguments.length?(a.scale(e),s.scale(.35*e),u.scale(e),c.translate(a.translate())):a.scale()},c.translate=function(e){if(!arguments.length)return a.translate();var t=a.scale(),o=+e[0],c=+e[1];return n=a.translate(e).clipExtent([[o-.455*t,c-.238*t],[o+.455*t,c+.238*t]]).stream(l),i=s.translate([o-.307*t,c+.201*t]).clipExtent([[o-.425*t+fm,c+.12*t+fm],[o-.214*t-fm,c+.234*t-fm]]).stream(l),r=u.translate([o-.205*t,c+.212*t]).clipExtent([[o-.214*t+fm,c+.166*t+fm],[o-.115*t-fm,c+.234*t-fm]]).stream(l),f()},c.fitExtent=function(e,t){return Sv(c,e,t)},c.fitSize=function(e,t){return Mv(c,e,t)},c.fitWidth=function(e,t){return Bv(c,e,t)},c.fitHeight=function(e,t){return zv(c,e,t)},c.scale(1070)},azimuthalequalarea:function(){return Pv(Gv).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return Pv(Vv).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return Lv(Kv).scale(109.5).parallels([30,30])},conicequalarea:Uv,conicequidistant:function(){return Lv(Zv).scale(131.154).center([0,13.9389])},equalEarth:function(){return Pv(ob).scale(177.158)},equirectangular:function(){return Pv(Qv).scale(152.63)},gnomonic:function(){return Pv(ab).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,i,r,o,a,s=1,u=0,l=0,c=1,f=1,d=0,h=null,p=1,m=1,g=Cv({point:function(e,t){var n=b([e,t]);this.stream.point(n[0],n[1])}}),y=ky;function v(){return p=s*c,m=s*f,o=a=null,b}function b(n){var i=n[0]*p,r=n[1]*m;if(d){var o=r*e-i*t;i=i*e+r*t,r=o}return[i+u,r+l]}return b.invert=function(n){var i=n[0]-u,r=n[1]-l;if(d){var o=r*e+i*t;i=i*e-r*t,r=o}return[i/p,r/m]},b.stream=function(e){return o&&a===e?o:o=g(y(a=e))},b.postclip=function(e){return arguments.length?(y=e,h=n=i=r=null,v()):y},b.clipExtent=function(e){return arguments.length?(y=null==e?(h=n=i=r=null,ky):wy(h=+e[0][0],n=+e[0][1],i=+e[1][0],r=+e[1][1]),v()):null==h?null:[[h,n],[i,r]]},b.scale=function(e){return arguments.length?(s=+e,v()):s},b.translate=function(e){return arguments.length?(u=+e[0],l=+e[1],v()):[u,l]},b.angle=function(n){return arguments.length?(t=Em(d=n%360*vm),e=_m(d),v()):d*ym},b.reflectX=function(e){return arguments.length?(c=e?-1:1,v()):c<0},b.reflectY=function(e){return arguments.length?(f=e?-1:1,v()):f<0},b.fitExtent=function(e,t){return Sv(b,e,t)},b.fitSize=function(e,t){return Mv(b,e,t)},b.fitWidth=function(e,t){return Bv(b,e,t)},b.fitHeight=function(e,t){return zv(b,e,t)},b},mercator:function(){return Xv(Yv).scale(961/gm)},mollweide:function(){return Pv(xb).scale(169.529)},naturalEarth1:function(){return Pv(sb).scale(175.295)},orthographic:function(){return Pv(ub).scale(249.5).clipAngle(90.000001)},stereographic:function(){return Pv(lb).scale(250).clipAngle(142)},transversemercator:function(){var e=Xv(cb),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)}};for(const KV in Db)Ab(KV,Db[KV]);function Fb(){}const Cb=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Eb(){var e=1,t=1,n=a;function i(e,t){return t.map((t=>r(e,t)))}function r(i,r){var a=[],s=[];return function(n,i,r){var a,s,u,l,c,f,d=[],h=[];a=s=-1,l=n[0]>=i,Cb[l<<1].forEach(p);for(;++a<e-1;)u=l,l=n[a+1]>=i,Cb[u|l<<1].forEach(p);Cb[l|0].forEach(p);for(;++s<t-1;){for(a=-1,l=n[s*e+e]>=i,c=n[s*e]>=i,Cb[l<<1|c<<2].forEach(p);++a<e-1;)u=l,l=n[s*e+e+a+1]>=i,f=c,c=n[s*e+a+1]>=i,Cb[u|l<<1|c<<2|f<<3].forEach(p);Cb[l|c<<3].forEach(p)}a=-1,c=n[s*e]>=i,Cb[c<<2].forEach(p);for(;++a<e-1;)f=c,c=n[s*e+a+1]>=i,Cb[c<<2|f<<3].forEach(p);function p(e){var t,n,i=[e[0][0]+a,e[0][1]+s],u=[e[1][0]+a,e[1][1]+s],l=o(i),c=o(u);(t=h[l])?(n=d[c])?(delete h[t.end],delete d[n.start],t===n?(t.ring.push(u),r(t.ring)):d[t.start]=h[n.end]={start:t.start,end:n.end,ring:t.ring.concat(n.ring)}):(delete h[t.end],t.ring.push(u),h[t.end=c]=t):(t=d[c])?(n=h[l])?(delete d[t.start],delete h[n.end],t===n?(t.ring.push(u),r(t.ring)):d[n.start]=h[t.end]={start:n.start,end:t.end,ring:n.ring.concat(t.ring)}):(delete d[t.start],t.ring.unshift(i),d[t.start=l]=t):d[l]=h[c]={start:l,end:c,ring:[i,u]}}Cb[c<<3].forEach(p)}(i,r,(e=>{n(e,i,r),function(e){var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];for(;++t<n;)i+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return i}(e)>0?a.push([e]):s.push(e)})),s.forEach((e=>{for(var t,n=0,i=a.length;n<i;++n)if(-1!==$b((t=a[n])[0],e))return void t.push(e)})),{type:"MultiPolygon",value:r,coordinates:a}}function o(t){return 2*t[0]+t[1]*(e+1)*4}function a(n,i,r){n.forEach((n=>{var o,a=n[0],s=n[1],u=0|a,l=0|s,c=i[l*e+u];a>0&&a<e&&u===a&&(o=i[l*e+u-1],n[0]=a+(r-o)/(c-o)-.5),s>0&&s<t&&l===s&&(o=i[(l-1)*e+u],n[1]=s+(r-o)/(c-o)-.5)}))}return i.contour=r,i.size=function(n){if(!arguments.length)return[e,t];var r=Math.floor(n[0]),o=Math.floor(n[1]);return r>=0&&o>=0||d("invalid size"),e=r,t=o,i},i.smooth=function(e){return arguments.length?(n=e?a:Fb,i):n===a},i}function $b(e,t){for(var n,i=-1,r=t.length;++i<r;)if(n=Sb(e,t[i]))return n;return 0}function Sb(e,t){for(var n=t[0],i=t[1],r=-1,o=0,a=e.length,s=a-1;o<a;s=o++){var u=e[o],l=u[0],c=u[1],f=e[s],d=f[0],h=f[1];if(Mb(u,f,t))return 0;c>i!=h>i&&n<(d-l)*(i-c)/(h-c)+l&&(r=-r)}return r}function Mb(e,t,n){var i,r,o,a;return function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])==(n[0]-e[0])*(t[1]-e[1])}(e,t,n)&&(r=e[i=+(e[0]===t[0])],o=n[i],a=t[i],r<=o&&o<=a||a<=o&&o<=r)}function Bb(e,t,n){return function(i){var r=k(i),o=n?Math.min(r[0],0):r[0],a=r[1],s=a-o,u=t?de(o,a,e):s/(e+1);return Ht(o+u,a,u)}}function zb(e){fr.call(this,null,e)}function Ob(e,t,n,i,r){const o=e.x1||0,a=e.y1||0,s=t*n<0;function u(e){e.forEach(l)}function l(e){s&&e.reverse(),e.forEach(c)}function c(e){e[0]=(e[0]-o)*t+i,e[1]=(e[1]-a)*n+r}return function(e){return e.coordinates.forEach(u),e}}function Nb(e,t,n){const i=e>=0?e:vr(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function Rb(e){return a(e)?e:s(+e)}function Tb(){var e=e=>e[0],t=e=>e[1],n=ae,i=[-1,-1],r=960,o=500,a=2;function s(s,u){const l=Nb(i[0],s,e)>>a,c=Nb(i[1],s,t)>>a,f=l?l+2:0,d=c?c+2:0,h=2*f+(r>>a),p=2*d+(o>>a),m=new Float32Array(h*p),g=new Float32Array(h*p);let y=m;s.forEach((i=>{const r=f+(+e(i)>>a),o=d+(+t(i)>>a);r>=0&&r<h&&o>=0&&o<p&&(m[r+o*h]+=+n(i))})),l>0&&c>0?(Pb(h,p,m,g,l),jb(h,p,g,m,c),Pb(h,p,m,g,l),jb(h,p,g,m,c),Pb(h,p,m,g,l),jb(h,p,g,m,c)):l>0?(Pb(h,p,m,g,l),Pb(h,p,g,m,l),Pb(h,p,m,g,l),y=g):c>0&&(jb(h,p,m,g,c),jb(h,p,g,m,c),jb(h,p,m,g,c),y=g);const v=u?Math.pow(2,-2*a):1/si(y);for(let e=0,t=h*p;e<t;++e)y[e]*=v;return{values:y,scale:1<<a,width:h,height:p,x1:f,y1:d,x2:f+(r>>a),y2:d+(o>>a)}}return s.x=function(t){return arguments.length?(e=Rb(t),s):e},s.y=function(e){return arguments.length?(t=Rb(e),s):t},s.weight=function(e){return arguments.length?(n=Rb(e),s):n},s.size=function(e){if(!arguments.length)return[r,o];var t=+e[0],n=+e[1];return t>=0&&n>=0||d("invalid size"),r=t,o=n,s},s.cellSize=function(e){return arguments.length?((e=+e)>=1||d("invalid cell size"),a=Math.floor(Math.log(e)/Math.LN2),s):1<<a},s.bandwidth=function(e){return arguments.length?(1===(e=u(e)).length&&(e=[+e[0],+e[0]]),2!==e.length&&d("invalid bandwidth"),i=e,s):i},s}function Pb(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<t;++a)for(let t=0,s=0;t<e+r;++t)t<e&&(s+=n[t+a*e]),t>=r&&(t>=o&&(s-=n[t-o+a*e]),i[t-r+a*e]=s/Math.min(t+1,e-1+o-t,o))}function jb(e,t,n,i,r){const o=1+(r<<1);for(let a=0;a<e;++a)for(let s=0,u=0;s<t+r;++s)s<t&&(u+=n[a+s*e]),s>=r&&(s>=o&&(u-=n[a+(s-o)*e]),i[a+(s-r)*e]=u/Math.min(s+1,t-1+o-s,o))}function Lb(e){fr.call(this,null,e)}zb.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"}]},t(zb,fr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||l,o=Eb().smooth(!1!==e.smooth),s=e.thresholds||function(e,t,n){const i=Bb(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?i:i(e.map((e=>gt(t(e).values))))}(i,r,e),u=null===e.as?null:e.as||"contour",c=[];return i.forEach((t=>{const n=r(t),i=o.size([n.width,n.height])(n.values,f(s)?s:s(n.values));!function(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;a(r)&&(r=r(n,i));a(o)&&(o=o(n,i));if((1===r||null==r)&&!o)return;const s=(te(r)?r:r[0])||1,u=(te(r)?r:r[1])||1,l=o&&o[0]||0,c=o&&o[1]||0;e.forEach(Ob(t,s,u,l,c))}(i,n,t,e),i.forEach((e=>{c.push(Ri(t,Oi(null!=u?{[u]:e}:e)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),Lb.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const qb=["x","y","weight","size","cellSize","bandwidth"];function Ub(e,t){return qb.forEach((n=>null!=t[n]?e[n](t[n]):0)),e}function Ib(e){fr.call(this,null,e)}t(Lb,fr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=function(e,t){var n,i,r,o,a,s,u=[],l=e=>e(o);if(null==t)u.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(l)])||(n[a]=s=[],s.dims=a,u.push(s)),s.push(o);return u}(t.materialize(t.SOURCE).source,e.groupby),o=(e.groupby||[]).map(x),a=Ub(Tb(),e),s=e.as||"grid";return n=r.map((t=>Oi(function(e,t){for(let n=0;n<o.length;++n)e[o[n]]=t[n];return e}({[s]:a(t,e.counts)},t.dims)))),this.value&&(i.rem=this.value),this.value=i.source=i.add=n,i}}),Ib.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},t(Ib,fr,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,i,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),o=Eb().smooth(!1!==e.smooth),a=e.values,s=e.thresholds||Bb(e.count||10,e.nice,!!a),u=e.size;return a||(a=t.materialize(t.SOURCE).source,i=Ob(n=Ub(Tb(),e)(a,!0),n.scale||1,n.scale||1,0,0),u=[n.width,n.height],a=n.values),s=f(s)?s:s(a),a=o.size(u)(a,s),i&&a.forEach(i),this.value&&(r.rem=this.value),this.value=r.source=r.add=(a||[]).map(Oi),r}});const Wb="Feature",Hb="FeatureCollection";function Gb(e){fr.call(this,null,e)}function Vb(e){fr.call(this,null,e)}function Yb(e){fr.call(this,null,e)}function Xb(e){fr.call(this,null,e)}function Jb(e){fr.call(this,[],e),this.generator=function(){var e,t,n,i,r,o,a,s,u,l,c,f,d=10,h=d,p=90,m=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return Ht(Am(i/p)*p,n,p).map(c).concat(Ht(Am(s/m)*m,a,m).map(f)).concat(Ht(Am(t/d)*d,e,d).filter((function(e){return bm(e%p)>fm})).map(u)).concat(Ht(Am(o/h)*h,r,h).filter((function(e){return bm(e%m)>fm})).map(l))}return y.lines=function(){return v().map((function(e){return{type:"LineString",coordinates:e}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(i).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(i=+e[0][0],n=+e[1][0],s=+e[0][1],a=+e[1][1],i>n&&(e=i,i=n,n=e),s>a&&(e=s,s=a,a=e),y.precision(g)):[[i,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],r=+n[1][1],t>e&&(n=t,t=e,e=n),o>r&&(n=o,o=r,r=n),y.precision(g)):[[t,o],[e,r]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(p=+e[0],m=+e[1],y):[p,m]},y.stepMinor=function(e){return arguments.length?(d=+e[0],h=+e[1],y):[d,h]},y.precision=function(d){return arguments.length?(g=+d,u=_y(o,r,90),l=Ay(t,e,g),c=_y(s,a,90),f=Ay(i,n,g),y):g},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function Kb(e){fr.call(this,null,e)}function Qb(e){if(!a(e))return!1;const t=ee(w(e));return t.$x||t.$y||t.$value||t.$max}function Zb(e){fr.call(this,null,e),this.modified(!0)}function ex(e,t,n){a(e[t])&&e[t](n)}Gb.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},t(Gb,fr,{transform(e,t){var n,i=this._features,r=this._points,o=e.fields,a=o&&o[0],s=o&&o[1],u=e.geojson||!o&&l,c=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(w(u))||a&&t.modified(w(a))||s&&t.modified(w(s)),this.value&&!n||(c=t.SOURCE,this._features=i=[],this._points=r=[]),u&&t.visit(c,(e=>i.push(u(e)))),a&&s&&(t.visit(c,(e=>{var t=a(e),n=s(e);null!=t&&null!=n&&(t=+t)===t&&(n=+n)===n&&r.push([t,n])})),i=i.concat({type:Wb,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:Hb,features:i}}}),Vb.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"}]},t(Vb,fr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||l,o=e.as||"path",a=n.SOURCE;!i||e.modified()?(this.value=i=kb(e.projection),n.materialize().reflow()):a=r===l||t.modified(r.fields)?n.ADD_MOD:n.ADD;const s=function(e,t){const n=e.pointRadius();e.context(null),null!=t&&e.pointRadius(t);return n}(i,e.pointRadius);return n.visit(a,(e=>e[o]=i(r(e)))),i.pointRadius(s),n.modifies(o)}}),Yb.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"]}]},t(Yb,fr,{transform(e,t){var n,i=e.projection,r=e.fields[0],o=e.fields[1],a=e.as||["x","y"],s=a[0],u=a[1];function l(e){const t=i([r(e),o(e)]);t?(e[s]=t[0],e[u]=t[1]):(e[s]=void 0,e[u]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(n=t.modified(r.fields)||t.modified(o.fields),t.visit(n?t.ADD_MOD:t.ADD,l)),t.modifies(a)}}),Xb.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"}]},t(Xb,fr,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",o=n.ADD;return i&&!e.modified()||(this.value=i=function(e,t,n){const i=null==n?n=>e(t(n)):i=>{var r=e.pointRadius(),o=e.pointRadius(n)(t(i));return e.pointRadius(r),o};return i.context=t=>(e.context(t),i),i}(kb(e.projection),e.field||O("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(e=>e[r]=i)),n.modifies(r)}}),Jb.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}]},t(Jb,fr,{transform(e,t){var n,i=this.value,r=this.generator;if(!i.length||e.modified())for(const o in e)a(r[o])&&r[o](e[o]);return n=r(),i.length?t.mod.push(Ti(i[0],n)):t.add.push(Oi(n)),i[0]=n,t}}),Kb.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"}]},t(Kb,fr,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i="shared"===e.resolve,r=e.field||l,o=function(e,t){let n;a(e)?(n=n=>e(n,t),n.dep=Qb(e)):e?n=s(e):(n=e=>e.$value/e.$max||0,n.dep=!0);return n}(e.opacity,e),u=function(e,t){let n;a(e)?(n=n=>pn(e(n,t)),n.dep=Qb(e)):n=s(pn(e||"#888"));return n}(e.color,e),c=e.as||"image",f={$x:0,$y:0,$value:0,$max:i?gt(n.map((e=>gt(r(e).values)))):0};return n.forEach((e=>{const t=r(e),n=v({},e,f);i||(n.$max=gt(t.values||[])),e[c]=function(e,t,n,i){const r=e.width,o=e.height,a=e.x1||0,s=e.y1||0,u=e.x2||r,l=e.y2||o,c=e.values,f=c?e=>c[e]:L,d=Ta(u-a,l-s),h=d.getContext("2d"),p=h.getImageData(0,0,u-a,l-s),m=p.data;for(let g=s,y=0;g<l;++g){t.$y=g-s;for(let e=a,o=g*r;e<u;++e,y+=4){t.$x=e-a,t.$value=f(e+o);const r=n(t);m[y+0]=r.r,m[y+1]=r.g,m[y+2]=r.b,m[y+3]=~~(255*i(t))}}return h.putImageData(p,0,0),d}(t,n,u.dep?u:s(u(n)),o.dep?o:s(o(n)))})),t.reflow(!0).modifies(c)}}),t(Zb,fr,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=function(e){const t=Ab((e||"mercator").toLowerCase());t||d("Unrecognized projection type: "+e);return t()}(e.type),_b.forEach((t=>{null!=e[t]&&ex(n,t,e[t])}))):_b.forEach((t=>{e.modified(t)&&ex(n,t,e[t])})),null!=e.pointRadius&&n.path.pointRadius(e.pointRadius),e.fit&&function(e,t){const n=function(e){return e=u(e),1===e.length?e[0]:{type:Hb,features:e.reduce(((e,t)=>e.concat(function(e){return e.type===Hb?e.features:u(e).filter((e=>null!=e)).map((e=>e.type===Wb?e:{type:Wb,geometry:e}))}(t))),[])}}(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});const tx=Object.freeze(Object.defineProperty({__proto__:null,contour:Ib,geojson:Gb,geopath:Vb,geopoint:Yb,geoshape:Xb,graticule:Jb,heatmap:Kb,isocontour:zb,kde2d:Lb,projection:Zb},Symbol.toStringTag,{value:"Module"}));function nx(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o,a,s,u,l,c,f,d,h=e._root,p={data:i},m=e._x0,g=e._y0,y=e._x1,v=e._y1;if(!h)return e._root=p,e;for(;h.length;)if((l=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a,r=h,!(h=h[f=c<<1|l]))return r[f]=p,e;if(s=+e._x.call(null,h.data),u=+e._y.call(null,h.data),t===s&&n===u)return p.next=h,r?r[f]=p:e._root=p,e;do{r=r?r[f]=new Array(4):e._root=new Array(4),(l=t>=(o=(m+y)/2))?m=o:y=o,(c=n>=(a=(g+v)/2))?g=a:v=a}while((f=c<<1|l)==(d=(u>=a)<<1|s>=o));return r[d]=h,r[f]=p,e}function ix(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function rx(e){return e[0]}function ox(e){return e[1]}function ax(e,t,n){var i=new sx(null==t?rx:t,null==n?ox:n,NaN,NaN,NaN,NaN);return null==e?i:i.addAll(e)}function sx(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function ux(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var lx=ax.prototype=sx.prototype;function cx(e){return function(){return e}}function fx(e){return 1e-6*(e()-.5)}function dx(e){return e.x+e.vx}function hx(e){return e.y+e.vy}function px(e){return e.index}function mx(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}lx.copy=function(){var e,t,n=new sx(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return n;if(!i.length)return n._root=ux(i),n;for(e=[{source:i,target:n._root=new Array(4)}];i=e.pop();)for(var r=0;r<4;++r)(t=i.source[r])&&(t.length?e.push({source:t,target:i.target[r]=new Array(4)}):i.target[r]=ux(t));return n},lx.add=function(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return nx(this.cover(t,n),t,n,e)},lx.addAll=function(e){var t,n,i,r,o=e.length,a=new Array(o),s=new Array(o),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(a[n]=i,s[n]=r,i<u&&(u=i),i>c&&(c=i),r<l&&(l=r),r>f&&(f=r));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;n<o;++n)nx(this,a[n],s[n],e[n]);return this},lx.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var a,s,u=r-n||1,l=this._root;n>e||e>=r||i>t||t>=o;)switch(s=(t<i)<<1|e<n,(a=new Array(4))[s]=l,l=a,u*=2,s){case 0:r=n+u,o=i+u;break;case 1:n=r-u,o=i+u;break;case 2:r=n+u,i=o-u;break;case 3:n=r-u,i=o-u}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this},lx.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},lx.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},lx.find=function(e,t,n){var i,r,o,a,s,u,l,c=this._x0,f=this._y0,d=this._x1,h=this._y1,p=[],m=this._root;for(m&&p.push(new ix(m,c,f,d,h)),null==n?n=1/0:(c=e-n,f=t-n,d=e+n,h=t+n,n*=n);u=p.pop();)if(!(!(m=u.node)||(r=u.x0)>d||(o=u.y0)>h||(a=u.x1)<c||(s=u.y1)<f))if(m.length){var g=(r+a)/2,y=(o+s)/2;p.push(new ix(m[3],g,y,a,s),new ix(m[2],r,y,g,s),new ix(m[1],g,o,a,y),new ix(m[0],r,o,g,y)),(l=(t>=y)<<1|e>=g)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=u)}else{var v=e-+this._x.call(null,m.data),b=t-+this._y.call(null,m.data),x=v*v+b*b;if(x<n){var w=Math.sqrt(n=x);c=e-w,f=t-w,d=e+w,h=t+w,i=m.data}}return i},lx.remove=function(e){if(isNaN(o=+this._x.call(null,e))||isNaN(a=+this._y.call(null,e)))return this;var t,n,i,r,o,a,s,u,l,c,f,d,h=this._root,p=this._x0,m=this._y0,g=this._x1,y=this._y1;if(!h)return this;if(h.length)for(;;){if((l=o>=(s=(p+g)/2))?p=s:g=s,(c=a>=(u=(m+y)/2))?m=u:y=u,t=h,!(h=h[f=c<<1|l]))return this;if(!h.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(n=t,d=f)}for(;h.data!==e;)if(i=h,!(h=h.next))return this;return(r=h.next)&&delete h.next,i?(r?i.next=r:delete i.next,this):t?(r?t[f]=r:delete t[f],(h=t[0]||t[1]||t[2]||t[3])&&h===(t[3]||t[2]||t[1]||t[0])&&!h.length&&(n?n[d]=h:this._root=h),this):(this._root=r,this)},lx.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},lx.root=function(){return this._root},lx.size=function(){var e=0;return this.visit((function(t){if(!t.length)do{++e}while(t=t.next)})),e},lx.visit=function(e){var t,n,i,r,o,a,s=[],u=this._root;for(u&&s.push(new ix(u,this._x0,this._y0,this._x1,this._y1));t=s.pop();)if(!e(u=t.node,i=t.x0,r=t.y0,o=t.x1,a=t.y1)&&u.length){var l=(i+o)/2,c=(r+a)/2;(n=u[3])&&s.push(new ix(n,l,c,o,a)),(n=u[2])&&s.push(new ix(n,i,c,l,a)),(n=u[1])&&s.push(new ix(n,l,r,o,c)),(n=u[0])&&s.push(new ix(n,i,r,l,c))}return this},lx.visitAfter=function(e){var t,n=[],i=[];for(this._root&&n.push(new ix(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var o,a=t.x0,s=t.y0,u=t.x1,l=t.y1,c=(a+u)/2,f=(s+l)/2;(o=r[0])&&n.push(new ix(o,a,s,c,f)),(o=r[1])&&n.push(new ix(o,c,s,u,f)),(o=r[2])&&n.push(new ix(o,a,f,c,l)),(o=r[3])&&n.push(new ix(o,c,f,u,l))}i.push(t)}for(;t=i.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},lx.x=function(e){return arguments.length?(this._x=e,this):this._x},lx.y=function(e){return arguments.length?(this._y=e,this):this._y};const gx=4294967296;function yx(e){return e.x}function vx(e){return e.y}var bx=Math.PI*(3-Math.sqrt(5));function xx(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,a=.6,s=new Map,u=mn(f),l=gn("tick","end"),c=function(){let e=1;return()=>(e=(1664525*e+1013904223)%gx)/gx}();function f(){d(),l.call("tick",t),n<i&&(u.stop(),l.call("end",t))}function d(i){var u,l,c=e.length;void 0===i&&(i=1);for(var f=0;f<i;++f)for(n+=(o-n)*r,s.forEach((function(e){e(n)})),u=0;u<c;++u)null==(l=e[u]).fx?l.x+=l.vx*=a:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=a:(l.y=l.fy,l.vy=0);return t}function h(){for(var t,n=0,i=e.length;n<i;++n){if((t=e[n]).index=n,null!=t.fx&&(t.x=t.fx),null!=t.fy&&(t.y=t.fy),isNaN(t.x)||isNaN(t.y)){var r=10*Math.sqrt(.5+n),o=n*bx;t.x=r*Math.cos(o),t.y=r*Math.sin(o)}(isNaN(t.vx)||isNaN(t.vy))&&(t.vx=t.vy=0)}}function p(t){return t.initialize&&t.initialize(e,c),t}return null==e&&(e=[]),h(),t={tick:d,restart:function(){return u.restart(f),t},stop:function(){return u.stop(),t},nodes:function(n){return arguments.length?(e=n,h(),s.forEach(p),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(i=+e,t):i},alphaDecay:function(e){return arguments.length?(r=+e,t):+r},alphaTarget:function(e){return arguments.length?(o=+e,t):o},velocityDecay:function(e){return arguments.length?(a=1-e,t):1-a},randomSource:function(e){return arguments.length?(c=e,s.forEach(p),t):c},force:function(e,n){return arguments.length>1?(null==n?s.delete(e):s.set(e,p(n)),t):s.get(e)},find:function(t,n,i){var r,o,a,s,u,l=0,c=e.length;for(null==i?i=1/0:i*=i,l=0;l<c;++l)(a=(r=t-(s=e[l]).x)*r+(o=n-s.y)*o)<i&&(u=s,i=a);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}const wx={center:function(e,t){var n,i=1;function r(){var r,o,a=n.length,s=0,u=0;for(r=0;r<a;++r)s+=(o=n[r]).x,u+=o.y;for(s=(s/a-e)*i,u=(u/a-t)*i,r=0;r<a;++r)(o=n[r]).x-=s,o.y-=u}return null==e&&(e=0),null==t&&(t=0),r.initialize=function(e){n=e},r.x=function(t){return arguments.length?(e=+t,r):e},r.y=function(e){return arguments.length?(t=+e,r):t},r.strength=function(e){return arguments.length?(i=+e,r):i},r},collide:function(e){var t,n,i,r=1,o=1;function a(){for(var e,a,u,l,c,f,d,h=t.length,p=0;p<o;++p)for(a=ax(t,dx,hx).visitAfter(s),e=0;e<h;++e)u=t[e],f=n[u.index],d=f*f,l=u.x+u.vx,c=u.y+u.vy,a.visit(m);function m(e,t,n,o,a){var s=e.data,h=e.r,p=f+h;if(!s)return t>l+p||o<l-p||n>c+p||a<c-p;if(s.index>u.index){var m=l-s.x-s.vx,g=c-s.y-s.vy,y=m*m+g*g;y<p*p&&(0===m&&(y+=(m=fx(i))*m),0===g&&(y+=(g=fx(i))*g),y=(p-(y=Math.sqrt(y)))/y*r,u.vx+=(m*=y)*(p=(h*=h)/(d+h)),u.vy+=(g*=y)*p,s.vx-=m*(p=1-p),s.vy-=g*p)}}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function u(){if(t){var i,r,o=t.length;for(n=new Array(o),i=0;i<o;++i)r=t[i],n[r.index]=+e(r,i,t)}}return"function"!=typeof e&&(e=cx(null==e?1:+e)),a.initialize=function(e,n){t=e,i=n,u()},a.iterations=function(e){return arguments.length?(o=+e,a):o},a.strength=function(e){return arguments.length?(r=+e,a):r},a.radius=function(t){return arguments.length?(e="function"==typeof t?t:cx(+t),u(),a):e},a},nbody:function(){var e,t,n,i,r,o=cx(-30),a=1,s=1/0,u=.81;function l(n){var r,o=e.length,a=ax(e,yx,vx).visitAfter(f);for(i=n,r=0;r<o;++r)t=e[r],a.visit(d)}function c(){if(e){var t,n,i=e.length;for(r=new Array(i),t=0;t<i;++t)n=e[t],r[n.index]=+o(n,t,e)}}function f(e){var t,n,i,o,a,s=0,u=0;if(e.length){for(i=o=a=0;a<4;++a)(t=e[a])&&(n=Math.abs(t.value))&&(s+=t.value,u+=n,i+=n*t.x,o+=n*t.y);e.x=i/u,e.y=o/u}else{(t=e).x=t.data.x,t.y=t.data.y;do{s+=r[t.data.index]}while(t=t.next)}e.value=s}function d(e,o,l,c){if(!e.value)return!0;var f=e.x-t.x,d=e.y-t.y,h=c-o,p=f*f+d*d;if(h*h/u<p)return p<s&&(0===f&&(p+=(f=fx(n))*f),0===d&&(p+=(d=fx(n))*d),p<a&&(p=Math.sqrt(a*p)),t.vx+=f*e.value*i/p,t.vy+=d*e.value*i/p),!0;if(!(e.length||p>=s)){(e.data!==t||e.next)&&(0===f&&(p+=(f=fx(n))*f),0===d&&(p+=(d=fx(n))*d),p<a&&(p=Math.sqrt(a*p)));do{e.data!==t&&(h=r[e.data.index]*i/p,t.vx+=f*h,t.vy+=d*h)}while(e=e.next)}}return l.initialize=function(t,i){e=t,n=i,c()},l.strength=function(e){return arguments.length?(o="function"==typeof e?e:cx(+e),c(),l):o},l.distanceMin=function(e){return arguments.length?(a=e*e,l):Math.sqrt(a)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(u=e*e,l):Math.sqrt(u)},l},link:function(e){var t,n,i,r,o,a,s=px,u=function(e){return 1/Math.min(r[e.source.index],r[e.target.index])},l=cx(30),c=1;function f(i){for(var r=0,s=e.length;r<c;++r)for(var u,l,f,d,h,p,m,g=0;g<s;++g)l=(u=e[g]).source,d=(f=u.target).x+f.vx-l.x-l.vx||fx(a),h=f.y+f.vy-l.y-l.vy||fx(a),d*=p=((p=Math.sqrt(d*d+h*h))-n[g])/p*i*t[g],h*=p,f.vx-=d*(m=o[g]),f.vy-=h*m,l.vx+=d*(m=1-m),l.vy+=h*m}function d(){if(i){var a,u,l=i.length,c=e.length,f=new Map(i.map(((e,t)=>[s(e,t,i),e])));for(a=0,r=new Array(l);a<c;++a)(u=e[a]).index=a,"object"!=typeof u.source&&(u.source=mx(f,u.source)),"object"!=typeof u.target&&(u.target=mx(f,u.target)),r[u.source.index]=(r[u.source.index]||0)+1,r[u.target.index]=(r[u.target.index]||0)+1;for(a=0,o=new Array(c);a<c;++a)u=e[a],o[a]=r[u.source.index]/(r[u.source.index]+r[u.target.index]);t=new Array(c),h(),n=new Array(c),p()}}function h(){if(i)for(var n=0,r=e.length;n<r;++n)t[n]=+u(e[n],n,e)}function p(){if(i)for(var t=0,r=e.length;t<r;++t)n[t]=+l(e[t],t,e)}return null==e&&(e=[]),f.initialize=function(e,t){i=e,a=t,d()},f.links=function(t){return arguments.length?(e=t,d(),f):e},f.id=function(e){return arguments.length?(s=e,f):s},f.iterations=function(e){return arguments.length?(c=+e,f):c},f.strength=function(e){return arguments.length?(u="function"==typeof e?e:cx(+e),h(),f):u},f.distance=function(e){return arguments.length?(l="function"==typeof e?e:cx(+e),p(),f):l},f},x:function(e){var t,n,i,r=cx(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vx+=(i[o]-r.x)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=cx(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:cx(+e),a(),o):r},o.x=function(t){return arguments.length?(e="function"==typeof t?t:cx(+t),a(),o):e},o},y:function(e){var t,n,i,r=cx(.1);function o(e){for(var r,o=0,a=t.length;o<a;++o)(r=t[o]).vy+=(i[o]-r.y)*n[o]*e}function a(){if(t){var o,a=t.length;for(n=new Array(a),i=new Array(a),o=0;o<a;++o)n[o]=isNaN(i[o]=+e(t[o],o,t))?0:+r(t[o],o,t)}}return"function"!=typeof e&&(e=cx(null==e?0:+e)),o.initialize=function(e){t=e,a()},o.strength=function(e){return arguments.length?(r="function"==typeof e?e:cx(+e),a(),o):r},o.y=function(t){return arguments.length?(e="function"==typeof t?t:cx(+t),a(),o):e},o}},_x="forces",Ax=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],kx=["static","iterations"],Dx=["x","y","vx","vy"];function Fx(e){fr.call(this,null,e)}function Cx(e,t,n,i){var r,o,a,s,l=u(t.forces);for(r=0,o=Ax.length;r<o;++r)(a=Ax[r])!==_x&&t.modified(a)&&e[a](t[a]);for(r=0,o=l.length;r<o;++r)s=_x+r,(a=n||t.modified(_x,r)?$x(l[r]):i&&Ex(l[r],i)?e.force(s):null)&&e.force(s,a);for(o=e.numForces||0;r<o;++r)e.force(_x+r,null);return e.numForces=l.length,e}function Ex(e,t){var n,i;for(n in e)if(a(i=e[n])&&t.modified(w(i)))return 1;return 0}function $x(e){var t,n;for(n in c(wx,e.force)||d("Unrecognized force: "+e.force),t=wx[e.force](),e)a(t[n])&&Sx(t[n],e[n],e);return t}function Sx(e,t,n){e(a(t)?e=>t(e,n):t)}Fx.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:Dx}]},t(Fx,fr,{transform(e,t){var n,i,r=this.value,o=t.changed(t.ADD_REM),a=e.modified(Ax),s=e.iterations||300;if(r?(o&&(t.modifies("index"),r.nodes(t.source)),(a||t.changed(t.MOD))&&Cx(r,e,0,t)):(this.value=r=function(e,t){const n=xx(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),Cx(n,t,!0).on("end",(()=>o=!0))}(t.source,e),r.on("tick",(n=t.dataflow,i=this,()=>n.touch(i).run())),e.static||(o=!0,r.tick()),t.modifies("index")),a||o||e.modified(kx)||t.changed()&&e.restart)if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/s)),e.static)for(r.stop();--s>=0;)r.tick();else if(r.stopped()&&r.restart(),!o)return t.StopPropagation;return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let s,u=this._argops,l=0,c=u.length;l<c;++l)if(s=u[l],s.name===_x&&"link"===s.op._argval.force)for(var i,r=s.op._argops,o=0,a=r.length;o<a;++o)if("links"===r[o].name&&(i=r[o].op.source)){n.pulse(i,n.changeset().reflow());break}return t.reflow(e.modified()).modifies(Dx)}});const Mx=Object.freeze(Object.defineProperty({__proto__:null,force:Fx},Symbol.toStringTag,{value:"Module"}));function Bx(e,t){return e.parent===t.parent?1:2}function zx(e,t){return e+t.x}function Ox(e,t){return Math.max(e,t.y)}function Nx(e){var t=0,n=e.children,i=n&&n.length;if(i)for(;--i>=0;)t+=n[i].value;else t=1;e.value=t}function Rx(e,t){e instanceof Map?(e=[void 0,e],void 0===t&&(t=Px)):void 0===t&&(t=Tx);for(var n,i,r,o,a,s=new qx(e),u=[s];n=u.pop();)if((r=t(n.data))&&(a=(r=Array.from(r)).length))for(n.children=r,o=a-1;o>=0;--o)u.push(i=r[o]=new qx(r[o])),i.parent=n,i.depth=n.depth+1;return s.eachBefore(Lx)}function Tx(e){return e.children}function Px(e){return Array.isArray(e)?e[1]:null}function jx(e){void 0!==e.data.value&&(e.value=e.data.value),e.data=e.data.data}function Lx(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function qx(e){this.data=e,this.depth=this.height=0,this.parent=null}function Ux(e){return null==e?null:Ix(e)}function Ix(e){if("function"!=typeof e)throw new Error;return e}function Wx(){return 0}function Hx(e){return function(){return e}}qx.prototype=Rx.prototype={constructor:qx,count:function(){return this.eachAfter(Nx)},each:function(e,t){let n=-1;for(const i of this)e.call(t,i,++n,this);return this},eachAfter:function(e,t){for(var n,i,r,o=this,a=[o],s=[],u=-1;o=a.pop();)if(s.push(o),n=o.children)for(i=0,r=n.length;i<r;++i)a.push(n[i]);for(;o=s.pop();)e.call(t,o,++u,this);return this},eachBefore:function(e,t){for(var n,i,r=this,o=[r],a=-1;r=o.pop();)if(e.call(t,r,++a,this),n=r.children)for(i=n.length-1;i>=0;--i)o.push(n[i]);return this},find:function(e,t){let n=-1;for(const i of this)if(e.call(t,i,++n,this))return i},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,i=t.children,r=i&&i.length;--r>=0;)n+=i[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),i=t.ancestors(),r=null;e=n.pop(),t=i.pop();for(;e===t;)r=e,e=n.pop(),t=i.pop();return r}(t,e),i=[t];t!==n;)t=t.parent,i.push(t);for(var r=i.length;e!==n;)i.splice(r,0,e),e=e.parent;return i},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Rx(this).eachBefore(jx)},[Symbol.iterator]:function*(){var e,t,n,i,r=this,o=[r];do{for(e=o.reverse(),o=[];r=e.pop();)if(yield r,t=r.children)for(n=0,i=t.length;n<i;++n)o.push(t[n])}while(o.length)}};const Gx=4294967296;function Vx(e,t){var n,i;if(Jx(t,e))return[t];for(n=0;n<e.length;++n)if(Yx(t,e[n])&&Jx(Qx(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(i=n+1;i<e.length;++i)if(Yx(Qx(e[n],e[i]),t)&&Yx(Qx(e[n],t),e[i])&&Yx(Qx(e[i],t),e[n])&&Jx(Zx(e[n],e[i],t),e))return[e[n],e[i],t];throw new Error}function Yx(e,t){var n=e.r-t.r,i=t.x-e.x,r=t.y-e.y;return n<0||n*n<i*i+r*r}function Xx(e,t){var n=e.r-t.r+1e-9*Math.max(e.r,t.r,1),i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function Jx(e,t){for(var n=0;n<t.length;++n)if(!Xx(e,t[n]))return!1;return!0}function Kx(e){switch(e.length){case 1:return{x:(t=e[0]).x,y:t.y,r:t.r};case 2:return Qx(e[0],e[1]);case 3:return Zx(e[0],e[1],e[2])}var t}function Qx(e,t){var n=e.x,i=e.y,r=e.r,o=t.x,a=t.y,s=t.r,u=o-n,l=a-i,c=s-r,f=Math.sqrt(u*u+l*l);return{x:(n+o+u/f*c)/2,y:(i+a+l/f*c)/2,r:(f+r+s)/2}}function Zx(e,t,n){var i=e.x,r=e.y,o=e.r,a=t.x,s=t.y,u=t.r,l=n.x,c=n.y,f=n.r,d=i-a,h=i-l,p=r-s,m=r-c,g=u-o,y=f-o,v=i*i+r*r-o*o,b=v-a*a-s*s+u*u,x=v-l*l-c*c+f*f,w=h*p-d*m,_=(p*x-m*b)/(2*w)-i,A=(m*g-p*y)/w,k=(h*b-d*x)/(2*w)-r,D=(d*y-h*g)/w,F=A*A+D*D-1,C=2*(o+_*A+k*D),E=_*_+k*k-o*o,$=-(Math.abs(F)>1e-6?(C+Math.sqrt(C*C-4*F*E))/(2*F):E/C);return{x:i+_+A*$,y:r+k+D*$,r:$}}function ew(e,t,n){var i,r,o,a,s=e.x-t.x,u=e.y-t.y,l=s*s+u*u;l?(r=t.r+n.r,r*=r,a=e.r+n.r,r>(a*=a)?(i=(l+a-r)/(2*l),o=Math.sqrt(Math.max(0,a/l-i*i)),n.x=e.x-i*s-o*u,n.y=e.y-i*u+o*s):(i=(l+r-a)/(2*l),o=Math.sqrt(Math.max(0,r/l-i*i)),n.x=t.x+i*s-o*u,n.y=t.y+i*u+o*s)):(n.x=t.x+n.r,n.y=t.y)}function tw(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function nw(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,o=(t.y*n.r+n.y*t.r)/i;return r*r+o*o}function iw(e){this._=e,this.next=null,this.previous=null}function rw(e,t){if(!(o=(e=function(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}(e)).length))return 0;var n,i,r,o,a,s,u,l,c,f,d;if((n=e[0]).x=0,n.y=0,!(o>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(o>2))return n.r+i.r;ew(i,n,r=e[2]),n=new iw(n),i=new iw(i),r=new iw(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(u=3;u<o;++u){ew(n._,i._,r=e[u]),r=new iw(r),l=i.next,c=n.previous,f=i._.r,d=n._.r;do{if(f<=d){if(tw(l._,r._)){i=l,n.next=i,i.previous=n,--u;continue e}f+=l._.r,l=l.next}else{if(tw(c._,r._)){(n=c).next=i,i.previous=n,--u;continue e}d+=c._.r,c=c.previous}}while(l!==c.next);for(r.previous=n,r.next=i,n.next=i.previous=i=r,a=nw(n);(r=r.next)!==i;)(s=nw(r))<a&&(n=r,a=s);i=n.next}for(n=[i._],r=i;(r=r.next)!==i;)n.push(r._);for(r=function(e,t){for(var n,i,r=0,o=(e=function(e,t){let n,i,r=e.length;for(;r;)i=t()*r--|0,n=e[r],e[r]=e[i],e[i]=n;return e}(Array.from(e),t)).length,a=[];r<o;)n=e[r],i&&Xx(i,n)?++r:(i=Kx(a=Vx(a,n)),r=0);return i}(n,t),u=0;u<o;++u)(n=e[u]).x-=r.x,n.y-=r.y;return r.r}function ow(e){return Math.sqrt(e.value)}function aw(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function sw(e,t,n){return function(i){if(r=i.children){var r,o,a,s=r.length,u=e(i)*t||0;if(u)for(o=0;o<s;++o)r[o].r+=u;if(a=rw(r,n),u)for(o=0;o<s;++o)r[o].r-=u;i.r=a+u}}}function uw(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function lw(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function cw(e,t,n,i,r){for(var o,a=e.children,s=-1,u=a.length,l=e.value&&(i-t)/e.value;++s<u;)(o=a[s]).y0=n,o.y1=r,o.x0=t,o.x1=t+=o.value*l}var fw={depth:-1},dw={},hw={};function pw(e){return e.id}function mw(e){return e.parentId}function gw(){var e,t=pw,n=mw;function i(i){var r,o,a,s,u,l,c,f,d=Array.from(i),h=t,p=n,m=new Map;if(null!=e){const t=d.map(((t,n)=>function(e){e=`${e}`;let t=e.length;vw(e,t-1)&&!vw(e,t-2)&&(e=e.slice(0,-1));return"/"===e[0]?e:`/${e}`}(e(t,n,i)))),n=t.map(yw),r=new Set(t).add("");for(const e of n)r.has(e)||(r.add(e),t.push(e),n.push(yw(e)),d.push(hw));h=(e,n)=>t[n],p=(e,t)=>n[t]}for(a=0,r=d.length;a<r;++a)o=d[a],l=d[a]=new qx(o),null!=(c=h(o,a,i))&&(c+="")&&(f=l.id=c,m.set(f,m.has(f)?dw:l)),null!=(c=p(o,a,i))&&(c+="")&&(l.parent=c);for(a=0;a<r;++a)if(c=(l=d[a]).parent){if(!(u=m.get(c)))throw new Error("missing: "+c);if(u===dw)throw new Error("ambiguous: "+c);u.children?u.children.push(l):u.children=[l],l.parent=u}else{if(s)throw new Error("multiple roots");s=l}if(!s)throw new Error("no root");if(null!=e){for(;s.data===hw&&1===s.children.length;)s=s.children[0],--r;for(let e=d.length-1;e>=0&&(l=d[e]).data===hw;--e)l.data=null}if(s.parent=fw,s.eachBefore((function(e){e.depth=e.parent.depth+1,--r})).eachBefore(Lx),s.parent=null,r>0)throw new Error("cycle");return s}return i.id=function(e){return arguments.length?(t=Ux(e),i):t},i.parentId=function(e){return arguments.length?(n=Ux(e),i):n},i.path=function(t){return arguments.length?(e=Ux(t),i):e},i}function yw(e){let t=e.length;if(t<2)return"";for(;--t>1&&!vw(e,t););return e.slice(0,t)}function vw(e,t){if("/"===e[t]){let n=0;for(;t>0&&"\\"===e[--t];)++n;if(!(1&n))return!0}return!1}function bw(e,t){return e.parent===t.parent?1:2}function xw(e){var t=e.children;return t?t[0]:e.t}function ww(e){var t=e.children;return t?t[t.length-1]:e.t}function _w(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function Aw(e,t,n){return e.a.parent===t.parent?e.a:n}function kw(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function Dw(e,t,n,i,r){for(var o,a=e.children,s=-1,u=a.length,l=e.value&&(r-n)/e.value;++s<u;)(o=a[s]).x0=t,o.x1=i,o.y0=n,o.y1=n+=o.value*l}kw.prototype=Object.create(qx.prototype);var Fw=(1+Math.sqrt(5))/2;function Cw(e,t,n,i,r,o){for(var a,s,u,l,c,f,d,h,p,m,g,y=[],v=t.children,b=0,x=0,w=v.length,_=t.value;b<w;){u=r-n,l=o-i;do{c=v[x++].value}while(!c&&x<w);for(f=d=c,g=c*c*(m=Math.max(l/u,u/l)/(_*e)),p=Math.max(d/g,g/f);x<w;++x){if(c+=s=v[x].value,s<f&&(f=s),s>d&&(d=s),g=c*c*m,(h=Math.max(d/g,g/f))>p){c-=s;break}p=h}y.push(a={value:c,dice:u<l,children:v.slice(b,x)}),a.dice?cw(a,n,i,r,_?i+=l*c/_:o):Dw(a,n,i,_?n+=u*c/_:r,o),_-=c,b=x}return y}const Ew=function e(t){function n(e,n,i,r,o){Cw(t,e,n,i,r,o)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(Fw);const $w=function e(t){function n(e,n,i,r,o){if((a=e._squarify)&&a.ratio===t)for(var a,s,u,l,c,f=-1,d=a.length,h=e.value;++f<d;){for(u=(s=a[f]).children,l=s.value=0,c=u.length;l<c;++l)s.value+=u[l].value;s.dice?cw(s,n,i,r,h?i+=(o-i)*s.value/h:o):Dw(s,n,i,h?n+=(r-n)*s.value/h:r,o),h-=s.value}else e._squarify=a=Cw(t,e,n,i,r,o),a.ratio=t}return n.ratio=function(t){return e((t=+t)>1?t:1)},n}(Fw);function Sw(e,t,n){const i={};return e.each((e=>{const r=e.data;n(r)&&(i[t(r)]=e)})),e.lookup=i,e}function Mw(e){fr.call(this,null,e)}Mw.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const Bw=e=>e.values;function zw(){const e=[],t={entries:e=>i(n(e,0),0),key:n=>(e.push(n),t)};function n(t,i){if(i>=e.length)return t;const r=t.length,o=e[i++],a={},s={};let u,l,c,f=-1;for(;++f<r;)u=o(l=t[f])+"",(c=a[u])?c.push(l):a[u]=[l];for(u in a)s[u]=n(a[u],i);return s}function i(t,n){if(++n>e.length)return t;const r=[];for(const e in t)r.push({key:e,values:i(t[e],n)});return r}return t}function Ow(e){fr.call(this,null,e)}t(Mw,fr,{transform(e,t){t.source||d("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),o=this.value;return(!o||i||t.changed())&&(o&&o.each((e=>{e.children&&Mi(e.data)&&r.rem.push(e.data)})),this.value=o=Rx({values:u(e.keys).reduce(((e,t)=>(e.key(t),e)),zw()).entries(r.source)},Bw),n&&o.each((e=>{e.children&&(e=Oi(e.data),r.add.push(e),r.source.push(e))})),Sw(o,Bi,Bi)),r.source.root=o,r}});const Nw=(e,t)=>e.parent===t.parent?1:2;t(Ow,fr,{transform(e,t){t.source&&t.source.root||d(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,o=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(Pi(e.sort,(e=>e.data))),function(e,t,n){for(let i,r=0,o=t.length;r<o;++r)i=t[r],i in n&&e[i](n[i])}(n,this.params,e),n.separation&&n.separation(!1!==e.separation?Nw:ae);try{this.value=n(r)}catch(a){d(a)}return r.each((e=>function(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o<r;++o)i[n[o]]=e[t[o]];i[n[r]]=e.children?e.children.length:0}(e,i,o))),t.reflow(e.modified()).modifies(o).modifies("leaf")}});const Rw=["x","y","r","depth","children"];function Tw(e){Ow.call(this,e)}Tw.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Rw.length,default:Rw}]},t(Tw,Ow,{layout:function(){var e=null,t=1,n=1,i=Wx;function r(r){const o=function(){let e=1;return()=>(e=(1664525*e+1013904223)%Gx)/Gx}();return r.x=t/2,r.y=n/2,e?r.eachBefore(aw(e)).eachAfter(sw(i,.5,o)).eachBefore(uw(1)):r.eachBefore(aw(ow)).eachAfter(sw(Wx,1,o)).eachAfter(sw(i,r.r/Math.min(t,n),o)).eachBefore(uw(Math.min(t,n)/(2*r.r))),r}return r.radius=function(t){return arguments.length?(e=Ux(t),r):e},r.size=function(e){return arguments.length?(t=+e[0],n=+e[1],r):[t,n]},r.padding=function(e){return arguments.length?(i="function"==typeof e?e:Hx(+e),r):i},r},params:["radius","size","padding"],fields:Rw});const Pw=["x0","y0","x1","y1","depth","children"];function jw(e){Ow.call(this,e)}function Lw(e){fr.call(this,null,e)}jw.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:Pw.length,default:Pw}]},t(jw,Ow,{layout:function(){var e=1,t=1,n=0,i=!1;function r(r){var o=r.height+1;return r.x0=r.y0=n,r.x1=e,r.y1=t/o,r.eachBefore(function(e,t){return function(i){i.children&&cw(i,i.x0,e*(i.depth+1)/t,i.x1,e*(i.depth+2)/t);var r=i.x0,o=i.y0,a=i.x1-n,s=i.y1-n;a<r&&(r=a=(r+a)/2),s<o&&(o=s=(o+s)/2),i.x0=r,i.y0=o,i.x1=a,i.y1=s}}(t,o)),i&&r.eachBefore(lw),r}return r.round=function(e){return arguments.length?(i=!!e,r):i},r.size=function(n){return arguments.length?(e=+n[0],t=+n[1],r):[e,t]},r.padding=function(e){return arguments.length?(n=+e,r):n},r},params:["size","round","padding"],fields:Pw}),Lw.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},t(Lw,fr,{transform(e,t){t.source||d("Stratify transform requires an upstream data source.");let n=this.value;const i=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),o=!n||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),o&&(n=r.source.length?Sw(gw().id(e.key).parentId(e.parentKey)(r.source),e.key,p):Sw(gw()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});const qw={tidy:function(){var e=bw,t=1,n=1,i=null;function r(r){var u=function(e){for(var t,n,i,r,o,a=new kw(e,0),s=[a];t=s.pop();)if(i=t._.children)for(t.children=new Array(o=i.length),r=o-1;r>=0;--r)s.push(n=t.children[r]=new kw(i[r],r)),n.parent=t;return(a.parent=new kw(null,0)).children=[a],a}(r);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),i)r.eachBefore(s);else{var l=r,c=r,f=r;r.eachBefore((function(e){e.x<l.x&&(l=e),e.x>c.x&&(c=e),e.depth>f.depth&&(f=e)}));var d=l===c?1:e(l,c)/2,h=d-l.x,p=t/(c.x+d+h),m=n/(f.depth||1);r.eachBefore((function(e){e.x=(e.x+h)*p,e.y=e.depth*m}))}return r}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n){!function(e){for(var t,n=0,i=0,r=e.children,o=r.length;--o>=0;)(t=r[o]).z+=n,t.m+=n,n+=t.s+(i+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,o=t,a=t,s=n,u=o.parent.children[0],l=o.m,c=a.m,f=s.m,d=u.m;s=ww(s),o=xw(o),s&&o;)u=xw(u),(a=ww(a)).a=t,(r=s.z+f-o.z-l+e(s._,o._))>0&&(_w(Aw(s,t,i),t,r),l+=r,c+=r),f+=s.m,l+=o.m,d+=u.m,c+=a.m;s&&!ww(a)&&(a.t=s,a.m+=f-c),o&&!xw(u)&&(u.t=o,u.m+=l-d,i=t)}return i}(t,r,t.parent.A||i[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(e){e.x*=t,e.y=e.depth*n}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r},cluster:function(){var e=Bx,t=1,n=1,i=!1;function r(r){var o,a=0;r.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(zx,0)/e.length}(n),t.y=function(e){return 1+e.reduce(Ox,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var s=function(e){for(var t;t=e.children;)e=t[0];return e}(r),u=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(r),l=s.x-e(s,u)/2,c=u.x+e(u,s)/2;return r.eachAfter(i?function(e){e.x=(e.x-r.x)*t,e.y=(r.y-e.y)*n}:function(e){e.x=(e.x-l)/(c-l)*t,e.y=(1-(r.y?e.y/r.y:1))*n})}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(e){return arguments.length?(i=!1,t=+e[0],n=+e[1],r):i?null:[t,n]},r.nodeSize=function(e){return arguments.length?(i=!0,t=+e[0],n=+e[1],r):i?[t,n]:null},r}},Uw=["x","y","depth","children"];function Iw(e){Ow.call(this,e)}function Ww(e){fr.call(this,[],e)}Iw.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:Uw.length,default:Uw}]},t(Iw,Ow,{layout(e){const t=e||"tidy";if(c(qw,t))return qw[t]();d("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:Uw}),Ww.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},t(Ww,fr,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||d("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(e=>o[Bi(e)]=1)),i.each((e=>{const t=e.data,n=e.parent&&e.parent.data;n&&o[Bi(t)]&&o[Bi(n)]&&r.add.push(Oi({source:n,target:t}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(e=>o[Bi(e)]=1)),n.forEach((e=>{(o[Bi(e.source)]||o[Bi(e.target)])&&r.mod.push(e)}))),r}});const Hw={binary:function(e,t,n,i,r){var o,a,s=e.children,u=s.length,l=new Array(u+1);for(l[0]=a=o=0;o<u;++o)l[o+1]=a+=s[o].value;!function e(t,n,i,r,o,a,u){if(t>=n-1){var c=s[t];return c.x0=r,c.y0=o,c.x1=a,void(c.y1=u)}var f=l[t],d=i/2+f,h=t+1,p=n-1;for(;h<p;){var m=h+p>>>1;l[m]<d?h=m+1:p=m}d-l[h-1]<l[h]-d&&t+1<h&&--h;var g=l[h]-f,y=i-g;if(a-r>u-o){var v=i?(r*y+a*g)/i:a;e(t,h,g,r,o,v,u),e(h,n,y,v,o,a,u)}else{var b=i?(o*y+u*g)/i:u;e(t,h,g,r,o,a,b),e(h,n,y,r,b,a,u)}}(0,u,e.value,t,n,i,r)},dice:cw,slice:Dw,slicedice:function(e,t,n,i,r){(1&e.depth?Dw:cw)(e,t,n,i,r)},squarify:Ew,resquarify:$w},Gw=["x0","y0","x1","y1","depth","children"];function Vw(e){Ow.call(this,e)}Vw.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:Gw.length,default:Gw}]},t(Vw,Ow,{layout(){const e=function(){var e=Ew,t=!1,n=1,i=1,r=[0],o=Wx,a=Wx,s=Wx,u=Wx,l=Wx;function c(e){return e.x0=e.y0=0,e.x1=n,e.y1=i,e.eachBefore(f),r=[0],t&&e.eachBefore(lw),e}function f(t){var n=r[t.depth],i=t.x0+n,c=t.y0+n,f=t.x1-n,d=t.y1-n;f<i&&(i=f=(i+f)/2),d<c&&(c=d=(c+d)/2),t.x0=i,t.y0=c,t.x1=f,t.y1=d,t.children&&(n=r[t.depth+1]=o(t)/2,i+=l(t)-n,c+=a(t)-n,(f-=s(t)-n)<i&&(i=f=(i+f)/2),(d-=u(t)-n)<c&&(c=d=(c+d)/2),e(t,i,c,f,d))}return c.round=function(e){return arguments.length?(t=!!e,c):t},c.size=function(e){return arguments.length?(n=+e[0],i=+e[1],c):[n,i]},c.tile=function(t){return arguments.length?(e=Ix(t),c):e},c.padding=function(e){return arguments.length?c.paddingInner(e).paddingOuter(e):c.paddingInner()},c.paddingInner=function(e){return arguments.length?(o="function"==typeof e?e:Hx(+e),c):o},c.paddingOuter=function(e){return arguments.length?c.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):c.paddingTop()},c.paddingTop=function(e){return arguments.length?(a="function"==typeof e?e:Hx(+e),c):a},c.paddingRight=function(e){return arguments.length?(s="function"==typeof e?e:Hx(+e),c):s},c.paddingBottom=function(e){return arguments.length?(u="function"==typeof e?e:Hx(+e),c):u},c.paddingLeft=function(e){return arguments.length?(l="function"==typeof e?e:Hx(+e),c):l},c}();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{c(Hw,t)?e.tile(Hw[t]):d("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:Gw});const Yw=Object.freeze(Object.defineProperty({__proto__:null,nest:Mw,pack:Tw,partition:jw,stratify:Lw,tree:Iw,treelinks:Ww,treemap:Vw},Symbol.toStringTag,{value:"Module"})),Xw=4278190080;function Jw(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function Kw(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;"group"===i?t.forEach((t=>{t.items.forEach((t=>Kw(e,t.items,n)))})):Cf[i].draw(e,{items:n?t.map(Qw):t})}function Qw(e){const t=Ri(e,{});return t.stroke&&0!==t.strokeOpacity||t.fill&&0!==t.fillOpacity?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const Zw=31,e_=new Uint32Array(33),t_=new Uint32Array(33);t_[0]=0,e_[0]=~t_[0];for(let KV=1;KV<=32;++KV)t_[KV]=t_[KV-1]<<1|1,e_[KV]=~t_[KV];function n_(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),o=~~((t+2*n+i)/i),a=e=>~~((e+n)/i);return a.invert=e=>e*i-n,a.bitmap=()=>function(e,t){const n=new Uint32Array(~~((e*t+32)/32));function i(e,t){n[e]|=t}function r(e,t){n[e]&=t}return{array:n,get:(t,i)=>{const r=i*e+t;return n[r>>>5]&1<<(r&Zw)},set:(t,n)=>{const r=n*e+t;i(r>>>5,1<<(r&Zw))},clear:(t,n)=>{const i=n*e+t;r(i>>>5,~(1<<(i&Zw)))},getRange:(t,i,r,o)=>{let a,s,u,l,c=o;for(;c>=i;--c)if(a=c*e+t,s=c*e+r,u=a>>>5,l=s>>>5,u===l){if(n[u]&e_[a&Zw]&t_[1+(s&Zw)])return!0}else{if(n[u]&e_[a&Zw])return!0;if(n[l]&t_[1+(s&Zw)])return!0;for(let e=u+1;e<l;++e)if(n[e])return!0}return!1},setRange:(t,n,r,o)=>{let a,s,u,l,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+r,u=a>>>5,l=s>>>5,u===l)i(u,e_[a&Zw]&t_[1+(s&Zw)]);else for(i(u,e_[a&Zw]),i(l,t_[1+(s&Zw)]),c=u+1;c<l;++c)i(c,4294967295)},clearRange:(t,n,i,o)=>{let a,s,u,l,c;for(;n<=o;++n)if(a=n*e+t,s=n*e+i,u=a>>>5,l=s>>>5,u===l)r(u,t_[a&Zw]|e_[1+(s&Zw)]);else for(r(u,t_[a&Zw]),r(l,e_[1+(s&Zw)]),c=u+1;c<l;++c)r(c,0)},outOfBounds:(n,i,r,o)=>n<0||i<0||o>=t||r>=e}}(r,o),a.ratio=i,a.padding=n,a.width=e,a.height=t,a}function i_(e,t,n,i,r,o){let a=n/2;return e-a<0||e+a>r||t-(a=i/2)<0||t+a>o}function r_(e,t,n,i,r,o,a,s){const u=r*o/(2*i),l=e(t-u),c=e(t+u),f=e(n-(o/=2)),d=e(n+o);return a.outOfBounds(l,f,c,d)||a.getRange(l,f,c,d)||s&&s.getRange(l,f,c,d)}const o_=[-1,-1,1,1],a_=[-1,1,-1,1];const s_=["right","center","left"],u_=["bottom","middle","top"];function l_(e,t,n,i,r,o,a,s,u,l,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const c_={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},f_={naive:function(e,t,n,i){const r=e.width,o=e.height;return function(e){const t=e.datum.datum.items[i].items,n=t.length,a=e.datum.fontSize,s=uf.width(e.datum,e.datum.text);let u,l,c,f,d,h,p,m=0;for(let i=0;i<n;++i)u=t[i].x,c=t[i].y,l=void 0===t[i].x2?u:t[i].x2,f=void 0===t[i].y2?c:t[i].y2,d=(u+l)/2,h=(c+f)/2,p=Math.abs(l-u+f-c),p>=m&&(m=p,e.x=d,e.y=h);return d=s/2,h=a/2,u=e.x-d,l=e.x+d,c=e.y-h,f=e.y+h,e.align="center",u<0&&l<=r?e.align="left":0<=u&&r<l&&(e.align="right"),e.baseline="middle",c<0&&f<=o?e.baseline="top":0<=c&&o<f&&(e.baseline="bottom"),!0}},"reduced-search":function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1];function u(t,n,i,u,l){const c=e.invert(t),f=e.invert(n);let d,h=i,p=o;if(!i_(c,f,u,l,r,o)&&!r_(e,c,f,l,u,h,a,s)&&!r_(e,c,f,l,u,l,a,null)){for(;p-h>=1;)d=(h+p)/2,r_(e,c,f,l,u,d,a,s)?p=d:h=d;if(h>i)return[c,f,h,!0]}}return function(t){const s=t.datum.datum.items[i].items,l=s.length,c=t.datum.fontSize,f=uf.width(t.datum,t.datum.text);let d,h,p,m,g,y,v,b,x,w,_,A,k,D,F,C,E,$=n?c:0,S=!1,M=!1,B=0;for(let i=0;i<l;++i){for(d=s[i].x,p=s[i].y,h=void 0===s[i].x2?d:s[i].x2,m=void 0===s[i].y2?p:s[i].y2,d>h&&(E=d,d=h,h=E),p>m&&(E=p,p=m,m=E),x=e(d),_=e(h),w=~~((x+_)/2),A=e(p),D=e(m),k=~~((A+D)/2),v=w;v>=x;--v)for(b=k;b>=A;--b)C=u(v,b,$,f,c),C&&([t.x,t.y,$,S]=C);for(v=w;v<=_;++v)for(b=k;b<=D;++b)C=u(v,b,$,f,c),C&&([t.x,t.y,$,S]=C);S||n||(F=Math.abs(h-d+m-p),g=(d+h)/2,y=(p+m)/2,F>=B&&!i_(g,y,f,c,r,o)&&!r_(e,g,y,c,f,c,a,null)&&(B=F,t.x=g,t.y=y,M=!0))}return!(!S&&!M)&&(g=f/2,y=c/2,a.setRange(e(t.x-g),e(t.y-y),e(t.x+g),e(t.y+y)),t.align="center",t.baseline="middle",!0)}},floodfill:function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],u=e.bitmap();return function(t){const l=t.datum.datum.items[i].items,c=l.length,f=t.datum.fontSize,d=uf.width(t.datum,t.datum.text),h=[];let p,m,g,y,v,b,x,w,_,A,k,D,F=n?f:0,C=!1,E=!1,$=0;for(let i=0;i<c;++i){for(p=l[i].x,g=l[i].y,m=void 0===l[i].x2?p:l[i].x2,y=void 0===l[i].y2?g:l[i].y2,h.push([e((p+m)/2),e((g+y)/2)]);h.length;)if([x,w]=h.pop(),!(a.get(x,w)||s.get(x,w)||u.get(x,w))){u.set(x,w);for(let e=0;e<4;++e)v=x+o_[e],b=w+a_[e],u.outOfBounds(v,b,v,b)||h.push([v,b]);if(v=e.invert(x),b=e.invert(w),_=F,A=o,!i_(v,b,d,f,r,o)&&!r_(e,v,b,f,d,_,a,s)&&!r_(e,v,b,f,d,f,a,null)){for(;A-_>=1;)k=(_+A)/2,r_(e,v,b,f,d,k,a,s)?A=k:_=k;_>F&&(t.x=v,t.y=b,F=_,C=!0)}}C||n||(D=Math.abs(m-p+y-g),v=(p+m)/2,b=(g+y)/2,D>=$&&!i_(v,b,d,f,r,o)&&!r_(e,v,b,f,d,f,a,null)&&($=D,t.x=v,t.y=b,E=!0))}return!(!C&&!E)&&(v=d/2,b=f/2,a.setRange(e(t.x-v),e(t.y-b),e(t.x+v),e(t.y+b)),t.align="center",t.baseline="middle",!0)}}};function d_(e,t,n,i,r,o,a,s,u,l,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=function(e,t){const n=new Float64Array(t),i=e.length;for(let r=0;r<i;++r)n[r]=e[r]||0;for(let r=i;r<t;++r)n[r]=n[i-1];return n}(i,f),h=function(e,t){const n=new Int8Array(t),i=e.length;for(let r=0;r<i;++r)n[r]|=c_[e[r]];for(let r=i;r<t;++r)n[r]=n[i-1];return n}(r,f),p=(x=e[0].datum)&&x.mark&&x.mark.marktype,m="group"===p&&e[0].datum.items[u].marktype,g="area"===m,y=function(e,t,n,i){const r=e=>[e.x,e.x,e.x,e.y,e.y,e.y];return e?"line"===e||"area"===e?e=>r(e.datum):"line"===t?e=>{const t=e.datum.items[i].items;return r(t.length?t["start"===n?0:t.length-1]:{x:NaN,y:NaN})}:e=>{const t=e.datum.bounds;return[t.x1,(t.x1+t.x2)/2,t.x2,t.y1,(t.y1+t.y2)/2,t.y2]}:r}(p,m,s,u),v=null===l||l===1/0,b=g&&"naive"===c;var x;let w=-1,_=-1;const A=e.map((e=>{const t=v?uf.width(e,e.text):void 0;return w=Math.max(w,t),_=Math.max(_,e.fontSize),{datum:e,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(e),textWidth:t}}));l=null===l||l===1/0?Math.max(w,_)+Math.max(...i):l;const k=n_(t[0],t[1],l);let D;if(!b){n&&A.sort(((e,t)=>n(e.datum,t.datum)));let t=!1;for(let e=0;e<h.length&&!t;++e)t=5===h[e]||d[e]<0;const i=(p&&a||g)&&e.map((e=>e.datum));D=o.length||i?function(e,t,n,i,r){const o=e.width,a=e.height,s=i||r,u=Ta(o,a).getContext("2d"),l=Ta(o,a).getContext("2d"),c=s&&Ta(o,a).getContext("2d");n.forEach((e=>Kw(u,e,!1))),Kw(l,t,!1),s&&Kw(c,t,!0);const f=Jw(u,o,a),d=Jw(l,o,a),h=s&&Jw(c,o,a),p=e.bitmap(),m=s&&e.bitmap();let g,y,v,b,x,w,_,A;for(y=0;y<a;++y)for(g=0;g<o;++g)x=y*o+g,w=f[x]&Xw,A=d[x]&Xw,_=s&&h[x]&Xw,(w||_||A)&&(v=e(g),b=e(y),r||!w&&!A||p.set(v,b),s&&(w||_)&&m.set(v,b));return[p,m]}(k,i||[],o,t,g):function(e,t){const n=e.bitmap();return(t||[]).forEach((t=>n.set(e(t.boundary[0]),e(t.boundary[3])))),[n,void 0]}(k,a&&A)}const F=g?f_[c](k,D,a,u):function(e,t,n,i){const r=e.width,o=e.height,a=t[0],s=t[1],u=i.length;return function(t){const l=t.boundary,c=t.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>r||l[3]>o)return!1;let f,d,h,p,m,g,y,v,b,x,w,_,A,k,D,F=t.textWidth??0;for(let r=0;r<u;++r){if(f=(3&n[r])-1,d=(n[r]>>>2&3)-1,h=0===f&&0===d||i[r]<0,p=f&&d?Math.SQRT1_2:1,m=i[r]<0?-1:1,g=l[1+f]+i[r]*f*p,w=l[4+d]+m*c*d/2+i[r]*d*p,v=w-c/2,b=w+c/2,_=e(g),k=e(v),D=e(b),!F){if(!l_(_,_,k,D,a,s,0,0,0,0,0,h))continue;F=uf.width(t.datum,t.datum.text)}if(x=g+m*F*f/2,g=x-F/2,y=x+F/2,_=e(g),A=e(y),l_(_,A,k,D,a,s,0,0,0,0,0,h))return t.x=f?f*m<0?y:g:x,t.y=d?d*m<0?b:v:w,t.align=s_[f*m+1],t.baseline=u_[d*m+1],a.setRange(_,k,A,D),!0}return!1}}(k,D,h,d);return A.forEach((e=>e.opacity=+F(e))),A}const h_=["x","y","opacity","align","baseline"],p_=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function m_(e){fr.call(this,null,e)}m_.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:p_},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:h_.length,default:h_}]},t(m_,fr,{transform(e,t){const n=e.modified();if(!(n||t.changed(t.ADD_REM)||function(n){const i=e[n];return a(i)&&t.modified(i.fields)}("sort")))return;e.size&&2===e.size.length||d("Size parameter should be specified as a [width, height] array.");const i=e.as||h_;return d_(t.materialize(t.SOURCE).source||[],e.size,e.sort,u(null==e.offset?1:e.offset),u(e.anchor||p_),e.avoidMarks||[],!1!==e.avoidBaseMark,e.lineAnchor||"end",e.markIndex||0,void 0===e.padding?0:e.padding,e.method||"naive").forEach((e=>{const t=e.datum;t[i[0]]=e.x,t[i[1]]=e.y,t[i[2]]=e.opacity,t[i[3]]=e.align,t[i[4]]=e.baseline})),t.reflow(n).modifies(i)}});const g_=Object.freeze(Object.defineProperty({__proto__:null,label:m_},Symbol.toStringTag,{value:"Module"}));function y_(e,t){var n,i,r,o,a,s,u=[],l=function(e){return e(o)};if(null==t)u.push(e);else for(n={},i=0,r=e.length;i<r;++i)o=e[i],(s=n[a=t.map(l)])||(n[a]=s=[],s.dims=a,u.push(s)),s.push(o);return u}function v_(e){fr.call(this,null,e)}v_.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},t(v_,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=y_(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(x),o=r.length,a=e.as||[x(e.x),x(e.y)],s=[];i.forEach((t=>{to(t,e.x,e.y,e.bandwidth||.3).forEach((e=>{const n={};for(let i=0;i<o;++i)n[r[i]]=t.dims[i];n[a[0]]=e[0],n[a[1]]=e[1],s.push(Oi(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=s}return n}});const b_={constant:Ir,linear:Yr,log:Xr,exp:Jr,pow:Kr,quad:Qr,poly:Zr};function x_(e){fr.call(this,null,e)}x_.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(b_)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},t(x_,fr,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=y_(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(x),o=e.method||"linear",a=null==e.order?3:e.order,s=((e,t)=>"poly"===e?t:"quad"===e?2:1)(o,a),u=e.as||[x(e.x),x(e.y)],l=b_[o],f=[];let h=e.extent;c(b_,o)||d("Invalid regression method: "+o),null!=h&&"log"===o&&h[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),h=null),i.forEach((n=>{if(n.length<=s)return void t.dataflow.warn("Skipping regression with more parameters than data points.");const i=l(n,e.x,e.y,a);if(e.params)return void f.push(Oi({keys:n.dims,coef:i.coef,rSquared:i.rSquared}));const c=h||k(n,e.x),d=e=>{const t={};for(let i=0;i<r.length;++i)t[r[i]]=n.dims[i];t[u[0]]=e[0],t[u[1]]=e[1],f.push(Oi(t))};"linear"===o||"constant"===o?c.forEach((e=>d([e,i.predict(e)]))):oo(i.predict,c,25,200).forEach(d)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const w_=Object.freeze(Object.defineProperty({__proto__:null,loess:v_,regression:x_},Symbol.toStringTag,{value:"Module"})),__=134217729;function A_(e,t,n,i,r){let o,a,s,u,l=t[0],c=i[0],f=0,d=0;c>l==c>-l?(o=l,l=t[++f]):(o=c,c=i[++d]);let h=0;if(f<e&&d<n)for(c>l==c>-l?(a=l+o,s=o-(a-l),l=t[++f]):(a=c+o,s=o-(a-c),c=i[++d]),o=a,0!==s&&(r[h++]=s);f<e&&d<n;)c>l==c>-l?(a=o+l,u=a-o,s=o-(a-u)+(l-u),l=t[++f]):(a=o+c,u=a-o,s=o-(a-u)+(c-u),c=i[++d]),o=a,0!==s&&(r[h++]=s);for(;f<e;)a=o+l,u=a-o,s=o-(a-u)+(l-u),l=t[++f],o=a,0!==s&&(r[h++]=s);for(;d<n;)a=o+c,u=a-o,s=o-(a-u)+(c-u),c=i[++d],o=a,0!==s&&(r[h++]=s);return 0===o&&0!==h||(r[h++]=o),h}function k_(e){return new Float64Array(e)}const D_=k_(4),F_=k_(8),C_=k_(12),E_=k_(16),$_=k_(4);function S_(e,t,n,i,r,o){const a=(t-o)*(n-r),s=(e-r)*(i-o),u=a-s,l=Math.abs(a+s);return Math.abs(u)>=33306690738754716e-32*l?u:-function(e,t,n,i,r,o,a){let s,u,l,c,f,d,h,p,m,g,y,v,b,x,w,_,A,k;const D=e-r,F=n-r,C=t-o,E=i-o;x=D*E,d=__*D,h=d-(d-D),p=D-h,d=__*E,m=d-(d-E),g=E-m,w=p*g-(x-h*m-p*m-h*g),_=C*F,d=__*C,h=d-(d-C),p=C-h,d=__*F,m=d-(d-F),g=F-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,D_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,D_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,D_[2]=v-(k-f)+(y-f),D_[3]=k;let $=function(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}(4,D_),S=22204460492503146e-32*a;if($>=S||-$>=S)return $;if(f=e-D,s=e-(D+f)+(f-r),f=n-F,l=n-(F+f)+(f-r),f=t-C,u=t-(C+f)+(f-o),f=i-E,c=i-(E+f)+(f-o),0===s&&0===u&&0===l&&0===c)return $;if(S=11093356479670487e-47*a+33306690738754706e-32*Math.abs($),$+=D*c+E*s-(C*l+F*u),$>=S||-$>=S)return $;x=s*E,d=__*s,h=d-(d-s),p=s-h,d=__*E,m=d-(d-E),g=E-m,w=p*g-(x-h*m-p*m-h*g),_=u*F,d=__*u,h=d-(d-u),p=u-h,d=__*F,m=d-(d-F),g=F-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,$_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,$_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,$_[2]=v-(k-f)+(y-f),$_[3]=k;const M=A_(4,D_,4,$_,F_);x=D*c,d=__*D,h=d-(d-D),p=D-h,d=__*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=C*l,d=__*C,h=d-(d-C),p=C-h,d=__*l,m=d-(d-l),g=l-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,$_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,$_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,$_[2]=v-(k-f)+(y-f),$_[3]=k;const B=A_(M,F_,4,$_,C_);x=s*c,d=__*s,h=d-(d-s),p=s-h,d=__*c,m=d-(d-c),g=c-m,w=p*g-(x-h*m-p*m-h*g),_=u*l,d=__*u,h=d-(d-u),p=u-h,d=__*l,m=d-(d-l),g=l-m,A=p*g-(_-h*m-p*m-h*g),y=w-A,f=w-y,$_[0]=w-(y+f)+(f-A),v=x+y,f=v-x,b=x-(v-f)+(y-f),y=b-_,f=b-y,$_[1]=b-(y+f)+(f-_),k=v+y,f=k-v,$_[2]=v-(k-f)+(y-f),$_[3]=k;const z=A_(B,C_,4,$_,E_);return E_[z-1]}(e,t,n,i,r,o,l)}const M_=Math.pow(2,-52),B_=new Uint32Array(512);class z_{static from(e,t=j_,n=L_){const i=e.length,r=new Float64Array(2*i);for(let o=0;o<i;o++){const i=e[o];r[2*o]=t(i),r[2*o+1]=n(i)}return new z_(r)}constructor(e){const t=e.length>>1;if(t>0&&"number"!=typeof e[0])throw new Error("Expected coords to contain numbers.");this.coords=e;const n=Math.max(2*t-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(t)),this._hullPrev=new Uint32Array(t),this._hullNext=new Uint32Array(t),this._hullTri=new Uint32Array(t),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(t),this._dists=new Float64Array(t),this.update()}update(){const{coords:e,_hullPrev:t,_hullNext:n,_hullTri:i,_hullHash:r}=this,o=e.length>>1;let a=1/0,s=1/0,u=-1/0,l=-1/0;for(let D=0;D<o;D++){const t=e[2*D],n=e[2*D+1];t<a&&(a=t),n<s&&(s=n),t>u&&(u=t),n>l&&(l=n),this._ids[D]=D}const c=(a+u)/2,f=(s+l)/2;let d,h,p,m=1/0;for(let D=0;D<o;D++){const t=O_(c,f,e[2*D],e[2*D+1]);t<m&&(d=D,m=t)}const g=e[2*d],y=e[2*d+1];m=1/0;for(let D=0;D<o;D++){if(D===d)continue;const t=O_(g,y,e[2*D],e[2*D+1]);t<m&&t>0&&(h=D,m=t)}let v=e[2*h],b=e[2*h+1],x=1/0;for(let D=0;D<o;D++){if(D===d||D===h)continue;const t=R_(g,y,v,b,e[2*D],e[2*D+1]);t<x&&(p=D,x=t)}let w=e[2*p],_=e[2*p+1];if(x===1/0){for(let i=0;i<o;i++)this._dists[i]=e[2*i]-e[0]||e[2*i+1]-e[1];T_(this._ids,this._dists,0,o-1);const t=new Uint32Array(o);let n=0;for(let e=0,i=-1/0;e<o;e++){const r=this._ids[e];this._dists[r]>i&&(t[n++]=r,i=this._dists[r])}return this.hull=t.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(S_(g,y,v,b,w,_)<0){const e=h,t=v,n=b;h=p,v=w,b=_,p=e,w=t,_=n}const A=function(e,t,n,i,r,o){const a=n-e,s=i-t,u=r-e,l=o-t,c=a*a+s*s,f=u*u+l*l,d=.5/(a*l-s*u),h=e+(l*c-s*f)*d;return{x:h,y:t+(a*f-u*c)*d}}(g,y,v,b,w,_);this._cx=A.x,this._cy=A.y;for(let D=0;D<o;D++)this._dists[D]=O_(e[2*D],e[2*D+1],A.x,A.y);T_(this._ids,this._dists,0,o-1),this._hullStart=d;let k=3;n[d]=t[p]=h,n[h]=t[d]=p,n[p]=t[h]=d,i[d]=0,i[h]=1,i[p]=2,r.fill(-1),r[this._hashKey(g,y)]=d,r[this._hashKey(v,b)]=h,r[this._hashKey(w,_)]=p,this.trianglesLen=0,this._addTriangle(d,h,p,-1,-1,-1);for(let D,F,C=0;C<this._ids.length;C++){const o=this._ids[C],a=e[2*o],s=e[2*o+1];if(C>0&&Math.abs(a-D)<=M_&&Math.abs(s-F)<=M_)continue;if(D=a,F=s,o===d||o===h||o===p)continue;let u=0;for(let e=0,t=this._hashKey(a,s);e<this._hashSize&&(u=r[(t+e)%this._hashSize],-1===u||u===n[u]);e++);u=t[u];let l,c=u;for(;l=n[c],S_(a,s,e[2*c],e[2*c+1],e[2*l],e[2*l+1])>=0;)if(c=l,c===u){c=-1;break}if(-1===c)continue;let f=this._addTriangle(c,o,n[c],-1,-1,i[c]);i[o]=this._legalize(f+2),i[c]=f,k++;let m=n[c];for(;l=n[m],S_(a,s,e[2*m],e[2*m+1],e[2*l],e[2*l+1])<0;)f=this._addTriangle(m,o,l,i[o],-1,i[m]),i[o]=this._legalize(f+2),n[m]=m,k--,m=l;if(c===u)for(;l=t[c],S_(a,s,e[2*l],e[2*l+1],e[2*c],e[2*c+1])<0;)f=this._addTriangle(l,o,c,-1,i[c],i[l]),this._legalize(f+2),i[l]=f,n[c]=c,k--,c=l;this._hullStart=t[o]=c,n[c]=t[m]=o,n[o]=m,r[this._hashKey(a,s)]=o,r[this._hashKey(e[2*c],e[2*c+1])]=c}this.hull=new Uint32Array(k);for(let D=0,F=this._hullStart;D<k;D++)this.hull[D]=F,F=n[F];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(function(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}(e-this._cx,t-this._cy)*this._hashSize)%this._hashSize}_legalize(e){const{_triangles:t,_halfedges:n,coords:i}=this;let r=0,o=0;for(;;){const a=n[e],s=e-e%3;if(o=s+(e+2)%3,-1===a){if(0===r)break;e=B_[--r];continue}const u=a-a%3,l=s+(e+1)%3,c=u+(a+2)%3,f=t[o],d=t[e],h=t[l],p=t[c];if(N_(i[2*f],i[2*f+1],i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1])){t[e]=p,t[a]=f;const i=n[c];if(-1===i){let t=this._hullStart;do{if(this._hullTri[t]===c){this._hullTri[t]=e;break}t=this._hullPrev[t]}while(t!==this._hullStart)}this._link(e,i),this._link(a,n[o]),this._link(o,c);const s=u+(a+1)%3;r<B_.length&&(B_[r++]=s)}else{if(0===r)break;e=B_[--r]}}return o}_link(e,t){this._halfedges[e]=t,-1!==t&&(this._halfedges[t]=e)}_addTriangle(e,t,n,i,r,o){const a=this.trianglesLen;return this._triangles[a]=e,this._triangles[a+1]=t,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,r),this._link(a+2,o),this.trianglesLen+=3,a}}function O_(e,t,n,i){const r=e-n,o=t-i;return r*r+o*o}function N_(e,t,n,i,r,o,a,s){const u=e-a,l=t-s,c=n-a,f=i-s,d=r-a,h=o-s,p=c*c+f*f,m=d*d+h*h;return u*(f*m-p*h)-l*(c*m-p*d)+(u*u+l*l)*(c*h-f*d)<0}function R_(e,t,n,i,r,o){const a=n-e,s=i-t,u=r-e,l=o-t,c=a*a+s*s,f=u*u+l*l,d=.5/(a*l-s*u),h=(l*c-s*f)*d,p=(a*f-u*c)*d;return h*h+p*p}function T_(e,t,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const i=e[r],o=t[i];let a=r-1;for(;a>=n&&t[e[a]]>o;)e[a+1]=e[a--];e[a+1]=i}else{let r=n+1,o=i;P_(e,n+i>>1,r),t[e[n]]>t[e[i]]&&P_(e,n,i),t[e[r]]>t[e[i]]&&P_(e,r,i),t[e[n]]>t[e[r]]&&P_(e,n,r);const a=e[r],s=t[a];for(;;){do{r++}while(t[e[r]]<s);do{o--}while(t[e[o]]>s);if(o<r)break;P_(e,r,o)}e[n+1]=e[o],e[o]=a,i-r+1>=o-n?(T_(e,t,r,i),T_(e,t,n,o-1)):(T_(e,t,n,o-1),T_(e,t,r,i))}}function P_(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function j_(e){return e[0]}function L_(e){return e[1]}const q_=1e-6;class U_{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(e,t){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(e,t){this._+=`L${this._x1=+e},${this._y1=+t}`}arc(e,t,n){const i=(e=+e)+(n=+n),r=t=+t;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${i},${r}`:(Math.abs(this._x1-i)>q_||Math.abs(this._y1-r)>q_)&&(this._+="L"+i+","+r),n&&(this._+=`A${n},${n},0,1,1,${e-n},${t}A${n},${n},0,1,1,${this._x1=i},${this._y1=r}`)}rect(e,t,n,i){this._+=`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${+n}v${+i}h${-n}Z`}value(){return this._||null}}class I_{constructor(){this._=[]}moveTo(e,t){this._.push([e,t])}closePath(){this._.push(this._[0].slice())}lineTo(e,t){this._.push([e,t])}value(){return this._.length?this._:null}}let W_=class{constructor(e,[t,n,i,r]=[0,0,960,500]){if(!((i=+i)>=(t=+t)&&(r=+r)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=e,this._circumcenters=new Float64Array(2*e.points.length),this.vectors=new Float64Array(2*e.points.length),this.xmax=i,this.xmin=t,this.ymax=r,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:e,hull:t,triangles:n},vectors:i}=this;let r,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let p,m,g=0,y=0,v=n.length;g<v;g+=3,y+=2){const i=2*n[g],s=2*n[g+1],u=2*n[g+2],l=e[i],c=e[i+1],f=e[s],d=e[s+1],h=e[u],v=e[u+1],b=f-l,x=d-c,w=h-l,_=v-c,A=2*(b*_-x*w);if(Math.abs(A)<1e-9){if(void 0===r){r=o=0;for(const n of t)r+=e[2*n],o+=e[2*n+1];r/=t.length,o/=t.length}const n=1e9*Math.sign((r-l)*_-(o-c)*w);p=(l+h)/2-n*_,m=(c+v)/2+n*w}else{const e=1/A,t=b*b+x*x,n=w*w+_*_;p=l+(_*t-x*n)*e,m=c+(b*n-w*t)*e}a[y]=p,a[y+1]=m}let s,u,l,c=t[t.length-1],f=4*c,d=e[2*c],h=e[2*c+1];i.fill(0);for(let p=0;p<t.length;++p)c=t[p],s=f,u=d,l=h,f=4*c,d=e[2*c],h=e[2*c+1],i[s+2]=i[f]=l-h,i[s+3]=i[f+1]=d-u}render(e){const t=null==e?e=new U_:void 0,{delaunay:{halfedges:n,inedges:i,hull:r},circumcenters:o,vectors:a}=this;if(r.length<=1)return null;for(let l=0,c=n.length;l<c;++l){const t=n[l];if(t<l)continue;const i=2*Math.floor(l/3),r=2*Math.floor(t/3),a=o[i],s=o[i+1],u=o[r],c=o[r+1];this._renderSegment(a,s,u,c,e)}let s,u=r[r.length-1];for(let l=0;l<r.length;++l){s=u,u=r[l];const t=2*Math.floor(i[u]/3),n=o[t],c=o[t+1],f=4*s,d=this._project(n,c,a[f+2],a[f+3]);d&&this._renderSegment(n,c,d[0],d[1],e)}return t&&t.value()}renderBounds(e){const t=null==e?e=new U_:void 0;return e.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),t&&t.value()}renderCell(e,t){const n=null==t?t=new U_:void 0,i=this._clip(e);if(null===i||!i.length)return;t.moveTo(i[0],i[1]);let r=i.length;for(;i[0]===i[r-2]&&i[1]===i[r-1]&&r>1;)r-=2;for(let o=2;o<r;o+=2)i[o]===i[o-2]&&i[o+1]===i[o-1]||t.lineTo(i[o],i[o+1]);return t.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:e}}=this;for(let t=0,n=e.length/2;t<n;++t){const e=this.cellPolygon(t);e&&(e.index=t,yield e)}}cellPolygon(e){const t=new I_;return this.renderCell(e,t),t.value()}_renderSegment(e,t,n,i,r){let o;const a=this._regioncode(e,t),s=this._regioncode(n,i);0===a&&0===s?(r.moveTo(e,t),r.lineTo(n,i)):(o=this._clipSegment(e,t,n,i,a,s))&&(r.moveTo(o[0],o[1]),r.lineTo(o[2],o[3]))}contains(e,t,n){return(t=+t)==t&&(n=+n)==n&&this.delaunay._step(e,t,n)===e}*neighbors(e){const t=this._clip(e);if(t)for(const n of this.delaunay.neighbors(e)){const e=this._clip(n);if(e)e:for(let i=0,r=t.length;i<r;i+=2)for(let o=0,a=e.length;o<a;o+=2)if(t[i]===e[o]&&t[i+1]===e[o+1]&&t[(i+2)%r]===e[(o+a-2)%a]&&t[(i+3)%r]===e[(o+a-1)%a]){yield n;break e}}}_cell(e){const{circumcenters:t,delaunay:{inedges:n,halfedges:i,triangles:r}}=this,o=n[e];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(t[2*n],t[2*n+1]),s=s%3==2?s-2:s+1,r[s]!==e)break;s=i[s]}while(s!==o&&-1!==s);return a}_clip(e){if(0===e&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const t=this._cell(e);if(null===t)return null;const{vectors:n}=this,i=4*e;return this._simplify(n[i]||n[i+1]?this._clipInfinite(e,t,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(e,t))}_clipFinite(e,t){const n=t.length;let i,r,o,a,s=null,u=t[n-2],l=t[n-1],c=this._regioncode(u,l),f=0;for(let d=0;d<n;d+=2)if(i=u,r=l,u=t[d],l=t[d+1],o=c,c=this._regioncode(u,l),0===o&&0===c)a=f,f=0,s?s.push(u,l):s=[u,l];else{let t,n,d,h,p;if(0===o){if(null===(t=this._clipSegment(i,r,u,l,o,c)))continue;[n,d,h,p]=t}else{if(null===(t=this._clipSegment(u,l,i,r,c,o)))continue;[h,p,n,d]=t,a=f,f=this._edgecode(n,d),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(n,d):s=[n,d]}a=f,f=this._edgecode(h,p),a&&f&&this._edge(e,a,f,s,s.length),s?s.push(h,p):s=[h,p]}if(s)a=f,f=this._edgecode(s[0],s[1]),a&&f&&this._edge(e,a,f,s,s.length);else if(this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(e,t,n,i,r,o){const a=r<o;for(a&&([e,t,n,i,r,o]=[n,i,e,t,o,r]);;){if(0===r&&0===o)return a?[n,i,e,t]:[e,t,n,i];if(r&o)return null;let s,u,l=r||o;8&l?(s=e+(n-e)*(this.ymax-t)/(i-t),u=this.ymax):4&l?(s=e+(n-e)*(this.ymin-t)/(i-t),u=this.ymin):2&l?(u=t+(i-t)*(this.xmax-e)/(n-e),s=this.xmax):(u=t+(i-t)*(this.xmin-e)/(n-e),s=this.xmin),r?(e=s,t=u,r=this._regioncode(e,t)):(n=s,i=u,o=this._regioncode(n,i))}}_clipInfinite(e,t,n,i,r,o){let a,s=Array.from(t);if((a=this._project(s[0],s[1],n,i))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],r,o))&&s.push(a[0],a[1]),s=this._clipFinite(e,s))for(let u,l=0,c=s.length,f=this._edgecode(s[c-2],s[c-1]);l<c;l+=2)u=f,f=this._edgecode(s[l],s[l+1]),u&&f&&(l=this._edge(e,u,f,s,l),c=s.length);else this.contains(e,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(e,t,n,i,r){for(;t!==n;){let n,o;switch(t){case 5:t=4;continue;case 4:t=6,n=this.xmax,o=this.ymin;break;case 6:t=2;continue;case 2:t=10,n=this.xmax,o=this.ymax;break;case 10:t=8;continue;case 8:t=9,n=this.xmin,o=this.ymax;break;case 9:t=1;continue;case 1:t=5,n=this.xmin,o=this.ymin}i[r]===n&&i[r+1]===o||!this.contains(e,n,o)||(i.splice(r,0,n,o),r+=2)}return r}_project(e,t,n,i){let r,o,a,s=1/0;if(i<0){if(t<=this.ymin)return null;(r=(this.ymin-t)/i)<s&&(a=this.ymin,o=e+(s=r)*n)}else if(i>0){if(t>=this.ymax)return null;(r=(this.ymax-t)/i)<s&&(a=this.ymax,o=e+(s=r)*n)}if(n>0){if(e>=this.xmax)return null;(r=(this.xmax-e)/n)<s&&(o=this.xmax,a=t+(s=r)*i)}else if(n<0){if(e<=this.xmin)return null;(r=(this.xmin-e)/n)<s&&(o=this.xmin,a=t+(s=r)*i)}return[o,a]}_edgecode(e,t){return(e===this.xmin?1:e===this.xmax?2:0)|(t===this.ymin?4:t===this.ymax?8:0)}_regioncode(e,t){return(e<this.xmin?1:e>this.xmax?2:0)|(t<this.ymin?4:t>this.ymax?8:0)}_simplify(e){if(e&&e.length>4){for(let t=0;t<e.length;t+=2){const n=(t+2)%e.length,i=(t+4)%e.length;(e[t]===e[n]&&e[n]===e[i]||e[t+1]===e[n+1]&&e[n+1]===e[i+1])&&(e.splice(n,2),t-=2)}e.length||(e=null)}return e}};const H_=2*Math.PI,G_=Math.pow;function V_(e){return e[0]}function Y_(e){return e[1]}function X_(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class J_{static from(e,t=V_,n=Y_,i){return new J_("length"in e?function(e,t,n,i){const r=e.length,o=new Float64Array(2*r);for(let a=0;a<r;++a){const r=e[a];o[2*a]=t.call(i,r,a,e),o[2*a+1]=n.call(i,r,a,e)}return o}(e,t,n,i):Float64Array.from(function*(e,t,n,i){let r=0;for(const o of e)yield t.call(i,o,r,e),yield n.call(i,o,r,e),++r}(e,t,n,i)))}constructor(e){this._delaunator=new z_(e),this.inedges=new Int32Array(e.length/2),this._hullIndex=new Int32Array(e.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const e=this._delaunator,t=this.points;if(e.hull&&e.hull.length>2&&function(e){const{triangles:t,coords:n}=e;for(let i=0;i<t.length;i+=3){const e=2*t[i],r=2*t[i+1],o=2*t[i+2];if((n[o]-n[e])*(n[r+1]-n[e+1])-(n[r]-n[e])*(n[o+1]-n[e+1])>1e-10)return!1}return!0}(e)){this.collinear=Int32Array.from({length:t.length/2},((e,t)=>t)).sort(((e,n)=>t[2*e]-t[2*n]||t[2*e+1]-t[2*n+1]));const e=this.collinear[0],n=this.collinear[this.collinear.length-1],i=[t[2*e],t[2*e+1],t[2*n],t[2*n+1]],r=1e-8*Math.hypot(i[3]-i[1],i[2]-i[0]);for(let o=0,a=t.length/2;o<a;++o){const e=X_(t[2*o],t[2*o+1],r);t[2*o]=e[0],t[2*o+1]=e[1]}this._delaunator=new z_(t)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,r=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let s=0,u=n.length;s<u;++s){const e=r[s%3==2?s-2:s+1];-1!==n[s]&&-1!==o[e]||(o[e]=s)}for(let s=0,u=i.length;s<u;++s)a[i[s]]=s;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],o[i[0]]=1,2===i.length&&(o[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(e){return new W_(this,e)}*neighbors(e){const{inedges:t,hull:n,_hullIndex:i,halfedges:r,triangles:o,collinear:a}=this;if(a){const t=a.indexOf(e);return t>0&&(yield a[t-1]),void(t<a.length-1&&(yield a[t+1]))}const s=t[e];if(-1===s)return;let u=s,l=-1;do{if(yield l=o[u],u=u%3==2?u-2:u+1,o[u]!==e)return;if(u=r[u],-1===u){const t=n[(i[e]+1)%n.length];return void(t!==l&&(yield t))}}while(u!==s)}find(e,t,n=0){if((e=+e)!=e||(t=+t)!=t)return-1;const i=n;let r;for(;(r=this._step(n,e,t))>=0&&r!==n&&r!==i;)n=r;return r}_step(e,t,n){const{inedges:i,hull:r,_hullIndex:o,halfedges:a,triangles:s,points:u}=this;if(-1===i[e]||!u.length)return(e+1)%(u.length>>1);let l=e,c=G_(t-u[2*e],2)+G_(n-u[2*e+1],2);const f=i[e];let d=f;do{let i=s[d];const f=G_(t-u[2*i],2)+G_(n-u[2*i+1],2);if(f<c&&(c=f,l=i),d=d%3==2?d-2:d+1,s[d]!==e)break;if(d=a[d],-1===d){if(d=r[(o[e]+1)%r.length],d!==i&&G_(t-u[2*d],2)+G_(n-u[2*d+1],2)<c)return d;break}}while(d!==f);return l}render(e){const t=null==e?e=new U_:void 0,{points:n,halfedges:i,triangles:r}=this;for(let o=0,a=i.length;o<a;++o){const t=i[o];if(t<o)continue;const a=2*r[o],s=2*r[t];e.moveTo(n[a],n[a+1]),e.lineTo(n[s],n[s+1])}return this.renderHull(e),t&&t.value()}renderPoints(e,t){void 0!==t||e&&"function"==typeof e.moveTo||(t=e,e=null),t=null==t?2:+t;const n=null==e?e=new U_:void 0,{points:i}=this;for(let r=0,o=i.length;r<o;r+=2){const n=i[r],o=i[r+1];e.moveTo(n+t,o),e.arc(n,o,t,0,H_)}return n&&n.value()}renderHull(e){const t=null==e?e=new U_:void 0,{hull:n,points:i}=this,r=2*n[0],o=n.length;e.moveTo(i[r],i[r+1]);for(let a=1;a<o;++a){const t=2*n[a];e.lineTo(i[t],i[t+1])}return e.closePath(),t&&t.value()}hullPolygon(){const e=new I_;return this.renderHull(e),e.value()}renderTriangle(e,t){const n=null==t?t=new U_:void 0,{points:i,triangles:r}=this,o=2*r[e*=3],a=2*r[e+1],s=2*r[e+2];return t.moveTo(i[o],i[o+1]),t.lineTo(i[a],i[a+1]),t.lineTo(i[s],i[s+1]),t.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:e}=this;for(let t=0,n=e.length/3;t<n;++t)yield this.trianglePolygon(t)}trianglePolygon(e){const t=new I_;return this.renderTriangle(e,t),t.value()}}function K_(e){fr.call(this,null,e)}K_.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const Q_=[-1e5,-1e5,1e5,1e5];function Z_(e){const t=e[0][0],n=e[0][1];let i=e.length-1;for(;e[i][0]===t&&e[i][1]===n;--i);return"M"+e.slice(0,i+1).join("L")+"Z"}t(K_,fr,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:Q_;const o=this.value=J_.from(i,e.x,e.y).voronoi(r);for(let s=0,u=i.length;s<u;++s){const e=o.cellPolygon(s);i[s][n]=e&&(2!==(a=e).length||a[0][0]!==a[1][0]||a[0][1]!==a[1][1])?Z_(e):null}var a;return t.reflow(e.modified()).modifies(n)}});const eA=Object.freeze(Object.defineProperty({__proto__:null,voronoi:K_},Symbol.toStringTag,{value:"Module"}));var tA=Math.PI/180,nA=2048;function iA(){var e,t,n,i,r,o,a,s=[256,256],u=sA,l=[],c=Math.random,f={};function d(e,t,n){for(var i,r,o,a,l,f=t.x,d=t.y,h=Math.hypot(s[0],s[1]),p=u(s),m=c()<.5?1:-1,g=-m;(i=p(g+=m))&&(r=~~i[0],o=~~i[1],!(Math.min(Math.abs(r),Math.abs(o))>=h));)if(t.x=f+r,t.y=d+o,!(t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>s[0]||t.y+t.y1>s[1]||n&&oA(t,e,s[0])||n&&(l=n,!((a=t).x+a.x1>l[0].x&&a.x+a.x0<l[1].x&&a.y+a.y1>l[0].y&&a.y+a.y0<l[1].y)))){for(var y,v=t.sprite,b=t.width>>5,x=s[0]>>5,w=t.x-(b<<4),_=127&w,A=32-_,k=t.y1-t.y0,D=(t.y+t.y0)*x+(w>>5),F=0;F<k;F++){y=0;for(var C=0;C<=b;C++)e[D+C]|=y<<A|(C<b?(y=v[F*b+C])>>>_:0);D+=x}return t.sprite=null,!0}return!1}return f.layout=function(){for(var u=function(e){e.width=e.height=1;var t=Math.sqrt(e.getContext("2d").getImageData(0,0,1,1).data.length>>2);e.width=2048/t,e.height=nA/t;var n=e.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:t}}(Ta()),f=function(e){var t=[],n=-1;for(;++n<e;)t[n]=0;return t}((s[0]>>5)*s[1]),h=null,p=l.length,m=-1,g=[],y=l.map((s=>({text:e(s),font:t(s),style:i(s),weight:r(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((e,t)=>t.size-e.size));++m<p;){var v=y[m];v.x=s[0]*(c()+.5)>>1,v.y=s[1]*(c()+.5)>>1,rA(u,v,y,m),v.hasText&&d(f,v,h)&&(g.push(v),h?aA(h,v):h=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return g},f.words=function(e){return arguments.length?(l=e,f):l},f.size=function(e){return arguments.length?(s=[+e[0],+e[1]],f):s},f.font=function(e){return arguments.length?(t=uA(e),f):t},f.fontStyle=function(e){return arguments.length?(i=uA(e),f):i},f.fontWeight=function(e){return arguments.length?(r=uA(e),f):r},f.rotate=function(e){return arguments.length?(o=uA(e),f):o},f.text=function(t){return arguments.length?(e=uA(t),f):e},f.spiral=function(e){return arguments.length?(u=lA[e]||e,f):u},f.fontSize=function(e){return arguments.length?(n=uA(e),f):n},f.padding=function(e){return arguments.length?(a=uA(e),f):a},f.random=function(e){return arguments.length?(c=e,f):c},f}function rA(e,t,n,i){if(!t.sprite){var r=e.context,o=e.ratio;r.clearRect(0,0,2048/o,nA/o);var a,s,u,l,c,f=0,d=0,h=0,p=n.length;for(--i;++i<p;){if(t=n[i],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/o)+"px "+t.font,a=r.measureText(t.text+"m").width*o,u=t.size<<1,t.rotate){var m=Math.sin(t.rotate*tA),g=Math.cos(t.rotate*tA),y=a*g,v=a*m,b=u*g,x=u*m;a=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,u=~~Math.max(Math.abs(v+b),Math.abs(v-b))}else a=a+31>>5<<5;if(u>h&&(h=u),f+a>=2048&&(f=0,d+=h,h=0),d+u>=nA)break;r.translate((f+(a>>1))/o,(d+(u>>1))/o),t.rotate&&r.rotate(t.rotate*tA),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=a,t.height=u,t.xoff=f,t.yoff=d,t.x1=a>>1,t.y1=u>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,f+=a}for(var w=r.getImageData(0,0,2048/o,nA/o).data,_=[];--i>=0;)if((t=n[i]).hasText){for(s=(a=t.width)>>5,u=t.y1-t.y0,l=0;l<u*s;l++)_[l]=0;if(null==(f=t.xoff))return;d=t.yoff;var A=0,k=-1;for(c=0;c<u;c++){for(l=0;l<a;l++){var D=s*c+(l>>5),F=w[2048*(d+c)+(f+l)<<2]?1<<31-l%32:0;_[D]|=F,A|=F}A?k=c:(t.y0++,u--,c--,d++)}t.y1=t.y0+k,t.sprite=_.slice(0,(t.y1-t.y0)*s)}}}function oA(e,t,n){n>>=5;for(var i,r=e.sprite,o=e.width>>5,a=e.x-(o<<4),s=127&a,u=32-s,l=e.y1-e.y0,c=(e.y+e.y0)*n+(a>>5),f=0;f<l;f++){i=0;for(var d=0;d<=o;d++)if((i<<u|(d<o?(i=r[f*o+d])>>>s:0))&t[c+d])return!0;c+=n}return!1}function aA(e,t){var n=e[0],i=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function sA(e){var t=e[0]/e[1];return function(e){return[t*(e*=.1)*Math.cos(e),e*Math.sin(e)]}}function uA(e){return"function"==typeof e?e:function(){return e}}var lA={archimedean:sA,rectangular:function(e){var t=4*e[0]/e[1],n=0,i=0;return function(e){var r=e<0?-1:1;switch(Math.sqrt(1+4*r*e)-r&3){case 0:n+=t;break;case 1:i+=4;break;case 2:n-=t;break;default:i-=4}return[n,i]}}};const cA=["x","y","font","fontSize","fontStyle","fontWeight","angle"],fA=["text","font","rotate","fontSize","fontStyle","fontWeight"];function dA(e){fr.call(this,iA(),e)}dA.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:cA}]},t(dA,fr,{transform(e,t){!e.size||e.size[0]&&e.size[1]||d("Wordcloud size dimensions must be non-zero.");const n=e.modified();if(!(n||t.changed(t.ADD_REM)||fA.some((function(n){const i=e[n];return a(i)&&t.modified(i.fields)}))))return;const i=t.materialize(t.SOURCE).source,r=this.value,o=e.as||cA;let u,l=e.fontSize||14;if(a(l)?u=e.fontSizeRange:l=s(l),u){const e=l,t=Hs("sqrt")().domain(k(i,e)).range(u);l=n=>t(e(n))}i.forEach((e=>{e[o[0]]=NaN,e[o[1]]=NaN,e[o[3]]=0}));const c=r.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(xr).layout(),f=r.size(),h=f[0]>>1,p=f[1]>>1,m=c.length;for(let a,s,d=0;d<m;++d)a=c[d],s=a.datum,s[o[0]]=a.x+h,s[o[1]]=a.y+p,s[o[2]]=a.font,s[o[3]]=a.size,s[o[4]]=a.style,s[o[5]]=a.weight,s[o[6]]=a.rotate;return t.reflow(n).modifies(o)}});const hA=Object.freeze(Object.defineProperty({__proto__:null,wordcloud:dA},Symbol.toStringTag,{value:"Module"})),pA=e=>new Uint8Array(e),mA=e=>new Uint16Array(e),gA=e=>new Uint32Array(e);function yA(e,t,n){const i=(t<257?pA:t<65537?mA:gA)(e);return n&&i.set(n),i}function vA(e,t,n){const i=1<<t;return{one:i,zero:~i,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(e,t){const n=this,r=n.bisect(n.range,e.value),o=e.index,a=r[0],s=r[1],u=o.length;let l;for(l=0;l<a;++l)t[o[l]]|=i;for(l=s;l<u;++l)t[o[l]]|=i;return n}}}function bA(){let e=gA(0),t=[],n=0;return{insert:function(i,r,o){if(!r.length)return[];const a=n,s=r.length,u=gA(s);let l,c,f,d=Array(s);for(f=0;f<s;++f)d[f]=i(r[f]),u[f]=f;if(d=function(e,t){return e.sort.call(t,((t,n)=>{const i=e[t],r=e[n];return i<r?-1:i>r?1:0})),function(e,t){return Array.from(t,(t=>e[t]))}(e,t)}(d,u),a)l=t,c=e,t=Array(a+s),e=gA(a+s),function(e,t,n,i,r,o,a,s,u){let l,c=0,f=0;for(l=0;c<i&&f<a;++l)t[c]<r[f]?(s[l]=t[c],u[l]=n[c++]):(s[l]=r[f],u[l]=o[f++]+e);for(;c<i;++c,++l)s[l]=t[c],u[l]=n[c];for(;f<a;++f,++l)s[l]=r[f],u[l]=o[f]+e}(o,l,c,a,d,u,s,t,e);else{if(o>0)for(f=0;f<s;++f)u[f]+=o;t=d,e=u}return n=a+s,{index:u,value:d}},remove:function(i,r){const o=n;let a,s,u;for(s=0;!r[e[s]]&&s<o;++s);for(u=s;s<o;++s)r[a=e[s]]||(e[u]=a,t[u]=t[s],++u);n=o-i},bisect:function(e,i){let r;return i?r=i.length:(i=t,r=n),[Wt(i,e[0],0,r),qt(i,e[1],0,r)]},reindex:function(t){for(let i=0,r=n;i<r;++i)e[i]=t[e[i]]},index:()=>e,size:()=>n}}function xA(e){fr.call(this,function(){let e=8,t=[],n=gA(0),i=yA(0,e),r=yA(0,e);return{data:()=>t,seen:()=>{return e=n,i=t.length,n=e.length>=i?e:((r=r||new e.constructor(i)).set(e),r);var e,i,r},add(e){for(let n,i=0,r=t.length,o=e.length;i<o;++i)n=e[i],n._index=r++,t.push(n)},remove(e,n){const o=t.length,a=Array(o-e),s=t;let u,l,c;for(l=0;!n[l]&&l<o;++l)a[l]=t[l],s[l]=l;for(c=l;l<o;++l)u=t[l],n[l]?s[l]=-1:(s[l]=c,i[c]=i[l],r[c]=r[l],a[c]=u,u._index=c++),i[l]=0;return t=a,s},size:()=>t.length,curr:()=>i,prev:()=>r,reset:e=>r[e]=i[e],all:()=>e<257?255:e<65537?65535:4294967295,set(e,t){i[e]|=t},clear(e,t){i[e]&=~t},resize(t,n){(t>i.length||n>e)&&(e=Math.max(n,e),i=yA(t,e,i),r=yA(t,e))}}}(),e),this._indices=null,this._dims=null}function wA(e){fr.call(this,null,e)}xA.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}}]},t(xA,fr,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((e=>t.modified(e.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},o=this._dims=[],a=i.length;let s,u,l=0;for(;l<a;++l)s=n[l].fname,u=r[s]||(r[s]=bA()),o.push(vA(u,l,i[l]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),i=e.fields,r=e.query,o=this._indices,a=this._dims,s=this.value,u=s.curr(),l=s.prev(),c=s.all(),f=n.rem=n.add,d=n.mod,h=r.length,p={};let m,g,y,v,b,x,w,_,A;if(l.set(u),t.rem.length&&(b=this.remove(e,t,n)),t.add.length&&s.add(t.add),t.mod.length)for(x={},v=t.mod,w=0,_=v.length;w<_;++w)x[v[w]._index]=1;for(w=0;w<h;++w)A=i[w],(!a[w]||e.modified("fields",w)||t.modified(A.fields))&&(y=A.fname,(m=p[y])||(o[y]=g=bA(),p[y]=m=g.insert(A,t.source,0)),a[w]=vA(g,w,r[w]).onAdd(m,u));for(w=0,_=s.data().length;w<_;++w)b[w]||(l[w]!==u[w]?f.push(w):x[w]&&u[w]!==c&&d.push(w));return s.mask=(1<<h)-1,n},eval(e,t){const n=t.materialize().fork(),i=this._dims.length;let r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<i)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<i)-1),t.mod.length&&(this.modify(t,n),r|=(1<<i)-1),this.value.mask=r,n},insert(e,t,n){const i=t.add,r=this.value,o=this._dims,a=this._indices,s=e.fields,u={},l=n.add,c=r.size()+i.length,f=o.length;let d,h,p,m=r.size();r.resize(c,f),r.add(i);const g=r.curr(),y=r.prev(),v=r.all();for(d=0;d<f;++d)h=s[d].fname,p=u[h]||(u[h]=a[h].insert(s[d],i,m)),o[d].onAdd(p,g);for(;m<c;++m)y[m]=v,g[m]!==v&&l.push(m)},modify(e,t){const n=t.mod,i=this.value,r=i.curr(),o=i.all(),a=e.mod;let s,u,l;for(s=0,u=a.length;s<u;++s)l=a[s]._index,r[l]!==o&&n.push(l)},remove(e,t,n){const i=this._indices,r=this.value,o=r.curr(),a=r.prev(),s=r.all(),u={},l=n.rem,c=t.rem;let f,d,h,p;for(f=0,d=c.length;f<d;++f)h=c[f]._index,u[h]=1,a[h]=p=o[h],o[h]=s,p!==s&&l.push(h);for(h in i)i[h].remove(d,u);return this.reindex(t,d,u),u},reindex(e,t,n){const i=this._indices,r=this.value;e.runAfter((()=>{const e=r.remove(t,n);for(const t in i)i[t].reindex(e)}))},update(e,t,n){const i=this._dims,r=e.query,o=t.stamp,a=i.length;let s,u,l=0;for(n.filters=0,u=0;u<a;++u)e.modified("query",u)&&(s=u,++l);if(1===l)l=i[s].one,this.incrementOne(i[s],r[s],n.add,n.rem);else for(u=0,l=0;u<a;++u)e.modified("query",u)&&(l|=i[u].one,this.incrementAll(i[u],r[u],o,n.add),n.rem=n.add);return l},incrementAll(e,t,n,i){const r=this.value,o=r.seen(),a=r.curr(),s=r.prev(),u=e.index(),l=e.bisect(e.range),c=e.bisect(t),f=c[0],d=c[1],h=l[0],p=l[1],m=e.one;let g,y,v;if(f<h)for(g=f,y=Math.min(h,d);g<y;++g)v=u[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(f>h)for(g=h,y=Math.min(f,p);g<y;++g)v=u[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;if(d>p)for(g=Math.max(f,p),y=d;g<y;++g)v=u[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;else if(d<p)for(g=Math.max(h,d),y=p;g<y;++g)v=u[g],o[v]!==n&&(s[v]=a[v],o[v]=n,i.push(v)),a[v]^=m;e.range=t.slice()},incrementOne(e,t,n,i){const r=this.value.curr(),o=e.index(),a=e.bisect(e.range),s=e.bisect(t),u=s[0],l=s[1],c=a[0],f=a[1],d=e.one;let h,p,m;if(u<c)for(h=u,p=Math.min(c,l);h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(u>c)for(h=c,p=Math.min(u,f);h<p;++h)m=o[h],r[m]^=d,i.push(m);if(l>f)for(h=Math.max(u,f),p=l;h<p;++h)m=o[h],r[m]^=d,n.push(m);else if(l<f)for(h=Math.max(c,l),p=f;h<p;++h)m=o[h],r[m]^=d,i.push(m);e.range=t.slice()}}),wA.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},t(wA,fr,{transform(e,t){const n=~(e.ignore||0),i=e.filter,r=i.mask;if(!(r&n))return t.StopPropagation;const o=t.fork(t.ALL),a=i.data(),s=i.curr(),u=i.prev(),l=e=>s[e]&n?null:a[e];return o.filter(o.MOD,l),r&r-1?(o.filter(o.ADD,(e=>{const t=s[e]&n;return!t&&t^u[e]&n?a[e]:null})),o.filter(o.REM,(e=>{const t=s[e]&n;return t&&!(0^u[e]&n)?a[e]:null}))):(o.filter(o.ADD,l),o.filter(o.REM,(e=>(s[e]&n)===r?a[e]:null))),o.filter(o.SOURCE,(e=>l(e._index)))}});const _A=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:xA,resolvefilter:wA},Symbol.toStringTag,{value:"Module"})),AA="Literal",kA="Property",DA="ArrayExpression",FA="BinaryExpression",CA="CallExpression",EA="ConditionalExpression",$A="LogicalExpression",SA="MemberExpression",MA="ObjectExpression",BA="UnaryExpression";function zA(e){this.type=e}var OA,NA,RA,TA,PA;zA.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case DA:return e.elements;case FA:case $A:return[e.left,e.right];case CA:return[e.callee].concat(e.arguments);case EA:return[e.test,e.consequent,e.alternate];case SA:return[e.object,e.property];case MA:return e.properties;case kA:return[e.key,e.value];case BA:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(OA={})[1]="Boolean",OA[2]="<end>",OA[3]="Identifier",OA[4]="Keyword",OA[5]="Null",OA[6]="Numeric",OA[7]="Punctuator",OA[8]="String",OA[9]="RegularExpression";var jA="Identifier",LA="Unexpected token %0",qA="Invalid regular expression",UA="Invalid regular expression: missing /",IA="Octal literals are not allowed in strict mode.",WA="ILLEGAL",HA="Disabled.",GA=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]"),VA=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 YA(e,t){if(!e)throw new Error("ASSERT: "+t)}function XA(e){return e>=48&&e<=57}function JA(e){return"0123456789abcdefABCDEF".includes(e)}function KA(e){return"01234567".includes(e)}function QA(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].includes(e)}function ZA(e){return 10===e||13===e||8232===e||8233===e}function ek(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&GA.test(String.fromCharCode(e))}function tk(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&VA.test(String.fromCharCode(e))}const nk={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 ik(){for(;RA<TA;){const e=NA.charCodeAt(RA);if(!QA(e)&&!ZA(e))break;++RA}}function rk(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)RA<TA&&JA(NA[RA])?(i=NA[RA++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):xk({},LA,WA);return String.fromCharCode(r)}function ok(){var e,t,n,i;for(t=0,"}"===(e=NA[RA])&&xk({},LA,WA);RA<TA&&JA(e=NA[RA++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&xk({},LA,WA),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function ak(){var e,t;for(e=NA.charCodeAt(RA++),t=String.fromCharCode(e),92===e&&(117!==NA.charCodeAt(RA)&&xk({},LA,WA),++RA,(e=rk("u"))&&"\\"!==e&&ek(e.charCodeAt(0))||xk({},LA,WA),t=e);RA<TA&&tk(e=NA.charCodeAt(RA));)++RA,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==NA.charCodeAt(RA)&&xk({},LA,WA),++RA,(e=rk("u"))&&"\\"!==e&&tk(e.charCodeAt(0))||xk({},LA,WA),t+=e);return t}function sk(){var e,t;return e=RA,t=92===NA.charCodeAt(RA)?ak():function(){var e,t;for(e=RA++;RA<TA;){if(92===(t=NA.charCodeAt(RA)))return RA=e,ak();if(!tk(t))break;++RA}return NA.slice(e,RA)}(),{type:1===t.length?3:nk.hasOwnProperty(t)?4:"null"===t?5:"true"===t||"false"===t?1:3,value:t,start:e,end:RA}}function uk(){var e,t,n,i,r=RA,o=NA.charCodeAt(RA),a=NA[RA];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++RA,{type:7,value:String.fromCharCode(o),start:r,end:RA};default:if(61===(e=NA.charCodeAt(RA+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return RA+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(e),start:r,end:RA};case 33:case 61:return RA+=2,61===NA.charCodeAt(RA)&&++RA,{type:7,value:NA.slice(r,RA),start:r,end:RA}}}return">>>="===(i=NA.substr(RA,4))?{type:7,value:i,start:r,end:RA+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:RA+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===t?{type:7,value:t,start:r,end:RA+=2}:("//"===t&&xk({},LA,WA),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:r,end:++RA}:void xk({},LA,WA))}function lk(){var e,t,n;if(YA(XA((n=NA[RA]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=RA,e="","."!==n){if(e=NA[RA++],n=NA[RA],"0"===e){if("x"===n||"X"===n)return++RA,function(e){let t="";for(;RA<TA&&JA(NA[RA]);)t+=NA[RA++];return 0===t.length&&xk({},LA,WA),ek(NA.charCodeAt(RA))&&xk({},LA,WA),{type:6,value:parseInt("0x"+t,16),start:e,end:RA}}(t);if(KA(n))return function(e){let t="0"+NA[RA++];for(;RA<TA&&KA(NA[RA]);)t+=NA[RA++];return(ek(NA.charCodeAt(RA))||XA(NA.charCodeAt(RA)))&&xk({},LA,WA),{type:6,value:parseInt(t,8),octal:!0,start:e,end:RA}}(t);n&&XA(n.charCodeAt(0))&&xk({},LA,WA)}for(;XA(NA.charCodeAt(RA));)e+=NA[RA++];n=NA[RA]}if("."===n){for(e+=NA[RA++];XA(NA.charCodeAt(RA));)e+=NA[RA++];n=NA[RA]}if("e"===n||"E"===n)if(e+=NA[RA++],"+"!==(n=NA[RA])&&"-"!==n||(e+=NA[RA++]),XA(NA.charCodeAt(RA)))for(;XA(NA.charCodeAt(RA));)e+=NA[RA++];else xk({},LA,WA);return ek(NA.charCodeAt(RA))&&xk({},LA,WA),{type:6,value:parseFloat(e),start:t,end:RA}}function ck(){var e,t,n,i;return PA=null,ik(),e=RA,t=function(){var e,t,n,i;for(YA("/"===(e=NA[RA]),"Regular expression literal must start with a slash"),t=NA[RA++],n=!1,i=!1;RA<TA;)if(t+=e=NA[RA++],"\\"===e)ZA((e=NA[RA++]).charCodeAt(0))&&xk({},UA),t+=e;else if(ZA(e.charCodeAt(0)))xk({},UA);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||xk({},UA),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";RA<TA&&tk((e=NA[RA]).charCodeAt(0));)++RA,"\\"===e&&RA<TA?xk({},LA,WA):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&xk({},qA,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";xk({},qA)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(i){xk({},qA)}try{return new RegExp(e,t)}catch(r){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:RA}}function fk(){if(ik(),RA>=TA)return{type:2,start:RA,end:RA};const e=NA.charCodeAt(RA);return ek(e)?sk():40===e||41===e||59===e?uk():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(YA("'"===(e=NA[RA])||'"'===e,"String literal must starts with a quote"),t=RA,++RA;RA<TA;){if((n=NA[RA++])===e){e="";break}if("\\"===n)if((n=NA[RA++])&&ZA(n.charCodeAt(0)))"\r"===n&&"\n"===NA[RA]&&++RA;else switch(n){case"u":case"x":"{"===NA[RA]?(++RA,r+=ok()):r+=rk(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:KA(n)?(0!==(i="01234567".indexOf(n))&&(o=!0),RA<TA&&KA(NA[RA])&&(o=!0,i=8*i+"01234567".indexOf(NA[RA++]),"0123".includes(n)&&RA<TA&&KA(NA[RA])&&(i=8*i+"01234567".indexOf(NA[RA++]))),r+=String.fromCharCode(i)):r+=n}else{if(ZA(n.charCodeAt(0)))break;r+=n}}return""!==e&&xk({},LA,WA),{type:8,value:r,octal:o,start:t,end:RA}}():46===e?XA(NA.charCodeAt(RA+1))?lk():uk():XA(e)?lk():uk()}function dk(){const e=PA;return RA=e.end,PA=fk(),RA=e.end,e}function hk(){const e=RA;PA=fk(),RA=e}function pk(e,t,n){const i=new zA("||"===e||"&&"===e?"LogicalExpression":"BinaryExpression");return i.operator=e,i.left=t,i.right=n,i}function mk(e,t){const n=new zA("CallExpression");return n.callee=e,n.arguments=t,n}function gk(e){const t=new zA(jA);return t.name=e,t}function yk(e){const t=new zA("Literal");return t.value=e.value,t.raw=NA.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function vk(e,t,n){const i=new zA("MemberExpression");return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function bk(e,t,n){const i=new zA("Property");return i.key=t,i.value=n,i.kind=e,i}function xk(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((e,t)=>(YA(t<i.length,"Message reference must be in range"),i[t])));throw(n=new Error(r)).index=RA,n.description=r,n}function wk(e){2===e.type&&xk(e,"Unexpected end of input"),6===e.type&&xk(e,"Unexpected number"),8===e.type&&xk(e,"Unexpected string"),3===e.type&&xk(e,"Unexpected identifier"),4===e.type&&xk(e,"Unexpected reserved word"),xk(e,LA,e.value)}function _k(e){const t=dk();7===t.type&&t.value===e||wk(t)}function Ak(e){return 7===PA.type&&PA.value===e}function kk(e){return 4===PA.type&&PA.value===e}function Dk(){const e=[];for(RA=PA.start,_k("[");!Ak("]");)Ak(",")?(dk(),e.push(null)):(e.push(Tk()),Ak("]")||_k(","));return dk(),function(e){const t=new zA("ArrayExpression");return t.elements=e,t}(e)}function Fk(){RA=PA.start;const e=dk();return 8===e.type||6===e.type?(e.octal&&xk(e,IA),yk(e)):gk(e.value)}function Ck(){var e,t,n;return RA=PA.start,3===(e=PA).type?(n=Fk(),_k(":"),bk("init",n,Tk())):2!==e.type&&7!==e.type?(t=Fk(),_k(":"),bk("init",t,Tk())):void wk(e)}function Ek(){var e,t,n=[],i={},r=String;for(RA=PA.start,_k("{");!Ak("}");)t="$"+((e=Ck()).key.type===jA?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?xk({},"Duplicate data property in object literal not allowed in strict mode"):i[t]=!0,n.push(e),Ak("}")||_k(",");return _k("}"),function(e){const t=new zA("ObjectExpression");return t.properties=e,t}(n)}const $k={if:1};function Sk(){var e,t,n;if(Ak("("))return function(){_k("(");const e=Pk();return _k(")"),e}();if(Ak("["))return Dk();if(Ak("{"))return Ek();if(e=PA.type,RA=PA.start,3===e||$k[PA.value])n=gk(dk().value);else if(8===e||6===e)PA.octal&&xk(PA,IA),n=yk(dk());else{if(4===e)throw new Error(HA);1===e?((t=dk()).value="true"===t.value,n=yk(t)):5===e?((t=dk()).value=null,n=yk(t)):Ak("/")||Ak("/=")?(n=yk(ck()),hk()):wk(dk())}return n}function Mk(){const e=[];if(_k("("),!Ak(")"))for(;RA<TA&&(e.push(Tk()),!Ak(")"));)_k(",");return _k(")"),e}function Bk(){return _k("."),function(){RA=PA.start;const e=dk();return function(e){return 3===e.type||4===e.type||1===e.type||5===e.type}(e)||wk(e),gk(e.value)}()}function zk(){_k("[");const e=Pk();return _k("]"),e}function Ok(){const e=function(){var e;for(e=Sk();;)if(Ak("."))e=vk(".",e,Bk());else if(Ak("("))e=mk(e,Mk());else{if(!Ak("["))break;e=vk("[",e,zk())}return e}();if(7===PA.type&&(Ak("++")||Ak("--")))throw new Error(HA);return e}function Nk(){var e,t;if(7!==PA.type&&4!==PA.type)t=Ok();else{if(Ak("++")||Ak("--"))throw new Error(HA);if(Ak("+")||Ak("-")||Ak("~")||Ak("!"))e=dk(),t=Nk(),t=function(e,t){const n=new zA("UnaryExpression");return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(kk("delete")||kk("void")||kk("typeof"))throw new Error(HA);t=Ok()}}return t}function Rk(e){let t=0;if(7!==e.type&&4!==e.type)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function Tk(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,u,l;if(e=PA,u=Nk(),0===(r=Rk(i=PA)))return u;for(i.prec=r,dk(),t=[e,PA],o=[u,i,a=Nk()];(r=Rk(PA))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),t.pop(),n=pk(s,u,a),o.push(n);(i=dk()).prec=r,o.push(i),t.push(PA),n=Nk(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=pk(o[l-1].value,o[l-2],n),l-=2;return n}(),Ak("?")&&(dk(),t=Tk(),_k(":"),e=function(e,t,n){const i=new zA("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,Tk())),e}function Pk(){const e=Tk();if(Ak(","))throw new Error(HA);return e}function jk(e){RA=0,TA=(NA=e).length,PA=null,hk();const t=Pk();if(2!==PA.type)throw new Error("Unexpect token after expression.");return t}var Lk={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 qk(e){function t(t,n,i){return r=>function(t,n,i,r){let o=e(n[0]);return i&&(o=i+"("+o+")",0===i.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+t+(r<0?"":0===r?"()":"("+n.slice(1).map(e).join(",")+")")}(t,r,n,i)}const n="new Date",i="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(t){t.length<3&&d("Missing arguments to clamp function."),t.length>3&&d("Too many arguments to clamp function.");const n=t.map(e);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",i,0),lower:t("toLowerCase",i,0),substring:t("substring",i),split:t("split",i),trim:t("trim",i,0),btoa:"btoa",atob:"atob",regexp:r,test:t("test",r),if:function(t){t.length<3&&d("Missing arguments to if function."),t.length>3&&d("Too many arguments to if function.");const n=t.map(e);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function Uk(e){const t=(e=e||{}).allowed?ee(e.allowed):{},n=e.forbidden?ee(e.forbidden):{},i=e.constants||Lk,r=(e.functions||qk)(p),o=e.globalvar,s=e.fieldvar,u=a(o)?o:e=>`${o}["${e}"]`;let l={},f={},h=0;function p(e){if(ie(e))return e;const t=m[e.type];return null==t&&d("Unsupported type: "+e.type),t(e)}const m={Literal:e=>e.raw,Identifier:e=>{const r=e.name;return h>0?r:c(n,r)?d("Illegal identifier: "+r):c(i,r)?i[r]:c(t,r)?r:(l[r]=1,u(r))},MemberExpression:e=>{const t=!e.computed,n=p(e.object);t&&(h+=1);const i=p(e.property);return n===s&&(f[function(e){const t=e&&e.length-1;return t&&('"'===e[0]&&'"'===e[t]||"'"===e[0]&&"'"===e[t])?e.slice(1,-1):e}(i)]=1),t&&(h-=1),n+(t?"."+i:"["+i+"]")},CallExpression:e=>{"Identifier"!==e.callee.type&&d("Illegal callee type: "+e.callee.type);const t=e.callee.name,n=e.arguments,i=c(r,t)&&r[t];return i||d("Unrecognized function: "+t),a(i)?i(n):i+"("+n.map(p).join(",")+")"},ArrayExpression:e=>"["+e.elements.map(p).join(",")+"]",BinaryExpression:e=>"("+p(e.left)+" "+e.operator+" "+p(e.right)+")",UnaryExpression:e=>"("+e.operator+p(e.argument)+")",ConditionalExpression:e=>"("+p(e.test)+"?"+p(e.consequent)+":"+p(e.alternate)+")",LogicalExpression:e=>"("+p(e.left)+e.operator+p(e.right)+")",ObjectExpression:e=>"{"+e.properties.map(p).join(",")+"}",Property:e=>{h+=1;const t=p(e.key);return h-=1,t+":"+p(e.value)}};function g(e){const t={code:p(e),globals:Object.keys(l),fields:Object.keys(f)};return l={},f={},t}return g.functions=r,g.constants=i,g}const Ik=Symbol("vega_selection_getter");function Wk(e){return e.getter&&e.getter[Ik]||(e.getter=O(e.field),e.getter[Ik]=!0),e.getter}const Hk="intersect",Gk="union",Vk="or",Yk="and",Xk="_vgsid_",Jk=O(Xk),Kk="index:unit";function Qk(e,t){for(var n,i,r=t.fields,o=t.values,a=r.length,s=0;s<a;++s)if(n=Wk(i=r[s])(e),he(n)&&(n=A(n)),he(o[s])&&(o[s]=A(o[s])),f(o[s])&&he(o[s][0])&&(o[s]=o[s].map(A)),"E"===i.type){if(f(o[s])?!o[s].includes(n):n!==o[s])return!1}else if("R"===i.type){if(!pe(n,o[s]))return!1}else if("R-RE"===i.type){if(!pe(n,o[s],!0,!1))return!1}else if("R-E"===i.type){if(!pe(n,o[s],!1,!1))return!1}else if("R-LE"===i.type){if(!pe(n,o[s],!1,!0))return!1}else if("E-LT"===i.type){if(n>=o[s])return!1}else if("E-LTE"===i.type){if(n>o[s])return!1}else if("E-GT"===i.type){if(n<=o[s])return!1}else if("E-GTE"===i.type){if(n<o[s])return!1}else if("E-VALID"===i.type){if(null===n||isNaN(n))return!1}else if("E-ONE"===i.type&&-1===o[s].indexOf(n))return!1;return!0}const Zk=z(Jk),eD=Zk.left,tD=Zk.right;var nD={[`${Xk}_union`]:function(...e){const t=new xn;for(const n of e)for(const e of n)t.add(e);return t},[`${Xk}_intersect`]:function(e,...t){e=new xn(e),t=t.map(ui);e:for(const n of e)for(const i of t)if(!i.has(n)){e.delete(n);continue e}return e},E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;n<i;++n)e.includes(t[n])||e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((e=>t.includes(e))):t},R_union:function(e,t){var n=A(t[0]),i=A(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<i&&(e[1]=i),e):[n,i]},R_intersect:function(e,t){var n=A(t[0]),i=A(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?i<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>i&&(e[1]=i),e):[n,i]}};function iD(e,t,n,i){t[0].type!==AA&&d("First argument to selection functions must be a string literal.");const r=t[0].value,o="unit",a="@"+o,s=":"+r;(t.length>=2&&S(t).value)!==Hk||c(i,a)||(i[a]=n.getData(r).indataRef(n,o)),c(i,s)||(i[s]=n.getData(r).tuplesRef())}function rD(e){const t=this.context.data[e];return t?t.values.value:[]}const oD=e=>function(t,n){const i=this.context.dataflow.locale();return null===t?"null":i[e](n)(t)},aD=oD("format"),sD=oD("timeFormat"),uD=oD("utcFormat"),lD=oD("timeParse"),cD=oD("utcParse"),fD=new Date(2e3,0,1);function dD(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(fD.setYear(2e3),fD.setMonth(e),fD.setDate(t),sD.call(this,fD,n)):""}function hD(e,t,n,i){t[0].type!==AA&&d("First argument to data functions must be a string literal.");const r=t[0].value,o=":"+r;if(!c(o,i))try{i[o]=n.getData(r).tuplesRef()}catch(a){}}function pD(e,t,n,i){if(t[0].type===AA)mD(n,i,t[0].value);else for(e in n.scales)mD(n,i,e)}function mD(e,t,n){const i="%"+n;if(!c(t,i))try{t[i]=e.scaleRef(n)}catch(r){}}function gD(e,t){if(ie(e)){const n=t.scales[e];return n&&Ws(n.value)?n.value:void 0}if(a(e))return Ws(e)?e:void 0}function yD(e,t,n){t.__bandwidth=e=>e&&e.bandwidth?e.bandwidth():0,n._bandwidth=pD,n._range=pD,n._scale=pD;const i=t=>"_["+(t.type===AA?fe("%"+t.value):fe("%")+"+"+e(t))+"]";return{_bandwidth:e=>`this.__bandwidth(${i(e[0])})`,_range:e=>`${i(e[0])}.range()`,_scale:t=>`${i(t[0])}(${e(t[1])})`}}function vD(e,t){return function(n,i,r){if(n){const t=gD(n,(r||this).context);return t&&t.path[e](i)}return t(i)}}const bD=vD("area",(function(e){return rg=new Zn,Lm(e,og),2*rg})),xD=vD("bounds",(function(e){var t,n,i,r,o,a,s;if(Xm=Ym=-(Gm=Vm=1/0),tg=[],Lm(e,zg),n=tg.length){for(tg.sort(Ug),t=1,o=[i=tg[0]];t<n;++t)Ig(i,(r=tg[t])[0])||Ig(i,r[1])?(qg(i[0],r[1])>qg(i[0],i[1])&&(i[1]=r[1]),qg(r[0],i[1])>qg(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(a=-1/0,t=0,i=o[n=o.length-1];t<=n;i=r,++t)r=o[t],(s=qg(i[1],r[0]))>a&&(a=s,Gm=r[0],Ym=i[1])}return tg=ng=null,Gm===1/0||Vm===1/0?[[NaN,NaN],[NaN,NaN]]:[[Gm,Vm],[Ym,Xm]]})),wD=vD("centroid",(function(e){yg=vg=bg=xg=wg=_g=Ag=kg=0,Dg=new Zn,Fg=new Zn,Cg=new Zn,Lm(e,Wg);var t=+Dg,n=+Fg,i=+Cg,r=Dm(t,n,i);return r<dm&&(t=_g,n=Ag,i=kg,vg<fm&&(t=bg,n=xg,i=wg),(r=Dm(t,n,i))<dm)?[NaN,NaN]:[wm(n,t)*ym,zm(i/r)*ym]}));function _D(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(i){e.warn(i)}return n[n.length-1]}function AD(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function kD(e){const t=pn(e);return.2126*AD(t.r)+.7152*AD(t.g)+.0722*AD(t.b)}function DD(e,t){return e===t||e!=e&&t!=t||(f(e)?!(!f(t)||e.length!==t.length)&&function(e,t){for(let n=0,i=e.length;n<i;++n)if(!DD(e[n],t[n]))return!1;return!0}(e,t):!(!ne(e)||!ne(t))&&FD(e,t))}function FD(e,t){for(const n in e)if(!DD(e[n],t[n]))return!1;return!0}function CD(e){return t=>FD(e,t)}const ED={};function $D(e){return f(e)||ArrayBuffer.isView(e)?e:null}function SD(e){return $D(e)||(ie(e)?e:null)}const MD=e=>e.data;function BD(e,t){const n=rD.call(t,e);return n.root&&n.root.lookup||{}}const zD=()=>"undefined"!=typeof window&&window||null;function OD(e,t,n){if(!e)return[];const[i,r]=e,o=(new Ml).set(i[0],i[1],r[0],r[1]);return mh(n||this.context.dataflow.scenegraph().root,o,function(e){let t=null;if(e){const n=u(e.marktype),i=u(e.markname);t=e=>(!n.length||n.some((t=>e.marktype===t)))&&(!i.length||i.some((t=>e.name===t)))}return t}(t))}const ND={random:()=>xr(),cumulativeNormal:Er,cumulativeLogNormal:Or,cumulativeUniform:Lr,densityNormal:Cr,densityLogNormal:zr,densityUniform:jr,quantileNormal:$r,quantileLogNormal:Nr,quantileUniform:qr,sampleNormal:Fr,sampleLogNormal:Br,sampleUniform:Pr,isArray:f,isBoolean:Pe,isDate:he,isDefined:e=>void 0!==e,isNumber:te,isObject:ne,isRegExp:Te,isString:ie,isTuple:Mi,isValid:e=>null!=e&&e==e,toBoolean:Re,toDate:e=>je(e),toNumber:A,toString:Ne,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return SD(e).indexOf(...n)},join:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return $D(e).join(...n)},lastindexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return SD(e).lastIndexOf(...n)},replace:function(e,t,n){return a(n)&&d("Function argument passed to replace."),ie(t)||Te(t)||d("Please pass a string or RegExp argument to replace."),String(e).replace(t,n)},reverse:function(e){return $D(e).slice().reverse()},sort:function(e){return $D(e).slice().sort(D)},slice:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return SD(e).slice(...n)},flush:Oe,lerp:ze,merge:function(){const e=[].slice.call(arguments);return e.unshift({}),v(...e)},pad:Be,peek:S,pluck:function(e,t){const n=ED[t]||(ED[t]=O(t));return f(e)?e.map(n):n(e)},span:R,inrange:pe,truncate:Me,rgb:pn,lab:bt,hcl:Ct,hsl:en,luminance:kD,contrast:function(e,t){const n=kD(e),i=kD(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)},sequence:Ht,format:aD,utcFormat:uD,utcParse:cD,utcOffset:Se,utcSequence:$e,timeFormat:sD,timeParse:lD,timeOffset:Ee,timeSequence:Ce,timeUnitSpecifier:Fe,monthFormat:function(e){return dD.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return dD.call(this,e,1,"%b")},dayFormat:function(e){return dD.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return dD.call(this,0,2+e,"%a")},quarter:De,utcquarter:ke,week:Ae,utcweek:_e,dayofyear:we,utcdayofyear:xe,warn:function(){return _D(this.context.dataflow,"warn",arguments)},info:function(){return _D(this.context.dataflow,"info",arguments)},debug:function(){return _D(this.context.dataflow,"debug",arguments)},extent:e=>k(e),inScope:function(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:OD,clampRange:be,pinchDistance:function(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)},pinchAngle:function(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){const e=zD();return e?e.screen:{}},containerSize:function(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){const e=zD();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return ms(e||0,t||0,n||0)},setdata:function(e,t){const n=this.context.dataflow,i=this.context.data[e].input;return n.pulse(i,n.changeset().remove(p).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?el(n,t=t||Iu(e)):e}},panLinear:ve,panLog:ye,panPow:ge,panSymlog:me,zoomLinear:ce,zoomLog:se,zoomPow:ue,zoomSymlog:le,encode:function(e,t,n){if(e){const n=this.context.dataflow,i=e.mark.source;n.pulse(i,n.changeset().encode(e,t))}return void 0!==n?n:e},modify:function(e,t,n,i,r,o){const a=this.context.dataflow,s=this.context.data[e],u=s.input,l=a.stamp();let c,d,h=s.changes;if(!1===a._trigger||!(u.value.length||t||i))return 0;if((!h||h.stamp<l)&&(s.changes=h=a.changeset(),h.stamp=l,a.runAfter((()=>{s.modified=!0,a.pulse(u,h).run()}),!0,1)),n&&(c=!0===n?p:f(n)||Mi(n)?n:CD(n),h.remove(c)),t&&h.insert(t),i&&(c=CD(i),u.value.some(c)?h.remove(c):h.insert(i)),r)for(d in o)h.modify(r,d,o[d]);return 1},lassoAppend:function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const r=(e=u(e))[e.length-1];return void 0===r||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e},lassoPath:function(e){return u(e).reduce(((t,n,i)=>{let[r,o]=n;return t+(0==i?`M ${r},${o} `:i===e.length-1?" Z":`L ${r},${o} `)}),"")},intersectLasso:function(e,t,n){const{x:i,y:r,mark:o}=n,a=(new Ml).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[s,u]of t)s<a.x1&&(a.x1=s),s>a.x2&&(a.x2=s),u<a.y1&&(a.y1=u),u>a.y2&&(a.y2=u);return a.translate(i,r),OD([[a.x1,a.y1],[a.x2,a.y2]],e,o).filter((e=>function(e,t,n){let i=0;for(let r=0,o=n.length-1;r<n.length;o=r++){const[a,s]=n[o],[u,l]=n[r];l>t!=s>t&&e<(a-u)*(t-l)/(s-l)+u&&i++}return 1&i}(e.x,e.y,t)))}},RD=["view","item","group","xy","x","y"],TD="this.",PD={},jD={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${fe("$"+e)}]`,functions:function(e){const t=qk(e);RD.forEach((e=>t[e]="event.vega."+e));for(const n in ND)t[n]=TD+n;return v(t,yD(e,ND,PD)),t},constants:Lk,visitors:PD},LD=Uk(jD);function qD(e,t,n){return 1===arguments.length?ND[e]:(ND[e]=t,n&&(PD[e]=n),LD&&(LD.functions[e]=TD+e),this)}function UD(e,t){const n={};let i;try{i=jk(e=ie(e)?e:fe(e)+"")}catch(o){d("Expression parse error: "+e)}i.visit((e=>{if(e.type!==CA)return;const i=e.callee.name,r=jD.visitors[i];r&&r(i,e.arguments,t,n)}));const r=LD(i);return r.globals.forEach((e=>{const i="$"+e;!c(n,i)&&t.getSignal(e)&&(n[i]=t.signalRef(e))})),{$expr:v({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}qD("bandwidth",(function(e,t){const n=gD(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),pD),qD("copy",(function(e,t){const n=gD(e,(t||this).context);return n?n.copy():void 0}),pD),qD("domain",(function(e,t){const n=gD(e,(t||this).context);return n?n.domain():[]}),pD),qD("range",(function(e,t){const n=gD(e,(t||this).context);return n&&n.range?n.range():[]}),pD),qD("invert",(function(e,t,n){const i=gD(e,(n||this).context);return i?f(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}),pD),qD("scale",(function(e,t,n){const i=gD(e,(n||this).context);return i?i(t):void 0}),pD),qD("gradient",(function(e,t,n,i,r){e=gD(e,(r||this).context);const o=Nu(t,n);let a=e.domain(),s=a[0],u=S(a),c=l;return u-s?c=ru(e,s,u):e=(e.interpolator?Hs("sequential")().interpolator(e.interpolator()):Hs("linear")().interpolate(e.interpolate()).range(e.range())).domain([s=0,u=1]),e.ticks&&(a=e.ticks(+i||15),s!==a[0]&&a.unshift(s),u!==S(a)&&a.push(u)),a.forEach((t=>o.stop(c(t),e(t)))),o}),pD),qD("geoArea",bD,pD),qD("geoBounds",xD,pD),qD("geoCentroid",wD,pD),qD("geoShape",(function(e,t,n){const i=gD(e,(n||this).context);return function(e){return i?i.path.context(e)(t):""}}),pD),qD("geoScale",(function(e,t){const n=gD(e,(t||this).context);return n&&n.scale()}),pD),qD("indata",(function(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r?r.count:r}),(function(e,t,n,i){t[0].type!==AA&&d("First argument to indata must be a string literal."),t[1].type!==AA&&d("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,a="@"+o;c(a,i)||(i[a]=n.getData(r).indataRef(n,o))})),qD("data",rD,hD),qD("treePath",(function(e,t,n){const i=BD(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(MD):void 0}),hD),qD("treeAncestors",(function(e,t){const n=BD(e,this)[t];return n?n.ancestors().map(MD):void 0}),hD),qD("vlSelectionTest",(function(e,t,n){for(var i,r,o,a,s,u=this.context.data[e],l=u?u.values.value:[],c=u?u[Kk]&&u[Kk].value:void 0,f=n===Hk,d=l.length,h=0;h<d;++h)if(i=l[h],c&&f){if(-1===(o=(r=r||{})[a=i.unit]||0))continue;if(s=Qk(t,i),r[a]=s?-1:++o,s&&1===c.size)return!0;if(!s&&o===c.get(a).count)return!1}else if(f^(s=Qk(t,i)))return s;return d&&f}),iD),qD("vlSelectionIdTest",(function(e,t,n){const i=this.context.data[e],r=i?i.values.value:[],o=i?i[Kk]&&i[Kk].value:void 0,a=n===Hk,s=Jk(t),u=eD(r,s);if(u===r.length)return!1;if(Jk(r[u])!==s)return!1;if(o&&a){if(1===o.size)return!0;if(tD(r,s)-u<o.size)return!1}return!0}),iD),qD("vlSelectionResolve",(function(e,t,n,i){for(var r,o,a,s,l,c,f,d,h,p,m,g,y=this.context.data[e],v=y?y.values.value:[],b={},x={},w={},_=v.length,A=0;A<_;++A)if(s=(r=v[A]).unit,o=r.fields,a=r.values,o&&a){for(m=0,g=o.length;m<g;++m)l=o[m],d=(f=b[l.field]||(b[l.field]={}))[s]||(f[s]=[]),w[l.field]=h=l.type.charAt(0),p=nD[`${h}_union`],f[s]=p(d,u(a[m]));n&&(d=x[s]||(x[s]=[])).push(u(a).reduce(((e,t,n)=>(e[o[n].field]=t,e)),{}))}else l=Xk,c=Jk(r),(d=(f=b[l]||(b[l]={}))[s]||(f[s]=[])).push(c),n&&(d=x[s]||(x[s]=[])).push({[Xk]:c});if(t=t||Gk,b[Xk]?b[Xk]=nD[`${Xk}_${t}`](...Object.values(b[Xk])):Object.keys(b).forEach((e=>{b[e]=Object.keys(b[e]).map((t=>b[e][t])).reduce(((n,i)=>void 0===n?i:nD[`${w[e]}_${t}`](n,i)))})),v=Object.keys(x),n&&v.length){b[i?"vlPoint":"vlMulti"]=t===Gk?{[Vk]:v.reduce(((e,t)=>(e.push(...x[t]),e)),[])}:{[Yk]:v.map((e=>({[Vk]:x[e]})))}}return b}),iD),qD("vlSelectionTuples",(function(e,t){return e.map((e=>v(t.fields?{values:t.fields.map((t=>Wk(t)(e.datum)))}:{[Xk]:Jk(e.datum)},t)))}));const ID=ee(["rule"]),WD=ee(["group","image","rect"]);function HD(e){return(e+"").toLowerCase()}function GD(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}var VD={operator:(e,t)=>GD(e,["_"],t.code),parameter:(e,t)=>GD(e,["datum","_"],t.code),event:(e,t)=>GD(e,["event"],t.code),handler:(e,t)=>GD(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const o in i){const e="o["+fe(o)+"]";r+=`$=${i[o].code};if(${e}!==$)${e}=$,m=1;`}return r+=function(e,t){let n="";return ID[t]||(e.x2&&(e.x?(WD[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(WD[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(i,n),r+="return m;",GD(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(fe).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=Function("a","b","var u, v; return "+e.map(((e,i)=>{const r=t[i];let o,a;return e.path?(o=`a${e.path}`,a=`b${e.path}`):((n=n||{})["f"+i]=e,o=`this.f${i}(a)`,a=`this.f${i}(b)`),function(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${i}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${i} : `}(o,a,-r,r)})).join("")+"0;");return n?i.bind(n):i}}};function YD(e,t,n){if(!e||!ne(e))return e;for(let i,r=0,o=XD.length;r<o;++r)if(i=XD[r],c(e,i.key))return i.parse(e,t,n);return e}var XD=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||d("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,t){const n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=j(e.$key,e.$flat,t.expr.codegen))}},{key:"$expr",parse:function(e,t,n){e.$params&&t.parseParameters(e.$params,n);const i="e:"+e.$expr.code;return t.fn[i]||(t.fn[i]=_(t.parameterExpression(e.$expr),e.$fields))}},{key:"$field",parse:function(e,t){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=O(e.$field,e.$name,t.expr.codegen))}},{key:"$encode",parse:function(e,t){const n=e.$encode,i={};for(const r in n){const e=n[r];i[r]=_(t.encodeExpression(e.$expr),e.$fields),i[r].output=e.$output}return i}},{key:"$compare",parse:function(e,t){const n="c:"+e.$compare+"_"+e.$order,i=u(e.$compare).map((e=>e&&e.$tupleid?Bi:e));return t.fn[n]||(t.fn[n]=P(i,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){const n=e.$subflow;return function(e,i,r){const o=t.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(r),a.detachSubflow=()=>t.detach(o),a}}},{key:"$tupleid",parse:function(){return Bi}}];const JD={skip:!0};function KD(e,t,n,i){return new QD(e,t,n,i)}function QD(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||VD,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function ZD(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function eF(e,t){e&&(null==t?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}QD.prototype=ZD.prototype={fork(){const e=new ZD(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((t=>t!==e));const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),"collect"===HD(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let r=n.get(e.parent.$ref);r?(i.connect(r,[t]),t.targets().add(r)):(n.unresolved=n.unresolved||[]).push((()=>{r=n.get(e.parent.$ref),i.connect(r,[t]),t.targets().add(r)}))}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const o in e.data){const i=n.data[o]||(n.data[o]={});e.data[o].forEach((e=>i[e]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[HD(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach((e=>t.parseOperator(e))),n.forEach((e=>t.parseOperatorParameters(e))),(e.streams||[]).forEach((e=>t.parseStream(e))),(e.updates||[]).forEach((e=>t.parseUpdate(e))),t.resolve()},parseOperator:function(e){const t=this;"operator"!==HD(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){const t=this;if(e.params){const n=t.get(e.id);n||d("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=f(r)?r.map((e=>YD(e,n,t))):YD(r,n,t)}return t},parseStream:function(e){var t,n=this,i=null!=e.filter?n.eventExpression(e.filter):void 0,r=null!=e.stream?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,i):e.merge&&(r=(t=e.merge.map((e=>n.get(e))))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map((e=>n.get(e))),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(i)),null!=e.throttle&&(r=r.throttle(+e.throttle)),null!=e.debounce&&(r=r.debounce(+e.debounce)),null==r&&d("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,i=ne(i=e.source)?i.$ref:i,r=n.get(i),o=e.update,a=void 0;r||d("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(e,r,t,o,a)},getState:function(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach((n=>{const r=t.signals[n];e.signals(n,r)&&(i[n]=r.value)}))}if(e.data){var r=n.data={};Object.keys(t.data).forEach((n=>{const i=t.data[n];e.data(n,i)&&(r[n]=i.input.value)}))}return t.subcontext&&!1!==e.recurse&&(n.subcontext=t.subcontext.map((t=>t.getState(e)))),n},setState:function(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach((e=>{n.update(t.signals[e],r[e],JD)})),Object.keys(i||{}).forEach((e=>{n.pulse(t.data[e].input,n.changeset().remove(p).insert(i[e]))})),(e.subcontext||[]).forEach(((e,n)=>{const i=t.subcontext[n];i&&i.setState(e)}))}};const tF="default";function nF(e,t){const n=e.globalCursor()?"undefined"!=typeof document&&document.body:e.container();if(n)return null==t?n.style.removeProperty("cursor"):n.style.cursor=t}function iF(e,t){var n=e._runtime.data;return c(n,t)||d("Unrecognized data set: "+t),n[t]}function rF(e,t){ji(t)||d("Second argument to changes must be a changeset.");const n=iF(this,e);return n.modified=!0,this.pulse(n.input,t)}function oF(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function aF(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function sF(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function uF(e,t,n){var i,r,o=e._renderer,a=o&&o.canvas();return a&&(r=sF(e),(i=Uf(t.changedTouches?t.changedTouches[0]:t,a))[0]-=r[0],i[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=function(e,t,n){const i=t?"group"===t.mark.marktype?t:t.mark.group:null;function r(e){var n,r=i;if(e)for(n=t;n;n=n.mark.group)if(n.mark.name===e){r=n;break}return r&&r.mark&&r.mark.interactive?r:{}}function o(e){if(!e)return n;ie(e)&&(e=r(e));const t=n.slice();for(;e;)t[0]-=e.x||0,t[1]-=e.y||0,e=e.mark&&e.mark.group;return t}return{view:s(e),item:s(t||{}),group:r,xy:o,x:e=>o(e)[0],y:e=>o(e)[1]}}(e,n,i),t}const lF="view",cF={trap:!1};function fF(e,t,n,i){e._eventListeners.push({type:n,sources:u(t),handler:i})}function dF(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return!(!1===i||ne(i)&&!i[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function hF(e){return e.item}function pF(e){return e.item.mark.source}function mF(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function gF(e,t,n){const i=document.createElement(e);for(const r in t)i.setAttribute(r,t[r]);return null!=n&&(i.textContent=n),i}function yF(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),fF(i,t,r,o),e.set=e=>{t.value=e,t.dispatchEvent(function(e){return"undefined"!=typeof Event?new Event(e):{type:e}}(r))}}function vF(e,t,n,i){const r=i.signal(n.signal),o=gF("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(gF("label"));a.appendChild(gF("span",{class:"vega-bind-name"},n.name||n.signal)),t.appendChild(o);let s=bF;switch(n.input){case"checkbox":s=xF;break;case"select":s=wF;break;case"radio":s=_F;break;case"range":s=AF}s(e,a,n,r)}function bF(e,t,n,i){const r=gF("input");for(const o in n)"signal"!==o&&"element"!==o&&r.setAttribute("input"===o?"type":o,n[o]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",(()=>e.update(r.value))),e.elements=[r],e.set=e=>r.value=e}function xF(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=gF("input",r);t.appendChild(o),o.addEventListener("change",(()=>e.update(o.checked))),e.elements=[o],e.set=e=>o.checked=!!e||null}function wF(e,t,n,i){const r=gF("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((e,t)=>{const n={value:e};kF(e,i)&&(n.selected=!0),r.appendChild(gF("option",n,(o[t]||e)+""))})),t.appendChild(r),r.addEventListener("change",(()=>{e.update(n.options[r.selectedIndex])})),e.elements=[r],e.set=e=>{for(let t=0,i=n.options.length;t<i;++t)if(kF(n.options[t],e))return void(r.selectedIndex=t)}}function _F(e,t,n,i){const r=gF("span",{class:"vega-bind-radio"}),o=n.labels||[];t.appendChild(r),e.elements=n.options.map(((t,a)=>{const s={type:"radio",name:n.signal,value:t};kF(t,i)&&(s.checked=!0);const u=gF("input",s);u.addEventListener("change",(()=>e.update(t)));const l=gF("label",{},(o[a]||t)+"");return l.prepend(u),r.appendChild(l),u})),e.set=t=>{const n=e.elements,i=n.length;for(let e=0;e<i;++e)kF(n[e].value,t)&&(n[e].checked=!0)}}function AF(e,t,n,i){i=void 0!==i?i:(+n.max+ +n.min)/2;const r=null!=n.max?n.max:Math.max(100,+i)||100,o=n.min||Math.min(0,r,+i)||0,a=n.step||de(o,r,100),s=gF("input",{type:"range",name:n.signal,min:o,max:r,step:a});s.value=i;const u=gF("span",{},+i);t.appendChild(s),t.appendChild(u);const l=()=>{u.textContent=s.value,e.update(+s.value)};s.addEventListener("input",l),s.addEventListener("change",l),e.elements=[s],e.set=e=>{s.value=e,u.textContent=e}}function kF(e,t){return e===t||e+""==t+""}function DF(e,t,n,i,r,o){return(t=t||new i(e.loader())).initialize(n,oF(e),aF(e),sF(e),r,o).background(e.background())}function FF(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function CF(e,t,n){if("string"==typeof t){if("undefined"==typeof document)return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.textContent=""}catch(i){t=null,e.error(i)}return t}const EF=e=>+e||0;function $F(e){return ne(e)?{top:EF(e.top),bottom:EF(e.bottom),left:EF(e.left),right:EF(e.right)}:(e=>({top:e,bottom:e,left:e,right:e}))(EF(e))}async function SF(e,t,n,i){const r=ph(t),o=r&&r.headless;return o||d("Unrecognized renderer type: "+t),await e.runAsync(),DF(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}var MF="width",BF="height",zF="padding",OF={skip:!0};function NF(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===zF?i.left+i.right:0)}function RF(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===zF?i.top+i.bottom:0)}function TF(e,t){return t.modified&&f(t.input.value)&&!e.startsWith("_:vega:_")}function PF(e,t){return!("parent"===e||t instanceof dr.proxy)}function jF(e,t,n,i){const r=e.element();r&&r.setAttribute("title",function(e){return null==e?"":f(e)?LF(e):ne(e)&&!he(e)?(t=e,Object.keys(t).map((e=>{const n=t[e];return e+": "+(f(n)?LF(n):qF(n))})).join("\n")):e+"";var t}(i))}function LF(e){return"["+e.map(qF).join(", ")+"]"}function qF(e){return f(e)?"[…]":ne(e)&&!he(e)?"{…}":e}function UF(e,t){const n=this;if(t=t||{},lr.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),null!=t.logLevel&&n.logLevel(t.logLevel),t.locale||e.locale){const i=v({},e.locale,t.locale);n.locale(Le(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||dh.Canvas,n._scenegraph=new Nf;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||jF,n._redraw=!0,n._handler=(new dd).scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(e){const t=v({defaults:{}},e),n=(e,t)=>{t.forEach((t=>{f(e[t])&&(e[t]=ee(e[t]))}))};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=function(e,t,n){return KD(e,dr,ND,n).parse(t)}(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((e=>({state:null,param:v({},e)}))),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=NF(n,n._width),n._viewHeight=RF(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(e){var t=e._signals,n=t[MF],i=t[BF],r=t[zF];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,(t=>{e._width=t.size,e._viewWidth=NF(e,t.size),o()}),{size:n}),e._resizeHeight=e.add(null,(t=>{e._height=t.size,e._viewHeight=RF(e,t.size),o()}),{size:i});const a=e.add(null,o,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,a.rank=r.rank+1}(n),function(e){e.add(null,(t=>(e._background=t.bg,e._resize=1,t.bg)),{bg:e._signals.background})}(n),function(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:tF,item:null}));e.on(e.events("view","pointermove"),t,((e,n)=>{const i=t.value,r=i?ie(i)?i:i.user:tF,o=n.item&&n.item.cursor||null;return i&&r===i.user&&o==i.item?i:{user:r,item:o}})),e.add(null,(function(t){let n=t.cursor,i=this.value;return ie(n)||(i=n.item,n=n.user),nF(e,n&&n!==tF?n:i||n),i}),{cursor:t})}(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function IF(e,t){return c(e._signals,t)?e._signals[t]:d("Unrecognized signal name: "+fe(t))}function WF(e,t){const n=(e._targets||[]).filter((e=>e._update&&e._update.handler===t));return n.length?n[0]:null}function HF(e,t,n,i){let r=WF(n,i);return r||(r=FF(e,(()=>i(t,n.value))),r.handler=i,e.on(n,null,r)),e}function GF(e,t,n){const i=WF(t,n);return i&&t._targets.remove(i),e}t(UF,lr,{async evaluate(e,t,n){if(await lr.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,r=sF(i=this),o=oF(i),a=aF(i),i._renderer.background(i.background()),i._renderer.resize(o,a,r),i._handler.origin(r),i._resizeListeners.forEach((e=>{try{e(o,a)}catch(t){i.error(t)}}))),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(s){this.error(s)}var i,r,o,a;return n&&Ei(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=null!=e?e+"":null;return t!==this._desc&&eF(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=IF(this,e);return 1===arguments.length?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",$F(e)):$F(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(ph(e)||d("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(lr.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(IF(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,i,r,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(MF,n,OF),a._resizeWidth.skip(!0)),a.height()!==i&&(s=1,a.signal(BF,i,OF),a._resizeHeight.skip(!0)),a._viewWidth!==e&&(a._resize=1,a._viewWidth=e),a._viewHeight!==t&&(a._resize=1,a._viewHeight=t),a._origin[0]===r[0]&&a._origin[1]===r[1]||(a._resize=1,a._origin=r),s&&a.run("enter"),o&&a.runAfter((e=>e.resize()))}),!1,1)},addEventListener(e,t,n){let i=t;return n&&!1===n.trap||(i=FF(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n,i,r=this._handler.handlers(e),o=r.length;--o>=0;)if(i=r[o].type,n=r[o].handler,e===i&&(t===n||t===n.raw)){this._handler.off(i,n);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return HF(this,e,IF(this,e),t)},removeSignalListener(e,t){return GF(this,IF(this,e),t)},addDataListener(e,t){return HF(this,e,iF(this,e).values,t)},removeDataListener(e,t){return GF(this,iF(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=nF(this,null);this._globalCursor=!!e,t&&nF(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push(function(e,t,n){var i=new dn,r=t;return null==t?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(e,t,n){t=+t,n=null==n?hn():+n,i._restart((function o(a){a+=r,i._restart(o,r+=t,n),e(a)}),t,n)},i.restart(e,t,n),i)}((function(t){e({timestamp:Date.now(),elapsed:t})}),t))},events:function(e,t,n){var i,r=this,o=new Yi(n),a=function(n,i){r.runAsync(null,(()=>{e===lF&&function(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return!1!==i&&!0!==r&&(!0===i||!1===r||(i?i[t]:r?!r[t]:e.preventDefault()))}(r,t)&&n.preventDefault(),o.receive(uF(r,n,i))}))};if("timer"===e)dF(r,"timer",t)&&r.timer(a,t);else if(e===lF)dF(r,"view",t)&&r.addEventListener(t,a,cF);else if("window"===e?dF(r,"window",t)&&"undefined"!=typeof window&&(i=[window]):"undefined"!=typeof document&&dF(r,"selector",t)&&(i=Array.from(document.querySelectorAll(e))),i){for(var s=0,u=i.length;s<u;++s)i[s].addEventListener(t,a);fF(r,i,t,a)}else r.warn("Can not resolve event source: "+e);return o},finalize:function(){var e,t,n,i,r,o=this._tooltip,a=this._timers,s=this._handler.handlers(),u=this._eventListeners;for(e=a.length;--e>=0;)a[e].stop();for(e=u.length;--e>=0;)for(t=(n=u[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);for(o&&o.call(this,this._handler,null,null,null),e=s.length;--e>=0;)r=s[e].type,i=s[e].handler,this._handler.off(r,i);return this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","pointerover",hF),pF,mF(e)),this.on(this.events("view","pointerout",hF),pF,mF(t)),this},data:function(e,t){return arguments.length<2?iF(this,e).values.value:rF.call(this,e,Li().remove(p).insert(t))},change:rF,insert:function(e,t){return rF.call(this,e,Li().insert(t))},remove:function(e,t){return rF.call(this,e,Li().remove(t))},scale:function(e){var t=this._runtime.scales;return c(t,e)||d("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=ph(i);e=n._el=e?CF(n,e,!0):null,function(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),eF(t,e.description()))}(n),o||n.error("Unrecognized renderer type: "+i);const a=o.handler||dd,s=e?o.renderer:o.headless;return n._renderer=s?DF(n,n._renderer,e,s):null,n._handler=function(e,t,n,i){const r=new i(e.loader(),FF(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,sF(e),e);return t&&t.handlers().forEach((e=>{r.on(e.type,e.handler)})),r}(n,n._handler,e,a),n._redraw=!0,e&&"none"!==r&&(t=t?n._elBind=CF(n,t,!0):e.appendChild(gF("form",{class:"vega-bindings"})),n._bind.forEach((e=>{e.param.element&&"container"!==r&&(e.element=CF(n,e.param.element,!!e.param.input))})),n._bind.forEach((e=>{!function(e,t,n){if(!t)return;const i=n.param;let r=n.state;r||(r=n.state={elements:null,active:!1,set:null,update:t=>{t!=e.signal(i.signal)&&e.runAsync(null,(()=>{r.source=!0,e.signal(i.signal,t)}))}},i.debounce&&(r.update=b(i.debounce,r.update))),(null==i.input&&i.element?yF:vF)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,(()=>{r.source?r.source=!1:r.set(e.signal(i.signal))})),r.active=!0)}(n,e.element||t,e)}))),n},toImageURL:async function(e,t){e!==dh.Canvas&&e!==dh.SVG&&e!==dh.PNG&&d("Unrecognized image type: "+e);const n=await SF(this,e,t);return e===dh.SVG?function(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await SF(this,dh.Canvas,e,t)).canvas()},toSVG:async function(e){return(await SF(this,dh.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:TF,signals:PF,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(e=>{e._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let e=null;const t=()=>{null!=e&&e();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}});const VF="[",YF="]",XF=/[[\]{}]/,JF={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let KF,QF;function ZF(e,t,n){return KF=t||"view",QF=n||JF,tC(e.trim()).map(nC)}function eC(e,t,n,i,r){const o=e.length;let a,s=0;for(;t<o;++t){if(a=e[t],!s&&a===n)return t;r&&r.indexOf(a)>=0?--s:i&&i.indexOf(a)>=0&&++s}return t}function tC(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=eC(e,r,",","[{","]}"),t.push(e.substring(i,r).trim()),i=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function nC(e){return"["===e[0]?function(e){const t=e.length;let n,i=1;if(i=eC(e,i,YF,VF,YF),i===t)throw"Empty between selector: "+e;if(n=tC(e.substring(1,i)),2!==n.length)throw"Between selector must have two elements: "+e;if(e=e.slice(i+1).trim(),">"!==e[0])throw"Expected '>' after between selector: "+e;n=n.map(nC);const r=nC(e.slice(1).trim());if(r.between)return{between:n,stream:r};r.between=n;return r}(e):function(e){const t={source:KF},n=[];let i,r,o=[0,0],a=0,s=0,u=e.length,l=0;if("}"===e[u-1]){if(l=e.lastIndexOf("{"),!(l>=0))throw"Unmatched right brace: "+e;try{o=function(e){const t=e.split(",");if(!e.length||t.length>2)throw e;return t.map((t=>{const n=+t;if(n!=n)throw e;return n}))}(e.substring(l+1,u-1))}catch(f){throw"Invalid throttle specification: "+e}u=(e=e.slice(0,l).trim()).length,l=0}if(!u)throw e;"@"===e[0]&&(a=++l);i=eC(e,l,":"),i<u&&(n.push(e.substring(s,i).trim()),s=l=++i);if(l=eC(e,l,VF),l===u)n.push(e.substring(s,u).trim());else if(n.push(e.substring(s,l).trim()),r=[],s=++l,s===u)throw"Unmatched left bracket: "+e;for(;l<u;){if(l=eC(e,l,YF),l===u)throw"Unmatched left bracket: "+e;if(r.push(e.substring(s,l).trim()),l<u-1&&e[++l]!==VF)throw"Expected left bracket: "+e;s=++l}if(!(u=n.length)||XF.test(n[u-1]))throw"Invalid event selector: "+e;u>1?(t.type=n[1],a?t.markname=n[0].slice(1):(c=n[0],QF[c]?t.marktype=n[0]:t.source=n[0])):t.type=n[0];var c;"!"===t.type.slice(-1)&&(t.consume=!0,t.type=t.type.slice(0,-1));null!=r&&(t.filter=r);o[0]&&(t.throttle=o[0]);o[1]&&(t.debounce=o[1]);return t}(e)}function iC(e){return ne(e)?e:{type:e||"pad"}}const rC=e=>+e||0;function oC(e){return ne(e)?e.signal?e:{top:rC(e.top),bottom:rC(e.bottom),left:rC(e.left),right:rC(e.right)}:{top:t=rC(e),bottom:t,left:t,right:t};var t}const aC=e=>ne(e)&&!f(e)?v({},e):{value:e};function sC(e,t,n,i){if(null!=n){return ne(n)&&!f(n)||f(n)&&n.length&&ne(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1}return 0}function uC(e,t,n){for(const i in t)sC(e,i,t[i]);for(const i in n)sC(e,i,n[i],"update")}function lC(e,t,n){for(const i in t)n&&c(n,i)||(e[i]=v(e[i]||{},t[i]));return e}function cC(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const fC="mark",dC="frame",hC="scope",pC="legend-label",mC="title-text",gC="title-subtitle";function yC(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const vC=e=>ie(e)?fe(e):e.signal?`(${e.signal})`:_C(e);function bC(e){if(null!=e.gradient)return function(e){const t=[e.start,e.stop,e.count].map((e=>null==e?null:fe(e)));for(;t.length&&null==S(t);)t.pop();return t.unshift(vC(e.gradient)),`gradient(${t.join(",")})`}(e);let t=e.signal?`(${e.signal})`:e.color?function(e){return e.c?xC("hcl",e.h,e.c,e.l):e.h||e.s?xC("hsl",e.h,e.s,e.l):e.l||e.a?xC("lab",e.l,e.a,e.b):e.r||e.g||e.b?xC("rgb",e.r,e.g,e.b):null}(e.color):null!=e.field?_C(e.field):void 0!==e.value?fe(e.value):void 0;return null!=e.scale&&(t=function(e,t){const n=vC(e.scale);null!=e.range?t=`lerp(_range(${n}), ${+e.range})`:(void 0!==t&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(1==+e.band?"":"*"+wC(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),null==t&&(t="0"));return t}(e,t)),void 0===t&&(t=null),null!=e.exponent&&(t=`pow(${t},${wC(e.exponent)})`),null!=e.mult&&(t+=`*${wC(e.mult)}`),null!=e.offset&&(t+=`+${wC(e.offset)}`),e.round&&(t=`round(${t})`),t}const xC=(e,t,n,i)=>`(${e}(${[t,n,i].map(bC).join(",")})+'')`;function wC(e){return ne(e)?"("+bC(e)+")":e}function _C(e){return AC(ne(e)?e:{datum:e})}function AC(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):d("Invalid field reference: "+fe(e));return e.signal||(i=ie(i)?Ue(i).map(fe).join("]["):AC(i)),t+"["+i+"]"}function kC(e,t,n,i,r,o){const a={};(o=o||{}).encoders={$encode:a},e=function(e,t,n,i,r){const o={},a={};let s,l,c,f;for(l in l="lineBreak","text"!==t||null==r[l]||cC(l,e)||yC(o,l,r[l]),("legend"==n||String(n).startsWith("axis"))&&(n=null),f=n===dC?r.group:n===fC?v({},r.mark,r[t]):null,f)c=cC(l,e)||("fill"===l||"stroke"===l)&&(cC("fill",e)||cC("stroke",e)),c||yC(o,l,f[l]);for(l in u(i).forEach((t=>{const n=r.style&&r.style[t];for(const i in n)cC(i,e)||yC(o,i,n[i])})),e=v({},e),o)f=o[l],f.signal?(s=s||{})[l]=f:a[l]=f;return e.enter=v(a,e.enter),s&&(e.update=v(s,e.update)),e}(e,t,n,i,r.config);for(const s in e)a[s]=DC(e[s],t,o,r);return o}function DC(e,t,n,i){const r={},o={};for(const s in e)null!=e[s]&&(r[s]=FC((a=e[s],f(a)?function(e){let t="";return e.forEach((e=>{const n=bC(e);t+=e.test?`(${e.test})?${n}:`:n})),":"===S(t)&&(t+="null"),t}(a):bC(a)),i,n,o));var a;return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function FC(e,t,n,i){const r=UD(e,t);return r.$fields.forEach((e=>i[e]=1)),v(n,r.$params),r.$expr}const CC=["value","update","init","react","bind"];function EC(e,t){d(e+' for "outer" push: '+fe(t))}function $C(e,t){const n=e.name;if("outer"===e.push)t.signals[n]||EC("No prior signal definition",n),CC.forEach((t=>{void 0!==e[t]&&EC("Invalid property ",t)}));else{const i=t.addSignal(n,e.value);!1===e.react&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function SC(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function MC(e,t,n,i){return new SC(e,t,n,i)}function BC(e,t){return MC("operator",e,t)}function zC(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function OC(e,t){return t?{$field:e,$name:t}:{$field:e}}const NC=OC("key");function RC(e,t){return{$compare:e,$order:t}}function TC(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const PC="scope",jC="view";function LC(e){return e&&e.signal}function qC(e){if(LC(e))return!0;if(ne(e))for(const t in e)if(qC(e[t]))return!0;return!1}function UC(e,t){return null!=e?e:t}function IC(e){return e&&e.signal||e}const WC="timer";function HC(e,t){return(e.merge?GC:e.stream?VC:e.type?YC:d("Invalid stream specification: "+fe(e)))(e,t)}function GC(e,t){const n=XC({merge:e.merge.map((e=>HC(e,t)))},e,t);return t.addStream(n).id}function VC(e,t){const n=XC({stream:HC(e.stream,t)},e,t);return t.addStream(n).id}function YC(e,t){let n;var i;e.type===WC?(n=t.event(WC,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((i=e.source)===PC?jC:i||jC,e.type);const r=XC({stream:n},e,t);return 1===Object.keys(r).length?n:t.addStream(r).id}function XC(e,t,n){let i=t.between;return i&&(2!==i.length&&d('Stream "between" parameter must have 2 entries: '+fe(t)),e.between=[HC(i[0],n),HC(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(function(e,t,n){const i="event.item";return i+(e&&"*"!==e?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}(t.marktype,t.markname,t.markrole)),t.source===PC&&i.push("inScope(event.item)"),i.length&&(e.filter=UD("("+i.join(")&&(")+")",n).$expr),null!=(i=t.throttle)&&(e.throttle=+i),null!=(i=t.debounce)&&(e.debounce=+i),t.consume&&(e.consume=!0),e}const JC={code:"_.$value",ast:{type:"Identifier",value:"value"}};function KC(e,t,n){const i=e.encode,r={target:n};let o=e.events,a=e.update,s=[];o||d("Signal update missing events specification."),ie(o)&&(o=ZF(o,t.isSubscope()?PC:jC)),o=u(o).filter((e=>e.signal||e.scale?(s.push(e),0):1)),s.length>1&&(s=[QC(s)]),o.length&&s.push(o.length>1?{merge:o}:o[0]),null!=i&&(a&&d("Signal encode and update are mutually exclusive."),a="encode(item(),"+fe(i)+")"),r.update=ie(a)?UD(a,t):null!=a.expr?UD(a.expr,t):null!=a.value?a.value:null!=a.signal?{$expr:JC,$params:{$value:t.signalRef(a.signal)}}:d("Invalid signal update specification."),e.force&&(r.options={force:!0}),s.forEach((e=>t.addUpdate(v(function(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):HC(e,t)}}(e,t),r))))}function QC(e){return{signal:"["+e.map((e=>e.scale?'scale("'+e.scale+'")':e.signal))+"]"}}const ZC=e=>(t,n,i)=>MC(e,n,t||void 0,i),eE=ZC("aggregate"),tE=ZC("axisticks"),nE=ZC("bound"),iE=ZC("collect"),rE=ZC("compare"),oE=ZC("datajoin"),aE=ZC("encode"),sE=ZC("expression"),uE=ZC("facet"),lE=ZC("field"),cE=ZC("key"),fE=ZC("legendentries"),dE=ZC("load"),hE=ZC("mark"),pE=ZC("multiextent"),mE=ZC("multivalues"),gE=ZC("overlap"),yE=ZC("params"),vE=ZC("prefacet"),bE=ZC("projection"),xE=ZC("proxy"),wE=ZC("relay"),_E=ZC("render"),AE=ZC("scale"),kE=ZC("sieve"),DE=ZC("sortitems"),FE=ZC("viewlayout"),CE=ZC("values");let EE=0;const $E={min:"min",max:"max",count:"sum"};function SE(e,t){const n=t.getScale(e.name).params;let i;for(i in n.domain=OE(e.domain,e,t),null!=e.range&&(n.range=UE(e,t,n)),null!=e.interpolate&&function(e,t){t.interpolate=ME(e.type||e),null!=e.gamma&&(t.interpolateGamma=ME(e.gamma))}(e.interpolate,n),null!=e.nice&&(n.nice=function(e,t){return e.signal?t.signalRef(e.signal):ne(e)?{interval:ME(e.interval),step:ME(e.step)}:ME(e)}(e.nice,t)),null!=e.bins&&(n.bins=function(e,t){return e.signal||f(e)?BE(e,t):t.objectProperty(e)}(e.bins,t)),e)c(n,i)||"name"===i||(n[i]=ME(e[i],t))}function ME(e,t){return ne(e)?e.signal?t.signalRef(e.signal):d("Unsupported object: "+fe(e)):e}function BE(e,t){return e.signal?t.signalRef(e.signal):e.map((e=>ME(e,t)))}function zE(e){d("Can not find data set: "+fe(e))}function OE(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(f(e)?NE:e.fields?TE:RE)(e,t,n);null==t.domainMin&&null==t.domainMax||d("No scale domain defined for domainMin/domainMax to override.")}function NE(e,t,n){return e.map((e=>ME(e,n)))}function RE(e,t,n){const i=n.getData(e.data);return i||zE(e.data),Xs(t.type)?i.valuesRef(n,e.field,jE(e.sort,!1)):Zs(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function TE(e,t,n){const i=e.data,r=e.fields.reduce(((e,t)=>(t=ie(t)?{data:i,field:t}:f(t)||t.signal?function(e,t){const n="_:vega:_"+EE++,i=iE({});if(f(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+fe(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,kE({})]),{data:n,field:"data"}}(t,n):t,e.push(t),e)),[]);return(Xs(t.type)?PE:Zs(t.type)?LE:qE)(e,n,r)}function PE(e,t,n){const i=jE(e.sort,!0);let r,o;const a=n.map((e=>{const n=t.getData(e.data);return n||zE(e.data),n.countsRef(t,e.field,i)})),s={groupby:NC,pulse:a};i&&(r=i.op||"count",o=i.field?TC(r,i.field):"count",s.ops=[$E[r]],s.fields=[t.fieldRef(o)],s.as=[o]),r=t.add(eE(s));const u=t.add(iE({pulse:zC(r)}));return o=t.add(CE({field:NC,sort:t.sortRef(i),pulse:zC(u)})),zC(o)}function jE(e,t){return e&&(e.field||e.op?e.field||"count"===e.op?t&&e.field&&e.op&&!$E[e.op]&&d("Multiple domain scales can not be sorted using "+e.op):d("No field provided for sort aggregate op: "+e.op):ne(e)?e.field="key":e={field:"key"}),e}function LE(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||zE(e.data),n.domainRef(t,e.field)}));return zC(t.add(mE({values:i})))}function qE(e,t,n){const i=n.map((e=>{const n=t.getData(e.data);return n||zE(e.data),n.extentRef(t,e.field)}));return zC(t.add(pE({extents:i})))}function UE(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(ie(r)){if(i&&c(i,r))return UE(e=v({},e,{range:i[r]}),t,n);"width"===r?r=[0,{signal:"width"}]:"height"===r?r=Xs(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:d("Unrecognized scale range value: "+fe(r))}else{if(r.scheme)return n.scheme=f(r.scheme)?BE(r.scheme,t):ME(r.scheme,t),r.extent&&(n.schemeExtent=BE(r.extent,t)),void(r.count&&(n.schemeCount=ME(r.count,t)));if(r.step)return void(n.rangeStep=ME(r.step,t));if(Xs(e.type)&&!f(r))return OE(r,e,t);f(r)||d("Unsupported range type: "+fe(r))}return r.map((e=>(f(e)?BE:ME)(e,t)))}function IE(e,t,n){return f(e)?e.map((e=>IE(e,t,n))):ne(e)?e.signal?n.signalRef(e.signal):"fit"===t?e:d("Unsupported parameter object: "+fe(e)):e}const WE="top",HE="left",GE="right",VE="bottom",YE="center",XE="index",JE="label",KE="perc",QE="value",ZE="guide-label",e$="guide-title",t$="group-title",n$="group-subtitle",i$="symbol",r$="gradient",o$="discrete",a$="size",s$=[a$,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],u$={name:1,style:1,interactive:1},l$={value:0},c$={value:1},f$="group",d$="rect",h$="rule",p$="text";function m$(e){return e.type=f$,e.interactive=e.interactive||!1,e}function g$(e,t){const n=(n,i)=>UC(e[n],UC(t[n],i));return n.isVertical=n=>"vertical"===UC(e.direction,t.direction||(n?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>UC(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>UC(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>UC(e.columns,UC(t.columns,+n.isVertical(!0))),n}function y$(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function v$(e,t,n){return`item.anchor === 'start' ? ${e} : item.anchor === 'end' ? ${t} : ${n}`}const b$=v$(fe(HE),fe(GE),fe(YE));function x$(e,t){return t?e?ne(e)?Object.assign({},e,{offset:x$(e.offset,t)}):{value:e,offset:t}:t:e}function w$(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=lC(e.encode,t,u$)):e.interactive=!1,e}function _$(e,t,n,i){const r=g$(e,n),o=r.isVertical(),a=r.gradientThickness(),s=r.gradientLength();let u,l,c,f,d;o?(l=[0,1],c=[0,0],f=a,d=s):(l=[0,0],c=[1,0],f=s,d=a);const h={enter:u={opacity:l$,x:l$,y:l$,width:aC(f),height:aC(d)},update:v({},u,{opacity:c$,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:l$}};return uC(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),w$({type:d$,role:"legend-gradient",encode:h},i)}function A$(e,t,n,i,r){const o=g$(e,n),a=o.isVertical(),s=o.gradientThickness(),u=o.gradientLength();let l,c,f,d,h="";a?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const p={opacity:l$,fill:{scale:t,field:QE}};p[l]={signal:h+"datum."+KE,mult:u},p[c]=l$,p[f]={signal:h+"datum.perc2",mult:u},p[d]=aC(s);const m={enter:p,update:v({},p,{opacity:c$}),exit:{opacity:l$}};return uC(m,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),w$({type:d$,role:"legend-band",key:QE,from:r,encode:m},i)}const k$=`datum.${KE}<=0?"${HE}":datum.${KE}>=1?"${GE}":"${YE}"`,D$=`datum.${KE}<=0?"${VE}":datum.${KE}>=1?"${WE}":"middle"`;function F$(e,t,n,i){const r=g$(e,t),o=r.isVertical(),a=aC(r.gradientThickness()),s=r.gradientLength();let u,l,c,f,d=r("labelOverlap"),h="";const p={enter:u={opacity:l$},update:l={opacity:c$,text:{field:JE}},exit:{opacity:l$}};return uC(p,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:UC(e.labelLimit,t.gradientLabelLimit)}),o?(u.align={value:"left"},u.baseline=l.baseline={signal:D$},c="y",f="x",h="1-"):(u.align=l.align={signal:k$},u.baseline={value:"top"},c="x",f="y"),u[c]=l[c]={signal:h+"datum."+KE,mult:s},u[f]=l[f]=a,a.offset=UC(e.labelOffset,t.gradientLabelOffset)||0,d=d?{separation:r("labelSeparation"),method:d,order:"datum."+XE}:void 0,w$({type:p$,role:pC,style:ZE,key:QE,from:i,encode:p,overlap:d},n)}function C$(e,t,n,i,r){const o=g$(e,t),a=n.entries,s=!(!a||!a.interactive),u=a?a.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.offset : datum.${a$}`,h=l?aC(l):{field:a$},p=`datum.${XE}`,m=`max(1, ${r})`;let g,y,v,b,x;h.mult=.5,g={enter:y={opacity:l$,x:{signal:d,mult:.5,offset:c},y:h},update:v={opacity:c$,x:y.x,y:y.y},exit:{opacity:l$}};let w=null,_=null;e.fill||(w=t.symbolBaseFillColor,_=t.symbolBaseStrokeColor),uC(g,{fill:o("symbolFillColor",w),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",_),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),s$.forEach((t=>{e[t]&&(v[t]=y[t]={scale:e[t],field:QE})}));const A=w$({type:"symbol",role:"legend-symbol",key:QE,from:f,clip:!!l||void 0,encode:g},n.symbols),k=aC(c);k.offset=o("labelOffset"),g={enter:y={opacity:l$,x:{signal:d,offset:k},y:h},update:v={opacity:c$,text:{field:JE},x:y.x,y:y.y},exit:{opacity:l$}},uC(g,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const D=w$({type:p$,role:pC,style:ZE,key:QE,from:f,encode:g},n.labels);return g={enter:{noBound:{value:!l},width:l$,height:l?aC(l):l$,opacity:l$},exit:{opacity:l$},update:v={opacity:c$,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${m})`,v.row.signal=`${p}%${b}`,v.column.signal=`floor(${p} / ${b})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${m})`,v.column.signal=`${p} % ${m}`,x={field:p}),v.column.signal=`(${r})?${v.column.signal}:${p}`,m$({role:hC,from:i={facet:{data:i,name:"value",groupby:XE}},encode:lC(g,a,u$),marks:[A,D],name:u,interactive:s,sort:x})}const E$='item.orient === "left"',$$='item.orient === "right"',S$=`(${E$} || ${$$})`,M$=`datum.vgrad && ${S$}`,B$=v$('"top"','"bottom"','"middle"'),z$=`datum.vgrad && ${$$} ? (${v$('"right"','"left"','"center"')}) : (${S$} && !(datum.vgrad && ${E$})) ? "left" : ${b$}`,O$=`item._anchor || (${S$} ? "middle" : "start")`,N$=`${M$} ? (${E$} ? -90 : 90) : 0`,R$=`${S$} ? (datum.vgrad ? (${$$} ? "bottom" : "top") : ${B$}) : "top"`;function T$(e,t){let n;return ne(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+P$(e.path)+")":e.sphere&&(n="geoShape("+P$(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function P$(e){return ne(e)&&e.signal?e.signal:fe(e)}function j$(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===f$?hC:t||fC}function L$(e){return{marktype:e.type,name:e.name||void 0,role:e.role||j$(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function q$(e,t){return e&&e.signal?t.signalRef(e.signal):!1!==e}function U$(e,t){const n=hr(e.type);n||d("Unrecognized transform type: "+fe(e.type));const i=MC(n.type.toLowerCase(),null,I$(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function I$(e,t,n){const i={},r=e.params.length;for(let o=0;o<r;++o){const r=e.params[o];i[r.name]=W$(r,t,n)}return i}function W$(e,t,n){const i=e.type,r=t[e.name];return"index"===i?function(e,t,n){ie(t.from)||d('Lookup "from" parameter must be a string literal.');return n.getData(t.from).lookupRef(n,t.key)}(0,t,n):void 0!==r?"param"===i?function(e,t,n){const i=t[e.name];return e.array?(f(i)||d("Expected an array of sub-parameters. Instead: "+fe(i)),i.map((t=>G$(e,t,n)))):G$(e,i,n)}(e,t,n):"projection"===i?n.projectionRef(t[e.name]):e.array&&!LC(r)?r.map((t=>H$(e,t,n))):H$(e,r,n):void(e.required&&d("Missing required "+fe(t.type)+" parameter: "+fe(e.name)))}function H$(e,t,n){const i=e.type;if(LC(t))return J$(i)?d("Expression references can not be signals."):K$(i)?n.fieldRef(t):Q$(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||K$(i);return r&&V$(t)?n.exprRef(t.expr,t.as):r&&Y$(t)?OC(t.field,t.as):J$(i)?UD(t,n):X$(i)?zC(n.getData(t).values):K$(i)?OC(t):Q$(i)?n.compareRef(t):t}}function G$(e,t,n){const i=e.params.length;let r;for(let a=0;a<i;++a){r=e.params[a];for(const e in r.key)if(r.key[e]!==t[e]){r=null;break}if(r)break}r||d("Unsupported parameter: "+fe(t));const o=v(I$(r,t,n),r.key);return zC(n.add(yE(o)))}const V$=e=>e&&e.expr,Y$=e=>e&&e.field,X$=e=>"data"===e,J$=e=>"expr"===e,K$=e=>"field"===e,Q$=e=>"compare"===e;function Z$(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:zC(t.getData(e.data).output)}function eS(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}function tS(e){return ie(e)?e:null}function nS(e,t,n){const i=TC(n.op,n.field);let r;if(t.ops){for(let o=0,a=t.as.length;o<a;++o)if(t.as[o]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function iS(e,t,n,i,r,o,a){const s=t[n]||(t[n]={}),u=function(e){return ne(e)?("descending"===e.order?"-":"+")+TC(e.op,e.field):""}(o);let l,c,f=tS(r);if(null!=f&&(e=t.scope,f+=u?"|"+u:"",l=s[f]),!l){const n=o?{field:NC,pulse:t.countsRef(e,r,o)}:{field:e.fieldRef(r),pulse:zC(t.output)};u&&(n.sort=e.sortRef(o)),c=e.add(MC(i,void 0,n)),a&&(t.index[r]=c),l=zC(c),null!=f&&(s[f]=l)}return l}function rS(e,t,n){const i=e.remove,r=e.insert,o=e.toggle,a=e.modify,s=e.values,u=t.add(BC()),l=UD("if("+e.trigger+',modify("'+n+'",'+[r,i,o,a,s].map((e=>null==e?"null":e)).join(",")+"),0)",t);u.update=l.$expr,u.params=l.$params}function oS(e,t){const n=j$(e),i=e.type===f$,r=e.from&&e.from.facet,o=e.overlap;let a,s,l,c,f,h,p,m=e.layout||n===hC||n===dC;const g=n===fC||m||r,y=function(e,t,n){let i,r,o,a,s;return e?(i=e.facet)&&(t||d("Only group marks can be faceted."),null!=i.field?a=s=Z$(i,n):(e.data?s=zC(n.getData(e.data).aggregate):(o=U$(v({type:"aggregate",groupby:u(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=Z$(i,n),a=s=zC(n.add(o))),r=n.keyRef(i.groupby,!0))):a=zC(n.add(iE(null,[{}]))),a||(a=Z$(e,n)),{key:r,pulse:a,parent:s}}(e.from,i,t);s=t.add(oE({key:y.key||(e.key?OC(e.key):void 0),pulse:y.pulse,clean:!i}));const b=zC(s);s=l=t.add(iE({pulse:b})),s=t.add(hE({markdef:L$(e),interactive:q$(e.interactive,t),clip:T$(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:zC(s)}));const x=zC(s);s=c=t.add(aE(kC(e.encode,e.type,n,e.style,t,{mod:!1,pulse:x}))),s.params.parent=t.encode(),e.transform&&e.transform.forEach((e=>{const n=U$(e,t),i=n.metadata;(i.generates||i.changes)&&d("Mark transforms should not generate new data."),i.nomod||(c.params.mod=!0),n.params.pulse=zC(s),t.add(s=n)})),e.sort&&(s=t.add(DE({sort:t.compareRef(e.sort),pulse:zC(s)})));const w=zC(s);(r||m)&&(m=t.add(FE({layout:t.objectProperty(e.layout),legends:t.legends,mark:x,pulse:w})),h=zC(m));const _=t.add(nE({mark:x,pulse:h||w}));p=zC(_),i&&(g&&(a=t.operators,a.pop(),m&&a.pop()),t.pushState(w,h||p,b),r?function(e,t,n){const i=e.from.facet,r=i.name,o=Z$(i,t);let a;i.name||d("Facet must have a name: "+fe(i)),i.data||d("Facet must reference a data set: "+fe(i)),i.field?a=t.add(vE({field:t.fieldRef(i.field),pulse:o})):i.groupby?a=t.add(uE({key:t.keyRef(i.groupby),group:zC(t.proxy(n.parent)),pulse:o})):d("Facet must specify groupby or field: "+fe(i));const s=t.fork(),u=s.add(iE()),l=s.add(kE({pulse:zC(u)}));s.addData(r,new eS(s,u,u,l)),s.addSignal("parent",null),a.params.subflow={$subflow:s.parse(e).toRuntime()}}(e,t,y):g?function(e,t,n){const i=t.add(vE({pulse:n.pulse})),r=t.fork();r.add(kE()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}(e,t,y):t.parse(e),t.popState(),g&&(m&&a.push(m),a.push(_))),o&&(p=function(e,t,n){const i=e.method,r=e.bound,o=e.separation,a={separation:LC(o)?n.signalRef(o.signal):o,method:LC(i)?n.signalRef(i.signal):i,pulse:t};e.order&&(a.sort=n.compareRef({field:e.order}));if(r){const e=r.tolerance;a.boundTolerance=LC(e)?n.signalRef(e.signal):+e,a.boundScale=n.scaleRef(r.scale),a.boundOrient=r.orient}return zC(n.add(gE(a)))}(o,p,t));const A=t.add(_E({pulse:p})),k=t.add(kE({pulse:zC(A)},void 0,t.parent()));null!=e.name&&(f=e.name,t.addData(f,new eS(t,l,A,k)),e.on&&e.on.forEach((e=>{(e.insert||e.remove||e.toggle)&&d("Marks only support modify triggers."),rS(e,t,f)})))}function aS(e,t){const n=t.config.legend,i=e.encode||{},r=g$(e,n),o=i.legend||{},a=o.name||void 0,s=o.interactive,u=o.style,l={};let c,f,h,p=0;s$.forEach((t=>e[t]?(l[t]=e[t],p=p||e[t]):0)),p||d("Missing valid scale for legend.");const m=function(e,t){let n=e.type||i$;e.type||1!==function(e){return s$.reduce(((t,n)=>t+(e[n]?1:0)),0)}(e)||!e.fill&&!e.stroke||(n=Ys(t)?r$:Js(t)?o$:i$);return n!==r$?n:Js(t)?o$:r$}(e,t.scaleType(p)),g={title:null!=e.title,scales:l,type:m,vgrad:"symbol"!==m&&r.isVertical()},y=zC(t.add(iE(null,[g]))),v=zC(t.add(fE(f={type:m,scale:t.scaleRef(p),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return m===r$?(h=[_$(e,p,n,i.gradient),F$(e,n,i.labels,v)],f.count=f.count||t.signalRef(`max(2,2*floor((${IC(r.gradientLength())})/100))`)):m===o$?h=[A$(e,p,n,i.gradient,v),F$(e,n,i.labels,v)]:(c=function(e,t){const n=g$(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(e,n),h=[C$(e,n,i,v,IC(c.columns))],f.size=function(e,t,n){const i=IC(uS("size",e,n)),r=IC(uS("strokeWidth",e,n)),o=IC(function(e,t,n){return y$("fontSize",e)||function(e,t,n){const i=t.config.style[n];return i&&i[e]}("fontSize",t,n)}(n[1].encode,t,ZE));return UD(`max(ceil(sqrt(${i})+${r}),${o})`,t)}(e,t,h[0].marks)),h=[m$({role:"legend-entry",from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:h,layout:c,interactive:s})],g.title&&h.push(function(e,t,n,i){const r=g$(e,t),o={enter:{opacity:l$},update:{opacity:c$,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:l$}};return uC(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:O$},angle:{signal:N$},align:{signal:z$},baseline:{signal:R$},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),w$({type:p$,role:"legend-title",style:e$,from:i,encode:o},n)}(e,n,i.title,y)),oS(m$({role:"legend",from:y,encode:lC(sS(r,e,n),o,u$),marks:h,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:a,interactive:s,style:u}),t)}function sS(e,t,n){const i={enter:{},update:{}};return uC(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function uS(e,t,n){return t[e]?`scale("${t[e]}",datum)`:y$(e,n[0].encode)}eS.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let o=t[0],a=null,s=1;for(o&&"load"===o.type&&(o=t[1]),e.add(t[0]);s<n;++s)t[s].params.pulse=zC(t[s-1]),e.add(t[s]),"aggregate"===t[s].type&&(a=t[s]);return new eS(e,o,r,i,a)},eS.prototype={countsRef(e,t,n){const i=this,r=i.counts||(i.counts={}),o=tS(t);let a,s,u;return null!=o&&(e=i.scope,a=r[o]),a?n&&n.field&&nS(e,a.agg.params,n):(u={groupby:e.fieldRef(t,"key"),pulse:zC(i.output)},n&&n.field&&nS(e,u,n),s=e.add(eE(u)),a=e.add(iE({pulse:zC(s)})),a={agg:s,ref:zC(a)},null!=o&&(r[o]=a)),a.ref},tuplesRef(){return zC(this.values)},extentRef(e,t){return iS(e,this,"extent","extent",t,!1)},domainRef(e,t){return iS(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return iS(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return iS(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return iS(e,this,"indata","tupleindex",t,!0,!0)}};const lS=`item.orient==="${HE}"?-90:item.orient==="${GE}"?90:0`;function cS(e,t){const n=g$(e=ie(e)?{text:e}:e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,a=r.interactive,s=r.style,u=[],l=zC(t.add(iE(null,[{}])));return u.push(function(e,t,n,i){const r={value:0},o=e.text,a={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return uC(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),w$({type:p$,role:mC,style:t$,from:i,encode:a},n)}(e,n,function(e){const t=e.encode;return t&&t.title||v({name:e.name,interactive:e.interactive,style:e.style},t)}(e),l)),e.subtitle&&u.push(function(e,t,n,i){const r={value:0},o=e.subtitle,a={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return uC(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),w$({type:p$,role:gC,style:n$,from:i,encode:a},n)}(e,n,i.subtitle,l)),oS(m$({role:"title",from:l,encode:fS(n,r),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),t)}function fS(e,t){const n={enter:{},update:{}};return uC(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:b$},angle:{signal:lS},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),lC(n,t,u$)}function dS(e,t){const n=[];e.transform&&e.transform.forEach((e=>{n.push(U$(e,t))})),e.on&&e.on.forEach((n=>{rS(n,t,e.name)})),t.addDataPipeline(e.name,function(e,t,n){const i=[];let r,o,a,s,l,c=null,f=!1,d=!1;e.values?LC(e.values)||qC(e.format)?(i.push(pS(t,e)),i.push(c=hS())):i.push(c=hS({$ingest:e.values,$format:e.format})):e.url?qC(e.url)||qC(e.format)?(i.push(pS(t,e)),i.push(c=hS())):i.push(c=hS({$request:e.url,$format:e.format})):e.source&&(c=r=u(e.source).map((e=>zC(t.getData(e).output))),i.push(null));for(o=0,a=n.length;o<a;++o)s=n[o],l=s.metadata,c||l.source||i.push(c=hS()),i.push(s),l.generates&&(d=!0),l.modifies&&!d&&(f=!0),l.source?c=s:l.changes&&(c=null);r&&(a=r.length-1,i[0]=wE({derive:f,pulse:a?r:r[0]}),(f||a)&&i.splice(1,0,hS()));c||i.push(hS());return i.push(kE({})),i}(e,t,n))}function hS(e){const t=iE({},e);return t.metadata={source:!0},t}function pS(e,t){return dE({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const mS=e=>e===VE||e===WE,gS=(e,t,n)=>LC(e)?_S(e.signal,t,n):e===HE||e===WE?t:n,yS=(e,t,n)=>LC(e)?xS(e.signal,t,n):mS(e)?t:n,vS=(e,t,n)=>LC(e)?wS(e.signal,t,n):mS(e)?n:t,bS=(e,t,n)=>LC(e)?AS(e.signal,t,n):e===WE?{value:t}:{value:n},xS=(e,t,n)=>DS(`${e} === '${WE}' || ${e} === '${VE}'`,t,n),wS=(e,t,n)=>DS(`${e} !== '${WE}' && ${e} !== '${VE}'`,t,n),_S=(e,t,n)=>CS(`${e} === '${HE}' || ${e} === '${WE}'`,t,n),AS=(e,t,n)=>CS(`${e} === '${WE}'`,t,n),kS=(e,t,n)=>CS(`${e} === '${GE}'`,t,n),DS=(e,t,n)=>(t=null!=t?aC(t):t,n=null!=n?aC(n):n,FS(t)&&FS(n)?{signal:`${e} ? (${t=t?t.signal||fe(t.value):null}) : (${n=n?n.signal||fe(n.value):null})`}:[v({test:e},t)].concat(n||[])),FS=e=>null==e||1===Object.keys(e).length,CS=(e,t,n)=>({signal:`${e} ? (${ES(t)}) : (${ES(n)})`}),ES=e=>LC(e)?e.signal:null==e?null:fe(e),$S=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function SS(e,t,n,i){let r;if(t&&c(t,e))return t[e];if(c(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[e$][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[ZE][r]}return null}function MS(e){const t={};for(const n of e)if(n)for(const e in n)t[e]=1;return Object.keys(t)}function BS(e,t){return{scale:e.scale,range:t}}function zS(e,t,n,i,r){const o=g$(e,t),a=e.orient,s=e.gridScale,u=gS(a,1,-1),l=function(e,t){if(1===t);else if(ne(e)){let n=e=v({},e);for(;null!=n.mult;){if(!ne(n.mult))return n.mult=LC(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n=n.mult=v({},n.mult)}n.mult=t}else e=LC(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);return e}(e.offset,u);let c,f,d;const h={enter:c={opacity:l$},update:d={opacity:c$},exit:f={opacity:l$}};uC(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:e.scale,field:QE,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},m=yS(a,{signal:"height"},{signal:"width"}),g=s?{scale:s,range:0,mult:u,offset:l}:{value:0,offset:l},y=s?{scale:s,range:1,mult:u,offset:l}:v(m,{mult:u,offset:l});return c.x=d.x=yS(a,p,g),c.y=d.y=vS(a,p,g),c.x2=d.x2=vS(a,y),c.y2=d.y2=yS(a,y),f.x=yS(a,p),f.y=vS(a,p),w$({type:h$,role:"axis-grid",key:QE,from:i,encode:h},n)}function OS(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function NS(e,t,n,i,r,o){const a=g$(e,t),s=e.orient,u=e.scale,l=gS(s,-1,1),c=IC(a("labelFlush")),f=IC(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let p,m=0===c||!!c;const g=aC(r);g.mult=l,g.offset=aC(a("labelPadding")||0),g.offset.mult=l;const y={scale:u,field:QE,band:.5,offset:x$(o.offset,a("labelOffset"))},v=yS(s,m?OS(u,c,'"left"','"right"','"center"'):{value:"center"},((e,t,n)=>LC(e)?kS(e.signal,t,n):e===GE?{value:t}:{value:n})(s,"left","right")),b=yS(s,bS(s,"bottom","top"),m?OS(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=OS(u,c,`-(${f})`,f,0);m=m&&f;const w={opacity:l$,x:yS(s,y,g),y:vS(s,y,g)},_={enter:w,update:p={opacity:c$,text:{field:JE},x:w.x,y:w.y,align:v,baseline:b},exit:{opacity:l$,x:w.x,y:w.y}};uC(_,{dx:!d&&m?yS(s,x):null,dy:!h&&m?vS(s,x):null}),uC(_,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:d,baseline:h});const A=a("labelBound");let k=a("labelOverlap");return k=k||A?{separation:a("labelSeparation"),method:k,order:"datum.index",bound:A?{scale:u,orient:s,tolerance:A}:null}:void 0,p.align!==v&&(p.align=$S(p.align,v)),p.baseline!==b&&(p.baseline=$S(p.baseline,b)),w$({type:p$,role:"axis-label",style:ZE,key:QE,from:i,encode:_,overlap:k},n)}function RS(e,t,n,i){const r=g$(e,t),o=e.orient,a=gS(o,-1,1);let s,u;const l={enter:s={opacity:l$,anchor:aC(r("titleAnchor",null)),align:{signal:b$}},update:u=v({},s,{opacity:c$,text:aC(e.title)}),exit:{opacity:l$}},c={signal:`lerp(range("${e.scale}"), ${v$(0,1,.5)})`};return u.x=yS(o,c),u.y=vS(o,c),s.angle=yS(o,l$,((e,t)=>0===t?0:LC(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t})(a,90)),s.baseline=yS(o,bS(o,VE,WE),{value:VE}),u.angle=s.angle,u.baseline=s.baseline,uC(l,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),function(e,t,n,i){const r=(e,t)=>null!=e?(n.update[t]=$S(aC(e),n.update[t]),!1):!cC(t,i),o=r(e("titleX"),"x"),a=r(e("titleY"),"y");n.enter.auto=a===o?aC(a):yS(t,aC(a),aC(o))}(r,o,l,n),l.update.align=$S(l.update.align,s.align),l.update.angle=$S(l.update.angle,s.angle),l.update.baseline=$S(l.update.baseline,s.baseline),w$({type:p$,role:"axis-title",style:e$,from:i,encode:l},n)}function TS(e,t){const n=function(e,t){var n,i,r,o,a,s,u,l,c=t.config,f=c.style,d=c.axis,h="band"===t.scaleType(e.scale)&&c.axisBand,p=e.orient;if(LC(p)){const e=MS([c.axisX,c.axisY]),t=MS([c.axisTop,c.axisBottom,c.axisLeft,c.axisRight]);for(r of(n={},e))n[r]=yS(p,SS(r,c.axisX,d,f),SS(r,c.axisY,d,f));for(r of(i={},t))i[r]=(o=p.signal,a=SS(r,c.axisTop,d,f),s=SS(r,c.axisBottom,d,f),u=SS(r,c.axisLeft,d,f),l=SS(r,c.axisRight,d,f),{signal:(null!=u?`${o} === '${HE}' ? (${ES(u)}) : `:"")+(null!=s?`${o} === '${VE}' ? (${ES(s)}) : `:"")+(null!=l?`${o} === '${GE}' ? (${ES(l)}) : `:"")+(null!=a?`${o} === '${WE}' ? (${ES(a)}) : `:"")+"(null)"})}else n=p===WE||p===VE?c.axisX:c.axisY,i=c["axis"+p[0].toUpperCase()+p.slice(1)];return n||i||h?v({},d,n,i,h):d}(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,a=r.interactive,s=r.style,u=g$(e,n),l=function(e){const t=e("tickBand");let n,i,r=e("tickOffset");return t?t.signal?(n={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},ne(r)||(r={signal:`(${t.signal}) === 'extent' ? 0 : ${r}`})):"extent"===t?(n=1,i=!0,r=0):(n=.5,i=!1):(n=e("bandPosition"),i=e("tickExtra")),{extra:i,band:n,offset:r}}(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:null!=e.title},f=zC(t.add(iE({},[c]))),d=zC(t.add(tE({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let p;return c.grid&&h.push(zS(e,n,i.grid,d,l)),c.ticks&&(p=u("tickSize"),h.push(function(e,t,n,i,r,o){const a=g$(e,t),s=e.orient,u=gS(s,-1,1);let l,c,f;const d={enter:l={opacity:l$},update:f={opacity:c$},exit:c={opacity:l$}};uC(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=aC(r);h.mult=u;const p={scale:e.scale,field:QE,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=l.y=yS(s,l$,p),f.y2=l.y2=yS(s,h),c.x=yS(s,p),f.x=l.x=vS(s,l$,p),f.x2=l.x2=vS(s,h),c.y=vS(s,p),w$({type:h$,role:"axis-tick",key:QE,from:i,encode:d},n)}(e,n,i.ticks,d,p,l))),c.labels&&(p=c.ticks?p:0,h.push(NS(e,n,i.labels,d,p,l))),c.domain&&h.push(function(e,t,n,i){const r=g$(e,t),o=e.orient;let a,s;const u={enter:a={opacity:l$},update:s={opacity:c$},exit:{opacity:l$}};uC(u,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const l=BS(e,0),c=BS(e,1);return a.x=s.x=yS(o,l,l$),a.x2=s.x2=yS(o,c),a.y=s.y=vS(o,l,l$),a.y2=s.y2=vS(o,c),w$({type:h$,role:"axis-domain",from:i,encode:u},n)}(e,n,i.domain,f)),c.title&&h.push(RS(e,n,i.title,f)),oS(m$({role:"axis",from:f,encode:lC(PS(u,e),r,u$),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:o,interactive:a,style:s}),t)}function PS(e,t){const n={enter:{},update:{}};return uC(n,{orient:e("orient"),offset:e("offset")||0,position:UC(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function jS(e,t,n){const i=u(e.signals),r=u(e.scales);return n||i.forEach((e=>$C(e,t))),u(e.projections).forEach((e=>function(e,t){const n=t.config.projection||{},i={};for(const r in e)"name"!==r&&(i[r]=IE(e[r],r,t));for(const r in n)null==i[r]&&(i[r]=IE(n[r],r,t));t.addProjection(e.name,i)}(e,t))),r.forEach((e=>function(e,t){const n=e.type||"linear";Gs(n)||d("Unrecognized scale type: "+fe(n)),t.addScale(e.name,{type:n,domain:void 0})}(e,t))),u(e.data).forEach((e=>dS(e,t))),r.forEach((e=>SE(e,t))),(n||i).forEach((e=>function(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?d("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=UD(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach((e=>KC(e,t,n.id)))}(e,t))),u(e.axes).forEach((e=>TS(e,t))),u(e.marks).forEach((e=>oS(e,t))),u(e.legends).forEach((e=>aS(e,t))),e.title&&cS(e.title,t),t.parseLambdas(),t}function LS(e,t){const n=t.config,i=zC(t.root=t.add(BC())),r=function(e,t){const n=n=>UC(e[n],t[n]),i=[qS("background",n("background")),qS("autosize",iC(n("autosize"))),qS("padding",oC(n("padding"))),qS("width",n("width")||0),qS("height",n("height")||0)],r=i.reduce(((e,t)=>(e[t.name]=t,e)),{}),o={};return u(e.signals).forEach((e=>{c(r,e.name)?e=v(r[e.name],e):i.push(e),o[e.name]=e})),u(t.signals).forEach((e=>{c(o,e.name)||c(r,e.name)||i.push(e)})),i}(e,n);r.forEach((e=>$C(e,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const o=t.add(iE()),a=t.add(aE(kC((e=>lC({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e))(e.encode),f$,dC,e.style,t,{pulse:zC(o)}))),s=t.add(FE({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:zC(a)}));t.operators.pop(),t.pushState(zC(a),zC(s),null),jS(e,t,r),t.operators.push(s);let l=t.add(nE({mark:i,pulse:zC(s)}));return l=t.add(_E({pulse:zC(l)})),l=t.add(kE({pulse:zC(l)})),t.addData("root",new eS(t,o,o,l)),t}function qS(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function US(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function IS(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function WS(e){return(f(e)?HS:GS)(e)}function HS(e){const t=e.length;let n="[";for(let i=0;i<t;++i){const t=e[i];n+=(i>0?",":"")+(ne(t)?t.signal||WS(t):fe(t))}return n+"]"}function GS(e){let t,n,i="{",r=0;for(t in e)n=e[t],i+=(++r>1?",":"")+fe(t)+":"+(ne(n)?n.signal||WS(n):fe(n));return i+"}"}US.prototype=IS.prototype={parse(e){return jS(e,this)},fork(){return new IS(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){const t=e instanceof SC?zC(e):e;return this.add(xE({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(e,t,n){let i,r;e&&(i=e.data||(e.data={}),r=i[t]||(i[t]=[]),r.push(n))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(zC(this.add(kE({pulse:e})))),this._parent.push(t),this._lookup.push(n?zC(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return S(this._parent)},encode(){return S(this._encode)},lookup(){return S(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(ie(e))return OC(e,t);e.signal||d("Unsupported field reference: "+fe(e));const n=e.signal;let i=this.field[n];if(!i){const e={name:this.signalRef(n)};t&&(e.as=t),this.field[n]=i=zC(this.add(lE(e)))}return i},compareRef(e){let t=!1;const n=e=>LC(e)?(t=!0,this.signalRef(e.signal)):function(e){return e&&e.expr}(e)?(t=!0,this.exprRef(e.expr)):e,i=u(e.field).map(n),r=u(e.order).map(n);return t?zC(this.add(rE({fields:i,orders:r}))):RC(i,r)},keyRef(e,t){let n=!1;const i=this.signals;return e=u(e).map((e=>LC(e)?(n=!0,zC(i[e.signal])):e)),n?zC(this.add(cE({fields:e,flat:t}))):function(e,t){const n={$key:e};return t&&(n.$flat=!0),n}(e,t)},sortRef(e){if(!e)return e;const t=TC(e.op,e.field),n=e.order||"ascending";return n.signal?zC(this.add(rE({fields:t,orders:this.signalRef(n.signal)}))):RC(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return c(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&d("Duplicate signal name: "+fe(e));const n=t instanceof SC?t:this.add(BC(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||d("Unrecognized signal name: "+fe(e)),this.signals[e]},signalRef(e){return this.signals[e]?zC(this.signals[e]):(c(this.lambdas,e)||(this.lambdas[e]=this.add(BC(null))),zC(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){const n=e[t],i=UD(n,this),r=this.lambdas[n];r.params=i.$params,r.update=i.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&ne(e)?this.signalRef(e.signal||WS(e)):e},exprRef(e,t){const n={expr:UD(e,this)};return t&&(n.expr.$name=t),zC(this.add(sE(n)))},addBinding(e,t){this.bindings||d("Nested signals do not support binding: "+fe(e)),this.bindings.push(v({signal:e},t))},addScaleProj(e,t){c(this.scales,e)&&d("Duplicate scale or projection name: "+fe(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,AE(t))},addProjection(e,t){this.addScaleProj(e,bE(t))},getScale(e){return this.scales[e]||d("Unrecognized scale name: "+fe(e)),this.scales[e]},scaleRef(e){return zC(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return c(this.data,e)&&d("Duplicate data set name: "+fe(e)),this.data[e]=t},getData(e){return this.data[e]||d("Undefined data set name: "+fe(e)),this.data[e]},addDataPipeline(e,t){return c(this.data,e)&&d("Duplicate data set name: "+fe(e)),this.addData(e,eS.fromEntries(this,t))}};v(dr,Oa,zp,cm,tx,Mx,g_,Yw,w_,eA,hA,_A);const VS=Object.freeze(Object.defineProperty({__proto__:null,Bounds:Ml,CanvasHandler:dd,CanvasRenderer:bd,DATE:Ie,DAY:We,DAYOFYEAR:He,Dataflow:lr,Debug:Ge,Error:i,EventStream:Yi,Gradient:Nu,GroupItem:zl,HOURS:Ve,Handler:If,HybridHandler:uh,HybridRenderer:sh,Info:Ye,Item:Bl,MILLISECONDS:Xe,MINUTES:Je,MONTH:Ke,Marks:Cf,MultiPulse:rr,None:Qe,Operator:Hi,Parameters:Ui,Pulse:er,QUARTER:Ze,RenderType:dh,Renderer:Hf,ResourceLoader:Ol,SECONDS:et,SVGHandler:wd,SVGRenderer:Gd,SVGStringRenderer:oh,Scenegraph:Nf,TIME_UNITS:U,Transform:fr,View:UF,WEEK:tt,Warn:nt,YEAR:it,accessor:_,accessorFields:w,accessorName:x,array:u,ascending:D,bandwidthNRD:vr,bin:br,bootstrapCI:wr,boundClip:xh,boundContext:tc,boundItem:Ef,boundMark:Sf,boundStroke:Tl,changeset:Li,clampRange:be,codegenExpression:Uk,compare:P,constant:s,cumulativeLogNormal:Or,cumulativeNormal:Er,cumulativeUniform:Lr,dayofyear:we,debounce:b,defaultLocale:r,definition:hr,densityLogNormal:zr,densityNormal:Cr,densityUniform:jr,domChild:jf,domClear:Lf,domCreate:Tf,domFind:Pf,dotbin:_r,error:d,expressionFunction:qD,extend:v,extent:k,extentIndex:q,falsy:oe,fastmap:T,field:O,flush:Oe,font:xf,fontFamily:bf,fontSize:pf,format:rt,formatLocale:ot,formats:at,hasOwnProperty:c,id:h,identity:l,inferType:st,inferTypes:ut,ingest:Oi,inherits:t,inrange:pe,interpolate:ou,interpolateColors:nu,interpolateRange:tu,intersect:mh,intersectBoxLine:dc,intersectPath:uc,intersectPoint:lc,intersectRule:fc,isArray:f,isBoolean:Pe,isDate:he,isFunction:a,isIterable:lt,isNumber:te,isObject:ne,isRegExp:Te,isString:ie,isTuple:Mi,key:j,lerp:ze,lineHeight:mf,loader:o,locale:Le,logger:n,lruCache:re,markup:Pd,merge:N,mergeConfig:qe,multiLineOffset:yf,one:ae,pad:Be,panLinear:ve,panLog:ye,panPow:ge,panSymlog:me,parse:function(e,t,n){return ne(e)||d("Input Vega specification must be an object."),LS(e,new US(t=qe(function(){const e="sans-serif",t="#4c78a8",n="#000",i="#888",r="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:t},area:{fill:t},image:null,line:{stroke:t,strokeWidth:2},path:{stroke:t},rect:{fill:t},rule:{stroke:n},shape:{stroke:t},symbol:{fill:t,size:64},text:{fill:n,font:e,fontSize:11},trail:{fill:t,size:2},style:{"guide-label":{fill:n,font:e,fontSize:10},"guide-title":{fill:n,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:r},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:i,grid:!1,gridWidth:1,gridColor:r,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:i,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:r,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:i,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}(),t,e.config),n)).toRuntime()},parseExpression:jk,parseSelector:ZF,path:Nn,pathCurves:Tu,pathEqual:_h,pathParse:Iu,pathRectangle:hl,pathRender:el,pathSymbols:rl,pathTrail:pl,peek:S,point:Uf,projection:Ab,quantileLogNormal:Nr,quantileNormal:$r,quantileUniform:qr,quantiles:gr,quantizeInterpolator:iu,quarter:De,quartiles:yr,get random(){return xr},randomInteger:function(e,t){let n,i,r;null==t&&(t=e,e=0);const o={min(e){return arguments.length?(n=e||0,r=i-n,o):n},max(e){return arguments.length?(i=e||0,r=i-n,o):i},sample:()=>n+Math.floor(r*xr()),pdf:e=>e===Math.floor(e)&&e>=n&&e<i?1/r:0,cdf(e){const t=Math.floor(e);return t<n?0:t>=i?1:(t-n+1)/r},icdf:e=>e>=0&&e<=1?n-1+Math.floor(e*r):NaN};return o.min(e).max(t)},randomKDE:Mr,randomLCG:function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},randomLogNormal:Rr,randomMixture:Tr,randomNormal:Sr,randomUniform:Ur,read:y,regressionConstant:Ir,regressionExp:Jr,regressionLinear:Yr,regressionLoess:to,regressionLog:Xr,regressionPoly:Zr,regressionPow:Kr,regressionQuad:Qr,renderModule:ph,repeat:ct,resetDefaultLocale:ft,resetSVGClipId:$l,resetSVGDefIds:function(){$l(),Su=0},responseType:g,runtimeContext:KD,sampleCurve:oo,sampleLogNormal:Br,sampleNormal:Fr,sampleUniform:Pr,scale:Hs,sceneEqual:wh,sceneFromJSON:zf,scenePickVisit:Ac,sceneToJSON:Bf,sceneVisit:_c,sceneZOrder:wc,scheme:lu,serializeXML:jd,setHybridRendererOptions:function(e){ah.svgMarkTypes=e.svgMarkTypes??["text"],ah.svgOnTop=e.svgOnTop??!0,ah.debug=e.debug??!1},setRandom:function(e){xr=e},span:R,splitAccessPath:Ue,stringValue:fe,textMetrics:uf,timeBin:F,timeFloor:$,timeFormatLocale:dt,timeInterval:B,timeOffset:Ee,timeSequence:Ce,timeUnitSpecifier:Fe,timeUnits:C,toBoolean:Re,toDate:je,toNumber:A,toSet:ee,toString:Ne,transform:pr,transforms:dr,truncate:Me,truthy:p,tupleid:Bi,typeParsers:ht,utcFloor:E,utcInterval:M,utcOffset:Se,utcSequence:$e,utcdayofyear:xe,utcquarter:ke,utcweek:_e,version:"5.33.0",visitArray:m,week:Ae,writeConfig:pt,zero:L,zoomLinear:ce,zoomLog:se,zoomPow:ue,zoomSymlog:le},Symbol.toStringTag,{value:"Module"}));function YS(e){return WM(e,"or")}function XS(e){return WM(e,"and")}function JS(e){return WM(e,"not")}function KS(e,t){if(JS(e))KS(e.not,t);else if(XS(e))for(const n of e.and)KS(n,t);else if(YS(e))for(const n of e.or)KS(n,t);else t(e)}function QS(e,t){return JS(e)?{not:QS(e.not,t)}:XS(e)?{and:e.and.map((e=>QS(e,t)))}:YS(e)?{or:e.or.map((e=>QS(e,t)))}:t(e)}const ZS=structuredClone;function eM(e){throw new Error(e)}function tM(e,t){const n={};for(const i of t)c(e,i)&&(n[i]=e[i]);return n}function nM(e,t){const n={...e};for(const i of t)delete n[i];return n}function iM(e){if(te(e))return e;const t=ie(e)?e:IM(e);if(t.length<250)return t;let n=0;for(let i=0;i<t.length;i++){n=(n<<5)-n+t.charCodeAt(i),n|=0}return n}function rM(e){return!1===e||null===e}function oM(e,t){return e.includes(t)}function aM(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function sM(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function uM(e,...t){for(const n of t)lM(e,n??{});return e}function lM(e,t){for(const n of yM(t))pt(e,n,t[n],!0)}function cM(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 fM(e,t){const n=yM(e),i=yM(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0}function dM(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function hM(e,t){for(const n of e)if(t.has(n))return!0;return!1}function pM(e){const t=new Set;for(const n of e){const e=Ue(n).map(((e,t)=>0===t?e:`[${e}]`)),i=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const n of i)t.add(n)}return t}function mM(e,t){return void 0===e||void 0===t||hM(pM(e),pM(t))}function gM(e){return 0===yM(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>IM(e))).join(",")})`};const yM=Object.keys,vM=Object.values,bM=Object.entries;function xM(e){return!0===e||!1===e}function wM(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function _M(e,t){return JS(e)?`!(${_M(e.not,t)})`:XS(e)?`(${e.and.map((e=>_M(e,t))).join(") && (")})`:YS(e)?`(${e.or.map((e=>_M(e,t))).join(") || (")})`:t(e)}function AM(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&AM(e[n],t)&&delete e[n],gM(e)}function kM(e){return e.charAt(0).toUpperCase()+e.substr(1)}function DM(e,t="datum"){const n=Ue(e),i=[];for(let r=1;r<=n.length;r++){const e=`[${n.slice(0,r).map(fe).join("][")}]`;i.push(`${t}${e}`)}return i.join(" && ")}function FM(e,t="datum"){return`${t}[${fe(Ue(e).join("."))}]`}function CM(e){return`datum['${e.replaceAll("'","\\'")}']`}function EM(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function $M(e){return`${Ue(e).map(EM).join("\\.")}`}function SM(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function MM(e){return`${Ue(e).join(".")}`}function BM(e){return e?Ue(e).length:0}function zM(...e){return e.find((e=>void 0!==e))}let OM=42;function NM(e){const t=++OM;return e?String(e)+t:t}function RM(){OM=42}function TM(e){return PM(e)?e:`__${e}`}function PM(e){return e.startsWith("__")}function jM(e){if(void 0!==e)return(e%360+360)%360}function LM(e){return!!te(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const qM=Object.getPrototypeOf(structuredClone({}));function UM(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(!UM(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!UM(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!=i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==qM.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==qM.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!=i--;){const n=r[i];if(!UM(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function IM(e){const t=[];return function e(n){if(n&&n.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?""+n:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;i<n.length;i++)i&&(r+=","),r+=e(n[i])||"null";return r+"]"}if(null===n)return"null";if(t.includes(n))throw new TypeError("Converting circular structure to JSON");const o=t.push(n)-1,a=Object.keys(n).sort();for(r="",i=0;i<a.length;i++){const t=a[i],o=e(n[t]);o&&(r&&(r+=","),r+=JSON.stringify(t)+":"+o)}return t.splice(o,1),`{${r}}`}(e)}function WM(e,t){return ne(e)&&c(e,t)&&void 0!==e[t]}const HM="row",GM="column",VM="facet",YM="x",XM="y",JM="x2",KM="y2",QM="xOffset",ZM="yOffset",eB="radius",tB="radius2",nB="theta",iB="theta2",rB="latitude",oB="longitude",aB="latitude2",sB="longitude2",uB="time",lB="color",cB="fill",fB="stroke",dB="shape",hB="size",pB="angle",mB="opacity",gB="fillOpacity",yB="strokeOpacity",vB="strokeWidth",bB="strokeDash",xB="text",wB="order",_B="detail",AB="key",kB="tooltip",DB="href",FB="url",CB="description",EB={theta:1,theta2:1,radius:1,radius2:1};function $B(e){return c(EB,e)}const SB={longitude:1,longitude2:1,latitude:1,latitude2:1};function MB(e){switch(e){case rB:return"y";case aB:return"y2";case oB:return"x";case sB:return"x2"}}function BB(e){return c(SB,e)}const zB=yM(SB),OB={x:1,y:1,x2:1,y2:1,...EB,...SB,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function NB(e){return e===lB||e===cB||e===fB}const RB={row:1,column:1,facet:1},TB=yM(RB),PB={...OB,...RB},jB=yM(PB),{order:LB,detail:qB,tooltip:UB,...IB}=PB,{row:WB,column:HB,facet:GB,...VB}=IB;function YB(e){return c(PB,e)}const XB=[JM,KM,aB,sB,iB,tB];function JB(e){return KB(e)!==e}function KB(e){switch(e){case JM:return YM;case KM:return XM;case aB:return rB;case sB:return oB;case iB:return nB;case tB:return eB}return e}function QB(e){if($B(e))switch(e){case nB:return"startAngle";case iB:return"endAngle";case eB:return"outerRadius";case tB:return"innerRadius"}return e}function ZB(e){switch(e){case YM:return JM;case XM:return KM;case rB:return aB;case oB:return sB;case nB:return iB;case eB:return tB}}function ez(e){switch(e){case YM:case JM:return"width";case XM:case KM:return"height"}}function tz(e){switch(e){case YM:return"xOffset";case XM:return"yOffset";case JM:return"x2Offset";case KM:return"y2Offset";case nB:return"thetaOffset";case eB:return"radiusOffset";case iB:return"theta2Offset";case tB:return"radius2Offset"}}function nz(e){switch(e){case YM:return"xOffset";case XM:return"yOffset"}}function iz(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const rz=yM(OB),{x:oz,y:az,x2:sz,y2:uz,xOffset:lz,yOffset:cz,latitude:fz,longitude:dz,latitude2:hz,longitude2:pz,theta:mz,theta2:gz,radius:yz,radius2:vz,...bz}=OB,xz=yM(bz),wz={x:1,y:1},_z=yM(wz);function Az(e){return c(wz,e)}const kz={theta:1,radius:1},Dz=yM(kz);function Fz(e){return"width"===e?YM:XM}const Cz={xOffset:1,yOffset:1};function Ez(e){return c(Cz,e)}const $z={time:1};function Sz(e){return e in $z}const{text:Mz,tooltip:Bz,href:zz,url:Oz,description:Nz,detail:Rz,key:Tz,order:Pz,...jz}=bz,Lz=yM(jz);const qz={...wz,...kz,...Cz,...jz},Uz=yM(qz);function Iz(e){return c(qz,e)}function Wz(e,t){return function(e){switch(e){case lB:case cB:case fB:case CB:case _B:case AB:case kB:case DB:case wB:case mB:case gB:case yB:case vB:case VM:case HM:case GM:return Hz;case YM:case XM:case QM:case ZM:case rB:case oB:case uB:return Vz;case JM:case KM:case aB:case sB:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case hB:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case bB:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case dB:return{point:"always",geoshape:"always"};case xB:return{text:"always"};case pB:return{point:"always",square:"always",text:"always"};case FB:return{image:"always"};case nB:case eB:return{text:"always",arc:"always"};case iB:case tB:return{arc:"always"}}}(e)[t]}const Hz={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:Gz,...Vz}=Hz;function Yz(e){switch(e){case YM:case XM:case nB:case eB:case QM:case ZM:case hB:case pB:case vB:case mB:case gB:case yB:case uB:case JM:case KM:case iB:case tB:return;case VM:case HM:case GM:case dB:case bB:case xB:case kB:case DB:case FB:case CB:return"discrete";case lB:case cB:case fB:return"flexible";case rB:case oB:case aB:case sB:case _B:case AB:case wB:return}}const Xz={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},Jz={count:1,min:1,max:1};function Kz(e){return WM(e,"argmin")}function Qz(e){return WM(e,"argmax")}function Zz(e){return ie(e)&&c(Xz,e)}const eO=new Set(["count","valid","missing","distinct"]);function tO(e){return ie(e)&&eO.has(e)}const nO=new Set(["count","sum","distinct","valid","missing"]),iO=new Set(["mean","average","median","q1","q3","min","max"]);function rO(e){return Pe(e)&&(e=AP(e,void 0)),"bin"+yM(e).map((t=>uO(e[t])?wM(`_${t}_${bM(e[t])}`):wM(`_${t}_${e[t]}`))).join("")}function oO(e){return!0===e||sO(e)&&!e.binned}function aO(e){return"binned"===e||sO(e)&&!0===e.binned}function sO(e){return ne(e)}function uO(e){return WM(e,"param")}function lO(e){switch(e){case HM:case GM:case hB:case lB:case cB:case fB:case vB:case mB:case gB:case yB:case dB:return 6;case bB:return 4;default:return 10}}function cO(e){return WM(e,"expr")}function fO(e,{level:t}={level:0}){const n=yM(e||{}),i={};for(const r of n)i[r]=0===t?wO(e[r]):fO(e[r],{level:t-1});return i}function dO(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:p,...m}=e,g={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},y={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...p?{subtitlePadding:p}:{}};return{titleMarkConfig:{...m,...s?{fill:s}:{}},subtitleMarkConfig:tM(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:y}}function hO(e){return ie(e)||f(e)&&ie(e[0])}function pO(e){return WM(e,"signal")}function mO(e){return WM(e,"step")}function gO(e){return!f(e)&&(WM(e,"field")&&WM(e,"data"))}const yO=yM({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),vO={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},bO=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function xO(e){const t=f(e.condition)?e.condition.map(_O):_O(e.condition);return{...wO(e),condition:t}}function wO(e){if(cO(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function _O(e){if(cO(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function AO(e){if(cO(e)){const{expr:t,...n}=e;return{signal:t,...n}}return pO(e)?e:void 0!==e?{value:e}:void 0}function kO(e){return pO(e)?e.signal:fe(e.value)}function DO(e){return pO(e)?e.signal:null==e?null:fe(e)}function FO(e,t,n){for(const i of n){const n=$O(i,t.markDef,t.config);void 0!==n&&(e[i]=AO(n))}return e}function CO(e){return[].concat(e.type,e.style??[])}function EO(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&WM(t,r)?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?$O(e,t,n,i):void 0}function $O(e,t,n,{vgChannel:i}={}){const r=SO(e,t,n.style);return zM(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function SO(e,t,n){return MO(e,CO(t),n)}function MO(e,t,n){let i;t=u(t);for(const r of t){const t=n[r];WM(t,e)&&(i=t[e])}return i}function BO(e,t){return u(e).reduce(((e,n)=>(e.field.push(lP(n,t)),e.order.push(n.sort??"ascending"),e)),{field:[],order:[]})}function zO(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(UM(t,e))return;n.push(e)})),n}function OO(e,t){return UM(e,t)||!t?e:e?[...u(e),...u(t)].join(", "):t}function NO(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((hO(n)||pO(n))&&(hO(i)||pO(i)))return{explicit:e.explicit,value:OO(n,i)};if(hO(n)||pO(n))return{explicit:e.explicit,value:n};if(hO(i)||pO(i))return{explicit:e.explicit,value:i};if(!(hO(n)||pO(n)||hO(i)||pO(i)))return{explicit:e.explicit,value:zO(n,i)};throw new Error("It should never reach here")}function RO(e){return`Invalid specification ${IM(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const TO='Autosize "fit" only works for single views and layered views.';function PO(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function jO(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function LO(e){return e?`Dropping "fit-${e}" because spec has discrete ${ez(e)}.`:'Dropping "fit" because spec has discrete size.'}function qO(e){return`Unknown field for ${e}. Cannot calculate view size.`}function UO(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function IO(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function WO(e){return`Selection not supported for ${e} yet.`}const HO="The same selection must be used to override scale domains in a layered view.";function GO(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const VO="Animation involving facet, layer, or concat is currently unsupported.";function YO(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function XO(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function JO(e){return`${e}Offset dropped because ${e} is continuous`}function KO(e){return`Invalid field type "${e}".`}function QO(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function ZO(e,t){return`Dropping ${IM(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function eN(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function tN(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function nN(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function iN(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function rN(e){return`Using unaggregated domain with raw field has no effect (${IM(e)}).`}function oN(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function aN(e){return`Unaggregated domain is currently unsupported for log scale (${IM(e)}).`}function sN(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function uN(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const lN="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function cN(e,t){return`Invalid ${e}: ${IM(t)}.`}function fN(e){return`1D error band does not support ${e}.`}function dN(e){return`Channel ${e} is required for "binned" bin.`}const hN=n(nt);let pN=hN;function mN(...e){pN.error(...e)}function gN(...e){pN.warn(...e)}function yN(e){if(e&&ne(e))for(const t of DN)if(WM(e,t))return!0;return!1}const vN=["january","february","march","april","may","june","july","august","september","october","november","december"],bN=vN.map((e=>e.substr(0,3))),xN=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],wN=xN.map((e=>e.substr(0,3)));function _N(e,t){const n=[];if(t&&void 0!==e.day&&yM(e).length>1&&(gN(function(e){return`Dropping day from datetime ${IM(e)} as day cannot be combined with other units.`}(e)),delete(e=ZS(e)).day),void 0!==e.year?n.push(e.year):n.push(2012),void 0!==e.month){const i=t?function(e){if(LM(e)&&(e=+e),te(e))return e-1;{const t=e.toLowerCase(),n=vN.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=bN.indexOf(i);if(-1!==r)return r;throw new Error(cN("month",e))}}(e.month):e.month;n.push(i)}else if(void 0!==e.quarter){const i=t?function(e){if(LM(e)&&(e=+e),te(e))return e>4&&gN(cN("quarter",e)),e-1;throw new Error(cN("quarter",e))}(e.quarter):e.quarter;n.push(te(i)?3*i:`${i}*3`)}else n.push(0);if(void 0!==e.date)n.push(e.date);else if(void 0!==e.day){const i=t?function(e){if(LM(e)&&(e=+e),te(e))return e%7;{const t=e.toLowerCase(),n=xN.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=wN.indexOf(i);if(-1!==r)return r;throw new Error(cN("day",e))}}(e.day):e.day;n.push(te(i)?i+1:`${i}+1`)}else n.push(1);for(const i of["hours","minutes","seconds","milliseconds"]){const t=e[i];n.push(void 0===t?0:t)}return n}function AN(e){const t=_N(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const kN={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},DN=yM(kN);function FN(e){return ne(e)?e.binned:CN(e)}function CN(e){return e&&e.startsWith("binned")}function EN(e){return e.startsWith("utc")}const $N={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function SN(e){return DN.filter((t=>BN(e,t)))}function MN(e){const t=SN(e);return t[t.length-1]}function BN(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function zN(e,t,{end:n}={end:!1}){const i=DM(t),r=EN(e)?"utc":"";let o;const a={};for(const u of DN)BN(e,u)&&(a[u]="quarter"===(s=u)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=u);var s;return n&&(a[o]+="+1"),function(e){const t=_N(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}function ON(e){if(!e)return;return`timeUnitSpecifier(${IM(SN(e))}, ${IM($N)})`}function NN(e){if(!e)return;let t;return ie(e)?t=CN(e)?{unit:e.substring(6),binned:!0}:{unit:e}:ne(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),EN(t.unit)&&(t.utc=!0,t.unit=t.unit.substring(3)),t}function RN(e,t=e=>e){const n=NN(e),i=MN(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=PN(i,n.step);return`${t(AN({...e,[o]:+e[o]+r}))} - ${t(AN(e))}`}}const TN={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function PN(e,t=1){if(function(e){return c(TN,e)}(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:3*t};case"week":return{part:"date",step:7*t}}}function jN(e){return!!(null==e?void 0:e.field)&&void 0!==e.equal}function LN(e){return!!(null==e?void 0:e.field)&&void 0!==e.lt}function qN(e){return!!(null==e?void 0:e.field)&&void 0!==e.lte}function UN(e){return!!(null==e?void 0:e.field)&&void 0!==e.gt}function IN(e){return!!(null==e?void 0:e.field)&&void 0!==e.gte}function WN(e){if(null==e?void 0:e.field){if(f(e.range)&&2===e.range.length)return!0;if(pO(e.range))return!0}return!1}function HN(e){return!!(null==e?void 0:e.field)&&(f(e.oneOf)||f(e.in))}function GN(e){return HN(e)||jN(e)||WN(e)||LN(e)||UN(e)||qN(e)||IN(e)}function VN(e,t){return FP(e,{timeUnit:t,wrapTime:!0})}function YN(e,t=!0){const{field:n}=e,i=NN(e.timeUnit),{unit:r,binned:o}=i||{},a=lP(e,{expr:"datum"}),s=r?`time(${o?a:zN(r,n)})`:a;if(jN(e))return`${s}===${VN(e.equal,r)}`;if(LN(e)){return`${s}<${VN(e.lt,r)}`}if(UN(e)){return`${s}>${VN(e.gt,r)}`}if(qN(e)){return`${s}<=${VN(e.lte,r)}`}if(IN(e)){return`${s}>=${VN(e.gte,r)}`}if(HN(e))return`indexof([${(u=e.oneOf,l=r,u.map((e=>VN(e,l)))).join(",")}], ${s}) !== -1`;if(function(e){return!!(null==e?void 0:e.field)&&void 0!==e.valid}(e))return XN(s,e.valid);if(WN(e)){const{range:n}=fO(e),i=pO(n)?{signal:`${n.signal}[0]`}:n[0],o=pO(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+VN(i,r)+", "+VN(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${VN(i,r)}`),null!==o&&a.push(`${s} <= ${VN(o,r)}`),a.length>0?a.join(" && "):"true"}var u,l;throw new Error(`Invalid field predicate: ${IM(e)}`)}function XN(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function JN(e){return GN(e)&&e.timeUnit?{...e,timeUnit:NN(e.timeUnit)}:e}function KN(e){return"ordinal"===e||"nominal"===e}const QN="quantitative",ZN="ordinal",eR="temporal",tR="nominal",nR="geojson";const iR="linear",rR="log",oR="pow",aR="sqrt",sR="time",uR="utc",lR="point",cR="band",fR={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function dR(e,t){const n=fR[e],i=fR[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const hR={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function pR(e){return hR[e]}const mR=new Set(["linear","log","pow","sqrt","symlog"]),gR=new Set([...mR,"time","utc"]);function yR(e){return mR.has(e)}const vR=new Set(["quantile","quantize","threshold"]),bR=new Set([...gR,...vR,"sequential","identity"]),xR=new Set(["ordinal","bin-ordinal","point","band"]);function wR(e){return xR.has(e)}function _R(e){return bR.has(e)}function AR(e){return gR.has(e)}function kR(e){return vR.has(e)}function DR(e){return WM(e,"param")}const{type:FR,domain:CR,range:ER,rangeMax:$R,rangeMin:SR,scheme:MR,...BR}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},zR=yM(BR);function OR(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return AR(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return AR(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return AR(e);case"nice":return AR(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return _R(e)&&!oM(["log","time","utc","threshold","quantile"],e)}}function NR(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return NB(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const RR={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},TR=RR.arc,PR=RR.area,jR=RR.bar,LR=RR.image,qR=RR.line,UR=RR.point,IR=RR.rect,WR=RR.rule,HR=RR.text,GR=RR.tick,VR=RR.trail,YR=RR.circle,XR=RR.square,JR=RR.geoshape;function KR(e){return["line","area","trail"].includes(e)}function QR(e){return["rect","bar","image","arc","tick"].includes(e)}const ZR=new Set(yM(RR));function eT(e){return WM(e,"type")}const tT=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],nT=yM({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),iT=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rT={area:["line","point"],bar:iT,rect:iT,line:["point"],tick:["bandSize","thickness",...iT]},oT=yM({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function aT(e){return WM(e,"band")}const sT={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},uT={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},lT={...uT,binSpacing:1},cT={...uT,thickness:1};function fT(e,{isPath:t}){return void 0===e||"break-paths-show-path-domains"===e?t?"break-paths-show-domains":"filter":null===e?"show":e}function dT({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){var o,a;if(!i||!_R(i)||r)return"always-valid";const s=fT(EO("invalid",e,t),{isPath:KR(e.type)});return void 0!==(null==(a=null==(o=t.scale)?void 0:o.invalid)?void 0:a[n])?"show":s}function hT({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,o=`peek(${i})`,a=t.domainHasZero();if("definitely"===a)return{scale:e,value:0};if("maybe"===a){return{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${"zeroOrMin"===n?r:o})`}}return{signal:`scale('${e}', ${"zeroOrMin"===n?r:o})`}}function pT({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:o}){var a;const s=null==n?void 0:n.get("type"),u=vP(t),l=dT({scaleChannel:e,markDef:r,config:o,scaleType:s,isCountAggregate:tO(null==u?void 0:u.aggregate)});if(u&&"show"===l){const t=(null==(a=o.scale.invalid)?void 0:a[e])??"zero-or-min";return{test:XN(lP(u,{expr:"datum"}),!1),...mT(t,n,i)}}}function mT(e,t,n){if(ne(i=e)&&"value"in i){const{value:t}=e;return pO(t)?{signal:t.signal}:{value:t}}var i;return hT({scale:t,scaleName:n,mode:"zeroOrMin"})}function gT(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:o,config:a}=e,s=KB(t),u=bT(e),l=pT({scaleChannel:s,channelDef:n,scale:r,scaleName:o,markDef:i,config:a});return void 0!==l?[l,u]:u}function yT(e,t,n,i){const r={};if(t&&(r.scale=t),KT(e)){const{datum:t}=e;yN(t)?r.signal=AN(t):pO(t)?r.signal=t.signal:cO(t)?r.signal=t.expr:r.value=t}else r.field=lP(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function vT({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:o="end",bandPosition:a=.5}){const s=!pO(a)&&0<a&&a<1?"datum":void 0,u=lP(t,{expr:s,suffix:r}),l=void 0!==n?lP(n,{expr:s}):lP(t,{suffix:o,expr:s}),c={};if(0===a||1===a){c.scale=e;const t=0===a?u:l;c.field=t}else{const t=pO(a)?`(1-${a.signal}) * ${u} + ${a.signal} * ${l}`:`${1-a} * ${u} + ${a} * ${l}`;c.signal=`scale("${e}", ${t})`}return i&&(c.offset=i),c}function bT({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:u,offset:l,defaultRef:c,bandPosition:f}){if(t){if(tP(t)){const a=null==s?void 0:s.get("type");if(nP(t)){f??(f=UT({fieldDef:t,fieldDef2:n,markDef:i,config:r}));const{bin:s,timeUnit:c,type:d}=t;if(oO(s)||f&&c&&d===eR)return(null==u?void 0:u.impute)?yT(t,o,{binSuffix:"mid"},{offset:l}):f&&!wR(a)?vT({scaleName:o,fieldOrDatumDef:t,bandPosition:f,offset:l}):yT(t,o,EP(t,e)?{binSuffix:"range"}:{},{offset:l});if(aO(s)){if(XT(n))return vT({scaleName:o,fieldOrDatumDef:t,fieldOrDatumDef2:n,bandPosition:f,offset:l});gN(dN(e===YM?JM:KM))}}return yT(t,o,wR(a)?{binSuffix:"range"}:{},{offset:l,band:"band"===a?f??t.bandPosition??.5:void 0})}if(iP(t)){const n=l?{offset:l}:{};return{...xT(e,t.value),...n}}}return a(c)&&(c=c()),c?{...c,...l?{offset:l}:{}}:c}function xT(e,t){return oM(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:oM(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:AO(t)}function wT(e){return e&&"number"!==e&&"time"!==e}function _T(e,t,n){return`${e}(${t}${n?`, ${IM(n)}`:""})`}function AT({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o}){var a,s;if(wT(n))return DT({fieldOrDatumDef:e,format:t,formatType:n,expr:i,config:o});const u=kT(e,i,r),l=JT(e);if(void 0===t&&void 0===n&&o.customFormatTypes){if("quantitative"===l){if(r&&o.normalizedNumberFormatType)return DT({fieldOrDatumDef:e,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:i,config:o});if(o.numberFormatType)return DT({fieldOrDatumDef:e,format:o.numberFormat,formatType:o.numberFormatType,expr:i,config:o})}if("temporal"===l&&o.timeFormatType&&XT(e)&&void 0===e.timeUnit)return DT({fieldOrDatumDef:e,format:o.timeFormat,formatType:o.timeFormatType,expr:i,config:o})}if(DP(e)){const n=function({field:e,timeUnit:t,format:n,formatType:i,rawTimeFormat:r,isUTCScale:o}){return!t||n?!t&&i?`${i}(${e}, '${n}')`:`${o?"utc":"time"}Format(${e}, '${n=ie(n)?n:r}')`:function(e,t,n){if(!e)return;const i=ON(e);return`${n||EN(e)?"utc":"time"}Format(${t}, ${i})`}(t,e,o)}({field:u,timeUnit:XT(e)?null==(a=NN(e.timeUnit))?void 0:a.unit:void 0,format:t,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:rP(e)&&(null==(s=e.scale)?void 0:s.type)===uR});return n?{signal:n}:void 0}if(t=ET({type:l,specifiedFormat:t,config:o,normalizeStack:r}),XT(e)&&oO(e.bin)){return{signal:MT(u,lP(e,{expr:i,binSuffix:"end"}),t,n,o)}}return t||"quantitative"===JT(e)?{signal:`${$T(u,t)}`}:{signal:`isValid(${u}) ? ${u} : ""+${u}`}}function kT(e,t,n){return XT(e)?n?`${lP(e,{expr:t,suffix:"end"})}-${lP(e,{expr:t,suffix:"start"})}`:lP(e,{expr:t}):function(e){const{datum:t}=e;return yN(t)?AN(t):`${IM(t)}`}(e)}function DT({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o,field:a}){if(a??(a=kT(e,i,r)),"datum.value"!==a&&XT(e)&&oO(e.bin)){return{signal:MT(a,lP(e,{expr:i,binSuffix:"end"}),t,n,o)}}return{signal:_T(n,a,t)}}function FT(e,t,n,i,r,o){var a;if(!ie(i)||!wT(i)){if(void 0===n&&void 0===i&&r.customFormatTypes&&"quantitative"===JT(e)){if(r.normalizedNumberFormatType&&oP(e)&&"normalize"===e.stack)return;if(r.numberFormatType)return}if(oP(e)&&"normalize"===e.stack&&r.normalizedNumberFormat)return ET({type:"quantitative",config:r,normalizeStack:!0});if(DP(e)){const t=XT(e)?null==(a=NN(e.timeUnit))?void 0:a.unit:void 0;if(void 0===t&&r.customFormatTypes&&r.timeFormatType)return;return function({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:i}){if(e)return e;if(t)return{signal:ON(t)};return i?void 0:n.timeFormat}({specifiedFormat:n,timeUnit:t,config:r,omitTimeFormatConfig:o})}return ET({type:t,specifiedFormat:n,config:r})}}function CT(e,t,n){var i;return e&&(pO(e)||"number"===e||"time"===e)?e:DP(t)&&"time"!==n&&"utc"!==n?XT(t)&&(null==(i=NN(null==t?void 0:t.timeUnit))?void 0:i.utc)?"utc":"time":void 0}function ET({type:e,specifiedFormat:t,config:n,normalizeStack:i}){return ie(t)?t:e===QN?i?n.normalizedNumberFormat:n.numberFormat:void 0}function $T(e,t){return`format(${e}, "${t||""}")`}function ST(e,t,n,i){return wT(n)?_T(n,e,t):$T(e,(ie(t)?t:void 0)??i.numberFormat)}function MT(e,t,n,i,r){if(void 0===n&&void 0===i&&r.customFormatTypes&&r.numberFormatType)return MT(e,t,r.numberFormat,r.numberFormatType,r);const o=ST(e,n,i,r),a=ST(t,n,i,r);return`${XN(e,!1)} ? "null" : ${o} + " – " + ${a}`}const BT="min",zT={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 OT(e){return c(zT,e)}function NT(e){return e&&("count"===e.op||WM(e,"field"))}function RT(e){return e&&f(e)}function TT(e){return WM(e,"row")||WM(e,"column")}function PT(e){return WM(e,"header")}function jT(e){return WM(e,"facet")}function LT(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...r?{aggregate:r}:{},field:t}}function qT(e){return WM(e,"sort")}function UT({fieldDef:e,fieldDef2:t,markDef:n,config:i}){if(tP(e)&&void 0!==e.bandPosition)return e.bandPosition;if(XT(e)){const{timeUnit:r,bin:o}=e;if(r&&!t)return $O("timeUnitBandPosition",n,i);if(oO(o))return.5}}function IT({channel:e,fieldDef:t,fieldDef2:n,markDef:i,config:r,scaleType:o,useVlSizeChannel:a}){var s,u,l;const c=ez(e),f=EO(a?"size":c,i,r,{vgChannel:c});if(void 0!==f)return f;if(XT(t)){const{timeUnit:e,bin:a}=t;if(e&&!n)return{band:$O("timeUnitBandSize",i,r)};if(oO(a)&&!wR(o))return{band:1}}return QR(i.type)?o?wR(o)?(null==(s=r[i.type])?void 0:s.discreteBandSize)||{band:1}:null==(u=r[i.type])?void 0:u.continuousBandSize:null==(l=r[i.type])?void 0:l.discreteBandSize:void 0}function WT(e,t,n,i){return!!(oO(e.bin)||e.timeUnit&&nP(e)&&"temporal"===e.type)&&void 0!==UT({fieldDef:e,fieldDef2:t,markDef:n,config:i})}function HT(e){return WM(e,"sort")&&!WM(e,"field")}function GT(e){return WM(e,"condition")}function VT(e){const t=null==e?void 0:e.condition;return!!t&&!f(t)&&XT(t)}function YT(e){const t=null==e?void 0:e.condition;return!!t&&!f(t)&&tP(t)}function XT(e){return WM(e,"field")||"count"===(null==e?void 0:e.aggregate)}function JT(e){return null==e?void 0:e.type}function KT(e){return WM(e,"datum")}function QT(e){return nP(e)&&!cP(e)||eP(e)}function ZT(e){return nP(e)&&"quantitative"===e.type&&!e.bin||eP(e)}function eP(e){return KT(e)&&te(e.datum)}function tP(e){return XT(e)||KT(e)}function nP(e){return e&&(WM(e,"field")||"count"===e.aggregate)&&WM(e,"type")}function iP(e){return WM(e,"value")}function rP(e){return WM(e,"scale")||WM(e,"sort")}function oP(e){return WM(e,"axis")||WM(e,"stack")||WM(e,"impute")}function aP(e){return WM(e,"legend")}function sP(e){return WM(e,"format")||WM(e,"formatType")}function uP(e){return nM(e,["legend","axis","header","scale"])}function lP(e,t={}){let n=e.field;const i=t.prefix;let r=t.suffix,o="";if(function(e){return"count"===e.aggregate}(e))n=TM("count");else{let i;if(!t.nofn)if(function(e){return WM(e,"op")}(e))i=e.op;else{const{bin:a,aggregate:s,timeUnit:u}=e;oO(a)?(i=rO(a),r=(t.binSuffix??"")+(t.suffix??"")):s?Qz(s)?(o=`["${n}"]`,n=`argmax_${s.argmax}`):Kz(s)?(o=`["${n}"]`,n=`argmin_${s.argmin}`):i=String(s):u&&!FN(u)&&(i=function(e){const{utc:t,...n}=NN(e);return n.unit?(t?"utc":"")+yM(n).map((e=>wM(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+yM(n).map((e=>wM(`_${e}_${n[e]}`))).join("")}(u),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?MM(n):t.expr?FM(n,t.expr)+o:$M(n)+o}function cP(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return XT(e)&&!!e.bin;case"temporal":return!1}throw new Error(KO(e.type))}const fP=(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(Qz(t))return`${r} for argmax(${t.argmax})`;if(Kz(t))return`${r} for argmin(${t.argmin})`;const o=i&&!FN(i)?NN(i):void 0,a=t||(null==o?void 0:o.unit)||(null==o?void 0:o.maxbins)&&"timeunit"||oO(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){var n;const{field:i,bin:r,timeUnit:o,aggregate:a}=e;if("count"===a)return t.countTitle;if(oO(r))return`${i} (binned)`;if(o&&!FN(o)){const e=null==(n=NN(o))?void 0:n.unit;if(e)return`${i} (${SN(e).join("-")})`}else if(a)return Qz(a)?`${i} for max ${a.argmax}`:Kz(a)?`${i} for min ${a.argmin}`:`${kM(a)} of ${i}`;return i}(e,t)}};let dP=fP;function hP(e){dP=e}function pP(e,t,{allowDisabling:n,includeDefault:i=!0}){var r;const o=null==(r=mP(e))?void 0:r.title;if(!XT(e))return o??e.title;const a=e,s=i?gP(a,t):void 0;return n?zM(o,a.title,s):o??a.title??s}function mP(e){return oP(e)&&e.axis?e.axis:aP(e)&&e.legend?e.legend:PT(e)&&e.header?e.header:void 0}function gP(e,t){return dP(e,t)}function yP(e){if(sP(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=mP(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function vP(e){return XT(e)?e:VT(e)?e.condition:void 0}function bP(e){return tP(e)?e:YT(e)?e.condition:void 0}function xP(e,t,n,i={}){if(ie(e)||te(e)||Pe(e)){return gN(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${IM(n)}}.`}(t,ie(e)?"string":te(e)?"number":"boolean",e)),{value:e}}return tP(e)?wP(e,t,n,i):YT(e)?{...e,condition:wP(e.condition,t,n,i)}:e}function wP(e,t,n,i){if(sP(e)){const{format:r,formatType:o,...a}=e;if(wT(o)&&!n.customFormatTypes)return gN(XO(t)),wP(a,t,n,i)}else{const r=oP(e)?"axis":aP(e)?"legend":PT(e)?"header":null;if(r&&e[r]){const{format:o,formatType:a,...s}=e[r];if(wT(a)&&!n.customFormatTypes)return gN(XO(t)),wP({...e,[r]:s},t,n,i)}}return XT(e)?_P(e,t,i):function(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=te(n)?"quantitative":ie(n)?"nominal":yN(n)?"temporal":void 0,{...e,type:t}}(e)}function _P(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:a}=e,s={...e};if(n||!i||Zz(i)||Qz(i)||Kz(i)||(gN(function(e){return`Invalid aggregation operator "${e}".`}(i)),delete s.aggregate),r&&(s.timeUnit=NN(r)),a&&(s.field=`${a}`),oO(o)&&(s.bin=AP(o,t)),aO(o)&&!Az(t)&&gN(function(e){return`Channel ${e} should not be used with "binned" bin.`}(t)),nP(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case QN:return"quantitative";case"t":case eR:return"temporal";case"o":case ZN:return"ordinal";case"n":case tR:return"nominal";case nR:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&tO(i)&&(gN(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,i)),s.type="quantitative")}else if(!JB(t)){const e=function(e,t){var n;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(qT(e)&&f(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!Qz(i)&&!Kz(i))return"quantitative";if(rP(e)&&(null==(n=e.scale)?void 0:n.type))switch(fR[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(s,t);s.type=e}if(nP(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 HM:case GM:case VM:return cP(e)?kP:{compatible:!1,warning:tN(t)};case YM:case XM:case QM:case ZM:case lB:case cB:case fB:case xB:case _B:case AB:case kB:case DB:case FB:case pB:case nB:case eB:case CB:return kP;case oB:case sB:case rB:case aB:return n!==QN?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:kP;case mB:case gB:case yB:case vB:case hB:case iB:case tB:case JM:case KM:case uB:return"nominal"!==n||e.sort?kP:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case dB:case bB:return cP(e)||rP(i=e)&&kR(null==(r=i.scale)?void 0:r.type)?kP:{compatible:!1,warning:nN(t)};case wB:return"nominal"!==e.type||"sort"in e?kP:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i,r}(s,t)||{};!1===e&&gN(n)}if(qT(s)&&ie(s.sort)){const{sort:e}=s;if(OT(e))return{...s,sort:{encoding:e}};const t=e.substring(1);if("-"===e.charAt(0)&&OT(t))return{...s,sort:{encoding:t,order:"descending"}}}if(PT(s)){const{header:e}=s;if(e){const{orient:t,...n}=e;if(t)return{...s,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return s}function AP(e,t){return Pe(e)?{maxbins:lO(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:lO(t)}}const kP={compatible:!0};function DP(e){const{formatType:t}=yP(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||XT(n)&&!!n.timeUnit));var n}function FP(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){var o;const a=t&&(null==(o=NN(t))?void 0:o.unit);let s,u=a||"temporal"===n;return cO(e)?s=e.expr:pO(e)?s=e.signal:yN(e)?(u=!0,s=AN(e)):(ie(e)||te(e))&&u&&(s=`datetime(${IM(e)})`,function(e){return c(kN,e)}(a)&&(te(e)&&e<1e4||ie(e)&&isNaN(Date.parse(e)))&&(s=AN({[a]:e}))),s?i&&u?`time(${s})`:s:r?void 0:IM(e)}function CP(e,t){const{type:n}=e;return t.map((t=>{const i=FP(t,{timeUnit:XT(e)&&!FN(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function EP(e,t){return oO(e.bin)?Iz(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const $P={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function SP(e){return null==e?void 0:e.condition}const MP=["domain","grid","labels","ticks","title"],BP={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},zP={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},OP={...zP,style:1,labelExpr:1,encoding:1};function NP(e){return c(OP,e)}const RP=yM({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function TP(e){return WM(e,"mark")}class PP{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!TP(e)&&(eT(t=e.mark)?t.type:t)===this.name;var t}}function jP(e,t){const n=e&&e[t];return!!n&&(f(n)?aM(n,(e=>!!e.field)):XT(n)||VT(n))}function LP(e,t){const n=e&&e[t];return!!n&&(f(n)?aM(n,(e=>!!e.field)):XT(n)||KT(n)||YT(n))}function qP(e,t){if(Az(t)){const n=e[t];if((XT(n)||KT(n))&&(KN(n.type)||XT(n)&&n.timeUnit)){return LP(e,nz(t))}}return!1}function UP(e){return aM(jB,(t=>{if(jP(e,t)){const n=e[t];if(f(n))return aM(n,(e=>!!e.aggregate));{const e=vP(n);return e&&!!e.aggregate}}return!1}))}function IP(e,t){const n=[],i=[],r=[],o=[],a={};return GP(e,((s,u)=>{if(XT(s)){const{field:l,aggregate:f,bin:d,timeUnit:h,...p}=s;if(f||h||d){const e=mP(s),m=null==e?void 0:e.title;let g=lP(s,{forAs:!0});const y={...m?[]:{title:pP(s,t,{allowDisabling:!0})},...p,field:g};if(f){let e;if(Qz(f)?(e="argmax",g=lP({op:"argmax",field:f.argmax},{forAs:!0}),y.field=`${g}.${l}`):Kz(f)?(e="argmin",g=lP({op:"argmin",field:f.argmin},{forAs:!0}),y.field=`${g}.${l}`):"boxplot"!==f&&"errorbar"!==f&&"errorband"!==f&&(e=f),e){const t={op:e,as:g};l&&(t.field=l),o.push(t)}}else if(n.push(g),nP(s)&&oO(d)){if(i.push({bin:d,field:l,as:g}),n.push(lP(s,{binSuffix:"end"})),EP(s,u)&&n.push(lP(s,{binSuffix:"range"})),Az(u)){const e={field:`${g}_end`};a[`${u}2`]=e}y.bin="binned",JB(u)||(y.type=QN)}else if(h&&!FN(h)){r.push({timeUnit:h,field:l,as:g});const e=nP(s)&&s.type!==eR&&"time";e&&(u===xB||u===kB?y.formatType=e:!function(e){return c(bz,e)}(u)?Az(u)&&(y.axis={formatType:e,...y.axis}):y.legend={formatType:e,...y.legend})}a[u]=y}else n.push(l),a[u]=e[u]}else a[u]=e[u]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function WP(e,t,n){const i=Wz(t,n);if(!i)return!1;if("binned"===i){const n=e[t===JM?YM:XM];return!!(XT(n)&&XT(e[t])&&aO(n.bin))}return!0}function HP(e,t){const n={};for(const i of yM(e)){const r=xP(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function GP(e,t,n){if(e)for(const i of yM(e)){const r=e[i];if(f(r))for(const e of r)t.call(n,e,i);else t.call(n,r,i)}}function VP(e,t){return yM(t).reduce(((n,i)=>{switch(i){case YM:case XM:case DB:case CB:case FB:case JM:case KM:case QM:case ZM:case nB:case iB:case eB:case tB:case uB:case rB:case oB:case aB:case sB:case xB:case dB:case pB:case kB:return n;case wB:if("line"===e||"trail"===e)return n;case _B:case AB:{const e=t[i];if(f(e)||XT(e))for(const t of u(e))t.aggregate||n.push(lP(t,{}));return n}case hB:if("trail"===e)return n;case lB:case cB:case fB:case mB:case gB:case yB:case bB:case vB:{const e=vP(t[i]);return e&&!e.aggregate&&n.push(lP(e,{})),n}}}),[])}function YP(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map((({fieldPrefix:e,titlePrefix:n})=>{const r=i?` of ${XP(t)}`:"";return{field:e+t.field,type:t.type,title:pO(n)?{signal:`${n}"${escape(r)}"`}:n+r}})),...cM(function(e){const t=[];for(const n of yM(e))if(jP(e,n)){const i=e[n],r=u(i);for(const e of r)XT(e)?t.push(e):VT(e)&&t.push(e.condition)}return t}(n).map(uP),iM)]}}function XP(e){const{title:t,field:n}=e;return zM(t,n)}function JP(e,t,n,i,r){const{scale:o,axis:a}=n;return({partName:s,mark:u,positionPrefix:l,endPositionPrefix:c,extraEncoding:f={}})=>{const d=XP(n);return KP(e,s,r,{mark:u,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...ie(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function KP(e,t,n,i){const{clip:r,color:o,opacity:a}=e,s=e.type;return e[t]||void 0===e[t]&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...o?{color:o}:{},...a?{opacity:a}:{},...eT(i.mark)?i.mark:{type:i.mark},style:`${s}-${String(t)}`,...Pe(e[t])?{}:e[t]}}]:[]}function QP(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],u=i[`${r}Error2`];return{continuousAxisChannelDef:ZP(o,n),continuousAxisChannelDef2:ZP(a,n),continuousAxisChannelDefError:ZP(s,n),continuousAxisChannelDefError2:ZP(u,n),continuousAxis:r}}function ZP(e,t){if(null==e?void 0:e.aggregate){const{aggregate:n,...i}=e;return n!==t&&gN(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function ej(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(eT(n)&&n.orient)return n.orient;if(QT(r)){if(QT(o)){const e=XT(r)&&r.aggregate,n=XT(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return DP(o)&&!DP(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(QT(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const tj="boxplot",nj=new PP(tj,rj);function ij(e){return te(e)?"tukey":e}function rj(e,{config:t}){e={...e,encoding:HP(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...a}=e,s=eT(n)?n:{type:n};r&&gN(WO("boxplot"));const u=s.extent??t.boxplot.extent,l=EO("size",s,t),c=s.invalid,d=ij(u),{bins:h,timeUnits:p,transform:m,continuousAxisChannelDef:g,continuousAxis:y,groupby:v,aggregate:b,encodingWithoutContinuousAxis:x,ticksOrient:w,boxOrient:_,customTooltipWithoutAggregatedField:A}=function(e,t,n){const i=ej(e,tj),{continuousAxisChannelDef:r,continuousAxis:o}=QP(e,i,tj),a=r.field,s=MM(a),u=ij(t),l=[...oj(a),{op:"median",field:a,as:`mid_box_${s}`},{op:"min",field:a,as:("min-max"===u?"lower_whisker_":"min_")+s},{op:"max",field:a,as:("min-max"===u?"upper_whisker_":"max_")+s}],c="min-max"===u||"tukey"===u?[]:[{calculate:`${CM(`upper_box_${s}`)} - ${CM(`lower_box_${s}`)}`,as:`iqr_${s}`},{calculate:`min(${CM(`upper_box_${s}`)} + ${CM(`iqr_${s}`)} * ${t}, ${CM(`max_${s}`)})`,as:`upper_whisker_${s}`},{calculate:`max(${CM(`lower_box_${s}`)} - ${CM(`iqr_${s}`)} * ${t}, ${CM(`min_${s}`)})`,as:`lower_whisker_${s}`}],{[o]:d,...h}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(f(t)){for(const e of t)e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return f(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(h),{bins:g,timeUnits:y,aggregate:v,groupby:b,encoding:x}=IP(m,n),w="vertical"===i?"horizontal":"vertical",_=i,A=[...g,...y,{aggregate:[...v,...l],groupby:b},...c];return{bins:g,timeUnits:y,transform:A,groupby:b,aggregate:v,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:x,ticksOrient:w,boxOrient:_,customTooltipWithoutAggregatedField:p}}(e,u,t),k=MM(g.field),{color:D,size:F,...C}=x,E=e=>JP(s,y,g,e,t.boxplot),$=E(C),S=E(x),M=(ne(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",B=E({...C,...F?{size:F}:{},color:{condition:{test:`${CM(`lower_box_${g.field}`)} >= ${CM(`upper_box_${g.field}`)}`,...D||{value:M}}}}),z=YP([{fieldPrefix:"min-max"===d?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===d?"lower_whisker_":"min_",titlePrefix:"Min"}],g,x),O={type:"tick",color:"black",opacity:1,orient:w,invalid:c,aria:!1},N="min-max"===d?z:YP([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],g,x),R=[...$({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...$({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...$({partName:"ticks",mark:O,positionPrefix:"lower_whisker",extraEncoding:N}),...$({partName:"ticks",mark:O,positionPrefix:"upper_whisker",extraEncoding:N})],T=[..."tukey"!==d?R:[],...S({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:_,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:z}),...B({partName:"median",mark:{type:"tick",invalid:c,...ne(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:z})];if("min-max"===d)return{...a,transform:(a.transform??[]).concat(m),layer:T};const P=CM(`lower_box_${g.field}`),j=CM(`upper_box_${g.field}`),L=`(${j} - ${P})`,q=`${P} - ${u} * ${L}`,U=`${j} + ${u} * ${L}`,I=CM(g.field),W={joinaggregate:oj(g.field),groupby:v},H={transform:[{filter:`(${q} <= ${I}) && (${I} <= ${U})`},{aggregate:[{op:"min",field:g.field,as:`lower_whisker_${k}`},{op:"max",field:g.field,as:`upper_whisker_${k}`},{op:"min",field:`lower_box_${g.field}`,as:`lower_box_${k}`},{op:"max",field:`upper_box_${g.field}`,as:`upper_box_${k}`},...b],groupby:v}],layer:R},{tooltip:G,...V}=C,{scale:Y,axis:X}=g,J=XP(g),K=nM(X,["title"]),Q=KP(s,"outliers",t.boxplot,{transform:[{filter:`(${I} < ${q}) || (${I} > ${U})`}],mark:"point",encoding:{[y]:{field:g.field,type:g.type,...void 0!==J?{title:J}:{},...void 0!==Y?{scale:Y}:{},...gM(K)?{}:{axis:K}},...V,...D?{color:D}:{},...A?{tooltip:A}:{}}})[0];let Z;const ee=[...h,...p,W];return Q?Z={transform:ee,layer:[Q,H]}:(Z=H,Z.transform.unshift(...ee)),{...a,layer:[Z,{transform:m,layer:T}]}}function oj(e){const t=MM(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}const aj="errorbar",sj=new PP(aj,uj);function uj(e,{config:t}){e={...e,encoding:HP(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:u,tooltipEncoding:l}=cj(e,aj,t);delete o.size;const c=JP(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function lj(e,t){const{encoding:n}=e;if(function(e){return(tP(e.x)||tP(e.y))&&!tP(e.x2)&&!tP(e.y2)&&!tP(e.xError)&&!tP(e.xError2)&&!tP(e.yError)&&!tP(e.yError2)}(n))return{orient:ej(e,t),inputType:"raw"};const i=function(e){return tP(e.x2)||tP(e.y2)}(n),r=function(e){return tP(e.xError)||tP(e.xError2)||tP(e.yError)||tP(e.yError2)}(n),o=n.x,a=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(tP(e)&&tP(i))throw new Error(`${t} cannot have both x2 and y2`);if(tP(e)){if(QT(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(tP(i)){if(QT(a))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,s=n.yError2;if(tP(i)&&!tP(e))throw new Error(`${t} cannot have xError2 without xError`);if(tP(s)&&!tP(r))throw new Error(`${t} cannot have yError2 without yError`);if(tP(e)&&tP(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(tP(e)){if(QT(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(tP(r)){if(QT(a))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 cj(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,u=eT(i)?i:{type:i};o&&gN(WO(t));const{orient:l,inputType:c}=lj(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:p,continuousAxis:m}=QP(e,l,t),{errorBarSpecificAggregate:g,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let u=[],l=[];const c=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&gN(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)u=[{op:n,field:c,as:`extent_${c}`},{op:t,field:c,as:`center_${c}`}],l=[{calculate:`${CM(`center_${c}`)} + ${CM(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${CM(`center_${c}`)} - ${CM(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:kM(t)},{fieldPrefix:"upper_",titlePrefix:fj(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:fj(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),u=[{op:t,field:c,as:`lower_${c}`},{op:i,field:c,as:`upper_${c}`},{op:e,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:pP({field:c,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:pP({field:c,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:pP({field:c,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&gN((h=e.center,`${(p=e.extent)?"extent ":""}${p&&h?"and ":""}${h?"center ":""}${p&&h?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],l=[{calculate:CM(n.field),as:`upper_${c}`},{calculate:CM(c),as:`lower_${c}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${CM(c)} + ${CM(i.field)}`,as:`upper_${c}`}],r?l.push({calculate:`${CM(c)} + ${CM(r.field)}`,as:`lower_${c}`}):l.push({calculate:`${CM(c)} - ${CM(i.field)}`,as:`lower_${c}`}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:SM(SM(e.calculate,"datum['",""),"']","")})}var h,p;return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}(u,f,d,h,p,c,t,n),{[m]:x,["x"===m?"x2":"y2"]:w,["x"===m?"xError":"yError"]:_,["x"===m?"xError2":"yError2"]:A,...k}=r,{bins:D,timeUnits:F,aggregate:C,groupby:E,encoding:$}=IP(k,n),S=[...C,...g],M="raw"!==c?[]:E,B=YP(v,f,$,b);return{transform:[...s.transform??[],...D,...F,...0===S.length?[]:[{aggregate:S,groupby:M}],...y],groupby:M,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:$,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:u,outerSpec:s,tooltipEncoding:B}}function fj(e,t,n){return`${kM(e)} ${n} ${t}`}const dj="errorband",hj=new PP(dj,pj);function pj(e,{config:t}){e={...e,encoding:HP(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:u}=cj(e,dj,t),l=a,c=JP(l,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const p={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},h={...h,...p,aria:!1}):l.interpolate?gN(fN("interpolate")):l.tension&&gN(fN("tension")),{...s,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const mj={};function gj(e,t,n){const i=new PP(e,t);mj[e]={normalizer:i,parts:n}}gj(tj,rj,["box","median","outliers","rule","ticks"]),gj(aj,uj,["ticks","rule"]),gj(dj,pj,["band","borders"]);const yj=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],vj={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"},bj={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},xj=yM(vj),wj=yM(bj),_j=yM({header:1,headerRow:1,headerColumn:1,headerFacet:1}),Aj=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],kj="_vgsid_",Dj={point:{on:"click",fields:[kj],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Fj(e){return"legend"===e||!!(null==e?void 0:e.legend)}function Cj(e){return Fj(e)&&ne(e)}function Ej(e){return!!(null==e?void 0:e.select)}function $j(e){const t=[];for(const n of e||[]){if(Ej(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function Sj(e){return WM(e,"concat")}function Mj(e){return WM(e,"vconcat")}function Bj(e){return WM(e,"hconcat")}function zj({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function Oj(e){return WM(e,"step")}function Nj(e){return WM(e,"view")||WM(e,"width")||WM(e,"height")}const Rj=yM({align:1,bounds:1,center:1,columns:1,spacing:1});function Tj(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function Pj(e,t){const n=jj(e,t);return Oj(n)?n.step:Lj}function jj(e,t){return zM(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Lj=20,qj={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Lj},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:lT,circle:{},geoshape:{},image:{},line:{},point:{},rect:uT,rule:{color:"black"},square:{},text:{color:"black"},tick:cT,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,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Dj,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Uj=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],Ij={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Wj={blue:Uj[0],orange:Uj[1],red:Uj[2],teal:Uj[3],green:Uj[4],yellow:Uj[5],purple:Uj[6],pink:Uj[7],brown:Uj[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Hj(e){const t=yM(e||{}),n={};for(const i of t){const t=e[i];n[i]=SP(t)?xO(t):wO(t)}return n}const Gj=[...oT,...RP,..._j,"background","padding","legend","lineBreak","scale","style","title","view"];function Vj(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,a=qe({},ZS(qj),n?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(n):{},t?function(e={}){return{signals:[{name:"color",value:ne(e)?{...Wj,...e}:Wj}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(t):{},i?function(e){return{signals:[{name:"fontSize",value:ne(e)?{...Ij,...e}:Ij}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(i):{},o||{});r&&pt(a,"selection",r,!0);const s=nM(a,Gj);for(const u of["background","lineBreak","padding"])a[u]&&(s[u]=wO(a[u]));for(const u of oT)a[u]&&(s[u]=fO(a[u]));for(const u of RP)a[u]&&(s[u]=Hj(a[u]));for(const u of _j)a[u]&&(s[u]=fO(a[u]));if(a.legend&&(s.legend=fO(a.legend)),a.scale){const{invalid:e,...t}=a.scale,n=fO(e,{level:1});s.scale={...fO(t),...yM(n).length>0?{invalid:n}:{}}}return a.style&&(s.style=function(e){const t=yM(e),n={};for(const i of t)n[i]=Hj(e[i]);return n}(a.style)),a.title&&(s.title=fO(a.title)),a.view&&(s.view=fO(a.view)),s}const Yj=new Set(["view",...ZR]),Xj=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Jj={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...rT};function Kj(e){e=ZS(e);for(const t of Xj)delete e[t];if(e.axis)for(const t in e.axis)SP(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of yj)delete e.legend[t];if(e.mark){for(const t of nT)delete e.mark[t];e.mark.tooltip&&ne(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat($j(e.params)),delete e.params);for(const t of Yj){for(const i of nT)delete e[t][i];const n=Jj[t];if(n)for(const i of n)delete e[t][i];Qj(e,t)}for(const t of yM(mj))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=dO(e.title);gM(t)||(e.style["group-title"]={...e.style["group-title"],...t});gM(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});gM(i)?delete e.title:e.title=i}(e);for(const t in e)ne(e[t])&&gM(e[t])&&delete e[t];return gM(e)?void 0:e}function Qj(e,t,n,i){"view"===t&&(n="cell");const r={...e[t],...e.style[n??t]};gM(r)||(e.style[n??t]=r),delete e[t]}function Zj(e){return WM(e,"layer")}class eL{map(e,t){return jT(e)?this.mapFacet(e,t):function(e){return WM(e,"repeat")}(e)?this.mapRepeat(e,t):Bj(e)?this.mapHConcat(e,t):Mj(e)?this.mapVConcat(e,t):Sj(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Zj(e))return this.mapLayer(e,t);if(TP(e))return this.mapUnit(e,t);throw new Error(RO(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const tL={zero:1,center:1,normalize:1};const nL=new Set([TR,jR,PR,WR,UR,YR,XR,qR,HR,GR]),iL=new Set([jR,PR,TR]);function rL(e){return XT(e)&&"quantitative"===JT(e)&&!e.bin}function oL(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t&&["bar","area"].includes(i),a=e[t],s=e[r];if(XT(a)&&XT(s))if(rL(a)&&rL(s)){if(a.stack)return t;if(s.stack)return r;const e=XT(a)&&!!a.aggregate;if(e!==(XT(s)&&!!s.aggregate))return e?t:r;if(o){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(rL(a))return t;if(rL(s))return r}else{if(rL(a)){if(o&&"vertical"===n)return;return t}if(rL(s)){if(o&&"horizontal"===n)return;return r}}}function aL(e,t){var n,i;const r=eT(e)?e:{type:e},o=r.type;if(!nL.has(o))return null;const a=oL(t,"x",r)||oL(t,"theta",r);if(!a)return null;const s=t[a],l=XT(s)?lP(s,{}):void 0,f=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(a),d=[],h=new Set;if(t[f]){const e=t[f],n=XT(e)?lP(e,{}):void 0;n&&n!==l&&(d.push(f),h.add(n))}const p="x"===f?"xOffset":"yOffset",m=t[p],g=XT(m)?lP(m,{}):void 0;g&&g!==l&&(d.push(p),h.add(g));const y=xz.reduce(((e,n)=>{if("tooltip"!==n&&jP(t,n)){const i=t[n];for(const t of u(i)){const i=vP(t);if(i.aggregate)continue;const r=lP(i,{});r&&h.has(r)||e.push({channel:n,fieldDef:i})}}return e}),[]);let v;return void 0!==s.stack?v=Pe(s.stack)?s.stack?"zero":null:s.stack:iL.has(o)&&(v="zero"),v&&c(tL,v)?UP(t)&&0===y.length?null:((null==(n=null==s?void 0:s.scale)?void 0:n.type)&&(null==(i=null==s?void 0:s.scale)?void 0:i.type)!==iR&&(null==s?void 0:s.stack)&&gN(`Stack is applied to a non-linear scale (${s.scale.type}).`),tP(t[ZB(a)])?(void 0!==s.stack&&gN(`Cannot stack "${b=a}" if there is already "${b}2".`),null):(XT(s)&&s.aggregate&&!nO.has(s.aggregate)&&gN(`Stacking is applied even though the aggregate function is non-summative ("${s.aggregate}").`),{groupbyChannels:d,groupbyFields:h,fieldChannel:a,impute:null!==s.impute&&KR(o),stackBy:y,offset:v})):null;var b}function sL(e,t,n){const i=fO(e),r=EO("orient",i,n);if(i.orient=function(e,t,n){switch(e){case UR:case YR:case XR:case HR:case IR:case LR:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case jR:if(XT(i)&&(aO(i.bin)||XT(r)&&r.aggregate&&!i.aggregate))return"vertical";if(XT(r)&&(aO(r.bin)||XT(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(XT(i)&&i.type===QN&&!oO(i.bin)||eP(i))&&XT(r)&&aO(r.bin)?"horizontal":"vertical";if(!a)return(XT(r)&&r.type===QN&&!oO(r.bin)||eP(r))&&XT(i)&&aO(i.bin)?"vertical":"horizontal"}case WR:if(o&&(!XT(i)||!aO(i.bin))&&a&&(!XT(r)||!aO(r.bin)))return;case PR:if(a)return XT(r)&&aO(r.bin)?"horizontal":"vertical";if(o)return XT(i)&&aO(i.bin)?"vertical":"horizontal";if(e===WR){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case qR:case GR:{const t=ZT(i),o=ZT(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=nP(i)&&i.type===eR,t=nP(r)&&r.type===eR;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&gN(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=EO("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:sT[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}const o=EO("opacity",i,n),a=EO("fillOpacity",i,n);void 0===o&&void 0===a&&(i.opacity=function(e,t){if(oM([UR,GR,YR,XR],e)&&!UP(t))return.7;return}(i.type,t));return void 0===EO("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||EO("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function uL(e){const{point:t,line:n,...i}=e;return yM(i).length>1?i:i.type}function lL(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:nM(e[t],["point","line"])});return e}function cL(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?ne(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?ne(t.point)?t.point:{}:void 0}function fL(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 dL{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(TP(e)){const{mark:n,encoding:i}=e,r=eT(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!cL(r,t[r.type],i);case"area":return!!cL(r,t[r.type],i)||!!fL(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:u,...l}=e,c=HP(u,i),f=eT(a)?a:{type:a},d=cL(f,i[f.type],c),h="area"===f.type&&fL(f,i[f.type]),p=[{name:s,...r?{params:r}:{},mark:uL({..."area"===f.type&&void 0===f.opacity&&void 0===f.fillOpacity?{opacity:.7}:{},...f}),encoding:nM(c,["shape"])}],m=aL(sL(f,c,i),c);let g=c;if(m){const{fieldChannel:e,offset:t}=m;g={...c,[e]:{...c[e],...t?{stack:t}:{}}}}return g=nM(g,["y2","x2"]),h&&p.push({...o?{projection:o}:{},mark:{type:"line",...tM(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&p.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...tM(f,["clip","tooltip"]),...d},encoding:g}),n({...l,layer:p},{...t,config:lL(i)})}}function hL(e,t){return t?TT(e)?bL(e,t):gL(e,t):e}function pL(e,t){return t?bL(e,t):e}function mL(e,t,n){const i=t[e];return!ie(r=i)&&WM(r,"repeat")?i.repeat in n?{...t,[e]:n[i.repeat]}:void gN(function(e){return`Unknown repeated value "${e}".`}(i.repeat)):t;var r}function gL(e,t){if(void 0!==(e=mL("field",e,t))){if(null===e)return null;if(qT(e)&&NT(e.sort)){const n=mL("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function yL(e,t){if(XT(e))return gL(e,t);{const n=mL("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function vL(e,t){if(!tP(e)){if(YT(e)){const n=yL(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=yL(e,t);if(n)return n;if(GT(e))return{condition:e.condition}}}function bL(e,t){const n={};for(const i in e)if(WM(e,i)){const r=e[i];if(f(r))n[i]=r.map((e=>vL(e,t))).filter((e=>e));else{const e=vL(r,t);void 0!==e&&(n[i]=e)}}return n}class xL{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(TP(e)){const{encoding:t,mark:n}=e;if("line"===n||eT(n)&&"line"===n.type)for(const e of XB){const n=t[KB(e)];if(t[e]&&(XT(n)&&!aO(n.bin)||KT(n)))return!0}}return!1}run(e,t,n){const{encoding:i,mark:r}=e;var o,a;return gN((o=!!i.x2,a=!!i.y2,`Line mark is for continuous lines and thus cannot be used with ${o&&a?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),n({...e,mark:ne(r)?{...r,type:"rule"}:"rule"},t)}}function wL({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...yM(e),...yM(t)]);for(const o of r){const r=t[o],a=e[o];if(tP(r)){const e={...a,...r};i[o]=e}else YT(r)?i[o]={...r,condition:{...a,...r.condition}}:r||null===r?i[o]=r:(n||iP(a)||pO(a)||tP(a)||f(a))&&(i[o]=a)}}else i=t;return!i||gM(i)?void 0:i}function _L(e){const{parentProjection:t,projection:n}=e;return t&&n&&gN(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${IM(t)} is overridden by a child projection ${IM(n)}.`}({parentProjection:t,projection:n})),n??t}function AL(e){return WM(e,"filter")}function kL(e){return WM(e,"lookup")}function DL(e){return WM(e,"pivot")}function FL(e){return WM(e,"density")}function CL(e){return WM(e,"quantile")}function EL(e){return WM(e,"regression")}function $L(e){return WM(e,"loess")}function SL(e){return WM(e,"sample")}function ML(e){return WM(e,"window")}function BL(e){return WM(e,"joinaggregate")}function zL(e){return WM(e,"flatten")}function OL(e){return WM(e,"calculate")}function NL(e){return WM(e,"bin")}function RL(e){return WM(e,"impute")}function TL(e){return WM(e,"timeUnit")}function PL(e){return WM(e,"aggregate")}function jL(e){return WM(e,"stack")}function LL(e){return WM(e,"fold")}function qL(e){return WM(e,"extent")&&!WM(e,"density")&&!WM(e,"regression")}function UL(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(AL(e))return{filter:HL(e,t)};if(NL(e)&&sO(e.bin))return{...e,bin:WL(e.bin)};if(kL(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function IL(e,t){var n,i;const r=ZS(e);if(XT(r)&&sO(r.bin)&&(r.bin=WL(r.bin)),rP(r)&&(null==(i=null==(n=r.scale)?void 0:n.domain)?void 0:i.selection)){const{selection:e,...t}=r.scale.domain;r.scale.domain={...t,...e?{param:e}:{}}}if(GT(r))if(f(r.condition))r.condition=r.condition.map((e=>{const{selection:n,param:i,test:r,...o}=e;return i?e:{...o,test:HL(e,t)}}));else{const{selection:e,param:n,test:i,...o}=IL(r.condition,t);r.condition=n?r.condition:{...o,test:HL(r.condition,t)}}return r}function WL(e){const t=e.extent;if(null==t?void 0:t.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function HL(e,t){const n=e=>QS(e,(e=>{var n;const i={param:e,empty:t.emptySelections[e]??!0};return(n=t.selectionPredicates)[e]??(n[e]=[]),t.selectionPredicates[e].push(i),i}));return e.selection?n(e.selection):QS(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class GL extends eL{map(e,t){const n=t.selections??[];if(e.params&&!TP(e)){const t=[];for(const i of e.params)Ej(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,t){const n=t.selections;if(!n||!n.length)return e;const i=(t.path??[]).concat(e.name),r=[];for(const o of n)if(o.views&&o.views.length)for(const t of o.views)(ie(t)&&(t===e.name||i.includes(t))||f(t)&&t.map((e=>i.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&r.push(o);else r.push(o);return r.length&&(e.params=r),e}}for(const KV of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const e=GL.prototype[KV];GL.prototype[KV]=function(t,n){return e.call(this,t,VL(t,n))}}function VL(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function YL(e,t){void 0===t&&(t=Vj(e.config));const n=function(e,t={}){const n={config:t};return KL.map(XL.map(JL.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=TP(e)||Zj(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(gN(PO("width")),i=void 0),"container"==r&&(gN(PO("height")),r=void 0));const s={type:"pad",...a,...n?QL(n.autosize):{},...QL(e.autosize)};"fit"!==s.type||o||(gN(TO),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&gN(jO("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&gN(jO("height"));if(UM(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const XL=new class extends eL{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[nj,sj,hj,new dL,new xL]}map(e,t){if(TP(e)){const n=jP(e.encoding,HM),i=jP(e.encoding,GM),r=jP(e.encoding,VM);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=pL(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const s of this.nonFacetUnitNormalizers)if(s.hasMatchingType(o,t.config))return s.run(o,t,a);return o}mapRepeat(e,t){return function(e){return!f(e.repeat)&&WM(e.repeat,"layer")}(e)?this.mapLayerRepeat(e,t):this.mapNonLayerRepeat(e,t)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:u={},repeaterPrefix:l=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...u,layer:e},r=`${(i.name?`${i.name}_`:"")+l}child__layer_${wM(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,t){const{repeat:n,spec:i,data:r,...o}=e;!f(n)&&e.columns&&(e=nM(e,["columns"]),gN(GO("repeat")));const a=[],{repeater:s={},repeaterPrefix:u=""}=t,l=!f(n)&&n.row||[s?s.row:null],c=!f(n)&&n.column||[s?s.column:null],d=f(n)&&n||[s?s.repeat:null];for(const p of d)for(const e of l)for(const r of c){const o={repeat:p,row:e,column:r,layer:s.layer},l=(i.name?`${i.name}_`:"")+u+"child__"+(f(n)?`${wM(p)}`:(n.row?`row_${wM(e)}`:"")+(n.column?`column_${wM(r)}`:"")),c=this.map(i,{...t,repeater:o,repeaterPrefix:l});c.name=l,a.push(nM(c,["data"]))}const h=f(n)?e.columns:n.column?n.column.length:1;return{data:i.data??r,align:"all",...o,columns:h,concat:a}}mapFacet(e,t){const{facet:n}=e;return TT(n)&&e.columns&&(e=nM(e,["columns"]),gN(GO("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=_L({parentProjection:o,projection:i}),u=wL({parentEncoding:r,encoding:pL(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...u?{encoding:u}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:u,height:l,view:c,params:f,encoding:d,...h}=e,{facetMapping:p,layout:m}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),g=pL(o,t.repeater);return this.mapFacet({...h,...m,facet:p,spec:{...s?{width:s}:{},...l?{height:l}:{},...c?{view:c}:{},...u?{projection:u}:{},mark:a,encoding:g,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&gN(`Facet encoding dropped as ${(o=[...n?[HM]:[],...i?[GM]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[HM,GM]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...u}=i;t[n]=u;for(const t of["align","center","spacing"])void 0!==i[t]&&(a[t]??(a[t]={}),a[t][n]=i[t])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:hL(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:wL({parentEncoding:t,encoding:r,layer:!0}),parentProjection:_L({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},s)}},JL=new class extends eL{map(e,t){return t.emptySelections??(t.emptySelections={}),t.selectionPredicates??(t.selectionPredicates={}),e=UL(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=UL(e,t)).encoding){const n={};for(const[i,r]of bM(e.encoding))n[i]=IL(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:bM(n).map((([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const s of vM(t.selectionPredicates[e]??{}))s.empty="none"!==o;return{name:e,value:i,select:a,bind:r}}))}:e}},KL=new GL;function QL(e){return ie(e)?{type:e}:e??{}}const ZL=["background","padding"];function eq(e,t){const n={};for(const i of ZL)e&&void 0!==e[i]&&(n[i]=wO(e[i]));return t&&(n.params=e.params),n}class tq{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new tq(ZS(this.explicit),ZS(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return zM(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,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of yM(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function nq(e){return{explicit:!0,value:e}}function iq(e){return{explicit:!1,value:e}}function rq(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:oq(t,n,i,r)}}function oq(e,t,n,i){return e.explicit&&t.explicit&&gN(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${IM(n)} and ${IM(i)}). Using ${IM(n)}.`}(n,i,e.value,t.value)),e}function aq(e,t,n,i,r=oq){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:UM(e.value,t.value)?e:r(e,t,n,i)}class sq extends tq{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}}function uq(e){return WM(e,"url")}function lq(e){return WM(e,"values")}function cq(e){return WM(e,"name")&&!uq(e)&&!lq(e)&&!fq(e)}function fq(e){return e&&(dq(e)||hq(e)||pq(e))}function dq(e){return WM(e,"sequence")}function hq(e){return WM(e,"sphere")}function pq(e){return WM(e,"graticule")}var mq,gq;function yq({invalid:e,isPath:t}){switch(fT(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}(gq=mq||(mq={}))[gq.Raw=0]="Raw",gq[gq.Main=1]="Main",gq[gq.Row=2]="Row",gq[gq.Column=3]="Column",gq[gq.Lookup=4]="Lookup",gq[gq.PreFilterInvalid=5]="PreFilterInvalid",gq[gq.PostFilterInvalid=6]="PostFilterInvalid";class vq{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.includes(e)?gN("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 i of this._children)i.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class bq extends vq{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}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)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${NM()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function xq(e){return void 0!==e.as}function wq(e){return`${e}_end`}class _q extends vq{clone(){return new _q(null,ZS(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(FN(o)){if(KG(t)){const{mark:e,markDef:i,config:s}=t,u=UT({fieldDef:n,markDef:i,config:s});(QR(e)||u)&&(a={timeUnit:NN(o),field:r})}}else a={as:lP(n,{forAs:!0}),field:r,timeUnit:o};if(KG(t)){const{mark:e,markDef:r,config:o}=t,s=UT({fieldDef:n,markDef:r,config:o});QR(e)&&Az(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[iM(a)]=a)}return e}),{});return gM(n)?null:new _q(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:NN(n)};return new _q(e,{[iM(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of bM(this.timeUnits)){const r=xq(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(vM(this.timeUnits).map((e=>xq(e)?e.as:wq(e.field))))}dependentFields(){return new Set(vM(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${iM(this.timeUnits)}`}assemble(){const e=[];for(const t of vM(this.timeUnits)){const{rectBandPosition:n}=t,i=NN(t.timeUnit);if(xq(t)){const{field:r,as:o}=t,{unit:a,utc:s,...u}=i,l=[o,`${o}_end`];e.push({field:$M(r),type:"timeunit",...a?{units:SN(a)}:{},...s?{timezone:"utc"}:{},...u,as:l}),e.push(...Fq(l,n,i))}else if(t){const{field:r}=t,o=r.replaceAll("\\.","."),a=Dq({timeUnit:i,field:o}),s=wq(o);e.push({type:"formula",expr:a,as:s}),e.push(...Fq([o,s],n,i))}}return e}}const Aq="offsetted_rect_start",kq="offsetted_rect_end";function Dq({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,o=MN(i),{part:a,step:s}=PN(o,e.step);return`${r?"utcOffset":"timeOffset"}('${a}', ${CM(t)}, ${n?-s:s})`}function Fq([e,t],n,i){if(void 0!==n&&.5!==n){const r=CM(e),o=CM(t);return[{type:"formula",expr:Cq([Dq({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${Aq}`},{type:"formula",expr:Cq([r,o],n+.5),as:`${e}_${kq}`}]}return[]}function Cq([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const Eq="_tuple_fields";class $q{constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const Sq={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new $q),o={},a={},s=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let r=wM(`${i}_${n}`);for(let o=1;s.has(r);o++)r=wM(`${i}_${n}_${o}`);return s.add(r),{[t]:r}},f=t.type,d=e.config.selection[f],h=void 0!==n.value?u(n.value):null;let{fields:p,encodings:m}=ne(n.select)?n.select:{};if(!p&&!m&&h)for(const u of h)if(ne(u))for(const e of yM(u))c(VB,e)?(m||(m=[])).push(e):"interval"===f?(gN('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),m=d.encodings):(p??(p=[])).push(e);p||m||(m=d.encodings,"fields"in d&&(p=d.fields));for(const u of m??[]){const t=e.fieldDef(u);if(t){let n=t.field;if(t.aggregate){gN(IO(u,t.aggregate));continue}if(!n){gN(UO(u));continue}if(t.timeUnit&&!FN(t.timeUnit)){n=e.vgField(u);const i={timeUnit:t.timeUnit,as:n,field:t.field};a[iM(i)]=i}if(!o[n]){const i={field:n,channel:u,type:"interval"===f&&Iz(u)&&_R(e.getScaleComponent(u).get("type"))?"R":t.bin?"R-RE":"E",index:r.items.length};i.signals={...l(i,"data"),...l(i,"visual")},r.items.push(o[n]=i),r.hasField[n]=o[n],r.hasSelectionId=r.hasSelectionId||n===kj,BB(u)?(i.geoChannel=u,i.channel=MB(u),r.hasChannel[i.channel]=o[n]):r.hasChannel[u]=o[n]}}else gN(UO(u))}for(const u of p??[]){if(r.hasField[u])continue;const e={type:"E",field:u,index:r.items.length};e.signals={...l(e,"data")},r.items.push(e),r.hasField[u]=e,r.hasSelectionId=r.hasSelectionId||u===kj}h&&(t.init=h.map((e=>r.items.map((t=>ne(e)?void 0!==e[t.geoChannel||t.channel]?e[t.geoChannel||t.channel]:e[t.field]:e))))),gM(a)||(r.timeUnit=new _q(null,a))},signals:(e,t,n)=>{const i=t.name+Eq;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(qq)})}},Mq="_curr",Bq="anim_value",zq="anim_clock",Oq="eased_anim_clock",Nq="min_extent",Rq="max_range_extent",Tq="last_tick_at",Pq="is_playing",jq=1/60*1e3,Lq={defined:e=>"point"===e.type,topLevelSignals:(e,t,n)=>(nI(t)&&(n=n.concat([{name:zq,init:"0",on:[{events:{type:"timer",throttle:jq},update:`${Pq} ? (${zq} + (now() - ${Tq}) > ${Rq} ? 0 : ${zq} + (now() - ${Tq})) : ${zq}`}]},{name:Tq,init:"now()",on:[{events:[{signal:zq},{signal:Pq}],update:"now()"}]},{name:Pq,init:"true"}])),n),signals:(e,t,n)=>{const i=t.name,r=i+Eq,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=vM(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+Jq):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),u="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let l=`unit: ${ZU(e)}, `;if(t.project.hasSelectionId)l+=`${kj}: ${a}[${fe(kj)}]`;else if(nI(t))l+=`fields: ${r}, values: [${Bq} ? ${Bq} : ${Nq}]`;else{l+=`fields: ${r}, values: [${o.items.map((t=>{const n=e.fieldDef(t.channel);return(null==n?void 0:n.bin)?`[${a}[${fe(e.vgField(t.channel,{}))}], ${a}[${fe(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${a}[${fe(t.field)}]`})).join(", ")}]`}if(nI(t))return n.concat((c=t.name,f=e.scaleName(uB),[{name:Oq,update:zq},{name:`${c}_domain`,init:`domain('${f}')`},{name:Nq,init:`extent(${c}_domain)[0]`},{name:Rq,init:`extent(range('${f}'))[1]`},{name:Bq,update:`invert('${f}', ${Oq})`}]),[{name:i+XU,on:[{events:[{signal:Oq},{signal:Bq}],update:`{${l}}`,force:!0}]}]);{const e=t.events;return n.concat([{name:i+XU,on:e?[{events:e,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}var c,f}};function qq(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=$M(r.field),r}function Uq(e,t=!0,n=l){if(f(e)){const i=e.map((e=>Uq(e,t,n)));return t?`[${i.join(", ")}]`:i}return yN(e)?n(t?AN(e):function(e){const t=_N(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):t?n(IM(e)):e}function Iq(e,t){for(const n of vM(e.component.selection??{})){const i=n.name;let r=`${i}${XU}, ${"global"===n.resolve?"true":`{unit: ${ZU(e)}}`}`;for(const o of QU)o.defined(n)&&(o.signals&&(t=o.signals(e,n,t)),o.modifyExpr&&(r=o.modifyExpr(e,n,r)));t.push({name:i+JU,on:[{events:{signal:n.name+XU},update:`modify(${fe(n.name+YU)}, ${r})`}]})}return Gq(t)}function Wq(e,t){if(e.component.selection&&yM(e.component.selection).length){const n=fe(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:ZF("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return Gq(t)}function Hq(e,t){for(const n of vM(e.component.selection??{}))for(const i of QU)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function Gq(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}const Vq={defined: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(!Iz(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;"sequential"==a&&gN("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&_R(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):gN("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter((e=>0===n.filter((t=>t.name===e.signals.data)).length));if(!e.parent||Xq(e)||0===i.length)return n;const r=n.find((e=>e.name===t.name));let o=r.update;if(o.includes(KU))r.update=`{${i.map((e=>`${fe($M(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of i){const t=`${fe($M(e.field))}: ${e.signals.data}`;o.includes(t)||(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&&!Xq(e))for(const i of t.scales){const e=n.find((e=>e.name===i.signals.data));e.push="outer",delete e.value,delete e.update}return n}};function Yq(e,t){return`domain(${fe(e.scaleName(t))})`}function Xq(e){return e.parent&&eV(e.parent)&&(!e.parent.parent||Xq(e.parent.parent))}const Jq="_brush",Kq="_scale_trigger",Qq="geo_interval_init_tick",Zq="_init",eU={defined:e=>"interval"===e.type,parse:(e,t,n)=>{var i;if(e.hasProjection){const e={...ne(n.select)?n.select:{}};e.fields=[kj],e.encodings||(e.encodings=n.value?yM(n.value):[oB,rB]),n.select={type:"interval",...e}}if(t.translate&&!Vq.defined(t)){const e=`!event.item || event.item.mark.name !== ${fe(t.name+Jq)}`;for(const n of t.events){if(!n.between){gN(`${n} is not an ordered event stream for interval selections.`);continue}const t=u((i=n.between[0]).filter??(i.filter=[]));t.includes(e)||t.push(e)}}},signals:(e,t,n)=>{const i=t.name,r=i+XU,o=vM(t.project.hasChannel).filter((e=>e.channel===YM||e.channel===XM)),a=t.init?t.init[0]:null;if(n.push(...o.reduce(((n,i)=>n.concat(function(e,t,n,i){const r=!e.hasProjection,o=n.channel,a=n.signals.visual,s=fe(r?e.scaleName(o):e.projectionName()),u=e=>`scale(${s}, ${e})`,l=e.getSizeSignalRef(o===YM?"width":"height").signal,c=`${o}(unit)`,f=t.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${c}, ${c}]`},{events:t,update:`[${a}[0], clamp(${c}, 0, ${l})]`}]),[]);if(r){const r=n.signals.data,l=Vq.defined(t),c=e.getScaleComponent(o),d=c?c.get("type"):void 0,h=i?{init:Uq(i,!0,u)}:{value:[]};return f.push({events:{signal:t.name+Kq},update:_R(d)?`[${u(`${r}[0]`)}, ${u(`${r}[1]`)}]`:"[0, 0]"}),l?[{name:r,on:[]}]:[{name:a,...h,on:f},{name:r,...i?{init:Uq(i)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${s}, ${a})`}]}]}{const e=o===YM?0:1,n=t.name+Zq;return[{name:a,...i?{init:`[${n}[0][${e}], ${n}[1][${e}]]`}:{value:[]},on:f}]}}(e,t,i,a&&a[i.index]))),[])),e.hasProjection){const s=fe(e.projectionName()),u=e.projectionName()+"_center",{x:l,y:c}=t.project.hasChannel,f=l&&l.signals.visual,d=c&&c.signals.visual,h=l?a&&a[l.index]:`${u}[0]`,p=c?a&&a[c.index]:`${u}[1]`,m=t=>e.getSizeSignalRef(t).signal,g=`[[${f?f+"[0]":"0"}, ${d?d+"[0]":"0"}],[${f?f+"[1]":m("width")}, ${d?d+"[1]":m("height")}]]`;if(a&&(n.unshift({name:i+Zq,init:`[scale(${s}, [${l?h[0]:h}, ${c?p[0]:p}]), scale(${s}, [${l?h[1]:h}, ${c?p[1]:p}])]`}),!l||!c)){n.find((e=>e.name===u))||n.unshift({name:u,update:`invert(${s}, [${m("width")}/2, ${m("height")}/2])`})}const y=`vlSelectionTuples(${`intersect(${g}, {markname: ${fe(e.getName("marks"))}}, unit.mark)`}, ${`{unit: ${ZU(e)}}`})`,v=o.map((e=>e.signals.visual));return n.concat({name:r,on:[{events:[...v.length?[{signal:v.join(" || ")}]:[],...a?[{signal:Qq}]:[]],update:y}]})}{if(!Vq.defined(t)){const t=i+Kq,r=o.map((t=>{const n=t.channel,{data:i,visual:r}=t.signals,o=fe(e.scaleName(n)),a=_R(e.getScaleComponent(n).get("type"))?"+":"";return`(!isArray(${i}) || (${a}invert(${o}, ${r})[0] === ${a}${i}[0] && ${a}invert(${o}, ${r})[1] === ${a}${i}[1]))`}));r.length&&n.push({name:t,value:{},on:[{events:o.map((t=>({scale:e.scaleName(t.channel)}))),update:r.join(" && ")+` ? ${t} : {}`}]})}const s=o.map((e=>e.signals.data)),u=`unit: ${ZU(e)}, fields: ${i+Eq}, values`;return n.concat({name:r,...a?{init:`{${u}: ${Uq(a)}}`}:{},...s.length?{on:[{events:[{signal:s.join(" || ")}],update:`${s.join(" && ")} ? {${u}: [${s}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(KG(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===Qq)).length||n.unshift({name:Qq,value:null,on:[{events:"timer{1}",update:`${Qq} === null ? {} : ${Qq}`}]})}return n},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,a=null==r?void 0:r.signals.visual,s=null==o?void 0:o.signals.visual,u=`data(${fe(t.name+YU)})`;if(Vq.defined(t)||!r&&!o)return n;const l={x:void 0!==r?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${s}[0]`}:{value:0},x2:void 0!==r?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const g of yM(l))l[g]=[{test:`${u}.length && ${u}[0].unit === ${ZU(e)}`,...l[g]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,p=yM(h).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${s}[0] !== ${s}[1]`].filter((e=>e)).join(" && "),value:h[t]},{value:null}],e)),{}),m=d??(t.translate?"move":null);return[{name:`${i+Jq}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:i+Jq,type:"rect",clip:!0,encode:{enter:{...m?{cursor:{value:m}}:{},fill:{value:"transparent"}},update:{...l,...p}}}]}};function tU({model:e,channelDef:t,vgChannel:n,invalidValueRef:i,mainRefFn:r}){const o=GT(t)&&t.condition;let a=[];if(o){a=u(o).map((t=>{const n=r(t);if(function(e){return WM(e,"param")}(t)){const{param:i,empty:r}=t;return{test:_W(e,{param:i,empty:r}),...n}}return{test:kW(e,t.test),...n}}))}void 0!==i&&a.push(i);const s=r(t);return void 0!==s&&a.push(s),a.length>1||1===a.length&&Boolean(a[0].test)?{[n]:a}:1===a.length?{[n]:a[0]}:{}}function nU(e,t="text"){const n=e.encoding[t];return tU({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>iU(t,e.config),invalidValueRef:void 0})}function iU(e,t,n="datum"){if(e){if(iP(e))return AO(e.value);if(tP(e)){const{format:i,formatType:r}=yP(e);return AT({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function rU(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,a=n.tooltip;if(f(a))return{tooltip:aU({tooltip:a},o,r,t)};{const s=t.reactiveGeom?"datum.datum":"datum";return tU({model:e,channelDef:a,vgChannel:"tooltip",mainRefFn:e=>{const a=iU(e,r,s);if(a)return a;if(null===e)return;let u=EO("tooltip",i,r);return!0===u&&(u={content:"encoding"}),ie(u)?{value:u}:ne(u)?pO(u)?u:"encoding"===u.content?aU(n,o,r,t):{signal:s}:void 0},invalidValueRef:void 0})}}function oU(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o=new Set,a=i?"datum.datum":"datum",s=[];function l(n,i){const l=KB(i),c=nP(n)?n:{...n,type:e[l].type},f=c.title||gP(c,r),d=u(f).join(", ").replaceAll(/"/g,'\\"');let h;if(Az(i)){const t="x"===i?"x2":"y2",n=vP(e[t]);if(aO(c.bin)&&n){const e=lP(c,{expr:a}),i=lP(n,{expr:a}),{format:s,formatType:u}=yP(c);h=MT(e,i,s,u,r),o.add(t)}}if((Az(i)||i===nB||i===eB)&&t&&t.fieldChannel===i&&"normalize"===t.offset){const{format:e,formatType:t}=yP(c);h=AT({fieldOrDatumDef:c,format:e,formatType:t,expr:a,config:r,normalizeStack:!0}).signal}h??(h=iU(c,r,a).signal),s.push({channel:i,key:d,value:h})}GP(e,((e,t)=>{XT(e)?l(e,t):VT(e)&&l(e.condition,t)}));const c={};for(const{channel:u,key:f,value:d}of s)o.has(u)||c[f]||(c[f]=d);return c}function aU(e,t,n,{reactiveGeom:i}={}){const r=oU(e,t,n,{reactiveGeom:i}),o=bM(r).map((([e,t])=>`"${e}": ${t}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function sU(e){const{markDef:t,config:n}=e,i=EO("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...uU(e),...lU(e)}}function uU(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=EO("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:c(vO,t)?{}:{ariaRoleDescription:{value:t}}}function lU(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return tU({model:e,channelDef:o,vgChannel:"description",mainRefFn:t=>iU(t,e.config),invalidValueRef:void 0});const a=EO("description",n,i);if(null!=a)return{description:AO(a)};if(!1===i.aria)return{};const s=oU(t,r,i);return gM(s)?void 0:{description:{signal:bM(s).map((([e,t],n)=>`"${n>0?"; ":""}${e}: " + (${t})`)).join(" + ")}}}function cU(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:u}=n;const l=r[e];void 0===s&&(u??(u=EO(e,i,o,{vgChannel:a,ignoreVgConfig:!GT(l)})),void 0!==u&&(s=AO(u)));const c={markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=pT({...c,scaleChannel:e,channelDef:l});return tU({model:t,channelDef:l,vgChannel:a??e,invalidValueRef:f,mainRefFn:t=>bT({...c,channel:e,channelDef:t,stack:null,defaultRef:s})})}function fU(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??EO("filled",n,r),s=oM(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,u=EO(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,l=EO(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],c=a?"fill":"stroke",f={...u?{fill:AO(u)}:{},...l?{stroke:AO(l)}:{}};return n.color&&(a?n.fill:n.stroke)&&gN(QO("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...cU("color",e,{vgChannel:c,defaultValue:a?u:l}),...cU("fill",e,{defaultValue:i.fill?u:void 0}),...cU("stroke",e,{defaultValue:i.stroke?l:void 0})}}function dU(e){const{encoding:t,mark:n}=e,i=t.order;return!KR(n)&&iP(i)?tU({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:e=>AO(e.value),invalidValueRef:void 0}):{}}function hU({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,a=t[o],s=n[o];if(("xOffset"===o||"yOffset"===o)&&s){return{offsetType:"encoding",offset:bT({channel:o,channelDef:s,markDef:t,config:null==i?void 0:i.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:AO(a),bandPosition:r})}}const u=t[o];return u?{offsetType:"visual",offset:u}:{}}function pU(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,u=r[e],l=r[ZB(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=hU({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=mU({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),m=!u&&Az(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(tP(n)&&r&&t===r.fieldChannel){if(XT(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return vT({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return yT(n,i,{suffix:"end"},{offset:o})}return gT(e)}({channel:e,channelDef:u,channel2Def:l,markDef:o,config:a,scaleName:c,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===h?0:void 0});return m?{[i||e]:m}:void 0}function mU({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=KB(n),u=QB(n),l=EO(n,o,a,{vgChannel:u});if(void 0!==l)return xT(n,l);switch(t){case"zeroOrMin":return gU({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:s,config:a});case"zeroOrMax":return gU({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:a});case"mid":return{...e[ez(n)],mult:.5}}}}function gU({mainChannel:e,config:t,...n}){const i=hT(n),{mode:r}=n;if(i)return i;switch(e){case"radius":{if("zeroOrMin"===r)return{value:0};const{widthSignal:e,heightSignal:t}=r.zeroOrMax;return{signal:`min(${e},${t})/2`}}case"theta":return"zeroOrMin"===r?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===r?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===r?{field:{group:"height"}}:{value:0}}}const yU={left:"x",center:"xc",right:"x2"},vU={top:"y",middle:"yc",bottom:"y2"};function bU(e,t,n,i="middle"){if("radius"===e||"theta"===e)return QB(e);const r="x"===e?"align":"baseline",o=EO(r,t,n);let a;return pO(o)?(gN(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?yU[a||("top"===i?"left":"center")]:vU[a||i]}function xU(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?wU(e,t,{defaultPos:n,defaultPos2:i}):pU(e,t,{defaultPos:n})}function wU(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=ZB(e),s=ez(e),u=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,u=KB(n),l=ez(n),c=QB(n),f=i[u],d=e.scaleName(u),h=e.getScaleComponent(u),{offset:p}=hU(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:u,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=ez(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[c]:{field:e.getName(n)}}}const m=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:u,defaultRef:l}){if(tP(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0))return yT(t,o,{suffix:"start"},{offset:u});return gT({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:u,defaultRef:l})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:h,stack:a,offset:p,defaultRef:void 0});if(void 0!==m)return{[c]:m};return _U(n,o)||_U(n,{[n]:SO(n,o,s.style),[l]:SO(l,o,s.style)})||_U(n,s[r])||_U(n,s.mark)||{[c]:mU({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}(t,i,a);return{...pU(e,t,{defaultPos:n,vgChannel:u[s]?bU(e,r,o):QB(e)}),...u}}function _U(e,t){const n=ez(e),i=QB(e);if(void 0!==t[i])return{[i]:xT(e,t[i])};if(void 0!==t[e])return{[i]:xT(e,t[e])};if(t[n]){const i=t[n];if(!aT(i))return{[n]:xT(e,i)};gN(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function AU(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,a=ZB(t),s=ez(t),u=i[t],l=i[a],c=e.getScaleComponent(t),d=c?c.get("type"):void 0,h=r.orient,p=i[s]??i.size??EO("size",r,n,{vgChannel:s}),m=tz(t),g="bar"===o&&("x"===t?"vertical"===h:"horizontal"===h)||"tick"===o&&("y"===t?"vertical"===h:"horizontal"===h);return!XT(u)||!(oO(u.bin)||aO(u.bin)||u.timeUnit&&!l)||p&&!aT(p)||i[m]||wR(d)?(tP(u)&&wR(d)||g)&&!l?function(e,t,n){var i,r;const{markDef:o,encoding:a,config:s,stack:u}=n,l=o.orient,c=n.scaleName(t),d=n.getScaleComponent(t),h=ez(t),p=ZB(t),m=tz(t),g=n.scaleName(m),y=n.getScaleComponent(nz(t)),v="tick"===o.type||"horizontal"===l&&"y"===t||"vertical"===l&&"x"===t;let b;(a.size||o.size)&&(v?b=cU("size",n,{vgChannel:h,defaultRef:AO(o.size)}):gN(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(o.type)));const x=!!b,w=IT({channel:t,fieldDef:e,markDef:o,config:s,scaleType:null==(i=d||y)?void 0:i.get("type"),useVlSizeChannel:v});b=b||{[h]:kU(h,g||c,y||d,s,w,!!e,o.type)};const _="band"===(null==(r=d||y)?void 0:r.get("type"))&&aT(w)&&!x?"top":"middle",A=bU(t,o,s,_),k="xc"===A||"yc"===A,{offset:D,offsetType:F}=hU({channel:t,markDef:o,encoding:a,model:n,bandPosition:k?.5:0}),C=gT({channel:t,channelDef:e,markDef:o,config:s,scaleName:c,scale:d,stack:u,offset:D,defaultRef:mU({model:n,defaultPos:"mid",channel:t,scaleName:c,scale:d}),bandPosition:k?"encoding"===F?0:.5:pO(w)?{signal:`(1-${w})/2`}:aT(w)?(1-w.band)/2:0});if(h)return{[A]:C,...b};{const e=QB(p),t=b[h],n=D?{...t,offset:D}:t;return{[A]:C,[e]:f(C)?[C[0],{...C[1],offset:n}]:{...C,offset:n}}}}(u,t,e):wU(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:e,fieldDef2:t,channel:n,model:i}){var r;const{config:o,markDef:a,encoding:s}=i,u=i.getScaleComponent(n),l=i.scaleName(n),c=u?u.get("type"):void 0,f=u.get("reverse"),d=IT({channel:n,fieldDef:e,markDef:a,config:o,scaleType:c}),h=null==(r=i.component.axes[n])?void 0:r[0],p=(null==h?void 0:h.get("translate"))??.5,m=Az(n)?EO("binSpacing",a,o)??0:0,g=ZB(n),y=QB(n),v=QB(g),b=$O("minBandSize",a,o),{offset:x}=hU({channel:n,markDef:a,encoding:s,model:i,bandPosition:0}),{offset:w}=hU({channel:g,markDef:a,encoding:s,model:i,bandPosition:0}),_=function({scaleName:e,fieldDef:t}){const n=lP(t,{expr:"datum"});return`abs(scale("${e}", ${lP(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:l}),A=DU(n,m,f,p,x,b,_),k=DU(g,m,f,p,w??x,b,_),D=pO(d)?{signal:`(1-${d.signal})/2`}:aT(d)?(1-d.band)/2:.5,F=UT({fieldDef:e,fieldDef2:t,markDef:a,config:o});if(oO(e.bin)||e.timeUnit){const t=e.timeUnit&&.5!==F;return{[v]:FU({fieldDef:e,scaleName:l,bandPosition:D,offset:k,useRectOffsetField:t}),[y]:FU({fieldDef:e,scaleName:l,bandPosition:pO(D)?{signal:`1-${D.signal}`}:1-D,offset:A,useRectOffsetField:t})}}if(aO(e.bin)){const n=yT(e,l,{},{offset:k});if(XT(t))return{[v]:n,[y]:yT(t,l,{},{offset:A})};if(sO(e.bin)&&e.bin.step)return{[v]:n,[y]:{signal:`scale("${l}", ${lP(e,{expr:"datum"})} + ${e.bin.step})`,offset:A}}}return void gN(dN(g))}({fieldDef:u,fieldDef2:l,channel:t,model:e})}function kU(e,t,n,i,r,o,a){if(aT(r)){if(!n)return{mult:r.band,field:{group:e}};{const e=n.get("type");if("band"===e){let e=`bandwidth('${t}')`;1!==r.band&&(e=`${r.band} * ${e}`);const n=$O("minBandSize",{type:a},i);return{signal:n?`max(${DO(n)}, ${e})`:e}}1!==r.band&&(gN(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),r=void 0)}}else{if(pO(r))return r;if(r)return{value:r}}if(n){const e=n.get("range");if(mO(e)&&te(e.step))return{value:e.step-2}}if(!o){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r,tickBandPaddingInner:o}=i.scale,s=zM(t,"tick"===a?o:"bar"===a?n:r);if(pO(s))return{signal:`(1 - (${s.signal})) * ${e}`};if(te(s))return{signal:`${1-s} * ${e}`}}return{value:Pj(i.view,e)-2}}function DU(e,t,n,i,r,o,a){if($B(e))return 0;const s="x"===e||"y2"===e,u=s?-t/2:t/2;if(pO(n)||pO(r)||pO(i)||o){const e=DO(n),t=DO(r),l=DO(i),c=DO(o),f=o?`(${a} < ${c} ? ${s?"":"-"}0.5 * (${c} - (${a})) : ${u})`:u;return{signal:(l?`${l} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-u:+r+u)}function FU({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return vT({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:Aq,endSuffix:kq}:{}})}const CU=new Set(["aria","width","height"]);function EU(e,t){const{fill:n,stroke:i}="include"===t.color?fU(e):{};return{...SU(e.markDef,t),...$U("fill",n),...$U("stroke",i),...cU("opacity",e),...cU("fillOpacity",e),...cU("strokeOpacity",e),...cU("strokeWidth",e),...cU("strokeDash",e),...dU(e),...rU(e),...nU(e,"href"),...sU(e)}}function $U(e,t){return t?{[e]:t}:{}}function SU(e,t){return yO.reduce(((n,i)=>(!CU.has(i)&&WM(e,i)&&"ignore"!==t[i]&&(n[i]=AO(e[i])),n)),{})}function MU(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef(((r,o)=>{var a;let s;if(!Iz(o)||!(s=e.getScaleType(o)))return;const u=tO(r.aggregate),l=dT({scaleChannel:o,markDef:n,config:t,scaleType:s,isCountAggregate:u});if("break-paths-filter-domains"===(c=l)||"break-paths-show-domains"===c){const t=e.vgField(o,{expr:"datum",binSuffix:(null==(a=e.stack)?void 0:a.impute)?"mid":void 0});t&&i.add(t)}var c})),i.size>0){return{defined:{signal:[...i].map((e=>XN(e,!0))).join(" && ")}}}}function BU(e,t){if(void 0!==t)return{[e]:AO(t)}}const zU="voronoi",OU={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(zU)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(KR(o))return gN(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(zU),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...rU(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 s=0,u=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.includes(zU)&&(u=!0)})),u||n.splice(s+1,0,a),n}},NU={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Fj(e.bind),parse:(e,t,n)=>tI(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init&&t.init[0],s=OU.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const u=wM(`${i}_${e.field}`);n.filter((e=>e.name===u)).length||n.unshift({name:u,...a?{init:Uq(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${s}[${fe(e.field)}] : null`}]:[],bind:o[e.field]??o[e.channel]??o})})),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+XU)),a=i+Eq,s=r.items.map((e=>wM(`${i}_${e.field}`))),u=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${u} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},RU="_toggle",TU={defined:e=>"point"===e.type&&!nI(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+RU,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+XU,i=t.name+RU;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${ZU(e)}}, `)+`${i} ? ${n} : null`}},PU={defined:e=>void 0!==e.clear&&!1!==e.clear&&!nI(e),parse:(e,t)=>{t.clear&&(t.clear=ie(t.clear)?ZF(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(NU.defined(t))for(const i of t.project.items){const e=n.findIndex((e=>e.name===wM(`${t.name}_${i.field}`)));-1!==e&&n[e].on.push({events:t.clear,update:"null"})}return 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)for(const r of t.project.items){const e=n.findIndex((e=>e.name===r.signals.visual));if(i(e,"[0, 0]"),-1===e){i(n.findIndex((e=>e.name===r.signals.data)),"null")}}else{let e=n.findIndex((e=>e.name===t.name+XU));i(e,"null"),TU.defined(t)&&(e=n.findIndex((e=>e.name===t.name+RU)),i(e,"false"))}return n}},jU={defined:e=>{const t="global"===e.resolve&&e.bind&&Fj(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==kj;return t&&!n&&gN("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,t,n)=>{const i=ZS(n);if(i.select=ie(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},tI(t,i),ne(n.select)&&(n.select.on||n.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=u(n.filter??[]),n.filter.includes(e)||n.filter.push(e)}const r=Cj(t.bind)?t.bind.legend:"click",o=ie(r)?ZF(r,"view"):u(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Cj(t.bind)&&t.bind.legend,o=e=>t=>{const n=ZS(t);return n.markname=e,n};for(const a of t.project.items){if(!a.hasLegend)continue;const e=`${wM(a.field)}_legend`,s=`${i}_${e}`;if(0===n.filter((e=>e.name===s)).length){const i=r.merge.map(o(`${e}_symbols`)).concat(r.merge.map(o(`${e}_labels`))).concat(r.merge.map(o(`${e}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:i,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+XU)),a=i+Eq,s=r.items.filter((e=>e.hasLegend)).map((e=>wM(`${i}_${wM(e.field)}_legend`))),u=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:u}):s.length>0&&(o.update=u,delete o.value,delete o.on);const l=n.find((e=>e.name===i+RU)),c=Cj(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:c}):l.on[0].events=c),n}};const LU="_translate_anchor",qU="_translate_delta",UU={defined:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Vq.defined(t),o=i+LU,{x:a,y:s}=t.project.hasChannel;let u=ZF(t.translate,"scope");return r||(u=u.map((e=>(e.between[0].markname=i+Jq,e)))),n.push({name:o,value:{},on:[{events:u.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==a?`, extent_x: ${r?Yq(e,YM):`slice(${a.signals.visual})`}`:"")+(void 0!==s?`, extent_y: ${r?Yq(e,XM):`slice(${s.signals.visual})`}`:"")+"}"}]},{name:i+qU,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&IU(e,t,a,"width",n),void 0!==s&&IU(e,t,s,"height",n),n}};function IU(e,t,n,i,r){const o=t.name,a=o+LU,s=o+qU,u=n.channel,l=Vq.defined(t),c=r.find((e=>e.name===n.signals[l?"data":"visual"])),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(u),h=d&&d.get("type"),p=d&&d.get("reverse"),m=`${a}.extent_${u}`,g=`${l&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${m}, ${`${l?u===YM?p?"":"-":p?"-":"":""}${s}.${u} / ${l?`${f}`:`span(${m})`}`}${l?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;c.on.push({events:{signal:s},update:l?g:`clampRange(${g}, 0, ${f})`})}const WU="_zoom_anchor",HU="_zoom_delta",GU={defined:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Vq.defined(t),o=i+HU,{x:a,y:s}=t.project.hasChannel,u=fe(e.scaleName(YM)),l=fe(e.scaleName(XM));let c=ZF(t.zoom,"scope");return r||(c=c.map((e=>(e.markname=i+Jq,e)))),n.push({name:i+WU,on:[{events:c,update:r?"{"+[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&VU(e,t,a,"width",n),void 0!==s&&VU(e,t,s,"height",n),n}};function VU(e,t,n,i,r){const o=t.name,a=n.channel,s=Vq.defined(t),u=r.find((e=>e.name===n.signals[s?"data":"visual"])),l=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(a),f=c&&c.get("type"),d=s?Yq(e,a):u.name,h=o+HU,p=`${s&&c?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${o}${WU}.${a}`}, ${h}${s?"pow"===f?`, ${c.get("exponent")??1}`:"symlog"===f?`, ${c.get("constant")??1}`:"":""})`;u.on.push({events:{signal:h},update:s?p:`clampRange(${p}, 0, ${l})`})}const YU="_store",XU="_tuple",JU="_modify",KU="vlSelectionResolve",QU=[Lq,eU,Sq,TU,NU,Vq,jU,PU,UU,GU,OU];function ZU(e,{escape:t}={escape:!0}){let n=t?fe(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!QG(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of TB)e[t]&&(n+=` + '__facet_${t}_' + (facet[${fe(i.vgField(t))}])`)}return n}function eI(e){return vM(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function tI(e,t){!ie(t.select)&&t.select.on||delete e.events,!ie(t.select)&&t.select.clear||delete e.clear,!ie(t.select)&&t.select.toggle||delete e.toggle}function nI(e){var t;return null==(t=e.events)?void 0:t.find((e=>"type"in e&&"timer"===e.type))}const iI="Property",rI="ArrayExpression",oI="BinaryExpression",aI="CallExpression",sI="ConditionalExpression",uI="LogicalExpression",lI="MemberExpression",cI="ObjectExpression",fI="UnaryExpression";function dI(e){this.type=e}var hI,pI,mI,gI,yI;dI.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=function(e){switch(e.type){case rI:return e.elements;case oI:case uI:return[e.left,e.right];case aI:return[e.callee].concat(e.arguments);case sI:return[e.test,e.consequent,e.alternate];case lI:return[e.object,e.property];case cI:return e.properties;case iI:return[e.key,e.value];case fI:return[e.argument];default:return[]}}(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};(hI={})[1]="Boolean",hI[2]="<end>",hI[3]="Identifier",hI[4]="Keyword",hI[5]="Null",hI[6]="Numeric",hI[7]="Punctuator",hI[8]="String",hI[9]="RegularExpression";var vI="Identifier",bI="Unexpected token %0",xI="Invalid regular expression",wI="Invalid regular expression: missing /",_I="Octal literals are not allowed in strict mode.",AI="ILLEGAL",kI="Disabled.",DI=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]"),FI=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 CI(e,t){if(!e)throw new Error("ASSERT: "+t)}function EI(e){return e>=48&&e<=57}function $I(e){return"0123456789abcdefABCDEF".includes(e)}function SI(e){return"01234567".includes(e)}function MI(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].includes(e)}function BI(e){return 10===e||13===e||8232===e||8233===e}function zI(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&DI.test(String.fromCharCode(e))}function OI(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&FI.test(String.fromCharCode(e))}const NI={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 RI(){for(;mI<gI;){const e=pI.charCodeAt(mI);if(!MI(e)&&!BI(e))break;++mI}}function TI(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)mI<gI&&$I(pI[mI])?(i=pI[mI++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):ZI({},bI,AI);return String.fromCharCode(r)}function PI(){var e,t,n,i;for(t=0,"}"===(e=pI[mI])&&ZI({},bI,AI);mI<gI&&$I(e=pI[mI++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&ZI({},bI,AI),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function jI(){var e,t;for(e=pI.charCodeAt(mI++),t=String.fromCharCode(e),92===e&&(117!==pI.charCodeAt(mI)&&ZI({},bI,AI),++mI,(e=TI("u"))&&"\\"!==e&&zI(e.charCodeAt(0))||ZI({},bI,AI),t=e);mI<gI&&OI(e=pI.charCodeAt(mI));)++mI,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==pI.charCodeAt(mI)&&ZI({},bI,AI),++mI,(e=TI("u"))&&"\\"!==e&&OI(e.charCodeAt(0))||ZI({},bI,AI),t+=e);return t}function LI(){var e,t;return e=mI,t=92===pI.charCodeAt(mI)?jI():function(){var e,t;for(e=mI++;mI<gI;){if(92===(t=pI.charCodeAt(mI)))return mI=e,jI();if(!OI(t))break;++mI}return pI.slice(e,mI)}(),{type:1===t.length?3:NI.hasOwnProperty(t)?4:"null"===t?5:"true"===t||"false"===t?1:3,value:t,start:e,end:mI}}function qI(){var e,t,n,i,r=mI,o=pI.charCodeAt(mI),a=pI[mI];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++mI,{type:7,value:String.fromCharCode(o),start:r,end:mI};default:if(61===(e=pI.charCodeAt(mI+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return mI+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(e),start:r,end:mI};case 33:case 61:return mI+=2,61===pI.charCodeAt(mI)&&++mI,{type:7,value:pI.slice(r,mI),start:r,end:mI}}}return">>>="===(i=pI.substr(mI,4))?{type:7,value:i,start:r,end:mI+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:r,end:mI+=3}:a===(t=n.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===t?{type:7,value:t,start:r,end:mI+=2}:("//"===t&&ZI({},bI,AI),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:r,end:++mI}:void ZI({},bI,AI))}function UI(){var e,t,n;if(CI(EI((n=pI[mI]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=mI,e="","."!==n){if(e=pI[mI++],n=pI[mI],"0"===e){if("x"===n||"X"===n)return++mI,function(e){let t="";for(;mI<gI&&$I(pI[mI]);)t+=pI[mI++];return 0===t.length&&ZI({},bI,AI),zI(pI.charCodeAt(mI))&&ZI({},bI,AI),{type:6,value:parseInt("0x"+t,16),start:e,end:mI}}(t);if(SI(n))return function(e){let t="0"+pI[mI++];for(;mI<gI&&SI(pI[mI]);)t+=pI[mI++];return(zI(pI.charCodeAt(mI))||EI(pI.charCodeAt(mI)))&&ZI({},bI,AI),{type:6,value:parseInt(t,8),octal:!0,start:e,end:mI}}(t);n&&EI(n.charCodeAt(0))&&ZI({},bI,AI)}for(;EI(pI.charCodeAt(mI));)e+=pI[mI++];n=pI[mI]}if("."===n){for(e+=pI[mI++];EI(pI.charCodeAt(mI));)e+=pI[mI++];n=pI[mI]}if("e"===n||"E"===n)if(e+=pI[mI++],"+"!==(n=pI[mI])&&"-"!==n||(e+=pI[mI++]),EI(pI.charCodeAt(mI)))for(;EI(pI.charCodeAt(mI));)e+=pI[mI++];else ZI({},bI,AI);return zI(pI.charCodeAt(mI))&&ZI({},bI,AI),{type:6,value:parseFloat(e),start:t,end:mI}}function II(){var e,t,n,i;return yI=null,RI(),e=mI,t=function(){var e,t,n,i;for(CI("/"===(e=pI[mI]),"Regular expression literal must start with a slash"),t=pI[mI++],n=!1,i=!1;mI<gI;)if(t+=e=pI[mI++],"\\"===e)BI((e=pI[mI++]).charCodeAt(0))&&ZI({},wI),t+=e;else if(BI(e.charCodeAt(0)))ZI({},wI);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||ZI({},wI),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";mI<gI&&OI((e=pI[mI]).charCodeAt(0));)++mI,"\\"===e&&mI<gI?ZI({},bI,AI):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&ZI({},xI,n),{value:n,literal:t}}(),i=function(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((e,t)=>{if(parseInt(t,16)<=1114111)return"x";ZI({},xI)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(i){ZI({},xI)}try{return new RegExp(e,t)}catch(r){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:mI}}function WI(){if(RI(),mI>=gI)return{type:2,start:mI,end:mI};const e=pI.charCodeAt(mI);return zI(e)?LI():40===e||41===e||59===e?qI():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(CI("'"===(e=pI[mI])||'"'===e,"String literal must starts with a quote"),t=mI,++mI;mI<gI;){if((n=pI[mI++])===e){e="";break}if("\\"===n)if((n=pI[mI++])&&BI(n.charCodeAt(0)))"\r"===n&&"\n"===pI[mI]&&++mI;else switch(n){case"u":case"x":"{"===pI[mI]?(++mI,r+=PI()):r+=TI(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:SI(n)?(0!==(i="01234567".indexOf(n))&&(o=!0),mI<gI&&SI(pI[mI])&&(o=!0,i=8*i+"01234567".indexOf(pI[mI++]),"0123".includes(n)&&mI<gI&&SI(pI[mI])&&(i=8*i+"01234567".indexOf(pI[mI++]))),r+=String.fromCharCode(i)):r+=n}else{if(BI(n.charCodeAt(0)))break;r+=n}}return""!==e&&ZI({},bI,AI),{type:8,value:r,octal:o,start:t,end:mI}}():46===e?EI(pI.charCodeAt(mI+1))?UI():qI():EI(e)?UI():qI()}function HI(){const e=yI;return mI=e.end,yI=WI(),mI=e.end,e}function GI(){const e=mI;yI=WI(),mI=e}function VI(e,t,n){const i=new dI("||"===e||"&&"===e?"LogicalExpression":"BinaryExpression");return i.operator=e,i.left=t,i.right=n,i}function YI(e,t){const n=new dI("CallExpression");return n.callee=e,n.arguments=t,n}function XI(e){const t=new dI(vI);return t.name=e,t}function JI(e){const t=new dI("Literal");return t.value=e.value,t.raw=pI.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function KI(e,t,n){const i=new dI("MemberExpression");return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function QI(e,t,n){const i=new dI("Property");return i.key=t,i.value=n,i.kind=e,i}function ZI(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((e,t)=>(CI(t<i.length,"Message reference must be in range"),i[t])));throw(n=new Error(r)).index=mI,n.description=r,n}function eW(e){2===e.type&&ZI(e,"Unexpected end of input"),6===e.type&&ZI(e,"Unexpected number"),8===e.type&&ZI(e,"Unexpected string"),3===e.type&&ZI(e,"Unexpected identifier"),4===e.type&&ZI(e,"Unexpected reserved word"),ZI(e,bI,e.value)}function tW(e){const t=HI();7===t.type&&t.value===e||eW(t)}function nW(e){return 7===yI.type&&yI.value===e}function iW(e){return 4===yI.type&&yI.value===e}function rW(){const e=[];for(mI=yI.start,tW("[");!nW("]");)nW(",")?(HI(),e.push(null)):(e.push(gW()),nW("]")||tW(","));return HI(),function(e){const t=new dI("ArrayExpression");return t.elements=e,t}(e)}function oW(){mI=yI.start;const e=HI();return 8===e.type||6===e.type?(e.octal&&ZI(e,_I),JI(e)):XI(e.value)}function aW(){var e,t,n;return mI=yI.start,3===(e=yI).type?(n=oW(),tW(":"),QI("init",n,gW())):2!==e.type&&7!==e.type?(t=oW(),tW(":"),QI("init",t,gW())):void eW(e)}function sW(){var e,t,n=[],i={},r=String;for(mI=yI.start,tW("{");!nW("}");)t="$"+((e=aW()).key.type===vI?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?ZI({},"Duplicate data property in object literal not allowed in strict mode"):i[t]=!0,n.push(e),nW("}")||tW(",");return tW("}"),function(e){const t=new dI("ObjectExpression");return t.properties=e,t}(n)}const uW={if:1};function lW(){var e,t,n;if(nW("("))return function(){tW("(");const e=yW();return tW(")"),e}();if(nW("["))return rW();if(nW("{"))return sW();if(e=yI.type,mI=yI.start,3===e||uW[yI.value])n=XI(HI().value);else if(8===e||6===e)yI.octal&&ZI(yI,_I),n=JI(HI());else{if(4===e)throw new Error(kI);1===e?((t=HI()).value="true"===t.value,n=JI(t)):5===e?((t=HI()).value=null,n=JI(t)):nW("/")||nW("/=")?(n=JI(II()),GI()):eW(HI())}return n}function cW(){const e=[];if(tW("("),!nW(")"))for(;mI<gI&&(e.push(gW()),!nW(")"));)tW(",");return tW(")"),e}function fW(){return tW("."),function(){mI=yI.start;const e=HI();return function(e){return 3===e.type||4===e.type||1===e.type||5===e.type}(e)||eW(e),XI(e.value)}()}function dW(){tW("[");const e=yW();return tW("]"),e}function hW(){const e=function(){var e;for(e=lW();;)if(nW("."))e=KI(".",e,fW());else if(nW("("))e=YI(e,cW());else{if(!nW("["))break;e=KI("[",e,dW())}return e}();if(7===yI.type&&(nW("++")||nW("--")))throw new Error(kI);return e}function pW(){var e,t;if(7!==yI.type&&4!==yI.type)t=hW();else{if(nW("++")||nW("--"))throw new Error(kI);if(nW("+")||nW("-")||nW("~")||nW("!"))e=HI(),t=pW(),t=function(e,t){const n=new dI("UnaryExpression");return n.operator=e,n.argument=t,n.prefix=!0,n}(e.value,t);else{if(iW("delete")||iW("void")||iW("typeof"))throw new Error(kI);t=hW()}}return t}function mW(e){let t=0;if(7!==e.type&&4!==e.type)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function gW(){var e,t;return e=function(){var e,t,n,i,r,o,a,s,u,l;if(e=yI,u=pW(),0===(r=mW(i=yI)))return u;for(i.prec=r,HI(),t=[e,yI],o=[u,i,a=pW()];(r=mW(yI))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),t.pop(),n=VI(s,u,a),o.push(n);(i=HI()).prec=r,o.push(i),t.push(yI),n=pW(),o.push(n)}for(n=o[l=o.length-1],t.pop();l>1;)t.pop(),n=VI(o[l-1].value,o[l-2],n),l-=2;return n}(),nW("?")&&(HI(),t=gW(),tW(":"),e=function(e,t,n){const i=new dI("ConditionalExpression");return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,gW())),e}function yW(){const e=gW();if(nW(","))throw new Error(kI);return e}function vW(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...vW(e.object)),t.push(...vW(e.property))),t)}function bW(e){return"MemberExpression"===e.object.type?bW(e.object):"datum"===e.object.name}function xW(e){const t=function(e){mI=0,gI=(pI=e).length,yI=null,GI();const t=yW();if(2!==yI.type)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit((e=>{"MemberExpression"===e.type&&bW(e)&&n.add(vW(e).slice(1).join("."))})),n}class wW extends vq{clone(){return new wW(null,this.model,ZS(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=kW(this.model,this.filter,this),this._dependentFields=xW(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function _W(e,t,n,i="datum"){const r=ie(t)?t:t.param,o=wM(r),a=fe(o+YU);let s;try{s=e.getSelectionComponent(o,r)}catch(c){return`!!${o}`}if(s.project.timeUnit){const t=n??e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}const u=`${s.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${i}${"global"===s.resolve?")":`, ${fe(s.resolve)})`}`,l=`length(data(${a}))`;return!1===t.empty?`${l} && ${u}`:`!${l} || ${u}`}function AW(e,t,n){const i=wM(t),r=n.encoding;let o,a=n.field;try{o=e.getSelectionComponent(i,t)}catch(s){return i}if(r||a){if(r&&!a){const e=o.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(a=o.project.items[0].field,gN(function(e,t,n,i){return(e.length?"Multiple ":"No ")+`matching ${fe(t)} encoding found for selection ${fe(n.param)}. Using "field": ${fe(i)}.`}(e,r,n,a))):a=e[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&gN(function(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${fe(e)}.`}(a));return`${o.name}[${fe($M(a))}]`}function kW(e,t,n){return _M(t,(t=>ie(t)?t:function(e){return WM(e,"param")}(t)?_W(e,t,n):YN(t)))}function DW(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function FW(e,t,n,i={header:!1}){var r,o;const{disable:a,orient:s,scale:l,labelExpr:c,title:d,zindex:h,...p}=e.combine();if(!a){for(const e in p){const n=e,i=BP[n],r=p[n];if(i&&i!==t&&"both"!==i)delete p[n];else if(SP(r)){const{condition:e,...t}=r,i=u(e),o=$P[n];if(o){const{vgProp:e,part:r}=o;DW(p,r,e,[...i.map((e=>{const{test:t,...n}=e;return{test:kW(null,t),...n}})),t]),delete p[n]}else if(null===o){const e={signal:i.map((e=>{const{test:t,...n}=e;return`${kW(null,t)} ? ${kO(n)} : `})).join("")+kO(t)};p[n]=e}}else if(pO(r)){const e=$P[n];if(e){const{vgProp:t,part:i}=e;DW(p,i,t,r),delete p[n]}}oM(["labelAlign","labelBaseline"],n)&&null===p[n]&&delete p[n]}if("grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode={...e?{grid:e}:{}},gM(p.encode)&&delete p.encode}return{scale:l,orient:s,...p,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:zM(h,0)}}{if(!i.header&&e.mainExtracted)return;if(void 0!==c){let e=c;(null==(o=null==(r=p.encode)?void 0:r.labels)?void 0:o.update)&&pO(p.encode.labels.update.text)&&(e=SM(c,"datum.label",p.encode.labels.update.text.signal)),DW(p,"labels","text",{signal:e})}if(null===p.labelAlign&&delete p.labelAlign,p.encode){for(const t of MP)e.hasAxisPart(t)||delete p.encode[t];gM(p.encode)&&delete p.encode}const t=function(e,t){if(e)return f(e)&&!hO(e)?e.map((e=>gP(e,t))).join(", "):e}(d,n);return{scale:l,orient:s,grid:!1,...t?{title:t}:{},...p,...!1===n.aria?{aria:!1}:{},zindex:zM(h,0)}}}}function CW(e){const{axes:t}=e.component,n=[];for(const i of _z)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function EW(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...yM(r),...yM(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${DO(r[t])} : ${DO(o[t])}`};return s}return t[e]}))])}function $W(e,t){var n;const i=[{}];for(const r of e){let e=null==(n=t[r])?void 0:n.style;if(e){e=u(e);for(const n of e)i.push(t.style[n])}}return Object.assign.apply(null,i)}function SW(e,t,n,i={}){var r;const o=MO(e,n,t);if(void 0!==o)return{configFrom:"style",configValue:o};for(const a of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==(null==(r=i[a])?void 0:r[e]))return{configFrom:a,configValue:i[a][e]};return{}}const MW={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??function(e,t){return!wR(e)&&XT(t)&&!oO(null==t?void 0:t.bin)&&!aO(null==t?void 0:t.bin)}(n,e),gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||OW(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||zW(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&oM(["quantitative","temporal"],e))return!0;return}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??function(e,t,n,i){if(n&&!ne(i)||"nominal"!==e&&"ordinal"!==e)return"log"!==t&&"symlog"!==t||"greedy";return}(t.type,n,XT(t)&&!!t.timeUnit,XT(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!wR(t)&&"log"!==t){if(XT(e)){if(oO(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&oM(["month","hours","day","quarter"],null==(r=NN(e.timeUnit))?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(XT(t)){const{timeUnit:e}=t;if(e){const t=RN(e);if(t)return{signal:t}}}return},title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=NW(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return zO(r?[LT(r)]:[],XT(a)?[LT(a)]:[])},values:({axis:e,fieldOrDatumDef:t})=>function(e,t){const n=e.values;if(f(n))return CP(t,n);if(pO(n))return n;return}(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){if("rect"===e&&cP(t))return 1;return 0}(n,t)};function BW(e){return`(((${e.signal} % 360) + 360) % 360)`}function zW(e,t,n,i){if(void 0!==e){if("x"===n){if(pO(e)){const n=BW(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${pO(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(pO(t)){const n=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${n} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(pO(e)){const n=BW(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${pO(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(pO(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${n} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function OW(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,o=i?"bottom":"left";if(pO(e)){const n=BW(e);return{signal:`(${r?`(${n} + 90)`:n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${pO(t)?`(${t.signal} === "${o}")`:t===o} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(pO(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${`${t.signal} ${n} "${o}"`} ? "left" : "right"`}}return(r<e&&e<180+r)==(t===o)?"left":"right"}function NW(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,a=r?r.title:void 0;return o&&a?OO(o,a):o||(a||(void 0!==o?o:void 0!==a?a:void 0))}class RW extends vq{clone(){return new RW(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=xW(this.transform.calculate)}static parseAllForSortIndex(e,t){return t.forEachFieldDef(((t,n)=>{if(rP(t)&&RT(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${YN({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new RW(e,{calculate:a,as:TW(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 ${iM(this.transform)}`}}function TW(e,t,n){return lP(e,{prefix:t,suffix:"sort_index",...n})}function PW(e,t){return oM(["top","bottom"],t)?"column":oM(["left","right"],t)||"row"===e?"row":"column"}function jW(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return zM((t||{})[e],r[e],n.header[e])}function LW(e,t,n,i){const r={};for(const o of e){const e=jW(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const qW=["row","column"],UW=["header","footer"];function IW(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:a,titleOrient:s}=LW(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),u=PW(t,s),l=jM(a);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...HW(l,u),...WW(u,l,o),...QW(i,r,t,xj,vj)}}}function WW(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=OW(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function HW(e,t){const n=zW(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function GW(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of UW)if(n[r])for(const o of n[r]){const a=XW(e,t,r,n,o);null!=a&&i.push(a)}return i}function VW(e,t){const{sort:n}=e;return NT(n)?{field:lP(n,{expr:"datum"}),order:n.order??"ascending"}:f(n)?{field:TW(e,t,{expr:"datum"}),order:"ascending"}:{field:lP(e,{expr:"datum"}),order:n??"ascending"}}function YW(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:u}=LW(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=AT({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=PW(t,s);return{text:{signal:u?SM(SM(u,"datum.label",l),"datum.value",lP(e,{expr:"parent"})):l},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...HW(o,c),...WW(c,o,a),...QW(n,e,t,wj,bj)}}function XW(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=LW(["labelOrient"],a.header,s,t);("row"===t&&!oM(["top","bottom"],e)||"column"===t&&!oM(["left","right"],e))&&(o=YW(a,t,s))}const u=QG(e)&&!TT(e.facet),l=r.axes,c=(null==l?void 0:l.length)>0;if(o||c){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:VW(a,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const JW={column:{start:0,end:1},row:{start:1,end:0}};function KW(e,t){return JW[t][e]}function QW(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=jW(a,null==t?void 0:t.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function ZW(e){return[...eH(e,"width"),...eH(e,"height"),...eH(e,"childWidth"),...eH(e,"childHeight")]}function eH(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(wR(i)&&mO(o)){const i=e.scaleName(n);if(QG(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[tH(i,o)]}return[tH(i,o),{name:r,update:nH(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} : ${Tj(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function tH(e,t){const n=`${e}_step`;return pO(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function nH(e,t,n){const i=t.get("type"),r=t.get("padding"),o=zM(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${DO(a)}, ${DO(o)}) * ${e}_step`}function iH(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function rH(e,t){return yM(e).reduce(((n,i)=>({...n,...tU({model:t,channelDef:e[i],vgChannel:i,mainRefFn:e=>AO(e.value),invalidValueRef:void 0})})),{})}function oH(e,t){if(QG(t))return"theta"===e?"independent":"shared";if(eV(t))return"shared";if(ZG(t))return Az(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function aH(e,t){const n=e.scale[t],i=Az(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&gN(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.`}(t)),"independent"):e[i][t]||"shared"}const sH=yM({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class uH extends tq{}const lH={symbols:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:s,config:u,mark:l}=n,c=a.filled&&"trail"!==l;let d={...FO({},n,tT),...fU(n,{filled:c})};const h=r.get("symbolOpacity")??u.legend.symbolOpacity,p=r.get("symbolFillColor")??u.legend.symbolFillColor,m=r.get("symbolStrokeColor")??u.legend.symbolStrokeColor,g=void 0===h?cH(s.opacity)??a.opacity:void 0;if(d.fill)if("fill"===i||c&&i===lB)delete d.fill;else if(WM(d.fill,"field"))p?delete d.fill:(d.fill=AO(u.legend.symbolBaseFillColor??"black"),d.fillOpacity=AO(g??1));else if(f(d.fill)){const e=fH(s.fill??s.color)??a.fill??(c&&a.color);e&&(d.fill=AO(e))}if(d.stroke)if("stroke"===i||!c&&i===lB)delete d.stroke;else if(WM(d.stroke,"field")||m)delete d.stroke;else if(f(d.stroke)){const e=zM(fH(s.stroke||s.color),a.stroke,c?a.color:void 0);e&&(d.stroke={value:e})}if(i!==mB){const e=XT(t)&&hH(n,r,t);e?d.opacity=[{test:e,...AO(g??1)},AO(u.legend.unselectedOpacity)]:g&&(d.opacity=AO(g))}return d={...d,...e},gM(d)?void 0:d},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const u=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?cH(a.opacity)||o.opacity:void 0;u&&(s.opacity=AO(u));return s={...s,...e},gM(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=XT(t)?hH(n,r,t):void 0,u=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=o;let f;wT(c)?f=DT({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:a}):void 0===l&&void 0===c&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=DT({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&XT(t)&&void 0===t.timeUnit&&(f=DT({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return gM(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return(null==n?void 0:n.length)?{...e,fill:{value:"transparent"}}:e}};function cH(e){return dH(e,((e,t)=>Math.max(e,t.value)))}function fH(e){return dH(e,((e,t)=>zM(e,t.value)))}function dH(e,t){return function(e){const t=null==e?void 0:e.condition;return!!t&&(f(t)||iP(t))}(e)?u(e.condition).reduce(t,e.value):iP(e)?e.value:void 0}function hH(e,t,n){const i=t.get("selections");if(!(null==i?void 0:i.length))return;const r=fe(n.field);return i.map((e=>`(!length(data(${fe(wM(e)+YU)})) || (${e}[${r}] && indexof(${e}[${r}], datum.value) >= 0))`)).join(" || ")}const pH={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return FT(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return CT(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:u}=e;if(AR(r))return"horizontal"===n?"top"===i||"bottom"===i?gH(t,"width",a,o):a:gH(t,"height",u,s);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(oM(["quantile","threshold","log","symlog"],e))return"greedy";return}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=fH(n)??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"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>pP(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(NB(n)&&AR(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:t})=>function(e,t){const n=e.values;if(f(n))return CP(t,n);if(pO(n))return n;return}(t,e)};function mH(e){const{legend:t}=e;return zM(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(NB(e)){if(oM(["quarter","month","day"],t))return"symbol";if(AR(n))return"gradient"}return"symbol"}(e))}function gH(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function yH(e){const t=KG(e)?function(e){const{encoding:t}=e,n={};for(const i of[lB,...Aj]){const r=bP(t[i]);r&&e.getScaleComponent(i)&&(i===dB&&XT(r)&&r.type===nR||(n[i]=bH(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){yH(i);for(const r of yM(i.component.legends))n.legend[r]=aH(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=xH(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of yM(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function vH(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!(null==n?void 0:n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function bH(e,t){var n;let i=e.legend(t);const{markDef:r,encoding:o,config:a}=e,s=a.legend,u=new uH({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){var i;const r=null==(i=e.fieldDef(t))?void 0:i.field;for(const o of vM(e.component.selection??{})){const e=o.project.hasField[r]??o.project.hasChannel[t];if(e&&jU.defined(o)){const t=n.get("selections")??[];t.push(o.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,u);const l=void 0!==i?!i:s.disable;if(u.set("disable",l,void 0!==i),l)return u;i=i||{};const c=e.getScaleComponent(t).get("type"),f=bP(o[t]),d=XT(f)?null==(n=NN(f.timeUnit))?void 0:n.unit:void 0,h=i.orient||a.legend.orient||"right",p=mH({legend:i,channel:t,timeUnit:d,scaleType:c}),m=function({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"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}}(n,t)}({legend:i,legendType:p,orient:h,legendConfig:s}),g={legend:i,channel:t,model:e,markDef:r,encoding:o,fieldOrDatumDef:f,legendConfig:s,config:a,scaleType:c,orient:h,legendType:p,direction:m};for(const w of sH){if("gradient"===p&&w.startsWith("symbol")||"symbol"===p&&w.startsWith("gradient"))continue;const n=w in pH?pH[w](g):i[w];if(void 0!==n){const r=vH(n,w,i,e.fieldDef(t));(r||void 0===a.legend[w])&&u.set(w,n,r)}}const y=(null==i?void 0:i.encoding)??{},v=u.get("selections"),b={},x={fieldOrDatumDef:f,model:e,channel:t,legendCmpt:u,legendType:p};for(const w of["labels","legend","title","symbols","gradient","entries"]){const t=rH(y[w]??{},e),n=w in lH?lH[w](t,x):t;void 0===n||gM(n)||(b[w]={...(null==v?void 0:v.length)&&XT(f)?{name:`${wM(f.field)}_legend_${w}`}:{},...(null==v?void 0:v.length)?{interactive:!!v}:{},update:n})}return gM(b)||u.set("encode",b,!!(null==i?void 0:i.encoding)),u}function xH(e,t){var n,i,r,o;if(!e)return t.clone();const a=e.getWithExplicit("orient"),s=t.getWithExplicit("orient");if(a.explicit&&s.explicit&&a.value!==s.value)return;let u=!1;for(const l of sH){const n=aq(e.getWithExplicit(l),t.getWithExplicit(l),l,"legend",((e,t)=>{switch(l){case"symbolType":return wH(e,t);case"title":return NO(e,t);case"type":return u=!0,iq("symbol")}return oq(e,t,l,"legend")}));e.setWithExplicit(l,n)}return u&&((null==(i=null==(n=e.implicit)?void 0:n.encode)?void 0:i.gradient)&&AM(e.implicit,["encode","gradient"]),(null==(o=null==(r=e.explicit)?void 0:r.encode)?void 0:o.gradient)&&AM(e.explicit,["encode","gradient"])),e}function wH(e,t){return"circle"===t.value?t:e}function _H(e){const t=e.component.legends,n={};for(const i of yM(t)){const r=IM(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r]){xH(e,t[i])||n[r].push(t[i])}else n[r]=[t[i].clone()]}return vM(n).flat().map((t=>function(e,t){var n,i,r;const{disable:o,labelExpr:a,selections:s,...u}=e.combine();if(o)return;!1===t.aria&&null==u.aria&&(u.aria=!1);if(null==(n=u.encode)?void 0:n.symbols){const e=u.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||u.stroke||(e.stroke={value:"transparent"});for(const t of Aj)u[t]&&delete e[t]}u.title||delete u.title;if(void 0!==a){let e=a;(null==(r=null==(i=u.encode)?void 0:i.labels)?void 0:r.update)&&pO(u.encode.labels.update.text)&&(e=SM(a,"datum.label",u.encode.labels.update.text.signal)),function(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}(u,"labels","text",{signal:e})}return u}(t,e.config))).filter((e=>void 0!==e))}function AH(e){return eV(e)||ZG(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),kH(e))}(e):kH(e)}function kH(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=pO(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return oM(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const DH=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class FH extends tq{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function CH(e){e.component.projection=KG(e)?function(e){if(e.hasProjection){const t=fO(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[oB,rB],[sB,aB]])(bP(n[i[0]])||bP(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(dB)&&e.typedFieldDef(dB).type===nR&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(mq.Main));return t}(e):void 0,o=new FH(e.projectionName(!0),{...fO(e.config.projection),...t},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}return}(e):function(e){if(0===e.children.length)return;let t;for(const i of e.children)CH(i);const n=sM(e.children,(e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=sM(DH,(n=>!c(e.explicit,n)&&!c(t.explicit,n)||!!(c(e.explicit,n)&&c(t.explicit,n)&&UM(e.get(n),t.get(n)))));if(UM(e.size,t.size)){if(n)return e;if(UM(e.explicit,{}))return t;if(UM(t.explicit,{}))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 FH(n,t.specifiedProjection,t.size,ZS(t.data));for(const t of e.children){const e=t.component.projection;e&&(e.isFit&&i.data.push(...t.component.projection.data),t.renameProjection(e.get("name"),n),e.merged=!0)}return i}return}(e)}function EH(e,t,n,i){if(EP(t,n)){const r=KG(e)?e.axis(n)??e.legend(n)??{}:{},o=lP(t,{expr:"datum"}),a=lP(t,{expr:"datum",binSuffix:"end"});return{formulaAs:lP(t,{binSuffix:"range",forAs:!0}),formula:MT(o,a,r.format,r.formatType,i)}}return{}}function $H(e,t){return`${rO(e)}_${t}`}function SH(e,t,n){const i=$H(AP(n,void 0)??{},t);return e.getName(`${i}_bins`)}function MH(e,t,n){let i,r;i=function(e){return"as"in e}(e)?ie(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[lP(e,{forAs:!0}),lP(e,{binSuffix:"end",forAs:!0})];const o={...AP(t,void 0)},a=$H(o,e.field),{signal:s,extentSignal:u}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,a);if(uO(o.extent)){const e=o.extent;r=AW(n,e.param,e),delete o.extent}return{key:a,binComponent:{bin:o,field:e.field,as:[i],...s?{signal:s}:{},...u?{extentSignal:u}:{},...r?{span:r}:{}}}}class BH extends vq{clone(){return new BH(null,ZS(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(nP(n)&&oO(n.bin)){const{key:r,binComponent:o}=MH(n,n.bin,t);e[r]={...o,...e[r],...EH(t,n,i,t.config)}}return e}),{});return gM(n)?null:new BH(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=MH(t,t.bin,n);return new BH(e,{[i]:r})}merge(e,t){for(const n of yM(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=cM([...this.bins[n].as,...e.bins[n].as],iM)):this.bins[n]=e.bins[n];for(const n of e.children)e.removeChild(n),n.parent=this;e.remove()}producedFields(){return new Set(vM(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(vM(this.bins).map((e=>e.field)))}hash(){return`Bin ${iM(this.bins)}`}assemble(){return vM(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:$M(e.field),as:n,signal:e.signal,...uO(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:$M(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const s of i)for(let e=0;e<2;e++)t.push({type:"formula",expr:lP({field:n[e]},{expr:"datum"}),as:s[e]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function zH(e,t,n,i){var r;const o=KG(i)?i.encoding[ZB(t)]:void 0;if(nP(n)&&KG(i)&&WT(n,o,i.markDef,i.config)){e.add(lP(n,{})),e.add(lP(n,{suffix:"end"}));const{mark:r,markDef:o,config:a}=i,s=UT({fieldDef:n,markDef:o,config:a});QR(r)&&.5!==s&&Az(t)&&(e.add(lP(n,{suffix:Aq})),e.add(lP(n,{suffix:kq}))),n.bin&&EP(n,t)&&e.add(lP(n,{binSuffix:"range"}))}else if(BB(t)){const n=MB(t);e.add(i.getName(n))}else e.add(lP(n));var a;return rP(n)&&(a=null==(r=n.scale)?void 0:r.range,ne(a)&&"field"in a)&&e.add(n.scale.range.field),e}class OH extends vq{clone(){return new OH(null,new Set(this.dimensions),ZS(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}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)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??(i["*"]={}),i["*"].count=new Set([lP(e,{forAs:!0})]);else{if(Kz(o)||Qz(o)){const e=Kz(o)?"argmin":"argmax",t=o[e];i[t]??(i[t]={}),i[t][e]=new Set([lP({op:e,field:t},{forAs:!0})])}else i[a]??(i[a]={}),i[a][o]=new Set([lP(e,{forAs:!0})]);Iz(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??(i[a]={}),i[a].min=new Set([lP({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([lP({field:a,aggregate:"max"},{forAs:!0})]))}else zH(r,n,e,t)})),r.size+yM(i).length===0?null:new OH(e,r,i)):null}static makeFromTransform(e,t){var n;const i=new Set,r={};for(const o of t.aggregate){const{op:e,field:t,as:i}=o;e&&("count"===e?(r["*"]??(r["*"]={}),r["*"].count=new Set([i||lP(o,{forAs:!0})])):(r[t]??(r[t]={}),(n=r[t])[e]??(n[e]=new Set),r[t][e].add(i||lP(o,{forAs:!0}))))}for(const o of t.groupby??[])i.add(o);return i.size+yM(r).length===0?null:new OH(e,i,r)}merge(e){return dM(this.dimensions,e.dimensions)?(function(e,t){for(const n of yM(t)){const i=t[n];for(const t of yM(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){pN.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...yM(this.measures)])}producedFields(){const e=new Set;for(const t of yM(this.measures))for(const n of yM(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 ${iM({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of yM(this.measures))for(const r of yM(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:$M(i));return{type:"aggregate",groupby:[...this.dimensions].map($M),ops:e,fields:t,as:n}}}class NH extends vq{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const r of TB){const e=t.facet[r];if(e){const{bin:n,sort:i}=e;this[r]={name:t.getName(`${r}_domain`),fields:[lP(e),...oO(n)?[lP(e,{binSuffix:"end"})]:[]],...NT(i)?{sortField:i}:f(i)?{sortIndexField:TW(e,r)}:{}}}}this.childModel=t.child}hash(){let e="Facet";for(const t of TB)this[t]&&(e+=` ${t.charAt(0)}:${iM(this[t])}`);return e}get fields(){var e;const t=[];for(const n of TB)(null==(e=this[n])?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of TB)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 _z){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(wR(i)&&mO(r)){const n=EG($G(this.childModel,t));n?e[t]=n:gN(qO(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:u}=this[e];if(s){const{op:e=BT,field:t}=s;r.push(t),o.push(e),a.push(lP(s,{forAs:!0}))}else u&&(r.push(u),o.push("max"),a.push(u));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){var t;const{columns:n}=this.model.layout,{layoutHeaders:i}=this.model.component,r=[],o={};for(const u of qW){for(const e of UW){const n=(i[u]&&i[u][e])??[];for(const e of n)if((null==(t=e.axes)?void 0:t.length)>0){o[u]=!0;break}}if(o[u]){const e=`length(data("${this.facet.name}"))`,t="row"===u?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e};r.push({name:`${this.facet.name}_${u}`,transform:[{type:"sequence",start:0,stop:t}]})}}const{row:a,column:s}=o;return(a||s)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,e)),r}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const a of[GM,HM])this[a]&&e.push(this.assembleRowColumnHeaderData(a,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function RH(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function TH(e){const t={};return KS(e.filter,(e=>{if(GN(e)){let n=null;jN(e)?n=wO(e.equal):qN(e)?n=wO(e.lte):LN(e)?n=wO(e.lt):UN(e)?n=wO(e.gt):IN(e)?n=wO(e.gte):WN(e)?n=e.range[0]:HN(e)&&(n=(e.oneOf??e.in)[0]),n&&(yN(n)?t[e.field]="date":te(n)?t[e.field]="number":ie(n)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}})),t}function PH(e){const t={};function n(e){var n;DP(e)?t[e.field]="date":"quantitative"===e.type&&(n=e.aggregate,ie(n)&&oM(["min","max"],n))?t[e.field]="number":BM(e.field)>1?e.field in t||(t[e.field]="flatten"):rP(e)&&NT(e.sort)&&BM(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((KG(e)||QG(e))&&e.forEachFieldDef(((t,i)=>{if(nP(t))n(t);else{const r=KB(i),o=e.fieldDef(r);n({...t,type:o.type})}})),KG(e)){const{mark:n,markDef:i,encoding:r}=e;if(KR(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];XT(e)&&"quantitative"===e.type&&!(e.field in t)&&(t[e.field]="number")}}return t}class jH extends vq{clone(){return new jH(null,ZS(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${iM(this._parse)}`}static makeExplicit(e,t,n){var i;let r={};const o=t.data;return!fq(o)&&(null==(i=null==o?void 0:o.format)?void 0:i.parse)&&(r=o.format.parse),this.makeWithAncestors(e,r,{},n)}static makeWithAncestors(e,t,n,i){for(const a of yM(n)){const e=i.getWithExplicit(a);void 0!==e.value&&(e.explicit||e.value===n[a]||"derived"===e.value||"flatten"===n[a]?delete n[a]:gN(YO(a,n[a],e.value)))}for(const a of yM(t)){const e=i.get(a);void 0!==e&&(e===t[a]?delete t[a]:gN(YO(a,t[a],e)))}const r=new tq(t,n);i.copyAll(r);const o={};for(const a of yM(r.combine())){const e=r.get(a);null!==e&&(o[a]=e)}return 0===yM(o).length||i.parseNothing?null:new jH(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of yM(this._parse)){const n=this._parse[t];1===BM(t)&&(e[t]=n)}return e}producedFields(){return new Set(yM(this._parse))}dependentFields(){return new Set(yM(this._parse))}assembleTransforms(e=!1){return yM(this._parse).filter((t=>!e||BM(t)>1)).map((e=>{const t=function(e,t){const n=DM(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(t.startsWith("date:"))return`timeParse(${n},'${RH(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${RH(t.slice(4,t.length))}')`;return gN(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:MM(e)}})).filter((e=>null!==e))}}class LH extends vq{clone(){return new LH(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([kj])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:kj}}}class qH extends vq{clone(){return new qH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${iM(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class UH extends vq{clone(){return new UH(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${iM(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class IH extends vq{constructor(e){let t;if(super(null),e??(e={name:"source"}),fq(e)||(t=e.format?{...nM(e.format,["parse"])}:{}),lq(e))this._data={values:e.values};else if(uq(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];oM(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else hq(e)?this._data={values:[{type:"Sphere"}]}:(cq(e)||fq(e))&&(this._data={});this._generator=fq(e),e.name&&(this._name=e.name),t&&!gM(t)&&(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{name:this._name,...this._data,transform:[]}}}var WH,HH=function(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n};function GH(e){return e instanceof IH||e instanceof qH||e instanceof UH}class VH{constructor(){WH.set(this,void 0),HH(this,WH,!1,"f")}setModified(){HH(this,WH,!0,"f")}get modifiedFlag(){return function(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}(this,WH,"f")}}WH=new WeakMap;class YH extends VH{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const n of t)this.run(n[0]);return this.modifiedFlag}}class XH extends VH{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class JH extends XH{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;i<t.length;i++)void 0===n[t[i]]?n[t[i]]=[e.children[i]]:n[t[i]].push(e.children[i]);for(const i of yM(n))n[i].length>1&&(this.setModified(),this.mergeNodes(e,n[i]))}}class KH extends XH{constructor(e){super(),this.requiresSelectionId=e&&eI(e)}run(e){e instanceof LH&&(this.requiresSelectionId&&(GH(e.parent)||e.parent instanceof OH||e.parent instanceof jH)||(this.setModified(),e.remove()))}}class QH extends VH{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof _q&&(n=e.producedFields(),hM(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class ZH extends XH{constructor(){super()}run(e){e instanceof bq&&!e.isRequired()&&(this.setModified(),e.remove())}}class eG extends YH{run(e){if(!(GH(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof jH)if(e instanceof jH)this.setModified(),e.merge(t);else{if(mM(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class tG extends YH{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof jH));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of yM(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!gM(i)){this.setModified();const n=new jH(e,i);for(const r of t){if(r instanceof jH)for(const e of yM(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof jH&&0===yM(r.parse).length&&r.remove()}}}}}class nG extends YH{run(e){e instanceof bq||e.numChildren()>0||e instanceof NH||e instanceof IH||(this.setModified(),e.remove())}}class iG extends YH{run(e){const t=e.children.filter((e=>e instanceof _q)),n=t.pop();for(const i of t)this.setModified(),n.merge(i)}}class rG extends YH{run(e){const t=e.children.filter((e=>e instanceof OH)),n={};for(const i of t){const e=iM(i.groupBy);e in n||(n[e]=[]),n[e].push(i)}for(const i of yM(n)){const t=n[i];if(t.length>1){const n=t.pop();for(const i of t)n.merge(i)&&(e.removeChild(i),i.parent=n,i.remove(),this.setModified())}}}}class oG extends YH{constructor(e){super(),this.model=e}run(e){const t=!(GH(e)||e instanceof wW||e instanceof jH||e instanceof LH),n=[],i=[];for(const r of e.children)r instanceof BH&&(t&&!mM(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof BH?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class aG extends YH{run(e){const t=[...e.children];if(!aM(t,(e=>e instanceof bq))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof bq){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof bq))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class sG extends vq{clone(){return new sG(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=cM(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??lP(e)}hash(){return`JoinAggregateTransform ${iM(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const r of this.transform.joinaggregate)t.push(r.op),n.push(this.getDefaultName(r)),e.push(void 0===r.field?null:r.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class uG extends vq{clone(){return new uG(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t,n){const{config:i,markDef:r}=t,{marks:o,scales:a}=n;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const s=t.reduceFieldDef(((e,n,o)=>{const a=Iz(o)&&t.getScaleComponent(o);if(a){const t=a.get("type"),{aggregate:s}=n,u=dT({scaleChannel:o,markDef:r,config:i,scaleType:t,isCountAggregate:tO(s)});"show"!==u&&"always-valid"!==u&&(e[n.field]=n)}return e}),{});return yM(s).length?new uG(e,s):null}dependentFields(){return new Set(yM(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${iM(this.filter)}`}assemble(){const e=yM(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=lP(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (${lG(i)}))`):"quantitative"===n.type&&e.push(lG(i))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}function lG(e){return`isValid(${e}) && isFinite(+${e})`}class cG extends vq{clone(){return new cG(null,ZS(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:o="zero"}=t,a=[],s=[];if(void 0!==t.sort)for(const c of t.sort)a.push(c.field),s.push(zM(c.order,"ascending"));const u={field:a,order:s};let l;return l=function(e){return f(e)&&e.every((e=>ie(e)))&&e.length>1}(r)?r:ie(r)?[r,`${r}_end`]:[`${t.stack}_start`,`${t.stack}_end`],new cG(e,{dimensionFieldDefs:[],stackField:n,groupby:i,offset:o,sort:u,facetby:[],as:l})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;const{groupbyChannels:r,fieldChannel:o,offset:a,impute:s}=n,u=r.map((e=>vP(i[e]))).filter((e=>!!e)),l=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=lP(t.fieldDef);return n&&e.push(n),e}),[])}(t),c=t.encoding.order;let d;if(f(c)||XT(c))d=BO(c);else{const e=HT(c)?c.sort:"y"===o?"descending":"ascending";d=l.reduce(((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t)),{field:[],order:[]})}return new cG(e,{dimensionFieldDefs:u,stackField:t.vgField(o),facetby:[],stackby:l,sort:d,offset:a,impute:s,as:[t.vgField(o,{suffix:"start",forAs:!0}),t.vgField(o,{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(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${iM(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[lP(e,{binSuffix:"mid"})]:[lP(e,{}),lP(e,{binSuffix:"end"})]:[lP(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:u}=this._stack;if(s)for(const l of n){const{bandPosition:n=.5,bin:o}=l;if(o){const t=lP(l,{expr:"datum"}),i=lP(l,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${lG(t)} ? ${n}*${t}+${1-n}*${i} : ${t}`,as:lP(l,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:lP(l,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:u,offset:a}),e}}class fG extends vq{clone(){return new fG(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=cM(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??lP(e)}hash(){return`WindowTransform ${iM(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const c of this.transform.window)t.push(c.op),n.push(this.getDefaultName(c)),i.push(void 0===c.param?null:c.param),e.push(void 0===c.field?null:c.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>Zz(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const c of this.transform.sort)a.push(c.field),s.push(c.order??"ascending");const u={field:a,order:s},l=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:u,...void 0!==l?{ignorePeers:l}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function dG(e){if(e instanceof NH)if(1!==e.numChildren()||e.children[0]instanceof bq){const n=e.model.component.data.main;hG(n);const i=(t=e,function e(n){if(!(n instanceof NH)){const i=n.clone();if(i instanceof bq){const e=pG+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof OH||i instanceof cG||i instanceof fG||i instanceof sG)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[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 OH||t instanceof cG||t instanceof fG||t instanceof sG)&&t.addDimensions(e.fields),t.swapWithParent(),dG(e)}else e.children.map(dG);var t}function hG(e){if(e instanceof bq&&e.type===mq.Main&&1===e.numChildren()){const t=e.children[0];t instanceof NH||(t.swapWithParent(),hG(e))}}const pG="scale_";function mG(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!mG(t.children))return!1}return!0}function gG(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function yG(e,t,n){let i=e.sources,r=!1;return r=gG(new ZH,i)||r,r=gG(new KH(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=gG(new nG,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=gG(new eG,i)||r,r=gG(new oG(t),i)||r,r=gG(new QH,i)||r,r=gG(new tG,i)||r,r=gG(new rG,i)||r,r=gG(new iG,i)||r,r=gG(new JH,i)||r,r=gG(new aG,i)||r),e.sources=i,r}class vG{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new vG((()=>e(t)))}}function bG(e){KG(e)?function(e){const t=e.component.scales;for(const n of yM(t)){const i=xG(e,n);if(t[n].setWithExplicit("domains",i),kG(e,n),e.component.data.isFaceted){let t=e;for(;!QG(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)gO(e)&&(e.data=pG+e.data.replace(pG,""))}}}(e):function(e){for(const n of e.children)bG(n);const t=e.component.scales;for(const n of yM(t)){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"):aq(i,e.getWithExplicit("domains"),"domains","scale",FG);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&gN(HO),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function xG(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=DG(t,n);if(!e)return void gN(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=DG(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&bP(i.x2)?bP(i.x)?aq(_G(n,r,e,"x"),_G(n,r,e,"x2"),"domain","scale",FG):_G(n,r,e,"x2"):"y"===t&&bP(i.y2)?bP(i.y)?aq(_G(n,r,e,"y"),_G(n,r,e,"y2"),"domain","scale",FG):_G(n,r,e,"y2"):_G(n,r,e,t)}function wG(e,t,n){var i;const r=null==(i=NN(n))?void 0:i.unit;return"temporal"===t||r?function(e,t,n){return e.map((e=>({signal:`{data: ${FP(e,{timeUnit:n,type:t})}}`})))}(e,t,r):[e]}function _G(e,t,n,i){const{encoding:r,markDef:o,mark:a,config:s,stack:u}=n,l=bP(r[i]),{type:c}=l,f=l.timeUnit,d=function(e){const{marks:t,scales:n}=yq(e);return t===n?mq.Main:"include-invalid-values"===n?mq.PreFilterInvalid:mq.PostFilterInvalid}({invalid:$O("invalid",o,s),isPath:KR(a)});if(function(e){return WM(e,"unionWith")}(t)){const r=_G(e,void 0,n,i);return nq([...wG(t.unionWith,c,f),...r.value])}if(pO(t))return nq([t]);if(t&&"unaggregated"!==t&&!DR(t))return nq(wG(t,c,f));if(u&&i===u.fieldChannel){if("normalize"===u.offset)return iq([[0,1]]);const e=n.requestDataName(d);return iq([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const h=Iz(i)&&XT(l)?function(e,t,n){if(!wR(n))return;const i=e.fieldDef(t),r=i.sort;if(RT(r))return{op:"min",field:TW(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(NT(r)){return AG(r,o&&!a.has(r.field))}if(function(e){return WM(e,"encoding")}(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:u}=i,l=o&&!a.has(u);if(Kz(s)||Qz(s))return AG({field:lP(i),order:n},l);if(Zz(s)||!s)return AG({op:s,field:u,order:n},l)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(oM(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if(KT(l)){return iq(wG([l.datum],c,f))}const p=l;if("unaggregated"===t){const{field:e}=l;return iq([{data:n.requestDataName(d),field:lP({field:e,aggregate:"min"})},{data:n.requestDataName(d),field:lP({field:e,aggregate:"max"})}])}if(oO(p.bin)){if(wR(e))return iq("bin-ordinal"===e?[]:[{data:xM(h)?n.requestDataName(d):n.requestDataName(mq.Raw),field:n.vgField(i,EP(p,i)?{binSuffix:"range"}:{}),sort:!0!==h&&ne(h)?h:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=p;if(oO(e)){const t=SH(n,p.field,e);return iq([new vG((()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return iq([{data:n.requestDataName(d),field:n.vgField(i,{})}])}}if(p.timeUnit&&oM(["time","utc"],e)){const e=r[ZB(i)];if(WT(p,e,o,s)){const t=n.requestDataName(d),r=UT({fieldDef:p,fieldDef2:e,markDef:o,config:s}),u=QR(a)&&.5!==r&&Az(i);return iq([{data:t,field:n.vgField(i,u?{suffix:Aq}:{})},{data:t,field:n.vgField(i,{suffix:u?kq:"end"})}])}}return iq(h?[{data:xM(h)?n.requestDataName(d):n.requestDataName(mq.Raw),field:n.vgField(i),sort:h}]:[{data:n.requestDataName(d),field:n.vgField(i)}])}function AG(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":BT),...i?{field:$M(i)}:{},...r?{order:r}:{}}}function kG(e,t){var n;const i=e.component.scales[t],r=e.specifiedScales[t].domain,o=null==(n=e.fieldDef(t))?void 0:n.bin,a=DR(r)?r:void 0,s=sO(o)&&uO(o.extent)?o.extent:void 0;(a||s)&&i.set("selectionExtent",a??s,!0)}function DG(e,t){const{aggregate:n,type:i}=e;return n?ie(n)&&!iO.has(n)?{valid:!1,reason:oN(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:aN(e)}:{valid:!0}:{valid:!1,reason:rN(e)}}function FG(e,t,n,i){return e.explicit&&t.explicit&&gN(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${IM(n)} and ${IM(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function CG(e){const t=cM(e.map((e=>{if(gO(e)){const{sort:t,...n}=e;return n}return e})),iM),n=cM(e.map((e=>{if(gO(e)){const t=e.sort;return void 0===t||xM(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),iM);if(0===t.length)return;if(1===t.length){const t=e[0];if(gO(t)&&n.length>0){let e=n[0];if(n.length>1){gN(lN);const t=n.filter((e=>ne(e)&&"op"in e&&"min"!==e.op));e=!n.every((e=>ne(e)&&"op"in e))||1!==t.length||t[0]}else if(ne(e)&&"field"in e){const n=e.field;t.field===n&&(e=!e.order||{order:e.order})}return{...t,sort:e}}return t}const i=cM(n.map((e=>xM(e)||!("op"in e)||ie(e.op)&&c(Jz,e.op)?e:(gN(function(e){return`Dropping sort property ${IM(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),iM);let r;1===i.length?r=i[0]:i.length>1&&(gN(lN),r=!0);const o=cM(e.map((e=>gO(e)?e.data:null)),(e=>e));if(1===o.length&&null!==o[0]){return{data:o[0],fields:t.map((e=>e.field)),...r?{sort:r}:{}}}return{fields:t,...r?{sort:r}:{}}}function EG(e){if(gO(e)&&ie(e.field))return e.field;if(function(e){return!f(e)&&WM(e,"fields")&&!WM(e,"data")}(e)){let t;for(const n of e.fields)if(gO(n)&&ie(n.field))if(t){if(t!==n.field)return gN("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 gN("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),t}if(function(e){return!f(e)&&WM(e,"fields")&&WM(e,"data")}(e)){gN("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 ie(t)?t:void 0}}function $G(e,t){return CG(e.component.scales[t].get("domains").map((t=>(gO(t)&&(t.data=e.lookupDataSource(t.data)),t))))}function SG(e){return eV(e)||ZG(e)?e.children.reduce(((e,t)=>e.concat(SG(t))),MG(e)):MG(e)}function MG(e){return yM(e.component.scales).reduce(((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:a,selectionExtent:s,domains:u,range:l,reverse:c,...d}=r,h=function(e,t,n,i){if(Az(n)){if(mO(e))return{step:{signal:`${t}_step`}}}else if(ne(e)&&gO(e))return{...e,data:i.lookupDataSource(e.data)};return e}(r.range,o,n,e),p=$G(e,n),m=s?function(e,t,n,i){const r=AW(e,t.param,t);return{signal:_R(n.get("type"))&&f(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}(e,s,i,p):null;return t.push({name:o,type:a,...p?{domain:p}:{},...m?{domainRaw:m}:{},range:h,...void 0!==c?{reverse:c}:{},...d}),t}),[])}class BG extends tq{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainHasZero(){const e=this.get("type");if(oM([rR,sR,uR],e))return"definitely-not";const t=this.get("zero");if(!0===t||void 0===t&&oM([iR,aR,oR],e))return"definitely";const n=this.get("domains");if(n.length>0){let e=!1,t=!1,i=!1;for(const r of n){if(f(r)){const n=r[0],i=r[r.length-1];if(te(n)&&te(i)){if(n<=0&&i>=0){e=!0;continue}t=!0;continue}}i=!0}if(e)return"definitely";if(t&&!i)return"definitely-not"}return"maybe"}}const zG=["range","scheme"];function OG(e,t){const n=e.fieldDef(t);if(null==n?void 0:n.bin){const{bin:i,field:r}=n,o=ez(t),a=e.getName(o);if(ne(i)&&i.binned&&void 0!==i.step)return new vG((()=>{const n=e.scaleName(t),r=`(domain("${n}")[1] - domain("${n}")[0]) / ${i.step}`;return`${e.getSignalName(a)} / (${r})`}));if(oO(i)){const t=SH(e,r,i);return new vG((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(a)} / (${i})`}))}}}function NG(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const c of zG)if(void 0!==n[c]){const i=OR(r,c),o=NR(e,c);if(i)if(o)gN(o);else switch(c){case"range":{const i=n.range;if(f(i)){if(Az(e))return nq(i.map((e=>{if("width"===e||"height"===e){const n=t.getName(e),i=t.getSignalName.bind(t);return vG.fromName(i,n)}return e})))}else if(ne(i))return nq({data:t.requestDataName(mq.Main),field:i.field,sort:{op:"min",field:t.vgField(e)}});return nq(i)}case"scheme":return nq(RG(n[c]))}else gN(sN(r,c,e))}const o=e===YM||"xOffset"===e?"width":"height",a=i[o];if(Oj(a))if(Az(e))if(wR(r)){const n=PG(a,t,e);if(n)return nq({step:n})}else gN(uN(o));else if(Ez(e)){const n=e===QM?"x":"y";if("band"===t.getScaleComponent(n).get("type")){const e=jG(a,r);if(e)return nq(e)}}const{rangeMin:s,rangeMax:u}=n,l=function(e,t){const{size:n,config:i,mark:r,encoding:o}=t,{type:a}=bP(o[e]),s=t.getScaleComponent(e),u=s.get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case YM:case XM:if(oM(["point","band"],u)){const r=LG(e,n,i.view);if(Oj(r)){return{step:PG(r,t,e)}}}return TG(e,t,u);case QM:case ZM:return function(e,t,n){const i=e===QM?"x":"y",r=t.getScaleComponent(i);if(!r)return TG(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:u}=t;if("band"===o){const e=LG(i,t.size,t.config.view);if(Oj(e)){const t=jG(e,n);if(t)return t}return[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(XT(n)&&n.timeUnit){const e=RN(n.timeUnit,(e=>`scale('${a}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=UT({fieldDef:n,markDef:s,config:u})-.5,o=0!==r?` + ${r}`:"";if(i){return[{signal:`${pO(i)?`${i.signal}/2`+o:`${i/2+r}`} * (${e})`},{signal:`${pO(i)?`(1 - ${i.signal}/2)`+o:`${1-i/2+r}`} * (${e})`}]}return[0,{signal:e}]}return eM(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,t,u);case hB:{const o=function(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(eN("size",e))}(r,i),a=function(e,t,n,i){const r={x:OG(n,"x"),y:OG(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=UG(t,r,i.view);return te(e)?e-1:new vG((()=>`${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=UG(t,r,i.view);return te(e)?Math.pow(qG*e,2):new vG((()=>`pow(${qG} * ${e.signal}, 2)`))}}throw new Error(eN("size",e))}(r,n,t,i);return kR(u)?function(e,t,n){const i=()=>{const i=DO(t),r=DO(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return pO(t)?new vG(i):{signal:i()}}(o,a,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&&f(n)?n.length+1:(gN(function(e){return`Domain for ${e} is required for threshold scale.`}(i)),3)}}(u,i,l,e)):[o,a]}case nB:return[0,2*Math.PI];case pB:return[0,360];case eB:return[0,new vG((()=>`min(${t.getSignalName(QG(t.parent)?"child_width":"width")},${t.getSignalName(QG(t.parent)?"child_height":"height")})/2`))];case uB:return{step:1e3/i.scale.framesPerSecond};case vB:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case bB:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case dB:return"symbol";case lB:case cB:case fB:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==c?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case mB:case gB:case yB:return[i.scale.minOpacity,i.scale.maxOpacity]}}(e,t);return(void 0!==s||void 0!==u)&&OR(r,"rangeMin")&&f(l)&&2===l.length?nq([s??l[0],u??l[1]]):iq(l)}function RG(e){return function(e){return!ie(e)&&WM(e,"name")}(e)?{scheme:e.name,...nM(e,["name"])}:{scheme:e}}function TG(e,t,n,{center:i}={}){const r=ez(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===XM&&_R(n)?i?[vG.fromName((e=>`${a(e)}/2`),o),vG.fromName((e=>`-${a(e)}/2`),o)]:[vG.fromName(a,o),0]:i?[vG.fromName((e=>`-${a(e)}/2`),o),vG.fromName((e=>`${a(e)}/2`),o)]:[0,vG.fromName(a,o)]}function PG(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=nz(n),a=i[o];if("offset"===zj({step:e,offsetIsDiscrete:tP(a)&&KN(a.type)})&&LP(i,o)){const n=t.getScaleComponent(o);let i=`domain('${t.scaleName(o)}').length`;if("band"===n.get("type")){i=`bandspace(${i}, ${n.get("paddingInner")??n.get("padding")??0}, ${n.get("paddingOuter")??n.get("padding")??0})`}const a=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${i} / (1-${s=a,pO(s)?s.signal:fe(s)})`}}return e.step;var s}function jG(e,t){if("offset"===zj({step:e,offsetIsDiscrete:wR(t)}))return{step:e.step}}function LG(e,t,n){const i=e===YM?"width":"height",r=t[i];return r||jj(n,i)}const qG=.95;function UG(e,t,n){const i=Oj(e.width)?e.width.step:Pj(n,"width"),r=Oj(e.height)?e.height.step:Pj(n,"height");return t.x||t.y?new vG((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function IG(e,t){KG(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of yM(n)){const u=a[s],l=n[s],c=e.getScaleComponent(s),f=bP(r[s]),d=u[t],h=c.get("type"),p=c.get("padding"),m=c.get("paddingInner"),g=OR(h,t),y=NR(s,t);if(void 0!==d&&(g?y&&gN(y):gN(sN(h,t,s))),g&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":yN(u[t])||"temporal"===n||e?l.set(t,{signal:FP(u[t],{type:n,timeUnit:e})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const n=WM(WG,t)?WG[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:h,scalePadding:p,scalePaddingInner:m,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:o,config:i,hasNestedOffsetScale:qP(r,s),hasSecondaryRangeChannel:!!r[ZB(s)]}):i.scale[t];void 0!==n&&l.set(t,n,!1)}}}(e,t):GG(e,t)}const WG={bins:({model:e,fieldOrDatumDef:t})=>XT(t)?function(e,t){const n=t.bin;if(oO(n)){const i=SH(e,t.field,n);return new vG((()=>e.getSignalName(i)))}if(aO(n)&&sO(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(oM([lB,cB,fB],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>function(e,t,n,i,r,o){var a;if((null==(a=vP(o))?void 0:a.bin)||f(n)||null!=r||null!=i||oM([sR,uR],e))return;return!!Az(t)||void 0}(e,t,n,i,r,o),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(Az(e)){if(AR(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!XT(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===lR)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(Az(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:s}=r;return o?s:zM(e,"bar"===n?t:"tick"===n?a:i)}if(Ez(t)&&i===cR)return r.offsetBandPaddingInner;return}(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(Az(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===cR)return zM(e,pO(i)?{signal:`${i.signal}/2`}:i/2)}else if(Ez(t)){if(n===lR)return.5;if(n===cR)return r.offsetBandPaddingOuter}return}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return _R(e)&&"descending"===t?pO(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(_R(e)&&"descending"===t)return!0;return}(t,XT(e)?e.sort:void 0,n,i.scale),zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:o,hasSecondaryRangeChannel:a})=>function(e,t,n,i,r,o,a){if(n&&"unaggregated"!==n&&_R(r)){if(f(n)){const e=n[0],t=n[n.length-1];if(te(e)&&e<=0&&te(t)&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!kR(r))return!0;if((!XT(t)||!t.bin)&&oM([..._z,...Dz],e)){const{orient:t,type:n}=i;return(!oM(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!oM(["bar","area"],n)||a)||(null==o?void 0:o.zero))}return!1}(e,t,n,i,r,o.scale,a)};function HG(e){KG(e)?function(e){const t=e.component.scales;for(const n of Uz){const i=t[n];if(!i)continue;const r=NG(n,e);i.setWithExplicit("range",r)}}(e):GG(e,"range")}function GG(e,t){const n=e.component.scales;for(const i of e.children)"range"===t?HG(i):IG(i,t);for(const i of yM(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=aq(r,e.getWithExplicit(t),t,"scale",rq(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0)))}}n[i].setWithExplicit(t,r)}}function VG(e,t,n,i,r=!1){const o=function(e,t,n,i){var r;switch(t.type){case"nominal":case"ordinal":if(NB(e)||"discrete"===Yz(e))return"shape"===e&&"ordinal"===t.type&&gN(iN(e,"ordinal")),"ordinal";if(Sz(e))return"band";if(Az(e)||Ez(e)){if(oM(["rect","bar","image","rule","tick"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in kz)return"band";return aT(n[ez(e)])||oP(t)&&(null==(r=t.axis)?void 0:r.tickBand)?"band":"point";case"temporal":return NB(e)?"time":"discrete"===Yz(e)?(gN(iN(e,"temporal")),"ordinal"):XT(t)&&t.timeUnit&&NN(t.timeUnit).utc?"utc":Sz(e)?"band":"time";case"quantitative":return NB(e)?XT(t)&&oO(t.bin)?"bin-ordinal":"linear":"discrete"===Yz(e)?(gN(iN(e,"quantitative")),"ordinal"):Sz(e)?"band":"linear";case"geojson":return}throw new Error(KO(t.type))}(t,n,i,r),{type:a}=e;return Iz(t)?void 0!==a?function(e,t,n=!1){if(!Iz(e))return!1;switch(e){case YM:case XM:case QM:case ZM:case nB:case eB:return!!AR(t)||"band"===t||"point"===t&&!n;case uB:return oM(["linear","band"],t);case hB:case vB:case mB:case gB:case yB:case pB:return AR(t)||kR(t)||oM(["band","point","ordinal"],t);case lB:case cB:case fB:return"band"!==t;case bB:case dB:return"ordinal"===t||kR(t)}}(t,a)?XT(n)&&(s=a,u=n.type,!(oM([ZN,tR],u)?void 0===s||wR(s):u===eR?oM([sR,uR,void 0],s):u!==QN||yR(s)||kR(s)||void 0===s))?(gN(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(gN(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,a,o)),o):o:null;var s,u}function YG(e){KG(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of Uz){const a=bP(t[o]);if(a&&n===JR&&o===dB&&a.type===nR)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??(s={});const n=VG(s,o,a,i,qP(t,o));r[o]=new BG(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){var t;const n=e.component.scales={},i={},r=e.component.resolve;for(const o of e.children){YG(o);for(const n of yM(o.component.scales))if((t=r.scale)[n]??(t[n]=oH(n,e)),"shared"===r.scale[n]){const e=i[n],t=o.component.scales[n].getWithExplicit("type");e?dR(e.value,t.value)?i[n]=aq(e,t,"type","scale",XG):(r.scale[n]="independent",delete i[n]):i[n]=t}}for(const o of yM(i)){const t=e.scaleName(o,!0),r=i[o];n[o]=new BG(t,r);for(const n of e.children){const e=n.component.scales[o];e&&(n.renameScale(e.get("name"),t),e.merged=!0)}}return n}(e)}const XG=rq(((e,t)=>pR(e)-pR(t)));class JG{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 KG(e){return"unit"===(null==e?void 0:e.type)}function QG(e){return"facet"===(null==e?void 0:e.type)}function ZG(e){return"concat"===(null==e?void 0:e.type)}function eV(e){return"layer"===(null==e?void 0:e.type)}class tV{constructor(e,t,n,i,r,o,a){this.type=t,this.parent=n,this.config=r,this.parent=n,this.config=r,this.view=fO(a),this.name=e.name??i,this.title=hO(e.title)?{text:e.title}:e.title?fO(e.title):void 0,this.scaleNameMap=n?n.scaleNameMap:new JG,this.projectionNameMap=n?n.projectionNameMap:new JG,this.signalNameMap=n?n.signalNameMap:new JG,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>AL(e)?{filter:QS(e.filter,JN)}:e)),this.layout="layer"===t||"unit"===t?{}:function(e,t,n){const i=n[t],r={},{spacing:o,columns:a}=i;void 0!==o&&(r.spacing=o),void 0!==a&&(jT(e)&&!TT(e.facet)||Sj(e))&&(r.columns=a),Mj(e)&&(r.columns=1);for(const s of Rj)if(void 0!==e[s])if("spacing"===s){const t=e[s];r[s]=te(t)?t:{row:t.row??o,column:t.column??o}}else r[s]=e[s];return r}(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:jT(e)||(null==n?void 0:n.component.data.isFaceted)&&void 0===e.data},layoutSize:new tq,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?ZS(o):{}},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}={}){YG(e),bG(e);for(const n of zR)IG(e,n);t||HG(e)}(this)}parseProjection(){CH(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){yH(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const r of yM(n)){const e=n[r];void 0!==e&&(i[r]=AO(e))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=AO(this.description)),"unit"!==this.type&&"layer"!==this.type)?gM(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of TB){const r=e[i];if(null==r?void 0:r.facetFieldDef){const{titleAnchor:e,titleOrient:o}=LW(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=PW(i,o),s=KW(e,a);void 0!==s&&(n[a]=s)}}return gM(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of TB)e[n].title&&t.push(IW(this,n));for(const n of qW)t=t.concat(GW(this,n));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>FW(e,"grid",t))),...i.map((e=>FW(e,"grid",t))),...n.map((e=>FW(e,"main",t))),...i.map((e=>FW(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return _H(this)}assembleProjections(){return AH(this)}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...dO(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return oM(["unit","layer"],this.type)?oM(["middle",void 0],n.anchor)&&(n.frame??(n.frame="group")):n.anchor??(n.anchor="start"),gM(n)?void 0:n}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||QG(this.parent)?SG(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}getName(e){return wM((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(mq[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(QG(this.parent)){const t=Fz(iH(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(wR(e)&&mO(i)){const e=n.get("name"),i=EG($G(this,t));if(i){return{signal:nH(e,n,lP({aggregate:"distinct",field:i},{expr:"datum"}))}}return gN(qO(t)),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):YB(e)&&Iz(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}getScaleType(e){const t=this.getScaleComponent(e);return t?t.get("type"):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(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){var e,t;return(null==(e=this.component.axes.x)?void 0:e.some((e=>e.hasOrientSignalRef())))||(null==(t=this.component.axes.y)?void 0:t.some((e=>e.hasOrientSignalRef())))}}class nV extends tV{vgField(e,t={}){const n=this.fieldDef(e);if(n)return lP(n,t)}reduceFieldDef(e,t){return function(e,t,n,i){return e?yM(e).reduce(((n,r)=>{const o=e[r];return f(o)?o.reduce(((e,n)=>t.call(i,e,n,r)),n):t.call(i,n,o,r)}),n):n}(this.getMapping(),((t,n,i)=>{const r=vP(n);return r?e(t,r,i):t}),t)}forEachFieldDef(e,t){GP(this.getMapping(),((t,n)=>{const i=vP(t);i&&e(i,n)}),t)}}class iV extends vq{clone(){return new iV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${iM(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return n.resolve=this.transform.resolve,n}}class rV extends vq{clone(){return new rV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${iM(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class oV extends vq{clone(){return new oV(this.parent,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${iM(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class aV extends vq{clone(){return new aV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${iM(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class sV extends vq{clone(){return new sV(null,ZS(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[[oB,rB],[sB,aB]]){const r=i.map((e=>{const n=bP(t.encoding[e]);return XT(n)?n.field:KT(n)?{expr:`${n.datum}`}:iP(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new sV(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(dB)){const i=t.typedFieldDef(dB);i.type===nR&&(e=new sV(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(ie);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${iM(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class uV extends vq{clone(){return new uV(null,this.projection,ZS(this.fields),ZS(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[oB,rB],[sB,aB]]){const i=n.map((e=>{const n=bP(t.encoding[e]);return XT(n)?n.field:KT(n)?{expr:`${n.datum}`}:iP(n)?{expr:`${n.value}`}:void 0})),r=n[0]===sB?"2":"";(i[0]||i[1])&&(e=new uV(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(ie))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${iM(this.fields)} ${iM(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class lV extends vq{clone(){return new lV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}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 lV(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(XT(i)&&XT(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:u,frame:l,keyvals:c}=o.impute,f=VP(t.mark,n);return new lV(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==u?{value:u}:{},...l?{frame:l}:{},...void 0!==c?{keyvals:c}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${iM(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(u=n,WM(u,"stop")?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};var u;if(i&&"value"!==i){return[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class cV extends vq{clone(){return new cV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${iM(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class fV extends vq{clone(){return new fV(null,ZS(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return WM(e,"data")}(o)){let e=DV(o.data,r);e||(e=new IH(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new bq(e,n,mq.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return WM(e,"param")}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(wM(e),e)}catch(s){throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(function(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}(e))}return new fV(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?u(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${iM({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:u(this.transform.as)}:{}};else{let t=this.transform.as;ie(t)||(gN('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),t="_lookup"),e={as:[t]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class dV extends vq{clone(){return new dV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${iM(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class hV extends vq{clone(){return new hV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=ZS(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${iM(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class pV extends vq{clone(){return new pV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=cM((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${iM(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class mV extends vq{clone(){return new mV(null,ZS(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${iM(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function gV(e){let t=0;return function n(i,r){if(i instanceof IH&&!i.isGenerator&&!uq(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof jH&&(i.parent instanceof IH&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof NH)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 e.push(...i.assemble());if((i instanceof qH||i instanceof UH||i instanceof uG||i instanceof wW||i instanceof RW||i instanceof uV||i instanceof OH||i instanceof fV||i instanceof fG||i instanceof sG||i instanceof aV||i instanceof oV||i instanceof iV||i instanceof cV||i instanceof dV||i instanceof hV||i instanceof LH||i instanceof mV||i instanceof pV||i instanceof rV)&&r.transform.push(i.assemble()),(i instanceof BH||i instanceof _q||i instanceof lV||i instanceof cG||i instanceof sV)&&r.transform.push(...i.assemble()),i instanceof bq)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof bq)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 bq&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}function yV(e,t){var n;const{facet:i,config:r,child:o,component:a}=e;if(e.channelHasField(t)){const s=i[t],u=jW("title",null,r,t);let l=pP(s,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});o.component.layoutHeaders[t].title&&(l=f(l)?l.join(", "):l,l+=` / ${o.component.layoutHeaders[t].title}`,o.component.layoutHeaders[t].title=null);const c=jW("labelOrient",s.header,r,t),d=null!==s.header&&zM(null==(n=s.header)?void 0:n.labels,r.header.labels,!0),h=oM(["bottom","right"],c)?"footer":"header";a.layoutHeaders[t]={title:null!==s.header?l:null,facetFieldDef:s,[h]:"facet"===t?[]:[vV(e,t,d)]}}}function vV(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 bV(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=aH(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",a=r[o];for(const r of n.component.axes[t]){const t="top"===(i=r.get("orient"))||"left"===i||pO(i)?"header":"footer";a[t]??(a[t]=[vV(e,o,!1)]);const n=FW(r,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),r.mainExtracted=!0}}}var i}function xV(e){for(const t of e.children)t.parseLayoutSize()}function wV(e,t){const n=iH(t),i=Fz(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const s of e.children){const t=s.component.layoutSize.getWithExplicit(n),o=r.scale[i]??oH(i,e);if("independent"===o&&"step"===t.value){a=void 0;break}if(a){if("independent"===o&&a.value!==t.value){a=void 0;break}a=aq(a,t,n,"")}else a=t}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function _V(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(wR(e)){const e=jj(i.view,t);return mO(n)||Oj(e)?"step":e}return Tj(i.view,t)}if(e.hasProjection||"arc"===e.mark)return Tj(i.view,t);{const e=jj(i.view,t);return Oj(e)?e.step:e}}function AV(e,t,n){return lP(t,{suffix:`by_${lP(e)}`,...n})}class kV extends nV{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=XV(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!TT(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=yM(e),n={};for(const i of t){if(![HM,GM].includes(i)){gN(eN(i,"facet"));break}const t=e[i];if(void 0===t.field){gN(ZO(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=_P(e,t);return n.header?n.header=fO(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return WM(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=FV(this),this.child.parseData()}parseLayoutSize(){xV(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Object.values(this.component.selection).some((e=>nI(e)))&&mN(VO)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of TB)yV(e,t);bV(e,"x"),bV(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of TB)for(const n of UW){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=jW("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=PW(t,n);e.titleAnchor??(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(null==r?void 0:r[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??(e[o]={}),e[o][t]=.5),i.title&&(e.offset??(e.offset={}),e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}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"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof kV)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof kV?{...this.channelHasField("column")?{encode:{update:{columns:{field:lP(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof kV){if(this.child.channelHasField("column")){const i=lP(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of _z){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(wR(o)&&mO(a)){const r=EG($G(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):gN(qO(i))}}}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:o,as:a}=this.getCardinalityAggregateForChild(),s=[];for(const l of TB){const e=this.facet[l];if(e){s.push(lP(e));const{bin:t,sort:u}=e;if(oO(t)&&s.push(lP(e,{binSuffix:"end"})),NT(u)){const{field:t,op:s=BT}=u,l=AV(e,u);n&&i?(r.push(l),o.push("max"),a.push(l)):(r.push(t),o.push(s),a.push(l))}else if(f(u)){const t=TW(e,l);r.push(t),o.push("max"),a.push(t)}}}const u=!!n&&!!i;return{name:e,data:t,groupby:s,...u||r.length>0?{aggregate:{...u?{cross:u}:{},...r.length?{fields:r,ops:o,as:a}:{}}}:{}}}facetSortFields(e){const{facet:t}=this,n=t[e];return n?NT(n.sort)?[AV(n,n.sort,{expr:"datum"})]:f(n.sort)?[TW(n,e,{expr:"datum"})]:[lP(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(NT(e)?e.order:!f(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){var e;const{facet:t,config:n}=this;if(t.facet)return YW(t.facet,"facet",n);const i={row:["top","bottom"],column:["left","right"]};for(const r of qW)if(t[r]){const o=jW("labelOrient",null==(e=t[r])?void 0:e.header,n,r);if(i[r].includes(o))return YW(t[r],r,n)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=gV(t);for(const i of e.children)n(i,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:TB.map((e=>this.facetSortFields(e))).flat(),order:TB.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(Wq(this,[]))}]}getMapping(){return this.facet}}function DV(e,t){var n,i,r,o;for(const a of t){const t=a.data;if(e.name&&a.hasName()&&e.name!==a.dataName)continue;const s=null==(n=e.format)?void 0:n.mesh,u=null==(i=t.format)?void 0:i.feature;if(s&&u)continue;const l=null==(r=e.format)?void 0:r.feature;if((l||u)&&l!==u)continue;const c=null==(o=t.format)?void 0:o.mesh;if(!s&&!c||s===c)if(lq(e)&&lq(t)){if(UM(e.values,t.values))return a}else if(uq(e)&&uq(t)){if(e.url===t.url)return a}else if(cq(e)&&e.name===a.dataName)return a}return null}function FV(e){var t;let n=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new IH({values:[]});return t.push(e),e}const n=DV(e.data,t);if(n)return fq(e.data)||(n.data.format=uM({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new IH(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:i,outputNodeRefCounts:r}=e.component.data,o=e.data,a=!(o&&(fq(o)||uq(o)||lq(o)))&&e.parent?e.parent.component.data.ancestorParse.clone():new sq;fq(o)?(dq(o)?n=new UH(n,o.sequence):pq(o)&&(n=new qH(n,o.graticule)),a.parseNothing=!0):null===(null==(t=null==o?void 0:o.format)?void 0:t.parse)&&(a.parseNothing=!0),n=jH.makeExplicit(n,e,a)??n,n=new LH(n);const s=e.parent&&eV(e.parent);(KG(e)||QG(e))&&s&&(n=BH.makeFromEncoding(n,e)??n),e.transforms.length>0&&(n=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(OL(r))a=e=new RW(e,r),o="derived";else if(AL(r)){const i=TH(r);a=e=jH.makeWithAncestors(e,{},i,n)??e,e=new wW(e,t,r.filter)}else if(NL(r))a=e=BH.makeFromTransform(e,r,t),o="number";else if(TL(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new jH(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=_q.makeFromTransform(e,r);else if(PL(r))a=e=OH.makeFromTransform(e,r),o="number",eI(t)&&(e=new LH(e));else if(kL(r))a=e=fV.make(e,t,r,i++),o="derived";else if(ML(r))a=e=new fG(e,r),o="number";else if(BL(r))a=e=new sG(e,r),o="number";else if(jL(r))a=e=cG.makeFromTransform(e,r),o="derived";else if(LL(r))a=e=new aV(e,r),o="derived";else if(qL(r))a=e=new rV(e,r),o="derived";else if(zL(r))a=e=new oV(e,r),o="derived";else if(DL(r))a=e=new pV(e,r),o="derived";else if(SL(r))e=new mV(e,r);else if(RL(r))a=e=lV.makeFromTransform(e,r),o="derived";else if(FL(r))a=e=new iV(e,r),o="derived";else if(CL(r))a=e=new dV(e,r),o="derived";else if(EL(r))a=e=new hV(e,r),o="derived";else{if(!$L(r)){gN(`Ignoring an invalid transform: ${IM(r)}.`);continue}a=e=new cV(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(n,e,a));const u=function(e){const t={};if(KG(e)&&e.component.selection)for(const n of yM(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&BM(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=PH(e);n=jH.makeWithAncestors(n,{},{...u,...l},a)??n,KG(e)&&(n=sV.parseAll(n,e),n=uV.parseAll(n,e)),(KG(e)||QG(e))&&(s||(n=BH.makeFromEncoding(n,e)??n),n=_q.makeFromEncoding(n,e)??n,n=RW.parseAllForSortIndex(n,e));const c=n=CV(mq.Raw,e,n);if(KG(e)){const t=OH.makeFromEncoding(n,e);t&&(n=t,eI(e)&&(n=new LH(n))),n=lV.makeFromEncoding(n,e)??n,n=cG.makeFromEncoding(n,e)??n}let f,d;if(KG(e)){const{markDef:t,mark:i,config:r}=e,o=EO("invalid",t,r),{marks:a,scales:s}=d=yq({invalid:o,isPath:KR(i)});a!==s&&"include-invalid-values"===s&&(f=n=CV(mq.PreFilterInvalid,e,n)),"exclude-invalid-values"===a&&(n=uG.make(n,e,d)??n)}const h=n=CV(mq.Main,e,n);let p;if(KG(e)&&d){const{marks:t,scales:i}=d;"include-invalid-values"===t&&"exclude-invalid-values"===i&&(n=uG.make(n,e,d)??n,p=n=CV(mq.PostFilterInvalid,e,n))}KG(e)&&function(e,t){for(const[n,i]of bM(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new bq(new wW(t,e,{param:n}),r,mq.Lookup,e.component.data.outputNodeRefCounts)}}(e,h);let m=null;if(QG(e)){const t=e.getName("facet");n=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(NT(r.sort)){const{field:n,op:i=BT}=r.sort;e=t=new sG(e,{joinaggregate:[{op:i,field:n,as:AV(r,r.sort,{forAs:!0})}],groupby:[lP(r)]})}return t}return null}(n,e.facet)??n,m=new NH(n,e,t,h.getSource()),i[t]=m}return{...e.component.data,outputNodes:i,outputNodeRefCounts:r,raw:c,main:h,facetRoot:m,ancestorParse:a,preFilterInvalid:f,postFilterInvalid:p}}function CV(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,o=t.getDataName(e),a=new bq(n,o,e,r);return i[o]=a,a}class EV extends tV{constructor(e,t,n,i){var r,o,a,s;super(e,"concat",t,n,i,e.resolve),"shared"!==(null==(o=null==(r=e.resolve)?void 0:r.axis)?void 0:o.x)&&"shared"!==(null==(s=null==(a=e.resolve)?void 0:a.axis)?void 0:s.y)||gN("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>XV(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=FV(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of yM(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>nI(e)))&&mN(VO)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return Mj(e)?e.vconcat:Bj(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){xV(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";wV(e,t),wV(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=ZW(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}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{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const $V={disable:1,gridScale:1,scale:1,...zP,labelExpr:1,encode:1},SV=yM($V);class MV extends tq{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new MV(ZS(this.explicit),ZS(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}hasOrientSignalRef(){return pO(this.explicit.orient)}}const BV={bottom:"top",top:"bottom",left:"right",right:"left"};function zV(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<n;i++){const n=e[i],r=t[i];if(!!n!=!!r)return;if(n&&r){const t=n.getWithExplicit("orient"),o=r.getWithExplicit("orient");if(t.explicit&&o.explicit&&t.value!==o.value)return;e[i]=OV(n,r)}}}return e}function OV(e,t){for(const n of SV){const i=aq(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",((e,t)=>{switch(n){case"title":return NO(e,t);case"gridScale":return{explicit:e.explicit,value:zM(e.value,t.value)}}return oq(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function NV(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(pO(n.labelAngle)?n.labelAngle:jM(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===NW(i,r))return!0}return e===n[t]}const RV=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function TV(e,t){var n,i;let r=t.axis(e);const o=new MV,a=bP(t.encoding[e]),{mark:s,config:u}=t,l=(null==r?void 0:r.orient)||(null==(n=u["x"===e?"axisX":"axisY"])?void 0:n.orient)||(null==(i=u.axis)?void 0:i.orient)||function(e){return"x"===e?"bottom":"left"}(e),c=t.getScaleComponent(e).get("type"),f=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:yR(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=pO(n)?"axisOrient":`axis${kM(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],u=["axis",a,o];return{vlOnlyAxisConfig:EW(s,i,e,n),vgAxisConfig:EW(u,i,e,n),axisConfigStyle:$W([...u,...s],i)}}(e,c,l,t.config),d=void 0!==r?!r:SW("disable",u.style,null==r?void 0:r.style,f).configValue;if(o.set("disable",d,void 0!==r),d)return o;r=r||{};const h=function(e,t,n,i,r){const o=null==t?void 0:t.labelAngle;if(void 0!==o)return pO(o)?o:jM(o);{const{configValue:o}=SW("labelAngle",i,null==t?void 0:t.style,r);return void 0!==o?jM(o):n!==YM||!oM([tR,ZN],e.type)||XT(e)&&e.timeUnit?void 0:270}}(a,r,e,u.style,f),p=CT(r.formatType,a,c),m=FT(a,a.type,r.format,r.formatType,u,!0),g={fieldOrDatumDef:a,axis:r,channel:e,model:t,scaleType:c,orient:l,labelAngle:h,format:m,formatType:p,mark:s,config:u};for(const b of SV){const n=b in MW?MW[b](g):NP(b)?r[b]:void 0,i=void 0!==n,a=NV(n,b,r,t,e);if(i&&a)o.set(b,n,a);else{const{configValue:e,configFrom:t}=NP(b)&&"values"!==b?SW(b,u.style,r.style,f):{},s=void 0!==e;i&&!s?o.set(b,n,a):("vgAxisConfig"!==t||RV.has(b)&&s||SP(e)||pO(e))&&o.set(b,e,!1)}}const y=r.encoding??{},v=MP.reduce(((n,i)=>{if(!o.hasAxisPart(i))return n;const r=rH(y[i]??{},t),a="labels"===i?function(e,t,n){const{encoding:i,config:r}=e,o=bP(i[t])??bP(i[ZB(t)]),a=e.axis(t)||{},{format:s,formatType:u}=a;if(wT(u))return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:u,config:r}),...n};if(void 0===s&&void 0===u&&r.customFormatTypes){if("quantitative"===JT(o)){if(oP(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===JT(o)&&r.timeFormatType&&XT(o)&&!o.timeUnit)return{text:DT({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,r):r;return void 0===a||gM(a)||(n[i]={update:a}),n}),{});return gM(v)||o.set("encode",v,!!r.encoding||void 0!==r.labelAngle),o}function PV(e,t){const{config:n}=e;return{...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...cU("size",e),...cU("angle",e),...jV(e,n,t)}}function jV(e,t,n){return n?{shape:{value:n}}:cU("shape",e)}function LV(e,t,n){if(void 0===EO("align",e,n))return"center"}function qV(e,t,n){if(void 0===EO("baseline",e,n))return"middle"}const UV={arc:{vgMark:"arc",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...AU(e,"radius"),...AU(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...xU("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...xU("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...MU(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,"x"),...AU(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>PV(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&XT(n)&&n.type===nR?{field:lP(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,"x"),...AU(e,"y"),...nU(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...cU("size",e,{vgChannel:"strokeWidth"}),...MU(e)})},point:{vgMark:"symbol",encodeEntry:e=>PV(e)},rect:{vgMark:"rect",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,"x"),...AU(e,"y")})},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?{...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...xU("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...xU("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...cU("size",e,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:e=>PV(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...EU(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...nU(e),...cU("size",e,{vgChannel:"fontSize"}),...cU("angle",e),...BU("align",LV(e.markDef,n,t)),...BU("baseline",qV(e.markDef,n,t)),...pU("radius",e,{defaultPos:null}),...pU("theta",e,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"x":"y",o="horizontal"===i?"y":"x",a="horizontal"===i?"height":"width";return{...EU(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...AU(e,r),...pU(o,e,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:AO(EO("thickness",n,t))}}},trail:{vgMark:"trail",encodeEntry:e=>({...EU(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...pU("x",e,{defaultPos:"mid"}),...pU("y",e,{defaultPos:"mid"}),...cU("size",e),...MU(e)})}};function IV(e){if(oM([qR,PR,VR],e.mark)){const t=VP(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:WV+e.requestDataName(mq.Main),data:e.requestDataName(mq.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:GV(e,{fromPrefix:WV})}]}(e,t)}else if(e.mark===jR){const t=bO.some((t=>EO(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){var t;const[n]=GV(e,{fromPrefix:HV}),i=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(e,t)=>`${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 a,s;"x"===e.stack.fieldChannel?(a={...tM(n.encode.update,["y","yc","y2","height",...bO]),x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...nM(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(a={...tM(n.encode.update,["x","xc","x2","width"]),y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...nM(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const l of bO){const t=$O(l,e.markDef,e.config);n.encode.update[l]?(a[l]=n.encode.update[l],delete n.encode.update[l]):t&&(a[l]=AO(t)),t&&(n.encode.update[l]={value:0})}const u=[];if((null==(t=e.stack.groupbyChannels)?void 0:t.length)>0)for(const l of e.stack.groupbyChannels){const t=e.fieldDef(l),n=lP(t);n&&u.push(n),((null==t?void 0:t.bin)||(null==t?void 0:t.timeUnit))&&u.push(lP(t,{binSuffix:"end"}))}a=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((t,i)=>{if(n.encode.update[i])return{...t,[i]:n.encode.update[i]};{const n=$O(i,e.markDef,e.config);return void 0!==n?{...t,[i]:AO(n)}:t}}),a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(mq.Main),name:HV+e.requestDataName(mq.Main),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:s},marks:[n]}]}]}(e)}return GV(e)}const WV="faceted_path_";const HV="stack_group_";function GV(e,t={fromPrefix:""}){const{mark:n,markDef:i,encoding:r,config:o}=e,a=zM(i.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!(null==t?void 0:t.get("selectionExtent"))&&!(null==n?void 0:n.get("selectionExtent")))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),s=CO(i),u=r.key,l=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,a=t.order;if(!(!f(a)&&iP(a)&&rM(a.value)||!a&&rM(EO("order",r,o)))){if((f(a)||XT(a))&&!n)return BO(a,{expr:"datum"});if(KR(i)){const e="horizontal"===r.orient?"y":"x";if(XT(t[e]))return{field:e}}}}(e),c=function(e){if(!e.component.selection)return null;const t=yM(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=yM(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}(e),d=EO("aria",i,o),h=UV[n].postEncodingTransform?UV[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:UV[n].vgMark,...a?{clip:a}:{},...s?{style:s}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...!1===d?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(mq.Main)},encode:{update:UV[n].encodeEntry(e)},...h?{transform:h}:{}}]}class VV extends nV{constructor(e,t,n,i={},r){super(e,"unit",t,n,r,void 0,Nj(e)?e.view:void 0),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection=[],this.children=[],this.correctDataNames=e=>{var t,n,i;return(null==(t=e.from)?void 0:t.data)&&(e.from.data=this.lookupDataSource(e.from.data),"time"in this.encoding&&(e.from.data=e.from.data+Mq)),(null==(i=null==(n=e.from)?void 0:n.facet)?void 0:i.data)&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e};const o=eT(e.mark)?{...e.mark}:{type:e.mark},a=o.type;void 0===o.filled&&(o.filled=function(e,t,{graticule:n}){if(n)return!1;const i=$O("filled",e,t),r=e.type;return zM(i,r!==UR&&r!==qR&&r!==WR)}(o,r,{graticule:e.data&&pq(e.data)}));const s=this.encoding=function(e,t,n,i){const r={};for(const s of yM(e))YB(s)||gN(`${o=s}-encoding is dropped as ${o} is not a valid encoding channel.`);var o,a;for(let s of rz){if(!e[s])continue;const o=e[s];if(Ez(s)){const e=iz(s),t=r[e];if(XT(t)&&("quantitative"===(a=t.type)||"temporal"===a)&&XT(o)&&!t.timeUnit){gN(JO(e));continue}}if("angle"!==s||"arc"!==t||e.theta||(gN("Arc marks uses theta channel rather than angle, replacing angle with theta."),s=nB),WP(e,s,t)){if(s===hB&&"line"===t){const t=vP(e[s]);if(null==t?void 0:t.aggregate){gN("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(s===lB&&(n?"fill"in e:"stroke"in e))gN(QO("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(s===_B||s===wB&&!f(o)&&!iP(o)||s===kB&&f(o)){if(o){if(s===wB){const t=e[s];if(HT(t)){r[s]=t;continue}}r[s]=u(o).reduce(((e,t)=>(XT(t)?e.push(_P(t,s)):gN(ZO(t,s)),e)),[])}}else{if(s===kB&&null===o)r[s]=null;else if(!(XT(o)||KT(o)||iP(o)||GT(o)||pO(o))){gN(ZO(o,s));continue}r[s]=xP(o,s,i)}}else gN(eN(s,t))}return r}(e.encoding||{},a,o.filled,r);this.markDef=sL(o,s,r),this.size=function({encoding:e,size:t}){for(const n of _z){const i=ez(n);Oj(t[i])&&QT(e[n])&&(delete t[i],gN(uN(i)))}return t}({encoding:s,size:Nj(e)?{...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:i}),this.stack=aL(this.markDef,s),this.specifiedScales=this.initScales(a,s),this.specifiedAxes=this.initAxes(s),this.specifiedLegends=this.initLegends(s),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>Ej(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===JR,n=e&&zB.some((t=>tP(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 Uz.reduce(((e,n)=>{const i=bP(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:t,range:n}=e,i=fO(e);return f(t)&&(i.domain=t.map(wO)),f(n)&&(i.range=n.map(wO)),i}initAxes(e){return _z.reduce(((t,n)=>{const i=e[n];if(tP(i)||n===YM&&tP(e.x2)||n===XM&&tP(e.y2)){const e=tP(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=yM(e),n={};for(const i of t){const t=e[i];n[i]=SP(t)?xO(t):wO(t)}return n}initLegends(e){return Lz.reduce(((t,n)=>{const i=bP(e[n]);if(i&&function(e){switch(e){case lB:case cB:case fB:case hB:case dB:case mB:case vB:case bB:return!0;case gB:case yB:case pB:case uB:return!1}}(n)){const e=i.legend;t[n]=e?fO(e):e}return t}),{})}parseData(){this.component.data=FV(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of _z){const r=ez(i);if(t[r]){const e=t[r];n.layoutSize.set(r,Oj(e)?"step":e,!0)}else{const t=_V(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;let r=0;for(const o of t){const t=wM(o.name),a=o.select,s=ie(a)?a:a.type,l=ne(a)?ZS(a):{type:s},c=i[s];for(const e in c)"fields"!==e&&"encodings"!==e&&("mark"===e&&(l.mark={...c.mark,...l.mark}),void 0!==l[e]&&!0!==l[e]||(l[e]=ZS(c[e]??l[e])));const f=n[t]={...l,name:t,type:s,init:o.value,bind:o.bind,events:ie(l.on)?ZF(l.on,"scope"):u(ZS(l.on))};if(nI(f)&&(r++,r>1)){delete n[t];continue}const d=ZS(o);for(const n of QU)n.defined(f)&&n.parse&&n.parse(e,f,d)}return r>1&&gN("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),n}(this,this.selection)}parseMarkGroup(){this.component.mark=IV(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,_z.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[TV(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;for(const i of vM(e.component.selection??{})){const r=i.name,o=fe(r+YU);if(0===t.filter((e=>e.name===r)).length){const e="global"===i.resolve?"union":i.resolve,n="point"===i.type?", true, true)":")";t.push({name:i.name,update:`${KU}(${o}, ${fe(e)}${n}`})}n=!0;for(const n of QU)n.defined(i)&&n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))}n&&0===t.filter((e=>"unit"===e.name)).length&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]});return Gq(t)}(this,e)}assembleSignals(){return[...CW(this),...Iq(this,[])]}assembleSelectionData(e){return function(e,t){const n=[],i=[],r=ZU(e,{escape:!1});for(const o of vM(e.component.selection??{})){const a={name:o.name+YU};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:kj}}]),o.init){const e=o.project.items.map(qq);a.values=o.project.hasSelectionId?o.init.map((e=>({unit:r,[kj]:Uq(e,!1)[0]}))):o.init.map((t=>({unit:r,fields:e,values:Uq(t,!1)})))}if([...n,...t].filter((e=>e.name===o.name+YU)).length||n.push(a),nI(o)&&t.length){const n=e.lookupDataSource(e.getDataName(mq.Main)),r=t.find((e=>e.name===n)),o=r.transform.find((e=>"filter"===e.type&&e.expr.includes("vlSelectionTest")));if(o){r.transform=r.transform.filter((e=>e!==o));const e={name:r.name+Mq,source:r.name,transform:[o]};i.push(e)}}}return n.concat(t,i)}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return ZW(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&eV(this.parent)||(e=Hq(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return jP(this.encoding,e)}fieldDef(e){return vP(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return nP(t)?t:null}}class YV extends tV{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(Zj(e))return new YV(e,this,this.getName(`layer_${t}`),o,r);if(TP(e))return new VV(e,this,this.getName(`layer_${t}`),o,r);throw new Error(RO(e))}))}parseData(){this.component.data=FV(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;xV(e=this),wV(e,"width"),wV(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of yM(e.component.selection))this.component.selection[t]=e.component.selection[t]}Object.values(this.component.selection).some((e=>nI(e)))&&mN(VO)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const r of e.children){r.parseAxesAndHeaders();for(const i of yM(r.component.axes))n.axis[i]=aH(e.component.resolve,i),"shared"===n.axis[i]&&(t[i]=zV(t[i],r.component.axes[i]),t[i]||(n.axis[i]="independent",delete t[i]))}for(const r of _z){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!pO(t)){if(i[t]>0&&!n){const n=BV[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.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())),CW(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),ZW(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const n of this.children)for(const t of u(n.assembleGroupStyle()))e.add(t);const t=Array.from(e);return t.length>1?t:1===t.length?t[0]:void 0}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)KG(n)&&(t=Hq(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),_H(this))}}function XV(e,t,n,i,r){if(jT(e))return new kV(e,t,n,r);if(Zj(e))return new YV(e,t,n,i,r);if(TP(e))return new VV(e,t,n,i,r);if(function(e){return Mj(e)||Bj(e)||Sj(e)}(e))return new EV(e,t,n,r);throw new Error(RO(e))}function JV(e,t={}){var n;t.logger&&(n=t.logger,pN=n),t.fieldTitle&&hP(t.fieldTitle);try{const n=Vj(qe(t.config,e.config)),i=YL(e,n),r=XV(i,null,"",void 0,n);r.parse(),function(e,t){mG(e.sources);let n=0,i=0;for(let r=0;r<5&&yG(e,t,!0);r++)n++;e.sources.map(dG);for(let r=0;r<5&&yG(e,t,!1);r++)i++;mG(e.sources),5===Math.max(n,i)&&gN("Maximum optimization runs(5) reached.")}(r.component.data,r);const o=function(e,t,n={},i){const r=e.config?Kj(e.config):void 0,o=function(e,t){const n=[],i=gV(n);let r=0;for(const a of e.sources){a.hasName()||(a.dataName="source_"+r++);const e=a.assemble();i(a,e)}for(const a of n)0===a.transform.length&&delete a.transform;let o=0;for(const[a,s]of n.entries())0!==(s.transform??[]).length||s.source||n.splice(o++,0,n.splice(a,1)[0]);for(const a of n)for(const t of a.transform??[])"lookup"===t.type&&(t.from=e.outputNodes[t.from].getSource());for(const a of n)a.name in t&&(a.values=t[a.name]);return n}(e.component.data,n),a=e.assembleSelectionData(o),s=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:d,...h}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...h,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:a,...s.length>0?{projections:s}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...$j(d)]),...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"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):ie(t)&&(t={type:t});if(r&&o&&(a=t.type,["fit","fit-x","fit-y"].includes(a)))if("step"===r&&"step"===o)gN(LO()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";gN(LO(Fz(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${Fz(e)}`:"fit"}(n)}var a;return{...1===yM(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t},...eq(n,!1),...eq(e,!0)}}(e,i.autosize,n,r),e.datasets,e.usermeta);return{spec:o,normalized:i}}finally{t.logger&&(pN=hN),t.fieldTitle&&hP(fP)}}export{eM as A,YL as B,jM as C,nM as D,tM as E,pM as F,MM as G,SM as H,$M as I,RM as J,dM as K,aM as L,RR as M,IM as N,kM as O,cM as P,NM as Q,vM as R,wM as S,VS as T,Zz as U,Lz as V,BM as a,DM as b,JV as c,CM as d,oM as e,UM as f,AM as g,ZS as h,bM as i,sM as j,mM as k,FM as l,zM as m,hM as n,WM as o,iM as p,TM as q,xM as r,gM as s,fM as t,PM as u,rM as v,LM as w,yM as x,_M as y,uM as z};
|