~nmh/moby-dick

1428953dfd59d8a1714518fc78744a1db6e9d6e5 — nick hansen 1 year, 11 months ago 058f11f trunk
add some charts
5 files changed, 175 insertions(+), 1 deletions(-)

M Makefile
M web/info.html
A web/vega-5.21.0.js
A web/vega-embed-6.20.2.js
A web/vega-lite-5.2.0.js
M Makefile => Makefile +4 -1
@@ 16,7 16,7 @@ haskell_files = package.yaml $(shell find src app -iname '*.hs' -type f)

elm_files = elm.json $(shell find elm -iname '*.elm' -type f)

web: web/main.min.js web/index.html web/styles.css
web: web/main.min.js web/index.html web/styles.css web/data.json

textfiles: moby-words.txt dictionary.txt



@@ 44,6 44,9 @@ web/main.min.js: web/main.js
> uglifyjs web/main.js --compress 'pure_funcs=[F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9],pure_getters,keep_fargs=false,unsafe_comps,unsafe' \
  | uglifyjs --mangle --output web/main.min.js

web/data.json: $(haskell_files) $(shell find solutions -iname '*.json' -type f)
> stack run -- summary solutions/*.json -o web/data.json

all-solutions: solution.json $(haskell_files) moby-dick.txt
> for i in {0..12} ; do \
    mkdir -p solutions ; \

M web/info.html => web/info.html +145 -0
@@ 5,6 5,9 @@
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Information</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
    <script src="vega-5.21.0.js"></script>
    <script src="vega-lite-5.2.0.js"></script>
    <script src="vega-embed-6.20.2.js"></script>
  </head>
  <body>
    <h1>What is this?</h1>


@@ 17,6 20,148 @@
    <p>The computer uses the strategy described in <a href="https://arxiv.org/abs/2203.06804">this paper</a>, which wins in a bounded number of guesses for puzzles of length &#969;<sub>0</sub>. Maybe a bit overkill for a mere 1.1 million characters, but at least it was pretty easy to code.</p>
    <h1>How does it all work?</h1>
    <p>Solutions are generated offline (it takes my laptop a few minutes to generate one) and loaded incrementally by the visualizer. The solver is written in Haskell and uses a simple depth-first search (by way of the List monad) for coming up with valid guesses. The visualization is written in Elm and was much more of a pain in the ass to get right than the solver. The source code for both is available <a href="https://git.sr.ht/~nmh/moby-dick/tree">here</a>.</p>
    <h1>Do you have any cool graphs?</h1>
    <p>Yes.</p>
    <div id="vis"></div>
    <script>
        var vegaSpec = {
            "$schema": "https//vega.github.io/schema/vega-lite/v5.json",
            "data": {"url": "data.json"},
            "hconcat": [
                {
                    "title": "solution progress",
                    "mark": {"type": "area"},
                    "transform": [
                        {
                            "filter": {
                                "field": "color",
                                "oneOf": ["Blank", "Yellow", "Green"]
                            }
                        },
                        {
                            "aggregate": [
                                {
                                    "field": "count",
                                    "op": "sum",
                                    "as": "ttlCount"
                                }
                            ],
                            "groupby": ["guessNumber", "color", "solutionId"]
                        },
                        {
                            "calculate": "datum.color == 'Green' ? 0 : (datum.color == 'Yellow' ? 1 : 2)",
                            "as": "stackOrder"
                        }
                    ],
                    "encoding": {
                        "x": {
                            "field": "guessNumber",
                            "type": "ordinal",
                            "title": "guess"
                        },
                        "y": {
                            "field": "ttlCount",
                            "type": "quantitative",
                            "aggregate": "average",
                            "title": "letter count"
                        },
                        "color": {
                            "field": "color",
                            "type": "nominal",
                            "scale": {"range": ["gray", "#c9b458", "#6aaa64"]},
                            "title": "status",
                            "sort": ["Blank", "Yellow", "Green"]
                        },
                        "order": {"field": "stackOrder"}
                    }
                },
                {
                    "title": "missing letters",
                    "mark": {"type": "rect"},
                    "transform": [
                        {
                            "filter": {
                                "field": "color",
                                "oneOf": ["Missing", "Blank"]
                            }
                        },
                        {
                            "calculate": "datum.color == 'Missing' ? datum.count : -1 * datum.count",
                            "as": "delta"
                        },
                        {
                            "aggregate": [
                                {
                                    "op": "sum",
                                    "field": "delta",
                                    "as": "sumDelta"
                                },
                                {
                                    "op": "distinct",
                                    "field": "solutionId",
                                    "as": "solutionCount"
                                }
                            ],
                            "groupby": ["guessNumber", "letter"]
                        },
                        {
                            "calculate": "datum.letter == ' ' ? '\\u2423' : datum.letter",
                            "as": "letter2"
                        },
                        {
                            "calculate": "datum.letter == ' ' ? 'space' : datum.letter",
                            "as": "letter3"
                        },
                        {
                            "calculate": "datum.sumDelta / datum.solutionCount",
                            "as": "meanDelta"
                        }
                    ],
                    "encoding": {
                        "x": {
                            "field": "guessNumber",
                            "type": "ordinal",
                            "title": "guess"
                        },
                        "y": {
                            "field": "letter2",
                            "type": "ordinal",
                            "title": "letter"
                        },
                        "color": {
                            "field": "meanDelta",
                            "type": "quantitative",
                            "scale": {
                                "domainMid": 0,
                                "type": "symlog",
                                "constant": 40
                            },
                            "title": "count"
                        },
                        "tooltip": [
                            {
                                "field": "letter3",
                                "type": "nominal",
                                "title": "letter"
                            },
                            {
                                "field": "guessNumber",
                                "type": "ordinal",
                                "title": "guess"
                            },
                            {
                                "field": "meanDelta",
                                "type": "quantitative",
                                "title": "avg. missing",
                                "format": "d"
                            }
                        ]
                    }
                }
            ]
        };
        vegaEmbed('#vis', vegaSpec);
    </script>
    <h1>What is the font used on this website?</h1>
    <p>The delightful <a href="https://github.com/belluzj/fantasque-sans">Fantasque Sans</a>.</p>
  </body>

A web/vega-5.21.0.js => web/vega-5.21.0.js +2 -0
@@ 0,0 1,2 @@
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={})}(this,(function(t){"use strict";var e="5.21.0";function n(t,e,n){return t.fields=e||[],t.fname=n,t}function r(t){return null==t?null:t.fname}function i(t){return null==t?null:t.fields}function o(t){return 1===t.length?a(t[0]):u(t)}const a=t=>function(e){return e[t]},u=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function s(t){throw Error(t)}function l(t){const e=[],n=t.length;let r,i,o,a=null,u=0,l="";function c(){e.push(l+t.substring(r,i)),l="",r=i+1}for(t+="",r=i=0;i<n;++i)if(o=t[i],"\\"===o)l+=t.substring(r,i),l+=t.substring(++i,++i),r=i;else if(o===a)c(),a=null,u=-1;else{if(a)continue;r===u&&'"'===o||r===u&&"'"===o?(r=i+1,a=o):"."!==o||u?"["===o?(i>r&&c(),u=r=i+1):"]"===o&&(u||s("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&s("Access path missing closing bracket: "+t),a&&s("Access path missing closing quote: "+t),i>r&&(i++,c()),e}function c(t,e,r){const i=l(t);return t=1===i.length?i[0]:t,n((r&&r.get||o)(i),[t],e||t)}const f=c("id"),h=n((t=>t),[],"identity"),d=n((()=>0),[],"zero"),p=n((()=>1),[],"one"),g=n((()=>!0),[],"true"),m=n((()=>!1),[],"false");function y(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}function v(t,e,n=y){let r=t||0;return{level(t){return arguments.length?(r=+t,this):r},error(){return r>=1&&n(e||"error","ERROR",arguments),this},warn(){return r>=2&&n(e||"warn","WARN",arguments),this},info(){return r>=3&&n(e||"log","INFO",arguments),this},debug(){return r>=4&&n(e||"log","DEBUG",arguments),this}}}var _=Array.isArray;function x(t){return t===Object(t)}const b=t=>"__proto__"!==t;function w(...t){return t.reduce(((t,e)=>{for(const n in e)if("signals"===n)t.signals=A(t.signals,e.signals);else{const r="legend"===n?{layout:1}:"style"===n||null;k(t,n,e[n],r)}return t}),{})}function k(t,e,n,r){if(!b(e))return;let i,o;if(x(n)&&!_(n))for(i in o=x(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?k(o,i,n[i]):b(i)&&(o[i]=n[i]);else t[e]=n}function A(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function M(t){return t[t.length-1]}function E(t){return null==t||""===t?null:+t}const D=t=>e=>t*Math.exp(e),C=t=>e=>Math.log(t*e),F=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),S=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,B=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function T(t,e,n,r){const i=n(t[0]),o=n(M(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function z(t,e){return T(t,e,E,h)}function N(t,e){var n=Math.sign(t[0]);return T(t,e,C(n),D(n))}function O(t,e,n){return T(t,e,B(n),B(1/n))}function R(t,e,n){return T(t,e,F(n),S(n))}function $(t,e,n,r,i){const o=r(t[0]),a=r(M(t)),u=null!=e?r(e):(o+a)/2;return[i(u+(o-u)*n),i(u+(a-u)*n)]}function q(t,e,n){return $(t,e,n,E,h)}function L(t,e,n){const r=Math.sign(t[0]);return $(t,e,n,C(r),D(r))}function U(t,e,n,r){return $(t,e,n,B(r),B(1/r))}function P(t,e,n,r){return $(t,e,n,F(r),S(r))}function j(t){return 1+~~(new Date(t).getMonth()/3)}function I(t){return 1+~~(new Date(t).getUTCMonth()/3)}function W(t){return null!=t?_(t)?t:[t]:[]}function H(t,e,n){let r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),r=o-i,r>=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function Y(t){return"function"==typeof t}function V(t,e,r){r=r||{},e=W(e)||[];const o=[],a=[],u={},s=r.comparator||X;return W(t).forEach(((t,n)=>{null!=t&&(o.push("descending"===e[n]?-1:1),a.push(t=Y(t)?t:c(t,null,r)),(i(t)||[]).forEach((t=>u[t]=1)))})),0===a.length?null:n(s(a,o),Object.keys(u))}const G=(t,e)=>(t<e||null==t)&&null!=e?-1:(t>e||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0),X=(t,e)=>1===t.length?J(t[0],e[0]):Z(t,e,t.length),J=(t,e)=>function(n,r){return G(t(n),t(r))*e},Z=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++u<n;)o=t[u],a=G(o(r),o(i));return a*e[u]});function Q(t){return Y(t)?t:()=>t}function K(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout((()=>(e(r),n=null)),t)}}function tt(t){for(let e,n,r=1,i=arguments.length;r<i;++r)for(n in e=arguments[r],e)t[n]=e[n];return t}function et(t,e){let n,r,i,o,a=0;if(t&&(n=t.length))if(null==e){for(r=t[a];a<n&&(null==r||r!=r);r=t[++a]);for(i=o=r;a<n;++a)r=t[a],null!=r&&(r<i&&(i=r),r>o&&(o=r))}else{for(r=e(t[a]);a<n&&(null==r||r!=r);r=e(t[++a]));for(i=o=r;a<n;++a)r=e(t[a]),null!=r&&(r<i&&(i=r),r>o&&(o=r))}return[i,o]}function nt(t,e){const n=t.length;let r,i,o,a,u,s=-1;if(null==e){for(;++s<n;)if(i=t[s],null!=i&&i>=i){r=o=i;break}if(s===n)return[-1,-1];for(a=u=s;++s<n;)i=t[s],null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}else{for(;++s<n;)if(i=e(t[s],s,t),null!=i&&i>=i){r=o=i;break}if(s===n)return[-1,-1];for(a=u=s;++s<n;)i=e(t[s],s,t),null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}return[a,u]}const rt=Object.prototype.hasOwnProperty;function it(t,e){return rt.call(t,e)}const ot={};function at(t){let e,n={};function r(t){return it(n,t)&&n[t]!==ot}const i={size:0,empty:0,object:n,has:r,get:t=>r(t)?n[t]:void 0,set(t,e){return r(t)||(++i.size,n[t]===ot&&--i.empty),n[t]=e,this},delete(t){return r(t)&&(--i.size,++i.empty,n[t]=ot),this},clear(){i.size=i.empty=0,i.object=n={}},test(t){return arguments.length?(e=t,i):e},clean(){const t={};let r=0;for(const i in n){const o=n[i];o===ot||e&&e(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=n=t}};return t&&Object.keys(t).forEach((e=>{i.set(e,t[e])})),i}function ut(t,e,n,r,i,o){if(!n&&0!==n)return o;const a=+n;let u,s=t[0],l=M(t);l<s&&(u=s,s=l,l=u),u=Math.abs(e-s);const c=Math.abs(l-e);return u<c&&u<=a?r:c<=a?i:o}function st(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),tt(r,n)}function lt(t,e,n,r){let i,o=e[0],a=e[e.length-1];return o>a&&(i=o,o=a,a=i),r=void 0===r||r,((n=void 0===n||n)?o<=t:o<t)&&(r?t<=a:t<a)}function ct(t){return"boolean"==typeof t}function ft(t){return"[object Date]"===Object.prototype.toString.call(t)}function ht(t){return t&&Y(t[Symbol.iterator])}function dt(t){return"number"==typeof t}function pt(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function gt(t){return"string"==typeof t}function mt(t,e,r){t&&(t=e?W(t).map((t=>t.replace(/\\(.)/g,"$1"))):W(t));const i=t&&t.length,a=r&&r.get||o,u=t=>a(e?[t]:l(t));let s;if(i)if(1===i){const e=u(t[0]);s=function(t){return""+e(t)}}else{const e=t.map(u);s=function(t){let n=""+e[0](t),r=0;for(;++r<i;)n+="|"+e[r](t);return n}}else s=function(){return""};return n(s,t,"key")}function yt(t,e){const n=t[0],r=M(t),i=+e;return i?1===i?r:n+i*(r-n):n}function vt(t){let e,n,r;t=+t||1e4;const i=()=>{e={},n={},r=0},o=(i,o)=>(++r>t&&(n=e,e={},r=1),e[i]=o);return i(),{clear:i,has:t=>it(e,t)||it(n,t),get:t=>it(e,t)?e[t]:it(n,t)?o(t,n[t]):void 0,set:(t,n)=>it(e,t)?e[t]=n:o(t,n)}}function _t(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let u=0,s=0,l=0;for(;u<i&&s<o;++l)a[l]=t(e[u],n[s])>0?n[s++]:e[u++];for(;u<i;++u,++l)a[l]=e[u];for(;s<o;++s,++l)a[l]=n[s];return a}function xt(t,e){let n="";for(;--e>=0;)n+=t;return n}function bt(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:"left"===r?xt(i,a)+o:"center"===r?xt(i,~~(a/2))+o+xt(i,Math.ceil(a/2)):o+xt(i,a)}function wt(t){return t&&M(t)-t[0]||0}function kt(t){return _(t)?"["+t.map(kt)+"]":x(t)||gt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function At(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}const Mt=t=>dt(t)||ft(t)?t:Date.parse(t);function Et(t,e){return e=e||Mt,null==t||""===t?null:e(t)}function Dt(t){return null==t||""===t?null:t+""}function Ct(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]]=!0;return e}function Ft(t,e,n,r){const i=null!=r?r:"…",o=t+"",a=o.length,u=Math.max(0,e-i.length);return a<=e?o:"left"===n?i+o.slice(a-u):"center"===n?o.slice(0,Math.ceil(u/2))+i+o.slice(a-~~(u/2)):o.slice(0,u)+i}function St(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const r=e(t[i]);r&&n(r,i,t)}}else t.forEach(n)}var Bt={},Tt={};function zt(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Nt(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function Ot(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Rt(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Ot(-t,6):t>9999?"+"+Ot(t,6):Ot(t,4)}(t.getUTCFullYear())+"-"+Ot(t.getUTCMonth()+1,2)+"-"+Ot(t.getUTCDate(),2)+(i?"T"+Ot(e,2)+":"+Ot(n,2)+":"+Ot(r,2)+"."+Ot(i,3)+"Z":r?"T"+Ot(e,2)+":"+Ot(n,2)+":"+Ot(r,2)+"Z":n||e?"T"+Ot(e,2)+":"+Ot(n,2)+"Z":"")}function $t(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,u=0,s=o<=0,l=!1;function c(){if(s)return Tt;if(l)return l=!1,Bt;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?s=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return s=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Tt;){for(var f=[];r!==Bt&&r!==Tt;)f.push(r),r=c();e&&null==(f=e(f,u++))||i.push(f)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Rt(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=zt(t);return function(r,i){return e(n(r),i,t)}}(t,e):zt(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Nt(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Nt(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}function qt(t){return t}function Lt(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return Ut(t,e)}))}:Ut(t,e)}function Ut(t,e){var n=e.id,r=e.bbox,i=null==e.properties?{}:e.properties,o=Pt(t,e);return null==n&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function Pt(t,e){var n=function(t){if(null==t)return qt;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,u){u||(e=n=0);var s=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*r+o,c[1]=(n+=t[1])*i+a;s<l;)c[s]=t[s],++s;return c}}(t.transform),r=t.arcs;function i(t,e){e.length&&e.pop();for(var i=r[t<0?~t:t],o=0,a=i.length;o<a;++o)e.push(n(i[o],o));t<0&&function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n}(e,a)}function o(t){return n(t)}function a(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function u(t){for(var e=a(t);e.length<4;)e.push(e[0]);return e}function s(t){return t.map(u)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=o(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(o);break;case"LineString":n=a(e.arcs);break;case"MultiLineString":n=e.arcs.map(a);break;case"Polygon":n=s(e.arcs);break;case"MultiPolygon":n=e.arcs.map(s);break;default:return null}return{type:r,coordinates:n}}(e)}function jt(t,e){var n={},r={},i={},o=[],a=-1;function u(t,e){for(var r in t){var i=t[r];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){n[t<0?~t:t]=1})),o.push(i)}}return e.forEach((function(n,r){var i,o=t.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++a],e[a]=n,e[r]=i)})),e.forEach((function(e){var n,o,a=function(e){var n,r=t.arcs[e<0?~e:e],i=r[0];t.transform?(n=[0,0],r.forEach((function(t){n[0]+=t[0],n[1]+=t[1]}))):n=r[r.length-1];return e<0?[n,i]:[i,n]}(e),u=a[0],s=a[1];if(n=i[u])if(delete i[n.end],n.push(e),n.end=s,o=r[s]){delete r[o.start];var l=o===n?n:n.concat(o);r[l.start=n.start]=i[l.end=o.end]=l}else r[n.start]=i[n.end]=n;else if(n=r[s])if(delete r[n.start],n.unshift(e),n.start=u,o=i[u]){delete i[o.end];var c=o===n?n:o.concat(n);r[c.start=o.start]=i[c.end=n.end]=c}else r[n.start]=i[n.end]=n;else r[(n=[e]).start=u]=i[n.end=s]=n})),u(i,r),u(r,i),e.forEach((function(t){n[t<0?~t:t]||o.push([t])})),o}function It(t){return Pt(t,Wt.apply(this,arguments))}function Wt(t,e,n){var r,i,o;if(arguments.length>1)r=Ht(t,e,n);else for(i=0,r=new Array(o=t.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:jt(t,r)}}function Ht(t,e,n){var r,i=[],o=[];function a(t){var e=t<0?~t:t;(o[e]||(o[e]=[])).push({i:t,g:r})}function u(t){t.forEach(a)}function s(t){t.forEach(u)}return function t(e){switch(r=e,e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":u(e.arcs);break;case"MultiLineString":case"Polygon":s(e.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(e.arcs)}}(e),o.forEach(null==n?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}function Yt(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Vt(t){let e=t,n=t;function r(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r<i;){const o=r+i>>>1;n(t[o],e)<0?r=o+1:i=o}return r}return 1===t.length&&(e=(e,n)=>t(e)-n,n=function(t){return(e,n)=>Yt(t(e),n)}(t)),{left:r,center:function(t,n,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=r(t,n,i,o-1);return a>i&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r<i;){const o=r+i>>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}function Gt(t){return null===t?NaN:+t}const Xt=Vt(Yt),Jt=Xt.right,Zt=Xt.left;Vt(Gt).center;var Qt=Jt;class Kt{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(e[n++]=a),t=o}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}var te=Math.sqrt(50),ee=Math.sqrt(10),ne=Math.sqrt(2);function re(t,e,n){var r,i,o,a,u=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((r=e<t)&&(i=t,t=e,e=i),0===(a=ie(t,e,n))||!isFinite(a))return[];if(a>0){let n=Math.round(t/a),r=Math.round(e/a);for(n*a<t&&++n,r*a>e&&--r,o=new Array(i=r-n+1);++u<i;)o[u]=(n+u)*a}else{a=-a;let n=Math.round(t*a),r=Math.round(e*a);for(n/a<t&&++n,r/a>e&&--r,o=new Array(i=r-n+1);++u<i;)o[u]=(n+u)/a}return r&&o.reverse(),o}function ie(t,e,n){var r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/Math.pow(10,i);return i>=0?(o>=te?10:o>=ee?5:o>=ne?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=te?10:o>=ee?5:o>=ne?2:1)}function oe(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=te?i*=10:o>=ee?i*=5:o>=ne&&(i*=2),e<t?-i:i}function ae(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function ue(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function se(t,e,n=0,r=t.length-1,i=Yt){for(;r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,u=Math.log(o),s=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*s*(o-s)/o)*(a-o/2<0?-1:1);se(t,e,Math.max(n,Math.floor(e-a*s/o+l)),Math.min(r,Math.floor(e+(o-a)*s/o+l)),i)}const o=t[e];let a=n,u=r;for(le(t,n,e),i(t[r],o)>0&&le(t,n,r);a<u;){for(le(t,a,u),++a,--u;i(t[a],o)<0;)++a;for(;i(t[u],o)>0;)--u}0===i(t[n],o)?le(t,n,u):(++u,le(t,u,r)),u<=e&&(n=u+1),e<=u&&(r=u-1)}return t}function le(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ce(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),r=t.length){if((e=+e)<=0||r<2)return ue(t);if(e>=1)return ae(t);var r,i=(r-1)*e,o=Math.floor(i),a=ae(se(t,o).subarray(0,o+1));return a+(ue(t.subarray(o+1))-a)*(i-o)}}function fe(t,e,n=Gt){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function he(t,e){return ce(t,.5,e)}function de(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function pe(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}function ge(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function me(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function ye(t){return(t=me(Math.abs(t)))?t[1]:NaN}var ve,_e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xe(t){if(!(e=_e.exec(t)))throw new Error("invalid format: "+t);var e;return new be({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function be(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function we(t,e){var n=me(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}xe.prototype=be.prototype,be.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var ke={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>we(100*t,e),r:we,s:function(t,e){var n=me(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(ve=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+me(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ae(t){return t}var Me,Ee,De,Ce=Array.prototype.map,Fe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Se(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ae:(e=Ce.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=e[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Ae:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ce.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=xe(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,y=t.trim,v=t.type;"n"===v?(g=!0,v="g"):ke[v]||(void 0===m&&(m=12),y=!0,v="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===h?o:/[%p]/.test(v)?s:"",b=ke[v],w=/[defgprs%]/.test(v);function k(t){var i,o,s,h=_,k=x;if("c"===v)k=b(t)+k,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),m),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==f&&(A=!1),h=(A?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===v?Fe[8+ve/3]:"")+k+(A&&"("===f?")":""),w)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+k.length,E=M<p?new Array(p-M+1).join(e):"";switch(g&&d&&(t=r(E+t,E.length?p-k.length:1/0),E=""),n){case"<":t=h+t+k+E;break;case"=":t=h+E+t+k;break;case"^":t=E.slice(0,M=E.length>>1)+h+t+k+E.slice(M);break;default:t=E+h+t+k}return u(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,e){var n=f(((t=xe(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ye(e)/3))),i=Math.pow(10,-r),o=Fe[8+r/3];return function(t){return n(i*t)+o}}}}function Be(t){return Math.max(0,-ye(Math.abs(t)))}function Te(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ye(e)/3)))-ye(Math.abs(t)))}function ze(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,ye(e)-ye(t))+1}!function(t){Me=Se(t),Ee=Me.format,De=Me.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});var Ne=new Date,Oe=new Date;function Re(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,o){var a,u=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return u;do{u.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return u},i.filter=function(n){return Re((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return Ne.setTime(+e),Oe.setTime(+r),t(Ne),t(Oe),Math.floor(n(Ne,Oe))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var $e=Re((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));$e.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Re((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):$e:null};var qe=$e;const Le=1e3,Ue=6e4,Pe=36e5,je=864e5,Ie=6048e5,We=2592e6,He=31536e6;var Ye=Re((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*Le)}),(function(t,e){return(e-t)/Le}),(function(t){return t.getUTCSeconds()})),Ve=Ye,Ge=Re((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Le)}),(function(t,e){t.setTime(+t+e*Ue)}),(function(t,e){return(e-t)/Ue}),(function(t){return t.getMinutes()})),Xe=Ge,Je=Re((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*Le-t.getMinutes()*Ue)}),(function(t,e){t.setTime(+t+e*Pe)}),(function(t,e){return(e-t)/Pe}),(function(t){return t.getHours()})),Ze=Je,Qe=Re((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Ue)/je),(t=>t.getDate()-1)),Ke=Qe;function tn(t){return Re((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Ue)/Ie}))}var en=tn(0),nn=tn(1);tn(2),tn(3);var rn=tn(4);tn(5),tn(6);var on=Re((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),an=on,un=Re((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));un.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Re((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var sn=un,ln=Re((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*Ue)}),(function(t,e){return(e-t)/Ue}),(function(t){return t.getUTCMinutes()})),cn=ln,fn=Re((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*Pe)}),(function(t,e){return(e-t)/Pe}),(function(t){return t.getUTCHours()})),hn=fn,dn=Re((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/je}),(function(t){return t.getUTCDate()-1})),pn=dn;function gn(t){return Re((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/Ie}))}var mn=gn(0),yn=gn(1);gn(2),gn(3);var vn=gn(4);gn(5),gn(6);var _n=Re((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),xn=_n,bn=Re((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));bn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Re((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var wn=bn;function kn(t,e,n,r,i,o){const a=[[Ve,1,Le],[Ve,5,5e3],[Ve,15,15e3],[Ve,30,3e4],[o,1,Ue],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,Pe],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,je],[r,2,1728e5],[n,1,Ie],[e,1,We],[e,3,7776e6],[t,1,He]];function u(e,n,r){const i=Math.abs(n-e)/r,o=Vt((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(oe(e/He,n/He,r));if(0===o)return qe.every(Math.max(oe(e,n,r),1));const[u,s]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return u.every(s)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:u(t,e,n),o=i?i.range(t,+e+1):[];return r?o.reverse():o},u]}const[An,Mn]=kn(wn,xn,mn,pn,hn,cn),[En,Dn]=kn(sn,an,en,Ke,Ze,Xe),Cn="year",Fn="quarter",Sn="month",Bn="week",Tn="date",zn="day",Nn="dayofyear",On="hours",Rn="minutes",$n="seconds",qn="milliseconds",Ln=[Cn,Fn,Sn,Bn,Tn,zn,Nn,On,Rn,$n,qn],Un=Ln.reduce(((t,e,n)=>(t[e]=1+n,t)),{});function Pn(t){const e=W(t).slice(),n={};e.length||s("Missing time unit."),e.forEach((t=>{it(Un,t)?n[t]=1:s(`Invalid time unit: ${t}.`)}));return(n.week||n.day?1:0)+(n.quarter||n.month||n.date?1:0)+(n.dayofyear?1:0)>1&&s(`Incompatible time units: ${t}`),e.sort(((t,e)=>Un[t]-Un[e])),e}const jn={[Cn]:"%Y ",[Fn]:"Q%q ",[Sn]:"%b ",[Tn]:"%d ",[Bn]:"W%U ",[zn]:"%a ",[Nn]:"%j ",[On]:"%H:00",[Rn]:"00:%M",[$n]:":%S",[qn]:".%L","year-month":"%Y-%m ","year-month-date":"%Y-%m-%d ","hours-minutes":"%H:%M"};function In(t,e){const n=tt({},jn,e),r=Pn(t),i=r.length;let o,a,u="",s=0;for(s=0;s<i;)for(o=r.length;o>s;--o)if(a=r.slice(s,o).join("-"),null!=n[a]){u+=n[a],s=o;break}return u.trim()}const Wn=new Date;function Hn(t){return Wn.setFullYear(t),Wn.setMonth(0),Wn.setDate(1),Wn.setHours(0,0,0,0),Wn}function Yn(t){return Gn(new Date(t))}function Vn(t){return Xn(new Date(t))}function Gn(t){return Ke.count(Hn(t.getFullYear())-1,t)}function Xn(t){return en.count(Hn(t.getFullYear())-1,t)}function Jn(t){return Hn(t).getDay()}function Zn(t,e,n,r,i,o,a){if(0<=t&&t<100){const u=new Date(-1,e,n,r,i,o,a);return u.setFullYear(t),u}return new Date(t,e,n,r,i,o,a)}function Qn(t){return tr(new Date(t))}function Kn(t){return er(new Date(t))}function tr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return pn.count(e-1,t)}function er(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return mn.count(e-1,t)}function nr(t){return Wn.setTime(Date.UTC(t,0,1)),Wn.getUTCDay()}function rr(t,e,n,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,e,n,r,i,o,a));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(t,e,n,r,i,o,a))}function ir(t,e,n,r,i){const o=e||1,a=M(t),u=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===a&&o,e),s=new Date,l=Ct(t),c=l.year?u(Cn):Q(2012),f=l.month?u(Sn):l.quarter?u(Fn):d,h=l.week&&l.day?u(zn,1,Bn+zn):l.week?u(Bn,1):l.day?u(zn,1):l.date?u(Tn,1):l.dayofyear?u(Nn,1):p,g=l.hours?u(On):d,m=l.minutes?u(Rn):d,y=l.seconds?u($n):d,v=l.milliseconds?u(qn):d;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),h(s,e),g(s),m(s),y(s),v(s))}}function or(t,e,n){return e+7*t-(n+6)%7}const ar={[Cn]:t=>t.getFullYear(),[Fn]:t=>Math.floor(t.getMonth()/3),[Sn]:t=>t.getMonth(),[Tn]:t=>t.getDate(),[On]:t=>t.getHours(),[Rn]:t=>t.getMinutes(),[$n]:t=>t.getSeconds(),[qn]:t=>t.getMilliseconds(),[Nn]:t=>Gn(t),[Bn]:t=>Xn(t),[Bn+zn]:(t,e)=>or(Xn(t),t.getDay(),Jn(e)),[zn]:(t,e)=>or(1,t.getDay(),Jn(e))},ur={[Fn]:t=>3*t,[Bn]:(t,e)=>or(t,0,Jn(e))};function sr(t,e){return ir(t,e||1,ar,ur,Zn)}const lr={[Cn]:t=>t.getUTCFullYear(),[Fn]:t=>Math.floor(t.getUTCMonth()/3),[Sn]:t=>t.getUTCMonth(),[Tn]:t=>t.getUTCDate(),[On]:t=>t.getUTCHours(),[Rn]:t=>t.getUTCMinutes(),[$n]:t=>t.getUTCSeconds(),[qn]:t=>t.getUTCMilliseconds(),[Nn]:t=>tr(t),[Bn]:t=>er(t),[zn]:(t,e)=>or(1,t.getUTCDay(),nr(e)),[Bn+zn]:(t,e)=>or(er(t),t.getUTCDay(),nr(e))},cr={[Fn]:t=>3*t,[Bn]:(t,e)=>or(t,0,nr(e))};function fr(t,e){return ir(t,e||1,lr,cr,rr)}const hr={[Cn]:sn,[Fn]:an.every(3),[Sn]:an,[Bn]:en,[Tn]:Ke,[zn]:Ke,[Nn]:Ke,[On]:Ze,[Rn]:Xe,[$n]:Ve,[qn]:qe},dr={[Cn]:wn,[Fn]:xn.every(3),[Sn]:xn,[Bn]:mn,[Tn]:pn,[zn]:pn,[Nn]:pn,[On]:hn,[Rn]:cn,[$n]:Ve,[qn]:qe};function pr(t){return hr[t]}function gr(t){return dr[t]}function mr(t,e,n){return t?t.offset(e,n):void 0}function yr(t,e,n){return mr(pr(t),e,n)}function vr(t,e,n){return mr(gr(t),e,n)}function _r(t,e,n,r){return t?t.range(e,n,r):void 0}function xr(t,e,n,r){return _r(pr(t),e,n,r)}function br(t,e,n,r){return _r(gr(t),e,n,r)}const wr=1e3,kr=6e4,Ar=36e5,Mr=864e5,Er=2592e6,Dr=31536e6,Cr=[Cn,Sn,Tn,On,Rn,$n,qn],Fr=Cr.slice(0,-1),Sr=Fr.slice(0,-1),Br=Sr.slice(0,-1),Tr=Br.slice(0,-1),zr=[Cn,Sn],Nr=[Cn],Or=[[Fr,1,wr],[Fr,5,5e3],[Fr,15,15e3],[Fr,30,3e4],[Sr,1,kr],[Sr,5,3e5],[Sr,15,9e5],[Sr,30,18e5],[Br,1,Ar],[Br,3,108e5],[Br,6,216e5],[Br,12,432e5],[Tr,1,Mr],[[Cn,Bn],1,6048e5],[zr,1,Er],[zr,3,7776e6],[Nr,1,Dr]];function Rr(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(wt(e))/n;let i,o,a=Vt((t=>t[2])).right(Or,r);return a===Or.length?(i=Nr,o=oe(e[0]/Dr,e[1]/Dr,n)):a?(a=Or[r/Or[a-1][2]<Or[a][2]/r?a-1:a],i=a[0],o=a[1]):(i=Cr,o=Math.max(oe(e[0],e[1],n),1)),{units:i,step:o}}function $r(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function qr(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Lr(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function Ur(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,l=Qr(i),c=Kr(i),f=Qr(o),h=Kr(o),d=Qr(a),p=Kr(a),g=Qr(u),m=Kr(u),y=Qr(s),v=Kr(s),_={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:xi,e:xi,f:Mi,g:Ri,G:qi,H:bi,I:wi,j:ki,L:Ai,m:Ei,M:Di,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:uo,s:so,S:Ci,u:Fi,U:Si,V:Ti,w:zi,W:Ni,x:null,X:null,y:Oi,Y:$i,Z:Li,"%":ao},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Ui,e:Ui,f:Hi,g:no,G:io,H:Pi,I:ji,j:Ii,L:Wi,m:Yi,M:Vi,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:uo,s:so,S:Gi,u:Xi,U:Ji,V:Qi,w:Ki,W:to,x:null,X:null,y:eo,Y:ro,Z:oo,"%":ao},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:ci,e:ci,f:mi,g:ai,G:oi,H:hi,I:hi,j:fi,L:gi,m:li,M:di,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c.get(r[0].toLowerCase()),n+r[0].length):-1},q:si,Q:vi,s:_i,S:pi,u:ei,U:ni,V:ri,w:ti,W:ii,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:ai,Y:oi,Z:ui,"%":yi};function w(t,e){return function(n){var r,i,o,a=[],u=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++u<l;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Yr[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,e){return function(n){var r,i,o=Lr(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=qr(Lr(o.y,0,1))).getUTCDay(),r=i>4||0===i?yn.ceil(r):yn(r),r=pn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=$r(Lr(o.y,0,1))).getDay(),r=i>4||0===i?nn.ceil(r):nn(r),r=Ke.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?qr(Lr(o.y,0,1)).getUTCDay():$r(Lr(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,qr(o)):$r(o)}}function A(t,e,n,r){for(var i,o,a=0,u=e.length,s=n.length;a<u;){if(r>=s)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=b[i in Yr?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=w(n,_),_.X=w(r,_),_.c=w(e,_),x.x=w(n,x),x.X=w(r,x),x.c=w(e,x),{format:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=k(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t+="",!0);return e.toString=function(){return t},e}}}var Pr,jr,Ir,Wr,Hr,Yr={"-":"",_:" ",0:"0"},Vr=/^\s*\d+/,Gr=/^%/,Xr=/[\\^$*+?|[\]().{}]/g;function Jr(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function Zr(t){return t.replace(Xr,"\\$&")}function Qr(t){return new RegExp("^(?:"+t.map(Zr).join("|")+")","i")}function Kr(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function ti(t,e,n){var r=Vr.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function ei(t,e,n){var r=Vr.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ni(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ri(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function ii(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function oi(t,e,n){var r=Vr.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function ai(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function ui(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function si(t,e,n){var r=Vr.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function li(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function ci(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function fi(t,e,n){var r=Vr.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function hi(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function di(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function pi(t,e,n){var r=Vr.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function gi(t,e,n){var r=Vr.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function mi(t,e,n){var r=Vr.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function yi(t,e,n){var r=Gr.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function vi(t,e,n){var r=Vr.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function _i(t,e,n){var r=Vr.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function xi(t,e){return Jr(t.getDate(),e,2)}function bi(t,e){return Jr(t.getHours(),e,2)}function wi(t,e){return Jr(t.getHours()%12||12,e,2)}function ki(t,e){return Jr(1+Ke.count(sn(t),t),e,3)}function Ai(t,e){return Jr(t.getMilliseconds(),e,3)}function Mi(t,e){return Ai(t,e)+"000"}function Ei(t,e){return Jr(t.getMonth()+1,e,2)}function Di(t,e){return Jr(t.getMinutes(),e,2)}function Ci(t,e){return Jr(t.getSeconds(),e,2)}function Fi(t){var e=t.getDay();return 0===e?7:e}function Si(t,e){return Jr(en.count(sn(t)-1,t),e,2)}function Bi(t){var e=t.getDay();return e>=4||0===e?rn(t):rn.ceil(t)}function Ti(t,e){return t=Bi(t),Jr(rn.count(sn(t),t)+(4===sn(t).getDay()),e,2)}function zi(t){return t.getDay()}function Ni(t,e){return Jr(nn.count(sn(t)-1,t),e,2)}function Oi(t,e){return Jr(t.getFullYear()%100,e,2)}function Ri(t,e){return Jr((t=Bi(t)).getFullYear()%100,e,2)}function $i(t,e){return Jr(t.getFullYear()%1e4,e,4)}function qi(t,e){var n=t.getDay();return Jr((t=n>=4||0===n?rn(t):rn.ceil(t)).getFullYear()%1e4,e,4)}function Li(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Jr(e/60|0,"0",2)+Jr(e%60,"0",2)}function Ui(t,e){return Jr(t.getUTCDate(),e,2)}function Pi(t,e){return Jr(t.getUTCHours(),e,2)}function ji(t,e){return Jr(t.getUTCHours()%12||12,e,2)}function Ii(t,e){return Jr(1+pn.count(wn(t),t),e,3)}function Wi(t,e){return Jr(t.getUTCMilliseconds(),e,3)}function Hi(t,e){return Wi(t,e)+"000"}function Yi(t,e){return Jr(t.getUTCMonth()+1,e,2)}function Vi(t,e){return Jr(t.getUTCMinutes(),e,2)}function Gi(t,e){return Jr(t.getUTCSeconds(),e,2)}function Xi(t){var e=t.getUTCDay();return 0===e?7:e}function Ji(t,e){return Jr(mn.count(wn(t)-1,t),e,2)}function Zi(t){var e=t.getUTCDay();return e>=4||0===e?vn(t):vn.ceil(t)}function Qi(t,e){return t=Zi(t),Jr(vn.count(wn(t),t)+(4===wn(t).getUTCDay()),e,2)}function Ki(t){return t.getUTCDay()}function to(t,e){return Jr(yn.count(wn(t)-1,t),e,2)}function eo(t,e){return Jr(t.getUTCFullYear()%100,e,2)}function no(t,e){return Jr((t=Zi(t)).getUTCFullYear()%100,e,2)}function ro(t,e){return Jr(t.getUTCFullYear()%1e4,e,4)}function io(t,e){var n=t.getUTCDay();return Jr((t=n>=4||0===n?vn(t):vn.ceil(t)).getUTCFullYear()%1e4,e,4)}function oo(){return"+0000"}function ao(){return"%"}function uo(t){return+t}function so(t){return Math.floor(+t/1e3)}function lo(t){const e={};return n=>e[n]||(e[n]=t(n))}function co(t){const e=lo(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=xe(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return r=e(n),i=e(".1f")(1)[1],t=>{const e=r(t),n=e.indexOf(i);if(n<0)return e;let o=function(t,e){let n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if(n=t.charCodeAt(r),n>=48&&n<=57)return r+1}(e,n);const a=o<e.length?e.slice(o):"";for(;--o>n;)if("0"!==e[o]){++o;break}return e.slice(0,o)+a}}return e(n);var r,i},formatSpan(t,r,i,o){o=xe(null==o?",f":o);const a=oe(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==o.precision)switch(o.type){case"s":return isNaN(s=Te(a,u))||(o.precision=s),n(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=ze(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=Be(a))||(o.precision=s-2*("%"===o.type))}return e(o)}}}let fo,ho;function po(){return fo=co({format:Ee,formatPrefix:De})}function go(t){return co(Se(t))}function mo(t){return arguments.length?fo=go(t):fo}function yo(t,e,n){x(n=n||{})||s(`Invalid time multi-format specifier: ${n}`);const r=e($n),i=e(Rn),o=e(On),a=e(Tn),u=e(Bn),l=e(Sn),c=e(Fn),f=e(Cn),h=t(n.milliseconds||".%L"),d=t(n.seconds||":%S"),p=t(n.minutes||"%I:%M"),g=t(n.hours||"%I %p"),m=t(n.date||n.day||"%a %d"),y=t(n.week||"%b %d"),v=t(n.month||"%B"),_=t(n.quarter||"%B"),b=t(n.year||"%Y");return t=>(r(t)<t?h:i(t)<t?d:o(t)<t?p:a(t)<t?g:l(t)<t?u(t)<t?m:y:f(t)<t?c(t)<t?v:_:b)(t)}function vo(t){const e=lo(t.format),n=lo(t.utcFormat);return{timeFormat:t=>gt(t)?e(t):yo(e,pr,t),utcFormat:t=>gt(t)?n(t):yo(n,gr,t),timeParse:lo(t.parse),utcParse:lo(t.utcParse)}}function _o(){return ho=vo({format:jr,parse:Ir,utcFormat:Wr,utcParse:Hr})}function xo(t){return vo(Ur(t))}function bo(t){return arguments.length?ho=xo(t):ho}!function(t){Pr=Ur(t),jr=Pr.format,Ir=Pr.parse,Wr=Pr.utcFormat,Hr=Pr.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),po(),_o();const wo=(t,e)=>tt({},t,e);function ko(t,e){const n=t?go(t):mo(),r=e?xo(e):bo();return wo(n,r)}function Ao(t,e){const n=arguments.length;return n&&2!==n&&s("defaultLocale expects either zero or two arguments."),n?wo(mo(t),bo(e)):wo(mo(),bo())}const Mo=/^(data:|([A-Za-z]+:)?\/\/)/,Eo=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Do=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Co="file://";async function Fo(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e)}async function So(t,e){e=tt({},this.options,e);const n=this.fileAccess,r={href:null};let i,o,a;const u=Eo.test(t.replace(Do,""));null!=t&&"string"==typeof t&&u||s("Sanitize failure, invalid URI: "+kt(t));const l=Mo.test(t);return(a=e.baseURL)&&!l&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith(Co))||"file"===e.mode||"http"!==e.mode&&!l&&n,i?t=t.slice(Co.length):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),o=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,e.target&&(r.target=e.target+""),e.rel&&(r.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(r.crossOrigin=e.crossOrigin+""),r}function Bo(t){return t?e=>new Promise(((n,r)=>{t.readFile(e,((t,e)=>{t?r(t):n(e)}))})):To}async function To(){s("No file system access.")}function zo(t){return t?async function(e,n){const r=tt({},this.options.http,n),i=n&&n.response,o=await t(e,r);return o.ok?Y(o[i])?o[i]():o.text():s(o.status+""+o.statusText)}:No}async function No(){s("No HTTP fetch method available.")}const Oo=t=>!(Number.isNaN(+t)||t instanceof Date),Ro={boolean:At,integer:E,number:E,date:Et,string:Dt,unknown:h},$o=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>Oo(t)&&Number.isInteger(+t),Oo,t=>!Number.isNaN(Date.parse(t))],qo=["boolean","integer","number","date"];function Lo(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=$o.length,i=$o.map(((t,e)=>e+1));for(let a,u,s=0,l=0;s<n;++s)for(u=e?t[s][e]:t[s],a=0;a<r;++a)if(i[a]&&(null!=(o=u)&&o==o)&&!$o[a](u)&&(i[a]=0,++l,l===$o.length))return"string";var o;return qo[i.reduce(((t,e)=>0===t?e:t),0)-1]}function Uo(t,e){return e.reduce(((e,n)=>(e[n]=Lo(t,n),e)),{})}function Po(t){const e=function(e,n){const r={delimiter:t};return jo(e,n?tt(n,r):r)};return e.responseType="text",e}function jo(t,e){return e.header&&(t=e.header.map(kt).join(e.delimiter)+"\n"+t),$t(e.delimiter).parse(t+"")}function Io(t,e){const n=e&&e.property?c(e.property):h;return!x(t)||(r=t,"function"==typeof Buffer&&Y(Buffer.isBuffer)&&Buffer.isBuffer(r))?n(JSON.parse(t)):function(t,e){!_(t)&&ht(t)&&(t=[...t]);return e&&e.copy?JSON.parse(JSON.stringify(t)):t}(n(t),e);var r}jo.responseType="text",Io.responseType="json";const Wo={interior:(t,e)=>t!==e,exterior:(t,e)=>t===e};function Ho(t,e){let n,r,i,o;return t=Io(t,e),e&&e.feature?(n=Lt,i=e.feature):e&&e.mesh?(n=It,i=e.mesh,o=Wo[e.filter]):s("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?n(t,r,o):s("Invalid TopoJSON object: "+i),r&&r.features||[r]}Ho.responseType="json";const Yo={dsv:jo,csv:Po(","),tsv:Po("\t"),json:Io,topojson:Ho};function Vo(t,e){return arguments.length>1?(Yo[t]=e,this):it(Yo,t)?Yo[t]:null}function Go(t){const e=Vo(t);return e&&e.responseType||"text"}function Xo(t,e,n,r){const i=Vo((e=e||{}).type||"json");return i||s("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=bo();n=n||i.timeParse,r=r||i.utcParse;let o,a,u,s,l,c,f=t.columns||Object.keys(t[0]);"auto"===e&&(e=Uo(t,f));f=Object.keys(e);const h=f.map((t=>{const i=e[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:"))){o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===o[0]?r:n)(a)}if(!Ro[i])throw Error("Illegal format pattern: "+t+":"+i);return Ro[i]}));for(u=0,l=t.length,c=f.length;u<l;++u)for(o=t[u],s=0;s<c;++s)a=f[s],o[a]=h[s](o[a])}(t,e.parse,n,r),it(t,"columns")&&delete t.columns,t}const Jo=function(t,e){return n=>({options:n||{},sanitize:So,load:Fo,fileAccess:!!e,file:Bo(e),http:zo(t)})}("undefined"!=typeof fetch&&fetch,null);function Zo(t){const e=t||h,n=[],r={};return n.add=t=>{const i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=t=>{const i=e(t);if(r[i]){r[i]=0;const e=n.indexOf(t);e>=0&&n.splice(e,1)}return n},n}async function Qo(t,e){try{await e(t)}catch(e){t.error(e)}}const Ko=Symbol("vega_id");let ta=1;function ea(t){return!(!t||!na(t))}function na(t){return t[Ko]}function ra(t,e){return t[Ko]=e,t}function ia(t){const e=t===Object(t)?t:{data:t};return na(e)?e:ra(e,ta++)}function oa(t){return aa(t,ia({}))}function aa(t,e){for(const n in t)e[n]=t[n];return e}function ua(t,e){return ra(e,na(t))}function sa(t,e){return t?e?(n,r)=>t(n,r)||na(e(n))-na(e(r)):(e,n)=>t(e,n)||na(e)-na(n):null}function la(t){return t&&t.constructor===ca}function ca(){const t=[],e=[],n=[],r=[],i=[];let o=null,a=!1;return{constructor:ca,insert(e){const n=W(e),r=n.length;for(let e=0;e<r;++e)t.push(n[e]);return this},remove(t){const n=Y(t)?r:e,i=W(t),o=i.length;for(let t=0;t<o;++t)n.push(i[t]);return this},modify(t,e,r){const o={field:e,value:Q(r)};return Y(t)?(o.filter=t,i.push(o)):(o.tuple=t,n.push(o)),this},encode(t,e){return Y(t)?i.push({filter:t,field:e}):n.push({tuple:t,field:e}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(u,s){const l={},c={};let f,h,d,p,g,m;for(f=0,h=s.length;f<h;++f)l[na(s[f])]=1;for(f=0,h=e.length;f<h;++f)g=e[f],l[na(g)]=-1;for(f=0,h=r.length;f<h;++f)p=r[f],s.forEach((t=>{p(t)&&(l[na(t)]=-1)}));for(f=0,h=t.length;f<h;++f)g=t[f],m=na(g),l[m]?l[m]=1:u.add.push(ia(t[f]));for(f=0,h=s.length;f<h;++f)g=s[f],l[na(g)]<0&&u.rem.push(g);function y(t,e,n){n?t[e]=n(t):u.encode=e,a||(c[na(t)]=t)}for(f=0,h=n.length;f<h;++f)d=n[f],g=d.tuple,p=d.field,m=l[na(g)],m>0&&(y(g,p,d.value),u.modifies(p));for(f=0,h=i.length;f<h;++f)d=i[f],p=d.filter,s.forEach((t=>{p(t)&&l[na(t)]>0&&y(t,d.field,d.value)})),u.modifies(d.field);if(a)u.mod=e.length||r.length?s.filter((t=>l[na(t)]>0)):s.slice();else for(m in c)u.mod.push(c[m]);return(o||null==o&&(e.length||r.length))&&u.clean(!0),u}}}const fa="_:mod:_";function ha(){Object.defineProperty(this,fa,{writable:!0,value:{}})}ha.prototype={set(t,e,n,r){const i=this,o=i[t],a=i[fa];return null!=e&&e>=0?(o[e]!==n||r)&&(o[e]=n,a[e+":"+t]=-1,a[t]=-1):(o!==n||r)&&(i[t]=n,a[t]=_(n)?1+n.length:-1),i},modified(t,e){const n=this[fa];if(!arguments.length){for(const t in n)if(n[t])return!0;return!1}if(_(t)){for(let e=0;e<t.length;++e)if(n[t[e]])return!0;return!1}return null!=e&&e>=0?e+1<n[t]||!!n[e+":"+t]:!!n[t]},clear(){return this[fa]={},this}};let da=0;const pa=new ha;function ga(t,e,n,r){this.id=++da,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}function ma(t){return function(e){const n=this.flags;return 0===arguments.length?!!(n&t):(this.flags=e?n|t:n&~t,this)}}ga.prototype={targets(){return this._targets||(this._targets=Zo(f))},set(t){return this.value!==t?(this.value=t,1):0},skip:ma(1),modified:ma(2),parameters(t,e,n){e=!1!==e;const r=this._argval=this._argval||new ha,i=this._argops=this._argops||[],o=[];let a,u,l,c;const f=(t,n,a)=>{a instanceof ga?(a!==this&&(e&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:n})):r.set(t,n,a)};for(a in t)if(u=t[a],"pulse"===a)W(u).forEach((t=>{t instanceof ga?t!==this&&(t.targets().add(this),o.push(t)):s("Pulse parameters must be operator instances.")})),this.source=u;else if(_(u))for(r.set(a,-1,Array(l=u.length)),c=0;c<l;++c)f(a,c,u[c]);else f(a,-1,u);return this.marshall().clear(),n&&(i.initonly=!0),o},marshall(t){const e=this._argval||pa,n=this._argops;let r,i,o,a;if(n){const u=n.length;for(i=0;i<u;++i)r=n[i],o=r.op,a=o.modified()&&o.stamp===t,e.set(r.name,r.index,o.value,a);if(n.initonly){for(i=0;i<u;++i)r=n[i],r.op.targets().remove(this);this._argops=null,this._update=null}}return e},detach(){const t=this._argops;let e,n,r,i;if(t)for(e=0,n=t.length;e<n;++e)r=t[e],i=r.op,i._targets&&i._targets.remove(this);this.pulse=null,this.source=null},evaluate(t){const e=this._update;if(e){const n=this.marshall(t.stamp),r=e.call(this,n,t);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.pulse=e||t}};let ya=0;function va(t,e,n){this.id=++ya,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function _a(t,e,n){return new va(t,e,n)}va.prototype={_filter:g,_apply:h,targets(){return this._targets||(this._targets=Zo(f))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const e=this.value=this._apply(t),n=this._targets,r=n?n.length:0;for(let t=0;t<r;++t)n[t].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const e=_a(t);return this.targets().add(e),e},apply(t){const e=_a(null,t);return this.targets().add(e),e},merge(){const t=_a();this.targets().add(t);for(let e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},throttle(t){let e=-1;return this.filter((()=>{const n=Date.now();return n-e>t?(e=n,1):0}))},debounce(t){const e=_a();return this.targets().add(_a(null,null,K(t,(t=>{const n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},between(t,e){let n=!1;return t.targets().add(_a(null,null,(()=>n=!0))),e.targets().add(_a(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=g,this._targets=null}};const xa={skip:!0};function ba(t,e,n,r,i,o){const a=tt({},o,xa);let u,s;Y(n)||(n=Q(n)),void 0===r?u=e=>t.touch(n(e)):Y(r)?(s=new ga(null,r,i,!1),u=e=>{s.evaluate(e);const r=n(e),i=s.value;la(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=e=>t.update(n(e),r,a),e.apply(u)}function wa(t,e,n,r,i,o){if(void 0===r)e.targets().add(n);else{const a=o||{},u=new ga(null,function(t,e){return e=Y(e)?e:Q(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);u.modified(a.force),u.rank=e.rank,e.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),t.connect(n,[u]))}}const ka={};function Aa(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function Ma(t,e){const n=[];return St(t,e,(t=>n.push(t))),n}function Ea(t,e){const n={};return t.visit(e,(t=>{n[na(t)]=1})),t=>n[na(t)]?null:t}function Da(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function Ca(t,e,n,r){const i=this;let o=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(const t of n)if(t.stamp===e){if(t.fields){const e=i.fields||(i.fields={});for(const n in t.fields)e[n]=1}t.changed(i.ADD)&&(o|=i.ADD),t.changed(i.REM)&&(o|=i.REM),t.changed(i.MOD)&&(o|=i.MOD)}this.changes=o}function Fa(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Aa.prototype={StopPropagation:ka,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(t){return new Aa(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new Aa(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,e){const n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source,t.cleans&&(n.cleans=t.cleans)),n},runAfter(t){this.dataflow.runAfter(t)},changed(t){const e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,Ea(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const e=this.fields||(this.fields={});return _(t)?t.forEach((t=>e[t]=!0)):e[t]=!0,this},modified(t,e){const n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?_(t)?t.some((t=>n[t])):n[t]:!!n)},filter(t,e){const n=this;return 1&t&&(n.addF=Da(n.addF,e)),2&t&&(n.remF=Da(n.remF,e)),4&t&&(n.modF=Da(n.modF,e)),16&t&&(n.srcF=Da(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=Ma(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Ma(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Ma(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},visit(t,e){const n=this,r=e;if(16&t)return St(n.source,n.srcF,r),n;1&t&&St(n.add,n.addF,r),2&t&&St(n.rem,n.remF,r),4&t&&St(n.mod,n.modF,r);const i=n.source;if(8&t&&i){const t=n.add.length+n.mod.length;t===i.length||St(i,t?Ea(n,5):n.srcF,r)}return n}},st(Ca,Aa,{fork(t){const e=new Aa(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(t=>e.add.push(t))),t&e.REM&&this.visit(e.REM,(t=>e.rem.push(t))),t&e.MOD&&this.visit(e.MOD,(t=>e.mod.push(t)))),e},changed(t){return this.changes&t},modified(t){const e=this,n=e.fields;return n&&e.changes&e.MOD?_(t)?t.some((t=>n[t])):n[t]:0},filter(){s("MultiPulse does not support filtering.")},materialize(){s("MultiPulse does not support materialization.")},visit(t,e){const n=this,r=n.pulses,i=r.length;let o=0;if(t&n.SOURCE)for(;o<i;++o)r[o].visit(t,e);else for(;o<i;++o)r[o].stamp===n.stamp&&r[o].visit(t,e);return n}});const Sa={skip:!1,force:!1};function Ba(t){let e=[];return{clear:()=>e=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),Ta(e,0,e.length-1,t)),pop:()=>{const n=e.pop();let r;return e.length?(r=e[0],e[0]=n,function(t,e,n){const r=e,i=t.length,o=t[e];let a,u=1+(e<<1);for(;u<i;)a=u+1,a<i&&n(t[u],t[a])>=0&&(u=a),t[e]=t[u],u=1+((e=u)<<1);t[e]=o,Ta(t,r,e,n)}(e,0,t)):r=n,r}}}function Ta(t,e,n,r){let i,o;const a=t[n];for(;n>e&&(o=n-1>>1,i=t[o],r(a,i)<0);)t[n]=i,n=o;return t[n]=a}function za(){this.logger(v()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Ao();try{this._loader=Jo()}catch(t){}this._touched=Zo(f),this._input={},this._pulse=null,this._heap=Ba(((t,e)=>t.qrank-e.qrank)),this._postrun=[]}function Na(t){return function(){return this._log[t].apply(this,arguments)}}function Oa(t,e){ga.call(this,t,null,e)}za.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:Na("error"),warn:Na("warn"),info:Na("info"),debug:Na("debug"),logLevel:Na("level"),cleanThreshold:1e4,add:function(t,e,n,r){let i,o=1;return t instanceof ga?i=t:t&&t.prototype instanceof ga?i=new t:Y(t)?i=new ga(null,t):(o=0,i=new ga(t,e)),this.rank(i),o&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},connect:function(t,e){const n=t.rank,r=e.length;for(let i=0;i<r;++i)if(n<e[i].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const e=[t];let n,r,i;for(;e.length;)if(this.rank(n=e.pop()),r=n._targets)for(i=r.length;--i>=0;)e.push(n=r[i]),n===t&&s("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||Sa);const r=new Aa(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},touch:function(t,e){const n=e||Sa;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||Sa;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:ca,ingest:function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},parse:function(t,e){const n=this.locale();return Xo(t,e,n.timeParse,n.utcParse)},preload:async function(t,e,n){const r=this,i=r._pending||function(t){let e;const n=new Promise((t=>e=t));return n.requests=0,n.done=()=>{0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const o=await r.request(e,n);return r.pulse(t,r.changeset().remove(g).insert(o.data||[])),i.done(),o},request:async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:Go(e&&e.type)});try{r=n.parse(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},events:function(t,e,n,r){const i=this,o=_a(n,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):W(t);const s=u.length;for(let t=0;t<s;++t)u[t].addEventListener(e,a);return o},on:function(t,e,n,r,i){return(t instanceof ga?wa:ba)(this,t,e,n,r,i),this},evaluate:async function(t,e,n){const r=this,i=[];if(r._pulse)return Fa(r);if(r._pending&&await r._pending,e&&await Qo(r,e),!r._touched.length)return r.debug("Dataflow invoked, but nothing to do."),r;const o=++r._clock;r._pulse=new Aa(r,o,t),r._touched.forEach((t=>r._enqueue(t,!0))),r._touched=Zo(f);let a,u,s,l=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,t)),u.then?u=await u:u.async&&(i.push(u.async),u=ka),u!==ka&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++l):r._enqueue(a,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${l} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort(((t,e)=>e.priority-t.priority));r._postrun=[];for(let e=0;e<t.length;++e)await Qo(r,t[e].callback)}return n&&await Qo(r,n),i.length&&Promise.all(i).then((t=>r.runAsync(null,(()=>{t.forEach((t=>{try{t(r)}catch(t){r.error(t)}}))})))),r},run:function(t,e,n){return this._pulse?Fa(this):(this.evaluate(t,e,n),this)},runAsync:async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},runAfter:function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,e){const n=t.stamp<this._clock;n&&(t.stamp=this._clock),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,e){const n=t.source,r=this._clock;return n&&_(n)?new Ca(this,r,n.map((t=>t.pulse)),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==ka&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)}},st(Oa,ga,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?this.skip(!1):e=this.evaluate(t),e=e||t,e.then?e=e.then((t=>this.pulse=t)):e!==t.StopPropagation&&(this.pulse=e),e},evaluate(t){const e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},transform(){}});const Ra={};function $a(t){const e=qa(t);return e&&e.Definition||null}function qa(t){return t=t&&t.toLowerCase(),it(Ra,t)?Ra[t]:null}function*La(t,e){if(null==e)for(let e of t)null!=e&&""!==e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)r=e(r,++n,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function Ua(t,e,n){const r=Float64Array.from(La(t,n));return r.sort(Yt),e.map((t=>fe(r,t)))}function Pa(t,e){return Ua(t,[.25,.5,.75],e)}function ja(t,e){const n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let u of t)null!=(u=e(u,++a,t))&&(u=+u)>=u&&(n=u-i,i+=n/++r,o+=n*(u-i))}if(r>1)return o/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=Pa(t,e),o=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,o)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function Ia(t){const e=t.maxbins||20,n=t.base||10,r=Math.log(n),i=t.divide||[5,2];let o,a,u,s,l,c,f=t.extent[0],h=t.extent[1];const d=t.span||h-f||Math.abs(f)||1;if(t.step)o=t.step;else if(t.steps){for(s=d/e,l=0,c=t.steps.length;l<c&&t.steps[l]<s;++l);o=t.steps[Math.max(0,l-1)]}else{for(a=Math.ceil(Math.log(e)/r),u=t.minstep||0,o=Math.max(u,Math.pow(n,Math.round(Math.log(d)/r)-a));Math.ceil(d/o)>e;)o*=n;for(l=0,c=i.length;l<c;++l)s=o/i[l],s>=u&&d/s<=e&&(o=s)}s=Math.log(o);const p=s>=0?0:1+~~(-s/r),g=Math.pow(n,-p-1);return(t.nice||void 0===t.nice)&&(s=Math.floor(f/o+g)*o,f=f<s?s-o:s,h=Math.ceil(h/o)*o),{start:f,stop:h===f?f+o:h,step:o}}function Wa(e,n,r,i){if(!e.length)return[void 0,void 0];const o=Float64Array.from(La(e,i)),a=o.length,u=n;let s,l,c,f;for(c=0,f=Array(u);c<u;++c){for(s=0,l=0;l<a;++l)s+=o[~~(t.random()*a)];f[c]=s/a}return f.sort(Yt),[ce(f,r/2),ce(f,1-r/2)]}function Ha(t,e,n,r){r=r||(t=>t);const i=t.length,o=new Float64Array(i);let a,u=0,s=1,l=r(t[0]),c=l,f=l+e;for(;s<i;++s){if(a=r(t[s]),a>=f){for(c=(l+c)/2;u<s;++u)o[u]=c;f=a+e,l=a}c=a}for(c=(l+c)/2;u<s;++u)o[u]=c;return n?function(t,e){const n=t.length;let r,i,o=0,a=1;for(;t[o]===t[a];)++a;for(;a<n;){for(r=a+1;t[a]===t[r];)++r;if(t[a]-t[a-1]<e){for(i=a+(o+r-a-a>>1);i<a;)t[i++]=t[a];for(;i>a;)t[i--]=t[o]}o=a,a=r}return t}(o,e+e/4):o}t.random=Math.random;const Ya=Math.sqrt(2*Math.PI),Va=Math.SQRT2;let Ga=NaN;function Xa(e,n){e=e||0,n=null==n?1:n;let r,i,o=0,a=0;if(Ga==Ga)o=Ga,Ga=NaN;else{do{o=2*t.random()-1,a=2*t.random()-1,r=o*o+a*a}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),o*=i,Ga=a*i}return e+o*n}function Ja(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*Ya)}function Za(t,e,n){const r=(t-(e=e||0))/(n=null==n?1:n),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let e;i<7.07106781186547?(e=.0352624965998911*i+.700383064443688,e=e*i+6.37396220353165,e=e*i+33.912866078383,e=e*i+112.079291497871,e=e*i+221.213596169931,e=e*i+220.206867912376,o=t*e,e=.0883883476483184*i+1.75566716318264,e=e*i+16.064177579207,e=e*i+86.7807322029461,e=e*i+296.564248779674,e=e*i+637.333633378831,e=e*i+793.826512519948,e=e*i+440.413735824752,o/=e):(e=i+.65,e=i+4/e,e=i+3/e,e=i+2/e,e=i+1/e,o=t/e/2.506628274631)}return r>0?1-o:o}function Qa(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*Va*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function Ka(t,e){let n,r;const i={mean(t){return arguments.length?(n=t||0,i):n},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Xa(n,r),pdf:t=>Ja(t,n,r),cdf:t=>Za(t,n,r),icdf:t=>Qa(t,n,r)};return i.mean(t).stdev(e)}function tu(e,n){const r=Ka();let i=0;const o={data(t){return arguments.length?(e=t,i=t?t.length:0,o.bandwidth(n)):e},bandwidth(t){return arguments.length?(!(n=t)&&e&&(n=ja(e)),o):n},sample:()=>e[~~(t.random()*i)]+n*r.sample(),pdf(t){let o=0,a=0;for(;a<i;++a)o+=r.pdf((t-e[a])/n);return o/n/i},cdf(t){let o=0,a=0;for(;a<i;++a)o+=r.cdf((t-e[a])/n);return o/i},icdf(){throw Error("KDE icdf not supported.")}};return o.data(e)}function eu(t,e){return t=t||0,e=null==e?1:e,Math.exp(t+Xa()*e)}function nu(t,e,n){if(t<=0)return 0;e=e||0,n=null==n?1:n;const r=(Math.log(t)-e)/n;return Math.exp(-.5*r*r)/(n*Ya*t)}function ru(t,e,n){return Za(Math.log(t),e,n)}function iu(t,e,n){return Math.exp(Qa(t,e,n))}function ou(t,e){let n,r;const i={mean(t){return arguments.length?(n=t||0,i):n},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>eu(n,r),pdf:t=>nu(t,n,r),cdf:t=>ru(t,n,r),icdf:t=>iu(t,n,r)};return i.mean(t).stdev(e)}function au(e,n){let r,i=0;const o={weights(t){return arguments.length?(r=function(t){const e=[];let n,r=0;for(n=0;n<i;++n)r+=e[n]=null==t[n]?1:+t[n];for(n=0;n<i;++n)e[n]/=r;return e}(n=t||[]),o):n},distributions(t){return arguments.length?(t?(i=t.length,e=t):(i=0,e=[]),o.weights(n)):e},sample(){const n=t.random();let o=e[i-1],a=r[0],u=0;for(;u<i-1;a+=r[++u])if(n<a){o=e[u];break}return o.sample()},pdf(t){let n=0,o=0;for(;o<i;++o)n+=r[o]*e[o].pdf(t);return n},cdf(t){let n=0,o=0;for(;o<i;++o)n+=r[o]*e[o].cdf(t);return n},icdf(){throw Error("Mixture icdf not supported.")}};return o.distributions(e).weights(n)}function uu(e,n){return null==n&&(n=null==e?1:e,e=0),e+(n-e)*t.random()}function su(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=e&&t<=n?1/(n-e):0}function lu(t,e,n){return null==n&&(n=null==e?1:e,e=0),t<e?0:t>n?1:(t-e)/(n-e)}function cu(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function fu(t,e){let n,r;const i={min(t){return arguments.length?(n=t||0,i):n},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>uu(n,r),pdf:t=>su(t,n,r),cdf:t=>lu(t,n,r),icdf:t=>cu(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function hu(t,e,n,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-o*t,o]}function du(t,e,n,r){t=t.filter((t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,n)=>e(t)-e(n)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,l,c=0,f=0,h=0;for(l of t)o[c]=u=+e(l),a[c]=s=+n(l),++c,f+=(u-f)/c,h+=(s-h)/c;for(c=0;c<i;++c)o[c]-=f,a[c]-=h;return[o,a,f,h]}function pu(t,e,n,r){let i,o,a=-1;for(const u of t)i=e(u),o=n(u),null!=i&&(i=+i)>=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function gu(t,e,n,r,i){let o=0,a=0;return pu(t,e,n,((t,e)=>{const n=e-i(t),u=e-r;o+=n*n,a+=u*u})),1-o/a}function mu(t,e,n){let r=0,i=0,o=0,a=0,u=0;pu(t,e,n,((t,e)=>{++u,r+=(t-r)/u,i+=(e-i)/u,o+=(t*e-o)/u,a+=(t*t-a)/u}));const s=hu(r,i,o,a),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:gu(t,e,n,i,l)}}function yu(t,e,n){let r=0,i=0,o=0,a=0,u=0;pu(t,e,n,((t,e)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(e-i)/u,o+=(t*e-o)/u,a+=(t*t-a)/u}));const s=hu(r,i,o,a),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:gu(t,e,n,i,l)}}function vu(t,e,n){const[r,i,o,a]=du(t,e,n);let u,s,l,c=0,f=0,h=0,d=0,p=0;pu(t,e,n,((t,e)=>{u=r[p++],s=Math.log(e),l=u*e,c+=(e*s-c)/p,f+=(l-f)/p,h+=(l*s-h)/p,d+=(u*l-d)/p}));const[g,m]=hu(f/a,c/a,h/a,d/a),y=t=>Math.exp(g+m*(t-o));return{coef:[Math.exp(g-m*o),m],predict:y,rSquared:gu(t,e,n,a,y)}}function _u(t,e,n){let r=0,i=0,o=0,a=0,u=0,s=0;pu(t,e,n,((t,e)=>{const n=Math.log(t),l=Math.log(e);++s,r+=(n-r)/s,i+=(l-i)/s,o+=(n*l-o)/s,a+=(n*n-a)/s,u+=(e-u)/s}));const l=hu(r,i,o,a),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:gu(t,e,n,u,c)}}function xu(t,e,n){const[r,i,o,a]=du(t,e,n),u=r.length;let s,l,c,f,h=0,d=0,p=0,g=0,m=0;for(s=0;s<u;)l=r[s],c=i[s++],f=l*l,h+=(f-h)/s,d+=(f*l-d)/s,p+=(f*f-p)/s,g+=(l*c-g)/s,m+=(f*c-m)/s;const y=p-h*h,v=h*y-d*d,_=(m*h-g*d)/v,x=(g*y-m*d)/v,b=-_*h,w=t=>_*(t-=o)*t+x*t+b+a;return{coef:[b-x*o+_*o*o+a,x-2*_*o,_],predict:w,rSquared:gu(t,e,n,a,w)}}function bu(t,e,n,r){if(1===r)return mu(t,e,n);if(2===r)return xu(t,e,n);const[i,o,a,u]=du(t,e,n),s=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;h<f;++h){for(p=0,g=0;p<s;++p)g+=Math.pow(i[p],h)*o[p];for(l.push(g),m=new Float64Array(f),d=0;d<f;++d){for(p=0,g=0;p<s;++p)g+=Math.pow(i[p],h+d);m[d]=g}c.push(m)}c.push(l);const y=function(t){const e=t.length-1,n=[];let r,i,o,a,u;for(r=0;r<e;++r){for(a=r,i=r+1;i<e;++i)Math.abs(t[r][i])>Math.abs(t[r][a])&&(a=i);for(o=r;o<e+1;++o)u=t[o][r],t[o][r]=t[o][a],t[o][a]=u;for(i=r+1;i<e;++i)for(o=e;o>=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(u=0,o=i+1;o<e;++o)u+=t[o][i]*n[o];n[i]=(t[e][i]-u)/t[i][i]}return n}(c),v=t=>{t-=a;let e=u+y[0]+y[1]*t+y[2]*t*t;for(h=3;h<f;++h)e+=y[h]*Math.pow(t,h);return e};return{coef:wu(f,y,-a,u),predict:v,rSquared:gu(t,e,n,u,v)}}function wu(t,e,n,r){const i=Array(t);let o,a,u,s;for(o=0;o<t;++o)i[o]=0;for(o=t-1;o>=0;--o)for(u=e[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(n,a)*s;return i[0]+=r,i}function ku(t,e,n,r){const[i,o,a,u]=du(t,e,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;t<s;++t){const n=i[t],r=e[0],a=e[1],u=n-i[r]>i[a]-n?r:a;let s=0,l=0,d=0,p=0,g=0;const m=1/Math.abs(i[u]-n||1);for(let t=r;t<=a;++t){const e=i[t],r=o[t],a=Au(Math.abs(n-e)*m)*h[t],u=e*a;s+=a,l+=u,d+=r*a,p+=r*u,g+=e*u}const[y,v]=hu(l/s,d/s,p/s,g/s);c[t]=y+v*n,f[t]=Math.abs(o[t]-c[t]),Mu(i,t+1,e)}if(2===t)break;const n=he(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r<s;++r)t=f[r]/(6*n),h[r]=t>=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,o=[];let a,u=0,s=0,l=[];for(;u<i;++u)a=t[u]+n,l[0]===a?l[1]+=(e[u]-l[1])/++s:(s=0,l[1]+=r,l=[a,e[u]],o.push(l));return l[1]+=r,o}(i,c,a,u)}function Au(t){return(t=1-t*t*t)*t*t}function Mu(t,e,n){const r=t[e];let i=n[0],o=n[1]+1;if(!(o>=t.length))for(;e>i&&t[o]-r<=r-t[i];)n[0]=++i,n[1]=o,++o}const Eu=.5*Math.PI/180;function Du(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],o=e[0],a=e[1],u=a-o,s=u/r,l=[i(o)],c=[];if(n===r){for(let t=1;t<r;++t)l.push(i(o+t/n*u));return l.push(i(a)),l}c.push(i(a));for(let t=n;--t>0;)c.push(i(o+t/n*u));let f=l[0],h=c[c.length-1];const d=1/u,p=function(t,e){let n=t,r=t;const i=e.length;for(let t=0;t<i;++t){const i=e[t][1];i<n&&(n=i),i>r&&(r=i)}return 1/(r-n)}(f[1],c);for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&Cu(f,t,h,d,p)>Eu?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function Cu(t,e,n,r,i){const o=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0])),a=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0]));return Math.abs(o-a)}function Fu(t){return t&&t.length?1===t.length?t[0]:(e=t,t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r<n;++r)i+="|"+e[r](t);return i}):function(){return""};var e}function Su(t,e,n){return n||t+(e?"_"+e:"")}const Bu=()=>{},Tu={init:Bu,add:Bu,rem:Bu,idx:0},zu={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.sum,add:(t,e)=>t.sum+=+e,rem:(t,e)=>t.sum-=e},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,e)=>t.product*=e,rem:(t,e)=>t.product/=e},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,e)=>(t.mean_d=e-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,e)=>(t.mean_d=e-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,e)=>t.dev+=t.mean_d*(e-t.mean),rem:(t,e)=>t.dev-=t.mean_d*(e-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,e)=>{(e<t.min||void 0===t.min)&&(t.min=e)},rem:(t,e)=>{e<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,e)=>{(e>t.max||void 0===t.max)&&(t.max=e)},rem:(t,e)=>{e>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,e,n)=>{e<t.min&&(t.argmin=n)},rem:(t,e)=>{e<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,e,n)=>{e>t.max&&(t.argmax=n)},rem:(t,e)=>{e>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3}},Nu=Object.keys(zu);function Ou(t,e){return zu[t](e)}function Ru(t,e){return t.idx-e.idx}function $u(){this.valid=0,this.missing=0,this._ops.forEach((t=>t.init(this)))}function qu(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((n=>n.add(this,t,e)))):++this.missing}function Lu(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((n=>n.rem(this,t,e)))):--this.missing}function Uu(t){return this._out.forEach((e=>t[e.out]=e.value(this))),t}function Pu(t,e){const n=e||h,r=function(t){const e={};t.forEach((t=>e[t.name]=t));const n=t=>{t.req&&t.req.forEach((t=>{e[t]||n(e[t]=zu[t]())}))};return t.forEach(n),Object.values(e).sort(Ru)}(t),i=t.slice().sort(Ru);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=$u,o.prototype.add=qu,o.prototype.rem=Lu,o.prototype.set=Uu,o.prototype.get=n,o.fields=t.map((t=>t.out)),o}function ju(t){this._key=t?c(t):na,this.reset()}Nu.forEach((t=>{zu[t]=function(t,e){return n=>tt({name:t,out:n||t},Tu,e)}(t,zu[t])}));const Iu=ju.prototype;function Wu(t){Oa.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Iu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Iu.add=function(t){this._add.push(t)},Iu.rem=function(t){this._rem.push(t)},Iu.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,e=this._rem,n=this._key,r=t.length,i=e.length,o=Array(r-i),a={};let u,s,l;for(u=0;u<i;++u)a[n(e[u])]=1;for(u=0,s=0;u<r;++u)a[n(l=t[u])]?a[n(l)]=0:o[s++]=l;return this._rem=[],this._add=o},Iu.distinct=function(t){const e=this.values(),n={};let r,i=e.length,o=0;for(;--i>=0;)r=t(e[i])+"",it(n,r)||(n[r]=1,++o);return o},Iu.extent=function(t){if(this._get!==t||!this._ext){const e=this.values(),n=nt(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},Iu.argmin=function(t){return this.extent(t)[0]||{}},Iu.argmax=function(t){return this.extent(t)[1]||{}},Iu.min=function(t){const e=this.extent(t)[0];return null!=e?t(e):void 0},Iu.max=function(t){const e=this.extent(t)[1];return null!=e?t(e):void 0},Iu.quartile=function(t){return this._get===t&&this._q||(this._q=Pa(this.values(),t),this._get=t),this._q},Iu.q1=function(t){return this.quartile(t)[0]},Iu.q2=function(t){return this.quartile(t)[1]},Iu.q3=function(t){return this.quartile(t)[2]},Iu.ci=function(t){return this._get===t&&this._ci||(this._ci=Wa(this.values(),1e3,.05,t),this._get=t),this._ci},Iu.ci0=function(t){return this.ci(t)[0]},Iu.ci1=function(t){return this.ci(t)[1]},Wu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Nu},{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"}]},st(Wu,Oa,{transform(t,e){const n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):{},e.visit(e.SOURCE,(t=>n.add(t)))):(n.value=n.value||n.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),e.clean()&&n._drop&&r.clean(!0).runAfter((()=>this.clean())),n.changes(r)},cross(){const t=this,e=t.value,n=t._dnames,r=n.map((()=>({}))),i=n.length;function o(t){let e,o,a,u;for(e in t)for(a=t[e].tuple,o=0;o<i;++o)r[o][u=a[n[o]]]=u}o(t._prev),o(e),function o(a,u,s){const l=n[s],c=r[s++];for(const n in c){const r=a?a+"|"+n:n;u[l]=c[n],s<i?o(r,u,s):e[r]||t.cell(r,u)}}("",{},0)},init(t){const e=this._inputs=[],n=this._outputs=[],o={};function a(t){const n=W(i(t)),r=n.length;let a,u=0;for(;u<r;++u)o[a=n[u]]||(o[a]=1,e.push(a))}this._dims=W(t.groupby),this._dnames=this._dims.map((t=>{const e=r(t);return a(t),n.push(e),e})),this.cellkey=t.key?t.key:Fu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const u=t.fields||[null],l=t.ops||["count"],c=t.as||[],f=u.length,h={};let d,p,g,m,y,v;for(f!==l.length&&s("Unmatched number of fields and aggregate ops."),v=0;v<f;++v)d=u[v],p=l[v],null==d&&"count"!==p&&s("Null aggregate field specified."),m=r(d),y=Su(p,m,c[v]),n.push(y),"count"!==p?(g=h[m],g||(a(d),g=h[m]=[],g.field=d,this._measures.push(g)),"count"!==p&&(this._countOnly=!1),g.push(Ou(p,y))):this._counts.push(y);return this._measures=this._measures.map((t=>Pu(t,t.field))),{}},cellkey:Fu(),cell(t,e){let n=this.value[t];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[t]=this.newcell(t,e),this._adds[this._alen++]=n),n},newcell(t,e){const n={key:t,num:0,agg:null,tuple:this.newtuple(e,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){const t=this._measures,e=t.length;n.agg=Array(e);for(let r=0;r<e;++r)n.agg[r]=new t[r](n)}return n.store&&(n.data=new ju),n},newtuple(t,e){const n=this._dnames,r=this._dims,i=r.length,o={};for(let e=0;e<i;++e)o[n[e]]=r[e](t);return e?ua(e.tuple,o):ia(o)},clean(){const t=this.value;for(const e in t)0===t[e].num&&delete t[e]},add(t){const e=this.cellkey(t),n=this.cell(e,t);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(t);const r=n.agg;for(let e=0,n=r.length;e<n;++e)r[e].add(r[e].get(t),t)},rem(t){const e=this.cellkey(t),n=this.cell(e,t);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(t);const r=n.agg;for(let e=0,n=r.length;e<n;++e)r[e].rem(r[e].get(t),t)},celltuple(t){const e=t.tuple,n=this._counts;t.store&&t.data.values();for(let r=0,i=n.length;r<i;++r)e[n[r]]=t.num;if(!this._countOnly){const n=t.agg;for(let t=0,r=n.length;t<r;++t)n[t].set(e)}return e},changes(t){const e=this._adds,n=this._mods,r=this._prev,i=this._drop,o=t.add,a=t.rem,u=t.mod;let s,l,c,f;if(r)for(l in r)s=r[l],i&&!s.num||a.push(s.tuple);for(c=0,f=this._alen;c<f;++c)o.push(this.celltuple(e[c])),e[c]=null;for(c=0,f=this._mlen;c<f;++c)s=n[c],(0===s.num&&i?a:u).push(this.celltuple(s)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,t}});function Hu(t){Oa.call(this,null,t)}function Yu(t,e,n){const r=t;let i=e||[],o=n||[],a={},u=0;return{add:t=>o.push(t),remove:t=>a[r(t)]=++u,size:()=>i.length,data:(t,e)=>(u&&(i=i.filter((t=>!a[r(t)])),a={},u=0),e&&t&&i.sort(t),o.length&&(i=t?_t(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function Vu(t){Oa.call(this,[],t)}function Gu(t){ga.call(this,null,Xu,t)}function Xu(t){return this.value&&!t.modified()?this.value:V(t.fields,t.orders)}function Ju(t){Oa.call(this,null,t)}function Zu(t){Oa.call(this,null,t)}Hu.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"]}]},st(Hu,Oa,{transform(t,e){const n=!1!==t.interval,r=this._bins(t),o=r.start,a=r.step,u=t.as||["bin0","bin1"],s=u[0],l=u[1];let c;return c=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(i(t.field))?e.ADD_MOD:e.ADD,e.visit(c,n?t=>{const e=r(t);t[s]=e,t[l]=null==e?null:o+a*(1+(e-o)/a)}:t=>t[s]=r(t)),e.modifies(n?u:s)},_bins(t){if(this.value&&!t.modified())return this.value;const e=t.field,o=Ia(t),a=o.step;let u,s,l=o.start,c=l+Math.ceil((o.stop-l)/a)*a;null!=(u=t.anchor)&&(s=u-(l+a*Math.floor((u-l)/a)),l+=s,c+=s);const f=function(t){let n=E(e(t));return null==n?null:n<l?-1/0:n>c?1/0:(n=Math.max(l,Math.min(n,c-a)),l+a*Math.floor(1e-14+(n-l)/a))};return f.start=l,f.stop=o.stop,f.step=a,this.value=n(f,i(e),t.name||"bin_"+r(e))}}),Vu.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},st(Vu,Oa,{transform(t,e){const n=e.fork(e.ALL),r=Yu(na,this.value,n.materialize(n.ADD).add),i=t.sort,o=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(sa(i),o),e.source&&e.source.root&&(this.value.root=e.source.root),n}}),st(Gu,ga),Ju.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"]}]},st(Ju,Oa,{transform(t,e){const n=e=>n=>{for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(u(n),t.case,o)||[],s=0,l=i.length;s<l;++s)a.test(r=i[s])||e(r)},r=this._parameterCheck(t,e),i=this._counts,o=this._match,a=this._stop,u=t.field,s=t.as||["text","count"],l=n((t=>i[t]=1+(i[t]||0))),c=n((t=>i[t]-=1));return r?e.visit(e.SOURCE,l):(e.visit(e.ADD,l),e.visit(e.REM,c)),this._finish(e,s)},_parameterCheck(t,e){let n=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),n=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),n=!0),(t.modified("field")||e.modified(t.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(t,e){const n=this._counts,r=this._tuples||(this._tuples={}),i=e[0],o=e[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let u,s,l;for(u in n)s=r[u],l=n[u]||0,!s&&l?(r[u]=s=ia({}),s[i]=u,s[o]=l,a.add.push(s)):0===l?(s&&a.rem.push(s),n[u]=null,r[u]=null):s[o]!==l&&(s[o]=l,a.mod.push(s));return a.modifies(e)}}),Zu.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},st(Zu,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter");let u=this.value;return a?(u&&(n.rem=u),u=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,o,a=[],u={},s=t.length,l=0;l<s;++l)for(u[e]=o=t[l],i=0;i<s;++i)u[n]=t[i],r(u)&&(a.push(ia(u)),(u={})[e]=o);return a}(u,i,o,t.filter||g)):n.mod=u,n.source=this.value,n.modifies(r)}});const Qu={kde:tu,mixture:au,normal:Ka,lognormal:ou,uniform:fu},Ku="function";function ts(t,e){const n=t.function;it(Qu,n)||s("Unknown distribution function: "+n);const r=Qu[n]();for(const n in t)"field"===n?r.data((t.from||e()).map(t[n])):"distributions"===n?r[n](t[n].map((t=>ts(t,e)))):typeof r[n]===Ku&&r[n](t[n]);return r}function es(t){Oa.call(this,null,t)}const ns=[{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}]}],rs={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ns},{name:"weights",type:"number",array:!0}]};function is(t,e){return t?t.map(((t,n)=>e[n]||r(t))):null}function os(t,e,n){const r=[],i=t=>t(s);let o,a,u,s,l,c;if(null==e)r.push(t.map(n));else for(o={},a=0,u=t.length;a<u;++a)s=t[a],l=e.map(i),c=o[l],c||(o[l]=c=[],c.dims=l,r.push(c)),c.push(n(s));return r}es.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:ns.concat(rs)},{name:"as",type:"string",array:!0,default:["value","density"]}]},st(es,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const r=ts(t.distribution,function(t){return()=>t.materialize(t.SOURCE).source}(e)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&s("Invalid density method: "+a),t.extent||r.data||s("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],l=Du(a,t.extent||et(r.data()),i,o).map((t=>{const e={};return e[u[0]]=t[0],e[u[1]]=t[1],ia(e)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function as(t){Oa.call(this,null,t)}as.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 us(t){ga.call(this,null,ss,t),this.modified(!0)}function ss(t){const e=t.expr;return this.value&&!t.modified("expr")?this.value:n((n=>e(n,t)),i(e),r(e))}function ls(t){Oa.call(this,[void 0,void 0],t)}function cs(t,e){ga.call(this,t),this.parent=e,this.count=0}function fs(t){Oa.call(this,{},t),this._keys=at();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;n<r;++n)t(e[n],n,e)}}function hs(t){ga.call(this,null,ds,t)}function ds(t){return this.value&&!t.modified()?this.value:_(t.name)?W(t.name).map((t=>c(t))):c(t.name,t.as)}function ps(t){Oa.call(this,at(),t)}function gs(t){Oa.call(this,[],t)}function ms(t){Oa.call(this,[],t)}function ys(t){Oa.call(this,null,t)}function vs(t){Oa.call(this,[],t)}st(as,Oa,{transform(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=os(e.source,t.groupby,h),i=t.smooth||!1,o=t.field,a=t.step||((t,e)=>wt(et(t,e))/30)(n,o),u=sa(((t,e)=>o(t)-o(e))),s=t.as||"bin",l=r.length;let c,f=1/0,d=-1/0,p=0;for(;p<l;++p){const t=r[p].sort(u);c=-1;for(const e of Ha(t,a,i,o))e<f&&(f=e),e>d&&(d=e),t[++c][s]=e}return this.value={start:f,stop:d,step:a},e.reflow(!0).modifies(s)}}),st(us,ga),ls.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},st(ls,Oa,{transform(t,e){const n=this.value,i=t.field,o=e.changed()||e.modified(i.fields)||t.modified("field");let a=n[0],u=n[1];if((o||null==a)&&(a=1/0,u=-1/0),e.visit(o?e.SOURCE:e.ADD,(t=>{const e=E(i(t));null!=e&&(e<a&&(a=e),e>u&&(u=e))})),!Number.isFinite(a)||!Number.isFinite(u)){let t=r(i);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${a}, ${u}]`),a=u=void 0}this.value=[a,u]}}),st(cs,ga,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),st(fs,Oa,{activate(t){this._targets[this._targets.active++]=t},subflow(t,e,n,r){const i=this.value;let o,a,u=it(i,t)&&i[t];return u?u.value.stamp<n.stamp&&(u.init(n),this.activate(u)):(a=r||(a=this._group[t])&&a.tuple,o=n.dataflow,u=new cs(n.fork(n.NO_SOURCE),this),o.add(u).connect(e(o,t,a)),i[t]=u,this.activate(u)),u},clean(){const t=this.value;let e=0;for(const n in t)if(0===t[n].count){const r=t[n].detachSubflow;r&&r(),delete t[n],++e}if(e){const t=this._targets.filter((t=>t&&t.count>0));this.initTargets(t)}},initTargets(t){const e=this._targets,n=e.length,r=t?t.length:0;let i=0;for(;i<r;++i)e[i]=t[i];for(;i<n&&null!=e[i];++i)e[i]=null;e.active=r},transform(t,e){const n=e.dataflow,r=t.key,i=t.subflow,o=this._keys,a=t.modified("key"),u=t=>this.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,(t=>{const e=na(t),n=o.get(e);void 0!==n&&(o.delete(e),u(n).rem(t))})),e.visit(e.ADD,(t=>{const e=r(t);o.set(na(t),e),u(e).add(t)})),a||e.modified(r.fields)?e.visit(e.MOD,(t=>{const e=na(t),n=o.get(e),i=r(t);n===i?u(i).mod(t):(o.set(e,i),u(n).rem(t),u(i).add(t))})):e.changed(e.MOD)&&e.visit(e.MOD,(t=>{u(o.get(na(t))).mod(t)})),a&&e.visit(e.REFLOW,(t=>{const e=na(t),n=o.get(e),i=r(t);n!==i&&(o.set(e,i),u(n).rem(t),u(i).add(t))})),e.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),e}}),st(hs,ga),ps.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},st(ps,Oa,{transform(t,e){const n=e.dataflow,r=this.value,i=e.fork(),o=i.add,a=i.rem,u=i.mod,s=t.expr;let l=!0;function c(e){const n=na(e),i=s(e,t),c=r.get(n);i&&c?(r.delete(n),o.push(e)):i||c?l&&i&&!c&&u.push(e):(r.set(n,1),a.push(e))}return e.visit(e.REM,(t=>{const e=na(t);r.has(e)?r.delete(e):a.push(t)})),e.visit(e.ADD,(e=>{s(e,t)?o.push(e):r.set(na(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),gs.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}]},st(gs,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=is(r,t.as||[]),o=t.index||null,a=i.length;return n.rem=this.value,e.visit(e.SOURCE,(t=>{const e=r.map((e=>e(t))),u=e.reduce(((t,e)=>Math.max(t,e.length)),0);let s,l,c,f=0;for(;f<u;++f){for(l=oa(t),s=0;s<a;++s)l[i[s]]=null==(c=e[s][f])?null:c;o&&(l[o]=f),n.add.push(l)}})),this.value=n.source=n.add,o&&n.modifies(o),n.modifies(i)}}),ms.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"]}]},st(ms,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE),i=t.fields,o=i.map(r),a=t.as||["key","value"],u=a[0],s=a[1],l=i.length;return n.rem=this.value,e.visit(e.SOURCE,(t=>{for(let e,r=0;r<l;++r)e=oa(t),e[u]=o[r],e[s]=i[r](t),n.add.push(e)})),this.value=n.source=n.add,n.modifies(a)}}),ys.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},st(ys,Oa,{transform(t,e){const n=t.expr,r=t.as,i=t.modified(),o=t.initonly?e.ADD:i?e.SOURCE:e.modified(n.fields)||e.modified(r)?e.ADD_MOD:e.ADD;return i&&(e=e.materialize().reflow(!0)),t.initonly||e.modifies(r),e.visit(o,(e=>e[r]=n(e,t)))}}),st(vs,Oa,{transform(t,e){const n=e.fork(e.ALL),r=t.generator;let i,o,a,u=this.value,s=t.size-u.length;if(s>0){for(i=[];--s>=0;)i.push(a=ia(r(t))),u.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(i):i}else o=u.slice(0,-s),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,u=u.slice(-s);return n.source=this.value=u,n}});const _s={value:"value",median:he,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:ue,max:ae},xs=[];function bs(t){Oa.call(this,[],t)}function ws(t){Wu.call(this,t)}function ks(t){Oa.call(this,null,t)}function As(t){ga.call(this,null,Ms,t)}function Ms(t){return this.value&&!t.modified()?this.value:mt(t.fields,t.flat)}function Es(t){Oa.call(this,[],t),this._pending=null}function Ds(t,e,n){n.forEach(ia);const r=e.fork(e.NO_FIELDS&e.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=n,t._pending=null,r.rem.length&&r.clean(!0),r}function Cs(t){Oa.call(this,{},t)}function Fs(t){ga.call(this,null,Ss,t)}function Ss(t){if(this.value&&!t.modified())return this.value;const e=t.extents,n=e.length;let r,i,o=1/0,a=-1/0;for(r=0;r<n;++r)i=e[r],i[0]<o&&(o=i[0]),i[1]>a&&(a=i[1]);return[o,a]}function Bs(t){ga.call(this,null,Ts,t)}function Ts(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,e)=>t.concat(e)),[])}function zs(t){Oa.call(this,null,t)}function Ns(t){Wu.call(this,t)}function Os(t){fs.call(this,t)}function Rs(t){Oa.call(this,null,t)}function $s(t){Oa.call(this,null,t)}function qs(t){Oa.call(this,null,t)}bs.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}]},st(bs,Oa,{transform(t,e){var n,i,o,a,u,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||_s.value;if(null!=_s[n])return n===_s.value?(e=void 0!==t.value?t.value:0,()=>e):_s[n];s("Unrecognized imputation method: "+n)}(t),m=function(t){const e=t.field;return t=>t?e(t):NaN}(t),y=r(t.field),v=r(t.key),_=(t.groupby||[]).map(r),x=function(t,e,n,r){var i,o,a,u,s,l,c,f,h=t=>t(f),d=[],p=r?r.slice():[],g={},m={};for(p.forEach(((t,e)=>g[t]=e+1)),u=0,c=t.length;u<c;++u)l=n(f=t[u]),s=g[l]||(g[l]=p.push(l)),(a=m[o=(i=e?e.map(h):xs)+""])||(a=m[o]=[],d.push(a),a.values=i),a[s-1]=f;return d.domain=p,d}(e.source,t.groupby,t.key,t.keyvals),b=[],w=this.value,k=x.domain.length;for(u=0,f=x.length;u<f;++u)for(o=(n=x[u]).values,i=NaN,c=0;c<k;++c)if(null==n[c]){for(a=x.domain[c],d={_impute:!0},l=0,h=o.length;l<h;++l)d[_[l]]=o[l];d[v]=a,d[y]=Number.isNaN(i)?i=g(n,m):i,b.push(ia(d))}return b.length&&(p.add=p.materialize(p.ADD).add.concat(b)),w.length&&(p.rem=p.materialize(p.REM).rem.concat(w)),this.value=b,p}}),ws.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:Nu},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},st(ws,Wu,{transform(t,e){const n=this,r=t.modified();let i;return n.value&&(r||e.modified(n._inputs,!0))?(i=n.value=r?n.init(t):{},e.visit(e.SOURCE,(t=>n.add(t)))):(i=n.value=n.value||this.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),n.changes(),e.visit(e.SOURCE,(t=>{tt(t,i[n.cellkey(t)].tuple)})),e.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,e=this._mods;let n,r;for(n=0,r=this._alen;n<r;++n)this.celltuple(t[n]),t[n]=null;for(n=0,r=this._mlen;n<r;++n)this.celltuple(e[n]),e[n]=null;this._alen=this._mlen=0}}),ks.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"]}]},st(ks,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const i=e.materialize(e.SOURCE).source,o=os(i,t.groupby,t.field),a=(t.groupby||[]).map(r),u=t.bandwidth,l=t.cumulative?"cdf":"pdf",c=t.as||["value","density"],f=[];let h=t.extent,d=t.steps||t.minsteps||25,p=t.steps||t.maxsteps||200;"pdf"!==l&&"cdf"!==l&&s("Invalid density method: "+l),"shared"===t.resolve&&(h||(h=et(i,t.field)),d=p=t.steps||p),o.forEach((e=>{const n=tu(e,u)[l],r=t.counts?e.length:1;Du(n,h||et(e),d,p).forEach((t=>{const n={};for(let t=0;t<a.length;++t)n[a[t]]=e.dims[t];n[c[0]]=t[0],n[c[1]]=t[1]*r,f.push(ia(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}}),st(As,ga),st(Es,Oa,{transform(t,e){const n=e.dataflow;if(this._pending)return Ds(this,e,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return e.StopPropagation;if(t.values)return Ds(this,e,n.parse(t.values,t.format));if(t.async){const e=n.request(t.url,t.format).then((t=>(this._pending=W(t.data),t=>t.touch(this))));return{async:e}}return n.request(t.url,t.format).then((t=>Ds(this,e,W(t.data))))}}),Cs.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}]},st(Cs,Oa,{transform(t,e){const n=t.fields,i=t.index,o=t.values,a=null==t.default?null:t.default,u=t.modified(),l=n.length;let c,f,h,d=u?e.SOURCE:e.ADD,p=e,g=t.as;return o?(f=o.length,l>1&&!g&&s('Multi-field lookup requires explicit "as" parameter.'),g&&g.length!==l*f&&s('The "as" parameter has too few output field names.'),g=g||o.map(r),c=function(t){for(var e,r,u=0,s=0;u<l;++u)if(null==(r=i.get(n[u](t))))for(e=0;e<f;++e,++s)t[g[s]]=a;else for(e=0;e<f;++e,++s)t[g[s]]=o[e](r)}):(g||s("Missing output field names."),c=function(t){for(var e,r=0;r<l;++r)e=i.get(n[r](t)),t[g[r]]=null==e?a:e}),u?p=e.reflow(!0):(h=n.some((t=>e.modified(t.fields))),d|=h?e.MOD:0),e.visit(d,c),p.modifies(g)}}),st(Fs,ga),st(Bs,ga),st(zs,Oa,{transform(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),Ns.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:Nu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},st(Ns,Wu,{_transform:Wu.prototype.transform,transform(t,e){return this._transform(function(t,e){const r=t.field,o=t.value,a=("count"===t.op?"__count__":t.op)||"sum",u=i(r).concat(i(o)),s=function(t,e,n){const r={},i=[];return n.visit(n.SOURCE,(e=>{const n=t(e);r[n]||(r[n]=1,i.push(n))})),i.sort(G),e?i.slice(0,e):i}(r,t.limit||0,e);e.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:s.map((()=>a)),fields:s.map((t=>function(t,e,r,i){return n((n=>e(n)===t?r(n):NaN),i,t+"")}(t,r,o,u))),as:s.map((t=>t+"")),modified:t.modified.bind(t)}}(t,e),e)}}),st(Os,fs,{transform(t,e){const n=t.subflow,r=t.field,o=t=>this.subflow(na(t),n,e,t);return(t.modified("field")||r&&e.modified(i(r)))&&s("PreFacet does not support field modification."),this.initTargets(),r?(e.visit(e.MOD,(t=>{const e=o(t);r(t).forEach((t=>e.mod(t)))})),e.visit(e.ADD,(t=>{const e=o(t);r(t).forEach((t=>e.add(ia(t))))})),e.visit(e.REM,(t=>{const e=o(t);r(t).forEach((t=>e.rem(t)))}))):(e.visit(e.MOD,(t=>o(t).mod(t))),e.visit(e.ADD,(t=>o(t).add(t))),e.visit(e.REM,(t=>o(t).rem(t)))),e.clean()&&e.runAfter((()=>this.clean())),e}}),Rs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},st(Rs,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=is(t.fields,t.as||[]),o=r?(t,e)=>function(t,e,n,r){for(let i=0,o=n.length;i<o;++i)e[r[i]]=n[i](t);return e}(t,e,r,i):aa;let a;return this.value?a=this.value:(e=e.addAll(),a=this.value={}),e.visit(e.REM,(t=>{const e=na(t);n.rem.push(a[e]),a[e]=null})),e.visit(e.ADD,(t=>{const e=o(t,ia({}));a[na(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{n.mod.push(o(t,a[na(t)]))})),n}}),st($s,Oa,{transform(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}}),qs.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 Ls(t){Oa.call(this,null,t)}function Us(t){Oa.call(this,[],t),this.count=0}function Ps(t){Oa.call(this,null,t)}function js(t){Oa.call(this,null,t),this.modified(!0)}function Is(t){Oa.call(this,null,t)}st(qs,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.as||["prob","value"];if(this.value&&!t.modified()&&!e.changed())return n.source=this.value,n;const o=os(e.materialize(e.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(r),u=[],s=t.step||.01,l=t.probs||pe(s/2,1-1e-14,s),c=l.length;return o.forEach((t=>{const e=Ua(t,l);for(let n=0;n<c;++n){const r={};for(let e=0;e<a.length;++e)r[a[e]]=t.dims[e];r[i[0]]=l[n],r[i[1]]=e[n],u.push(ia(r))}})),this.value&&(n.rem=this.value),this.value=n.add=n.source=u,n}}),st(Ls,Oa,{transform(t,e){let n,r;return this.value?r=this.value:(n=e=e.addAll(),r=this.value={}),t.derive&&(n=e.fork(e.NO_SOURCE),e.visit(e.REM,(t=>{const e=na(t);n.rem.push(r[e]),r[e]=null})),e.visit(e.ADD,(t=>{const e=oa(t);r[na(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{const e=r[na(t)];for(const r in t)e[r]=t[r],n.modifies(r);n.mod.push(e)}))),n}}),Us.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},st(Us,Oa,{transform(e,n){const r=n.fork(n.NO_SOURCE),i=e.modified("size"),o=e.size,a=this.value.reduce(((t,e)=>(t[na(e)]=1,t)),{});let u=this.value,s=this.count,l=0;function c(e){let n,i;u.length<o?u.push(e):(i=~~((s+1)*t.random()),i<u.length&&i>=l&&(n=u[i],a[na(n)]&&r.rem.push(n),u[i]=e)),++s}if(n.rem.length&&(n.visit(n.REM,(t=>{const e=na(t);a[e]&&(a[e]=-1,r.rem.push(t)),--s})),u=u.filter((t=>-1!==a[na(t)]))),(n.rem.length||i)&&u.length<o&&n.source&&(l=s=u.length,n.visit(n.SOURCE,(t=>{a[na(t)]||c(t)})),l=-1),i&&u.length>o){const t=u.length-o;for(let e=0;e<t;++e)a[na(u[e])]=-1,r.rem.push(u[e]);u=u.slice(t)}return n.mod.length&&n.visit(n.MOD,(t=>{a[na(t)]&&r.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||l<0)&&(r.add=u.filter((t=>!a[na(t)]))),this.count=s,this.value=r.source=u,r}}),Ps.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"}]},st(Ps,Oa,{transform(t,e){if(this.value&&!t.modified())return;const n=e.materialize().fork(e.MOD),r=t.as||"data";return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=pe(t.start,t.stop,t.step||1).map((t=>{const e={};return e[r]=t,ia(e)})),n.add=e.add.concat(this.value),n}}),st(js,Oa,{transform(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}});const Ws=["unit0","unit1"];function Hs(t){Oa.call(this,at(),t)}function Ys(t){Oa.call(this,null,t)}Is.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Ln,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:Ws}]},st(Is,Oa,{transform(t,e){const n=t.field,r=!1!==t.interval,o="utc"===t.timezone,a=this._floor(t,e),u=(o?gr:pr)(a.unit).offset,s=t.as||Ws,l=s[0],c=s[1],f=a.step;let h=a.start||1/0,d=a.stop||-1/0,p=e.ADD;return(t.modified()||e.modified(i(n)))&&(p=(e=e.reflow(!0)).SOURCE,h=1/0,d=-1/0),e.visit(p,(t=>{const e=n(t);let i,o;null==e?(t[l]=null,r&&(t[c]=null)):(t[l]=i=o=a(e),r&&(t[c]=o=u(i,f)),i<h&&(h=i),o>d&&(d=o))})),a.start=h,a.stop=d,e.modifies(r?s:l)},_floor(t,e){const n="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:Rr({extent:t.extent||et(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins}),o=Pn(r),a=this.value||{},u=(n?fr:sr)(o,i);return u.unit=M(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),st(Hs,Oa,{transform(t,e){const n=e.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,(t=>i.delete(r(t)))),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()}}),st(Ys,Oa,{transform(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(sa(t.sort)):e.source).map(t.field))}});const Vs={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){const t=Vs.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{const n=e.data,r=e.compare;let i=e.index;if(t<i){for(;i+1<n.length&&!r(n[i],n[i+1]);)++i;t=i}return(1+t)/n.length}}},ntile:function(t,e){(e=+e)>0||s("ntile num must be greater than zero.");const n=Vs.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{const r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{const r=n.index+e,i=n.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:e=>t(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||s("nth_value nth must be greater than zero."),{next:n=>{const r=n.i0+(e-1);return r<n.i1?t(n.data[r]):null}}},prev_value:function(t){let e;return{init:()=>e=null,next:n=>{const r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{const i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;n<r;++n){if(null!=t(e[n]))return n}return-1}(t,i,r.index))<0?(n=i.length,e=null):e=t(i[n])}}}};const Gs=Object.keys(Vs);function Xs(t){const e=W(t.ops),n=W(t.fields),o=W(t.params),a=W(t.as),u=this.outputs=[],l=this.windows=[],c={},f={},h=[],p=[];let g=!0;function m(t){W(i(t)).forEach((t=>c[t]=1))}m(t.sort),e.forEach(((t,e)=>{const i=n[e],c=r(i),y=Su(t,c,a[e]);if(m(i),u.push(y),it(Vs,t))l.push(function(t,e,n,r){const i=Vs[t](e,n);return{init:i.init||d,update:function(t,e){e[r]=i.next(t)}}}(t,n[e],o[e],y));else{if(null==i&&"count"!==t&&s("Null aggregate field specified."),"count"===t)return void h.push(y);g=!1;let e=f[c];e||(e=f[c]=[],e.field=i,p.push(e)),e.push(Ou(t,y))}})),(h.length||p.length)&&(this.cell=function(t,e,n){t=t.map((t=>Pu(t,t.field)));const r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,o=r.agg=Array(i),a=0;a<i;++a)o[a]=new t[a](r);if(r.store)var u=r.data=new ju;return r.add=function(t){if(r.num+=1,!n){u&&u.add(t);for(let e=0;e<i;++e)o[e].add(o[e].get(t),t)}},r.rem=function(t){if(r.num-=1,!n){u&&u.rem(t);for(let e=0;e<i;++e)o[e].rem(o[e].get(t),t)}},r.set=function(t){let i,a;for(u&&u.values(),i=0,a=e.length;i<a;++i)t[e[i]]=r.num;if(!n)for(i=0,a=o.length;i<a;++i)o[i].set(t)},r.init=function(){r.num=0,u&&u.reset();for(let t=0;t<i;++t)o[t].init()},r}(p,h,g)),this.inputs=Object.keys(c)}const Js=Xs.prototype;function Zs(t){Oa.call(this,{},t),this._mlen=0,this._mods=[]}function Qs(t,e,n,r){const i=r.sort,o=i&&!r.ignorePeers,a=r.frame||[null,0],u=t.data(n),s=u.length,l=o?Vt(i):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:i||Q(-1)};e.init();for(let t=0;t<s;++t)Ks(c,a,t,s),o&&tl(c,l),e.update(c,u[t])}function Ks(t,e,n,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==e[0]?0:Math.max(0,n-Math.abs(e[0])),t.i1=null==e[1]?r:Math.min(r,n+Math.abs(e[1])+1),t.index=n}function tl(t,e){const n=t.i0,r=t.i1-1,i=t.compare,o=t.data,a=o.length-1;n>0&&!i(o[n],o[n-1])&&(t.i0=e.left(o,o[n])),r<a&&!i(o[r],o[r+1])&&(t.i1=e.right(o,o[r]))}Js.init=function(){this.windows.forEach((t=>t.init())),this.cell&&this.cell.init()},Js.update=function(t,e){const n=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(n){for(a=t.p0;a<t.i0;++a)n.rem(i[a]);for(a=t.p1;a<t.i1;++a)n.add(i[a]);n.set(e)}for(a=0;a<o;++a)r[a].update(t,e)},Zs.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Gs.concat(Nu)},{name:"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}]},st(Zs,Oa,{transform(t,e){this.stamp=e.stamp;const n=t.modified(),r=sa(t.sort),i=Fu(t.groupby),o=t=>this.group(i(t));let a=this.state;a&&!n||(a=this.state=new Xs(t)),n||e.modified(a.inputs)?(this.value={},e.visit(e.SOURCE,(t=>o(t).add(t)))):(e.visit(e.REM,(t=>o(t).remove(t))),e.visit(e.ADD,(t=>o(t).add(t))));for(let e=0,n=this._mlen;e<n;++e)Qs(this._mods[e],a,r,t);return this._mlen=0,this._mods=[],e.reflow(n).modifies(a.outputs)},group(t){let e=this.value[t];return e||(e=this.value[t]=Yu(na),e.stamp=-1),e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e),e}});var el=Object.freeze({__proto__:null,aggregate:Wu,bin:Hu,collect:Vu,compare:Gu,countpattern:Ju,cross:Zu,density:es,dotbin:as,expression:us,extent:ls,facet:fs,field:hs,filter:ps,flatten:gs,fold:ms,formula:ys,generate:vs,impute:bs,joinaggregate:ws,kde:ks,key:As,load:Es,lookup:Cs,multiextent:Fs,multivalues:Bs,params:zs,pivot:Ns,prefacet:Os,project:Rs,proxy:$s,quantile:qs,relay:Ls,sample:Us,sequence:Ps,sieve:js,subflow:cs,timeunit:Is,tupleindex:Hs,values:Ys,window:Zs});const nl=Math.PI,rl=2*nl,il=1e-6,ol=rl-il;function al(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ul(){return new al}function sl(t){return function(){return t}}al.prototype=ul.prototype={constructor:al,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,r){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+r)},bezierCurveTo:function(t,e,n,r,i,o){this._+="C"+ +t+","+ +e+","+ +n+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,e,n,r,i){t=+t,e=+e,n=+n,r=+r,i=+i;var o=this._x1,a=this._y1,u=n-t,s=r-e,l=o-t,c=a-e,f=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(f>il)if(Math.abs(c*u-s*l)>il&&i){var h=n-o,d=r-a,p=u*u+s*s,g=h*h+d*d,m=Math.sqrt(p),y=Math.sqrt(f),v=i*Math.tan((nl-Math.acos((p+f-g)/(2*m*y)))/2),_=v/y,x=v/m;Math.abs(_-1)>il&&(this._+="L"+(t+_*l)+","+(e+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*u)+","+(this._y1=e+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),u=n*Math.sin(r),s=t+a,l=e+u,c=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>il||Math.abs(this._y1-l)>il)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%rl+rl),f>ol?this._+="A"+n+","+n+",0,1,"+c+","+(t-a)+","+(e-u)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>il&&(this._+="A"+n+","+n+",0,"+ +(f>=nl)+","+c+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var ll=Math.abs,cl=Math.atan2,fl=Math.cos,hl=Math.max,dl=Math.min,pl=Math.sin,gl=Math.sqrt,ml=1e-12,yl=Math.PI,vl=yl/2,_l=2*yl;function xl(t){return t>1?0:t<-1?yl:Math.acos(t)}function bl(t){return t>=1?vl:t<=-1?-vl:Math.asin(t)}function wl(t){return t.innerRadius}function kl(t){return t.outerRadius}function Al(t){return t.startAngle}function Ml(t){return t.endAngle}function El(t){return t&&t.padAngle}function Dl(t,e,n,r,i,o,a,u){var s=n-t,l=r-e,c=a-i,f=u-o,h=f*s-c*l;if(!(h*h<ml))return[t+(h=(c*(e-o)-f*(t-i))/h)*s,e+h*l]}function Cl(t,e,n,r,i,o,a){var u=t-n,s=e-r,l=(a?o:-o)/gl(u*u+s*s),c=l*s,f=-l*u,h=t+c,d=e+f,p=n+c,g=r+f,m=(h+p)/2,y=(d+g)/2,v=p-h,_=g-d,x=v*v+_*_,b=i-o,w=h*g-p*d,k=(_<0?-1:1)*gl(hl(0,b*b*x-w*w)),A=(w*_-v*k)/x,M=(-w*v-_*k)/x,E=(w*_+v*k)/x,D=(-w*v+_*k)/x,C=A-m,F=M-y,S=E-m,B=D-y;return C*C+F*F>S*S+B*B&&(A=E,M=D),{cx:A,cy:M,x01:-c,y01:-f,x11:A*(i/b-1),y11:M*(i/b-1)}}function Fl(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Sl(t){this._context=t}function Bl(t){return new Sl(t)}function Tl(t){return t[0]}function zl(t){return t[1]}function Nl(t,e){var n=sl(!0),r=null,i=Bl,o=null;function a(a){var u,s,l,c=(a=Fl(a)).length,f=!1;for(null==r&&(o=i(l=ul())),u=0;u<=c;++u)!(u<c&&n(s=a[u],u,a))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(s,u,a),+e(s,u,a));if(l)return o=null,l+""||null}return t="function"==typeof t?t:void 0===t?Tl:sl(t),e="function"==typeof e?e:void 0===e?zl:sl(e),a.x=function(e){return arguments.length?(t="function"==typeof e?e:sl(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:sl(+t),a):e},a.defined=function(t){return arguments.length?(n="function"==typeof t?t:sl(!!t),a):n},a.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),a):i},a.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),a):r},a}function Ol(t,e,n){var r=null,i=sl(!0),o=null,a=Bl,u=null;function s(s){var l,c,f,h,d,p=(s=Fl(s)).length,g=!1,m=new Array(p),y=new Array(p);for(null==o&&(u=a(d=ul())),l=0;l<=p;++l){if(!(l<p&&i(h=s[l],l,s))===g)if(g=!g)c=l,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),f=l-1;f>=c;--f)u.point(m[f],y[f]);u.lineEnd(),u.areaEnd()}g&&(m[l]=+t(h,l,s),y[l]=+e(h,l,s),u.point(r?+r(h,l,s):m[l],n?+n(h,l,s):y[l]))}if(d)return u=null,d+""||null}function l(){return Nl().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Tl:sl(+t),e="function"==typeof e?e:sl(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?zl:sl(+n),s.x=function(e){return arguments.length?(t="function"==typeof e?e:sl(+e),r=null,s):t},s.x0=function(e){return arguments.length?(t="function"==typeof e?e:sl(+e),s):t},s.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:sl(+t),s):r},s.y=function(t){return arguments.length?(e="function"==typeof t?t:sl(+t),n=null,s):e},s.y0=function(t){return arguments.length?(e="function"==typeof t?t:sl(+t),s):e},s.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:sl(+t),s):n},s.lineX0=s.lineY0=function(){return l().x(t).y(e)},s.lineY1=function(){return l().x(t).y(n)},s.lineX1=function(){return l().x(r).y(e)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:sl(!!t),s):i},s.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),s):a},s.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),s):o},s}Sl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var Rl={draw:function(t,e){var n=Math.sqrt(e/yl);t.moveTo(n,0),t.arc(0,0,n,0,_l)}};function $l(){}function ql(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Ll(t){this._context=t}function Ul(t){this._context=t}function Pl(t){this._context=t}function jl(t,e){this._basis=new Ll(t),this._beta=e}Ll.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ql(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ql(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Ul.prototype={areaStart:$l,areaEnd:$l,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ql(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Pl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ql(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},jl.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,u=e[n]-o,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*a),this._beta*e[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Il=function t(e){function n(t){return 1===e?new Ll(t):new jl(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Wl(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Hl(t,e){this._context=t,this._k=(1-e)/6}Hl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Wl(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Wl(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Yl=function t(e){function n(t){return new Hl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Vl(t,e){this._context=t,this._k=(1-e)/6}Vl.prototype={areaStart:$l,areaEnd:$l,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Wl(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Gl=function t(e){function n(t){return new Vl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Xl(t,e){this._context=t,this._k=(1-e)/6}Xl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Wl(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Jl=function t(e){function n(t){return new Xl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Zl(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>ml){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>ml){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*l+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Ql(t,e){this._context=t,this._alpha=e}Ql.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Zl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Kl=function t(e){function n(t){return e?new Ql(t,e):new Hl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function tc(t,e){this._context=t,this._alpha=e}tc.prototype={areaStart:$l,areaEnd:$l,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Zl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var ec=function t(e){function n(t){return e?new tc(t,e):new Vl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function nc(t,e){this._context=t,this._alpha=e}nc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Zl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var rc=function t(e){function n(t){return e?new nc(t,e):new Xl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function ic(t){this._context=t}function oc(t){return t<0?-1:1}function ac(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(oc(o)+oc(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function uc(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function sc(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*e,o-u,a-u*n,o,a)}function lc(t){this._context=t}function cc(t){this._context=new fc(t)}function fc(t){this._context=t}function hc(t){this._context=t}function dc(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/o[r-1],e=r-2;e>=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)o[e]=2*t[e+1]-i[e+1];return[i,o]}function pc(t,e){this._context=t,this._t=e}function gc(t,e){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}ic.prototype={areaStart:$l,areaEnd:$l,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sc(this,this._t0,uc(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,sc(this,uc(this,n=ac(this,t,e)),n);break;default:sc(this,this._t0,n=ac(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(cc.prototype=Object.create(lc.prototype)).point=function(t,e){lc.prototype.point.call(this,e,t)},fc.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}},hc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=dc(t),i=dc(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},pc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};const mc=()=>"undefined"!=typeof Image?Image:null;function yc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function vc(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const _c=Symbol("implicit");function xc(){var t=new Map,e=[],n=[],r=_c;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==_c)return r;t.set(o,a=e.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return xc(e,n).unknown(r)},yc.apply(i,arguments),i}function bc(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function wc(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function kc(){}var Ac=.7,Mc=1/Ac,Ec="\\s*([+-]?\\d+)\\s*",Dc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Cc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Fc=/^#([0-9a-f]{3,8})$/,Sc=new RegExp("^rgb\\("+[Ec,Ec,Ec]+"\\)$"),Bc=new RegExp("^rgb\\("+[Cc,Cc,Cc]+"\\)$"),Tc=new RegExp("^rgba\\("+[Ec,Ec,Ec,Dc]+"\\)$"),zc=new RegExp("^rgba\\("+[Cc,Cc,Cc,Dc]+"\\)$"),Nc=new RegExp("^hsl\\("+[Dc,Cc,Cc]+"\\)$"),Oc=new RegExp("^hsla\\("+[Dc,Cc,Cc,Dc]+"\\)$"),Rc={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function $c(){return this.rgb().formatHex()}function qc(){return this.rgb().formatRgb()}function Lc(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Fc.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Uc(e):3===n?new Wc(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Pc(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Pc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Sc.exec(t))?new Wc(e[1],e[2],e[3],1):(e=Bc.exec(t))?new Wc(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Tc.exec(t))?Pc(e[1],e[2],e[3],e[4]):(e=zc.exec(t))?Pc(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Nc.exec(t))?Gc(e[1],e[2]/100,e[3]/100,1):(e=Oc.exec(t))?Gc(e[1],e[2]/100,e[3]/100,e[4]):Rc.hasOwnProperty(t)?Uc(Rc[t]):"transparent"===t?new Wc(NaN,NaN,NaN,0):null}function Uc(t){return new Wc(t>>16&255,t>>8&255,255&t,1)}function Pc(t,e,n,r){return r<=0&&(t=e=n=NaN),new Wc(t,e,n,r)}function jc(t){return t instanceof kc||(t=Lc(t)),t?new Wc((t=t.rgb()).r,t.g,t.b,t.opacity):new Wc}function Ic(t,e,n,r){return 1===arguments.length?jc(t):new Wc(t,e,n,null==r?1:r)}function Wc(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Hc(){return"#"+Vc(this.r)+Vc(this.g)+Vc(this.b)}function Yc(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Vc(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Gc(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Zc(t,e,n,r)}function Xc(t){if(t instanceof Zc)return new Zc(t.h,t.s,t.l,t.opacity);if(t instanceof kc||(t=Lc(t)),!t)return new Zc;if(t instanceof Zc)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=e===o?(n-r)/u+6*(n<r):n===o?(r-e)/u+2:(e-n)/u+4,u/=s<.5?o+i:2-o-i,a*=60):u=s>0&&s<1?0:a,new Zc(a,u,s,t.opacity)}function Jc(t,e,n,r){return 1===arguments.length?Xc(t):new Zc(t,e,n,null==r?1:r)}function Zc(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Qc(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}bc(kc,Lc,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:$c,formatHex:$c,formatHsl:function(){return Xc(this).formatHsl()},formatRgb:qc,toString:qc}),bc(Wc,Ic,wc(kc,{brighter:function(t){return t=null==t?Mc:Math.pow(Mc,t),new Wc(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Ac:Math.pow(Ac,t),new Wc(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Hc,formatHex:Hc,formatRgb:Yc,toString:Yc})),bc(Zc,Jc,wc(kc,{brighter:function(t){return t=null==t?Mc:Math.pow(Mc,t),new Zc(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Ac:Math.pow(Ac,t),new Zc(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Wc(Qc(t>=240?t-240:t+120,i,r),Qc(t,i,r),Qc(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const Kc=Math.PI/180,tf=180/Math.PI,ef=.96422,nf=.82521,rf=4/29,of=6/29,af=3*of*of;function uf(t){if(t instanceof lf)return new lf(t.l,t.a,t.b,t.opacity);if(t instanceof mf)return yf(t);t instanceof Wc||(t=jc(t));var e,n,r=df(t.r),i=df(t.g),o=df(t.b),a=cf((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=cf((.4360747*r+.3850649*i+.1430804*o)/ef),n=cf((.0139322*r+.0971045*i+.7141733*o)/nf)),new lf(116*a-16,500*(e-a),200*(a-n),t.opacity)}function sf(t,e,n,r){return 1===arguments.length?uf(t):new lf(t,e,n,null==r?1:r)}function lf(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function cf(t){return t>.008856451679035631?Math.pow(t,1/3):t/af+rf}function ff(t){return t>of?t*t*t:af*(t-rf)}function hf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function df(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function pf(t){if(t instanceof mf)return new mf(t.h,t.c,t.l,t.opacity);if(t instanceof lf||(t=uf(t)),0===t.a&&0===t.b)return new mf(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*tf;return new mf(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function gf(t,e,n,r){return 1===arguments.length?pf(t):new mf(t,e,n,null==r?1:r)}function mf(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function yf(t){if(isNaN(t.h))return new lf(t.l,0,0,t.opacity);var e=t.h*Kc;return new lf(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}bc(lf,sf,wc(kc,{brighter:function(t){return new lf(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new lf(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Wc(hf(3.1338561*(e=ef*ff(e))-1.6168667*(t=1*ff(t))-.4906146*(n=nf*ff(n))),hf(-.9787684*e+1.9161415*t+.033454*n),hf(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),bc(mf,gf,wc(kc,{brighter:function(t){return new mf(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new mf(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return yf(this).rgb()}}));var vf=-.14861,_f=1.78277,xf=-.29227,bf=-.90649,wf=1.97294,kf=wf*bf,Af=wf*_f,Mf=_f*xf-bf*vf;function Ef(t){if(t instanceof Cf)return new Cf(t.h,t.s,t.l,t.opacity);t instanceof Wc||(t=jc(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(Mf*r+kf*e-Af*n)/(Mf+kf-Af),o=r-i,a=(wf*(n-i)-xf*o)/bf,u=Math.sqrt(a*a+o*o)/(wf*i*(1-i)),s=u?Math.atan2(a,o)*tf-120:NaN;return new Cf(s<0?s+360:s,u,i,t.opacity)}function Df(t,e,n,r){return 1===arguments.length?Ef(t):new Cf(t,e,n,null==r?1:r)}function Cf(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ff(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function Sf(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r<e-1?t[r+2]:2*o-i;return Ff((n-r/e)*e,a,i,o,u)}}function Bf(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],u=t[(r+2)%e];return Ff((n-r/e)*e,i,o,a,u)}}bc(Cf,Df,wc(kc,{brighter:function(t){return t=null==t?Mc:Math.pow(Mc,t),new Cf(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Ac:Math.pow(Ac,t),new Cf(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Kc,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Wc(255*(e+n*(vf*r+_f*i)),255*(e+n*(xf*r+bf*i)),255*(e+n*(wf*r)),this.opacity)}}));var Tf=t=>()=>t;function zf(t,e){return function(n){return t+n*e}}function Nf(t,e){var n=e-t;return n?zf(t,n>180||n<-180?n-360*Math.round(n/360):n):Tf(isNaN(t)?e:t)}function Of(t){return 1==(t=+t)?Rf:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Tf(isNaN(e)?n:e)}}function Rf(t,e){var n=e-t;return n?zf(t,n):Tf(isNaN(t)?e:t)}var $f=function t(e){var n=Of(e);function r(t,e){var r=n((t=Ic(t)).r,(e=Ic(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Rf(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function qf(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),u=new Array(i);for(n=0;n<i;++n)r=Ic(e[n]),o[n]=r.r||0,a[n]=r.g||0,u[n]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var Lf=qf(Sf),Uf=qf(Bf);function Pf(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function jf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function If(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Jf(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function Wf(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Hf(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Yf(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Jf(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var Vf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gf=new RegExp(Vf.source,"g");function Xf(t,e){var n,r,i,o=Vf.lastIndex=Gf.lastIndex=0,a=-1,u=[],s=[];for(t+="",e+="";(n=Vf.exec(t))&&(r=Gf.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Hf(n,r)})),o=Gf.lastIndex;return o<e.length&&(i=e.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?s[0]?function(t){return function(e){return t(e)+""}}(s[0].x):function(t){return function(){return t}}(e):(e=s.length,function(t){for(var n,r=0;r<e;++r)u[(n=s[r]).i]=n.x(t);return u.join("")})}function Jf(t,e){var n,r=typeof e;return null==e||"boolean"===r?Tf(e):("number"===r?Hf:"string"===r?(n=Lc(e))?(e=n,$f):Xf:e instanceof Lc?$f:e instanceof Date?Wf:jf(e)?Pf:Array.isArray(e)?If:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Yf:Hf)(t,e)}function Zf(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Qf,Kf=180/Math.PI,th={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function eh(t,e,n,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,s/=u),t*r<e*n&&(t=-t,e=-e,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Kf,skewX:Math.atan(s)*Kf,scaleX:a,scaleY:u}}function nh(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],s=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,e,null,n);u.push({i:s-4,x:Hf(t,i)},{i:s-2,x:Hf(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,u,s),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Hf(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,u,s),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Hf(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,u,s),function(t,e,n,r,o,a){if(t!==n||e!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Hf(t,n)},{i:u-2,x:Hf(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var e,n=-1,r=s.length;++n<r;)u[(e=s[n]).i]=e.x(t);return u.join("")}}}var rh=nh((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?th:eh(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),ih=nh((function(t){return null==t?th:(Qf||(Qf=document.createElementNS("http://www.w3.org/2000/svg","g")),Qf.setAttribute("transform",t),(t=Qf.transform.baseVal.consolidate())?eh((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):th)}),", ",")",")");function oh(t){return((t=Math.exp(t))+1/t)/2}var ah=function t(e,n,r){function i(t,i){var o,a,u=t[0],s=t[1],l=t[2],c=i[0],f=i[1],h=i[2],d=c-u,p=f-s,g=d*d+p*p;if(g<1e-12)a=Math.log(h/l)/e,o=function(t){return[u+t*d,s+t*p,l*Math.exp(e*t*a)]};else{var m=Math.sqrt(g),y=(h*h-l*l+r*g)/(2*l*n*m),v=(h*h-l*l-r*g)/(2*h*n*m),_=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);a=(x-_)/e,o=function(t){var r=t*a,i=oh(_),o=l/(n*m)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(e*r+_)-function(t){return((t=Math.exp(t))-1/t)/2}(_));return[u+o*d,s+o*p,l*i/oh(e*r+_)]}}return o.duration=1e3*a*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function uh(t){return function(e,n){var r=t((e=Jc(e)).h,(n=Jc(n)).h),i=Rf(e.s,n.s),o=Rf(e.l,n.l),a=Rf(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var sh=uh(Nf),lh=uh(Rf);function ch(t){return function(e,n){var r=t((e=gf(e)).h,(n=gf(n)).h),i=Rf(e.c,n.c),o=Rf(e.l,n.l),a=Rf(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var fh=ch(Nf),hh=ch(Rf);function dh(t){return function e(n){function r(e,r){var i=t((e=Df(e)).h,(r=Df(r)).h),o=Rf(e.s,r.s),a=Rf(e.l,r.l),u=Rf(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=o(t),e.l=a(Math.pow(t,n)),e.opacity=u(t),e+""}}return n=+n,r.gamma=e,r}(1)}var ph=dh(Nf),gh=dh(Rf);function mh(t,e){void 0===e&&(e=t,t=Jf);for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);n<r;)o[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[e](t-e)}}var yh=Object.freeze({__proto__:null,interpolate:Jf,interpolateArray:function(t,e){return(jf(e)?Pf:If)(t,e)},interpolateBasis:Sf,interpolateBasisClosed:Bf,interpolateDate:Wf,interpolateDiscrete:function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},interpolateHue:function(t,e){var n=Nf(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},interpolateNumber:Hf,interpolateNumberArray:Pf,interpolateObject:Yf,interpolateRound:Zf,interpolateString:Xf,interpolateTransformCss:rh,interpolateTransformSvg:ih,interpolateZoom:ah,interpolateRgb:$f,interpolateRgbBasis:Lf,interpolateRgbBasisClosed:Uf,interpolateHsl:sh,interpolateHslLong:lh,interpolateLab:function(t,e){var n=Rf((t=sf(t)).l,(e=sf(e)).l),r=Rf(t.a,e.a),i=Rf(t.b,e.b),o=Rf(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}},interpolateHcl:fh,interpolateHclLong:hh,interpolateCubehelix:ph,interpolateCubehelixLong:gh,piecewise:mh,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}});function vh(t){return+t}var _h=[0,1];function xh(t){return t}function bh(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function wh(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=bh(i,r),o=n(a,o)):(r=bh(r,i),o=n(o,a)),function(t){return o(r(t))}}function kh(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=bh(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=Qt(t,e,1,r)-1;return o[n](i[n](e))}}function Ah(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Mh(){var t,e,n,r,i,o,a=_h,u=_h,s=Jf,l=xh;function c(){var t=Math.min(a.length,u.length);return l!==xh&&(l=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?kh:wh,i=o=null,f}function f(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),u,s)))(t(l(e)))}return f.invert=function(n){return l(e((o||(o=r(u,a.map(t),Hf)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,vh),c()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),s=Zf,c()},f.clamp=function(t){return arguments.length?(l=!!t||xh,c()):l!==xh},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}function Eh(){return Mh()(xh,xh)}function Dh(t,e,n,r){var i,o=oe(t,e,n);switch((r=xe(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Te(o,a))||(r.precision=i),De(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=ze(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Be(o))||(r.precision=i-2*("%"===r.type))}return Ee(r)}function Ch(t){var e=t.domain;return t.ticks=function(t){var n=e();return re(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return Dh(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,u=o.length-1,s=o[a],l=o[u],c=10;for(l<s&&(i=s,s=l,l=i,i=a,a=u,u=i);c-- >0;){if((i=ie(s,l,n))===r)return o[a]=s,o[u]=l,e(o);if(i>0)s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function Fh(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}function Sh(t){return Math.log(t)}function Bh(t){return Math.exp(t)}function Th(t){return-Math.log(-t)}function zh(t){return-Math.exp(-t)}function Nh(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Oh(t){return function(e){return-t(-e)}}function Rh(t){var e,n,r=t(Sh,Bh),i=r.domain,o=10;function a(){return e=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(e){return Math.log(e)/t})}(o),n=function(t){return 10===t?Nh:t===Math.E?Math.exp:function(e){return Math.pow(t,e)}}(o),i()[0]<0?(e=Oh(e),n=Oh(n),t(Th,zh)):t(Sh,Bh),r}return r.base=function(t){return arguments.length?(o=+t,a()):o},r.domain=function(t){return arguments.length?(i(t),a()):i()},r.ticks=function(t){var r,a=i(),u=a[0],s=a[a.length-1];(r=s<u)&&(h=u,u=s,s=h);var l,c,f,h=e(u),d=e(s),p=null==t?10:+t,g=[];if(!(o%1)&&d-h<p){if(h=Math.floor(h),d=Math.ceil(d),u>0){for(;h<=d;++h)for(c=1,l=n(h);c<o;++c)if(!((f=l*c)<u)){if(f>s)break;g.push(f)}}else for(;h<=d;++h)for(c=o-1,l=n(h);c>=1;--c)if(!((f=l*c)<u)){if(f>s)break;g.push(f)}2*g.length<p&&(g=re(u,s,p))}else g=re(h,d,Math.min(d-h,p)).map(n);return r?g.reverse():g},r.tickFormat=function(t,i){if(null==i&&(i=10===o?".0e":","),"function"!=typeof i&&(i=Ee(i)),t===1/0)return i;null==t&&(t=10);var a=Math.max(1,o*t/r.ticks().length);return function(t){var r=t/n(Math.round(e(t)));return r*o<o-.5&&(r*=o),r<=a?i(t):""}},r.nice=function(){return i(Fh(i(),{floor:function(t){return n(Math.floor(e(t)))},ceil:function(t){return n(Math.ceil(e(t)))}}))},r}function $h(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function qh(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Lh(t){var e=1,n=t($h(e),qh(e));return n.constant=function(n){return arguments.length?t($h(e=+n),qh(e)):e},Ch(n)}function Uh(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Ph(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function jh(t){return t<0?-t*t:t*t}function Ih(t){var e=t(xh,xh),n=1;function r(){return 1===n?t(xh,xh):.5===n?t(Ph,jh):t(Uh(n),Uh(1/n))}return e.exponent=function(t){return arguments.length?(n=+t,r()):n},Ch(e)}function Wh(){var t=Ih(Mh());return t.copy=function(){return Ah(t,Wh()).exponent(t.exponent())},yc.apply(t,arguments),t}function Hh(t){return new Date(t)}function Yh(t){return t instanceof Date?+t:+new Date(+t)}function Vh(t,e,n,r,i,o,a,u,s,l){var c=Eh(),f=c.invert,h=c.domain,d=l(".%L"),p=l(":%S"),g=l("%I:%M"),m=l("%I %p"),y=l("%a %d"),v=l("%b %d"),_=l("%B"),x=l("%Y");function b(t){return(s(t)<t?d:u(t)<t?p:a(t)<t?g:o(t)<t?m:r(t)<t?i(t)<t?y:v:n(t)<t?_:x)(t)}return c.invert=function(t){return new Date(f(t))},c.domain=function(t){return arguments.length?h(Array.from(t,Yh)):h().map(Hh)},c.ticks=function(e){var n=h();return t(n[0],n[n.length-1],null==e?10:e)},c.tickFormat=function(t,e){return null==e?b:l(e)},c.nice=function(t){var n=h();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?h(Fh(n,t)):c},c.copy=function(){return Ah(c,Vh(t,e,n,r,i,o,a,u,s,l))},c}function Gh(){var t,e,n,r,i,o=0,a=1,u=xh,s=!1;function l(e){return null==e||isNaN(e=+e)?i:u(0===n?.5:(e=(r(e)-t)*n,s?Math.max(0,Math.min(1,e)):e))}function c(t){return function(e){var n,r;return arguments.length?([n,r]=e,u=t(n,r),l):[u(0),u(1)]}}return l.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),e=r(a=+a),n=t===e?0:1/(e-t),l):[o,a]},l.clamp=function(t){return arguments.length?(s=!!t,l):s},l.interpolator=function(t){return arguments.length?(u=t,l):u},l.range=c(Jf),l.rangeRound=c(Zf),l.unknown=function(t){return arguments.length?(i=t,l):i},function(i){return r=i,t=i(o),e=i(a),n=t===e?0:1/(e-t),l}}function Xh(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Jh(){var t=Ch(Gh()(xh));return t.copy=function(){return Xh(t,Jh())},vc.apply(t,arguments)}function Zh(){var t=Ih(Gh());return t.copy=function(){return Xh(t,Zh()).exponent(t.exponent())},vc.apply(t,arguments)}function Qh(){var t,e,n,r,i,o,a,u=0,s=.5,l=1,c=1,f=xh,h=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-e)*(c*t<c*e?r:i),f(h?Math.max(0,Math.min(1,t)):t))}function p(t){return function(e){var n,r,i;return arguments.length?([n,r,i]=e,f=mh(t,[n,r,i]),d):[f(0),f(.5),f(1)]}}return d.domain=function(a){return arguments.length?([u,s,l]=a,t=o(u=+u),e=o(s=+s),n=o(l=+l),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),c=e<t?-1:1,d):[u,s,l]},d.clamp=function(t){return arguments.length?(h=!!t,d):h},d.interpolator=function(t){return arguments.length?(f=t,d):f},d.range=p(Jf),d.rangeRound=p(Zf),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(u),e=a(s),n=a(l),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),c=e<t?-1:1,d}}function Kh(){var t=Ih(Qh());return t.copy=function(){return Xh(t,Kh()).exponent(t.exponent())},vc.apply(t,arguments)}function td(t,e,n){const r=t-e+2*n;return t?r>0?r:1:0}const ed="linear",nd="log",rd="pow",id="sqrt",od="symlog",ad="time",ud="utc",sd="sequential",ld="quantile",cd="quantize",fd="threshold",hd="ordinal",dd="point",pd="band",gd="bin-ordinal",md="continuous",yd="discrete",vd="discretizing",_d="interpolating",xd="temporal";function bd(){const t=xc().unknown(void 0),e=t.domain,n=t.range;let r,i,o=[0,1],a=!1,u=0,s=0,l=.5;function c(){const t=e().length,c=o[1]<o[0],f=o[1-c],h=td(t,u,s);let d=o[c-0];r=(f-d)/(h||1),a&&(r=Math.floor(r)),d+=(f-d-r*(t-u))*l,i=r*(1-u),a&&(d=Math.round(d),i=Math.round(i));const p=pe(t).map((t=>d+r*t));return n(c?p.reverse():p)}return delete t.unknown,t.domain=function(t){return arguments.length?(e(t),c()):e()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],c()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,c()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,c()):a},t.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),u=s,c()):u},t.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),c()):u},t.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},t.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]<o[0],a=r?n().reverse():n(),u=a.length-1;let s,l,c,f=+t[0],h=+t[1];return f!=f||h!=h||(h<f&&(c=f,f=h,h=c),h<a[0]||f>o[1-r])?void 0:(s=Math.max(0,Jt(a,f)-1),l=f===h?s:Jt(a,h)-1,f-a[s]>i+1e-10&&++s,r&&(c=s,s=u-l,l=u-c),s>l?void 0:e().slice(s,l+1))},t.invert=function(e){const n=t.invertRange([e,e]);return n?n[0]:n},t.copy=function(){return bd().domain(e()).range(o).round(a).paddingInner(u).paddingOuter(s).align(l)},c()}function wd(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return wd(e())},t}var kd=Array.prototype.map;function Ad(t){return kd.call(t,E)}const Md=Array.prototype.slice;const Ed={};function Dd(t,e,n){const r=function(){const n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){let n,r=e[0],i=e[1];return i<r&&(n=r,r=i,i=n),[t.invert(r),t.invert(i)]}}(n):n.invertExtent?function(t){return function(e){const n=t.range();let r,i,o,a,u=e[0],s=e[1],l=-1;for(s<u&&(i=u,u=s,s=i),o=0,a=n.length;o<a;++o)n[o]>=u&&n[o]<=s&&(l<0&&(l=o),r=o);if(!(l<0))return u=t.invertExtent(n[l]),s=t.invertExtent(n[r]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=t,n};return r.metadata=Ct(W(n)),r}function Cd(t,e,n){return arguments.length>1?(Ed[t]=Dd(t,e,n),this):Fd(t)?Ed[t]:void 0}function Fd(t){return it(Ed,t)}function Sd(t,e){const n=Ed[t];return n&&n.metadata[e]}function Bd(t){return Sd(t,md)}function Td(t){return Sd(t,yd)}function zd(t){return Sd(t,vd)}function Nd(t){return Sd(t,nd)}function Od(t){return Sd(t,_d)}function Rd(t){return Sd(t,ld)}Cd("identity",(function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,vh),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,vh):[0,1],Ch(r)})),Cd(ed,(function t(){var e=Eh();return e.copy=function(){return Ah(e,t())},yc.apply(e,arguments),Ch(e)}),md),Cd(nd,(function t(){var e=Rh(Mh()).domain([1,10]);return e.copy=function(){return Ah(e,t()).base(e.base())},yc.apply(e,arguments),e}),[md,nd]),Cd(rd,Wh,md),Cd(id,(function(){return Wh.apply(null,arguments).exponent(.5)}),md),Cd(od,(function t(){var e=Lh(Mh());return e.copy=function(){return Ah(e,t()).constant(e.constant())},yc.apply(e,arguments)}),md),Cd(ad,(function(){return yc.apply(Vh(En,Dn,sn,an,en,Ke,Ze,Xe,Ve,jr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[md,xd]),Cd(ud,(function(){return yc.apply(Vh(An,Mn,wn,xn,mn,pn,hn,cn,Ve,Wr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[md,xd]),Cd(sd,Jh,[md,_d]),Cd("sequential-linear",Jh,[md,_d]),Cd("sequential-log",(function t(){var e=Rh(Gh()).domain([1,10]);return e.copy=function(){return Xh(e,t()).base(e.base())},vc.apply(e,arguments)}),[md,_d,nd]),Cd("sequential-pow",Zh,[md,_d]),Cd("sequential-sqrt",(function(){return Zh.apply(null,arguments).exponent(.5)}),[md,_d]),Cd("sequential-symlog",(function t(){var e=Lh(Gh());return e.copy=function(){return Xh(e,t()).constant(e.constant())},vc.apply(e,arguments)}),[md,_d]),Cd("diverging-linear",(function t(){var e=Ch(Qh()(xh));return e.copy=function(){return Xh(e,t())},vc.apply(e,arguments)}),[md,_d]),Cd("diverging-log",(function t(){var e=Rh(Qh()).domain([.1,1,10]);return e.copy=function(){return Xh(e,t()).base(e.base())},vc.apply(e,arguments)}),[md,_d,nd]),Cd("diverging-pow",Kh,[md,_d]),Cd("diverging-sqrt",(function(){return Kh.apply(null,arguments).exponent(.5)}),[md,_d]),Cd("diverging-symlog",(function t(){var e=Lh(Qh());return e.copy=function(){return Xh(e,t()).constant(e.constant())},vc.apply(e,arguments)}),[md,_d]),Cd(ld,(function t(){var e,n=[],r=[],i=[];function o(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t<e;)i[t-1]=fe(n,t/e);return a}function a(t){return null==t||isNaN(t=+t)?e:r[Qt(i,t)]}return a.invertExtent=function(t){var e=r.indexOf(t);return e<0?[NaN,NaN]:[e>0?i[e-1]:n[0],e<i.length?i[e]:n[n.length-1]]},a.domain=function(t){if(!arguments.length)return n.slice();n=[];for(let e of t)null==e||isNaN(e=+e)||n.push(e);return n.sort(Yt),o()},a.range=function(t){return arguments.length?(r=Array.from(t),o()):r.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return i.slice()},a.copy=function(){return t().domain(n).range(r).unknown(e)},yc.apply(a,arguments)}),[vd,ld]),Cd(cd,(function t(){var e,n=0,r=1,i=1,o=[.5],a=[0,1];function u(t){return null!=t&&t<=t?a[Qt(o,t,0,i)]:e}function s(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*n)/(i+1);return u}return u.domain=function(t){return arguments.length?([n,r]=t,n=+n,r=+r,s()):[n,r]},u.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,s()):a.slice()},u.invertExtent=function(t){var e=a.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,o[0]]:e>=i?[o[i-1],r]:[o[e-1],o[e]]},u.unknown=function(t){return arguments.length?(e=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([n,r]).range(a).unknown(e)},yc.apply(Ch(u),arguments)}),vd),Cd(fd,(function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[Qt(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},yc.apply(o,arguments)}),vd),Cd(gd,(function t(){let e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(Qt(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=Ad(t),r):e.slice()},r.range=function(t){return arguments.length?(n=Md.call(t),r):n.slice()},r.tickFormat=function(t,n){return Dh(e[0],M(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[yd,vd]),Cd(hd,xc,yd),Cd(pd,bd,yd),Cd(dd,(function(){return wd(bd().paddingInner(1))}),yd);const $d=["clamp","base","constant","exponent"];function qd(t,e){const n=e[0],r=M(e)-n;return function(e){return t(n+e*r)}}function Ld(t,e,n){return mh(jd(e||"rgb",n),t)}function Ud(t,e){const n=new Array(e),r=e+1;for(let i=0;i<e;)n[i]=t(++i/r);return n}function Pd(t,e,n){const r=n-e;let i,o,a;return r&&Number.isFinite(r)?(i=(o=t.type).indexOf("-"),o=i<0?o:o.slice(i+1),a=Cd(o)().domain([e,n]).range([0,1]),$d.forEach((e=>t[e]?a[e](t[e]()):0)),a):Q(.5)}function jd(t,e){const n=yh[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function Id(t){const e=t.length/6|0,n=new Array(e);for(let r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}function Wd(t,e){for(const n in t)Yd(n,e(t[n]))}const Hd={};function Yd(t,e){return t=t&&t.toLowerCase(),arguments.length>1?(Hd[t]=e,this):Hd[t]}Wd({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Id),Wd({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"},(t=>Ld(Id(t))));const Vd="symbol",Gd=t=>_(t)?t.map((t=>String(t))):String(t),Xd=(t,e)=>t[1]-e[1],Jd=(t,e)=>e[1]-t[1];function Zd(t,e,n){let r;return dt(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,Math.floor(wt(t.domain())/n||1)))),x(e)&&(r=e.step,e=e.interval),gt(e)&&(e=t.type===ad?pr(e):t.type==ud?gr(e):s("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function Qd(t,e,n){let r=t.range(),i=r[0],o=M(r),a=Xd;if(i>o&&(r=o,o=i,i=r,a=Jd),i=Math.floor(i),o=Math.ceil(o),e=e.map((e=>[e,t(e)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),n>0&&e.length>1){const t=[e[0],M(e)];for(;e.length>n&&e.length>=3;)e=e.filter(((t,e)=>!(e%2)));e.length<3&&(e=t)}return e}function Kd(t,e){return t.bins?Qd(t,t.bins):t.ticks?t.ticks(e):t.domain()}function tp(t,e,n,r,i,o){const a=e.type;let u=Gd;if(a===ad||i===ad)u=t.timeFormat(r);else if(a===ud||i===ud)u=t.utcFormat(r);else if(Nd(a)){const i=t.formatFloat(r);if(o||e.bins)u=i;else{const t=ep(e,n,!1);u=e=>t(e)?i(e):""}}else if(e.tickFormat){const i=e.domain();u=t.formatSpan(i[0],i[i.length-1],n,r)}else r&&(u=t.format(r));return u}function ep(t,e,n){const r=Kd(t,e),i=t.base(),o=Math.log(i),a=Math.max(1,i*e/r.length),u=t=>{let e=t/Math.pow(i,Math.round(Math.log(t)/o));return e*i<i-.5&&(e*=i),e<=a};return n?r.filter(u):u}const np={[ld]:"quantiles",[cd]:"thresholds",[fd]:"domain"},rp={[ld]:"quantiles",[cd]:"domain"};function ip(t,e){return t.bins?function(t){const e=t.slice(0,-1);return e.max=M(t),e}(t.bins):t.type===nd?ep(t,e,!0):np[t.type]?function(t){const e=[-1/0].concat(t);return e.max=1/0,e}(t[np[t.type]]()):Kd(t,e)}function op(t,e,n,r,i,o,a){const u=rp[e.type]&&o!==ad&&o!==ud?function(t,e,n){const r=e[rp[e.type]](),i=r.length;let o,a=i>1?r[1]-r[0]:r[0];for(o=1;o<i;++o)a=Math.min(a,r[o]-r[o-1]);return t.formatSpan(0,a,30,n)}(t,e,i):tp(t,e,n,i,o,a);return r===Vd&&(t=>np[t.type]||t.bins)(e)?ap(u):"discrete"===r?sp(u):lp(u)}const ap=t=>(e,n,r)=>{const i=up(r[n+1],up(r.max,1/0)),o=cp(e,t),a=cp(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},up=(t,e)=>null!=t?t:e,sp=t=>(e,n)=>n?t(e):null,lp=t=>e=>t(e),cp=(t,e)=>Number.isFinite(t)?e(t):null;function fp(t,e,n,r){const i=r||e.type;return gt(n)&&function(t){return Sd(t,xd)}(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==ad?n||i!==ud?op(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function hp(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=fp(t,e,n.format,n.formatType);if(zd(e.type)){const t=ip(e).slice(1).map(i),n=t.length;return`${n} boundar${1===n?"y":"ies"}: ${t.join(", ")}`}if(Td(e.type)){const t=e.domain(),n=t.length;return`${n} value${1===n?"":"s"}: ${n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=e.domain();return`values from ${i(t[0])} to ${i(M(t))}`}}let dp=0;const pp="p_";function gp(t){return t&&t.gradient}function mp(t,e,n){const r=t.gradient;let i=t.id,o="radial"===r?pp:"";return i||(i=t.id="gradient_"+dp++,"radial"===r?(t.x1=yp(t.x1,.5),t.y1=yp(t.y1,.5),t.r1=yp(t.r1,0),t.x2=yp(t.x2,.5),t.y2=yp(t.y2,.5),t.r2=yp(t.r2,.5),o=pp):(t.x1=yp(t.x1,0),t.y1=yp(t.y1,0),t.x2=yp(t.x2,1),t.y2=yp(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function yp(t,e){return null!=t?t:e}function vp(t,e){var n,r=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}}const _p={basis:{curve:function(t){return new Ll(t)}},"basis-closed":{curve:function(t){return new Ul(t)}},"basis-open":{curve:function(t){return new Pl(t)}},bundle:{curve:Il,tension:"beta",value:.85},cardinal:{curve:Yl,tension:"tension",value:0},"cardinal-open":{curve:Jl,tension:"tension",value:0},"cardinal-closed":{curve:Gl,tension:"tension",value:0},"catmull-rom":{curve:Kl,tension:"alpha",value:.5},"catmull-rom-closed":{curve:ec,tension:"alpha",value:.5},"catmull-rom-open":{curve:rc,tension:"alpha",value:.5},linear:{curve:Bl},"linear-closed":{curve:function(t){return new ic(t)}},monotone:{horizontal:function(t){return new cc(t)},vertical:function(t){return new lc(t)}},natural:{curve:function(t){return new hc(t)}},step:{curve:function(t){return new pc(t,.5)}},"step-after":{curve:function(t){return new pc(t,1)}},"step-before":{curve:function(t){return new pc(t,0)}}};function xp(t,e,n){var r=it(_p,t)&&_p[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}const bp={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},wp=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\.\d+)(\.\d)/g,/(\d)([-+])/g,/\s|,|###/];function kp(t){const e=[];let n,r,i,o,a,u,s,l,c,f;const h=t.slice().replace(wp[0],"###$1").split(wp[1]).slice(1);for(s=0,c=h.length;s<c;++s){for(n=h[s],r=n.slice(1).trim().replace(wp[2],"$1###$2").replace(wp[3],"$1###$2").split(wp[4]),a=n.charAt(0),i=[a],l=0,f=r.length;l<f;++l)(o=+r[l])===o&&i.push(o);if(u=bp[a.toLowerCase()],i.length-1>u){const t=i.length;for(l=1,e.push([a].concat(i.slice(l,l+=u))),a="M"===a?"L":"m"===a?"l":a;l<t;l+=u)e.push([a].concat(i.slice(l,l+u)))}else e.push(i)}return e}const Ap=Math.PI/180,Mp=Math.PI/2,Ep=2*Math.PI,Dp=Math.sqrt(3)/2;var Cp={},Fp={},Sp=[].join;function Bp(t){const e=Sp.call(t);if(Fp[e])return Fp[e];var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],l=t[7];const c=l*a,f=-s*u,h=s*a,d=l*u,p=Math.cos(i),g=Math.sin(i),m=Math.cos(o),y=Math.sin(o),v=.5*(o-i),_=Math.sin(.5*v),x=8/3*_*_/Math.sin(v),b=n+p-x*g,w=r+g+x*p,k=n+m,A=r+y,M=k+x*y,E=A-x*m;return Fp[e]=[c*b+f*w,h*b+d*w,c*M+f*E,h*M+d*E,c*k+f*A,h*k+d*A]}const Tp=["l",0,0,0,0,0,0,0];function zp(t,e,n){const r=Tp[0]=t[0];if("a"===r||"A"===r)Tp[1]=e*t[1],Tp[2]=n*t[2],Tp[3]=t[3],Tp[4]=t[4],Tp[5]=t[5],Tp[6]=e*t[6],Tp[7]=n*t[7];else if("h"===r||"H"===r)Tp[1]=e*t[1];else if("v"===r||"V"===r)Tp[1]=n*t[1];else for(var i=1,o=t.length;i<o;++i)Tp[i]=(i%2==1?e:n)*t[i];return Tp}function Np(t,e,n,r,i,o){var a,u,s,l,c,f=null,h=0,d=0,p=0,g=0;null==n&&(n=0),null==r&&(r=0),null==i&&(i=1),null==o&&(o=i),t.beginPath&&t.beginPath();for(var m=0,y=e.length;m<y;++m){switch(a=e[m],1===i&&1===o||(a=zp(a,i,o)),a[0]){case"l":h+=a[1],d+=a[2],t.lineTo(h+n,d+r);break;case"L":h=a[1],d=a[2],t.lineTo(h+n,d+r);break;case"h":h+=a[1],t.lineTo(h+n,d+r);break;case"H":h=a[1],t.lineTo(h+n,d+r);break;case"v":d+=a[1],t.lineTo(h+n,d+r);break;case"V":d=a[1],t.lineTo(h+n,d+r);break;case"m":h+=a[1],d+=a[2],t.moveTo(h+n,d+r);break;case"M":h=a[1],d=a[2],t.moveTo(h+n,d+r);break;case"c":u=h+a[5],s=d+a[6],p=h+a[3],g=d+a[4],t.bezierCurveTo(h+a[1]+n,d+a[2]+r,p+n,g+r,u+n,s+r),h=u,d=s;break;case"C":h=a[5],d=a[6],p=a[3],g=a[4],t.bezierCurveTo(a[1]+n,a[2]+r,p+n,g+r,h+n,d+r);break;case"s":u=h+a[3],s=d+a[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+n,g+r,h+a[1]+n,d+a[2]+r,u+n,s+r),p=h+a[1],g=d+a[2],h=u,d=s;break;case"S":u=a[3],s=a[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+n,g+r,a[1]+n,a[2]+r,u+n,s+r),h=u,d=s,p=a[1],g=a[2];break;case"q":u=h+a[3],s=d+a[4],p=h+a[1],g=d+a[2],t.quadraticCurveTo(p+n,g+r,u+n,s+r),h=u,d=s;break;case"Q":u=a[3],s=a[4],t.quadraticCurveTo(a[1]+n,a[2]+r,u+n,s+r),h=u,d=s,p=a[1],g=a[2];break;case"t":u=h+a[1],s=d+a[2],null===f[0].match(/[QqTt]/)?(p=h,g=d):"t"===f[0]?(p=2*h-l,g=2*d-c):"q"===f[0]&&(p=2*h-p,g=2*d-g),l=p,c=g,t.quadraticCurveTo(p+n,g+r,u+n,s+r),d=s,p=(h=u)+a[1],g=d+a[2];break;case"T":u=a[1],s=a[2],p=2*h-p,g=2*d-g,t.quadraticCurveTo(p+n,g+r,u+n,s+r),h=u,d=s;break;case"a":Op(t,h+n,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+h+n,a[7]+d+r]),h+=a[6],d+=a[7];break;case"A":Op(t,h+n,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+r]),h=a[6],d=a[7];break;case"z":case"Z":t.closePath()}f=a}}function Op(t,e,n,r){const i=function(t,e,n,r,i,o,a,u,s){const l=Sp.call(arguments);if(Cp[l])return Cp[l];const c=a*Ap,f=Math.sin(c),h=Math.cos(c),d=h*(u-t)*.5+f*(s-e)*.5,p=h*(s-e)*.5-f*(u-t)*.5;let g=d*d/((n=Math.abs(n))*n)+p*p/((r=Math.abs(r))*r);g>1&&(g=Math.sqrt(g),n*=g,r*=g);const m=h/n,y=f/n,v=-f/r,_=h/r,x=m*u+y*s,b=v*u+_*s,w=m*t+y*e,k=v*t+_*e;let A=1/((w-x)*(w-x)+(k-b)*(k-b))-.25;A<0&&(A=0);let M=Math.sqrt(A);o==i&&(M=-M);const E=.5*(x+w)-M*(k-b),D=.5*(b+k)+M*(w-x),C=Math.atan2(b-D,x-E);let F=Math.atan2(k-D,w-E)-C;F<0&&1===o?F+=Ep:F>0&&0===o&&(F-=Ep);const S=Math.ceil(Math.abs(F/(Mp+.001))),B=[];for(let t=0;t<S;++t){const e=C+t*F/S,i=C+(t+1)*F/S;B[t]=[E,D,e,i,n,r,f,h]}return Cp[l]=B}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,n);for(let e=0;e<i.length;++e){const n=Bp(i[e]);t.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])}}const Rp=.5773502691896257,$p={circle:{draw:function(t,e){const n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,Ep)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/2.5;t.moveTo(-n,-r),t.lineTo(-n,r),t.lineTo(-r,r),t.lineTo(-r,n),t.lineTo(r,n),t.lineTo(r,r),t.lineTo(n,r),t.lineTo(n,-r),t.lineTo(r,-r),t.lineTo(r,-n),t.lineTo(-r,-n),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,e){const n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},arrow:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/7,i=n/2.5,o=n/8;t.moveTo(-r,n),t.lineTo(r,n),t.lineTo(r,-o),t.lineTo(i,-o),t.lineTo(0,-n),t.lineTo(-i,-o),t.lineTo(-r,-o),t.closePath()}},wedge:{draw:function(t,e){var n=Math.sqrt(e)/2,r=Dp*n,i=r-n*Rp,o=n/4;t.moveTo(0,-r-i),t.lineTo(-o,r-i),t.lineTo(o,r-i),t.closePath()}},triangle:{draw:function(t,e){var n=Math.sqrt(e)/2,r=Dp*n,i=r-n*Rp;t.moveTo(0,-r-i),t.lineTo(-n,r-i),t.lineTo(n,r-i),t.closePath()}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Dp*n;t.moveTo(0,-r),t.lineTo(-n,r),t.lineTo(n,r),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Dp*n;t.moveTo(0,r),t.lineTo(-n,-r),t.lineTo(n,-r),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Dp*n;t.moveTo(r,0),t.lineTo(-r,-n),t.lineTo(-r,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,r=Dp*n;t.moveTo(-r,0),t.lineTo(r,-n),t.lineTo(r,n),t.closePath()}},stroke:{draw:function(t,e){const n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(n,0)}}};function qp(t){return it($p,t)?$p[t]:function(t){if(!it(Lp,t)){const e=kp(t);Lp[t]={draw:function(t,n){Np(t,e,0,0,Math.sqrt(n)/2)}}}return Lp[t]}(t)}var Lp={};const Up=.448084975506;function Pp(t){return t.x}function jp(t){return t.y}function Ip(t){return t.width}function Wp(t){return t.height}function Hp(t){return"function"==typeof t?t:()=>+t}function Yp(t,e,n){return Math.max(e,Math.min(t,n))}function Vp(){var t=Pp,e=jp,n=Ip,r=Wp,i=Hp(0),o=i,a=i,u=i,s=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+e.call(this,l),g=+n.call(this,l),m=+r.call(this,l),y=Math.min(g,m)/2,v=Yp(+i.call(this,l),0,y),_=Yp(+o.call(this,l),0,y),x=Yp(+a.call(this,l),0,y),b=Yp(+u.call(this,l),0,y);if(s||(s=h=ul()),v<=0&&_<=0&&x<=0&&b<=0)s.rect(d,p,g,m);else{var w=d+g,k=p+m;s.moveTo(d+v,p),s.lineTo(w-_,p),s.bezierCurveTo(w-Up*_,p,w,p+Up*_,w,p+_),s.lineTo(w,k-b),s.bezierCurveTo(w,k-Up*b,w-Up*b,k,w-b,k),s.lineTo(d+x,k),s.bezierCurveTo(d+Up*x,k,d,k-Up*x,d,k-x),s.lineTo(d,p+v),s.bezierCurveTo(d,p+Up*v,d+Up*v,p,d+v,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(e){return arguments.length?(t=Hp(e),l):t},l.y=function(t){return arguments.length?(e=Hp(t),l):e},l.width=function(t){return arguments.length?(n=Hp(t),l):n},l.height=function(t){return arguments.length?(r=Hp(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Hp(t),o=null!=e?Hp(e):i,u=null!=n?Hp(n):i,a=null!=r?Hp(r):o,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Gp(){var t,e,n,r,i,o,a,u,s=null;function l(t,e,n){const r=n/2;if(i){var l=a-e,c=t-o;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*u,d=(c/=f)*u,p=Math.atan2(c,l);s.moveTo(o-h,a-d),s.lineTo(t-l*r,e-c*r),s.arc(t,e,r,p-Math.PI,p),s.lineTo(o+h,a+d),s.arc(o,a,u,p,p+Math.PI)}else s.arc(t,e,r,0,Ep);s.closePath()}else i=1;o=t,a=e,u=r}function c(o){var a,u,c,f=o.length,h=!1;for(null==s&&(s=c=ul()),a=0;a<=f;++a)!(a<f&&r(u=o[a],a,o))===h&&(h=!h)&&(i=0),h&&l(+t(u,a,o),+e(u,a,o),+n(u,a,o));if(c)return s=null,c+""||null}return c.x=function(e){return arguments.length?(t=e,c):t},c.y=function(t){return arguments.length?(e=t,c):e},c.size=function(t){return arguments.length?(n=t,c):n},c.defined=function(t){return arguments.length?(r=t,c):r},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function Xp(t,e){return null!=t?t:e}const Jp=t=>t.x||0,Zp=t=>t.y||0,Qp=t=>!(!1===t.defined),Kp=function(){var t=wl,e=kl,n=sl(0),r=null,i=Al,o=Ml,a=El,u=null;function s(){var s,l,c=+t.apply(this,arguments),f=+e.apply(this,arguments),h=i.apply(this,arguments)-vl,d=o.apply(this,arguments)-vl,p=ll(d-h),g=d>h;if(u||(u=s=ul()),f<c&&(l=f,f=c,c=l),f>ml)if(p>_l-ml)u.moveTo(f*fl(h),f*pl(h)),u.arc(0,0,f,h,d,!g),c>ml&&(u.moveTo(c*fl(d),c*pl(d)),u.arc(0,0,c,d,h,g));else{var m,y,v=h,_=d,x=h,b=d,w=p,k=p,A=a.apply(this,arguments)/2,M=A>ml&&(r?+r.apply(this,arguments):gl(c*c+f*f)),E=dl(ll(f-c)/2,+n.apply(this,arguments)),D=E,C=E;if(M>ml){var F=bl(M/c*pl(A)),S=bl(M/f*pl(A));(w-=2*F)>ml?(x+=F*=g?1:-1,b-=F):(w=0,x=b=(h+d)/2),(k-=2*S)>ml?(v+=S*=g?1:-1,_-=S):(k=0,v=_=(h+d)/2)}var B=f*fl(v),T=f*pl(v),z=c*fl(b),N=c*pl(b);if(E>ml){var O,R=f*fl(_),$=f*pl(_),q=c*fl(x),L=c*pl(x);if(p<yl&&(O=Dl(B,T,q,L,R,$,z,N))){var U=B-O[0],P=T-O[1],j=R-O[0],I=$-O[1],W=1/pl(xl((U*j+P*I)/(gl(U*U+P*P)*gl(j*j+I*I)))/2),H=gl(O[0]*O[0]+O[1]*O[1]);D=dl(E,(c-H)/(W-1)),C=dl(E,(f-H)/(W+1))}}k>ml?C>ml?(m=Cl(q,L,B,T,f,C,g),y=Cl(R,$,z,N,f,C,g),u.moveTo(m.cx+m.x01,m.cy+m.y01),C<E?u.arc(m.cx,m.cy,C,cl(m.y01,m.x01),cl(y.y01,y.x01),!g):(u.arc(m.cx,m.cy,C,cl(m.y01,m.x01),cl(m.y11,m.x11),!g),u.arc(0,0,f,cl(m.cy+m.y11,m.cx+m.x11),cl(y.cy+y.y11,y.cx+y.x11),!g),u.arc(y.cx,y.cy,C,cl(y.y11,y.x11),cl(y.y01,y.x01),!g))):(u.moveTo(B,T),u.arc(0,0,f,v,_,!g)):u.moveTo(B,T),c>ml&&w>ml?D>ml?(m=Cl(z,N,R,$,c,-D,g),y=Cl(B,T,q,L,c,-D,g),u.lineTo(m.cx+m.x01,m.cy+m.y01),D<E?u.arc(m.cx,m.cy,D,cl(m.y01,m.x01),cl(y.y01,y.x01),!g):(u.arc(m.cx,m.cy,D,cl(m.y01,m.x01),cl(m.y11,m.x11),!g),u.arc(0,0,c,cl(m.cy+m.y11,m.cx+m.x11),cl(y.cy+y.y11,y.cx+y.x11),g),u.arc(y.cx,y.cy,D,cl(y.y11,y.x11),cl(y.y01,y.x01),!g))):u.arc(0,0,c,b,x,g):u.lineTo(z,N)}else u.moveTo(0,0);if(u.closePath(),s)return u=null,s+""||null}return s.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-yl/2;return[fl(r)*n,pl(r)*n]},s.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:sl(+e),s):t},s.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:sl(+t),s):e},s.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:sl(+t),s):n},s.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:sl(+t),s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:sl(+t),s):i},s.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:sl(+t),s):o},s.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:sl(+t),s):a},s.context=function(t){return arguments.length?(u=null==t?null:t,s):u},s}().startAngle((t=>t.startAngle||0)).endAngle((t=>t.endAngle||0)).padAngle((t=>t.padAngle||0)).innerRadius((t=>t.innerRadius||0)).outerRadius((t=>t.outerRadius||0)).cornerRadius((t=>t.cornerRadius||0)),tg=Ol().x(Jp).y1(Zp).y0((t=>(t.y||0)+(t.height||0))).defined(Qp),eg=Ol().y(Zp).x1(Jp).x0((t=>(t.x||0)+(t.width||0))).defined(Qp),ng=Nl().x(Jp).y(Zp).defined(Qp),rg=Vp().x(Jp).y(Zp).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Xp(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Xp(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Xp(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Xp(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),ig=function(t,e){var n=null;function r(){var r;if(n||(n=r=ul()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return t="function"==typeof t?t:sl(t||Rl),e="function"==typeof e?e:sl(void 0===e?64:+e),r.type=function(e){return arguments.length?(t="function"==typeof e?e:sl(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:sl(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r}().type((t=>qp(t.shape||"circle"))).size((t=>Xp(t.size,64))),og=Gp().x(Jp).y(Zp).defined(Qp).size((t=>t.size||1));function ag(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function ug(t,e,n,r){return rg.context(t)(e,n,r)}var sg=1;function lg(){sg=1}function cg(t,e,n){var r=e.clip,i=t._defs,o=e.clip_id||(e.clip_id="clip"+sg++),a=i.clipping[o]||(i.clipping[o]={id:o});return Y(r)?a.path=r(null):ag(n)?a.path=ug(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function fg(t){this.clear(),t&&this.union(t)}function hg(t){this.mark=t,this.bounds=this.bounds||new fg}function dg(t){hg.call(this,t),this.items=this.items||[]}function pg(t){this._pending=0,this._loader=t||Jo()}function gg(t){t._pending+=1}function mg(t){t._pending-=1}function yg(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(r+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,r):0))}return t}fg.prototype={clone(){return new fg(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},add(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,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(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},rotate(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,e,n){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(t),s=Math.sin(t),l=e-e*u+n*s,c=n-e*s-n*u;return[u*r-s*i+l,s*r+u*i+c,u*r-s*a+l,s*r+u*a+c,u*o-s*i+l,s*o+u*i+c,u*o-s*a+l,s*o+u*a+c]},union(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},contains(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},st(dg,hg),pg.prototype={pending(){return this._pending},sanitizeURL(t){const e=this;return gg(e),e._loader.sanitize(t,{context:"href"}).then((t=>(mg(e),t))).catch((()=>(mg(e),null)))},loadImage(t){const e=this,n=mc();return gg(e),e._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!n)throw{url:r};const i=new n,o=it(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>mg(e),i.onerror=()=>mg(e),i.src=r,i})).catch((t=>(mg(e),{complete:!1,width:0,height:0,src:t&&t.url||""})))},ready(){const t=this;return new Promise((e=>{!function n(r){t.pending()?setTimeout((()=>{n(!0)}),10):e(r)}(!1)}))}};const vg=Ep-1e-8;let _g,xg,bg,wg,kg,Ag,Mg,Eg;const Dg=(t,e)=>_g.add(t,e),Cg=(t,e)=>Dg(xg=t,bg=e),Fg=t=>Dg(t,_g.y1),Sg=t=>Dg(_g.x1,t),Bg=(t,e)=>kg*t+Mg*e,Tg=(t,e)=>Ag*t+Eg*e,zg=(t,e)=>Dg(Bg(t,e),Tg(t,e)),Ng=(t,e)=>Cg(Bg(t,e),Tg(t,e));function Og(t,e){return _g=t,e?(wg=e*Ap,kg=Eg=Math.cos(wg),Ag=Math.sin(wg),Mg=-Ag):(kg=Eg=1,wg=Ag=Mg=0),Rg}const Rg={beginPath(){},closePath(){},moveTo:Ng,lineTo:Ng,rect(t,e,n,r){wg?(zg(t+n,e),zg(t+n,e+r),zg(t,e+r),Ng(t,e)):(Dg(t+n,e+r),Cg(t,e))},quadraticCurveTo(t,e,n,r){const i=Bg(t,e),o=Tg(t,e),a=Bg(n,r),u=Tg(n,r);$g(xg,i,a,Fg),$g(bg,o,u,Sg),Cg(a,u)},bezierCurveTo(t,e,n,r,i,o){const a=Bg(t,e),u=Tg(t,e),s=Bg(n,r),l=Tg(n,r),c=Bg(i,o),f=Tg(i,o);qg(xg,a,s,c,Fg),qg(bg,u,l,f,Sg),Cg(c,f)},arc(t,e,n,r,i,o){if(r+=wg,i+=wg,xg=n*Math.cos(i)+t,bg=n*Math.sin(i)+e,Math.abs(i-r)>vg)Dg(t-n,e-n),Dg(t+n,e+n);else{const a=r=>Dg(n*Math.cos(r)+t,n*Math.sin(r)+e);let u,s;if(a(r),a(i),i!==r)if((r%=Ep)<0&&(r+=Ep),(i%=Ep)<0&&(i+=Ep),i<r&&(o=!o,u=r,r=i,i=u),o)for(i-=Ep,u=r-r%Mp,s=0;s<4&&u>i;++s,u-=Mp)a(u);else for(u=r-r%Mp+Mp,s=0;s<4&&u<i;++s,u+=Mp)a(u)}}};function $g(t,e,n,r){const i=(t-e)/(t+n-2*e);0<i&&i<1&&r(t+(e-t)*i)}function qg(t,e,n,r,i){const o=r-t+3*e-3*n,a=t+n-2*e,u=t-e;let s,l=0,c=0;Math.abs(o)>1e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),l=(-a+s)/o,c=(-a-s)/o)):l=.5*u/a,0<l&&l<1&&i(Lg(l,t,e,n,r)),0<c&&c<1&&i(Lg(c,t,e,n,r))}function Lg(t,e,n,r,i){const o=1-t,a=o*o,u=t*t;return a*o*e+3*a*t*n+3*o*u*r+u*t*i}var Ug=(Ug=gc(1,1))?Ug.getContext("2d"):null;const Pg=new fg;function jg(t){return function(e,n){if(!Ug)return!0;t(Ug,e),Pg.clear().union(e.bounds).intersect(n).round();const{x1:r,y1:i,x2:o,y2:a}=Pg;for(let t=i;t<=a;++t)for(let e=r;e<=o;++e)if(Ug.isPointInPath(e,t))return!0;return!1}}function Ig(t,e){return e.contains(t.x||0,t.y||0)}function Wg(t,e){const n=t.x||0,r=t.y||0,i=t.width||0,o=t.height||0;return e.intersects(Pg.set(n,r,n+i,r+o))}function Hg(t,e){const n=t.x||0,r=t.y||0;return Yg(e,n,r,null!=t.x2?t.x2:n,null!=t.y2?t.y2:r)}function Yg(t,e,n,r,i){const{x1:o,y1:a,x2:u,y2:s}=t,l=r-e,c=i-n;let f,h,d,p,g=0,m=1;for(p=0;p<4;++p){if(0===p&&(f=-l,h=-(o-e)),1===p&&(f=l,h=u-e),2===p&&(f=-c,h=-(a-n)),3===p&&(f=c,h=s-n),Math.abs(f)<1e-10&&h<0)return!1;if(d=h/f,f<0){if(d>m)return!1;d>g&&(g=d)}else if(f>0){if(d<g)return!1;d<m&&(m=d)}}return!0}function Vg(t,e){t.globalCompositeOperation=e.blend||"source-over"}function Gg(t,e){return null==t?e:t}function Xg(t,e){const n=e.length;for(let r=0;r<n;++r)t.addColorStop(e[r].offset,e[r].color);return t}function Jg(t,e,n){return gp(n)?function(t,e,n){const r=n.width(),i=n.height();let o;if("radial"===e.gradient)o=t.createRadialGradient(n.x1+Gg(e.x1,.5)*r,n.y1+Gg(e.y1,.5)*i,Math.max(r,i)*Gg(e.r1,0),n.x1+Gg(e.x2,.5)*r,n.y1+Gg(e.y2,.5)*i,Math.max(r,i)*Gg(e.r2,.5));else{const a=Gg(e.x1,0),u=Gg(e.y1,0),s=Gg(e.x2,1),l=Gg(e.y2,0);if(a!==s&&u!==l&&r!==i){const n=gc(Math.ceil(r),Math.ceil(i)),o=n.getContext("2d");return o.scale(r,i),o.fillStyle=Xg(o.createLinearGradient(a,u,s,l),e.stops),o.fillRect(0,0,r,i),t.createPattern(n,"no-repeat")}o=t.createLinearGradient(n.x1+a*r,n.y1+u*i,n.x1+s*r,n.y1+l*i)}return Xg(o,e.stops)}(t,n,e.bounds):n}function Zg(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=Jg(t,e,e.fill),!0)}var Qg=[];function Kg(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=Jg(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||Qg),t.lineDashOffset=e.strokeDashOffset||0),!0))}function tm(t,e){return t.zindex-e.zindex||t.index-e.index}function em(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,o=[];for(n=0,r=i.length;n<r;++n)(e=i[n]).index=n,e.zindex&&o.push(e);return t.zdirty=!1,t.zitems=o.sort(tm)}function nm(t,e){var n,r,i=t.items;if(!i||!i.length)return;const o=em(t);if(o&&o.length){for(n=0,r=i.length;n<r;++n)i[n].zindex||e(i[n]);i=o}for(n=0,r=i.length;n<r;++n)e(i[n])}function rm(t,e){var n,r,i=t.items;if(!i||!i.length)return null;const o=em(t);for(o&&o.length&&(i=o),r=i.length;--r>=0;)if(n=e(i[r]))return n;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function im(t){return function(e,n,r){nm(n,(n=>{r&&!r.intersects(n.bounds)||am(t,e,n,n)}))}}function om(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||am(t,e,n.items[0],n.items)}}function am(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(Vg(e,n),n.fill&&Zg(e,n,i)&&e.fill(),n.stroke&&Kg(e,n,i)&&e.stroke()))}function um(t){return t=t||g,function(e,n,r,i,o,a){return r*=e.pixelRatio,i*=e.pixelRatio,rm(n,(n=>{const u=n.bounds;if((!u||u.contains(o,a))&&u)return t(e,n,r,i,o,a)?n:void 0}))}}function sm(t,e){return function(n,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,l=null==e?s.fill:e,c=s.stroke&&n.isPointInStroke;return c&&(a=s.strokeWidth,u=s.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=u?u:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,o)||c&&n.isPointInStroke(i,o))}}function lm(t){return um(sm(t))}function cm(t,e){return"translate("+t+","+e+")"}function fm(t){return"rotate("+t+")"}function hm(t){return cm(t.x||0,t.y||0)}function dm(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,o=n.angle||0;t.translate(r,i),o&&t.rotate(o*=Ap),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",function(t){return cm(t.x||0,t.y||0)+(t.angle?" "+fm(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){return e(Og(t,n.angle),n),yg(t,n).translate(n.x||0,n.y||0)},draw:im(r),pick:lm(r),isect:n||jg(r)}}var pm=dm("arc",(function(t,e){return Kp.context(t)(e)}));function gm(t,e,n){function r(t,n){t.beginPath(),e(t,n)}const i=sm(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(Og(t),r),yg(t,r[0]))},draw:om(r),pick:function(t,e,n,r,o,a){var u=e.items,s=e.bounds;return!u||!u.length||s&&!s.contains(o,a)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,u,n,r)?u[0]:null)},isect:Ig,tip:n}}var mm=gm("area",(function(t,e){const n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?eg:tg).curve(xp(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,u=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i))<u&&(u=r,n=t[a]);return n}));function ym(t,e){t.beginPath(),ag(e)?ug(t,e,0,0):t.rect(0,0,e.width||0,e.height||0),t.clip()}function vm(t){const e=Gg(t.strokeWidth,1);return null!=t.strokeOffset?t.strokeOffset:t.stroke&&e>.5&&e<1.5?.5-Math.abs(e-1):0}function _m(t,e){const n=vm(e);t("d",ug(null,e,n,n))}function xm(t,e,n,r){const i=vm(e);t.beginPath(),ug(t,e,(n||0)+i,(r||0)+i)}const bm=sm(xm),wm=sm(xm,!1),km=sm(xm,!0);var Am={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",hm(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,r=n.length;for(let e=0;e<r;++e)t.union(n[e].bounds)}return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),yg(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){nm(e,(e=>{const r=e.x||0,i=e.y||0,o=e.strokeForeground,a=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&a&&(xm(t,e,r,i),Vg(t,e),e.fill&&Zg(t,e,a)&&t.fill(),e.stroke&&!o&&Kg(t,e,a)&&t.stroke()),t.save(),t.translate(r,i),e.clip&&ym(t,e),n&&n.translate(-r,-i),nm(e,(e=>{this.draw(t,e,n)})),n&&n.translate(r,i),t.restore(),o&&e.stroke&&a&&(xm(t,e,r,i),Vg(t,e),Kg(t,e,a)&&t.stroke())}))},pick:function(t,e,n,r,i,o){if(e.bounds&&!e.bounds.contains(i,o)||!e.items)return null;const a=n*t.pixelRatio,u=r*t.pixelRatio;return rm(e,(s=>{let l,c,f;const h=s.bounds;if(h&&!h.contains(i,o))return;c=s.x||0,f=s.y||0;const d=c+(s.width||0),p=f+(s.height||0),g=s.clip;if(g&&(i<c||i>d||o<f||o>p))return;if(t.save(),t.translate(c,f),c=i-c,f=o-f,g&&ag(s)&&!km(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,y=!1!==e.interactive;return y&&m&&s.stroke&&wm(t,s,a,u)?(t.restore(),s):(l=rm(s,(t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?this.pick(t,n,r,c,f):null)),!l&&y&&(s.fill||!m&&s.stroke)&&bm(t,s,a,u)&&(l=s),t.restore(),l||null)}))},isect:Wg,content:function(t,e,n){t("clip-path",e.clip?cg(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),_m(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?_m(t,e):t("d","")}},Mm={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Em(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then((e=>{t.image=e,t.image.url=t.url}))),n}function Dm(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function Cm(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function Fm(t,e){return"center"===t?e/2:"right"===t?e:0}function Sm(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var Bm={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=Em(e,n),i=Dm(e,r),o=Cm(e,r),a=(e.x||0)-Fm(e.align,i),u=(e.y||0)-Sm(e.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",Mm["xmlns:xlink"],"xlink:href"),t("transform",cm(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=Dm(e,n),i=Cm(e,n),o=(e.x||0)-Fm(e.align,r),a=(e.y||0)-Sm(e.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,e,n){nm(e,(e=>{if(n&&!n.intersects(e.bounds))return;const r=Em(e,this);let i=Dm(e,r),o=Cm(e,r);if(0===i||0===o)return;let a,u,s,l,c=(e.x||0)-Fm(e.align,i),f=(e.y||0)-Sm(e.baseline,o);!1!==e.aspect&&(u=r.width/r.height,s=e.width/e.height,u==u&&s==s&&u!==s&&(s<u?(l=i/u,f+=(o-l)/2,o=l):(l=o*u,c+=(i-l)/2,i=l))),(r.complete||r.toDataURL)&&(Vg(t,e),t.globalAlpha=null!=(a=e.opacity)?a:1,t.imageSmoothingEnabled=!1!==e.smooth,t.drawImage(r,c,f,i,o))}))},pick:um(),isect:g,get:Em,xOffset:Fm,yOffset:Sm},Tm=gm("line",(function(t,e){const n=e[0],r=n.interpolate||"linear";return ng.curve(xp(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(r=t[o].y-e[1])*r<i)return t[o];return null}));function zm(t,e){var n=e.path;if(null==n)return!0;var r=e.x||0,i=e.y||0,o=e.scaleX||1,a=e.scaleY||1,u=(e.angle||0)*Ap,s=e.pathCache;s&&s.path===n||((e.pathCache=s=kp(n)).path=n),u&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(u),Np(t,s,0,0,o,a),t.rotate(-u),t.translate(-r,-i)):Np(t,s,r,i,o,a)}var Nm={type:"path",tag:"path",nested:!1,attr:function(t,e){var n=e.scaleX||1,r=e.scaleY||1;1===n&&1===r||t("vector-effect","non-scaling-stroke"),t("transform",function(t){return cm(t.x||0,t.y||0)+(t.angle?" "+fm(t.angle):"")+(t.scaleX||t.scaleY?" "+function(t,e){return"scale("+t+","+e+")"}(t.scaleX||1,t.scaleY||1):"")}(e)),t("d",e.path)},bound:function(t,e){return zm(Og(t,e.angle),e)?t.set(0,0,0,0):yg(t,e,!0)},draw:im(zm),pick:lm(zm),isect:jg(zm)};function Om(t,e){t.beginPath(),ug(t,e)}var Rm={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",ug(null,e))},bound:function(t,e){var n,r;return yg(t.set(n=e.x||0,r=e.y||0,n+e.width||0,r+e.height||0),e)},draw:im(Om),pick:lm(Om),isect:Wg};function $m(t,e,n){var r,i,o,a;return!(!e.stroke||!Kg(t,e,n))&&(r=e.x||0,i=e.y||0,o=null!=e.x2?e.x2:r,a=null!=e.y2?e.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(o,a),!0)}var qm={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",hm(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,r;return yg(t.set(n=e.x||0,r=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:r),e)},draw:function(t,e,n){nm(e,(e=>{if(!n||n.intersects(e.bounds)){var r=null==e.opacity?1:e.opacity;r&&$m(t,e,r)&&(Vg(t,e),t.stroke())}}))},pick:um((function(t,e,n,r){return!!t.isPointInStroke&&($m(t,e,1)&&t.isPointInStroke(n,r))})),isect:Hg},Lm=dm("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),Um=dm("symbol",(function(t,e){return ig.context(t)(e)}),Ig);const Pm=vt();var jm={height:Gm,measureWidth:Ym,estimateWidth:Wm,width:Wm,canvas:Im};function Im(t){jm.width=t&&Ug?Ym:Wm}function Wm(t,e){return Hm(Qm(t,e),Gm(t))}function Hm(t,e){return~~(.8*t.length*e)}function Ym(t,e){return Gm(t)<=0||!(e=Qm(t,e))?0:Vm(e,ty(t))}function Vm(t,e){const n=`(${e}) ${t}`;let r=Pm.get(n);return void 0===r&&(Ug.font=e,r=Ug.measureText(t).width,Pm.set(n,r)),r}function Gm(t){return null!=t.fontSize?+t.fontSize||0:11}function Xm(t){return null!=t.lineHeight?t.lineHeight:Gm(t)+2}function Jm(t){return e=t.lineBreak&&t.text&&!_(t.text)?t.text.split(t.lineBreak):t.text,_(e)?e.length>1?e:e[0]:e;var e}function Zm(t){const e=Jm(t);return(_(e)?e.length-1:0)*Xm(t)}function Qm(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(jm.width===Ym){const e=ty(t);return t=>Vm(t,e)}{const e=Gm(t);return t=>Hm(t,e)}}(t);if(r(e)<n)return e;var i,o=t.ellipsis||"…",a="rtl"===t.dir,u=0,s=e.length;if(n-=r(o),a){for(;u<s;)i=u+s>>>1,r(e.slice(i))>n?u=i+1:s=i;return o+e.slice(u)}for(;u<s;)i=1+(u+s>>>1),r(e.slice(0,i))<n?u=i:s=i-1;return e.slice(0,u)+o}(t,n):n}function Km(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function ty(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+Gm(t)+"px "+Km(t,e)}function ey(t){var e=t.baseline,n=Gm(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:"line-top"===e?.29*n+.5*Xm(t):"line-bottom"===e?.29*n-.5*Xm(t):0)}Im(!0);const ny={left:"start",center:"middle",right:"end"},ry=new fg;function iy(t){var e,n=t.x||0,r=t.y||0,i=t.radius||0;return i&&(e=(t.theta||0)-Mp,n+=i*Math.cos(e),r+=i*Math.sin(e)),ry.x1=n,ry.y1=r,ry}function oy(t,e,n){var r,i=jm.height(e),o=e.align,a=iy(e),u=a.x1,s=a.y1,l=e.dx||0,c=(e.dy||0)+ey(e)-Math.round(.8*i),f=Jm(e);if(_(f)?(i+=Xm(e)*(f.length-1),r=f.reduce(((t,n)=>Math.max(t,jm.width(e,n))),0)):r=jm.width(e,f),"center"===o?l-=r/2:"right"===o&&(l-=r),t.set(l+=u,c+=s,l+r,c+i),e.angle&&!n)t.rotate(e.angle*Ap,u,s);else if(2===n)return t.rotatedPoints(e.angle*Ap,u,s);return t}var ay={type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+ey(e),o=iy(e),a=o.x1,u=o.y1,s=e.angle||0;t("text-anchor",ny[e.align]||"start"),s?(n=cm(a,u)+" "+fm(s),(r||i)&&(n+=" "+cm(r,i))):n=cm(a+r,u+i),t("transform",n)},bound:oy,draw:function(t,e,n){nm(e,(e=>{var r,i,o,a,u,s,l,c=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===c||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=ty(e),t.textAlign=e.align||"left",i=(r=iy(e)).x1,o=r.y1,e.angle&&(t.save(),t.translate(i,o),t.rotate(e.angle*Ap),i=o=0),i+=e.dx||0,o+=(e.dy||0)+ey(e),s=Jm(e),Vg(t,e),_(s))for(u=Xm(e),a=0;a<s.length;++a)l=Qm(e,s[a]),e.fill&&Zg(t,e,c)&&t.fillText(l,i,o),e.stroke&&Kg(t,e,c)&&t.strokeText(l,i,o),o+=u;else l=Qm(e,s),e.fill&&Zg(t,e,c)&&t.fillText(l,i,o),e.stroke&&Kg(t,e,c)&&t.strokeText(l,i,o);e.angle&&t.restore()}}))},pick:um((function(t,e,n,r,i,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var a=iy(e),u=a.x1,s=a.y1,l=oy(ry,e,1),c=-e.angle*Ap,f=Math.cos(c),h=Math.sin(c),d=f*i-h*o+(u-f*u+h*s),p=h*i+f*o+(s-h*u-f*s);return l.contains(d,p)})),isect:function(t,e){const n=oy(ry,t,2);return Yg(e,n[0],n[1],n[2],n[3])||Yg(e,n[0],n[1],n[4],n[5])||Yg(e,n[4],n[5],n[6],n[7])||Yg(e,n[2],n[3],n[6],n[7])}},uy=gm("trail",(function(t,e){return og.context(t)(e)}),(function(t,e){for(var n,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null})),sy={arc:pm,area:mm,group:Am,image:Bm,line:Tm,path:Nm,rect:Rm,rule:qm,shape:Lm,symbol:Um,text:ay,trail:uy};function ly(t,e,n){var r=sy[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new fg),t,n)}var cy={mark:null};function fy(t,e,n){var r,i,o,a,u=sy[t.marktype],s=u.bound,l=t.items,c=l&&l.length;if(u.nested)return c?o=l[0]:(cy.mark=t,o=cy),a=ly(o,s,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new fg,c)for(r=0,i=l.length;r<i;++r)e.union(ly(l[r],s,n));return t.bounds=e}const hy=["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 dy(t,e){return JSON.stringify(t,hy,e)}function py(t){return gy("string"==typeof t?JSON.parse(t):t)}function gy(t){var e,n,r,i=t.marktype,o=t.items;if(o)for(n=0,r=o.length;n<r;++n)e=i?"mark":"group",o[n][e]=t,o[n].zindex&&(o[n][e].zdirty=!0),"group"===(i||e)&&gy(o[n]);return i&&fy(t),t}function my(t){arguments.length?this.root=py(t):(this.root=yy({marktype:"group",name:"root",role:"frame"}),this.root.items=[new dg(this.root)])}function yy(t,e){const n={bounds:new fg,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0};return null!=t.aria&&(n.aria=t.aria),t.description&&(n.description=t.description),n}function vy(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function _y(t,e){e=e.toLowerCase();for(var n=t.childNodes,r=0,i=n.length;r<i;++r)if(n[r].tagName.toLowerCase()===e)return n[r]}function xy(t,e,n,r){var i,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(i=o||null,o=vy(t.ownerDocument,n,r),t.insertBefore(o,i)),o}function by(t,e){for(var n=t.childNodes,r=n.length;r>e;)t.removeChild(n[--r]);return t}function wy(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function ky(t,e){const n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Ay(t,e){this._active=null,this._handlers={},this._loader=t||Jo(),this._tooltip=e||My}function My(t,e,n,r){t.element().setAttribute("title",r||"")}function Ey(t){this._el=null,this._bgcolor=null,this._loader=new pg(t)}my.prototype={toJSON(t){return dy(this.root,t||0)},mark(t,e,n){const r=yy(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r}},Ay.prototype={initialize(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},scene(t){return arguments.length?(this._scene=t,this):this._scene},on(){},off(){},_handlerIndex(t,e,n){for(let r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},handlers(t){const e=this._handlers,n=[];if(t)n.push(...e[this.eventName(t)]);else for(const t in e)n.push(...e[t]);return n},eventName(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)},handleHref(t,e,n){this._loader.sanitize(n,{context:"href"}).then((e=>{const n=new MouseEvent(t.type,t),r=vy(null,"a");for(const t in e)r.setAttribute(t,e[t]);r.dispatchEvent(n)})).catch((()=>{}))},handleTooltip(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,o,a=t&&t.mark;if(a&&(i=sy[a.marktype]).tip){for((o=ky(e,n))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(e,t,this.canvas(),this._origin);const r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},getItemBoundingClientRect(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let u=i.x1+r[0]+n.left,s=i.y1+r[1]+n.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:o,height:a,left:u,top:s,right:u+o,bottom:s+a}}},Ey.prototype={initialize(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},resize(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},dirty(){},render(t){const e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},_render(){},renderAsync(t){const e=this.render(t);return this._ready?this._ready.then((()=>e)):Promise.resolve(e)},_load(t,e){var n=this,r=n._loader[t](e);if(!n._ready){const t=n._call;n._ready=n._loader.ready().then((e=>{e&&t(),n._ready=null}))}return r},sanitizeURL(t){return this._load("sanitizeURL",t)},loadImage(t){return this._load("loadImage",t)}};const Dy="dragenter",Cy="dragleave",Fy="dragover",Sy="mousedown",By="mousemove",Ty="mouseout",zy="mouseover",Ny="click",Oy="mousewheel",Ry="touchstart",$y="touchmove",qy="touchend",Ly=By,Uy=Ty,Py=Ny;function jy(t,e){Ay.call(this,t,e),this._down=null,this._touch=null,this._first=!0,this._events={}}function Iy(t,e){(t=>t===Ry||t===$y||t===qy?[Ry,$y,qy]:[t])(e).forEach((e=>function(t,e){const n=t.canvas();n&&!t._events[e]&&(t._events[e]=1,n.addEventListener(e,t[e]?n=>t[e](n):n=>t.fire(e,n)))}(t,e)))}function Wy(t,e,n){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||this.fire(n,r),this._active=o,this.fire(e,r)),this.fire(t,r)}}function Hy(t){return function(e){this.fire(t,e),this._active=null}}st(jy,Ay,{initialize(t,e,n){return this._canvas=t&&_y(t,"canvas"),[Ny,Sy,By,Ty,Cy].forEach((t=>Iy(this,t))),Ay.prototype.initialize.call(this,t,e,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",Dy,Cy,Fy,Sy,"mouseup",By,Ty,zy,Ny,"dblclick","wheel",Oy,Ry,$y,qy],DOMMouseScroll(t){this.fire(Oy,t)},mousemove:Wy(By,zy,Ty),dragover:Wy(Fy,Dy,Cy),mouseout:Hy(Ty),dragleave:Hy(Cy),mousedown(t){this._down=this._active,this.fire(Sy,t)},click(t){this._down===this._active&&(this.fire(Ny,t),this._down=null)},touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Ry,t,!0)},touchmove(t){this.fire($y,t,!0)},touchend(t){this.fire(qy,t,!0),this._touch=null},fire(t,e,n){const r=n?this._touch:this._active,i=this._handlers[t];if(e.vegaType=t,t===Py&&r&&r.href?this.handleHref(e,r,r.href):t!==Ly&&t!==Uy||this.handleTooltip(e,r,t!==Uy),i)for(let t=0,n=i.length;t<n;++t)i[t].handler.call(this._obj,e,r)},on(t,e){const n=this.eventName(t),r=this._handlers;return this._handlerIndex(r[n],t,e)<0&&(Iy(this,t),(r[n]||(r[n]=[])).push({type:t,handler:e})),this},off(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&r.splice(i,1),this},pickEvent(t){const e=ky(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},pick(t,e,n,r,i){const o=this.context();return sy[t.marktype].pick.call(this,o,t,e,n,r,i)}});var Yy="undefined"!=typeof window&&window.devicePixelRatio||1;function Vy(t){Ey.call(this,t),this._options={},this._redraw=!1,this._dirty=new fg,this._tempb=new fg}const Gy=Ey.prototype;function Xy(t,e){Ay.call(this,t,e);const n=this;n._hrefHandler=Jy(n,((t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=Jy(n,((t,e)=>{n.handleTooltip(t,e,t.type!==Uy)}))}st(Vy,Ey,{initialize(t,e,n,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:gc(1,1,this._options.type),t&&this._canvas&&(by(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Gy.initialize.call(this,t,e,n,r,i)},resize(t,e,n,r){if(Gy.resize.call(this,t,e,n,r),this._canvas)!function(t,e,n,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=a?Yy:i;t.width=e*s,t.height=n*s;for(const t in o)u[t]=o[t];a&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||s("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(t){const e=this._tempb.clear().union(t.bounds);let n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)},_render(t){const e=this.context(),n=this._origin,r=this._width,i=this._height,o=this._dirty,a=((t,e,n)=>(new fg).set(0,0,e,n).translate(-t[0],-t[1]))(n,r,i);e.save();const u=this._redraw||o.empty()?(this._redraw=!1,a.expand(1)):function(t,e,n){return e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,a.intersect(o),n);return this.clear(-n[0],-n[1],r,i),this.draw(e,t,u),e.restore(),o.clear(),this},draw(t,e,n){const r=sy[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),Y(n)?(t.beginPath(),n(t),t.clip()):ym(t,e.group)}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},clear(t,e,n,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,e,n,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,e,n,r))}});const Jy=(t,e)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,e.call(t._obj,n,r)};st(Xy,Ay,{initialize(t,e,n){let r=this._svg;return r&&(r.removeEventListener(Py,this._hrefHandler),r.removeEventListener(Ly,this._tooltipHandler),r.removeEventListener(Uy,this._tooltipHandler)),this._svg=r=t&&_y(t,"svg"),r&&(r.addEventListener(Py,this._hrefHandler),r.addEventListener(Ly,this._tooltipHandler),r.addEventListener(Uy,this._tooltipHandler)),Ay.prototype.initialize.call(this,t,e,n)},canvas(){return this._svg},on(t,e){const n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){const i={type:t,handler:e,listener:Jy(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},off(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}});const Zy="aria-hidden",Qy="aria-label",Ky="role",tv="aria-roledescription",ev="graphics-object",nv="graphics-symbol",rv=(t,e,n)=>({[Ky]:t,[tv]:e,[Qy]:n||void 0}),iv=Ct(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),ov={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?cv(t):null,i=t.context,o=i.scales[e.scale].value,a=i.dataflow.locale(),u=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(r?` titled '${r}'`:"")+` for a ${Td(u)?"discrete":u} scale`+` with ${hp(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?cv(t):null,r=`${e.type||""} legend`.trim(),i=e.scales,o=Object.keys(i),a=t.context,u=a.scales[i[o[0]]].value,s=a.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+` for ${function(t){return(t=t.map((t=>t+("fill"===t||"stroke"===t?" color":"")))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+M(t)}(o)}`+` with ${hp(s,u,t)}`;var l}},"title-text":{desc:"title",caption:t=>`Title text '${lv(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${lv(t)}'`}},av={ariaRole:Ky,ariaRoleDescription:tv,description:Qy};function uv(t,e){const n=!1===e.aria;if(t(Zy,n||void 0),n||null==e.description)for(const e in av)t(av[e],void 0);else{const n=e.mark.marktype;t(Qy,e.description),t(Ky,e.ariaRole||("group"===n?ev:nv)),t(tv,e.ariaRoleDescription||`${n} mark`)}}function sv(t){return!1===t.aria?{[Zy]:!0}:iv[t.role]?null:ov[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return rv(e.role||nv,e.desc,n.description||r(n))}catch(t){return null}}(t,ov[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some((t=>null!=t.description&&!1!==t.aria));return rv(n?ev:nv,`${e} mark container`,t.description)}(t)}function lv(t){return W(t.text).join(" ")}function cv(t){try{return W(M(t.items).items[0].text).join(" ")}catch(t){return null}}const fv=t=>(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function hv(){let t="",e="",n="";const r=[],i=()=>e=n="",o=(t,n)=>{var r;return null!=n&&(e+=` ${t}="${r=n,fv(r).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),a},a={open(u,...s){(o=>{e&&(t+=`${e}>${n}`,i()),r.push(o)})(u),e="<"+u;for(const t of s)for(const e in t)o(e,t[e]);return a},close(){const o=r.pop();return t+=e?e+(n?`>${n}</${o}>`:"/>"):`</${o}>`,i(),a},attr:o,text:t=>(n+=fv(t),a),toString:()=>t};return a}const dv=t=>pv(hv(),t)+"";function pv(t,e){if(t.open(e.tagName),e.hasAttributes()){const n=e.attributes,r=n.length;for(let e=0;e<r;++e)t.attr(n[e].name,n[e].value)}if(e.hasChildNodes()){const n=e.childNodes;for(const e of n)3===e.nodeType?t.text(e.nodeValue):pv(t,e)}return t.close()}const gv={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity",blend:"mix-blend-mode"},mv={fill:"none","stroke-miterlimit":10},yv="http://www.w3.org/2000/xmlns/",vv=Mm.xmlns;function _v(t){Ey.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}const xv=Ey.prototype;function bv(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function wv(t,e,n){let r,i,o;if("radial"===e.gradient){let r=xy(t,n++,"pattern",vv);Sv(r,{id:pp+e.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),r=xy(r,0,"rect",vv),Sv(r,{width:1,height:1,fill:`url(${Tv()}#${e.id})`}),Sv(t=xy(t,n++,"radialGradient",vv),{id:e.id,fx:e.x1,fy:e.y1,fr:e.r1,cx:e.x2,cy:e.y2,r:e.r2})}else Sv(t=xy(t,n++,"linearGradient",vv),{id:e.id,x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2});for(r=0,i=e.stops.length;r<i;++r)o=xy(t,r,"stop",vv),o.setAttribute("offset",e.stops[r].offset),o.setAttribute("stop-color",e.stops[r].color);return by(t,r),n}function kv(t,e,n){let r;return(t=xy(t,n,"clipPath",vv)).setAttribute("id",e.id),e.path?(r=xy(t,0,"path",vv),r.setAttribute("d",e.path)):(r=xy(t,0,"rect",vv),Sv(r,{x:0,y:0,width:e.width,height:e.height})),by(t,1),n+1}function Av(t,e,n,r,i){let o,a=t._svg;if(!a&&(o=e.ownerDocument,a=vy(o,r,vv),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){const e=vy(o,"path",vv);a.appendChild(e),e.__data__=t;const n=vy(o,"g",vv);a.appendChild(n),n.__data__=t;const r=vy(o,"path",vv);a.appendChild(r),r.__data__=t,r.__values__={fill:"default"}}return(a.ownerSVGElement!==i||function(t,e){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=e}(a,n))&&e.insertBefore(a,n?n.nextSibling:e.firstChild),a}st(_v,Ey,{initialize(t,e,n,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=xy(t,0,"svg",vv),this._svg.setAttributeNS(yv,"xmlns",vv),this._svg.setAttributeNS(yv,"xmlns:xlink",Mm["xmlns:xlink"]),this._svg.setAttribute("version",Mm.version),this._svg.setAttribute("class","marks"),by(t,1),this._root=xy(this._svg,0,"g",vv),Sv(this._root,mv),by(this._svg,1)),this.background(this._bgcolor),xv.initialize.call(this,t,e,n,r,i)},background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),xv.background.apply(this,arguments)},resize(t,e,n,r){return xv.resize.call(this,t,e,n,r),this._svg&&(Sv(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this},canvas(){return this._svg},svg(){const t=this._svg,e=this._bgcolor;if(!t)return null;let n;e&&(t.removeAttribute("style"),n=xy(t,0,"rect",vv),Sv(n,{width:this._width,height:this._height,fill:e}));const r=dv(t);return e&&(t.removeChild(n),this._svg.style.setProperty("background-color",e)),r},_render(t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t),by(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},isDirty(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const e=++this._dirtyID;let n,r,i,o,a,u,s;for(a=0,u=t.length;a<u;++a)n=t[a],r=n.mark,r.marktype!==i&&(i=r.marktype,o=sy[i]),r.zdirty&&r.dirty!==e&&(this._dirtyAll=!1,bv(n,e),r.items.forEach((t=>{t.dirty=e}))),r.zdirty||(n.exit?(o.nested&&r.items.length?(s=r.items[0],s._svg&&this._update(o,s._svg,s)):n._svg&&(s=n._svg.parentNode,s&&s.removeChild(n._svg)),n._svg=null):(n=o.nested?r.items[0]:n,n._update!==e&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,bv(n,e)),n._update=e)));return!this._dirtyAll},mark(t,e,n){if(!this.isDirty(e))return e._svg;const r=this._svg,i=sy[e.marktype],o=!1===e.interactive?"none":null,a="g"===i.tag;let u=null,s=0;const l=Av(e,t,n,"g",r);l.setAttribute("class",wy(e));const c=sv(e);for(const t in c)Bv(l,t,c[t]);a||Bv(l,"pointer-events",o),Bv(l,"clip-path",e.clip?cg(this,e,e.group):null);const f=t=>{const e=this.isDirty(t),n=Av(t,l,u,i.tag,r);e&&(this._update(i,n,t),a&&function(t,e,n){e=e.lastChild.previousSibling;let r,i=0;nm(n,(n=>{r=t.mark(e,n,r),++i})),by(e,1+i)}(this,n,t)),u=n,++s};return i.nested?e.items.length&&f(e.items[0]):nm(e,f),by(l,s),l},_update(t,e,n){Mv=e,Ev=e.__values__,uv(Cv,n),t.attr(Cv,n,this);const r=Dv[t.type];r&&r.call(this,t,e,n),Mv&&this.style(Mv,n)},style(t,e){if(null!=e)for(const n in gv){let r="font"===n?Km(e):e[n];if(r===Ev[n])continue;const i=gv[n];null==r?t.removeAttribute(i):(gp(r)&&(r=mp(r,this._defs.gradient,Tv())),t.setAttribute(i,r+"")),Ev[n]=r}},defs(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=xy(t,1,"defs",vv)),r=wv(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=xy(t,1,"defs",vv)),r=kv(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):by(n,r))},_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}});let Mv=null,Ev=null;const Dv={group(t,e,n){const r=Mv=e.childNodes[2];Ev=r.__values__,t.foreground(Cv,n,this),Ev=e.__values__,Mv=e.childNodes[1],t.content(Cv,n,this);const i=Mv=e.childNodes[0];t.background(Cv,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==Ev.events&&(Bv(r,"pointer-events",o),Bv(i,"pointer-events",o),Ev.events=o),n.strokeForeground&&n.stroke){const t=n.fill;Bv(r,"display",null),this.style(i,n),Bv(i,"stroke",null),t&&(n.fill=null),Ev=r.__values__,this.style(r,n),t&&(n.fill=t),Mv=null}else Bv(r,"display","none")},image(t,e,n){!1===n.smooth?(Fv(e,"image-rendering","optimizeSpeed"),Fv(e,"image-rendering","pixelated")):Fv(e,"image-rendering",null)},text(t,e,n){const r=Jm(n);let i,o,a,u;_(r)?(o=r.map((t=>Qm(n,t))),i=o.join("\n"),i!==Ev.text&&(by(e,0),a=e.ownerDocument,u=Xm(n),o.forEach(((t,r)=>{const i=vy(a,"tspan",vv);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),e.appendChild(i)})),Ev.text=i)):(o=Qm(n,r),o!==Ev.text&&(e.textContent=o,Ev.text=o)),Bv(e,"font-family",Km(n)),Bv(e,"font-size",Gm(n)+"px"),Bv(e,"font-style",n.fontStyle),Bv(e,"font-variant",n.fontVariant),Bv(e,"font-weight",n.fontWeight)}};function Cv(t,e,n){e!==Ev[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(Mv,t,e,n):Bv(Mv,t,e),Ev[t]=e)}function Fv(t,e,n){n!==Ev[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),Ev[e]=n)}function Sv(t,e){for(const n in e)Bv(t,n,e[n])}function Bv(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function Tv(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function zv(t){Ey.call(this,t),this._text=null,this._defs={gradient:{},clipping:{}}}st(zv,Ey,{svg(){return this._text},_render(t){const e=hv();e.open("svg",tt({},Mm,{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&&e.open("rect",{width:this._width,height:this._height,fill:n}).close(),e.open("g",mv,{transform:"translate("+this._origin+")"}),this.mark(e,t),e.close(),this.defs(e),this._text=e.close()+"",this},mark(t,e){const n=sy[e.marktype],r=n.tag,i=[uv,n.attr];t.open("g",{class:wy(e),"clip-path":e.clip?cg(this,e,e.group):null},sv(e),{"pointer-events":"g"!==r&&!1===e.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(e,o,i,"g"!==r?r:null)),"text"===r){const e=Jm(o);if(_(e)){const n={x:0,dy:Xm(o)};for(let r=0;r<e.length;++r)t.open("tspan",r?n:null).text(Qm(o,e[r])).close()}else t.text(Qm(o,e))}else if("g"===r){const r=o.strokeForeground,i=o.fill,a=o.stroke;r&&a&&(o.stroke=null),t.open("path",this.attr(e,o,n.background,"bgrect")).close(),t.open("g",this.attr(e,o,n.content)),nm(o,(e=>this.mark(t,e))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(e,o,n.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(e,o,n.foreground,"bgfore")).close()}t.close(),a&&t.close()};return n.nested?e.items&&e.items.length&&o(e.items[0]):nm(e,o),t.close()},href(t){const e=t.href;let n;if(e){if(n=this._hrefs&&this._hrefs[e])return n;this.sanitizeURL(e).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[e]=t}))}return null},attr(t,e,n,r){const i={},o=(t,e,n,r)=>{i[r||t]=e};return Array.isArray(n)?n.forEach((t=>t(o,e,this))):n(o,e,this),r&&function(t,e,n,r,i){if(null==e)return t;"bgrect"===r&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===r&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===r&&!1===e.smooth&&(t.style="image-rendering: optimizeSpeed; image-rendering: pixelated;");"text"===r&&(t["font-family"]=Km(e),t["font-size"]=Gm(e)+"px",t["font-style"]=e.fontStyle,t["font-variant"]=e.fontVariant,t["font-weight"]=e.fontWeight);for(const n in gv){let r=e[n];const o=gv[n];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(gp(r)&&(r=mp(r,i.gradient,"")),t[o]=r)}}(i,e,t,r,this._defs),i},defs(t){const e=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(e).length+Object.keys(n).length){t.open("defs");for(const n in e){const r=e[n],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:pp+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),t.close(),t.open("radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let e=0;e<i.length;++e)t.open("stop",{offset:i[e].offset,"stop-color":i[e].color}).close();t.close()}for(const e in n){const r=n[e];t.open("clipPath",{id:e}),r.path?t.open("path",{d:r.path}).close():t.open("rect",{x:0,y:0,width:r.width,height:r.height}).close(),t.close()}t.close()}}});const Nv="canvas",Ov="none",Rv={Canvas:Nv,PNG:"png",SVG:"svg",None:Ov},$v={};function qv(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?($v[t]=e,this):$v[t]}function Lv(t,e,n){const r=[],i=(new fg).union(e),o=t.marktype;return o?Uv(t,i,n,r):"group"===o?Pv(t,i,n,r):s("Intersect scene must be mark node or group item.")}function Uv(t,e,n,r){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const i=t.items,o=t.marktype,a=i.length;let u=0;if("group"===o)for(;u<a;++u)Pv(i[u],e,n,r);else for(const t=sy[o].isect;u<a;++u){const n=i[u];jv(n,e,t)&&r.push(n)}}return r}function Pv(t,e,n,r){n&&n(t.mark)&&jv(t,e,sy.group.isect)&&r.push(t);const i=t.items,o=i&&i.length;if(o){const a=t.x||0,u=t.y||0;e.translate(-a,-u);for(let t=0;t<o;++t)Uv(i[t],e,n,r);e.translate(a,u)}return r}function jv(t,e,n){const r=t.bounds;return e.encloses(r)||e.intersects(r)&&n(t,e)}$v.canvas=$v.png={renderer:Vy,headless:Vy,handler:jy},$v.svg={renderer:_v,headless:zv,handler:Xy},$v.none={};const Iv=new fg;function Wv(t){const e=t.clip;if(Y(e))e(Og(Iv.clear()));else{if(!e)return;Iv.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Iv)}function Hv(t,e,n){return t===e||("path"===n?Yv(t,e):t instanceof Date&&e instanceof Date?+t==+e:dt(t)&&dt(e)?Math.abs(t-e)<=1e-9:t&&e&&(x(t)||x(e))?function(t,e){var n,r,i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(i.sort(),o.sort(),r=i.length-1;r>=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!Hv(t[n=i[r]],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function Yv(t,e){return Hv(kp(t),kp(e))}const Vv="top",Gv="left",Xv="right",Jv="bottom",Zv="start",Qv="middle",Kv="end",t_="group",e_="axis",n_="title",r_="frame",i_="scope",o_="legend",a_="row-header",u_="row-footer",s_="row-title",l_="column-header",c_="column-footer",f_="column-title",h_="padding",d_="fit",p_="fit-x",g_="fit-y",m_="none",y_="all",v_="each",__="flush",x_="column",b_="row";function w_(t){Oa.call(this,null,t)}function k_(t,e,n){return e(t.bounds.clear(),t,n)}st(w_,Oa,{transform(t,e){const n=e.dataflow,r=t.mark,i=r.marktype,o=sy[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&n.dirty(r.items[0]),s=k_(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===t_||t.modified())switch(e.visit(e.MOD,(t=>n.dirty(t))),s.clear(),r.items.forEach((t=>s.union(k_(t,a)))),r.role){case e_:case o_:case n_:e.reflow()}else u=e.changed(e.REM),e.visit(e.ADD,(t=>{s.union(k_(t,a))})),e.visit(e.MOD,(t=>{u=u||s.alignsWith(t.bounds),n.dirty(t),s.union(k_(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return Wv(r),e.modifies("bounds")}});const A_=":vega_identifier:";function M_(t){Oa.call(this,0,t)}function E_(t){Oa.call(this,null,t)}function D_(t){Oa.call(this,null,t)}M_.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},st(M_,Oa,{transform(t,e){const n=(i=e.dataflow)._signals[A_]||(i._signals[A_]=i.add(0)),r=t.as;var i;let o=n.value;return e.visit(e.ADD,(t=>t[r]=t[r]||++o)),n.set(this.value=o),e}}),st(E_,Oa,{transform(t,e){let n=this.value;n||(n=e.dataflow.scenegraph().mark(t.markdef,function(t){const e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index),n.group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);const r=n.marktype===t_?dg:hg;return e.visit(e.ADD,(t=>r.call(t,n))),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e}});const C_={parity:t=>t.filter(((t,e)=>e%2?t.opacity=0:1)),greedy:(t,e)=>{let n;return t.filter(((t,r)=>r&&F_(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1)))}},F_=(t,e,n)=>n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),S_=(t,e)=>{for(var n,r=1,i=t.length,o=t[0].bounds;r<i;o=n,++r)if(F_(o,n=t[r].bounds,e))return!0},B_=t=>{const e=t.bounds;return e.width()>1&&e.height()>1},T_=t=>(t.forEach((t=>t.opacity=1)),t),z_=(t,e)=>t.reflow(e.modified()).modifies("opacity");function N_(t){Oa.call(this,null,t)}st(D_,Oa,{transform(t,e){const n=C_[t.method]||C_.parity,r=t.separation||0;let i,o,a=e.materialize(e.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(T_(a),e=z_(e,t)),e;if(a=a.filter(B_),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=T_(a),e=z_(e,t),i.length>=3&&S_(i,r)){do{i=n(i,r)}while(i.length>=3&&S_(i,r));i.length<3&&!M(a).opacity&&(i.length>1&&(M(i).opacity=0),M(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,e,n)=>{var r=t.range(),i=new fg;return e===Vv||e===Jv?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const u=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&u.union(t.bounds)})),e}}),st(N_,Oa,{transform(t,e){const n=e.dataflow;if(e.visit(e.ALL,(t=>n.dirty(t))),e.fields&&e.fields.zindex){const t=e.source&&e.source[0];t&&(t.mark.zdirty=!0)}}});const O_=new fg;function R_(t,e,n){return t[e]===n?0:(t[e]=n,1)}function $_(t){var e=t.items[0].orient;return e===Gv||e===Xv}function q_(t,e,n,r){var i,o,a=e.items[0],u=a.datum,s=null!=a.translate?a.translate:.5,l=a.orient,c=function(t){let e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(u),f=a.range,h=a.offset,d=a.position,p=a.minExtent,g=a.maxExtent,m=u.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,_=m&&Zm(m),x=0,b=0;switch(O_.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(a.items[i].bounds),(i=c[1])>-1&&v.union(a.items[i].bounds),l){case Vv:x=d||0,b=-h,o=Math.max(p,Math.min(g,-v.y1)),v.add(0,-o).add(f,0),m&&L_(t,m,o,y,_,0,-1,v);break;case Gv:x=-h,b=d||0,o=Math.max(p,Math.min(g,-v.x1)),v.add(-o,0).add(0,f),m&&L_(t,m,o,y,_,1,-1,v);break;case Xv:x=n+h,b=d||0,o=Math.max(p,Math.min(g,v.x2)),v.add(0,0).add(o,f),m&&L_(t,m,o,y,_,1,1,v);break;case Jv:x=d||0,b=r+h,o=Math.max(p,Math.min(g,v.y2)),v.add(0,0).add(f,o),m&&L_(t,m,o,y,0,0,1,v);break;default:x=a.x,b=a.y}return yg(v.translate(x,b),a),R_(a,"x",x+s)|R_(a,"y",b+s)&&(a.bounds=O_,t.dirty(a),a.bounds=v,t.dirty(a)),a.mark.bounds.clear().union(v)}function L_(t,e,n,r,i,o,a,u){const s=e.bounds;if(e.auto){const u=a*(n+i+r);let l=0,c=0;t.dirty(e),o?l=(e.x||0)-(e.x=u):c=(e.y||0)-(e.y=u),e.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(e)}u.union(s)}const U_=(t,e)=>Math.floor(Math.min(t,e)),P_=(t,e)=>Math.ceil(Math.max(t,e));function j_(t){return(new fg).set(0,0,t.width||0,t.height||0)}function I_(t){const e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function W_(t,e,n){const r=x(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function H_(t){return t<0?Math.ceil(-t):0}function Y_(t,e,n){var r,i,o,a,u,s,l,c,f,h,d,p=!n.nodirty,g=n.bounds===__?j_:I_,m=O_.set(0,0,0,0),y=W_(n.align,x_),v=W_(n.align,b_),_=W_(n.padding,x_),x=W_(n.padding,b_),b=n.columns||e.length,w=b<=0?1:Math.ceil(e.length/b),k=e.length,A=Array(k),M=Array(b),E=0,D=Array(k),C=Array(w),F=0,S=Array(k),B=Array(k),T=Array(k);for(i=0;i<b;++i)M[i]=0;for(i=0;i<w;++i)C[i]=0;for(i=0;i<k;++i)s=e[i],u=T[i]=g(s),s.x=s.x||0,S[i]=0,s.y=s.y||0,B[i]=0,o=i%b,a=~~(i/b),E=Math.max(E,l=Math.ceil(u.x2)),F=Math.max(F,c=Math.ceil(u.y2)),M[o]=Math.max(M[o],l),C[a]=Math.max(C[a],c),A[i]=_+H_(u.x1),D[i]=x+H_(u.y1),p&&t.dirty(e[i]);for(i=0;i<k;++i)i%b==0&&(A[i]=0),i<b&&(D[i]=0);if(y===v_)for(o=1;o<b;++o){for(d=0,i=o;i<k;i+=b)d<A[i]&&(d=A[i]);for(i=o;i<k;i+=b)A[i]=d+M[o-1]}else if(y===y_){for(d=0,i=0;i<k;++i)i%b&&d<A[i]&&(d=A[i]);for(i=0;i<k;++i)i%b&&(A[i]=d+E)}else for(y=!1,o=1;o<b;++o)for(i=o;i<k;i+=b)A[i]+=M[o-1];if(v===v_)for(a=1;a<w;++a){for(d=0,r=(i=a*b)+b;i<r;++i)d<D[i]&&(d=D[i]);for(i=a*b;i<r;++i)D[i]=d+C[a-1]}else if(v===y_){for(d=0,i=b;i<k;++i)d<D[i]&&(d=D[i]);for(i=b;i<k;++i)D[i]=d+F}else for(v=!1,a=1;a<w;++a)for(r=(i=a*b)+b;i<r;++i)D[i]+=C[a-1];for(f=0,i=0;i<k;++i)f=A[i]+(i%b?f:0),S[i]+=f-e[i].x;for(o=0;o<b;++o)for(h=0,i=o;i<k;i+=b)h+=D[i],B[i]+=h-e[i].y;if(y&&W_(n.center,x_)&&w>1)for(i=0;i<k;++i)(f=(u=y===y_?E:M[i%b])-T[i].x2-e[i].x-S[i])>0&&(S[i]+=f/2);if(v&&W_(n.center,b_)&&1!==b)for(i=0;i<k;++i)(h=(u=v===y_?F:C[~~(i/b)])-T[i].y2-e[i].y-B[i])>0&&(B[i]+=h/2);for(i=0;i<k;++i)m.union(T[i].translate(S[i],B[i]));switch(f=W_(n.anchor,"x"),h=W_(n.anchor,"y"),W_(n.anchor,x_)){case Kv:f-=m.width();break;case Qv:f-=m.width()/2}switch(W_(n.anchor,b_)){case Kv:h-=m.height();break;case Qv:h-=m.height()/2}for(f=Math.round(f),h=Math.round(h),m.clear(),i=0;i<k;++i)e[i].mark.bounds.clear();for(i=0;i<k;++i)(s=e[i]).x+=S[i]+=f,s.y+=B[i]+=h,m.union(s.mark.bounds.union(s.bounds.translate(S[i],B[i]))),p&&t.dirty(s);return m}function V_(t,e,n){var r,i,o,a,u,s,l,c=function(t){var e,n,r=t.items,i=r.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<i;++o)if(n=(e=r[o]).items,e.marktype===t_)switch(e.role){case e_:case o_:case n_:break;case a_:a.rowheaders.push(...n);break;case u_:a.rowfooters.push(...n);break;case l_:a.colheaders.push(...n);break;case c_:a.colfooters.push(...n);break;case s_:a.rowtitle=n[0];break;case f_:a.coltitle=n[0];break;default:a.marks.push(...n)}return a}(e),f=c.marks,h=n.bounds===__?G_:X_,d=n.offset,p=n.columns||f.length,g=p<=0?1:Math.ceil(f.length/p),m=g*p;const y=Y_(t,f,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(s=W_(n.headerBand,b_,null),r=J_(t,c.rowheaders,f,p,g,-W_(d,"rowHeader"),U_,0,h,"x1",0,p,1,s)),c.colheaders&&(s=W_(n.headerBand,x_,null),i=J_(t,c.colheaders,f,p,p,-W_(d,"columnHeader"),U_,1,h,"y1",0,1,p,s)),c.rowfooters&&(s=W_(n.footerBand,b_,null),o=J_(t,c.rowfooters,f,p,g,W_(d,"rowFooter"),P_,0,h,"x2",p-1,p,1,s)),c.colfooters&&(s=W_(n.footerBand,x_,null),a=J_(t,c.colfooters,f,p,p,W_(d,"columnFooter"),P_,1,h,"y2",m-p,1,p,s)),c.rowtitle&&(u=W_(n.titleAnchor,b_),l=W_(d,"rowTitle"),l=u===Kv?o+l:r-l,s=W_(n.titleBand,b_,.5),Z_(t,c.rowtitle,l,0,y,s)),c.coltitle&&(u=W_(n.titleAnchor,x_),l=W_(d,"columnTitle"),l=u===Kv?a+l:i-l,s=W_(n.titleBand,x_,.5),Z_(t,c.coltitle,l,1,y,s))}function G_(t,e){return"x1"===e?t.x||0:"y1"===e?t.y||0:"x2"===e?(t.x||0)+(t.width||0):"y2"===e?(t.y||0)+(t.height||0):void 0}function X_(t,e){return t.bounds[e]}function J_(t,e,n,r,i,o,a,u,s,l,c,f,h,d){var p,g,m,y,v,_,x,b,w,k=n.length,A=0,M=0;if(!k)return A;for(p=c;p<k;p+=f)n[p]&&(A=a(A,s(n[p],l)));if(!e.length)return A;for(e.length>i&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),A+=o,g=0,y=e.length;g<y;++g)t.dirty(e[g]),e[g].mark.bounds.clear();for(p=c,g=0,y=e.length;g<y;++g,p+=f){for(v=(_=e[g]).mark.bounds,m=p;m>=0&&null==(x=n[m]);m-=h);u?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=A):(b=A,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),v.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=a(M,v[l])}return M}function Z_(t,e,n,r,i,o){if(e){t.dirty(e);var a=n,u=n;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),e.bounds.translate(a-(e.x||0),u-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=a,e.y=u,t.dirty(e)}}function Q_(t,e,n,r,i,o,a){const u=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),s=function(t,e){let n=-1/0;return t.forEach((t=>{null!=t.offset&&(n=Math.max(n,t.offset))})),n>-1/0?n:e}(t,u("offset",0)),l=u("anchor",Zv),c=l===Kv?1:l===Qv?.5:0,f={align:v_,bounds:u("bounds",__),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(e){case Gv:f.anchor={x:Math.floor(r.x1)-s,column:Kv,y:c*(a||r.height()+2*r.y1),row:l};break;case Xv:f.anchor={x:Math.ceil(r.x2)+s,y:c*(a||r.height()+2*r.y1),row:l};break;case Vv:f.anchor={y:Math.floor(i.y1)-s,row:Kv,x:c*(o||i.width()+2*i.x1),column:l};break;case Jv:f.anchor={y:Math.ceil(i.y2)+s,x:c*(o||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:o-s,y:s,column:Kv};break;case"bottom-left":f.anchor={x:s,y:a-s,row:Kv};break;case"bottom-right":f.anchor={x:o-s,y:a-s,column:Kv,row:Kv}}return f}function K_(t,e){var n,r,i=e.items[0],o=i.datum,a=i.orient,u=i.bounds,s=i.x,l=i.y;return i._bounds?i._bounds.clear().union(u):i._bounds=u.clone(),u.clear(),function(t,e,n){var r=e.padding,i=r-n.x,o=r-n.y;if(e.datum.title){var a=e.items[1].items[0],u=a.anchor,s=e.titlePadding||0,l=r-a.x,c=r-a.y;switch(a.orient){case Gv:i+=Math.ceil(a.bounds.width())+s;break;case Xv:case Jv:break;default:o+=a.bounds.height()+s}switch((i||o)&&ex(t,n,i,o),a.orient){case Gv:c+=tx(e,n,a,u,1,1);break;case Xv:l+=tx(e,n,a,Kv,0,0)+s,c+=tx(e,n,a,u,1,1);break;case Jv:l+=tx(e,n,a,u,0,0),c+=tx(e,n,a,Kv,-1,0,1)+s;break;default:l+=tx(e,n,a,u,0,0)}(l||c)&&ex(t,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(ex(t,n,-l,0),ex(t,a,-l,0))}else(i||o)&&ex(t,n,i,o)}(t,i,i.items[0].items[0]),u=function(t,e){return t.items.forEach((t=>e.union(t.bounds))),e.x1=t.padding,e.y1=t.padding,e}(i,u),n=2*i.padding,r=2*i.padding,u.empty()||(n=Math.ceil(u.width()+n),r=Math.ceil(u.height()+r)),"symbol"===o.type&&function(t){const e=t.reduce(((t,e)=>(t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t)),{});t.forEach((t=>{t.width=e[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==m_&&(i.x=s=0,i.y=l=0),i.width=n,i.height=r,yg(u.set(s,l,s+n,l+r),i),i.mark.bounds.clear().union(u),i}function tx(t,e,n,r,i,o,a){const u="symbol"!==t.datum.type,s=n.datum.vgrad,l=(!u||!o&&s||a?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&o?l:0,f=s&&o?0:l,h=i<=0?0:Zm(n);return Math.round(r===Zv?c:r===Kv?f-h:.5*(l-h))}function ex(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function nx(t){Oa.call(this,null,t)}st(nx,Oa,{transform(t,e){const n=e.dataflow;return t.mark.items.forEach((e=>{t.layout&&V_(n,e,t.layout),function(t,e,n){var r,i,o,a,u,s=e.items,l=Math.max(0,e.width||0),c=Math.max(0,e.height||0),f=(new fg).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(a=0,u=s.length;a<u;++a)switch((i=s[a]).role){case e_:($_(i)?h:d).union(q_(t,i,l,c));break;case n_:r=i;break;case o_:p.push(K_(t,i));break;case r_:case i_:case a_:case u_:case s_:case l_:case c_:case f_:h.union(i.bounds),d.union(i.bounds);break;default:f.union(i.bounds)}if(p.length){const e={};p.forEach((t=>{(o=t.orient||Xv)!==m_&&(e[o]||(e[o]=[])).push(t)}));for(const r in e){const i=e[r];Y_(t,i,Q_(i,r,n.legends,h,d,l,c))}p.forEach((e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),n.autosize&&n.autosize.type===d_)switch(e.orient){case Gv:case Xv:f.add(r.x1,0).add(r.x2,0);break;case Vv:case Jv:f.add(0,r.y1).add(0,r.y2)}else f.union(r)}))}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var o,a=e.items[0],u=a.frame,s=a.orient,l=a.anchor,c=a.offset,f=a.padding,h=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],p=s===Gv||s===Xv?r:n,g=0,m=0,y=0,v=0,_=0;if(u!==t_?s===Gv?(g=i.y2,p=i.y1):s===Xv?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===Gv&&(g=r,p=0),o=l===Zv?g:l===Kv?p:(g+p)/2,d&&d.text){switch(s){case Vv:case Jv:_=h.bounds.height()+f;break;case Gv:v=h.bounds.width()+f;break;case Xv:v=-h.bounds.width()-f}O_.clear().union(d.bounds),O_.translate(v-(d.x||0),_-(d.y||0)),R_(d,"x",v)|R_(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(O_),d.mark.bounds.clear().union(O_),t.dirty(d)),O_.clear().union(d.bounds)}else O_.clear();switch(O_.union(h.bounds),s){case Vv:m=o,y=i.y1-O_.height()-c;break;case Gv:m=i.x1-O_.width()-c,y=o;break;case Xv:m=i.x2+O_.width()+c,y=o;break;case Jv:m=o,y=i.y2+c;break;default:m=a.x,y=a.y}return R_(a,"x",m)|R_(a,"y",y)&&(O_.translate(m,y),t.dirty(a),a.bounds.clear().union(O_),e.bounds.clear().union(O_),t.dirty(a)),a.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,u=t._height,s=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,e.height||0),f=Math.max(0,Math.ceil(-n.y1));const h=Math.max(0,Math.ceil(n.x2-s)),d=Math.max(0,Math.ceil(n.y2-c));if(i.contains===h_){const e=t.padding();a-=e.left+e.right,u-=e.top+e.bottom}o===m_?(l=0,f=0,s=a,c=u):o===d_?(s=Math.max(0,a-l-h),c=Math.max(0,u-f-d)):o===p_?(s=Math.max(0,a-l-h),u=c+f+d):o===g_?(a=s+l+h,c=Math.max(0,u-f-d)):"pad"===o&&(a=s+l+h,u=c+f+d);t._resizeView(a,u,s,c,[l,f],i.resize)}(t,e,f,n)}(n,e,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?e.reflow():e}});var rx=Object.freeze({__proto__:null,bound:w_,identifier:M_,mark:E_,overlap:D_,render:N_,viewlayout:nx});function ix(t){Oa.call(this,null,t)}function ox(t){Oa.call(this,null,t)}function ax(){return ia({})}function ux(t){Oa.call(this,null,t)}function sx(t){Oa.call(this,[],t)}st(ix,Oa,{transform(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.dataflow.locale(),r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=this.value,o=t.scale,a=Zd(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||tp(n,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?Qd(o,t.values,a):Kd(o,a);return i&&(r.rem=i),i=s.map(((t,e)=>ia({index:e/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(ia({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),st(ox,Oa,{transform(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||ax,o=t.key||na,a=this.value;return _(r.encode)&&(r.encode=null),a&&(t.modified("key")||e.modified(o))&&s("DataJoin does not support modified key function or fields."),a||(e=e.addAll(),this.value=a=function(t){const e=at().test((t=>t.exit));return e.lookup=n=>e.get(t(n)),e}(o)),e.visit(e.ADD,(t=>{const e=o(t);let n=a.get(e);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(n=i(t),a.set(e,n),r.add.push(n)),n.datum=t,n.exit=!1})),e.visit(e.MOD,(t=>{const e=o(t),n=a.get(e);n&&(n.datum=t,r.mod.push(n))})),e.visit(e.REM,(t=>{const e=o(t),n=a.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)})),e.changed(e.ADD_MOD)&&r.modifies("datum"),(e.clean()||t.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),r}}),st(ux,Oa,{transform(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,o=e.encode;if(_(o)){if(!n.changed()&&!o.every((t=>i[t])))return e.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,u=i.update||m,s=i.enter||m,l=i.exit||m,c=(o&&!a?i[o]:u)||m;if(e.changed(e.ADD)&&(e.visit(e.ADD,(e=>{s(e,t),u(e,t)})),n.modifies(s.output),n.modifies(u.output),c!==m&&c!==u&&(e.visit(e.ADD,(e=>{c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==m&&(e.visit(e.REM,(e=>{l(e,t)})),n.modifies(l.output)),a||c!==m){const i=e.MOD|(t.modified()?e.REFLOW:0);a?(e.visit(i,(e=>{const i=s(e,t)||r;(c(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(s.output)):e.visit(i,(e=>{(c(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation}}),st(sx,Oa,{transform(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,o,a,u=e.dataflow.locale(),s=e.fork(e.NO_SOURCE|e.NO_FIELDS),l=this.value,c=t.type||Vd,f=t.scale,h=+t.limit,d=Zd(f,null==t.count?5:t.count,t.minstep),p=!!t.values||c===Vd,g=t.format||op(u,f,d,c,t.formatSpecifier,t.formatType,p),m=t.values||ip(f,d);return l&&(s.rem=l),c===Vd?(h&&m.length>h?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=m.slice(0,h-1),a=!0):l=m,Y(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),o=l.reduce(((e,n)=>Math.max(e,i(n,t))),0)):i=Q(o=i||8),l=l.map(((e,n)=>ia({index:n,label:g(e,n,l),value:e,offset:o,size:i(e,t)}))),a&&(a=m[l.length],l.push(ia({index:l.length,label:`…${m.length-l.length} entries`,value:a,offset:o,size:i(a,t)})))):"gradient"===c?(n=f.domain(),r=Pd(f,n[0],M(n)),m.length<3&&!t.values&&n[0]!==M(n)&&(m=[n[0],M(n)]),l=m.map(((t,e)=>ia({index:e,label:g(t,e,m),value:t,perc:r(t)})))):(i=m.length-1,r=function(t){const e=t.domain(),n=e.length-1;let r=+e[0],i=+M(e),o=i-r;if(t.type===fd){const t=n?o/n:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),l=m.map(((t,e)=>ia({index:e,label:g(t,e,m),value:t,perc:e?r(t):0,perc2:e===i?1:r(m[e+1])})))),s.source=l,s.add=l,this.value=l,s}});const lx=t=>t.source.x,cx=t=>t.source.y,fx=t=>t.target.x,hx=t=>t.target.y;function dx(t){Oa.call(this,{},t)}dx.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"}]},st(dx,Oa,{transform(t,e){var n=t.sourceX||lx,r=t.sourceY||cx,i=t.targetX||fx,o=t.targetY||hx,a=t.as||"path",u=t.orient||"vertical",l=t.shape||"line",c=yx.get(l+"-"+u)||yx.get(l);return c||s("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(t=>{t[a]=c(n(t),r(t),i(t),o(t))})),e.reflow(t.modified()).modifies(a)}});const px=(t,e,n,r)=>"M"+t+","+e+"L"+n+","+r,gx=(t,e,n,r)=>{var i=n-t,o=r-e,a=Math.sqrt(i*i+o*o)/2;return"M"+t+","+e+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r},mx=(t,e,n,r)=>{const i=n-t,o=r-e,a=.2*(i+o),u=.2*(o-i);return"M"+t+","+e+"C"+(t+a)+","+(e+u)+" "+(n+u)+","+(r-a)+" "+n+","+r},yx=at({line:px,"line-radial":(t,e,n,r)=>px(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),arc:gx,"arc-radial":(t,e,n,r)=>gx(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),curve:mx,"curve-radial":(t,e,n,r)=>mx(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(t,e,n,r)=>"M"+t+","+e+"V"+r+"H"+n,"orthogonal-vertical":(t,e,n,r)=>"M"+t+","+e+"H"+n+"V"+r,"orthogonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),u=Math.sin(n);return"M"+e*i+","+e*o+"A"+e+","+e+" 0 0,"+((Math.abs(n-t)>Math.PI?n<=t:n>t)?1:0)+" "+e*a+","+e*u+"L"+r*a+","+r*u},"diagonal-horizontal":(t,e,n,r)=>{const i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":(t,e,n,r)=>{const i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),u=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function vx(t){Oa.call(this,null,t)}vx.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"]}]},st(vx,Oa,{transform(t,e){var n,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.field||p,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(s),d=h.length,g=l,m=(c-l)/ge(h),y=pe(d);for(t.sort&&y.sort(((t,e)=>h[t]-h[e])),n=0;n<d;++n)i=h[y[n]],(r=f[y[n]])[a]=g,r[u]=g+=i*m;return this.value=h,e.reflow(t.modified()).modifies(o)}});function _x(t){return Bd(t)&&t!==sd}const xx=Ct(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function bx(t){Oa.call(this,null,t),this.modified(!0)}function wx(t,e,n){Nd(t)&&(Math.abs(e.reduce(((t,e)=>t+(e<0?-1:e>0?1:0)),0))!==e.length&&n.warn("Log scale domain includes zero: "+kt(e)));return e}function kx(t,e,n){return Y(t)&&(e||n)?qd(t,Ax(e||[0,1],n)):t}function Ax(t,e){return e?t.slice().reverse():t}function Mx(t){Oa.call(this,null,t)}st(bx,Oa,{transform(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if(n===sd)return"sequential-linear";(function(t){const e=t.type;return Bd(e)&&e!==ad&&e!==ud&&(t.scheme||t.range&&t.range.length&&t.range.every(gt))})(t)&&(r=2===(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?"sequential-":3===e?"diverging-":"");return(r+n||ed).toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=Cd(i)()),t)if(!xx[i]){if("padding"===i&&_x(r.type))continue;Y(r[i])?r[i](t[i]):n.warn("Unsupported scale property: "+i)}return function(t,e,n){var r=t.type,i=e.round||!1,o=e.range;if(null!=e.rangeStep)o=function(t,e,n){t!==pd&&t!==dd&&s("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i=t===dd?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*td(n,i,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,i=e.schemeExtent;_(e.scheme)?r=Ld(e.scheme,e.interpolate,e.interpolateGamma):(r=Yd(e.scheme.toLowerCase()))||s(`Unrecognized scheme name: ${e.scheme}`);return n=t===fd?n+1:t===gd?n-1:t===ld||t===cd?+e.schemeCount||5:n,Od(t)?kx(r,i,e.reverse):Y(r)?Ud(kx(r,i),n):t===hd?r:r.slice(0,n)}(r,e,n),Y(o))){if(t.interpolator)return t.interpolator(o);s(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&Od(r))return t.interpolator(Ld(Ax(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate(jd(e.interpolate,e.interpolateGamma)):Y(t.round)?t.round(i):Y(t.rangeRound)&&t.interpolate(i?Zf:Jf);o&&t.range(Ax(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!_(r)){const e=t.domain(),n=e[0],i=M(e),o=r.step;let a=null==r.start?n:r.start,u=null==r.stop?i:r.stop;o||s("Scale bins parameter missing step property."),a<n&&(a=o*Math.ceil(n/o)),u>i&&(u=o*Math.floor(i/o)),r=pe(a,u+o/2,o)}r?t.bins=r:t.bins&&delete t.bins;t.type===gd&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){const r=function(t,e,n){return e?(t.domain(wx(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,o,a=e.domain,u=t.type,s=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&(e===ed||e===rd||e===id)}(t);if(!a)return 0;_x(u)&&e.padding&&a[0]!==M(a)&&(a=function(t,e,n,r,i,o){var a=Math.abs(M(n)-n[0]),u=a/(a-2*r),s=t===nd?L(e,null,u):t===id?U(e,null,u,.5):t===rd?U(e,null,u,i||1):t===od?P(e,null,u,o||1):q(e,null,u);return(e=e.slice())[0]=s[0],e[e.length-1]=s[1],e}(u,a,e.range,e.padding,e.exponent,e.constant));if((s||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=e.domainMin&&(a[0]=e.domainMin),null!=e.domainMax&&(a[i]=e.domainMax),null!=e.domainMid)){const t=(o=e.domainMid)>a[i]?i+1:o<a[0]?0:i;t!==i&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(t,0,o)}t.domain(wx(u,a,n)),u===hd&&t.unknown(e.domainImplicit?_c:void 0);e.nice&&t.nice&&t.nice(!0!==e.nice&&Zd(t,e.nice)||null);return a.length}(r,t,n))),e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),st(Mx,Oa,{transform(t,e){const n=t.modified("sort")||e.changed(e.ADD)||e.modified(t.sort.fields)||e.modified("datum");return n&&e.source.sort(sa(t.sort)),this.modified(n),e}});const Ex="zero",Dx="center",Cx="normalize",Fx=["y0","y1"];function Sx(t){Oa.call(this,null,t)}function Bx(t,e,n,r,i){for(var o,a=(e-t.sum)/2,u=t.length,s=0;s<u;++s)(o=t[s])[r]=a,o[i]=a+=Math.abs(n(o))}function Tx(t,e,n,r,i){for(var o,a=1/t.sum,u=0,s=t.length,l=0,c=0;l<s;++l)(o=t[l])[r]=u,o[i]=u=a*(c+=Math.abs(n(o)))}function zx(t,e,n,r,i){for(var o,a,u=0,s=0,l=t.length,c=0;c<l;++c)(o=+n(a=t[c]))<0?(a[r]=s,a[i]=s+=o):(a[r]=u,a[i]=u+=o)}Sx.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:Ex,values:[Ex,Dx,Cx]},{name:"as",type:"string",array:!0,length:2,default:Fx}]},st(Sx,Oa,{transform(t,e){var n,r,i,o,a=t.as||Fx,u=a[0],s=a[1],l=sa(t.sort),c=t.field||p,f=t.offset===Dx?Bx:t.offset===Cx?Tx:zx;for(n=function(t,e,n,r){var i,o,a,u,s,l,c,f,h,d=[],p=t=>t(s);if(null==e)d.push(t.slice());else for(i={},o=0,a=t.length;o<a;++o)s=t[o],(c=i[l=e.map(p)])||(i[l]=c=[],d.push(c)),c.push(s);for(l=0,h=0,u=d.length;l<u;++l){for(o=0,f=0,a=(c=d[l]).length;o<a;++o)f+=Math.abs(r(c[o]));c.sum=f,f>h&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,o=n.max;r<i;++r)f(n[r],o,c,u,s);return e.reflow(t.modified()).modifies(a)}});var Nx=Object.freeze({__proto__:null,axisticks:ix,datajoin:ox,encode:ux,legendentries:sx,linkpath:dx,pie:vx,scale:bx,sortitems:Mx,stack:Sx}),Ox=1e-6,Rx=1e-12,$x=Math.PI,qx=$x/2,Lx=$x/4,Ux=2*$x,Px=180/$x,jx=$x/180,Ix=Math.abs,Wx=Math.atan,Hx=Math.atan2,Yx=Math.cos,Vx=Math.ceil,Gx=Math.exp,Xx=Math.hypot,Jx=Math.log,Zx=Math.pow,Qx=Math.sin,Kx=Math.sign||function(t){return t>0?1:t<0?-1:0},tb=Math.sqrt,eb=Math.tan;function nb(t){return t>1?0:t<-1?$x:Math.acos(t)}function rb(t){return t>1?qx:t<-1?-qx:Math.asin(t)}function ib(){}function ob(t,e){t&&ub.hasOwnProperty(t.type)&&ub[t.type](t,e)}var ab={Feature:function(t,e){ob(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)ob(n[r].geometry,e)}},ub={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){sb(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)sb(n[r],e,0)},Polygon:function(t,e){lb(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)lb(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)ob(n[r],e)}};function sb(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function lb(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)sb(t[n],e,1);e.polygonEnd()}function cb(t,e){t&&ab.hasOwnProperty(t.type)?ab[t.type](t,e):ob(t,e)}var fb,hb,db,pb,gb,mb,yb,vb,_b,xb,bb,wb,kb,Ab,Mb,Eb,Db=new Kt,Cb=new Kt,Fb={point:ib,lineStart:ib,lineEnd:ib,polygonStart:function(){Db=new Kt,Fb.lineStart=Sb,Fb.lineEnd=Bb},polygonEnd:function(){var t=+Db;Cb.add(t<0?Ux+t:t),this.lineStart=this.lineEnd=this.point=ib},sphere:function(){Cb.add(Ux)}};function Sb(){Fb.point=Tb}function Bb(){zb(fb,hb)}function Tb(t,e){Fb.point=zb,fb=t,hb=e,db=t*=jx,pb=Yx(e=(e*=jx)/2+Lx),gb=Qx(e)}function zb(t,e){var n=(t*=jx)-db,r=n>=0?1:-1,i=r*n,o=Yx(e=(e*=jx)/2+Lx),a=Qx(e),u=gb*a,s=pb*o+u*Yx(i),l=u*r*Qx(i);Db.add(Hx(l,s)),db=t,pb=o,gb=a}function Nb(t){return[Hx(t[1],t[0]),rb(t[2])]}function Ob(t){var e=t[0],n=t[1],r=Yx(n);return[r*Yx(e),r*Qx(e),Qx(n)]}function Rb(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function $b(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function qb(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Lb(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ub(t){var e=tb(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Pb,jb,Ib,Wb,Hb,Yb,Vb,Gb,Xb,Jb,Zb,Qb,Kb,tw,ew,nw,rw={point:iw,lineStart:aw,lineEnd:uw,polygonStart:function(){rw.point=sw,rw.lineStart=lw,rw.lineEnd=cw,Ab=new Kt,Fb.polygonStart()},polygonEnd:function(){Fb.polygonEnd(),rw.point=iw,rw.lineStart=aw,rw.lineEnd=uw,Db<0?(mb=-(vb=180),yb=-(_b=90)):Ab>Ox?_b=90:Ab<-1e-6&&(yb=-90),Eb[0]=mb,Eb[1]=vb},sphere:function(){mb=-(vb=180),yb=-(_b=90)}};function iw(t,e){Mb.push(Eb=[mb=t,vb=t]),e<yb&&(yb=e),e>_b&&(_b=e)}function ow(t,e){var n=Ob([t*jx,e*jx]);if(kb){var r=$b(kb,n),i=$b([r[1],-r[0],0],r);Ub(i),i=Nb(i);var o,a=t-xb,u=a>0?1:-1,s=i[0]*Px*u,l=Ix(a)>180;l^(u*xb<s&&s<u*t)?(o=i[1]*Px)>_b&&(_b=o):l^(u*xb<(s=(s+360)%360-180)&&s<u*t)?(o=-i[1]*Px)<yb&&(yb=o):(e<yb&&(yb=e),e>_b&&(_b=e)),l?t<xb?fw(mb,t)>fw(mb,vb)&&(vb=t):fw(t,vb)>fw(mb,vb)&&(mb=t):vb>=mb?(t<mb&&(mb=t),t>vb&&(vb=t)):t>xb?fw(mb,t)>fw(mb,vb)&&(vb=t):fw(t,vb)>fw(mb,vb)&&(mb=t)}else Mb.push(Eb=[mb=t,vb=t]);e<yb&&(yb=e),e>_b&&(_b=e),kb=n,xb=t}function aw(){rw.point=ow}function uw(){Eb[0]=mb,Eb[1]=vb,rw.point=iw,kb=null}function sw(t,e){if(kb){var n=t-xb;Ab.add(Ix(n)>180?n+(n>0?360:-360):n)}else bb=t,wb=e;Fb.point(t,e),ow(t,e)}function lw(){Fb.lineStart()}function cw(){sw(bb,wb),Fb.lineEnd(),Ix(Ab)>Ox&&(mb=-(vb=180)),Eb[0]=mb,Eb[1]=vb,kb=null}function fw(t,e){return(e-=t)<0?e+360:e}function hw(t,e){return t[0]-e[0]}function dw(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var pw={sphere:ib,point:gw,lineStart:yw,lineEnd:xw,polygonStart:function(){pw.lineStart=bw,pw.lineEnd=ww},polygonEnd:function(){pw.lineStart=yw,pw.lineEnd=xw}};function gw(t,e){t*=jx;var n=Yx(e*=jx);mw(n*Yx(t),n*Qx(t),Qx(e))}function mw(t,e,n){++Pb,Ib+=(t-Ib)/Pb,Wb+=(e-Wb)/Pb,Hb+=(n-Hb)/Pb}function yw(){pw.point=vw}function vw(t,e){t*=jx;var n=Yx(e*=jx);tw=n*Yx(t),ew=n*Qx(t),nw=Qx(e),pw.point=_w,mw(tw,ew,nw)}function _w(t,e){t*=jx;var n=Yx(e*=jx),r=n*Yx(t),i=n*Qx(t),o=Qx(e),a=Hx(tb((a=ew*o-nw*i)*a+(a=nw*r-tw*o)*a+(a=tw*i-ew*r)*a),tw*r+ew*i+nw*o);jb+=a,Yb+=a*(tw+(tw=r)),Vb+=a*(ew+(ew=i)),Gb+=a*(nw+(nw=o)),mw(tw,ew,nw)}function xw(){pw.point=gw}function bw(){pw.point=kw}function ww(){Aw(Qb,Kb),pw.point=gw}function kw(t,e){Qb=t,Kb=e,t*=jx,e*=jx,pw.point=Aw;var n=Yx(e);tw=n*Yx(t),ew=n*Qx(t),nw=Qx(e),mw(tw,ew,nw)}function Aw(t,e){t*=jx;var n=Yx(e*=jx),r=n*Yx(t),i=n*Qx(t),o=Qx(e),a=ew*o-nw*i,u=nw*r-tw*o,s=tw*i-ew*r,l=Xx(a,u,s),c=rb(l),f=l&&-c/l;Xb.add(f*a),Jb.add(f*u),Zb.add(f*s),jb+=c,Yb+=c*(tw+(tw=r)),Vb+=c*(ew+(ew=i)),Gb+=c*(nw+(nw=o)),mw(tw,ew,nw)}function Mw(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function Ew(t,e){return[Ix(t)>$x?t+Math.round(-t/Ux)*Ux:t,e]}function Dw(t,e,n){return(t%=Ux)?e||n?Mw(Fw(t),Sw(e,n)):Fw(t):e||n?Sw(e,n):Ew}function Cw(t){return function(e,n){return[(e+=t)>$x?e-Ux:e<-$x?e+Ux:e,n]}}function Fw(t){var e=Cw(t);return e.invert=Cw(-t),e}function Sw(t,e){var n=Yx(t),r=Qx(t),i=Yx(e),o=Qx(e);function a(t,e){var a=Yx(e),u=Yx(t)*a,s=Qx(t)*a,l=Qx(e),c=l*n+u*r;return[Hx(s*i-c*o,u*n-l*r),rb(c*i+s*o)]}return a.invert=function(t,e){var a=Yx(e),u=Yx(t)*a,s=Qx(t)*a,l=Qx(e),c=l*i-s*o;return[Hx(s*i+l*o,u*n+c*r),rb(c*n-u*r)]},a}function Bw(t,e){(e=Ob(e))[0]-=t,Ub(e);var n=nb(-e[1]);return((-e[2]<0?-n:n)+Ux-Ox)%Ux}function Tw(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:ib,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function zw(t,e){return Ix(t[0]-e[0])<Ox&&Ix(t[1]-e[1])<Ox}function Nw(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Ow(t,e,n,r,i){var o,a,u=[],s=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],a=t[e];if(zw(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}u.push(n=new Nw(r,t,null,!0)),s.push(n.o=new Nw(r,null,n,!1)),u.push(n=new Nw(a,t,null,!1)),s.push(n.o=new Nw(a,null,n,!0))}})),u.length){for(s.sort(e),Rw(u),Rw(s),o=0,a=s.length;o<a;++o)s[o].e=n=!n;for(var l,c,f=u[0];;){for(var h=f,d=!0;h.v;)if((h=h.n)===f)return;l=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(o=0,a=l.length;o<a;++o)i.point((c=l[o])[0],c[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(l=h.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function Rw(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function $w(t){return Ix(t[0])<=$x?t[0]:Kx(t[0])*((Ix(t[0])+$x)%Ux-$x)}function qw(t,e,n,r){return function(i){var o,a,u,s=e(i),l=Tw(),c=e(l),f=!1,h={point:d,lineStart:g,lineEnd:m,polygonStart:function(){h.point=y,h.lineStart=v,h.lineEnd=_,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=m,a=de(a);var t=function(t,e){var n=$w(e),r=e[1],i=Qx(r),o=[Qx(n),-Yx(n),0],a=0,u=0,s=new Kt;1===i?r=qx+Ox:-1===i&&(r=-qx-Ox);for(var l=0,c=t.length;l<c;++l)if(h=(f=t[l]).length)for(var f,h,d=f[h-1],p=$w(d),g=d[1]/2+Lx,m=Qx(g),y=Yx(g),v=0;v<h;++v,p=x,m=w,y=k,d=_){var _=f[v],x=$w(_),b=_[1]/2+Lx,w=Qx(b),k=Yx(b),A=x-p,M=A>=0?1:-1,E=M*A,D=E>$x,C=m*w;if(s.add(Hx(C*M*Qx(E),y*k+C*Yx(E))),a+=D?A+M*Ux:A,D^p>=n^x>=n){var F=$b(Ob(d),Ob(_));Ub(F);var S=$b(o,F);Ub(S);var B=(D^A>=0?-1:1)*rb(S[2]);(r>B||r===B&&(F[0]||F[1]))&&(u+=D^A>=0?1:-1)}}return(a<-1e-6||a<Ox&&s<-1e-12)^1&u}(o,r);a.length?(f||(i.polygonStart(),f=!0),Ow(a,Uw,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){s.point(t,e)}function g(){h.point=p,s.lineStart()}function m(){h.point=d,s.lineEnd()}function y(t,e){u.push([t,e]),c.point(t,e)}function v(){c.lineStart(),u=[]}function _(){y(u[0][0],u[0][1]),c.lineEnd();var t,e,n,r,s=c.clean(),h=l.result(),d=h.length;if(u.pop(),o.push(u),u=null,d)if(1&s){if((e=(n=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&s&&h.push(h.pop().concat(h.shift())),a.push(h.filter(Lw))}return h}}function Lw(t){return t.length>1}function Uw(t,e){return((t=t.x)[0]<0?t[1]-qx-Ox:qx-t[1])-((e=e.x)[0]<0?e[1]-qx-Ox:qx-e[1])}Ew.invert=Ew;var Pw=qw((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var u=o>0?$x:-$x,s=Ix(o-n);Ix(s-$x)<Ox?(t.point(n,r=(r+a)/2>0?qx:-qx),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),e=0):i!==u&&s>=$x&&(Ix(n-i)<Ox&&(n-=i*Ox),Ix(o-u)<Ox&&(o-=u*Ox),r=function(t,e,n,r){var i,o,a=Qx(t-n);return Ix(a)>Ox?Wx((Qx(e)*(o=Yx(r))*Qx(n)-Qx(r)*(i=Yx(e))*Qx(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),e=0),t.point(n=o,r=a),i=u},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*qx,r.point(-$x,i),r.point(0,i),r.point($x,i),r.point($x,0),r.point($x,-i),r.point(0,-i),r.point(-$x,-i),r.point(-$x,0),r.point(-$x,i);else if(Ix(t[0]-e[0])>Ox){var o=t[0]<e[0]?$x:-$x;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-$x,-qx]);function jw(t){var e=Yx(t),n=6*jx,r=e>0,i=Ix(e)>Ox;function o(t,n){return Yx(t)*Yx(n)>e}function a(t,n,r){var i=[1,0,0],o=$b(Ob(t),Ob(n)),a=Rb(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var l=e*a/s,c=-e*u/s,f=$b(i,o),h=Lb(i,l);qb(h,Lb(o,c));var d=f,p=Rb(h,d),g=Rb(d,d),m=p*p-g*(Rb(h,h)-1);if(!(m<0)){var y=tb(m),v=Lb(d,(-p-y)/g);if(qb(v,h),v=Nb(v),!r)return v;var _,x=t[0],b=n[0],w=t[1],k=n[1];b<x&&(_=x,x=b,b=_);var A=b-x,M=Ix(A-$x)<Ox;if(!M&&k<w&&(_=w,w=k,k=_),M||A<Ox?M?w+k>0^v[1]<(Ix(v[0]-x)<Ox?w:k):w<=v[1]&&v[1]<=k:A>$x^(x<=v[0]&&v[0]<=b)){var E=Lb(d,(-p+y)/g);return qb(E,h),[v,Nb(E)]}}}function u(e,n){var i=r?t:$x-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return qw(o,(function(t){var e,n,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],g=o(f,h),m=r?g?0:u(f,h):g?u(f+(f<0?$x:-$x),h):0;if(!e&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=a(e,p))||zw(e,d)||zw(p,d))&&(p[2]=1),g!==s)c=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;m&n||!(y=a(p,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&zw(e,p)||t.point(p[0],p[1]),e=p,s=g,n=m},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return c|(l&&s)<<1}}}),(function(e,r,i,o){!function(t,e,n,r,i,o){if(n){var a=Yx(e),u=Qx(e),s=r*n;null==i?(i=e+r*Ux,o=e-s/2):(i=Bw(a,i),o=Bw(a,o),(r>0?i<o:i>o)&&(i+=r*Ux));for(var l,c=i;r>0?c>o:c<o;c-=s)l=Nb([a,-u*Yx(c),-u*Qx(c)]),t.point(l[0],l[1])}}(o,t,n,i,e,r)}),r?[0,-t]:[-$x,t-$x])}var Iw=1e9,Ww=-Iw;function Hw(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,u,l){var c=0,f=0;if(null==i||(c=a(i,u))!==(f=a(o,u))||s(i,o)<0^u>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+u+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return Ix(r[0]-t)<Ox?i>0?0:3:Ix(r[0]-n)<Ox?i>0?2:1:Ix(r[1]-e)<Ox?i>0?1:0:i>0?3:2}function u(t,e){return s(t.x,e.x)}function s(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var s,l,c,f,h,d,p,g,m,y,v,_=a,x=Tw(),b={point:w,lineStart:function(){b.point=k,l&&l.push(c=[]);y=!0,m=!1,p=g=NaN},lineEnd:function(){s&&(k(f,h),d&&m&&x.rejoin(),s.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var o,a,u=l[n],s=1,c=u.length,f=u[0],h=f[0],d=f[1];s<c;++s)o=h,a=d,h=(f=u[s])[0],d=f[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=v&&e,i=(s=de(s)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&Ow(s,u,e,o,a),a.polygonEnd());_=a,s=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function k(o,a){var u=i(o,a);if(l&&c.push([o,a]),y)f=o,h=a,d=u,y=!1,u&&(_.lineStart(),_.point(o,a));else if(u&&m)_.point(o,a);else{var s=[p=Math.max(Ww,Math.min(Iw,p)),g=Math.max(Ww,Math.min(Iw,g))],x=[o=Math.max(Ww,Math.min(Iw,o)),a=Math.max(Ww,Math.min(Iw,a))];!function(t,e,n,r,i,o){var a,u=t[0],s=t[1],l=0,c=1,f=e[0]-u,h=e[1]-s;if(a=n-u,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=i-u,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=r-s,h||!(a>0)){if(a/=h,h<0){if(a<l)return;a<c&&(c=a)}else if(h>0){if(a>c)return;a>l&&(l=a)}if(a=o-s,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a<l)return;a<c&&(c=a)}return l>0&&(t[0]=u+l*f,t[1]=s+l*h),c<1&&(e[0]=u+c*f,e[1]=s+c*h),!0}}}}}(s,x,t,e,n,r)?u&&(_.lineStart(),_.point(o,a),v=!1):(m||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),u||_.lineEnd(),v=!1)}p=o,g=a,m=u}return b}}function Yw(t,e,n){var r=pe(t,e-Ox,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function Vw(t,e,n){var r=pe(t,e-Ox,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}var Gw,Xw,Jw,Zw,Qw=t=>t,Kw=new Kt,tk=new Kt,ek={point:ib,lineStart:ib,lineEnd:ib,polygonStart:function(){ek.lineStart=nk,ek.lineEnd=ok},polygonEnd:function(){ek.lineStart=ek.lineEnd=ek.point=ib,Kw.add(Ix(tk)),tk=new Kt},result:function(){var t=Kw/2;return Kw=new Kt,t}};function nk(){ek.point=rk}function rk(t,e){ek.point=ik,Gw=Jw=t,Xw=Zw=e}function ik(t,e){tk.add(Zw*t-Jw*e),Jw=t,Zw=e}function ok(){ik(Gw,Xw)}var ak=ek,uk=1/0,sk=uk,lk=-uk,ck=lk,fk={point:function(t,e){t<uk&&(uk=t);t>lk&&(lk=t);e<sk&&(sk=e);e>ck&&(ck=e)},lineStart:ib,lineEnd:ib,polygonStart:ib,polygonEnd:ib,result:function(){var t=[[uk,sk],[lk,ck]];return lk=ck=-(sk=uk=1/0),t}};var hk,dk,pk,gk,mk=fk,yk=0,vk=0,_k=0,xk=0,bk=0,wk=0,kk=0,Ak=0,Mk=0,Ek={point:Dk,lineStart:Ck,lineEnd:Bk,polygonStart:function(){Ek.lineStart=Tk,Ek.lineEnd=zk},polygonEnd:function(){Ek.point=Dk,Ek.lineStart=Ck,Ek.lineEnd=Bk},result:function(){var t=Mk?[kk/Mk,Ak/Mk]:wk?[xk/wk,bk/wk]:_k?[yk/_k,vk/_k]:[NaN,NaN];return yk=vk=_k=xk=bk=wk=kk=Ak=Mk=0,t}};function Dk(t,e){yk+=t,vk+=e,++_k}function Ck(){Ek.point=Fk}function Fk(t,e){Ek.point=Sk,Dk(pk=t,gk=e)}function Sk(t,e){var n=t-pk,r=e-gk,i=tb(n*n+r*r);xk+=i*(pk+t)/2,bk+=i*(gk+e)/2,wk+=i,Dk(pk=t,gk=e)}function Bk(){Ek.point=Dk}function Tk(){Ek.point=Nk}function zk(){Ok(hk,dk)}function Nk(t,e){Ek.point=Ok,Dk(hk=pk=t,dk=gk=e)}function Ok(t,e){var n=t-pk,r=e-gk,i=tb(n*n+r*r);xk+=i*(pk+t)/2,bk+=i*(gk+e)/2,wk+=i,kk+=(i=gk*t-pk*e)*(pk+t),Ak+=i*(gk+e),Mk+=3*i,Dk(pk=t,gk=e)}var Rk=Ek;function $k(t){this._context=t}$k.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ux)}},result:ib};var qk,Lk,Uk,Pk,jk,Ik=new Kt,Wk={point:ib,lineStart:function(){Wk.point=Hk},lineEnd:function(){qk&&Yk(Lk,Uk),Wk.point=ib},polygonStart:function(){qk=!0},polygonEnd:function(){qk=null},result:function(){var t=+Ik;return Ik=new Kt,t}};function Hk(t,e){Wk.point=Yk,Lk=Pk=t,Uk=jk=e}function Yk(t,e){Pk-=t,jk-=e,Ik.add(tb(Pk*Pk+jk*jk)),Pk=t,jk=e}var Vk=Wk;function Gk(){this._string=[]}function Xk(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Jk(t,e){var n,r,i=4.5;function o(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),cb(t,n(r))),r.result()}return o.area=function(t){return cb(t,n(ak)),ak.result()},o.measure=function(t){return cb(t,n(Vk)),Vk.result()},o.bounds=function(t){return cb(t,n(mk)),mk.result()},o.centroid=function(t){return cb(t,n(Rk)),Rk.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,Qw):(t=e).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(e=null,new Gk):new $k(e=t),"function"!=typeof i&&r.pointRadius(i),o):e},o.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(e)}function Zk(t){return function(e){var n=new Qk;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Qk(){}function Kk(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),cb(n,t.stream(mk)),e(mk.result()),null!=r&&t.clipExtent(r),t}function tA(t,e,n){return Kk(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,u])}),n)}function eA(t,e,n){return tA(t,[[0,0],e],n)}function nA(t,e,n){return Kk(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])}),n)}function rA(t,e,n){return Kk(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])}),n)}Gk.prototype={_radius:4.5,_circle:Xk(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Xk(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Qk.prototype={constructor:Qk,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var iA=Yx(30*jx);function oA(t,e){return+e?function(t,e){function n(r,i,o,a,u,s,l,c,f,h,d,p,g,m){var y=l-r,v=c-i,_=y*y+v*v;if(_>4*e&&g--){var x=a+h,b=u+d,w=s+p,k=tb(x*x+b*b+w*w),A=rb(w/=k),M=Ix(Ix(w)-1)<Ox||Ix(o-f)<Ox?(o+f)/2:Hx(b,x),E=t(M,A),D=E[0],C=E[1],F=D-r,S=C-i,B=v*F-y*S;(B*B/_>e||Ix((y*F+v*S)/_-.5)>.3||a*h+u*d+s*p<iA)&&(n(r,i,o,a,u,s,D,C,M,x/=k,b/=k,w,g,m),m.point(D,C),n(D,C,M,x,b,w,l,c,f,h,d,p,g,m))}}return function(e){var r,i,o,a,u,s,l,c,f,h,d,p,g={point:m,lineStart:y,lineEnd:_,polygonStart:function(){e.polygonStart(),g.lineStart=x},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function m(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){c=NaN,g.point=v,e.lineStart()}function v(r,i){var o=Ob([r,i]),a=t(r,i);n(c,f,l,h,d,p,c=a[0],f=a[1],l=r,h=o[0],d=o[1],p=o[2],16,e),e.point(c,f)}function _(){g.point=m,e.lineEnd()}function x(){y(),g.point=b,g.lineEnd=w}function b(t,e){v(r=t,e),i=c,o=f,a=h,u=d,s=p,g.point=v}function w(){n(c,f,l,h,d,p,i,o,r,a,u,s,16,e),g.lineEnd=_,_()}return g}}(t,e):function(t){return Zk({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var aA=Zk({point:function(t,e){this.stream.point(t*jx,e*jx)}});function uA(t,e,n,r,i,o){if(!o)return function(t,e,n,r,i){function o(o,a){return[e+t*(o*=r),n-t*(a*=i)]}return o.invert=function(o,a){return[(o-e)/t*r,(n-a)/t*i]},o}(t,e,n,r,i);var a=Yx(o),u=Qx(o),s=a*t,l=u*t,c=a/t,f=u/t,h=(u*n-a*e)/t,d=(u*e+a*n)/t;function p(t,o){return[s*(t*=r)-l*(o*=i)+e,n-l*t-s*o]}return p.invert=function(t,e){return[r*(c*t-f*e+h),i*(d-f*t-c*e)]},p}function sA(t){return lA((function(){return t}))()}function lA(t){var e,n,r,i,o,a,u,s,l,c,f=150,h=480,d=250,p=0,g=0,m=0,y=0,v=0,_=0,x=1,b=1,w=null,k=Pw,A=null,M=Qw,E=.5;function D(t){return s(t[0]*jx,t[1]*jx)}function C(t){return(t=s.invert(t[0],t[1]))&&[t[0]*Px,t[1]*Px]}function F(){var t=uA(f,0,0,x,b,_).apply(null,e(p,g)),r=uA(f,h-t[0],d-t[1],x,b,_);return n=Dw(m,y,v),u=Mw(e,r),s=Mw(n,u),a=oA(u,E),S()}function S(){return l=c=null,D}return D.stream=function(t){return l&&c===t?l:l=aA(function(t){return Zk({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(k(a(M(c=t)))))},D.preclip=function(t){return arguments.length?(k=t,w=void 0,S()):k},D.postclip=function(t){return arguments.length?(M=t,A=r=i=o=null,S()):M},D.clipAngle=function(t){return arguments.length?(k=+t?jw(w=t*jx):(w=null,Pw),S()):w*Px},D.clipExtent=function(t){return arguments.length?(M=null==t?(A=r=i=o=null,Qw):Hw(A=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),S()):null==A?null:[[A,r],[i,o]]},D.scale=function(t){return arguments.length?(f=+t,F()):f},D.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],F()):[h,d]},D.center=function(t){return arguments.length?(p=t[0]%360*jx,g=t[1]%360*jx,F()):[p*Px,g*Px]},D.rotate=function(t){return arguments.length?(m=t[0]%360*jx,y=t[1]%360*jx,v=t.length>2?t[2]%360*jx:0,F()):[m*Px,y*Px,v*Px]},D.angle=function(t){return arguments.length?(_=t%360*jx,F()):_*Px},D.reflectX=function(t){return arguments.length?(x=t?-1:1,F()):x<0},D.reflectY=function(t){return arguments.length?(b=t?-1:1,F()):b<0},D.precision=function(t){return arguments.length?(a=oA(u,E=t*t),S()):tb(E)},D.fitExtent=function(t,e){return tA(D,t,e)},D.fitSize=function(t,e){return eA(D,t,e)},D.fitWidth=function(t,e){return nA(D,t,e)},D.fitHeight=function(t,e){return rA(D,t,e)},function(){return e=t.apply(this,arguments),D.invert=e.invert&&C,F()}}function cA(t){var e=0,n=$x/3,r=lA(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*jx,n=t[1]*jx):[e*Px,n*Px]},i}function fA(t,e){var n=Qx(t),r=(n+Qx(e))/2;if(Ix(r)<Ox)return function(t){var e=Yx(t);function n(t,n){return[t*e,Qx(n)/e]}return n.invert=function(t,n){return[t/e,rb(n*e)]},n}(t);var i=1+n*(2*r-n),o=tb(i)/r;function a(t,e){var n=tb(i-2*r*Qx(e))/r;return[n*Qx(t*=r),o-n*Yx(t)]}return a.invert=function(t,e){var n=o-e,a=Hx(t,Ix(n))*Kx(n);return n*r<0&&(a-=$x*Kx(t)*Kx(n)),[a/r,rb((i-(t*t+n*n)*r*r)/(2*r))]},a}function hA(){return cA(fA).scale(155.424).center([0,33.6442])}function dA(){return hA().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function pA(t){return function(e,n){var r=Yx(e),i=Yx(n),o=t(r*i);return o===1/0?[2,0]:[o*i*Qx(e),o*Qx(n)]}}function gA(t){return function(e,n){var r=tb(e*e+n*n),i=t(r),o=Qx(i),a=Yx(i);return[Hx(e*o,r*a),rb(r&&n*o/r)]}}var mA=pA((function(t){return tb(2/(1+t))}));mA.invert=gA((function(t){return 2*rb(t/2)}));var yA=pA((function(t){return(t=nb(t))&&t/Qx(t)}));function vA(t,e){return[t,Jx(eb((qx+e)/2))]}function _A(t){var e,n,r,i=sA(t),o=i.center,a=i.scale,u=i.translate,s=i.clipExtent,l=null;function c(){var o=$x*a(),u=i(function(t){function e(e){return(e=t(e[0]*jx,e[1]*jx))[0]*=Px,e[1]*=Px,e}return t=Dw(t[0]*jx,t[1]*jx,t.length>2?t[2]*jx:0),e.invert=function(e){return(e=t.invert(e[0]*jx,e[1]*jx))[0]*=Px,e[1]*=Px,e},e}(i.rotate()).invert([0,0]));return s(null==l?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===vA?[[Math.max(u[0]-o,l),e],[Math.min(u[0]+o,n),r]]:[[l,Math.max(u[1]-o,e)],[n,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),c()):a()},i.translate=function(t){return arguments.length?(u(t),c()):u()},i.center=function(t){return arguments.length?(o(t),c()):o()},i.clipExtent=function(t){return arguments.length?(null==t?l=e=n=r=null:(l=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,e],[n,r]]},c()}function xA(t){return eb((qx+t)/2)}function bA(t,e){var n=Yx(t),r=t===e?Qx(t):Jx(n/Yx(e))/Jx(xA(e)/xA(t)),i=n*Zx(xA(t),r)/r;if(!r)return vA;function o(t,e){i>0?e<-qx+Ox&&(e=-qx+Ox):e>qx-Ox&&(e=qx-Ox);var n=i/Zx(xA(e),r);return[n*Qx(r*t),i-n*Yx(r*t)]}return o.invert=function(t,e){var n=i-e,o=Kx(r)*tb(t*t+n*n),a=Hx(t,Ix(n))*Kx(n);return n*r<0&&(a-=$x*Kx(t)*Kx(n)),[a/r,2*Wx(Zx(i/o,1/r))-qx]},o}function wA(t,e){return[t,e]}function kA(t,e){var n=Yx(t),r=t===e?Qx(t):(n-Yx(e))/(e-t),i=n/r+t;if(Ix(r)<Ox)return wA;function o(t,e){var n=i-e,o=r*t;return[n*Qx(o),i-n*Yx(o)]}return o.invert=function(t,e){var n=i-e,o=Hx(t,Ix(n))*Kx(n);return n*r<0&&(o-=$x*Kx(t)*Kx(n)),[o/r,i-Kx(r)*tb(t*t+n*n)]},o}yA.invert=gA((function(t){return t})),vA.invert=function(t,e){return[t,2*Wx(Gx(e))-qx]},wA.invert=wA;var AA=1.340264,MA=-.081106,EA=893e-6,DA=.003796,CA=tb(3)/2;function FA(t,e){var n=rb(CA*Qx(e)),r=n*n,i=r*r*r;return[t*Yx(n)/(CA*(AA+3*MA*r+i*(7*EA+9*DA*r))),n*(AA+MA*r+i*(EA+DA*r))]}function SA(t,e){var n=Yx(e),r=Yx(t)*n;return[n*Qx(t)/r,Qx(e)/r]}function BA(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function TA(t,e){return[Yx(e)*Qx(t),Qx(e)]}function zA(t,e){var n=Yx(e),r=1+Yx(t)*n;return[n*Qx(t)/r,Qx(e)/r]}function NA(t,e){return[Jx(eb((qx+e)/2)),-t]}FA.invert=function(t,e){for(var n,r=e,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(AA+MA*i+o*(EA+DA*i))-e)/(AA+3*MA*i+o*(7*EA+9*DA*i)))*r)*i*i,!(Ix(n)<Rx));++a);return[CA*t*(AA+3*MA*i+o*(7*EA+9*DA*i))/Yx(r),rb(Qx(r)/CA)]},SA.invert=gA(Wx),BA.invert=function(t,e){var n,r=e,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-e)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Ix(n)>Ox&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},TA.invert=gA(rb),zA.invert=gA((function(t){return 2*Wx(t)})),NA.invert=function(t,e){return[-e,2*Wx(Gx(t))-qx]};var OA=Math.abs,RA=Math.cos,$A=Math.sin,qA=Math.PI,LA=qA/2,UA=function(t){return t>0?Math.sqrt(t):0}(2);function PA(t){return t>1?LA:t<-1?-LA:Math.asin(t)}function jA(t,e){var n,r=t*$A(e),i=30;do{e-=n=(e+$A(e)-r)/(1+RA(e))}while(OA(n)>1e-6&&--i>0);return e/2}var IA=function(t,e,n){function r(r,i){return[t*r*RA(i=jA(n,i)),e*$A(i)]}return r.invert=function(r,i){return i=PA(i/e),[r/(t*RA(i)),PA((2*i+$A(2*i))/n)]},r}(UA/LA,UA,qA);const WA=Jk(),HA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function YA(t,e){return function n(){const r=e();return r.type=t,r.path=Jk().projection(r),r.copy=r.copy||function(){const t=n();return HA.forEach((e=>{r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function VA(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(XA[t]=YA(t,e),this):XA[t]||null}function GA(t){return t&&t.path||WA}const XA={albers:dA,albersusa:function(){var t,e,n,r,i,o,a=dA(),u=hA().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=hA().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){o=[t,e]}};function c(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function f(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),u.stream(n),s.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},c.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),s.precision(t),f()):a.precision()},c.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),s.scale(t),c.translate(a.translate())):a.scale()},c.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),o=+t[0],c=+t[1];return n=a.translate(t).clipExtent([[o-.455*e,c-.238*e],[o+.455*e,c+.238*e]]).stream(l),r=u.translate([o-.307*e,c+.201*e]).clipExtent([[o-.425*e+Ox,c+.12*e+Ox],[o-.214*e-Ox,c+.234*e-Ox]]).stream(l),i=s.translate([o-.205*e,c+.212*e]).clipExtent([[o-.214*e+Ox,c+.166*e+Ox],[o-.115*e-Ox,c+.234*e-Ox]]).stream(l),f()},c.fitExtent=function(t,e){return tA(c,t,e)},c.fitSize=function(t,e){return eA(c,t,e)},c.fitWidth=function(t,e){return nA(c,t,e)},c.fitHeight=function(t,e){return rA(c,t,e)},c.scale(1070)},azimuthalequalarea:function(){return sA(mA).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return sA(yA).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return cA(bA).scale(109.5).parallels([30,30])},conicequalarea:hA,conicequidistant:function(){return cA(kA).scale(131.154).center([0,13.9389])},equalEarth:function(){return sA(FA).scale(177.158)},equirectangular:function(){return sA(wA).scale(152.63)},gnomonic:function(){return sA(SA).scale(144.049).clipAngle(60)},identity:function(){var t,e,n,r,i,o,a,u=1,s=0,l=0,c=1,f=1,h=0,d=null,p=1,g=1,m=Zk({point:function(t,e){var n=_([t,e]);this.stream.point(n[0],n[1])}}),y=Qw;function v(){return p=u*c,g=u*f,o=a=null,_}function _(n){var r=n[0]*p,i=n[1]*g;if(h){var o=i*t-r*e;r=r*t+i*e,i=o}return[r+s,i+l]}return _.invert=function(n){var r=n[0]-s,i=n[1]-l;if(h){var o=i*t+r*e;r=r*t-i*e,i=o}return[r/p,i/g]},_.stream=function(t){return o&&a===t?o:o=m(y(a=t))},_.postclip=function(t){return arguments.length?(y=t,d=n=r=i=null,v()):y},_.clipExtent=function(t){return arguments.length?(y=null==t?(d=n=r=i=null,Qw):Hw(d=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),v()):null==d?null:[[d,n],[r,i]]},_.scale=function(t){return arguments.length?(u=+t,v()):u},_.translate=function(t){return arguments.length?(s=+t[0],l=+t[1],v()):[s,l]},_.angle=function(n){return arguments.length?(e=Qx(h=n%360*jx),t=Yx(h),v()):h*Px},_.reflectX=function(t){return arguments.length?(c=t?-1:1,v()):c<0},_.reflectY=function(t){return arguments.length?(f=t?-1:1,v()):f<0},_.fitExtent=function(t,e){return tA(_,t,e)},_.fitSize=function(t,e){return eA(_,t,e)},_.fitWidth=function(t,e){return nA(_,t,e)},_.fitHeight=function(t,e){return rA(_,t,e)},_},mercator:function(){return _A(vA).scale(961/Ux)},mollweide:function(){return sA(IA).scale(169.529)},naturalEarth1:function(){return sA(BA).scale(175.295)},orthographic:function(){return sA(TA).scale(249.5).clipAngle(90.000001)},stereographic:function(){return sA(zA).scale(250).clipAngle(142)},transversemercator:function(){var t=_A(NA),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(const t in XA)VA(t,XA[t]);function JA(){}const ZA=[[],[[[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 QA(){var t=1,e=1,n=a;function r(t,e){return e.map((e=>i(t,e)))}function i(r,i){var a=[],u=[];return function(n,r,i){var a,u,s,l,c,f,h=new Array,d=new Array;a=u=-1,l=n[0]>=r,ZA[l<<1].forEach(p);for(;++a<t-1;)s=l,l=n[a+1]>=r,ZA[s|l<<1].forEach(p);ZA[l<<0].forEach(p);for(;++u<e-1;){for(a=-1,l=n[u*t+t]>=r,c=n[u*t]>=r,ZA[l<<1|c<<2].forEach(p);++a<t-1;)s=l,l=n[u*t+t+a+1]>=r,f=c,c=n[u*t+a+1]>=r,ZA[s|l<<1|c<<2|f<<3].forEach(p);ZA[l|c<<3].forEach(p)}a=-1,c=n[u*t]>=r,ZA[c<<2].forEach(p);for(;++a<t-1;)f=c,c=n[u*t+a+1]>=r,ZA[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+a,t[0][1]+u],s=[t[1][0]+a,t[1][1]+u],l=o(r),c=o(s);(e=d[l])?(n=h[c])?(delete d[e.end],delete h[n.start],e===n?(e.ring.push(s),i(e.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(s),d[e.end=c]=e):(e=h[c])?(n=d[l])?(delete h[e.start],delete d[n.end],e===n?(e.ring.push(s),i(e.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(r),h[e.start=l]=e):h[l]=d[c]={start:l,end:c,ring:[r,s]}}ZA[c<<3].forEach(p)}(r,i,(t=>{n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)>0?a.push([t]):u.push(t)})),u.forEach((t=>{for(var e,n=0,r=a.length;n<r;++n)if(-1!==KA((e=a[n])[0],t))return void e.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function o(e){return 2*e[0]+e[1]*(t+1)*4}function a(n,r,i){n.forEach((n=>{var o,a=n[0],u=n[1],s=0|a,l=0|u,c=r[l*t+s];a>0&&a<t&&s===a&&(o=r[l*t+s-1],n[0]=a+(i-o)/(c-o)-.5),u>0&&u<e&&l===u&&(o=r[(l-1)*t+s],n[1]=u+(i-o)/(c-o)-.5)}))}return r.contour=i,r.size=function(n){if(!arguments.length)return[t,e];var i=Math.floor(n[0]),o=Math.floor(n[1]);return i>=0&&o>=0||s("invalid size"),t=i,e=o,r},r.smooth=function(t){return arguments.length?(n=t?a:JA,r):n===a},r}function KA(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=tM(t,e[r]))return n;return 0}function tM(t,e){for(var n=e[0],r=e[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var s=t[o],l=s[0],c=s[1],f=t[u],h=f[0],d=f[1];if(eM(s,f,e))return 0;c>r!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function eM(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function nM(t,e,n){return function(r){var i=et(r),o=n?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=e?oe(o,a,t):u/(t+1);return pe(o+s,a,s)}}function rM(t){Oa.call(this,null,t)}function iM(t,e,n,r,i){const o=t.x1||0,a=t.y1||0,u=e*n<0;function s(t){t.forEach(l)}function l(t){u&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-o)*e+r,t[1]=(t[1]-a)*n+i}return function(t){return t.coordinates.forEach(s),t}}function oM(t,e,n){const r=t>=0?t:ja(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function aM(t){return Y(t)?t:Q(+t)}function uM(){var t=t=>t[0],e=t=>t[1],n=p,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const l=oM(r[0],u,t)>>a,c=oM(r[1],u,e)>>a,f=l?l+2:0,h=c?c+2:0,d=2*f+(i>>a),p=2*h+(o>>a),g=new Float32Array(d*p),m=new Float32Array(d*p);let y=g;u.forEach((r=>{const i=f+(+t(r)>>a),o=h+(+e(r)>>a);i>=0&&i<d&&o>=0&&o<p&&(g[i+o*d]+=+n(r))})),l>0&&c>0?(sM(d,p,g,m,l),lM(d,p,m,g,c),sM(d,p,g,m,l),lM(d,p,m,g,c),sM(d,p,g,m,l),lM(d,p,m,g,c)):l>0?(sM(d,p,g,m,l),sM(d,p,m,g,l),sM(d,p,g,m,l),y=m):c>0&&(lM(d,p,g,m,c),lM(d,p,m,g,c),lM(d,p,g,m,c),y=m);const v=s?Math.pow(2,-2*a):1/ge(y);for(let t=0,e=d*p;t<e;++t)y[t]*=v;return{values:y,scale:1<<a,width:d,height:p,x1:f,y1:h,x2:f+(i>>a),y2:h+(o>>a)}}return u.x=function(e){return arguments.length?(t=aM(e),u):t},u.y=function(t){return arguments.length?(e=aM(t),u):e},u.weight=function(t){return arguments.length?(n=aM(t),u):n},u.size=function(t){if(!arguments.length)return[i,o];var e=+t[0],n=+t[1];return e>=0&&n>=0||s("invalid size"),i=e,o=n,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||s("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<<a},u.bandwidth=function(t){return arguments.length?(1===(t=W(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&s("invalid bandwidth"),r=t,u):r},u}function sM(t,e,n,r,i){const o=1+(i<<1);for(let a=0;a<e;++a)for(let e=0,u=0;e<t+i;++e)e<t&&(u+=n[e+a*t]),e>=i&&(e>=o&&(u-=n[e-o+a*t]),r[e-i+a*t]=u/Math.min(e+1,t-1+o-e,o))}function lM(t,e,n,r,i){const o=1+(i<<1);for(let a=0;a<t;++a)for(let u=0,s=0;u<e+i;++u)u<e&&(s+=n[a+u*t]),u>=i&&(u>=o&&(s-=n[a+(u-o)*t]),r[a+(u-i)*t]=s/Math.min(u+1,e-1+o-u,o))}function cM(t){Oa.call(this,null,t)}rM.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"}]},st(rM,Oa,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||h,o=QA().smooth(!1!==t.smooth),a=t.thresholds||function(t,e,n){const r=nM(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map((t=>ae(e(t).values))))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach((e=>{const n=i(e),r=o.size([n.width,n.height])(n.values,_(a)?a:a(n.values));!function(t,e,n,r){let i=r.scale||e.scale,o=r.translate||e.translate;Y(i)&&(i=i(n,r));Y(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(dt(i)?i:i[0])||1,u=(dt(i)?i:i[1])||1,s=o&&o[0]||0,l=o&&o[1]||0;t.forEach(iM(e,a,u,s,l))}(r,n,e,t),r.forEach((t=>{s.push(aa(e,ia(null!=u?{[u]:t}:t)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n}}),cM.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 fM=["x","y","weight","size","cellSize","bandwidth"];function hM(t,e){return fM.forEach((n=>null!=e[n]?t[n](e[n]):0)),t}function dM(t){Oa.call(this,null,t)}st(cM,Oa,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),o=function(t,e){var n,r,i,o,a,u,s=[],l=t=>t(o);if(null==e)s.push(t);else for(n={},r=0,i=t.length;r<i;++r)o=t[r],(u=n[a=e.map(l)])||(n[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}(e.materialize(e.SOURCE).source,t.groupby),a=(t.groupby||[]).map(r),u=hM(uM(),t),s=t.as||"grid";return n=o.map((e=>ia(function(t,e){for(let n=0;n<a.length;++n)t[a[n]]=e[n];return t}({[s]:u(e,t.counts)},e.dims)))),this.value&&(i.rem=this.value),this.value=i.source=i.add=n,i}}),dM.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}]},st(dM,Oa,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),o=QA().smooth(!1!==t.smooth),a=t.values,u=t.thresholds||nM(t.count||10,t.nice,!!a),s=t.size;return a||(a=e.materialize(e.SOURCE).source,r=iM(n=hM(uM(),t)(a,!0),n.scale||1,n.scale||1,0,0),s=[n.width,n.height],a=n.values),u=_(u)?u:u(a),a=o.size(s)(a,u),r&&a.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(a||[]).map(ia),i}});const pM="Feature",gM="FeatureCollection";function mM(t){Oa.call(this,null,t)}function yM(t){Oa.call(this,null,t)}function vM(t){Oa.call(this,null,t)}function _M(t){Oa.call(this,null,t)}function xM(t){Oa.call(this,[],t),this.generator=function(){var t,e,n,r,i,o,a,u,s,l,c,f,h=10,d=h,p=90,g=360,m=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return pe(Vx(r/p)*p,n,p).map(c).concat(pe(Vx(u/g)*g,a,g).map(f)).concat(pe(Vx(e/h)*h,t,h).filter((function(t){return Ix(t%p)>Ox})).map(s)).concat(pe(Vx(o/d)*d,i,d).filter((function(t){return Ix(t%g)>Ox})).map(l))}return y.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(a).slice(1),c(n).reverse().slice(1),f(u).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],u=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),u>a&&(t=u,u=a,a=t),y.precision(m)):[[r,u],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(m)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],y):[h,d]},y.precision=function(h){return arguments.length?(m=+h,s=Yw(o,i,90),l=Vw(e,t,m),c=Yw(u,a,90),f=Vw(r,n,m),y):m},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function bM(t){Oa.call(this,null,t)}function wM(t){if(!Y(t))return!1;const e=Ct(i(t));return e.$x||e.$y||e.$value||e.$max}function kM(t){Oa.call(this,null,t),this.modified(!0)}function AM(t,e,n){Y(t[e])&&t[e](n)}mM.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},st(mM,Oa,{transform(t,e){var n,r=this._features,o=this._points,a=t.fields,u=a&&a[0],s=a&&a[1],l=t.geojson||!a&&h,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(i(l))||u&&e.modified(i(u))||s&&e.modified(i(s)),this.value&&!n||(c=e.SOURCE,this._features=r=[],this._points=o=[]),l&&e.visit(c,(t=>r.push(l(t)))),u&&s&&(e.visit(c,(t=>{var e=u(t),n=s(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&o.push([e,n])})),r=r.concat({type:pM,geometry:{type:"MultiPoint",coordinates:o}})),this.value={type:gM,features:r}}}),yM.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"}]},st(yM,Oa,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||h,o=t.as||"path",a=n.SOURCE;!r||t.modified()?(this.value=r=GA(t.projection),n.materialize().reflow()):a=i===h||e.modified(i.fields)?n.ADD_MOD:n.ADD;const u=function(t,e){const n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(u),n.modifies(o)}}),vM.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"]}]},st(vM,Oa,{transform(t,e){var n,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],u=a[0],s=a[1];function l(t){const e=r([i(t),o(t)]);e?(t[u]=e[0],t[s]=e[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(o.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(a)}}),_M.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"}]},st(_M,Oa,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",o=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){const r=null==n?n=>t(e(n)):r=>{var i=t.pointRadius(),o=t.pointRadius(n)(e(r));return t.pointRadius(i),o};return r.context=e=>(t.context(e),r),r}(GA(t.projection),t.field||c("datum"),t.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(t=>t[i]=r)),n.modifies(i)}}),xM.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}]},st(xM,Oa,{transform(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(const e in t)Y(i[e])&&i[e](t[e]);return n=i(),r.length?e.mod.push(ua(r[0],n)):e.add.push(ia(n)),r[0]=n,e}}),bM.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"}]},st(bM,Oa,{transform(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||h,o=function(t,e){let n;Y(t)?(n=n=>t(n,e),n.dep=wM(t)):t?n=Q(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),a=function(t,e){let n;Y(t)?(n=n=>Ic(t(n,e)),n.dep=wM(t)):n=Q(Ic(t||"#888"));return n}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?ae(n.map((t=>ae(i(t).values)))):0};return n.forEach((t=>{const e=i(t),n=tt({},t,s);r||(n.$max=ae(e.values||[])),t[u]=function(t,e,n,r){const i=t.width,o=t.height,a=t.x1||0,u=t.y1||0,s=t.x2||i,l=t.y2||o,c=t.values,f=c?t=>c[t]:d,h=gc(s-a,l-u),p=h.getContext("2d"),g=p.getImageData(0,0,s-a,l-u),m=g.data;for(let t=u,o=0;t<l;++t){e.$y=t-u;for(let u=a,l=t*i;u<s;++u,o+=4){e.$x=u-a,e.$value=f(u+l);const t=n(e);m[o+0]=t.r,m[o+1]=t.g,m[o+2]=t.b,m[o+3]=~~(255*r(e))}}return p.putImageData(g,0,0),h}(e,n,a.dep?a:Q(a(n)),o.dep?o:Q(o(n)))})),e.reflow(!0).modifies(u)}}),st(kM,Oa,{transform(t,e){let n=this.value;return!n||t.modified("type")?(this.value=n=function(t){const e=VA((t||"mercator").toLowerCase());e||s("Unrecognized projection type: "+t);return e()}(t.type),HA.forEach((e=>{null!=t[e]&&AM(n,e,t[e])}))):HA.forEach((e=>{t.modified(e)&&AM(n,e,t[e])})),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){const n=function(t){return 1===(t=W(t)).length?t[0]:{type:gM,features:t.reduce(((t,e)=>t.concat(function(t){return t.type===gM?t.features:W(t).filter((t=>null!=t)).map((t=>t.type===pM?t:{type:pM,geometry:t}))}(e))),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)}});var MM=Object.freeze({__proto__:null,contour:dM,geojson:mM,geopath:yM,geopoint:vM,geoshape:_M,graticule:xM,heatmap:bM,isocontour:rM,kde2d:cM,projection:kM});function EM(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,u,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,y=t._x1,v=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===u&&n===s)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a}while((f=c<<1|l)==(h=(s>=a)<<1|u>=o));return i[h]=d,i[f]=p,t}function DM(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function CM(t){return t[0]}function FM(t){return t[1]}function SM(t,e,n){var r=new BM(null==e?CM:e,null==n?FM:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function BM(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function TM(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var zM=SM.prototype=BM.prototype;function NM(t){return function(){return t}}function OM(t){return 1e-6*(t()-.5)}function RM(t){return t.x+t.vx}function $M(t){return t.y+t.vy}function qM(t){return t.index}function LM(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}zM.copy=function(){var t,e,n=new BM(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=TM(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=TM(e));return n},zM.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return EM(this.cover(e,n),e,n,t)},zM.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,u[n]=i,r<s&&(s=r),r>c&&(c=r),i<l&&(l=i),i>f&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;n<o;++n)EM(this,a[n],u[n],t[n]);return this},zM.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,u,s=i-n||1,l=this._root;n>t||t>=i||r>e||e>=o;)switch(u=(e<r)<<1|t<n,(a=new Array(4))[u]=l,l=a,s*=2,u){case 0:i=n+s,o=r+s;break;case 1:n=i-s,o=r+s;break;case 2:i=n+s,r=o-s;break;case 3:n=i-s,r=o-s}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},zM.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},zM.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},zM.find=function(t,e,n){var r,i,o,a,u,s,l,c=this._x0,f=this._y0,h=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new DM(g,c,f,h,d)),null==n?n=1/0:(c=t-n,f=e-n,h=t+n,d=e+n,n*=n);s=p.pop();)if(!(!(g=s.node)||(i=s.x0)>h||(o=s.y0)>d||(a=s.x1)<c||(u=s.y1)<f))if(g.length){var m=(i+a)/2,y=(o+u)/2;p.push(new DM(g[3],m,y,a,u),new DM(g[2],i,y,m,u),new DM(g[1],m,o,a,y),new DM(g[0],i,o,m,y)),(l=(e>=y)<<1|t>=m)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var v=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=v*v+_*_;if(x<n){var b=Math.sqrt(n=x);c=t-b,f=e-b,h=t+b,d=e+b,r=g.data}}return r},zM.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,u,s,l,c,f,h,d=this._root,p=this._x0,g=this._y0,m=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((l=o>=(u=(p+m)/2))?p=u:m=u,(c=a>=(s=(g+y)/2))?g=s:y=s,e=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},zM.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},zM.root=function(){return this._root},zM.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},zM.visit=function(t){var e,n,r,i,o,a,u=[],s=this._root;for(s&&u.push(new DM(s,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(s=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&s.length){var l=(r+o)/2,c=(i+a)/2;(n=s[3])&&u.push(new DM(n,l,c,o,a)),(n=s[2])&&u.push(new DM(n,r,c,l,a)),(n=s[1])&&u.push(new DM(n,l,i,o,c)),(n=s[0])&&u.push(new DM(n,r,i,l,c))}return this},zM.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new DM(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,u=e.y0,s=e.x1,l=e.y1,c=(a+s)/2,f=(u+l)/2;(o=i[0])&&n.push(new DM(o,a,u,c,f)),(o=i[1])&&n.push(new DM(o,c,u,s,f)),(o=i[2])&&n.push(new DM(o,a,f,c,l)),(o=i[3])&&n.push(new DM(o,c,f,s,l))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},zM.x=function(t){return arguments.length?(this._x=t,this):this._x},zM.y=function(t){return arguments.length?(this._y=t,this):this._y};var UM={value:()=>{}};function PM(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new jM(r)}function jM(t){this._=t}function IM(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function WM(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function HM(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=UM,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}jM.prototype=PM.prototype={constructor:jM,on:function(t,e){var n,r=this._,i=IM(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=HM(r[n],t.name,e);else if(null==e)for(n in r)r[n]=HM(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=WM(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new jM(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var YM,VM,GM=0,XM=0,JM=0,ZM=0,QM=0,KM=0,tE="object"==typeof performance&&performance.now?performance:Date,eE="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function nE(){return QM||(eE(rE),QM=tE.now()+KM)}function rE(){QM=0}function iE(){this._call=this._time=this._next=null}function oE(t,e,n){var r=new iE;return r.restart(t,e,n),r}function aE(){QM=(ZM=tE.now())+KM,GM=XM=0;try{!function(){nE(),++GM;for(var t,e=YM;e;)(t=QM-e._time)>=0&&e._call.call(null,t),e=e._next;--GM}()}finally{GM=0,function(){var t,e,n=YM,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:YM=e);VM=t,sE(r)}(),QM=0}}function uE(){var t=tE.now(),e=t-ZM;e>1e3&&(KM-=e,ZM=t)}function sE(t){GM||(XM&&(XM=clearTimeout(XM)),t-QM>24?(t<1/0&&(XM=setTimeout(aE,t-tE.now()-KM)),JM&&(JM=clearInterval(JM))):(JM||(ZM=tE.now(),JM=setInterval(uE,1e3)),GM=1,eE(aE)))}iE.prototype=oE.prototype={constructor:iE,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?nE():+n)+(null==e?0:+e),this._next||VM===this||(VM?VM._next=this:YM=this,VM=this),this._call=t,this._time=n,sE()},stop:function(){this._call&&(this._call=null,this._time=1/0,sE())}};const lE=4294967296;function cE(t){return t.x}function fE(t){return t.y}var hE=Math.PI*(3-Math.sqrt(5));function dE(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=oE(f),l=PM("tick","end"),c=function(){let t=1;return()=>(t=(1664525*t+1013904223)%lE)/lE}();function f(){h(),l.call("tick",e),n<r&&(s.stop(),l.call("end",e))}function h(r){var s,l,c=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(n+=(o-n)*i,u.forEach((function(t){t(n)})),s=0;s<c;++s)null==(l=t[s]).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 e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*hE;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,c),e}return null==t&&(t=[]),d(),e={tick:h,restart:function(){return s.restart(f),e},stop:function(){return s.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),u.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(c=t,u.forEach(p),e):c},force:function(t,n){return arguments.length>1?(null==n?u.delete(t):u.set(t,p(n)),e):u.get(t)},find:function(e,n,r){var i,o,a,u,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l<c;++l)(a=(i=e-(u=t[l]).x)*i+(o=n-u.y)*o)<r&&(s=u,r=a);return s},on:function(t,n){return arguments.length>1?(l.on(t,n),e):l.on(t)}}}const pE={center:function(t,e){var n,r=1;function i(){var i,o,a=n.length,u=0,s=0;for(i=0;i<a;++i)u+=(o=n[i]).x,s+=o.y;for(u=(u/a-t)*r,s=(s/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=u,o.y-=s}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var e,n,r,i=1,o=1;function a(){for(var t,a,s,l,c,f,h,d=e.length,p=0;p<o;++p)for(a=SM(e,RM,$M).visitAfter(u),t=0;t<d;++t)s=e[t],f=n[s.index],h=f*f,l=s.x+s.vx,c=s.y+s.vy,a.visit(g);function g(t,e,n,o,a){var u=t.data,d=t.r,p=f+d;if(!u)return e>l+p||o<l-p||n>c+p||a<c-p;if(u.index>s.index){var g=l-u.x-u.vx,m=c-u.y-u.vy,y=g*g+m*m;y<p*p&&(0===g&&(y+=(g=OM(r))*g),0===m&&(y+=(m=OM(r))*m),y=(p-(y=Math.sqrt(y)))/y*i,s.vx+=(g*=y)*(p=(d*=d)/(h+d)),s.vy+=(m*=y)*p,u.vx-=g*(p=1-p),u.vy-=m*p)}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function s(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=NM(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,s()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:NM(+e),s(),a):t},a},nbody:function(){var t,e,n,r,i,o=NM(-30),a=1,u=1/0,s=.81;function l(n){var i,o=t.length,a=SM(t,cE,fE).visitAfter(f);for(r=n,i=0;i<o;++i)e=t[i],a.visit(h)}function c(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function f(t){var e,n,r,o,a,u=0,s=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(u+=e.value,s+=n,r+=n*e.x,o+=n*e.y);t.x=r/s,t.y=o/s}else{(e=t).x=e.data.x,e.y=e.data.y;do{u+=i[e.data.index]}while(e=e.next)}t.value=u}function h(t,o,l,c){if(!t.value)return!0;var f=t.x-e.x,h=t.y-e.y,d=c-o,p=f*f+h*h;if(d*d/s<p)return p<u&&(0===f&&(p+=(f=OM(n))*f),0===h&&(p+=(h=OM(n))*h),p<a&&(p=Math.sqrt(a*p)),e.vx+=f*t.value*r/p,e.vy+=h*t.value*r/p),!0;if(!(t.length||p>=u)){(t.data!==e||t.next)&&(0===f&&(p+=(f=OM(n))*f),0===h&&(p+=(h=OM(n))*h),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(d=i[t.data.index]*r/p,e.vx+=f*d,e.vy+=h*d)}while(t=t.next)}}return l.initialize=function(e,r){t=e,n=r,c()},l.strength=function(t){return arguments.length?(o="function"==typeof t?t:NM(+t),c(),l):o},l.distanceMin=function(t){return arguments.length?(a=t*t,l):Math.sqrt(a)},l.distanceMax=function(t){return arguments.length?(u=t*t,l):Math.sqrt(u)},l.theta=function(t){return arguments.length?(s=t*t,l):Math.sqrt(s)},l},link:function(t){var e,n,r,i,o,a,u=qM,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},l=NM(30),c=1;function f(r){for(var i=0,u=t.length;i<c;++i)for(var s,l,f,h,d,p,g,m=0;m<u;++m)l=(s=t[m]).source,h=(f=s.target).x+f.vx-l.x-l.vx||OM(a),d=f.y+f.vy-l.y-l.vy||OM(a),h*=p=((p=Math.sqrt(h*h+d*d))-n[m])/p*r*e[m],d*=p,f.vx-=h*(g=o[m]),f.vy-=d*g,l.vx+=h*(g=1-g),l.vy+=d*g}function h(){if(r){var a,s,l=r.length,c=t.length,f=new Map(r.map(((t,e)=>[u(t,e,r),t])));for(a=0,i=new Array(l);a<c;++a)(s=t[a]).index=a,"object"!=typeof s.source&&(s.source=LM(f,s.source)),"object"!=typeof s.target&&(s.target=LM(f,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(a=0,o=new Array(c);a<c;++a)s=t[a],o[a]=i[s.source.index]/(i[s.source.index]+i[s.target.index]);e=new Array(c),d(),n=new Array(c),p()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+s(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+l(t[e],e,t)}return null==t&&(t=[]),f.initialize=function(t,e){r=t,a=e,h()},f.links=function(e){return arguments.length?(t=e,h(),f):t},f.id=function(t){return arguments.length?(u=t,f):u},f.iterations=function(t){return arguments.length?(c=+t,f):c},f.strength=function(t){return arguments.length?(s="function"==typeof t?t:NM(+t),d(),f):s},f.distance=function(t){return arguments.length?(l="function"==typeof t?t:NM(+t),p(),f):l},f},x:function(t){var e,n,r,i=NM(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=NM(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:NM(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:NM(+e),a(),o):t},o},y:function(t){var e,n,r,i=NM(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=NM(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:NM(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:NM(+e),a(),o):t},o}},gE="forces",mE=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],yE=["static","iterations"],vE=["x","y","vx","vy"];function _E(t){Oa.call(this,null,t)}function xE(t,e,n,r){var i,o,a,u,s=W(e.forces);for(i=0,o=mE.length;i<o;++i)(a=mE[i])!==gE&&e.modified(a)&&t[a](e[a]);for(i=0,o=s.length;i<o;++i)u=gE+i,(a=n||e.modified(gE,i)?wE(s[i]):r&&bE(s[i],r)?t.force(u):null)&&t.force(u,a);for(o=t.numForces||0;i<o;++i)t.force(gE+i,null);return t.numForces=s.length,t}function bE(t,e){var n,r;for(n in t)if(Y(r=t[n])&&e.modified(i(r)))return 1;return 0}function wE(t){var e,n;for(n in it(pE,t.force)||s("Unrecognized force: "+t.force),e=pE[t.force](),t)Y(e[n])&&kE(e[n],t[n],t);return e}function kE(t,e,n){t(Y(e)?t=>e(t,n):e)}_E.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},{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:vE}]},st(_E,Oa,{transform(t,e){var n,r,i=this.value,o=e.changed(e.ADD_REM),a=t.modified(mE),u=t.iterations||300;if(i?(o&&(e.modifies("index"),i.nodes(e.source)),(a||e.changed(e.MOD))&&xE(i,t,0,e)):(this.value=i=function(t,e){const n=dE(t),r=n.stop,i=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,i()),n.stop=()=>(o=!0,r()),xE(n,e,!0).on("end",(()=>o=!0))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,()=>n.touch(r).run())),t.static||(o=!0,i.tick()),e.modifies("index")),a||o||t.modified(yE)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return e.StopPropagation;return this.finish(t,e)},finish(t,e){const n=e.dataflow;for(let t,e=this._argops,u=0,s=e.length;u<s;++u)if(t=e[u],t.name===gE&&"link"===t.op._argval.force)for(var r,i=t.op._argops,o=0,a=i.length;o<a;++o)if("links"===i[o].name&&(r=i[o].op.source)){n.pulse(r,n.changeset().reflow());break}return e.reflow(t.modified()).modifies(vE)}});var AE=Object.freeze({__proto__:null,force:_E});function ME(t,e){return t.parent===e.parent?1:2}function EE(t,e){return t+e.x}function DE(t,e){return Math.max(t,e.y)}function CE(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function FE(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=BE)):void 0===e&&(e=SE);for(var n,r,i,o,a,u=new NE(t),s=[u];n=s.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)s.push(r=i[o]=new NE(i[o])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(zE)}function SE(t){return t.children}function BE(t){return Array.isArray(t)?t[1]:null}function TE(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function zE(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function NE(t){this.data=t,this.depth=this.height=0,this.parent=null}function OE(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(Array.from(t))).length,o=[];r<i;)e=t[r],n&&qE(n,e)?++r:(n=UE(o=RE(o,e)),r=0);return n}function RE(t,e){var n,r;if(LE(e,t))return[e];for(n=0;n<t.length;++n)if($E(e,t[n])&&LE(PE(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if($E(PE(t[n],t[r]),e)&&$E(PE(t[n],e),t[r])&&$E(PE(t[r],e),t[n])&&LE(jE(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function $E(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function qE(t,e){var n=t.r-e.r+1e-9*Math.max(t.r,e.r,1),r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function LE(t,e){for(var n=0;n<e.length;++n)if(!qE(t,e[n]))return!1;return!0}function UE(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return PE(t[0],t[1]);case 3:return jE(t[0],t[1],t[2])}}function PE(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,u=e.r,s=o-n,l=a-r,c=u-i,f=Math.sqrt(s*s+l*l);return{x:(n+o+s/f*c)/2,y:(r+a+l/f*c)/2,r:(f+i+u)/2}}function jE(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,u=e.y,s=e.r,l=n.x,c=n.y,f=n.r,h=r-a,d=r-l,p=i-u,g=i-c,m=s-o,y=f-o,v=r*r+i*i-o*o,_=v-a*a-u*u+s*s,x=v-l*l-c*c+f*f,b=d*p-h*g,w=(p*x-g*_)/(2*b)-r,k=(g*m-p*y)/b,A=(d*_-h*x)/(2*b)-i,M=(h*y-d*m)/b,E=k*k+M*M-1,D=2*(o+w*k+A*M),C=w*w+A*A-o*o,F=-(E?(D+Math.sqrt(D*D-4*E*C))/(2*E):C/D);return{x:r+w+k*F,y:i+A+M*F,r:F}}function IE(t,e,n){var r,i,o,a,u=t.x-e.x,s=t.y-e.y,l=u*u+s*s;l?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=t.x-r*u-o*s,n.y=t.y-r*s+o*u):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*u-o*s,n.y=e.y+r*s+o*u)):(n.x=e.x+n.r,n.y=e.y)}function WE(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function HE(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function YE(t){this._=t,this.next=null,this.previous=null}function VE(t){if(!(i=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,n,r,i,o,a,u,s,l,c,f;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;IE(n,e,r=t[2]),e=new YE(e),n=new YE(n),r=new YE(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(u=3;u<i;++u){IE(e._,n._,r=t[u]),r=new YE(r),s=n.next,l=e.previous,c=n._.r,f=e._.r;do{if(c<=f){if(WE(s._,r._)){n=s,e.next=n,n.previous=e,--u;continue t}c+=s._.r,s=s.next}else{if(WE(l._,r._)){(e=l).next=n,n.previous=e,--u;continue t}f+=l._.r,l=l.previous}}while(s!==l.next);for(r.previous=e,r.next=n,e.next=n.previous=n=r,o=HE(e);(r=r.next)!==n;)(a=HE(r))<o&&(e=r,o=a);n=e.next}for(e=[n._],r=n;(r=r.next)!==n;)e.push(r._);for(r=OE(e),u=0;u<i;++u)(e=t[u]).x-=r.x,e.y-=r.y;return r.r}function GE(t){return null==t?null:XE(t)}function XE(t){if("function"!=typeof t)throw new Error;return t}function JE(){return 0}function ZE(t){return function(){return t}}function QE(t){return Math.sqrt(t.value)}function KE(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function tD(t,e){return function(n){if(r=n.children){var r,i,o,a=r.length,u=t(n)*e||0;if(u)for(i=0;i<a;++i)r[i].r+=u;if(o=VE(r),u)for(i=0;i<a;++i)r[i].r-=u;n.r=o+u}}}function eD(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function nD(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function rD(t,e,n,r,i){for(var o,a=t.children,u=-1,s=a.length,l=t.value&&(r-e)/t.value;++u<s;)(o=a[u]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*l}NE.prototype=FE.prototype={constructor:NE,count:function(){return this.eachAfter(CE)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],u=[],s=-1;o=a.pop();)if(u.push(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r]);for(;o=u.pop();)t.call(e,o,++s,this);return this},eachBefore:function(t,e){for(var n,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(e,i,++a,this),n=i.children)for(r=n.length-1;r>=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return FE(this).eachBefore(TE)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n])}while(o.length)}};var iD={depth:-1},oD={};function aD(t){return t.id}function uD(t){return t.parentId}function sD(){var t=aD,e=uD;function n(n){var r,i,o,a,u,s,l,c=Array.from(n),f=c.length,h=new Map;for(i=0;i<f;++i)r=c[i],u=c[i]=new NE(r),null!=(s=t(r,i,n))&&(s+="")&&(l=u.id=s,h.set(l,h.has(l)?oD:u)),null!=(s=e(r,i,n))&&(s+="")&&(u.parent=s);for(i=0;i<f;++i)if(s=(u=c[i]).parent){if(!(a=h.get(s)))throw new Error("missing: "+s);if(a===oD)throw new Error("ambiguous: "+s);a.children?a.children.push(u):a.children=[u],u.parent=a}else{if(o)throw new Error("multiple roots");o=u}if(!o)throw new Error("no root");if(o.parent=iD,o.eachBefore((function(t){t.depth=t.parent.depth+1,--f})).eachBefore(zE),o.parent=null,f>0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=XE(e),n):t},n.parentId=function(t){return arguments.length?(e=XE(t),n):e},n}function lD(t,e){return t.parent===e.parent?1:2}function cD(t){var e=t.children;return e?e[0]:t.t}function fD(t){var e=t.children;return e?e[e.length-1]:t.t}function hD(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function dD(t,e,n){return t.a.parent===e.parent?t.a:n}function pD(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function gD(t,e,n,r,i){for(var o,a=t.children,u=-1,s=a.length,l=t.value&&(i-n)/t.value;++u<s;)(o=a[u]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*l}pD.prototype=Object.create(NE.prototype);var mD=(1+Math.sqrt(5))/2;function yD(t,e,n,r,i,o){for(var a,u,s,l,c,f,h,d,p,g,m,y=[],v=e.children,_=0,x=0,b=v.length,w=e.value;_<b;){s=i-n,l=o-r;do{c=v[x++].value}while(!c&&x<b);for(f=h=c,m=c*c*(g=Math.max(l/s,s/l)/(w*t)),p=Math.max(h/m,m/f);x<b;++x){if(c+=u=v[x].value,u<f&&(f=u),u>h&&(h=u),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=u;break}p=d}y.push(a={value:c,dice:s<l,children:v.slice(_,x)}),a.dice?rD(a,n,r,i,w?r+=l*c/w:o):gD(a,n,r,w?n+=s*c/w:i,o),w-=c,_=x}return y}var vD=function t(e){function n(t,n,r,i,o){yD(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(mD);var _D=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,u,s,l,c,f=-1,h=a.length,d=t.value;++f<h;){for(s=(u=a[f]).children,l=u.value=0,c=s.length;l<c;++l)u.value+=s[l].value;u.dice?rD(u,n,r,i,d?r+=(o-r)*u.value/d:o):gD(u,n,r,d?n+=(i-n)*u.value/d:i,o),d-=u.value}else t._squarify=a=yD(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(mD);function xD(t,e,n){const r={};return t.each((t=>{const i=t.data;n(i)&&(r[e(i)]=t)})),t.lookup=r,t}function bD(t){Oa.call(this,null,t)}bD.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const wD=t=>t.values;function kD(){const t=[],e={entries:t=>r(n(t,0),0),key:n=>(t.push(n),e)};function n(e,r){if(r>=t.length)return e;const i=e.length,o=t[r++],a={},u={};let s,l,c,f=-1;for(;++f<i;)s=o(l=e[f])+"",(c=a[s])?c.push(l):a[s]=[l];for(s in a)u[s]=n(a[s],r);return u}function r(e,n){if(++n>t.length)return e;const i=[];for(const t in e)i.push({key:t,values:r(e[t],n)});return i}return e}function AD(t){Oa.call(this,null,t)}st(bD,Oa,{transform(t,e){e.source||s("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),o=this.value;return(!o||r||e.changed())&&(o&&o.each((t=>{t.children&&ea(t.data)&&i.rem.push(t.data)})),this.value=o=FE({values:W(t.keys).reduce(((t,e)=>(t.key(e),t)),kD()).entries(i.source)},wD),n&&o.each((t=>{t.children&&(t=ia(t.data),i.add.push(t),i.source.push(t))})),xD(o,na,na)),i.source.root=o,i}});const MD=(t,e)=>t.parent===e.parent?1:2;st(AD,Oa,{transform(t,e){e.source&&e.source.root||s(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(t.method),r=this.fields,i=e.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(sa(t.sort,(t=>t.data))),function(t,e,n){for(let r,i=0,o=e.length;i<o;++i)r=e[i],r in n&&t[r](n[r])}(n,this.params,t),n.separation&&n.separation(!1!==t.separation?MD:p);try{this.value=n(i)}catch(t){s(t)}return i.each((t=>function(t,e,n){const r=t.data,i=e.length-1;for(let o=0;o<i;++o)r[n[o]]=t[e[o]];r[n[i]]=t.children?t.children.length:0}(t,r,o))),e.reflow(t.modified()).modifies(o).modifies("leaf")}});const ED=["x","y","r","depth","children"];function DD(t){AD.call(this,t)}DD.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:ED.length,default:ED}]},st(DD,AD,{layout:function(){var t=null,e=1,n=1,r=JE;function i(i){return i.x=e/2,i.y=n/2,t?i.eachBefore(KE(t)).eachAfter(tD(r,.5)).eachBefore(eD(1)):i.eachBefore(KE(QE)).eachAfter(tD(JE,1)).eachAfter(tD(r,i.r/Math.min(e,n))).eachBefore(eD(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=GE(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:ZE(+t),i):r},i},params:["radius","size","padding"],fields:ED});const CD=["x0","y0","x1","y1","depth","children"];function FD(t){AD.call(this,t)}function SD(t){Oa.call(this,null,t)}FD.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:CD.length,default:CD}]},st(FD,AD,{layout:function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&rD(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,u=r.y1-n;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(e,o)),r&&i.eachBefore(nD),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},params:["size","round","padding"],fields:CD}),SD.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},st(SD,Oa,{transform(t,e){e.source||s("Stratify transform requires an upstream data source.");let n=this.value;const r=t.modified(),i=e.fork(e.ALL).materialize(e.SOURCE),o=!n||r||e.changed(e.ADD_REM)||e.modified(t.key.fields)||e.modified(t.parentKey.fields);return i.source=i.source.slice(),o&&(n=i.source.length?xD(sD().id(t.key).parentId(t.parentKey)(i.source),t.key,g):xD(sD()([{}]),t.key,t.key)),i.source.root=this.value=n,i}});const BD={tidy:function(){var t=lD,e=1,n=1,r=null;function i(i){var s=function(t){for(var e,n,r,i,o,a=new pD(t,0),u=[a];e=u.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(n=e.children[i]=new pD(r[i],i)),n.parent=e;return(a.parent=new pD(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.x<l.x&&(l=t),t.x>c.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,u=n,s=o.parent.children[0],l=o.m,c=a.m,f=u.m,h=s.m;u=fD(u),o=cD(o),u&&o;)s=cD(s),(a=fD(a)).a=e,(i=u.z+f-o.z-l+t(u._,o._))>0&&(hD(dD(u,e,r),e,i),l+=i,c+=i),f+=u.m,l+=o.m,h+=s.m,c+=a.m;u&&!fD(a)&&(a.t=u,a.m+=f-c),o&&!cD(s)&&(s.t=o,s.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=ME,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(EE,0)/t.length}(n),e.y=function(t){return 1+t.reduce(DE,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)}));var u=function(t){for(var e;e=t.children;)t=e[0];return t}(i),s=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=u.x-t(u,s)/2,c=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},TD=["x","y","depth","children"];function zD(t){AD.call(this,t)}function ND(t){Oa.call(this,[],t)}zD.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:TD.length,default:TD}]},st(zD,AD,{layout(t){const e=t||"tidy";if(it(BD,e))return BD[e]();s("Unrecognized Tree layout method: "+e)},params:["size","nodeSize"],fields:TD}),ND.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},st(ND,Oa,{transform(t,e){const n=this.value,r=e.source&&e.source.root,i=e.fork(e.NO_SOURCE),o={};return r||s("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(i.rem=n,e.visit(e.SOURCE,(t=>o[na(t)]=1)),r.each((t=>{const e=t.data,n=t.parent&&t.parent.data;n&&o[na(e)]&&o[na(n)]&&i.add.push(ia({source:n,target:e}))})),this.value=i.add):e.changed(e.MOD)&&(e.visit(e.MOD,(t=>o[na(t)]=1)),n.forEach((t=>{(o[na(t.source)]||o[na(t.target)])&&i.mod.push(t)}))),i}});const OD={binary:function(t,e,n,r,i){var o,a,u=t.children,s=u.length,l=new Array(s+1);for(l[0]=a=o=0;o<s;++o)l[o+1]=a+=u[o].value;!function t(e,n,r,i,o,a,s){if(e>=n-1){var c=u[e];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=s)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d<p;){var g=d+p>>>1;l[g]<h?d=g+1:p=g}h-l[d-1]<l[d]-h&&e+1<d&&--d;var m=l[d]-f,y=r-m;if(a-i>s-o){var v=r?(i*y+a*m)/r:a;t(e,d,m,i,o,v,s),t(d,n,y,v,o,a,s)}else{var _=r?(o*y+s*m)/r:s;t(e,d,m,i,o,a,_),t(d,n,y,i,_,a,s)}}(0,s,t.value,e,n,r,i)},dice:rD,slice:gD,slicedice:function(t,e,n,r,i){(1&t.depth?gD:rD)(t,e,n,r,i)},squarify:vD,resquarify:_D},RD=["x0","y0","x1","y1","depth","children"];function $D(t){AD.call(this,t)}$D.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:RD.length,default:RD}]},st($D,AD,{layout(){const t=function(){var t=vD,e=!1,n=1,r=1,i=[0],o=JE,a=JE,u=JE,s=JE,l=JE;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(nD),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f<r&&(r=f=(r+f)/2),h<c&&(c=h=(c+h)/2),e.x0=r,e.y0=c,e.x1=f,e.y1=h,e.children&&(n=i[e.depth+1]=o(e)/2,r+=l(e)-n,c+=a(e)-n,(f-=u(e)-n)<r&&(r=f=(r+f)/2),(h-=s(e)-n)<c&&(c=h=(c+h)/2),t(e,r,c,f,h))}return c.round=function(t){return arguments.length?(e=!!t,c):e},c.size=function(t){return arguments.length?(n=+t[0],r=+t[1],c):[n,r]},c.tile=function(e){return arguments.length?(t=XE(e),c):t},c.padding=function(t){return arguments.length?c.paddingInner(t).paddingOuter(t):c.paddingInner()},c.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:ZE(+t),c):o},c.paddingOuter=function(t){return arguments.length?c.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):c.paddingTop()},c.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:ZE(+t),c):a},c.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:ZE(+t),c):u},c.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:ZE(+t),c):s},c.paddingLeft=function(t){return arguments.length?(l="function"==typeof t?t:ZE(+t),c):l},c}();return t.ratio=e=>{const n=t.tile();n.ratio&&t.tile(n.ratio(e))},t.method=e=>{it(OD,e)?t.tile(OD[e]):s("Unrecognized Treemap layout method: "+e)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:RD});var qD=Object.freeze({__proto__:null,nest:bD,pack:DD,partition:FD,stratify:SD,tree:zD,treelinks:ND,treemap:$D});function LD(t,e,n,r){const i=t.width,o=t.height,a=n||r,u=gc(i,o).getContext("2d");e.forEach((t=>UD(u,t,a)));const s=new Uint32Array(u.getImageData(0,0,i,o).data.buffer),l=t.bitmap(),c=a&&t.bitmap();let f,h,d,p,g;for(h=0;h<o;++h)for(f=0;f<i;++f)g=4278190080&s[h*i+f],g&&(d=t(f),p=t(h),r||l.set(d,p),a&&268435456^g&&c.set(d,p));return[l,c]}function UD(t,e,n){if(!e.length)return;const r=e[0].mark.marktype;"group"===r?e.forEach((e=>{e.items.forEach((e=>UD(t,e.items,n)))})):sy[r].draw(t,{items:n?e.map(PD):e})}function PD(t){const e=aa(t,{});return e.stroke&&(e.strokeOpacity=1),e.fill&&(e.fillOpacity=.0625,e.stroke="#000",e.strokeOpacity=1,e.strokeWidth=2),e}const jD=31,ID=new Uint32Array(33),WD=new Uint32Array(33);WD[0]=0,ID[0]=~WD[0];for(let t=1;t<=32;++t)WD[t]=WD[t-1]<<1|1,ID[t]=~WD[t];function HD(t,e,n){const r=Math.max(1,Math.sqrt(t*e/1e6)),i=~~((t+2*n+r)/r),o=~~((e+2*n+r)/r),a=t=>~~((t+n)/r);return a.invert=t=>t*r-n,a.bitmap=()=>function(t,e){const n=new Uint32Array(~~((t*e+32)/32));function r(t,e){n[t]|=e}function i(t,e){n[t]&=e}return{array:n,get:(e,r)=>{const i=r*t+e;return n[i>>>5]&1<<(i&jD)},set:(e,n)=>{const i=n*t+e;r(i>>>5,1<<(i&jD))},clear:(e,n)=>{const r=n*t+e;i(r>>>5,~(1<<(r&jD)))},getRange:(e,r,i,o)=>{let a,u,s,l,c=o;for(;c>=r;--c)if(a=c*t+e,u=c*t+i,s=a>>>5,l=u>>>5,s===l){if(n[s]&ID[a&jD]&WD[1+(u&jD)])return!0}else{if(n[s]&ID[a&jD])return!0;if(n[l]&WD[1+(u&jD)])return!0;for(let t=s+1;t<l;++t)if(n[t])return!0}return!1},setRange:(e,n,i,o)=>{let a,u,s,l,c;for(;n<=o;++n)if(a=n*t+e,u=n*t+i,s=a>>>5,l=u>>>5,s===l)r(s,ID[a&jD]&WD[1+(u&jD)]);else for(r(s,ID[a&jD]),r(l,WD[1+(u&jD)]),c=s+1;c<l;++c)r(c,4294967295)},clearRange:(e,n,r,o)=>{let a,u,s,l,c;for(;n<=o;++n)if(a=n*t+e,u=n*t+r,s=a>>>5,l=u>>>5,s===l)i(s,WD[a&jD]|ID[1+(u&jD)]);else for(i(s,WD[a&jD]),i(l,ID[1+(u&jD)]),c=s+1;c<l;++c)i(c,0)},outOfBounds:(n,r,i,o)=>n<0||r<0||o>=e||i>=t}}(i,o),a.ratio=r,a.padding=n,a.width=t,a.height=e,a}function YD(t,e,n,r,i,o){let a=n/2;return t-a<0||t+a>i||e-(a=r/2)<0||e+a>o}function VD(){return!1}function GD(t,e,n,r,i,o,a,u){const s=i*o/(2*r),l=t(e-s),c=t(e+s),f=t(n-(o/=2)),h=t(n+o);return a.outOfBounds(l,f,c,h)||a.getRange(l,f,c,h)||u&&u.getRange(l,f,c,h)}function XD(t,e,n,r,i,o,a,u){const s=i*o/(2*r);let l=t(e-s),c=t(e+s),f=t(n-(o/=2)),h=t(n+o);return l=l>0?l:0,f=f>0?f:0,c=c<t.width?c:t.width-1,h=h<t.height?h:t.height-1,a.getRange(l,f,c,h)||u&&u.getRange(l,f,c,h)}function JD(t){return t?[XD,VD]:[GD,YD]}const ZD=[-1,-1,1,1],QD=[-1,1,-1,1];const KD=["right","center","left"],tC=["bottom","middle","top"];function eC(t,e,n,r,i,o,a,u,s,l,c,f){return!(i.outOfBounds(t,n,e,r)||(f&&o?o.getRange(t,n,e,r)||!function(t,e,n,r,i){return i[0]<=t&&n<=i[2]&&i[3]<=e&&r<=i[5]}(a,s,u,l,c):i.getRange(t,n,e,r)))}const nC={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},rC={naive:function(t,e,n,r){const i=t.width,o=t.height;return function(t){const e=t.datum.datum.items[r].items,n=e.length,a=t.datum.fontSize,u=jm.width(t.datum,t.datum.text);let s,l,c,f,h,d,p,g=0;for(let r=0;r<n;++r)s=e[r].x,c=e[r].y,l=void 0===e[r].x2?s:e[r].x2,f=void 0===e[r].y2?c:e[r].y2,h=(s+l)/2,d=(c+f)/2,p=Math.abs(l-s+f-c),p>=g&&(g=p,t.x=h,t.y=d);return h=u/2,d=a/2,s=t.x-h,l=t.x+h,c=t.y-d,f=t.y+d,t.align="center",s<0&&l<=i?t.align="left":0<=s&&i<l&&(t.align="right"),t.baseline="middle",c<0&&f<=o?t.baseline="top":0<=c&&o<f&&(t.baseline="bottom"),!0}},"reduced-search":function(t,e,n,r,i){const o=t.width,a=t.height,[u,s]=JD(i),l=e[0],c=e[1];function f(e,n,r,i,f){const h=t.invert(e),d=t.invert(n);let p,g=r,m=a;if(!s(h,d,i,f,o,a)&&!u(t,h,d,f,i,g,l,c)&&!u(t,h,d,f,i,f,l,null)){for(;m-g>=1;)p=(g+m)/2,u(t,h,d,f,i,p,l,c)?m=p:g=p;if(g>r)return[h,d,g,!0]}}return function(e){const i=e.datum.datum.items[r].items,c=i.length,h=e.datum.fontSize,d=jm.width(e.datum,e.datum.text);let p,g,m,y,v,_,x,b,w,k,A,M,E,D,C,F,S,B=n?h:0,T=!1,z=!1,N=0;for(let r=0;r<c;++r){for(p=i[r].x,m=i[r].y,g=void 0===i[r].x2?p:i[r].x2,y=void 0===i[r].y2?m:i[r].y2,p>g&&(S=p,p=g,g=S),m>y&&(S=m,m=y,y=S),w=t(p),A=t(g),k=~~((w+A)/2),M=t(m),D=t(y),E=~~((M+D)/2),x=k;x>=w;--x)for(b=E;b>=M;--b)F=f(x,b,B,d,h),F&&([e.x,e.y,B,T]=F);for(x=k;x<=A;++x)for(b=E;b<=D;++b)F=f(x,b,B,d,h),F&&([e.x,e.y,B,T]=F);T||n||(C=Math.abs(g-p+y-m),v=(p+g)/2,_=(m+y)/2,C>=N&&!s(v,_,d,h,o,a)&&!u(t,v,_,h,d,h,l,null)&&(N=C,e.x=v,e.y=_,z=!0))}return!(!T&&!z)&&(v=d/2,_=h/2,l.setRange(t(e.x-v),t(e.y-_),t(e.x+v),t(e.y+_)),e.align="center",e.baseline="middle",!0)}},floodfill:function(t,e,n,r,i){const o=t.width,a=t.height,[u,s]=JD(i),l=e[0],c=e[1],f=t.bitmap();return function(e){const i=e.datum.datum.items[r].items,h=i.length,d=e.datum.fontSize,p=jm.width(e.datum,e.datum.text),g=[];let m,y,v,_,x,b,w,k,A,M,E,D,C=n?d:0,F=!1,S=!1,B=0;for(let r=0;r<h;++r){for(m=i[r].x,v=i[r].y,y=void 0===i[r].x2?m:i[r].x2,_=void 0===i[r].y2?v:i[r].y2,g.push([t((m+y)/2),t((v+_)/2)]);g.length;)if([w,k]=g.pop(),!(l.get(w,k)||c.get(w,k)||f.get(w,k))){f.set(w,k);for(let t=0;t<4;++t)x=w+ZD[t],b=k+QD[t],f.outOfBounds(x,b,x,b)||g.push([x,b]);if(x=t.invert(w),b=t.invert(k),A=C,M=a,!s(x,b,p,d,o,a)&&!u(t,x,b,d,p,A,l,c)&&!u(t,x,b,d,p,d,l,null)){for(;M-A>=1;)E=(A+M)/2,u(t,x,b,d,p,E,l,c)?M=E:A=E;A>C&&(e.x=x,e.y=b,C=A,F=!0)}}F||n||(D=Math.abs(y-m+_-v),x=(m+y)/2,b=(v+_)/2,D>=B&&!s(x,b,p,d,o,a)&&!u(t,x,b,d,p,d,l,null)&&(B=D,e.x=x,e.y=b,S=!0))}return!(!F&&!S)&&(x=p/2,b=d/2,l.setRange(t(e.x-x),t(e.y-b),t(e.x+x),t(e.y+b)),e.align="center",e.baseline="middle",!0)}}};function iC(t,e,n,r,i,o,a,u,s,l,c){if(!t.length)return t;const f=Math.max(r.length,i.length),h=function(t,e){const n=new Float64Array(e),r=t.length;for(let e=0;e<r;++e)n[e]=t[e]||0;for(let t=r;t<e;++t)n[t]=n[r-1];return n}(r,f),d=function(t,e){const n=new Int8Array(e),r=t.length;for(let e=0;e<r;++e)n[e]|=nC[t[e]];for(let t=r;t<e;++t)n[t]=n[r-1];return n}(i,f),p=(b=t[0].datum)&&b.mark&&b.mark.marktype,g="group"===p&&t[0].datum.items[s].marktype,m="area"===g,y=function(t,e,n,r){const i=t=>[t.x,t.x,t.x,t.y,t.y,t.y];return t?"line"===t||"area"===t?t=>i(t.datum):"line"===e?t=>{const e=t.datum.items[r].items;return i(e.length?e["start"===n?0:e.length-1]:{x:NaN,y:NaN})}:t=>{const e=t.datum.bounds;return[e.x1,(e.x1+e.x2)/2,e.x2,e.y1,(e.y1+e.y2)/2,e.y2]}:i}(p,g,u,s),v=null===l||l===1/0,_=HD(e[0],e[1],v?0:l),x=m&&"naive"===c;var b;const w=t.map((t=>({datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(t)})));let k;if(!x){n&&w.sort(((t,e)=>n(t.datum,e.datum)));let e=!1;for(let t=0;t<d.length&&!e;++t)e=5===d[t]||h[t]<0;p&&(a||m)&&(o=[t.map((t=>t.datum))].concat(o)),k=o.length?LD(_,o,e,m):function(t,e){const n=t.bitmap();return(e||[]).forEach((e=>n.set(t(e.boundary[0]),t(e.boundary[3])))),[n,void 0]}(_,a&&w)}const A=m?rC[c](_,k,a,s,v):function(t,e,n,r,i){const o=t.width,a=t.height,u=e[0],s=e[1],l=r.length;return function(e){const c=e.boundary,f=e.datum.fontSize;if(!i&&(c[2]<0||c[5]<0||c[0]>o||c[3]>a))return!1;let h,d,p,g,m,y,v,_,x,b,w,k,A,M,E,D=0;for(let o=0;o<l;++o){if(h=(3&n[o])-1,d=(n[o]>>>2&3)-1,p=0===h&&0===d||r[o]<0,g=h&&d?Math.SQRT1_2:1,m=r[o]<0?-1:1,y=c[1+h]+r[o]*h*g,w=c[4+d]+m*f*d/2+r[o]*d*g,_=w-f/2,x=w+f/2,k=t(y),M=t(_),E=t(x),i&&(k=k<0?0:k,M=M<0?0:M,E=E>=t.height?t.height-1:E),!D){if(!eC(k,k,M,E,u,s,y,y,_,x,c,p))continue;D=jm.width(e.datum,e.datum.text)}if(b=y+m*D*h/2,y=b-D/2,v=b+D/2,k=t(y),A=t(v),i&&(k=k<0?0:k,A=A>=t.width?t.width-1:A),eC(k,A,M,E,u,s,y,v,_,x,c,p))return e.x=h?h*m<0?v:y:b,e.y=d?d*m<0?x:_:w,e.align=KD[h*m+1],e.baseline=tC[d*m+1],u.setRange(k,M,A,E),!0}return!1}}(_,k,d,h,v);return w.forEach((t=>t.opacity=+A(t))),w}const oC=["x","y","opacity","align","baseline"],aC=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function uC(t){Oa.call(this,null,t)}uC.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:aC},{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:oC.length,default:oC}]},st(uC,Oa,{transform(t,e){const n=t.modified();if(!(n||e.changed(e.ADD_REM)||function(n){const r=t[n];return Y(r)&&e.modified(r.fields)}("sort")))return;t.size&&2===t.size.length||s("Size parameter should be specified as a [width, height] array.");const r=t.as||oC;return iC(e.materialize(e.SOURCE).source||[],t.size,t.sort,W(null==t.offset?1:t.offset),W(t.anchor||aC),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const e=t.datum;e[r[0]]=t.x,e[r[1]]=t.y,e[r[2]]=t.opacity,e[r[3]]=t.align,e[r[4]]=t.baseline})),e.reflow(n).modifies(r)}});var sC=Object.freeze({__proto__:null,label:uC});function lC(t,e){var n,r,i,o,a,u,s=[],l=function(t){return t(o)};if(null==e)s.push(t);else for(n={},r=0,i=t.length;r<i;++r)o=t[r],(u=n[a=e.map(l)])||(n[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}function cC(t){Oa.call(this,null,t)}cC.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}]},st(cC,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const i=lC(e.materialize(e.SOURCE).source,t.groupby),o=(t.groupby||[]).map(r),a=o.length,u=t.as||[r(t.x),r(t.y)],s=[];i.forEach((e=>{ku(e,t.x,t.y,t.bandwidth||.3).forEach((t=>{const n={};for(let t=0;t<a;++t)n[o[t]]=e.dims[t];n[u[0]]=t[0],n[u[1]]=t[1],s.push(ia(n))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=s}return n}});const fC={linear:mu,log:yu,exp:vu,pow:_u,quad:xu,poly:bu};function hC(t){Oa.call(this,null,t)}hC.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(fC)},{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}]},st(hC,Oa,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const i=lC(e.materialize(e.SOURCE).source,t.groupby),o=(t.groupby||[]).map(r),a=t.method||"linear",u=t.order||3,l=((t,e)=>"poly"===t?e:"quad"===t?2:1)(a,u),c=t.as||[r(t.x),r(t.y)],f=fC[a],h=[];let d=t.extent;it(fC,a)||s("Invalid regression method: "+a),null!=d&&"log"===a&&d[0]<=0&&(e.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach((n=>{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,u);if(t.params)return void h.push(ia({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||et(n,t.x),s=t=>{const e={};for(let t=0;t<o.length;++t)e[o[t]]=n.dims[t];e[c[0]]=t[0],e[c[1]]=t[1],h.push(ia(e))};"linear"===a?i.forEach((t=>s([t,r.predict(t)]))):Du(r.predict,i,25,200).forEach(s)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=h}return n}});var dC=Object.freeze({__proto__:null,loess:cC,regression:hC});const pC=Math.pow(2,-52),gC=new Uint32Array(512);class mC{static from(t,e=AC,n=MC){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=e(r),i[2*o+1]=n(r)}return new mC(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,s=-1/0,l=-1/0;for(let e=0;e<o;e++){const n=t[2*e],r=t[2*e+1];n<a&&(a=n),r<u&&(u=r),n>s&&(s=n),r>l&&(l=r),this._ids[e]=e}const c=(a+s)/2,f=(u+l)/2;let h,d,p,g=1/0;for(let e=0;e<o;e++){const n=yC(c,f,t[2*e],t[2*e+1]);n<g&&(h=e,g=n)}const m=t[2*h],y=t[2*h+1];g=1/0;for(let e=0;e<o;e++){if(e===h)continue;const n=yC(m,y,t[2*e],t[2*e+1]);n<g&&n>0&&(d=e,g=n)}let v=t[2*d],_=t[2*d+1],x=1/0;for(let e=0;e<o;e++){if(e===h||e===d)continue;const n=bC(m,y,v,_,t[2*e],t[2*e+1]);n<x&&(p=e,x=n)}let b=t[2*p],w=t[2*p+1];if(x===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];wC(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t];this._dists[i]>r&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(_C(m,y,v,_,b,w)){const t=d,e=v,n=_;d=p,v=b,_=w,p=t,b=e,w=n}const k=function(t,e,n,r,i,o){const a=n-t,u=r-e,s=i-t,l=o-e,c=a*a+u*u,f=s*s+l*l,h=.5/(a*l-u*s);return{x:t+(l*c-u*f)*h,y:e+(a*f-s*c)*h}}(m,y,v,_,b,w);this._cx=k.x,this._cy=k.y;for(let e=0;e<o;e++)this._dists[e]=yC(t[2*e],t[2*e+1],k.x,k.y);wC(this._ids,this._dists,0,o-1),this._hullStart=h;let A=3;n[h]=e[p]=d,n[d]=e[h]=p,n[p]=e[d]=h,r[h]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(m,y)]=h,i[this._hashKey(v,_)]=d,i[this._hashKey(b,w)]=p,this.trianglesLen=0,this._addTriangle(h,d,p,-1,-1,-1);for(let o,a,u=0;u<this._ids.length;u++){const s=this._ids[u],l=t[2*s],c=t[2*s+1];if(u>0&&Math.abs(l-o)<=pC&&Math.abs(c-a)<=pC)continue;if(o=l,a=c,s===h||s===d||s===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t<this._hashSize&&(f=i[(e+t)%this._hashSize],-1===f||f===n[f]);t++);f=e[f];let g,m=f;for(;g=n[m],!_C(l,c,t[2*m],t[2*m+1],t[2*g],t[2*g+1]);)if(m=g,m===f){m=-1;break}if(-1===m)continue;let y=this._addTriangle(m,s,n[m],-1,-1,r[m]);r[s]=this._legalize(y+2),r[m]=y,A++;let v=n[m];for(;g=n[v],_C(l,c,t[2*v],t[2*v+1],t[2*g],t[2*g+1]);)y=this._addTriangle(v,s,g,r[s],-1,r[v]),r[s]=this._legalize(y+2),n[v]=v,A--,v=g;if(m===f)for(;g=e[m],_C(l,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1]);)y=this._addTriangle(g,s,m,-1,r[m],r[g]),this._legalize(y+2),r[g]=y,n[m]=m,A--,m=g;this._hullStart=e[s]=m,n[m]=e[v]=s,n[s]=v,i[this._hashKey(l,c)]=s,i[this._hashKey(t[2*m],t[2*m+1])]=m}this.hull=new Uint32Array(A);for(let t=0,e=this._hullStart;t<A;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=gC[--i];continue}const s=a-a%3,l=u+(t+1)%3,c=s+(a+2)%3,f=e[o],h=e[t],d=e[l],p=e[c];if(xC(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,c);const u=s+(a+1)%3;i<gC.length&&(gC[i++]=u)}else{if(0===i)break;t=gC[--i]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=e,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function yC(t,e,n,r){const i=t-n,o=e-r;return i*i+o*o}function vC(t,e,n,r,i,o){const a=(r-e)*(i-t),u=(n-t)*(o-e);return Math.abs(a-u)>=33306690738754716e-32*Math.abs(a+u)?a-u:0}function _C(t,e,n,r,i,o){return(vC(i,o,t,e,n,r)||vC(t,e,n,r,i,o)||vC(n,r,i,o,t,e))<0}function xC(t,e,n,r,i,o,a,u){const s=t-a,l=e-u,c=n-a,f=r-u,h=i-a,d=o-u,p=c*c+f*f,g=h*h+d*d;return s*(f*g-p*d)-l*(c*g-p*h)+(s*s+l*l)*(c*d-f*h)<0}function bC(t,e,n,r,i,o){const a=n-t,u=r-e,s=i-t,l=o-e,c=a*a+u*u,f=s*s+l*l,h=.5/(a*l-u*s),d=(l*c-u*f)*h,p=(a*f-s*c)*h;return d*d+p*p}function wC(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;kC(t,n+r>>1,i),e[t[n]]>e[t[r]]&&kC(t,n,r),e[t[i]]>e[t[r]]&&kC(t,i,r),e[t[n]]>e[t[i]]&&kC(t,n,i);const a=t[i],u=e[a];for(;;){do{i++}while(e[t[i]]<u);do{o--}while(e[t[o]]>u);if(o<i)break;kC(t,i,o)}t[n+1]=t[o],t[o]=a,r-i+1>=o-n?(wC(t,e,i,r),wC(t,e,n,o-1)):(wC(t,e,n,o-1),wC(t,e,i,r))}}function kC(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function AC(t){return t[0]}function MC(t){return t[1]}const EC=1e-6;class DC{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>EC||Math.abs(this._y1-i)>EC)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class CC{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class FC{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,o=0,a=0,u=n.length;o<u;o+=3,a+=2){const u=2*n[o],s=2*n[o+1],l=2*n[o+2],c=t[u],f=t[u+1],h=t[s],d=t[s+1],p=t[l],g=t[l+1],m=h-c,y=d-f,v=p-c,_=g-f,x=m*m+y*y,b=v*v+_*_,w=2*(m*_-y*v);if(w)if(Math.abs(w)<1e-8)e=(c+p)/2,r=(f+g)/2;else{const t=1/w;e=c+(_*x-y*b)*t,r=f+(m*b-v*x)*t}else e=(c+p)/2-1e8*_,r=(f+g)/2+1e8*v;i[a]=e,i[a+1]=r}let o,a,u,s=e[e.length-1],l=4*s,c=t[2*s],f=t[2*s+1];r.fill(0);for(let n=0;n<e.length;++n)s=e[n],o=l,a=c,u=f,l=4*s,c=t[2*s],f=t[2*s+1],r[o+2]=r[l]=u-f,r[o+3]=r[l+1]=c-a}render(t){const e=null==t?t=new DC:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),a=2*Math.floor(r/3),u=o[i],s=o[i+1],l=o[a],c=o[a+1];this._renderSegment(u,s,l,c,t)}let u,s=i[i.length-1];for(let e=0;e<i.length;++e){u=s,s=i[e];const n=2*Math.floor(r[s]/3),l=o[n],c=o[n+1],f=4*u,h=this._project(l,c,a[f+2],a[f+3]);h&&this._renderSegment(l,c,h[0],h[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new DC:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new DC:void 0,r=this._clip(t);if(null===r||!r.length)return;e.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(t.index=e,yield t)}}cellPolygon(t){const e=new CC;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let o;const a=this._regioncode(t,e),u=this._regioncode(n,r);0===a&&0===u?(i.moveTo(t,e),i.lineTo(n,r)):(o=this._clipSegment(t,e,n,r,a,u))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(e[r]==t[o]&&e[r+1]==t[o+1]&&e[(r+2)%i]==t[(o+a-2)%a]&&e[(r+3)%i]==t[(o+a-1)%a]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,o=n[t];if(-1===o)return null;const a=[];let u=o;do{const n=Math.floor(u/3);if(a.push(e[2*n],e[2*n+1]),u=u%3==2?u-2:u+1,i[u]!==t)break;u=r[u]}while(u!==o&&-1!==u);return a}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e)}_clipFinite(t,e){const n=e.length;let r,i,o,a,u,s=null,l=e[n-2],c=e[n-1],f=this._regioncode(l,c);for(let h=0;h<n;h+=2)if(r=l,i=c,l=e[h],c=e[h+1],o=f,f=this._regioncode(l,c),0===o&&0===f)a=u,u=0,s?s.push(l,c):s=[l,c];else{let e,n,h,d,p;if(0===o){if(null===(e=this._clipSegment(r,i,l,c,o,f)))continue;[n,h,d,p]=e}else{if(null===(e=this._clipSegment(l,c,r,i,f,o)))continue;[d,p,n,h]=e,a=u,u=this._edgecode(n,h),a&&u&&this._edge(t,a,u,s,s.length),s?s.push(n,h):s=[n,h]}a=u,u=this._edgecode(d,p),a&&u&&this._edge(t,a,u,s,s.length),s?s.push(d,p):s=[d,p]}if(s)a=u,u=this._edgecode(s[0],s[1]),a&&u&&this._edge(t,a,u,s,s.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(t,e,n,r,i,o){for(;;){if(0===i&&0===o)return[t,e,n,r];if(i&o)return null;let a,u,s=i||o;8&s?(a=t+(n-t)*(this.ymax-e)/(r-e),u=this.ymax):4&s?(a=t+(n-t)*(this.ymin-e)/(r-e),u=this.ymin):2&s?(u=e+(r-e)*(this.xmax-t)/(n-t),a=this.xmax):(u=e+(r-e)*(this.xmin-t)/(n-t),a=this.xmin),i?(t=a,e=u,i=this._regioncode(t,e)):(n=a,r=u,o=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,o){let a,u=Array.from(e);if((a=this._project(u[0],u[1],n,r))&&u.unshift(a[0],a[1]),(a=this._project(u[u.length-2],u[u.length-1],i,o))&&u.push(a[0],a[1]),u=this._clipFinite(t,u))for(let e,n=0,r=u.length,i=this._edgecode(u[r-2],u[r-1]);n<r;n+=2)e=i,i=this._edgecode(u[n],u[n+1]),e&&i&&(n=this._edge(t,e,i,u,n),r=u.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(u=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return u}_edge(t,e,n,r,i){for(;e!==n;){let n,o;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,o=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,o=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,o=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,o=this.ymin}r[i]===n&&r[i+1]===o||!this.contains(t,n,o)||(r.splice(i,0,n,o),i+=2)}if(r.length>4)for(let t=0;t<r.length;t+=2){const e=(t+2)%r.length,n=(t+4)%r.length;(r[t]===r[e]&&r[e]===r[n]||r[t+1]===r[e+1]&&r[e+1]===r[n+1])&&(r.splice(e,2),t-=2)}return i}_project(t,e,n,r){let i,o,a,u=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<u&&(a=this.ymin,o=t+(u=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<u&&(a=this.ymax,o=t+(u=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<u&&(o=this.xmax,a=e+(u=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<u&&(o=this.xmin,a=e+(u=i)*r)}return[o,a]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}}const SC=2*Math.PI,BC=Math.pow;function TC(t){return t[0]}function zC(t){return t[1]}function NC(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class OC{static from(t,e=TC,n=zC,r){return new OC("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=e.call(r,i,a,t),o[2*a+1]=n.call(r,i,a,t)}return o}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const o of t)yield e.call(r,o,i,t),yield n.call(r,o,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new mC(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],o=2*e[t+2];if((n[o]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[o+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t<n;++t){const n=NC(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new mC(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==o[e]||(o[e]=t)}for(let t=0,e=r.length;t<e;++t)a[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],o[r[0]]=1,2===r.length&&(o[r[1]]=0))}voronoi(t){return new FC(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e<a.length-1&&(yield a[e+1]))}const u=e[t];if(-1===u)return;let s=u,l=-1;do{if(yield l=o[s],s=s%3==2?s-2:s+1,o[s]!==t)return;if(s=i[s],-1===s){const e=n[(r[t]+1)%n.length];return void(e!==l&&(yield e))}}while(s!==u)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=BC(e-s[2*t],2)+BC(n-s[2*t+1],2);const f=r[t];let h=f;do{let r=u[h];const f=BC(e-s[2*r],2)+BC(n-s[2*r+1],2);if(f<c&&(c=f,l=r),h=h%3==2?h-2:h+1,u[h]!==t)break;if(h=a[h],-1===h){if(h=i[(o[t]+1)%i.length],h!==r&&BC(e-s[2*h],2)+BC(n-s[2*h+1],2)<c)return h;break}}while(h!==f);return l}render(t){const e=null==t?t=new DC:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,o=r.length;e<o;++e){const o=r[e];if(o<e)continue;const a=2*i[e],u=2*i[o];t.moveTo(n[a],n[a+1]),t.lineTo(n[u],n[u+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e=2){const n=null==t?t=new DC:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],o=r[n+1];t.moveTo(i+e,o),t.arc(i,o,e,0,SC)}return n&&n.value()}renderHull(t){const e=null==t?t=new DC:void 0,{hull:n,points:r}=this,i=2*n[0],o=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<o;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new CC;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new DC:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],u=2*i[t+2];return e.moveTo(r[o],r[o+1]),e.lineTo(r[a],r[a+1]),e.lineTo(r[u],r[u+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new CC;return this.renderTriangle(t,e),e.value()}}function RC(t){Oa.call(this,null,t)}RC.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 $C=[-1e5,-1e5,1e5,1e5];function qC(t){const e=t[0][0],n=t[0][1];let r=t.length-1;for(;t[r][0]===e&&t[r][1]===n;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}st(RC,Oa,{transform(t,e){const n=t.as||"path",r=e.source;if(!r||!r.length)return e;let i=t.size;i=i?[0,0,i[0],i[1]]:(i=t.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:$C;const o=this.value=OC.from(r,t.x,t.y).voronoi(i);for(let t=0,e=r.length;t<e;++t){const e=o.cellPolygon(t);r[t][n]=e?qC(e):null}return e.reflow(t.modified()).modifies(n)}});var LC=Object.freeze({__proto__:null,voronoi:RC}),UC=Math.PI/180,PC=2048;function jC(){var t,e,n,r,i,o,a,u=[256,256],s=VC,l=[],c=Math.random,f={};function h(t,e,n){for(var r,i,o,a=e.x,l=e.y,f=Math.sqrt(u[0]*u[0]+u[1]*u[1]),h=s(u),d=c()<.5?1:-1,p=-d;(r=h(p+=d))&&(i=~~r[0],o=~~r[1],!(Math.min(Math.abs(i),Math.abs(o))>=f));)if(e.x=a+i,e.y=l+o,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>u[0]||e.y+e.y1>u[1])&&(!n||!WC(e,t,u[0]))&&(!n||YC(e,n))){for(var g,m=e.sprite,y=e.width>>5,v=u[0]>>5,_=e.x-(y<<4),x=127&_,b=32-x,w=e.y1-e.y0,k=(e.y+e.y0)*v+(_>>5),A=0;A<w;A++){g=0;for(var M=0;M<=y;M++)t[k+M]|=g<<b|(M<y?(g=m[A*y+M])>>>x:0);k+=v}return e.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=PC/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(gc()),f=function(t){var e=[],n=-1;for(;++n<t;)e[n]=0;return e}((u[0]>>5)*u[1]),d=null,p=l.length,g=-1,m=[],y=l.map((u=>({text:t(u),font:e(u),style:r(u),weight:i(u),rotate:o(u),size:~~(n(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}))).sort(((t,e)=>e.size-t.size));++g<p;){var v=y[g];v.x=u[0]*(c()+.5)>>1,v.y=u[1]*(c()+.5)>>1,IC(s,v,y,g),v.hasText&&h(f,v,d)&&(m.push(v),d?HC(d,v):d=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=u[0]>>1,v.y-=u[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(u=[+t[0],+t[1]],f):u},f.font=function(t){return arguments.length?(e=GC(t),f):e},f.fontStyle=function(t){return arguments.length?(r=GC(t),f):r},f.fontWeight=function(t){return arguments.length?(i=GC(t),f):i},f.rotate=function(t){return arguments.length?(o=GC(t),f):o},f.text=function(e){return arguments.length?(t=GC(e),f):t},f.spiral=function(t){return arguments.length?(s=XC[t]||t,f):s},f.fontSize=function(t){return arguments.length?(n=GC(t),f):n},f.padding=function(t){return arguments.length?(a=GC(t),f):a},f.random=function(t){return arguments.length?(c=t,f):c},f}function IC(t,e,n,r){if(!e.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,2048/o,PC/o);var a,u,s,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r<p;){if(e=n[r],i.save(),i.font=e.style+" "+e.weight+" "+~~((e.size+1)/o)+"px "+e.font,a=i.measureText(e.text+"m").width*o,s=e.size<<1,e.rotate){var g=Math.sin(e.rotate*UC),m=Math.cos(e.rotate*UC),y=a*m,v=a*g,_=s*m,x=s*g;a=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,s=~~Math.max(Math.abs(v+_),Math.abs(v-_))}else a=a+31>>5<<5;if(s>d&&(d=s),f+a>=2048&&(f=0,h+=d,d=0),h+s>=PC)break;i.translate((f+(a>>1))/o,(h+(s>>1))/o),e.rotate&&i.rotate(e.rotate*UC),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=a,e.height=s,e.xoff=f,e.yoff=h,e.x1=a>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=a}for(var b=i.getImageData(0,0,2048/o,PC/o).data,w=[];--r>=0;)if((e=n[r]).hasText){for(u=(a=e.width)>>5,s=e.y1-e.y0,l=0;l<s*u;l++)w[l]=0;if(null==(f=e.xoff))return;h=e.yoff;var k=0,A=-1;for(c=0;c<s;c++){for(l=0;l<a;l++){var M=u*c+(l>>5),E=b[2048*(h+c)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,k|=E}k?A=c:(e.y0++,s--,c--,h++)}e.y1=e.y0+A,e.sprite=w.slice(0,(e.y1-e.y0)*u)}}}function WC(t,e,n){n>>=5;for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),u=127&a,s=32-u,l=t.y1-t.y0,c=(t.y+t.y0)*n+(a>>5),f=0;f<l;f++){r=0;for(var h=0;h<=o;h++)if((r<<s|(h<o?(r=i[f*o+h])>>>u:0))&e[c+h])return!0;c+=n}return!1}function HC(t,e){var n=t[0],r=t[1];e.x+e.x0<n.x&&(n.x=e.x+e.x0),e.y+e.y0<n.y&&(n.y=e.y+e.y0),e.x+e.x1>r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function YC(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>e[0].y&&t.y+t.y0<e[1].y}function VC(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function GC(t){return"function"==typeof t?t:function(){return t}}var XC={archimedean:VC,rectangular:function(t){var e=4*t[0]/t[1],n=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:n+=e;break;case 1:r+=4;break;case 2:n-=e;break;default:r-=4}return[n,r]}}};const JC=["x","y","font","fontSize","fontStyle","fontWeight","angle"],ZC=["text","font","rotate","fontSize","fontStyle","fontWeight"];function QC(t){Oa.call(this,jC(),t)}QC.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:JC}]},st(QC,Oa,{transform(e,n){!e.size||e.size[0]&&e.size[1]||s("Wordcloud size dimensions must be non-zero.");const r=e.modified();if(!(r||n.changed(n.ADD_REM)||ZC.some((function(t){const r=e[t];return Y(r)&&n.modified(r.fields)}))))return;const i=n.materialize(n.SOURCE).source,o=this.value,a=e.as||JC;let u,l=e.fontSize||14;if(Y(l)?u=e.fontSizeRange:l=Q(l),u){const t=l,e=Cd("sqrt")().domain(et(i,t)).range(u);l=n=>e(t(n))}i.forEach((t=>{t[a[0]]=NaN,t[a[1]]=NaN,t[a[3]]=0}));const c=o.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(t.random).layout(),f=o.size(),h=f[0]>>1,d=f[1]>>1,p=c.length;for(let t,e,n=0;n<p;++n)t=c[n],e=t.datum,e[a[0]]=t.x+h,e[a[1]]=t.y+d,e[a[2]]=t.font,e[a[3]]=t.size,e[a[4]]=t.style,e[a[5]]=t.weight,e[a[6]]=t.rotate;return n.reflow(r).modifies(a)}});var KC=Object.freeze({__proto__:null,wordcloud:QC});const tF=t=>new Uint8Array(t),eF=t=>new Uint16Array(t),nF=t=>new Uint32Array(t);function rF(t,e,n){const r=(e<257?tF:e<65537?eF:nF)(t);return n&&r.set(n),r}function iF(t,e,n){const r=1<<e;return{one:r,zero:~r,range:n.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd(t,e){const n=this,i=n.bisect(n.range,t.value),o=t.index,a=i[0],u=i[1],s=o.length;let l;for(l=0;l<a;++l)e[o[l]]|=r;for(l=u;l<s;++l)e[o[l]]|=r;return n}}}function oF(){let t=nF(0),e=[],n=0;return{insert:function(r,i,o){if(!i.length)return[];const a=n,u=i.length,s=nF(u);let l,c,f,h=Array(u);for(f=0;f<u;++f)h[f]=r(i[f]),s[f]=f;if(h=function(t,e){return t.sort.call(e,((e,n)=>{const r=t[e],i=t[n];return r<i?-1:r>i?1:0})),function(t,e){return Array.from(e,(e=>t[e]))}(t,e)}(h,s),a)l=e,c=t,e=Array(a+u),t=nF(a+u),function(t,e,n,r,i,o,a,u,s){let l,c=0,f=0;for(l=0;c<r&&f<a;++l)e[c]<i[f]?(u[l]=e[c],s[l]=n[c++]):(u[l]=i[f],s[l]=o[f++]+t);for(;c<r;++c,++l)u[l]=e[c],s[l]=n[c];for(;f<a;++f,++l)u[l]=i[f],s[l]=o[f]+t}(o,l,c,a,h,s,u,e,t);else{if(o>0)for(f=0;f<u;++f)s[f]+=o;e=h,t=s}return n=a+u,{index:s,value:h}},remove:function(r,i){const o=n;let a,u,s;for(u=0;!i[t[u]]&&u<o;++u);for(s=u;u<o;++u)i[a=t[u]]||(t[s]=a,e[s]=e[u],++s);n=o-r},bisect:function(t,r){let i;return r?i=r.length:(r=e,i=n),[Zt(r,t[0],0,i),Jt(r,t[1],0,i)]},reindex:function(e){for(let r=0,i=n;r<i;++r)t[r]=e[t[r]]},index:()=>t,size:()=>n}}function aF(t){Oa.call(this,function(){let t=8,e=[],n=nF(0),r=rF(0,t),i=rF(0,t);return{data:()=>e,seen:()=>n=function(t,e,n){return t.length>=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length),add(t){for(let n,r=0,i=e.length,o=t.length;r<o;++r)n=t[r],n._index=i++,e.push(n)},remove(t,n){const o=e.length,a=Array(o-t),u=e;let s,l,c;for(l=0;!n[l]&&l<o;++l)a[l]=e[l],u[l]=l;for(c=l;l<o;++l)s=e[l],n[l]?u[l]=-1:(u[l]=c,r[c]=r[l],i[c]=i[l],a[c]=s,s._index=c++),r[l]=0;return e=a,u},size:()=>e.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,e){r[t]|=e},clear(t,e){r[t]&=~e},resize(e,n){(e>r.length||n>t)&&(t=Math.max(n,t),r=rF(e,t,r),i=rF(e,t))}}}(),t),this._indices=null,this._dims=null}function uF(t){Oa.call(this,null,t)}aF.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}}]},st(aF,Oa,{transform(t,e){return this._dims?t.modified("fields")||t.fields.some((t=>e.modified(t.fields)))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},init(t,e){const n=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let u,s,l=0;for(;l<a;++l)u=n[l].fname,s=i[u]||(i[u]=oF()),o.push(iF(s,l,r[l]));return this.eval(t,e)},reinit(t,e){const n=e.materialize().fork(),r=t.fields,i=t.query,o=this._indices,a=this._dims,u=this.value,s=u.curr(),l=u.prev(),c=u.all(),f=n.rem=n.add,h=n.mod,d=i.length,p={};let g,m,y,v,_,x,b,w,k;if(l.set(s),e.rem.length&&(_=this.remove(t,e,n)),e.add.length&&u.add(e.add),e.mod.length)for(x={},v=e.mod,b=0,w=v.length;b<w;++b)x[v[b]._index]=1;for(b=0;b<d;++b)k=r[b],(!a[b]||t.modified("fields",b)||e.modified(k.fields))&&(y=k.fname,(g=p[y])||(o[y]=m=oF(),p[y]=g=m.insert(k,e.source,0)),a[b]=iF(m,b,i[b]).onAdd(g,s));for(b=0,w=u.data().length;b<w;++b)_[b]||(l[b]!==s[b]?f.push(b):x[b]&&s[b]!==c&&h.push(b));return u.mask=(1<<d)-1,n},eval(t,e){const n=e.materialize().fork(),r=this._dims.length;let i=0;return e.rem.length&&(this.remove(t,e,n),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,e,n)),e.add.length&&(this.insert(t,e,n),i|=(1<<r)-1),e.mod.length&&(this.modify(e,n),i|=(1<<r)-1),this.value.mask=i,n},insert(t,e,n){const r=e.add,i=this.value,o=this._dims,a=this._indices,u=t.fields,s={},l=n.add,c=i.size()+r.length,f=o.length;let h,d,p,g=i.size();i.resize(c,f),i.add(r);const m=i.curr(),y=i.prev(),v=i.all();for(h=0;h<f;++h)d=u[h].fname,p=s[d]||(s[d]=a[d].insert(u[h],r,g)),o[h].onAdd(p,m);for(;g<c;++g)y[g]=v,m[g]!==v&&l.push(g)},modify(t,e){const n=e.mod,r=this.value,i=r.curr(),o=r.all(),a=t.mod;let u,s,l;for(u=0,s=a.length;u<s;++u)l=a[u]._index,i[l]!==o&&n.push(l)},remove(t,e,n){const r=this._indices,i=this.value,o=i.curr(),a=i.prev(),u=i.all(),s={},l=n.rem,c=e.rem;let f,h,d,p;for(f=0,h=c.length;f<h;++f)d=c[f]._index,s[d]=1,a[d]=p=o[d],o[d]=u,p!==u&&l.push(d);for(d in r)r[d].remove(h,s);return this.reindex(e,h,s),s},reindex(t,e,n){const r=this._indices,i=this.value;t.runAfter((()=>{const t=i.remove(e,n);for(const e in r)r[e].reindex(t)}))},update(t,e,n){const r=this._dims,i=t.query,o=e.stamp,a=r.length;let u,s,l=0;for(n.filters=0,s=0;s<a;++s)t.modified("query",s)&&(u=s,++l);if(1===l)l=r[u].one,this.incrementOne(r[u],i[u],n.add,n.rem);else for(s=0,l=0;s<a;++s)t.modified("query",s)&&(l|=r[s].one,this.incrementAll(r[s],i[s],o,n.add),n.rem=n.add);return l},incrementAll(t,e,n,r){const i=this.value,o=i.seen(),a=i.curr(),u=i.prev(),s=t.index(),l=t.bisect(t.range),c=t.bisect(e),f=c[0],h=c[1],d=l[0],p=l[1],g=t.one;let m,y,v;if(f<d)for(m=f,y=Math.min(d,h);m<y;++m)v=s[m],o[v]!==n&&(u[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;else if(f>d)for(m=d,y=Math.min(f,p);m<y;++m)v=s[m],o[v]!==n&&(u[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;if(h>p)for(m=Math.max(f,p),y=h;m<y;++m)v=s[m],o[v]!==n&&(u[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;else if(h<p)for(m=Math.max(d,h),y=p;m<y;++m)v=s[m],o[v]!==n&&(u[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;t.range=e.slice()},incrementOne(t,e,n,r){const i=this.value.curr(),o=t.index(),a=t.bisect(t.range),u=t.bisect(e),s=u[0],l=u[1],c=a[0],f=a[1],h=t.one;let d,p,g;if(s<c)for(d=s,p=Math.min(c,l);d<p;++d)g=o[d],i[g]^=h,n.push(g);else if(s>c)for(d=c,p=Math.min(s,f);d<p;++d)g=o[d],i[g]^=h,r.push(g);if(l>f)for(d=Math.max(s,f),p=l;d<p;++d)g=o[d],i[g]^=h,n.push(g);else if(l<f)for(d=Math.max(c,l),p=f;d<p;++d)g=o[d],i[g]^=h,r.push(g);t.range=e.slice()}}),uF.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."}]},st(uF,Oa,{transform(t,e){const n=~(t.ignore||0),r=t.filter,i=r.mask;if(0==(i&n))return e.StopPropagation;const o=e.fork(e.ALL),a=r.data(),u=r.curr(),s=r.prev(),l=t=>u[t]&n?null:a[t];return o.filter(o.MOD,l),i&i-1?(o.filter(o.ADD,(t=>{const e=u[t]&n;return!e&&e^s[t]&n?a[t]:null})),o.filter(o.REM,(t=>{const e=u[t]&n;return e&&!(e^e^s[t]&n)?a[t]:null}))):(o.filter(o.ADD,l),o.filter(o.REM,(t=>(u[t]&n)===i?a[t]:null))),o.filter(o.SOURCE,(t=>l(t._index)))}});var sF=Object.freeze({__proto__:null,crossfilter:aF,resolvefilter:uF});const lF="Literal",cF="Property",fF="ArrayExpression",hF="BinaryExpression",dF="CallExpression",pF="ConditionalExpression",gF="LogicalExpression",mF="MemberExpression",yF="ObjectExpression",vF="UnaryExpression";function _F(t){this.type=t}var xF,bF,wF,kF,AF;_F.prototype.visit=function(t){let e,n,r;if(t(this))return 1;for(e=function(t){switch(t.type){case fF:return t.elements;case hF:case gF:return[t.left,t.right];case dF:return[t.callee].concat(t.arguments);case pF:return[t.test,t.consequent,t.alternate];case mF:return[t.object,t.property];case yF:return t.properties;case cF:return[t.key,t.value];case vF:return[t.argument];default:return[]}}(this),n=0,r=e.length;n<r;++n)if(e[n].visit(t))return 1};(xF={})[1]="Boolean",xF[2]="<end>",xF[3]="Identifier",xF[4]="Keyword",xF[5]="Null",xF[6]="Numeric",xF[7]="Punctuator",xF[8]="String",xF[9]="RegularExpression";var MF="Identifier",EF="Unexpected token %0",DF="Invalid regular expression",CF="Invalid regular expression: missing /",FF="Octal literals are not allowed in strict mode.",SF="ILLEGAL",BF="Disabled.",TF=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]"),zF=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 NF(t,e){if(!t)throw new Error("ASSERT: "+e)}function OF(t){return t>=48&&t<=57}function RF(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function $F(t){return"01234567".indexOf(t)>=0}function qF(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function LF(t){return 10===t||13===t||8232===t||8233===t}function UF(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&TF.test(String.fromCharCode(t))}function PF(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&zF.test(String.fromCharCode(t))}const jF={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 IF(){for(;wF<kF;){const t=bF.charCodeAt(wF);if(!qF(t)&&!LF(t))break;++wF}}function WF(t){var e,n,r,i=0;for(n="u"===t?4:2,e=0;e<n;++e)wF<kF&&RF(bF[wF])?(r=bF[wF++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):aS({},EF,SF);return String.fromCharCode(i)}function HF(){var t,e,n,r;for(e=0,"}"===(t=bF[wF])&&aS({},EF,SF);wF<kF&&RF(t=bF[wF++]);)e=16*e+"0123456789abcdef".indexOf(t.toLowerCase());return(e>1114111||"}"!==t)&&aS({},EF,SF),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function YF(){var t,e;for(t=bF.charCodeAt(wF++),e=String.fromCharCode(t),92===t&&(117!==bF.charCodeAt(wF)&&aS({},EF,SF),++wF,(t=WF("u"))&&"\\"!==t&&UF(t.charCodeAt(0))||aS({},EF,SF),e=t);wF<kF&&PF(t=bF.charCodeAt(wF));)++wF,e+=String.fromCharCode(t),92===t&&(e=e.substr(0,e.length-1),117!==bF.charCodeAt(wF)&&aS({},EF,SF),++wF,(t=WF("u"))&&"\\"!==t&&PF(t.charCodeAt(0))||aS({},EF,SF),e+=t);return e}function VF(){var t,e;return t=wF,e=92===bF.charCodeAt(wF)?YF():function(){var t,e;for(t=wF++;wF<kF;){if(92===(e=bF.charCodeAt(wF)))return wF=t,YF();if(!PF(e))break;++wF}return bF.slice(t,wF)}(),{type:1===e.length?3:jF.hasOwnProperty(e)?4:"null"===e?5:"true"===e||"false"===e?1:3,value:e,start:t,end:wF}}function GF(){var t,e,n,r,i=wF,o=bF.charCodeAt(wF),a=bF[wF];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++wF,{type:7,value:String.fromCharCode(o),start:i,end:wF};default:if(61===(t=bF.charCodeAt(wF+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return wF+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(t),start:i,end:wF};case 33:case 61:return wF+=2,61===bF.charCodeAt(wF)&&++wF,{type:7,value:bF.slice(i,wF),start:i,end:wF}}}return">>>="===(r=bF.substr(wF,4))?{type:7,value:r,start:i,end:wF+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:wF+=3}:a===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===e?{type:7,value:e,start:i,end:wF+=2}:("//"===e&&aS({},EF,SF),"<>=!+-*%&|^/".indexOf(a)>=0?{type:7,value:a,start:i,end:++wF}:void aS({},EF,SF))}function XF(){var t,e,n;if(NF(OF((n=bF[wF]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=wF,t="","."!==n){if(t=bF[wF++],n=bF[wF],"0"===t){if("x"===n||"X"===n)return++wF,function(t){let e="";for(;wF<kF&&RF(bF[wF]);)e+=bF[wF++];return 0===e.length&&aS({},EF,SF),UF(bF.charCodeAt(wF))&&aS({},EF,SF),{type:6,value:parseInt("0x"+e,16),start:t,end:wF}}(e);if($F(n))return function(t){let e="0"+bF[wF++];for(;wF<kF&&$F(bF[wF]);)e+=bF[wF++];return(UF(bF.charCodeAt(wF))||OF(bF.charCodeAt(wF)))&&aS({},EF,SF),{type:6,value:parseInt(e,8),octal:!0,start:t,end:wF}}(e);n&&OF(n.charCodeAt(0))&&aS({},EF,SF)}for(;OF(bF.charCodeAt(wF));)t+=bF[wF++];n=bF[wF]}if("."===n){for(t+=bF[wF++];OF(bF.charCodeAt(wF));)t+=bF[wF++];n=bF[wF]}if("e"===n||"E"===n)if(t+=bF[wF++],"+"!==(n=bF[wF])&&"-"!==n||(t+=bF[wF++]),OF(bF.charCodeAt(wF)))for(;OF(bF.charCodeAt(wF));)t+=bF[wF++];else aS({},EF,SF);return UF(bF.charCodeAt(wF))&&aS({},EF,SF),{type:6,value:parseFloat(t),start:e,end:wF}}function JF(){var t,e,n,r;return AF=null,IF(),t=wF,e=function(){var t,e,n,r;for(NF("/"===(t=bF[wF]),"Regular expression literal must start with a slash"),e=bF[wF++],n=!1,r=!1;wF<kF;)if(e+=t=bF[wF++],"\\"===t)LF((t=bF[wF++]).charCodeAt(0))&&aS({},CF),e+=t;else if(LF(t.charCodeAt(0)))aS({},CF);else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||aS({},CF),{value:e.substr(1,e.length-2),literal:e}}(),n=function(){var t,e,n;for(e="",n="";wF<kF&&PF((t=bF[wF]).charCodeAt(0));)++wF,"\\"===t&&wF<kF?aS({},EF,SF):(n+=t,e+=t);return n.search(/[^gimuy]/g)>=0&&aS({},DF,n),{value:n,literal:e}}(),r=function(t,e){let n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,e)=>{if(parseInt(e,16)<=1114111)return"x";aS({},DF)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){aS({},DF)}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:wF}}function ZF(){if(IF(),wF>=kF)return{type:2,start:wF,end:wF};const t=bF.charCodeAt(wF);return UF(t)?VF():40===t||41===t||59===t?GF():39===t||34===t?function(){var t,e,n,r,i="",o=!1;for(NF("'"===(t=bF[wF])||'"'===t,"String literal must starts with a quote"),e=wF,++wF;wF<kF;){if((n=bF[wF++])===t){t="";break}if("\\"===n)if((n=bF[wF++])&&LF(n.charCodeAt(0)))"\r"===n&&"\n"===bF[wF]&&++wF;else switch(n){case"u":case"x":"{"===bF[wF]?(++wF,i+=HF()):i+=WF(n);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:$F(n)?(0!==(r="01234567".indexOf(n))&&(o=!0),wF<kF&&$F(bF[wF])&&(o=!0,r=8*r+"01234567".indexOf(bF[wF++]),"0123".indexOf(n)>=0&&wF<kF&&$F(bF[wF])&&(r=8*r+"01234567".indexOf(bF[wF++]))),i+=String.fromCharCode(r)):i+=n}else{if(LF(n.charCodeAt(0)))break;i+=n}}return""!==t&&aS({},EF,SF),{type:8,value:i,octal:o,start:e,end:wF}}():46===t?OF(bF.charCodeAt(wF+1))?XF():GF():OF(t)?XF():GF()}function QF(){const t=AF;return wF=t.end,AF=ZF(),wF=t.end,t}function KF(){const t=wF;AF=ZF(),wF=t}function tS(t,e,n){const r=new _F("||"===t||"&&"===t?"LogicalExpression":"BinaryExpression");return r.operator=t,r.left=e,r.right=n,r}function eS(t,e){const n=new _F("CallExpression");return n.callee=t,n.arguments=e,n}function nS(t){const e=new _F(MF);return e.name=t,e}function rS(t){const e=new _F("Literal");return e.value=t.value,e.raw=bF.slice(t.start,t.end),t.regex&&("//"===e.raw&&(e.raw="/(?:)/"),e.regex=t.regex),e}function iS(t,e,n){const r=new _F("MemberExpression");return r.computed="["===t,r.object=e,r.property=n,r.computed||(n.member=!0),r}function oS(t,e,n){const r=new _F("Property");return r.key=e,r.value=n,r.kind=t,r}function aS(t,e){var n,r=Array.prototype.slice.call(arguments,2),i=e.replace(/%(\d)/g,((t,e)=>(NF(e<r.length,"Message reference must be in range"),r[e])));throw(n=new Error(i)).index=wF,n.description=i,n}function uS(t){2===t.type&&aS(t,"Unexpected end of input"),6===t.type&&aS(t,"Unexpected number"),8===t.type&&aS(t,"Unexpected string"),3===t.type&&aS(t,"Unexpected identifier"),4===t.type&&aS(t,"Unexpected reserved word"),aS(t,EF,t.value)}function sS(t){const e=QF();7===e.type&&e.value===t||uS(e)}function lS(t){return 7===AF.type&&AF.value===t}function cS(t){return 4===AF.type&&AF.value===t}function fS(){const t=[];for(wF=AF.start,sS("[");!lS("]");)lS(",")?(QF(),t.push(null)):(t.push(kS()),lS("]")||sS(","));return QF(),function(t){const e=new _F("ArrayExpression");return e.elements=t,e}(t)}function hS(){wF=AF.start;const t=QF();return 8===t.type||6===t.type?(t.octal&&aS(t,FF),rS(t)):nS(t.value)}function dS(){var t,e,n;return wF=AF.start,3===(t=AF).type?(n=hS(),sS(":"),oS("init",n,kS())):2!==t.type&&7!==t.type?(e=hS(),sS(":"),oS("init",e,kS())):void uS(t)}function pS(){var t,e,n=[],r={},i=String;for(wF=AF.start,sS("{");!lS("}");)e="$"+((t=dS()).key.type===MF?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,e)?aS({},"Duplicate data property in object literal not allowed in strict mode"):r[e]=!0,n.push(t),lS("}")||sS(",");return sS("}"),function(t){const e=new _F("ObjectExpression");return e.properties=t,e}(n)}const gS={if:1};function mS(){var t,e,n;if(lS("("))return function(){sS("(");const t=AS();return sS(")"),t}();if(lS("["))return fS();if(lS("{"))return pS();if(t=AF.type,wF=AF.start,3===t||gS[AF.value])n=nS(QF().value);else if(8===t||6===t)AF.octal&&aS(AF,FF),n=rS(QF());else{if(4===t)throw new Error(BF);1===t?((e=QF()).value="true"===e.value,n=rS(e)):5===t?((e=QF()).value=null,n=rS(e)):lS("/")||lS("/=")?(n=rS(JF()),KF()):uS(QF())}return n}function yS(){const t=[];if(sS("("),!lS(")"))for(;wF<kF&&(t.push(kS()),!lS(")"));)sS(",");return sS(")"),t}function vS(){return sS("."),function(){wF=AF.start;const t=QF();return function(t){return 3===t.type||4===t.type||1===t.type||5===t.type}(t)||uS(t),nS(t.value)}()}function _S(){sS("[");const t=AS();return sS("]"),t}function xS(){const t=function(){var t;for(t=mS();;)if(lS("."))t=iS(".",t,vS());else if(lS("("))t=eS(t,yS());else{if(!lS("["))break;t=iS("[",t,_S())}return t}();if(7===AF.type&&(lS("++")||lS("--")))throw new Error(BF);return t}function bS(){var t,e;if(7!==AF.type&&4!==AF.type)e=xS();else{if(lS("++")||lS("--"))throw new Error(BF);if(lS("+")||lS("-")||lS("~")||lS("!"))t=QF(),e=bS(),e=function(t,e){const n=new _F("UnaryExpression");return n.operator=t,n.argument=e,n.prefix=!0,n}(t.value,e);else{if(cS("delete")||cS("void")||cS("typeof"))throw new Error(BF);e=xS()}}return e}function wS(t){let e=0;if(7!==t.type&&4!==t.type)return 0;switch(t.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function kS(){var t,e;return t=function(){var t,e,n,r,i,o,a,u,s,l;if(t=AF,s=bS(),0===(i=wS(r=AF)))return s;for(r.prec=i,QF(),e=[t,AF],o=[s,r,a=bS()];(i=wS(AF))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),e.pop(),n=tS(u,s,a),o.push(n);(r=QF()).prec=i,o.push(r),e.push(AF),n=bS(),o.push(n)}for(n=o[l=o.length-1],e.pop();l>1;)e.pop(),n=tS(o[l-1].value,o[l-2],n),l-=2;return n}(),lS("?")&&(QF(),e=kS(),sS(":"),t=function(t,e,n){const r=new _F("ConditionalExpression");return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,kS())),t}function AS(){const t=kS();if(lS(","))throw new Error(BF);return t}function MS(t){wF=0,kF=(bF=t).length,AF=null,KF();const e=AS();if(2!==AF.type)throw new Error("Unexpect token after expression.");return e}var ES={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 DS(t){function e(e,n,r){return i=>function(e,n,r,i){let o=t(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}const n="new Date",r="String",i="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",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&s("Missing arguments to clamp function."),e.length>3&&s("Too many arguments to clamp function.");const n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase",r,0),lower:e("toLowerCase",r,0),substring:e("substring",r),split:e("split",r),trim:e("trim",r,0),regexp:i,test:e("test",i),if:function(e){e.length<3&&s("Missing arguments to if function."),e.length>3&&s("Too many arguments to if function.");const n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function CS(t){const e=(t=t||{}).allowed?Ct(t.allowed):{},n=t.forbidden?Ct(t.forbidden):{},r=t.constants||ES,i=(t.functions||DS)(h),o=t.globalvar,a=t.fieldvar,u=Y(o)?o:t=>`${o}["${t}"]`;let l={},c={},f=0;function h(t){if(gt(t))return t;const e=d[t.type];return null==e&&s("Unsupported type: "+t.type),e(t)}const d={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return f>0?i:it(n,i)?s("Illegal identifier: "+i):it(r,i)?r[i]:it(e,i)?i:(l[i]=1,u(i))},MemberExpression:t=>{const e=!t.computed,n=h(t.object);e&&(f+=1);const r=h(t.property);return n===a&&(c[function(t){const e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&s("Illegal callee type: "+t.callee.type);const e=t.callee.name,n=t.arguments,r=it(i,e)&&i[e];return r||s("Unrecognized function: "+e),Y(r)?r(n):r+"("+n.map(h).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(h).join(",")+"]",BinaryExpression:t=>"("+h(t.left)+" "+t.operator+" "+h(t.right)+")",UnaryExpression:t=>"("+t.operator+h(t.argument)+")",ConditionalExpression:t=>"("+h(t.test)+"?"+h(t.consequent)+":"+h(t.alternate)+")",LogicalExpression:t=>"("+h(t.left)+t.operator+h(t.right)+")",ObjectExpression:t=>"{"+t.properties.map(h).join(",")+"}",Property:t=>{f+=1;const e=h(t.key);return f-=1,e+":"+h(t.value)}};function p(t){const e={code:h(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},e}return p.functions=i,p.constants=r,p}const FS="intersect",SS="union",BS="index:unit";function TS(t,e){for(var n,r,i=e.fields,o=e.values,a=i.length,u=0;u<a;++u)if((r=i[u]).getter=c.getter||c(r.field),ft(n=r.getter(t))&&(n=E(n)),ft(o[u])&&(o[u]=E(o[u])),ft(o[u][0])&&(o[u]=o[u].map(E)),"E"===r.type){if(_(o[u])?o[u].indexOf(n)<0:n!==o[u])return!1}else if("R"===r.type){if(!lt(n,o[u]))return!1}else if("R-RE"===r.type){if(!lt(n,o[u],!0,!1))return!1}else if("R-E"===r.type){if(!lt(n,o[u],!1,!1))return!1}else if("R-LE"===r.type&&!lt(n,o[u],!1,!0))return!1;return!0}const zS=c("_vgsid_"),NS=function(t){let e=t,n=t;function r(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r<i;){const o=r+i>>>1;n(t[o],e)<0?r=o+1:i=o}return r}return 1===t.length&&(e=(e,n)=>t(e)-n,n=function(t){return(e,n)=>function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}(t(e),n)}(t)),{left:r,center:function(t,n,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=r(t,n,i,o-1);return a>i&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r<i;){const o=r+i>>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}(zS),OS=NS.left,RS=NS.right;var $S={E_union:function(t,e){if(!t.length)return e;for(var n=0,r=e.length;n<r;++n)t.indexOf(e[n])<0&&t.push(e[n]);return t},E_intersect:function(t,e){return t.length?t.filter((t=>e.indexOf(t)>=0)):e},R_union:function(t,e){var n=E(e[0]),r=E(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]<r&&(t[1]=r),t):[n,r]},R_intersect:function(t,e){var n=E(e[0]),r=E(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?r<t[0]||t[1]<n?[]:(t[0]<n&&(t[0]=n),t[1]>r&&(t[1]=r),t):[n,r]}};function qS(t,e,n,r){e[0].type!==lF&&s("First argument to selection functions must be a string literal.");const i=e[0].value,o="unit",a="@unit",u=":"+i;(e.length>=2&&M(e).value)!==FS||it(r,a)||(r["@unit"]=n.getData(i).indataRef(n,o)),it(r,u)||(r[u]=n.getData(i).tuplesRef())}function LS(t){const e=this.context.data[t];return e?e.values.value:[]}const US=t=>function(e,n){return this.context.dataflow.locale()[t](n)(e)},PS=US("format"),jS=US("timeFormat"),IS=US("utcFormat"),WS=US("timeParse"),HS=US("utcParse"),YS=new Date(2e3,0,1);function VS(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(YS.setYear(2e3),YS.setMonth(t),YS.setDate(e),jS.call(this,YS,n)):""}function GS(t,e,n,r){e[0].type!==lF&&s("First argument to data functions must be a string literal.");const i=e[0].value,o=":"+i;if(!it(o,r))try{r[o]=n.getData(i).tuplesRef()}catch(t){}}function XS(t,e,n,r){if(e[0].type===lF)JS(n,r,e[0].value);else for(t in n.scales)JS(n,r,t)}function JS(t,e,n){const r="%"+n;if(!it(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}function ZS(t,e){let n;return Y(t)?t:gt(t)?(n=e.scales[t])&&n.value:void 0}function QS(t,e,n){e.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,n._bandwidth=XS,n._range=XS,n._scale=XS;const r=e=>"_["+(e.type===lF?kt("%"+e.value):kt("%")+"+"+t(e))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:e=>`${r(e[0])}(${t(e[1])})`}}function KS(t,e){return function(n,r,i){if(n){const e=ZS(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const tB=KS("area",(function(t){return Cb=new Kt,cb(t,Fb),2*Cb})),eB=KS("bounds",(function(t){var e,n,r,i,o,a,u;if(_b=vb=-(mb=yb=1/0),Mb=[],cb(t,rw),n=Mb.length){for(Mb.sort(hw),e=1,o=[r=Mb[0]];e<n;++e)dw(r,(i=Mb[e])[0])||dw(r,i[1])?(fw(r[0],i[1])>fw(r[0],r[1])&&(r[1]=i[1]),fw(i[0],r[1])>fw(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(u=fw(r[1],i[0]))>a&&(a=u,mb=i[0],vb=r[1])}return Mb=Eb=null,mb===1/0||yb===1/0?[[NaN,NaN],[NaN,NaN]]:[[mb,yb],[vb,_b]]})),nB=KS("centroid",(function(t){Pb=jb=Ib=Wb=Hb=Yb=Vb=Gb=0,Xb=new Kt,Jb=new Kt,Zb=new Kt,cb(t,pw);var e=+Xb,n=+Jb,r=+Zb,i=Xx(e,n,r);return i<Rx&&(e=Yb,n=Vb,r=Gb,jb<Ox&&(e=Ib,n=Wb,r=Hb),(i=Xx(e,n,r))<Rx)?[NaN,NaN]:[Hx(n,e)*Px,rb(r/i)*Px]}));function rB(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function iB(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function oB(t){const e=Ic(t);return.2126*iB(e.r)+.7152*iB(e.g)+.0722*iB(e.b)}function aB(t,e){return t===e||t!=t&&e!=e||(_(t)?!(!_(e)||t.length!==e.length)&&function(t,e){for(let n=0,r=t.length;n<r;++n)if(!aB(t[n],e[n]))return!1;return!0}(t,e):!(!x(t)||!x(e))&&uB(t,e))}function uB(t,e){for(const n in t)if(!aB(t[n],e[n]))return!1;return!0}function sB(t){return e=>uB(t,e)}const lB={};function cB(t){return _(t)||ArrayBuffer.isView(t)?t:null}function fB(t){return cB(t)||(gt(t)?t:null)}const hB=t=>t.data;function dB(t,e){const n=LS.call(e,t);return n.root&&n.root.lookup||{}}const pB=()=>"undefined"!=typeof window&&window||null;const gB={random:()=>t.random(),cumulativeNormal:Za,cumulativeLogNormal:ru,cumulativeUniform:lu,densityNormal:Ja,densityLogNormal:nu,densityUniform:su,quantileNormal:Qa,quantileLogNormal:iu,quantileUniform:cu,sampleNormal:Xa,sampleLogNormal:eu,sampleUniform:uu,isArray:_,isBoolean:ct,isDate:ft,isDefined:t=>void 0!==t,isNumber:dt,isObject:x,isRegExp:pt,isString:gt,isTuple:ea,isValid:t=>null!=t&&t==t,toBoolean:At,toDate:Et,toNumber:E,toString:Dt,indexof:function(t,...e){return fB(t).indexOf(...e)},join:function(t,...e){return cB(t).join(...e)},lastindexof:function(t,...e){return fB(t).lastIndexOf(...e)},replace:function(t,e,n){return Y(n)&&s("Function argument passed to replace."),String(t).replace(e,n)},reverse:function(t){return cB(t).slice().reverse()},slice:function(t,...e){return fB(t).slice(...e)},flush:ut,lerp:yt,merge:function(){const t=[].slice.call(arguments);return t.unshift({}),tt(...t)},pad:bt,peek:M,pluck:function(t,e){const n=lB[e]||(lB[e]=c(e));return _(t)?t.map(n):n(t)},span:wt,inrange:lt,truncate:Ft,rgb:Ic,lab:sf,hcl:gf,hsl:Jc,luminance:oB,contrast:function(t,e){const n=oB(t),r=oB(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:pe,format:PS,utcFormat:IS,utcParse:HS,utcOffset:vr,utcSequence:br,timeFormat:jS,timeParse:WS,timeOffset:yr,timeSequence:xr,timeUnitSpecifier:In,monthFormat:function(t){return VS.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return VS.call(this,t,1,"%b")},dayFormat:function(t){return VS.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return VS.call(this,0,2+t,"%a")},quarter:j,utcquarter:I,week:Vn,utcweek:Kn,dayofyear:Yn,utcdayofyear:Qn,warn:function(){return rB(this.context.dataflow,"warn",arguments)},info:function(){return rB(this.context.dataflow,"info",arguments)},debug:function(){return rB(this.context.dataflow,"debug",arguments)},extent:et,inScope:function(t){const e=this.context.group;let n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:function(t,e,n){if(!t)return[];const[r,i]=t,o=(new fg).set(r[0],r[1],i[0],i[1]);return Lv(n||this.context.dataflow.scenegraph().root,o,function(t){let e=null;if(t){const n=W(t.marktype),r=W(t.markname);e=t=>(!n.length||n.some((e=>t.marktype===e)))&&(!r.length||r.some((e=>t.name===e)))}return e}(e))},clampRange:H,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){const t=pB();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){const t=pB();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return td(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(g).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?Np(n,e=e||kp(t)):t}},panLinear:z,panLog:N,panPow:O,panSymlog:R,zoomLinear:q,zoomLog:L,zoomPow:U,zoomSymlog:P,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,o){const a=this.context.dataflow,u=this.context.data[t],s=u.input,l=a.stamp();let c,f,h=u.changes;if(!1===a._trigger||!(s.value.length||e||r))return 0;if((!h||h.stamp<l)&&(u.changes=h=a.changeset(),h.stamp=l,a.runAfter((()=>{u.modified=!0,a.pulse(s,h).run()}),!0,1)),n&&(c=!0===n?g:_(n)||ea(n)?n:sB(n),h.remove(c)),e&&h.insert(e),r&&(c=sB(r),s.value.some(c)?h.remove(c):h.insert(r)),i)for(f in o)h.modify(i,f,o[f]);return 1}},mB=["view","item","group","xy","x","y"],yB="this.",vB={},_B={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${kt("$"+t)}]`,functions:function(t){const e=DS(t);mB.forEach((t=>e[t]="event.vega."+t));for(const t in gB)e[t]=yB+t;return tt(e,QS(t,gB,vB)),e},constants:ES,visitors:vB},xB=CS(_B);function bB(t,e,n){return 1===arguments.length?gB[t]:(gB[t]=e,n&&(vB[t]=n),xB&&(xB.functions[t]=yB+t),this)}function wB(t,e){const n={};let r;try{r=MS(t=gt(t)?t:kt(t)+"")}catch(e){s("Expression parse error: "+t)}r.visit((t=>{if(t.type!==dF)return;const r=t.callee.name,i=_B.visitors[r];i&&i(r,t.arguments,e,n)}));const i=xB(r);return i.globals.forEach((t=>{const r="$"+t;!it(n,r)&&e.getSignal(t)&&(n[r]=e.signalRef(t))})),{$expr:tt({code:i.code},e.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}bB("bandwidth",(function(t,e){const n=ZS(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0}),XS),bB("copy",(function(t,e){const n=ZS(t,(e||this).context);return n?n.copy():void 0}),XS),bB("domain",(function(t,e){const n=ZS(t,(e||this).context);return n?n.domain():[]}),XS),bB("range",(function(t,e){const n=ZS(t,(e||this).context);return n&&n.range?n.range():[]}),XS),bB("invert",(function(t,e,n){const r=ZS(t,(n||this).context);return r?_(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0}),XS),bB("scale",(function(t,e,n){const r=ZS(t,(n||this).context);return r?r(e):void 0}),XS),bB("gradient",(function(t,e,n,r,i){t=ZS(t,(i||this).context);const o=vp(e,n);let a=t.domain(),u=a[0],s=M(a),l=h;return s-u?l=Pd(t,u,s):t=(t.interpolator?Cd("sequential")().interpolator(t.interpolator()):Cd("linear")().interpolate(t.interpolate()).range(t.range())).domain([u=0,s=1]),t.ticks&&(a=t.ticks(+r||15),u!==a[0]&&a.unshift(u),s!==M(a)&&a.push(s)),a.forEach((e=>o.stop(l(e),t(e)))),o}),XS),bB("geoArea",tB,XS),bB("geoBounds",eB,XS),bB("geoCentroid",nB,XS),bB("geoShape",(function(t,e,n){const r=ZS(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),XS),bB("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){e[0].type!==lF&&s("First argument to indata must be a string literal."),e[1].type!==lF&&s("Second argument to indata must be a string literal.");const i=e[0].value,o=e[1].value,a="@"+o;it(a,r)||(r[a]=n.getData(i).indataRef(n,o))})),bB("data",LS,GS),bB("treePath",(function(t,e,n){const r=dB(t,this),i=r[e],o=r[n];return i&&o?i.path(o).map(hB):void 0}),GS),bB("treeAncestors",(function(t,e){const n=dB(t,this)[e];return n?n.ancestors().map(hB):void 0}),GS),bB("vlSelectionTest",(function(t,e,n){for(var r,i,o,a,u,s=this.context.data[t],l=s?s.values.value:[],c=s?s[BS]&&s[BS].value:void 0,f=n===FS,h=l.length,d=0;d<h;++d)if(r=l[d],c&&f){if(-1===(o=(i=i||{})[a=r.unit]||0))continue;if(u=TS(e,r),i[a]=u?-1:++o,u&&1===c.size)return!0;if(!u&&o===c.get(a).count)return!1}else if(f^(u=TS(e,r)))return u;return h&&f}),qS),bB("vlSelectionIdTest",(function(t,e,n){const r=this.context.data[t],i=r?r.values.value:[],o=r?r[BS]&&r[BS].value:void 0,a=n===FS,u=zS(e),s=OS(i,u);if(s===i.length)return!1;if(zS(i[s])!==u)return!1;if(o&&a){if(1===o.size)return!0;if(RS(i,u)-s<o.size)return!1}return!0}),qS),bB("vlSelectionResolve",(function(t,e,n,r){for(var i,o,a,u,s,l,c,f,h,d,p,g=this.context.data[t],m=g?g.values.value:[],y={},v={},_={},x=m.length,b=0;b<x;++b){for(u=(i=m[b]).unit,o=i.fields,a=i.values,d=0,p=o.length;d<p;++d)s=o[d],c=(l=y[s.field]||(y[s.field]={}))[u]||(l[u]=[]),_[s.field]=f=s.type.charAt(0),h=$S[f+"_union"],l[u]=h(c,W(a[d]));n&&(c=v[u]||(v[u]=[])).push(W(a).reduce(((t,e,n)=>(t[o[n].field]=e,t)),{}))}if(e=e||SS,Object.keys(y).forEach((t=>{y[t]=Object.keys(y[t]).map((e=>y[t][e])).reduce(((n,r)=>void 0===n?r:$S[_[t]+"_"+e](n,r)))})),m=Object.keys(v),n&&m.length){y[r?"vlPoint":"vlMulti"]=e===SS?{or:m.reduce(((t,e)=>(t.push(...v[e]),t)),[])}:{and:m.map((t=>({or:v[t]})))}}return y}),qS),bB("vlSelectionTuples",(function(t,e){return t.map((t=>tt({values:e.fields.map((e=>(e.getter||(e.getter=c(e.field)))(t.datum)))},e)))}));const kB=Ct(["rule"]),AB=Ct(["group","image","rect"]);function MB(t){return(t+"").toLowerCase()}function EB(t,e,n){n.endsWith(";")||(n="return("+n+");");const r=Function(...e.concat(n));return t&&t.functions?r.bind(t.functions):r}var DB={operator:(t,e)=>EB(t,["_"],e.code),parameter:(t,e)=>EB(t,["datum","_"],e.code),event:(t,e)=>EB(t,["event"],e.code),handler:(t,e)=>EB(t,["_","event"],`var datum=event.item&&event.item.datum;return ${e.code};`),encode:(t,e)=>{const{marktype:n,channels:r}=e;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const e="o["+kt(t)+"]";i+=`$=${r[t].code};if(${e}!==$)${e}=$,m=1;`}return i+=function(t,e){let n="";return kB[e]||(t.x2&&(t.x?(AB[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(AB[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),i+="return m;",EB(t,["item","_"],i)},codegen:{get(t){const e=`[${t.map(kt).join("][")}]`,n=Function("_",`return _${e};`);return n.path=e,n},comparator(t,e){let n;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=e[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((n=n||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,e,n,r){return`((u = ${t}) < (v = ${e}) || u == null) && v != null ? ${n}\n  : (u > v || v == null) && u != null ? ${r}\n  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n  : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return n?r.bind(n):r}}};function CB(t,e,n){if(!t||!x(t))return t;for(let r,i=0,o=FB.length;i<o;++i)if(r=FB[i],it(t,r.key))return r.parse(t,e,n);return t}var FB=[{key:"$ref",parse:function(t,e){return e.get(t.$ref)||s("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,e){const n="k:"+t.$key+"_"+!!t.$flat;return e.fn[n]||(e.fn[n]=mt(t.$key,t.$flat,e.expr.codegen))}},{key:"$expr",parse:function(t,e,r){t.$params&&e.parseParameters(t.$params,r);const i="e:"+t.$expr.code;return e.fn[i]||(e.fn[i]=n(e.parameterExpression(t.$expr),t.$fields))}},{key:"$field",parse:function(t,e){if(!t.$field)return null;const n="f:"+t.$field+"_"+t.$name;return e.fn[n]||(e.fn[n]=c(t.$field,t.$name,e.expr.codegen))}},{key:"$encode",parse:function(t,e){const r=t.$encode,i={};for(const t in r){const o=r[t];i[t]=n(e.encodeExpression(o.$expr),o.$fields),i[t].output=o.$output}return i}},{key:"$compare",parse:function(t,e){const n="c:"+t.$compare+"_"+t.$order,r=W(t.$compare).map((t=>t&&t.$tupleid?na:t));return e.fn[n]||(e.fn[n]=V(r,t.$order,e.expr.codegen))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){const n=t.$subflow;return function(t,r,i){const o=e.fork().parse(n),a=o.get(n.operators[0].id),u=o.signals.parent;return u&&u.set(i),a.detachSubflow=()=>e.detach(o),a}}},{key:"$tupleid",parse:function(){return na}}];const SB={skip:!0};function BB(t,e,n,r){return new TB(t,e,n,r)}function TB(t,e,n,r){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.expr=r||DB,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function zB(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function NB(t,e){t&&(null==e?t.removeAttribute("aria-label"):t.setAttribute("aria-label",e))}TB.prototype=zB.prototype={fork(){const t=new zB(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((e=>e!==t));const e=Object.keys(t.nodes);for(const n of e)t.nodes[n]._targets=null;for(const n of e)t.nodes[n].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,e){return this.nodes[t]=e},add(t,e){const n=this,r=n.dataflow,i=t.value;if(n.set(t.id,e),function(t){return"collect"===MB(t)}(t.type)&&i&&(i.$ingest?r.ingest(e,i.$ingest,i.$format):i.$request?r.preload(e,i.$request,i.$format):r.pulse(e,r.changeset().insert(i))),t.root&&(n.root=e),t.parent){let i=n.get(t.parent.$ref);i?(r.connect(i,[e]),e.targets().add(i)):(n.unresolved=n.unresolved||[]).push((()=>{i=n.get(t.parent.$ref),r.connect(i,[e]),e.targets().add(i)}))}if(t.signal&&(n.signals[t.signal]=e),t.scale&&(n.scales[t.scale]=e),t.data)for(const r in t.data){const i=n.data[r]||(n.data[r]={});t.data[r].forEach((t=>i[t]=e))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,e){this.add(t,this.dataflow.add(t.value,e))},transform(t,e){this.add(t,this.dataflow.add(this.transforms[MB(e)]))},stream(t,e){this.set(t.id,e)},update(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const e=this,n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),t.locale&&(e.locale=t.locale),n.forEach((t=>e.parseOperator(t))),n.forEach((t=>e.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>e.parseStream(t))),(t.updates||[]).forEach((t=>e.parseUpdate(t))),e.resolve()},parseOperator:function(t){const e=this;!function(t){return"operator"===MB(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?e.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const e=this;if(t.params){const n=e.get(t.id);n||s("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(e.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,e){e=e||{};const n=this;for(const r in t){const i=t[r];e[r]=_(i)?i.map((t=>CB(t,n,e))):CB(i,n,e)}return e},parseStream:function(t){var e,n=this,r=null!=t.filter?n.eventExpression(t.filter):void 0,i=null!=t.stream?n.get(t.stream):void 0;t.source?i=n.events(t.source,t.type,r):t.merge&&(i=(e=t.merge.map((t=>n.get(t))))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map((t=>n.get(t))),i=i.between(e[0],e[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&s("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),n.stream(t,i)},parseUpdate:function(t){var e,n=this,r=x(r=t.source)?r.$ref:r,i=n.get(r),o=t.update,a=void 0;i||s("Source not defined: "+t.source),e=t.target&&t.target.$expr?n.eventExpression(t.target.$expr):n.get(t.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(t,i,e,o,a)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach((n=>{const i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)}))}if(t.data){var i=n.data={};Object.keys(e.data).forEach((n=>{const r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)}))}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map((e=>e.getState(t)))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{n.update(e.signals[t],i[t],SB)})),Object.keys(r||{}).forEach((t=>{n.pulse(e.data[t].input,n.changeset().remove(g).insert(r[t]))})),(t.subcontext||[]).forEach(((t,n)=>{const r=e.subcontext[n];r&&r.setState(t)}))}};const OB="default";function RB(t,e){const n=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(n)return null==e?n.style.removeProperty("cursor"):n.style.cursor=e}function $B(t,e){var n=t._runtime.data;return it(n,e)||s("Unrecognized data set: "+e),n[e]}function qB(t,e){la(e)||s("Second argument to changes must be a changeset.");const n=$B(this,t);return n.modified=!0,this.pulse(n.input,e)}function LB(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function UB(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function PB(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}function jB(t,e,n){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=PB(t),(r=ky(e.changedTouches?e.changedTouches[0]:e,a))[0]-=i[0],r[1]-=i[1]),e.dataflow=t,e.item=n,e.vega=function(t,e,n){const r=e?"group"===e.mark.marktype?e:e.mark.group:null;function i(t){var n,i=r;if(t)for(n=e;n;n=n.mark.group)if(n.mark.name===t){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return n;gt(t)&&(t=i(t));const e=n.slice();for(;t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:Q(t),item:Q(e||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,n,r),e}const IB="view",WB={trap:!1};function HB(t,e,n,r){t._eventListeners.push({type:n,sources:W(e),handler:r})}function YB(t,e,n){const r=t._eventConfig&&t._eventConfig[e];return!(!1===r||x(r)&&!r[n])||(t.warn(`Blocked ${e} ${n} event listener.`),!1)}function VB(t){return t.item}function GB(t){return t.item.mark.source}function XB(t){return function(e,n){return n.vega.view().changeset().encode(n.item,t)}}function JB(t,e,n){const r=document.createElement(t);for(const t in e)r.setAttribute(t,e[t]);return null!=n&&(r.textContent=n),r}function ZB(t,e,n,r){const i=n.event||"input",o=()=>t.update(e.value);r.signal(n.signal,e.value),e.addEventListener(i,o),HB(r,e,i,o),t.set=t=>{e.value=t,e.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function QB(t,e,n,r){const i=r.signal(n.signal),o=JB("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(JB("label"));a.appendChild(JB("span",{class:"vega-bind-name"},n.name||n.signal)),e.appendChild(o);let u=KB;switch(n.input){case"checkbox":u=tT;break;case"select":u=eT;break;case"radio":u=nT;break;case"range":u=rT}u(t,a,n,i)}function KB(t,e,n,r){const i=JB("input");for(const t in n)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,n[t]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function tT(t,e,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const o=JB("input",i);e.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function eT(t,e,n,r){const i=JB("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((t,e)=>{const n={value:t};iT(t,r)&&(n.selected=!0),i.appendChild(JB("option",n,(o[e]||t)+""))})),e.appendChild(i),i.addEventListener("change",(()=>{t.update(n.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let e=0,r=n.options.length;e<r;++e)if(iT(n.options[e],t))return void(i.selectedIndex=e)}}function nT(t,e,n,r){const i=JB("span",{class:"vega-bind-radio"}),o=n.labels||[];e.appendChild(i),t.elements=n.options.map(((e,a)=>{const u={type:"radio",name:n.signal,value:e};iT(e,r)&&(u.checked=!0);const s=JB("input",u);s.addEventListener("change",(()=>t.update(e)));const l=JB("label",{},(o[a]||e)+"");return l.prepend(s),i.appendChild(l),s})),t.set=e=>{const n=t.elements,r=n.length;for(let t=0;t<r;++t)iT(n[t].value,e)&&(n[t].checked=!0)}}function rT(t,e,n,r){r=void 0!==r?r:(+n.max+ +n.min)/2;const i=null!=n.max?n.max:Math.max(100,+r)||100,o=n.min||Math.min(0,i,+r)||0,a=n.step||oe(o,i,100),u=JB("input",{type:"range",name:n.signal,min:o,max:i,step:a});u.value=r;const s=JB("span",{},+r);e.appendChild(u),e.appendChild(s);const l=()=>{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",l),u.addEventListener("change",l),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function iT(t,e){return t===e||t+""==e+""}function oT(t,e,n,r,i,o){return(e=e||new r(t.loader())).initialize(n,LB(t),UB(t),PB(t),i,o).background(t.background())}function aT(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function uT(t,e,n){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e&&n)try{e.innerHTML=""}catch(n){e=null,t.error(n)}return e}const sT=t=>+t||0;function lT(t){return x(t)?{top:sT(t.top),bottom:sT(t.bottom),left:sT(t.left),right:sT(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(sT(t))}async function cT(t,e,n,r){const i=qv(e),o=i&&i.headless;return o||s("Unrecognized renderer type: "+e),await t.runAsync(),oT(t,null,null,o,n,r).renderAsync(t._scenegraph.root)}var fT="width",hT="height",dT="padding",pT={skip:!0};function gT(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===dT?r.left+r.right:0)}function mT(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===dT?r.top+r.bottom:0)}function yT(t,e){return e.modified&&_(e.input.value)&&t.indexOf("_:vega:_")}function vT(t,e){return!("parent"===t||e instanceof Ra.proxy)}function _T(t,e,n,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":_(t)?xT(t):x(t)&&!ft(t)?(e=t,Object.keys(e).map((t=>{const n=e[t];return t+": "+(_(n)?xT(n):bT(n))})).join("\n")):t+"";var e}(r))}function xT(t){return"["+t.map(bT).join(", ")+"]"}function bT(t){return _(t)?"[…]":x(t)&&!ft(t)?"{…}":t}function wT(t,e){const n=this;if(e=e||{},za.call(n),e.loader&&n.loader(e.loader),e.logger&&n.logger(e.logger),null!=e.logLevel&&n.logLevel(e.logLevel),e.locale||t.locale){const r=tt({},t.locale,e.locale);n.locale(ko(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=e.renderer||Rv.Canvas,n._scenegraph=new my;const r=n._scenegraph.root;n._renderer=null,n._tooltip=e.tooltip||_T,n._redraw=!0,n._handler=(new jy).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(t){const e=tt({defaults:{}},t),n=(t,e)=>{e.forEach((e=>{_(t[e])&&(t[e]=Ct(t[e]))}))};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=function(t,e,n){return BB(t,Ra,gB,n).parse(e)}(n,t,e.expr);n._runtime=i,n._signals=i.signals,n._bind=(t.bindings||[]).map((t=>({state:null,param:tt({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=gT(n,n._width),n._viewHeight=mT(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(t){var e=t._signals,n=e.width,r=e.height,i=e.padding;function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(e=>{t._width=e.size,t._viewWidth=gT(t,e.size),o()}),{size:n}),t._resizeHeight=t.add(null,(e=>{t._height=e.size,t._viewHeight=mT(t,e.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(n),function(t){t.add(null,(e=>(t._background=e.bg,t._resize=1,e.bg)),{bg:t._signals.background})}(n),function(t){const e=t._signals.cursor||(t._signals.cursor=t.add({user:OB,item:null}));t.on(t.events("view","mousemove"),e,((t,n)=>{const r=e.value,i=r?gt(r)?r:r.user:OB,o=n.item&&n.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(e){let n=e.cursor,r=this.value;return gt(n)||(r=n.item,n=n.user),RB(t,n&&n!==OB?n:r||n),r}),{cursor:e})}(n),n.description(t.description),e.hover&&n.hover(),e.container&&n.initialize(e.container,e.bind)}function kT(t,e){return it(t._signals,e)?t._signals[e]:s("Unrecognized signal name: "+kt(e))}function AT(t,e){const n=(t._targets||[]).filter((t=>t._update&&t._update.handler===e));return n.length?n[0]:null}function MT(t,e,n,r){let i=AT(n,r);return i||(i=aT(t,(()=>r(e,n.value))),i.handler=r,t.on(n,null,i)),t}function ET(t,e,n){const r=AT(e,n);return r&&e._targets.remove(r),t}st(wT,za,{async evaluate(t,e,n){if(await za.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=PB(t),n=LB(t),r=UB(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((e=>{try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&Qo(this,n),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&NB(this._el,this._desc=e),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,e,n){const r=kT(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",lT(t)):lT(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(qv(t)||s("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&(za.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(kT(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,e,n,r,i,o){this.runAfter((a=>{let u=0;a._autosize=0,a.width()!==n&&(u=1,a.signal(fT,n,pT),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal(hT,r,pT),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==e&&(a._resize=1,a._viewHeight=e),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,e,n){let r=e;return n&&!1===n.trap||(r=aT(this,e),r.raw=e),this._handler.on(t,r),this},removeEventListener(t,e){for(var n,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},addResizeListener(t){const e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},removeResizeListener(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},addSignalListener(t,e){return MT(this,t,kT(this,t),e)},removeSignalListener(t,e){return ET(this,kT(this,t),e)},addDataListener(t,e){return MT(this,t,$B(this,t).values,e)},removeDataListener(t,e){return ET(this,$B(this,t).values,e)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=RB(this,null);this._globalCursor=!!t,e&&RB(this,e)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,e){this._timers.push(function(t,e,n){var r=new iE,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?nE():+n,r._restart((function o(a){a+=i,r._restart(o,i+=e,n),t(a)}),e,n)},r.restart(t,e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},events:function(t,e,n){var r,i=this,o=new va(n),a=function(n,r){i.runAsync(null,(()=>{t===IB&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),o.receive(jB(i,n,r))}))};if("timer"===t)YB(i,"timer",e)&&i.timer(a,e);else if(t===IB)YB(i,"view",e)&&i.addEventListener(e,a,WB);else if("window"===t?YB(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&YB(i,"selector",e)&&(r=document.querySelectorAll(t)),r){for(var u=0,s=r.length;u<s;++u)r[u].addEventListener(e,a);HB(i,r,e,a)}else i.warn("Can not resolve event source: "+t);return o},finalize:function(){var t,e,n,r=this._tooltip,i=this._timers,o=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=o.length;--t>=0;)for(e=(n=o[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},hover:function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",VB),GB,XB(t)),this.on(this.events("view","mouseout",VB),GB,XB(e)),this},data:function(t,e){return arguments.length<2?$B(this,t).values.value:qB.call(this,t,ca().remove(g).insert(e))},change:qB,insert:function(t,e){return qB.call(this,t,ca().insert(e))},remove:function(t,e){return qB.call(this,t,ca().remove(e))},scale:function(t){var e=this._runtime.scales;return it(e,t)||s("Unrecognized scale or projection: "+t),e[t].value},initialize:function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,o=qv(r);t=n._el=t?uT(n,t,!0):null,function(t){const e=t.container();e&&(e.setAttribute("role","graphics-document"),e.setAttribute("aria-roleDescription","visualization"),NB(e,t.description()))}(n),o||n.error("Unrecognized renderer type: "+r);const a=o.handler||jy,u=t?o.renderer:o.headless;return n._renderer=u?oT(n,n._renderer,t,u):null,n._handler=function(t,e,n,r){const i=new r(t.loader(),aT(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,PB(t),t);return e&&e.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(n,n._handler,t,a),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=uT(n,e,!0):t.appendChild(JB("form",{class:"vega-bindings"})),n._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=uT(n,t.param.element,!!t.param.input))})),n._bind.forEach((t=>{!function(t,e,n){if(!e)return;const r=n.param;let i=n.state;i||(i=n.state={elements:null,active:!1,set:null,update:e=>{e!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=K(r.debounce,i.update))),(null==r.input&&r.element?ZB:QB)(i,e,r,t),i.active||(t.on(t._signals[r.signal],null,(()=>{i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0)}(n,t.element||e,t)}))),n},toImageURL:async function(t,e){t!==Rv.Canvas&&t!==Rv.SVG&&t!==Rv.PNG&&s("Unrecognized image type: "+t);const n=await cT(this,t,e);return t===Rv.SVG?function(t,e){const n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(t,e){return(await cT(this,Rv.Canvas,t,e)).canvas()},toSVG:async function(t){return(await cT(this,Rv.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:yT,signals:vT,recurse:!0})},setState:function(t){return this.runAsync(null,(e=>{e._trigger=!1,e._runtime.setState(t)}),(t=>{t._trigger=!0})),this}});const DT="[",CT="]",FT=/[[\]{}]/,ST={"*":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 BT,TT;function zT(t,e,n){return BT=e||"view",TT=n||ST,OT(t.trim()).map(RT)}function NT(t,e,n,r,i){const o=t.length;let a,u=0;for(;e<o;++e){if(a=t[e],!u&&a===n)return e;i&&i.indexOf(a)>=0?--u:r&&r.indexOf(a)>=0&&++u}return e}function OT(t){const e=[],n=t.length;let r=0,i=0;for(;i<n;)i=NT(t,i,",","[{","]}"),e.push(t.substring(r,i).trim()),r=++i;if(0===e.length)throw"Empty event selector: "+t;return e}function RT(t){return"["===t[0]?function(t){const e=t.length;let n,r=1;if(r=NT(t,r,CT,DT,CT),r===e)throw"Empty between selector: "+t;if(n=OT(t.substring(1,r)),2!==n.length)throw"Between selector must have two elements: "+t;if(">"!==(t=t.slice(r+1).trim())[0])throw"Expected '>' after between selector: "+t;n=n.map(RT);const i=RT(t.slice(1).trim());if(i.between)return{between:n,stream:i};i.between=n;return i}(t):function(t){const e={source:BT},n=[];let r,i,o=[0,0],a=0,u=0,s=t.length,l=0;if("}"===t[s-1]){if(l=t.lastIndexOf("{"),!(l>=0))throw"Unmatched right brace: "+t;try{o=function(t){const e=t.split(",");if(!t.length||e.length>2)throw t;return e.map((e=>{const n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,s-1))}catch(e){throw"Invalid throttle specification: "+t}s=(t=t.slice(0,l).trim()).length,l=0}if(!s)throw t;"@"===t[0]&&(a=++l);r=NT(t,l,":"),r<s&&(n.push(t.substring(u,r).trim()),u=l=++r);if(l=NT(t,l,DT),l===s)n.push(t.substring(u,s).trim());else if(n.push(t.substring(u,l).trim()),i=[],u=++l,u===s)throw"Unmatched left bracket: "+t;for(;l<s;){if(l=NT(t,l,CT),l===s)throw"Unmatched left bracket: "+t;if(i.push(t.substring(u,l).trim()),l<s-1&&t[++l]!==DT)throw"Expected left bracket: "+t;u=++l}if(!(s=n.length)||FT.test(n[s-1]))throw"Invalid event selector: "+t;s>1?(e.type=n[1],a?e.markname=n[0].slice(1):!function(t){return TT[t]}(n[0])?e.source=n[0]:e.marktype=n[0]):e.type=n[0];"!"===e.type.slice(-1)&&(e.consume=!0,e.type=e.type.slice(0,-1));null!=i&&(e.filter=i);o[0]&&(e.throttle=o[0]);o[1]&&(e.debounce=o[1]);return e}(t)}function $T(t){return x(t)?t:{type:t||"pad"}}const qT=t=>+t||0;function LT(t){return x(t)?t.signal?t:{top:qT(t.top),bottom:qT(t.bottom),left:qT(t.left),right:qT(t.right)}:{top:e=qT(t),bottom:e,left:e,right:e};var e}const UT=t=>x(t)&&!_(t)?tt({},t):{value:t};function PT(t,e,n,r){if(null!=n){return x(n)&&!_(n)||_(n)&&n.length&&x(n[0])?t.update[e]=n:t[r||"enter"][e]={value:n},1}return 0}function jT(t,e,n){for(const n in e)PT(t,n,e[n]);for(const e in n)PT(t,e,n[e],"update")}function IT(t,e,n){for(const r in e)n&&it(n,r)||(t[r]=tt(t[r]||{},e[r]));return t}function WT(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}const HT="mark",YT="frame",VT="scope",GT="legend-label",XT="title-text",JT="title-subtitle";function ZT(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const QT=t=>gt(t)?kt(t):t.signal?`(${t.signal})`:nz(t);function KT(t){if(null!=t.gradient)return function(t){const e=[t.start,t.stop,t.count].map((t=>null==t?null:kt(t)));for(;e.length&&null==M(e);)e.pop();return e.unshift(QT(t.gradient)),`gradient(${e.join(",")})`}(t);let e=t.signal?`(${t.signal})`:t.color?function(t){return t.c?tz("hcl",t.h,t.c,t.l):t.h||t.s?tz("hsl",t.h,t.s,t.l):t.l||t.a?tz("lab",t.l,t.a,t.b):t.r||t.g||t.b?tz("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?nz(t.field):void 0!==t.value?kt(t.value):void 0;return null!=t.scale&&(e=function(t,e){const n=QT(t.scale);null!=t.range?e=`lerp(_range(${n}), ${+t.range})`:(void 0!==e&&(e=`_scale(${n}, ${e})`),t.band&&(e=(e?e+"+":"")+`_bandwidth(${n})`+(1==+t.band?"":"*"+ez(t.band)),t.extra&&(e=`(datum.extra ? _scale(${n}, datum.extra.value) : ${e})`)),null==e&&(e="0"));return e}(t,e)),void 0===e&&(e=null),null!=t.exponent&&(e=`pow(${e},${ez(t.exponent)})`),null!=t.mult&&(e+=`*${ez(t.mult)}`),null!=t.offset&&(e+=`+${ez(t.offset)}`),t.round&&(e=`round(${e})`),e}const tz=(t,e,n,r)=>`(${t}(${[e,n,r].map(KT).join(",")})+'')`;function ez(t){return x(t)?"("+KT(t)+")":t}function nz(t){return rz(x(t)?t:{datum:t})}function rz(t){let e,n,r;if(t.signal)e="datum",r=t.signal;else if(t.group||t.parent){for(n=Math.max(1,t.level||1),e="item";n-- >0;)e+=".mark.group";t.parent?(r=t.parent,e+=".datum"):r=t.group}else t.datum?(e="datum",r=t.datum):s("Invalid field reference: "+kt(t));return t.signal||(r=gt(r)?l(r).map(kt).join("]["):rz(r)),e+"["+r+"]"}function iz(t,e,n,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,e,n,r,i){const o={},a={};let u,s,l,c;for(s in s="lineBreak","text"!==e||null==i[s]||WT(s,t)||ZT(o,s,i[s]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===YT?i.group:n===HT?tt({},i.mark,i[e]):null,c)l=WT(s,t)||("fill"===s||"stroke"===s)&&(WT("fill",t)||WT("stroke",t)),l||ZT(o,s,c[s]);for(s in W(r).forEach((e=>{const n=i.style&&i.style[e];for(const e in n)WT(e,t)||ZT(o,e,n[e])})),t=tt({},t),o)c=o[s],c.signal?(u=u||{})[s]=c:a[s]=c;return t.enter=tt(a,t.enter),u&&(t.update=tt(u,t.update)),t}(t,e,n,r,i.config);for(const n in t)a[n]=oz(t[n],e,o,i);return o}function oz(t,e,n,r){const i={},o={};for(const e in t)null!=t[e]&&(i[e]=az((a=t[e],_(a)?function(t){let e="";return t.forEach((t=>{const n=KT(t);e+=t.test?`(${t.test})?${n}:`:n})),":"===M(e)&&(e+="null"),e}(a):KT(a)),r,n,o));var a;return{$expr:{marktype:e,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function az(t,e,n,r){const i=wB(t,e);return i.$fields.forEach((t=>r[t]=1)),tt(n,i.$params),i.$expr}const uz=["value","update","init","react","bind"];function sz(t,e){s(t+' for "outer" push: '+kt(e))}function lz(t,e){const n=t.name;if("outer"===t.push)e.signals[n]||sz("No prior signal definition",n),uz.forEach((e=>{void 0!==t[e]&&sz("Invalid property ",e)}));else{const r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function cz(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function fz(t,e,n,r){return new cz(t,e,n,r)}function hz(t,e){return fz("operator",t,e)}function dz(t){const e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function pz(t,e){return e?{$field:t,$name:e}:{$field:t}}const gz=pz("key");function mz(t,e){return{$compare:t,$order:e}}function yz(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}const vz="scope",_z="view";function xz(t){return t&&t.signal}function bz(t){if(xz(t))return!0;if(x(t))for(const e in t)if(bz(t[e]))return!0;return!1}function wz(t,e){return null!=t?t:e}function kz(t){return t&&t.signal||t}const Az="timer";function Mz(t,e){return(t.merge?Ez:t.stream?Dz:t.type?Cz:s("Invalid stream specification: "+kt(t)))(t,e)}function Ez(t,e){const n=Fz({merge:t.merge.map((t=>Mz(t,e)))},t,e);return e.addStream(n).id}function Dz(t,e){const n=Fz({stream:Mz(t.stream,e)},t,e);return e.addStream(n).id}function Cz(t,e){let n;t.type===Az?(n=e.event(Az,t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return t===vz?_z:t||_z}(t.source),t.type);const r=Fz({stream:n},t,e);return 1===Object.keys(r).length?n:e.addStream(r).id}function Fz(t,e,n){let r=e.between;return r&&(2!==r.length&&s('Stream "between" parameter must have 2 entries: '+kt(e)),t.between=[Mz(r[0],n),Mz(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),e.source===vz&&r.push("inScope(event.item)"),r.length&&(t.filter=wB("("+r.join(")&&(")+")",n).$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}const Sz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function Bz(t,e,n){const r=t.encode,i={target:n};let o=t.events,a=t.update,u=[];o||s("Signal update missing events specification."),gt(o)&&(o=zT(o,e.isSubscope()?vz:_z)),o=W(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[Tz(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&s("Signal encode and update are mutually exclusive."),a="encode(item(),"+kt(r)+")"),i.update=gt(a)?wB(a,e):null!=a.expr?wB(a.expr,e):null!=a.value?a.value:null!=a.signal?{$expr:Sz,$params:{$value:e.signalRef(a.signal)}}:s("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>e.addUpdate(tt(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):Mz(t,e)}}(t,e),i))))}function Tz(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const zz=t=>(e,n,r)=>fz(t,n,e||void 0,r),Nz=zz("aggregate"),Oz=zz("axisticks"),Rz=zz("bound"),$z=zz("collect"),qz=zz("compare"),Lz=zz("datajoin"),Uz=zz("encode"),Pz=zz("expression"),jz=zz("facet"),Iz=zz("field"),Wz=zz("key"),Hz=zz("legendentries"),Yz=zz("load"),Vz=zz("mark"),Gz=zz("multiextent"),Xz=zz("multivalues"),Jz=zz("overlap"),Zz=zz("params"),Qz=zz("prefacet"),Kz=zz("projection"),tN=zz("proxy"),eN=zz("relay"),nN=zz("render"),rN=zz("scale"),iN=zz("sieve"),oN=zz("sortitems"),aN=zz("viewlayout"),uN=zz("values");let sN=0;const lN={min:"min",max:"max",count:"sum"};function cN(t,e){const n=e.getScale(t.name).params;let r;for(r in n.domain=pN(t.domain,t,e),null!=t.range&&(n.range=wN(t,e,n)),null!=t.interpolate&&function(t,e){e.interpolate=fN(t.type||t),null!=t.gamma&&(e.interpolateGamma=fN(t.gamma))}(t.interpolate,n),null!=t.nice&&(n.nice=function(t){return x(t)?{interval:fN(t.interval),step:fN(t.step)}:fN(t)}(t.nice)),null!=t.bins&&(n.bins=function(t,e){return t.signal||_(t)?hN(t,e):e.objectProperty(t)}(t.bins,e)),t)it(n,r)||"name"===r||(n[r]=fN(t[r],e))}function fN(t,e){return x(t)?t.signal?e.signalRef(t.signal):s("Unsupported object: "+kt(t)):t}function hN(t,e){return t.signal?e.signalRef(t.signal):t.map((t=>fN(t,e)))}function dN(t){s("Can not find data set: "+kt(t))}function pN(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(_(t)?gN:t.fields?yN:mN)(t,e,n);null==e.domainMin&&null==e.domainMax||s("No scale domain defined for domainMin/domainMax to override.")}function gN(t,e,n){return t.map((t=>fN(t,n)))}function mN(t,e,n){const r=n.getData(t.data);return r||dN(t.data),Td(e.type)?r.valuesRef(n,t.field,_N(t.sort,!1)):Rd(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function yN(t,e,n){const r=t.data,i=t.fields.reduce(((t,e)=>(e=gt(e)?{data:r,field:e}:_(e)||e.signal?function(t,e){const n="_:vega:_"+sN++,r=$z({});if(_(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+kt(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,iN({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t)),[]);return(Td(e.type)?vN:Rd(e.type)?xN:bN)(t,n,i)}function vN(t,e,n){const r=_N(t.sort,!0);let i,o;const a=n.map((t=>{const n=e.getData(t.data);return n||dN(t.data),n.countsRef(e,t.field,r)})),u={groupby:gz,pulse:a};r&&(i=r.op||"count",o=r.field?yz(i,r.field):"count",u.ops=[lN[i]],u.fields=[e.fieldRef(o)],u.as=[o]),i=e.add(Nz(u));const s=e.add($z({pulse:dz(i)}));return o=e.add(uN({field:gz,sort:e.sortRef(r),pulse:dz(s)})),dz(o)}function _N(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!lN[t.op]&&s("Multiple domain scales can not be sorted using "+t.op):s("No field provided for sort aggregate op: "+t.op):x(t)?t.field="key":t={field:"key"}),t}function xN(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||dN(t.data),n.domainRef(e,t.field)}));return dz(e.add(Xz({values:r})))}function bN(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||dN(t.data),n.extentRef(e,t.field)}));return dz(e.add(Gz({extents:r})))}function wN(t,e,n){const r=e.config.range;let i=t.range;if(i.signal)return e.signalRef(i.signal);if(gt(i)){if(r&&it(r,i))return wN(t=tt({},t,{range:r[i]}),e,n);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=Td(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:s("Unrecognized scale range value: "+kt(i))}else{if(i.scheme)return n.scheme=_(i.scheme)?hN(i.scheme,e):fN(i.scheme,e),i.extent&&(n.schemeExtent=hN(i.extent,e)),void(i.count&&(n.schemeCount=fN(i.count,e)));if(i.step)return void(n.rangeStep=fN(i.step,e));if(Td(t.type)&&!_(i))return pN(i,t,e);_(i)||s("Unsupported range type: "+kt(i))}return i.map((t=>(_(t)?hN:fN)(t,e)))}function kN(t,e,n){return _(t)?t.map((t=>kN(t,e,n))):x(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:s("Unsupported parameter object: "+kt(t)):t}const AN="top",MN="left",EN="right",DN="bottom",CN="center",FN="index",SN="label",BN="perc",TN="value",zN="guide-label",NN="guide-title",ON="group-title",RN="group-subtitle",$N="symbol",qN="gradient",LN="discrete",UN="size",PN=[UN,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],jN={name:1,style:1,interactive:1},IN={value:0},WN={value:1},HN="group",YN="rect",VN="rule",GN="text";function XN(t){return t.type=HN,t.interactive=t.interactive||!1,t}function JN(t,e){const n=(n,r)=>wz(t[n],wz(e[n],r));return n.isVertical=n=>"vertical"===wz(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>wz(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>wz(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>wz(t.columns,wz(e.columns,+n.isVertical(!0))),n}function ZN(t,e){const n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function QN(t,e,n){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${e} : ${n}`}const KN=QN(kt(MN),kt(EN),kt(CN));function tO(t,e){return e?t?x(t)?Object.assign({},t,{offset:tO(t.offset,e)}):{value:t,offset:e}:e:t}function eO(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=IT(t.encode,e,jN)):t.interactive=!1,t}function nO(t,e,n,r){const i=JN(t,n),o=i.isVertical(),a=i.gradientThickness(),u=i.gradientLength();let s,l,c,f,h;o?(l=[0,1],c=[0,0],f=a,h=u):(l=[0,0],c=[1,0],f=u,h=a);const d={enter:s={opacity:IN,x:IN,y:IN,width:UT(f),height:UT(h)},update:tt({},s,{opacity:WN,fill:{gradient:e,start:l,stop:c}}),exit:{opacity:IN}};return jT(d,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),eO({type:YN,role:"legend-gradient",encode:d},r)}function rO(t,e,n,r,i){const o=JN(t,n),a=o.isVertical(),u=o.gradientThickness(),s=o.gradientLength();let l,c,f,h,d="";a?(l="y",f="y2",c="x",h="width",d="1-"):(l="x",f="x2",c="y",h="height");const p={opacity:IN,fill:{scale:e,field:TN}};p[l]={signal:d+"datum."+BN,mult:s},p[c]=IN,p[f]={signal:d+"datum.perc2",mult:s},p[h]=UT(u);const g={enter:p,update:tt({},p,{opacity:WN}),exit:{opacity:IN}};return jT(g,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),eO({type:YN,role:"legend-band",key:TN,from:i,encode:g},r)}function iO(t,e,n,r){const i=JN(t,e),o=i.isVertical(),a=UT(i.gradientThickness()),u=i.gradientLength();let s,l,c,f,h=i("labelOverlap"),d="";const p={enter:s={opacity:IN},update:l={opacity:WN,text:{field:SN}},exit:{opacity:IN}};return jT(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:wz(t.labelLimit,e.gradientLabelLimit)}),o?(s.align={value:"left"},s.baseline=l.baseline={signal:'datum.perc<=0?"bottom":datum.perc>=1?"top":"middle"'},c="y",f="x",d="1-"):(s.align=l.align={signal:'datum.perc<=0?"left":datum.perc>=1?"right":"center"'},s.baseline={value:"top"},c="x",f="y"),s[c]=l[c]={signal:d+"datum."+BN,mult:u},s[f]=l[f]=a,a.offset=wz(t.labelOffset,e.gradientLabelOffset)||0,h=h?{separation:i("labelSeparation"),method:h,order:"datum.index"}:void 0,eO({type:GN,role:GT,style:zN,key:TN,from:r,encode:p,overlap:h},n)}function oO(t,e,n,r,i){const o=JN(t,e),a=n.entries,u=!(!a||!a.interactive),s=a?a.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},h=`(${i}) ? datum.offset : datum.size`,d=l?UT(l):{field:UN},p="datum.index",g=`max(1, ${i})`;let m,y,v,_,x;d.mult=.5,m={enter:y={opacity:IN,x:{signal:h,mult:.5,offset:c},y:d},update:v={opacity:WN,x:y.x,y:y.y},exit:{opacity:IN}};let b=null,w=null;t.fill||(b=e.symbolBaseFillColor,w=e.symbolBaseStrokeColor),jT(m,{fill:o("symbolFillColor",b),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),PN.forEach((e=>{t[e]&&(v[e]=y[e]={scale:t[e],field:TN})}));const k=eO({type:"symbol",role:"legend-symbol",key:TN,from:f,clip:!!l||void 0,encode:m},n.symbols),A=UT(c);A.offset=o("labelOffset"),m={enter:y={opacity:IN,x:{signal:h,offset:A},y:d},update:v={opacity:WN,text:{field:SN},x:y.x,y:y.y},exit:{opacity:IN}},jT(m,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const M=eO({type:GN,role:GT,style:zN,key:TN,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:IN,height:l?UT(l):IN,opacity:IN},exit:{opacity:IN},update:v={opacity:WN,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(_=`ceil(item.mark.items.length / ${g})`,v.row.signal=`${p}%${_}`,v.column.signal=`floor(${p} / ${_})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${g})`,v.column.signal=`${p} % ${g}`,x={field:p}),v.column.signal=`(${i})?${v.column.signal}:${p}`,XN({role:VT,from:r={facet:{data:r,name:"value",groupby:FN}},encode:IT(m,a,jN),marks:[k,M],name:s,interactive:u,sort:x})}const aO='item.orient === "left"',uO='item.orient === "right"',sO=`(${aO} || ${uO})`,lO=`datum.vgrad && ${sO}`,cO=QN('"top"','"bottom"','"middle"'),fO=`datum.vgrad && ${uO} ? (${QN('"right"','"left"','"center"')}) : (${sO} && !(datum.vgrad && ${aO})) ? "left" : ${KN}`,hO=`item._anchor || (${sO} ? "middle" : "start")`,dO=`${lO} ? (${aO} ? -90 : 90) : 0`,pO=`${sO} ? (datum.vgrad ? (${uO} ? "bottom" : "top") : ${cO}) : "top"`;function gO(t,e){let n;return x(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+mO(t.path)+")":t.sphere&&(n="geoShape("+mO(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function mO(t){return x(t)&&t.signal?t.signal:kt(t)}function yO(t){const e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")&&e.indexOf("title")?t.type===HN?VT:e||HT:e}function vO(t){return{marktype:t.type,name:t.name||void 0,role:t.role||yO(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function _O(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function xO(t,e){const n=$a(t.type);n||s("Unrecognized transform type: "+kt(t.type));const r=fz(n.type.toLowerCase(),null,bO(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function bO(t,e,n){const r={},i=t.params.length;for(let o=0;o<i;++o){const i=t.params[o];r[i.name]=wO(i,e,n)}return r}function wO(t,e,n){const r=t.type,i=e[t.name];return"index"===r?function(t,e,n){gt(e.from)||s('Lookup "from" parameter must be a string literal.');return n.getData(e.from).lookupRef(n,e.key)}(0,e,n):void 0!==i?"param"===r?function(t,e,n){const r=e[t.name];return t.array?(_(r)||s("Expected an array of sub-parameters. Instead: "+kt(r)),r.map((e=>AO(t,e,n)))):AO(t,r,n)}(t,e,n):"projection"===r?n.projectionRef(e[t.name]):t.array&&!xz(i)?i.map((e=>kO(t,e,n))):kO(t,i,n):void(t.required&&s("Missing required "+kt(e.type)+" parameter: "+kt(t.name)))}function kO(t,e,n){const r=t.type;if(xz(e))return CO(r)?s("Expression references can not be signals."):FO(r)?n.fieldRef(e):SO(r)?n.compareRef(e):n.signalRef(e.signal);{const i=t.expr||FO(r);return i&&MO(e)?n.exprRef(e.expr,e.as):i&&EO(e)?pz(e.field,e.as):CO(r)?wB(e,n):DO(r)?dz(n.getData(e).values):FO(r)?pz(e):SO(r)?n.compareRef(e):e}}function AO(t,e,n){const r=t.params.length;let i;for(let n=0;n<r;++n){i=t.params[n];for(const t in i.key)if(i.key[t]!==e[t]){i=null;break}if(i)break}i||s("Unsupported parameter: "+kt(e));const o=tt(bO(i,e,n),i.key);return dz(n.add(Zz(o)))}const MO=t=>t&&t.expr,EO=t=>t&&t.field,DO=t=>"data"===t,CO=t=>"expr"===t,FO=t=>"field"===t,SO=t=>"compare"===t;function BO(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:dz(e.getData(t.data).output)}function TO(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}function zO(t){return gt(t)?t:null}function NO(t,e,n){const r=yz(n.op,n.field);let i;if(e.ops){for(let t=0,n=e.as.length;t<n;++t)if(e.as[t]===r)return}else e.ops=["count"],e.fields=[null],e.as=["count"];n.op&&(e.ops.push((i=n.op.signal)?t.signalRef(i):n.op),e.fields.push(t.fieldRef(n.field)),e.as.push(r))}function OO(t,e,n,r,i,o,a){const u=e[n]||(e[n]={}),s=function(t){return x(t)?("descending"===t.order?"-":"+")+yz(t.op,t.field):""}(o);let l,c,f=zO(i);if(null!=f&&(t=e.scope,f+=s?"|"+s:"",l=u[f]),!l){const n=o?{field:gz,pulse:e.countsRef(t,i,o)}:{field:t.fieldRef(i),pulse:dz(e.output)};s&&(n.sort=t.sortRef(o)),c=t.add(fz(r,void 0,n)),a&&(e.index[i]=c),l=dz(c),null!=f&&(u[f]=l)}return l}function RO(t,e,n){const r=t.remove,i=t.insert,o=t.toggle,a=t.modify,u=t.values,s=e.add(hz()),l=wB("if("+t.trigger+',modify("'+n+'",'+[i,r,o,a,u].map((t=>null==t?"null":t)).join(",")+"),0)",e);s.update=l.$expr,s.params=l.$params}function $O(t,e){const n=yO(t),r=t.type===HN,i=t.from&&t.from.facet,o=t.overlap;let a,u,l,c,f,h,d,p=t.layout||n===VT||n===YT;const g=n===HT||p||i,m=function(t,e,n){let r,i,o,a,u;return t?(r=t.facet)&&(e||s("Only group marks can be faceted."),null!=r.field?a=u=BO(r,n):(t.data?u=dz(n.getData(t.data).aggregate):(o=xO(tt({type:"aggregate",groupby:W(r.groupby)},r.aggregate),n),o.params.key=n.keyRef(r.groupby),o.params.pulse=BO(r,n),a=u=dz(n.add(o))),i=n.keyRef(r.groupby,!0))):a=dz(n.add($z(null,[{}]))),a||(a=BO(t,n)),{key:i,pulse:a,parent:u}}(t.from,r,e);u=e.add(Lz({key:m.key||(t.key?pz(t.key):void 0),pulse:m.pulse,clean:!r}));const y=dz(u);u=l=e.add($z({pulse:y})),u=e.add(Vz({markdef:vO(t),interactive:_O(t.interactive,e),clip:gO(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:dz(u)}));const v=dz(u);u=c=e.add(Uz(iz(t.encode,t.type,n,t.style,e,{mod:!1,pulse:v}))),u.params.parent=e.encode(),t.transform&&t.transform.forEach((t=>{const n=xO(t,e),r=n.metadata;(r.generates||r.changes)&&s("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),n.params.pulse=dz(u),e.add(u=n)})),t.sort&&(u=e.add(oN({sort:e.compareRef(t.sort),pulse:dz(u)})));const _=dz(u);(i||p)&&(p=e.add(aN({layout:e.objectProperty(t.layout),legends:e.legends,mark:v,pulse:_})),h=dz(p));const x=e.add(Rz({mark:v,pulse:h||_}));d=dz(x),r&&(g&&(a=e.operators,a.pop(),p&&a.pop()),e.pushState(_,h||d,y),i?function(t,e,n){const r=t.from.facet,i=r.name,o=BO(r,e);let a;r.name||s("Facet must have a name: "+kt(r)),r.data||s("Facet must reference a data set: "+kt(r)),r.field?a=e.add(Qz({field:e.fieldRef(r.field),pulse:o})):r.groupby?a=e.add(jz({key:e.keyRef(r.groupby),group:dz(e.proxy(n.parent)),pulse:o})):s("Facet must specify groupby or field: "+kt(r));const u=e.fork(),l=u.add($z()),c=u.add(iN({pulse:dz(l)}));u.addData(i,new TO(u,l,l,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,e,m):g?function(t,e,n){const r=e.add(Qz({pulse:n.pulse})),i=e.fork();i.add(iN()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,e,m):e.parse(t),e.popState(),g&&(p&&a.push(p),a.push(x))),o&&(d=function(t,e,n){const r=t.method,i=t.bound,o=t.separation,a={separation:xz(o)?n.signalRef(o.signal):o,method:xz(r)?n.signalRef(r.signal):r,pulse:e};t.order&&(a.sort=n.compareRef({field:t.order}));if(i){const t=i.tolerance;a.boundTolerance=xz(t)?n.signalRef(t.signal):+t,a.boundScale=n.scaleRef(i.scale),a.boundOrient=i.orient}return dz(n.add(Jz(a)))}(o,d,e));const b=e.add(nN({pulse:d})),w=e.add(iN({pulse:dz(b)},void 0,e.parent()));null!=t.name&&(f=t.name,e.addData(f,new TO(e,l,b,w)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&s("Marks only support modify triggers."),RO(t,e,f)})))}function qO(t,e){const n=e.config.legend,r=t.encode||{},i=JN(t,n),o=r.legend||{},a=o.name||void 0,u=o.interactive,l=o.style,c={};let f,h,d,p=0;PN.forEach((e=>t[e]?(c[e]=t[e],p=p||t[e]):0)),p||s("Missing valid scale for legend.");const g=function(t,e){let n=t.type||$N;t.type||1!==function(t){return PN.reduce(((e,n)=>e+(t[n]?1:0)),0)}(t)||!t.fill&&!t.stroke||(n=Bd(e)?qN:zd(e)?LN:$N);return n!==qN?n:zd(e)?LN:qN}(t,e.scaleType(p)),m={title:null!=t.title,scales:c,type:g,vgrad:"symbol"!==g&&i.isVertical()},y=dz(e.add($z(null,[m]))),v=dz(e.add(Hz(h={type:g,scale:e.scaleRef(p),count:e.objectProperty(i("tickCount")),limit:e.property(i("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)})));return g===qN?(d=[nO(t,p,n,r.gradient),iO(t,n,r.labels,v)],h.count=h.count||e.signalRef(`max(2,2*floor((${kz(i.gradientLength())})/100))`)):g===LN?d=[rO(t,p,n,r.gradient,v),iO(t,n,r.labels,v)]:(f=function(t,e){const n=JN(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,n),d=[oO(t,n,r,v,kz(f.columns))],h.size=function(t,e,n){const r=kz(UO("size",t,n)),i=kz(UO("strokeWidth",t,n)),o=kz(function(t,e,n){return ZN("fontSize",t)||function(t,e,n){const r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,zN));return wB(`max(ceil(sqrt(${r})+${i}),${o})`,e)}(t,e,d[0].marks)),d=[XN({role:"legend-entry",from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:f,interactive:u})],m.title&&d.push(function(t,e,n,r){const i=JN(t,e),o={enter:{opacity:IN},update:{opacity:WN,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:IN}};return jT(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:hO},angle:{signal:dO},align:{signal:fO},baseline:{signal:pO},text:t.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),eO({type:GN,role:"legend-title",style:NN,from:r,encode:o},n)}(t,n,r.title,y)),$O(XN({role:"legend",from:y,encode:IT(LO(i,t,n),o,jN),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:l}),e)}function LO(t,e,n){const r={enter:{},update:{}};return jT(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),r}function UO(t,e,n){return e[t]?`scale("${e[t]}",datum)`:ZN(t,n[0].encode)}TO.fromEntries=function(t,e){const n=e.length,r=e[n-1],i=e[n-2];let o=e[0],a=null,u=1;for(o&&"load"===o.type&&(o=e[1]),t.add(e[0]);u<n;++u)e[u].params.pulse=dz(e[u-1]),t.add(e[u]),"aggregate"===e[u].type&&(a=e[u]);return new TO(t,o,i,r,a)},TO.prototype={countsRef(t,e,n){const r=this,i=r.counts||(r.counts={}),o=zO(e);let a,u,s;return null!=o&&(t=r.scope,a=i[o]),a?n&&n.field&&NO(t,a.agg.params,n):(s={groupby:t.fieldRef(e,"key"),pulse:dz(r.output)},n&&n.field&&NO(t,s,n),u=t.add(Nz(s)),a=t.add($z({pulse:dz(u)})),a={agg:u,ref:dz(a)},null!=o&&(i[o]=a)),a.ref},tuplesRef(){return dz(this.values)},extentRef(t,e){return OO(t,this,"extent","extent",e,!1)},domainRef(t,e){return OO(t,this,"domain","values",e,!1)},valuesRef(t,e,n){return OO(t,this,"vals","values",e,n||!0)},lookupRef(t,e){return OO(t,this,"lookup","tupleindex",e,!1)},indataRef(t,e){return OO(t,this,"indata","tupleindex",e,!0,!0)}};function PO(t,e){const n=JN(t=gt(t)?{text:t}:t,e.config.title),r=t.encode||{},i=r.group||{},o=i.name||void 0,a=i.interactive,u=i.style,s=[],l=dz(e.add($z(null,[{}])));return s.push(function(t,e,n,r){const i={value:0},o=t.text,a={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return jT(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("color"),font:e("font"),fontSize:e("fontSize"),fontStyle:e("fontStyle"),fontWeight:e("fontWeight"),lineHeight:e("lineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),eO({type:GN,role:XT,style:ON,from:r,encode:a},n)}(t,n,function(t){const e=t.encode;return e&&e.title||tt({name:t.name,interactive:t.interactive,style:t.style},e)}(t),l)),t.subtitle&&s.push(function(t,e,n,r){const i={value:0},o=t.subtitle,a={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return jT(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("subtitleColor"),font:e("subtitleFont"),fontSize:e("subtitleFontSize"),fontStyle:e("subtitleFontStyle"),fontWeight:e("subtitleFontWeight"),lineHeight:e("subtitleLineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),eO({type:GN,role:JT,style:RN,from:r,encode:a},n)}(t,n,r.subtitle,l)),$O(XN({role:"title",from:l,encode:jO(n,i),marks:s,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:u}),e)}function jO(t,e){const n={enter:{},update:{}};return jT(n,{orient:t("orient"),anchor:t("anchor"),align:{signal:KN},angle:{signal:'item.orient==="left"?-90:item.orient==="right"?90:0'},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),IT(n,e,jN)}function IO(t,e){const n=[];t.transform&&t.transform.forEach((t=>{n.push(xO(t,e))})),t.on&&t.on.forEach((n=>{RO(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){const r=[];let i,o,a,u,s,l=null,c=!1,f=!1;t.values?xz(t.values)||bz(t.format)?(r.push(HO(e,t)),r.push(l=WO())):r.push(l=WO({$ingest:t.values,$format:t.format})):t.url?bz(t.url)||bz(t.format)?(r.push(HO(e,t)),r.push(l=WO())):r.push(l=WO({$request:t.url,$format:t.format})):t.source&&(l=i=W(t.source).map((t=>dz(e.getData(t).output))),r.push(null));for(o=0,a=n.length;o<a;++o)u=n[o],s=u.metadata,l||s.source||r.push(l=WO()),r.push(u),s.generates&&(f=!0),s.modifies&&!f&&(c=!0),s.source?l=u:s.changes&&(l=null);i&&(a=i.length-1,r[0]=eN({derive:c,pulse:a?i:i[0]}),(c||a)&&r.splice(1,0,WO()));l||r.push(WO());return r.push(iN({})),r}(t,e,n))}function WO(t){const e=$z({},t);return e.metadata={source:!0},e}function HO(t,e){return Yz({url:e.url?t.property(e.url):void 0,async:e.async?t.property(e.async):void 0,values:e.values?t.property(e.values):void 0,format:t.objectProperty(e.format)})}const YO=t=>t===DN||t===AN,VO=(t,e,n)=>xz(t)?KO(t.signal,e,n):t===MN||t===AN?e:n,GO=(t,e,n)=>xz(t)?ZO(t.signal,e,n):YO(t)?e:n,XO=(t,e,n)=>xz(t)?QO(t.signal,e,n):YO(t)?n:e,JO=(t,e,n)=>xz(t)?tR(t.signal,e,n):t===AN?{value:e}:{value:n},ZO=(t,e,n)=>nR(`${t} === 'top' || ${t} === 'bottom'`,e,n),QO=(t,e,n)=>nR(`${t} !== 'top' && ${t} !== 'bottom'`,e,n),KO=(t,e,n)=>iR(`${t} === 'left' || ${t} === 'top'`,e,n),tR=(t,e,n)=>iR(`${t} === 'top'`,e,n),eR=(t,e,n)=>iR(`${t} === 'right'`,e,n),nR=(t,e,n)=>(e=null!=e?UT(e):e,n=null!=n?UT(n):n,rR(e)&&rR(n)?{signal:`${t} ? (${e=e?e.signal||kt(e.value):null}) : (${n=n?n.signal||kt(n.value):null})`}:[tt({test:t},e)].concat(n||[])),rR=t=>null==t||1===Object.keys(t).length,iR=(t,e,n)=>({signal:`${t} ? (${aR(e)}) : (${aR(n)})`}),oR=(t,e,n,r,i)=>({signal:(null!=r?`${t} === 'left' ? (${aR(r)}) : `:"")+(null!=n?`${t} === 'bottom' ? (${aR(n)}) : `:"")+(null!=i?`${t} === 'right' ? (${aR(i)}) : `:"")+(null!=e?`${t} === 'top' ? (${aR(e)}) : `:"")+"(null)"}),aR=t=>xz(t)?t.signal:null==t?null:kt(t),uR=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function sR(t,e,n,r){let i;if(e&&it(e,t))return e[t];if(it(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r["guide-title"][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r["guide-label"][i]}return null}function lR(t){const e={};for(const n of t)if(n)for(const t in n)e[t]=1;return Object.keys(e)}function cR(t,e){return{scale:t.scale,range:e}}function fR(t,e,n,r,i){const o=JN(t,e),a=t.orient,u=t.gridScale,s=VO(a,1,-1),l=function(t,e){if(1===e);else if(x(t)){let n=t=tt({},t);for(;null!=n.mult;){if(!x(n.mult))return n.mult=xz(e)?{signal:`(${n.mult}) * (${e.signal})`}:n.mult*e,t;n=n.mult=tt({},n.mult)}n.mult=e}else t=xz(e)?{signal:`(${e.signal}) * (${t||0})`}:e*(t||0);return t}(t.offset,s);let c,f,h;const d={enter:c={opacity:IN},update:h={opacity:WN},exit:f={opacity:IN}};jT(d,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:t.scale,field:TN,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},g=GO(a,{signal:"height"},{signal:"width"}),m=u?{scale:u,range:0,mult:s,offset:l}:{value:0,offset:l},y=u?{scale:u,range:1,mult:s,offset:l}:tt(g,{mult:s,offset:l});return c.x=h.x=GO(a,p,m),c.y=h.y=XO(a,p,m),c.x2=h.x2=XO(a,y),c.y2=h.y2=GO(a,y),f.x=GO(a,p),f.y=XO(a,p),eO({type:VN,role:"axis-grid",key:TN,from:r,encode:d},n)}function hR(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function dR(t,e,n,r,i,o){const a=JN(t,e),u=t.orient,s=t.scale,l=VO(u,-1,1),c=kz(a("labelFlush")),f=kz(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let p,g=0===c||!!c;const m=UT(i);m.mult=l,m.offset=UT(a("labelPadding")||0),m.offset.mult=l;const y={scale:s,field:TN,band:.5,offset:tO(o.offset,a("labelOffset"))},v=GO(u,g?hR(s,c,'"left"','"right"','"center"'):{value:"center"},((t,e,n)=>xz(t)?eR(t.signal,e,n):t===EN?{value:e}:{value:n})(u,"left","right")),_=GO(u,JO(u,"bottom","top"),g?hR(s,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=hR(s,c,`-(${f})`,f,0);g=g&&f;const b={opacity:IN,x:GO(u,y,m),y:XO(u,y,m)},w={enter:b,update:p={opacity:WN,text:{field:SN},x:b.x,y:b.y,align:v,baseline:_},exit:{opacity:IN,x:b.x,y:b.y}};jT(w,{dx:!h&&g?GO(u,x):null,dy:!d&&g?XO(u,x):null}),jT(w,{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:h,baseline:d});const k=a("labelBound");let A=a("labelOverlap");return A=A||k?{separation:a("labelSeparation"),method:A,order:"datum.index",bound:k?{scale:s,orient:u,tolerance:k}:null}:void 0,p.align!==v&&(p.align=uR(p.align,v)),p.baseline!==_&&(p.baseline=uR(p.baseline,_)),eO({type:GN,role:"axis-label",style:zN,key:TN,from:r,encode:w,overlap:A},n)}function pR(t,e,n,r){const i=JN(t,e),o=t.orient,a=VO(o,-1,1);let u,s;const l={enter:u={opacity:IN,anchor:UT(i("titleAnchor",null)),align:{signal:KN}},update:s=tt({},u,{opacity:WN,text:UT(t.title)}),exit:{opacity:IN}},c={signal:`lerp(range("${t.scale}"), ${QN(0,1,.5)})`};return s.x=GO(o,c),s.y=XO(o,c),u.angle=GO(o,IN,((t,e)=>0===e?0:xz(t)?{signal:`(${t.signal}) * ${e}`}:{value:t*e})(a,90)),u.baseline=GO(o,JO(o,DN,AN),{value:DN}),s.angle=u.angle,s.baseline=u.baseline,jT(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(t,e,n,r){const i=(t,e)=>null!=t?(n.update[e]=uR(UT(t),n.update[e]),!1):!WT(e,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");n.enter.auto=a===o?UT(a):GO(e,UT(a),UT(o))}(i,o,l,n),l.update.align=uR(l.update.align,u.align),l.update.angle=uR(l.update.angle,u.angle),l.update.baseline=uR(l.update.baseline,u.baseline),eO({type:GN,role:"axis-title",style:NN,from:r,encode:l},n)}function gR(t,e){const n=function(t,e){var n,r,i,o=e.config,a=o.style,u=o.axis,s="band"===e.scaleType(t.scale)&&o.axisBand,l=t.orient;if(xz(l)){const t=lR([o.axisX,o.axisY]),e=lR([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(n={},t))n[i]=GO(l,sR(i,o.axisX,u,a),sR(i,o.axisY,u,a));for(i of(r={},e))r[i]=oR(l.signal,sR(i,o.axisTop,u,a),sR(i,o.axisBottom,u,a),sR(i,o.axisLeft,u,a),sR(i,o.axisRight,u,a))}else n=l===AN||l===DN?o.axisX:o.axisY,r=o["axis"+l[0].toUpperCase()+l.slice(1)];return n||r||s?tt({},u,n,r,s):u}(t,e),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,u=i.style,s=JN(t,n),l=function(t){const e=t("tickBand");let n,r,i=t("tickOffset");return e?e.signal?(n={signal:`(${e.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${e.signal}) === 'extent'`},x(i)||(i={signal:`(${e.signal}) === 'extent' ? 0 : ${i}`})):"extent"===e?(n=1,r=!0,i=0):(n=.5,r=!1):(n=t("bandPosition"),r=t("tickExtra")),{extra:r,band:n,offset:i}}(s),c={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:null!=t.title},f=dz(e.add($z({},[c]))),h=dz(e.add(Oz({scale:e.scaleRef(t.scale),extra:e.property(l.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),d=[];let p;return c.grid&&d.push(fR(t,n,r.grid,h,l)),c.ticks&&(p=s("tickSize"),d.push(function(t,e,n,r,i,o){const a=JN(t,e),u=t.orient,s=VO(u,-1,1);let l,c,f;const h={enter:l={opacity:IN},update:f={opacity:WN},exit:c={opacity:IN}};jT(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=UT(i);d.mult=s;const p={scale:t.scale,field:TN,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=l.y=GO(u,IN,p),f.y2=l.y2=GO(u,d),c.x=GO(u,p),f.x=l.x=XO(u,IN,p),f.x2=l.x2=XO(u,d),c.y=XO(u,p),eO({type:VN,role:"axis-tick",key:TN,from:r,encode:h},n)}(t,n,r.ticks,h,p,l))),c.labels&&(p=c.ticks?p:0,d.push(dR(t,n,r.labels,h,p,l))),c.domain&&d.push(function(t,e,n,r){const i=JN(t,e),o=t.orient;let a,u;const s={enter:a={opacity:IN},update:u={opacity:WN},exit:{opacity:IN}};jT(s,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=cR(t,0),c=cR(t,1);return a.x=u.x=GO(o,l,IN),a.x2=u.x2=GO(o,c),a.y=u.y=XO(o,l,IN),a.y2=u.y2=XO(o,c),eO({type:VN,role:"axis-domain",from:r,encode:s},n)}(t,n,r.domain,f)),c.title&&d.push(pR(t,n,r.title,f)),$O(XN({role:"axis",from:f,encode:IT(mR(s,t),i,jN),marks:d,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:o,interactive:a,style:u}),e)}function mR(t,e){const n={enter:{},update:{}};return jT(n,{orient:t("orient"),offset:t("offset")||0,position:wz(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${e.scale}")))`},translate:t("translate"),format:e.format,formatType:e.formatType}),n}function yR(t,e,n){const r=W(t.signals),i=W(t.scales);return n||r.forEach((t=>lz(t,e))),W(t.projections).forEach((t=>function(t,e){const n=e.config.projection||{},r={};for(const n in t)"name"!==n&&(r[n]=kN(t[n],n,e));for(const t in n)null==r[t]&&(r[t]=kN(n[t],t,e));e.addProjection(t.name,r)}(t,e))),i.forEach((t=>function(t,e){const n=t.type||"linear";Fd(n)||s("Unrecognized scale type: "+kt(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e))),W(t.data).forEach((t=>IO(t,e))),i.forEach((t=>cN(t,e))),(n||r).forEach((t=>function(t,e){const n=e.getSignal(t.name);let r=t.update;t.init&&(r?s("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=wB(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((t=>Bz(t,e,n.id)))}(t,e))),W(t.axes).forEach((t=>gR(t,e))),W(t.marks).forEach((t=>$O(t,e))),W(t.legends).forEach((t=>qO(t,e))),t.title&&PO(t.title,e),e.parseLambdas(),e}function vR(t,e){const n=e.config,r=dz(e.root=e.add(hz())),i=function(t,e){const n=n=>wz(t[n],e[n]),r=[_R("background",n("background")),_R("autosize",$T(n("autosize"))),_R("padding",LT(n("padding"))),_R("width",n("width")||0),_R("height",n("height")||0)],i=r.reduce(((t,e)=>(t[e.name]=e,t)),{}),o={};return W(t.signals).forEach((t=>{it(i,t.name)?t=tt(i[t.name],t):r.push(t),o[t.name]=t})),W(e.signals).forEach((t=>{it(o,t.name)||it(i,t.name)||r.push(t)})),r}(t,n);i.forEach((t=>lz(t,e))),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const o=e.add($z()),a=e.add(Uz(iz((t=>IT({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),HN,YT,t.style,e,{pulse:dz(o)}))),u=e.add(aN({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:r,pulse:dz(a)}));e.operators.pop(),e.pushState(dz(a),dz(u),null),yR(t,e,i),e.operators.push(u);let s=e.add(Rz({mark:r,pulse:dz(u)}));return s=e.add(nN({pulse:dz(s)})),s=e.add(iN({pulse:dz(s)})),e.addData("root",new TO(e,o,o,s)),e}function _R(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function xR(t,e){this.config=t||{},this.options=e||{},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 bR(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function wR(t){return(_(t)?kR:AR)(t)}function kR(t){const e=t.length;let n="[";for(let r=0;r<e;++r){const e=t[r];n+=(r>0?",":"")+(x(e)?e.signal||wR(e):kt(e))}return n+"]"}function AR(t){let e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+kt(e)+":"+(x(n)?n.signal||wR(n):kt(n));return r+"}"}xR.prototype=bR.prototype={parse(t){return yR(t,this)},fork(){return new bR(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(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((e=>{e.$ref=t.id})),t.refs=null),t},proxy(t){const e=t instanceof cz?dz(t):t;return this.add(tN({value:e}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){let r,i;t&&(r=t.data||(t.data={}),i=r[e]||(r[e]=[]),i.push(n))}for(t in this.data){e=this.data[t],n(e.input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values");for(const r in e.index)n(e.index[r],t,"index:"+r)}return this},pushState(t,e,n){this._encode.push(dz(this.add(iN({pulse:t})))),this._parent.push(e),this._lookup.push(n?dz(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return M(this._parent)},encode(){return M(this._encode)},lookup(){return M(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,e){if(gt(t))return pz(t,e);t.signal||s("Unsupported field reference: "+kt(t));const n=t.signal;let r=this.field[n];if(!r){const t={name:this.signalRef(n)};e&&(t.as=e),this.field[n]=r=dz(this.add(Iz(t)))}return r},compareRef(t){let e=!1;const n=t=>xz(t)?(e=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(e=!0,this.exprRef(t.expr)):t,r=W(t.field).map(n),i=W(t.order).map(n);return e?dz(this.add(qz({fields:r,orders:i}))):mz(r,i)},keyRef(t,e){let n=!1;const r=this.signals;return t=W(t).map((t=>xz(t)?(n=!0,dz(r[t.signal])):t)),n?dz(this.add(Wz({fields:t,flat:e}))):function(t,e){const n={$key:t};return e&&(n.$flat=!0),n}(t,e)},sortRef(t){if(!t)return t;const e=yz(t.op,t.field),n=t.order||"ascending";return n.signal?dz(this.add(qz({fields:e,orders:this.signalRef(n.signal)}))):mz(e,n)},event(t,e){const n=t+":"+e;if(!this.events[n]){const r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},hasOwnSignal(t){return it(this.signals,t)},addSignal(t,e){this.hasOwnSignal(t)&&s("Duplicate signal name: "+kt(t));const n=e instanceof cz?e:this.add(hz(e));return this.signals[t]=n},getSignal(t){return this.signals[t]||s("Unrecognized signal name: "+kt(t)),this.signals[t]},signalRef(t){return this.signals[t]?dz(this.signals[t]):(it(this.lambdas,t)||(this.lambdas[t]=this.add(hz(null))),dz(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let e=0,n=t.length;e<n;++e){const n=t[e],r=wB(n,this),i=this.lambdas[n];i.params=r.$params,i.update=r.$expr}},property(t){return t&&t.signal?this.signalRef(t.signal):t},objectProperty(t){return t&&x(t)?this.signalRef(t.signal||wR(t)):t},exprRef(t,e){const n={expr:wB(t,this)};return e&&(n.expr.$name=e),dz(this.add(Pz(n)))},addBinding(t,e){this.bindings||s("Nested signals do not support binding: "+kt(t)),this.bindings.push(tt({signal:t},e))},addScaleProj(t,e){it(this.scales,t)&&s("Duplicate scale or projection name: "+kt(t)),this.scales[t]=this.add(e)},addScale(t,e){this.addScaleProj(t,rN(e))},addProjection(t,e){this.addScaleProj(t,Kz(e))},getScale(t){return this.scales[t]||s("Unrecognized scale name: "+kt(t)),this.scales[t]},scaleRef(t){return dz(this.getScale(t))},scaleType(t){return this.getScale(t).params.type},projectionRef(t){return this.scaleRef(t)},projectionType(t){return this.scaleType(t)},addData(t,e){return it(this.data,t)&&s("Duplicate data set name: "+kt(t)),this.data[t]=e},getData(t){return this.data[t]||s("Undefined data set name: "+kt(t)),this.data[t]},addDataPipeline(t,e){return it(this.data,t)&&s("Duplicate data set name: "+kt(t)),this.addData(t,TO.fromEntries(this,e))}},tt(Ra,el,rx,Nx,MM,AE,sC,qD,dC,LC,KC,sF);const MR=e;t.Bounds=fg,t.CanvasHandler=jy,t.CanvasRenderer=Vy,t.DATE=Tn,t.DAY=zn,t.DAYOFYEAR=Nn,t.Dataflow=za,t.Debug=4,t.Error=1,t.EventStream=va,t.Gradient=vp,t.GroupItem=dg,t.HOURS=On,t.Handler=Ay,t.Info=3,t.Item=hg,t.MILLISECONDS=qn,t.MINUTES=Rn,t.MONTH=Sn,t.Marks=sy,t.MultiPulse=Ca,t.None=0,t.Operator=ga,t.Parameters=ha,t.Pulse=Aa,t.QUARTER=Fn,t.RenderType=Rv,t.Renderer=Ey,t.ResourceLoader=pg,t.SECONDS=$n,t.SVGHandler=Xy,t.SVGRenderer=_v,t.SVGStringRenderer=zv,t.Scenegraph=my,t.TIME_UNITS=Ln,t.Transform=Oa,t.View=wT,t.WEEK=Bn,t.Warn=2,t.YEAR=Cn,t.accessor=n,t.accessorFields=i,t.accessorName=r,t.array=W,t.ascending=G,t.bandwidthNRD=ja,t.bin=Ia,t.bootstrapCI=Wa,t.boundClip=Wv,t.boundContext=Og,t.boundItem=ly,t.boundMark=fy,t.boundStroke=yg,t.changeset=ca,t.clampRange=H,t.codegenExpression=CS,t.compare=V,t.constant=Q,t.cumulativeLogNormal=ru,t.cumulativeNormal=Za,t.cumulativeUniform=lu,t.dayofyear=Yn,t.debounce=K,t.defaultLocale=Ao,t.definition=$a,t.densityLogNormal=nu,t.densityNormal=Ja,t.densityUniform=su,t.domChild=xy,t.domClear=by,t.domCreate=vy,t.domFind=_y,t.dotbin=Ha,t.error=s,t.expressionFunction=bB,t.extend=tt,t.extent=et,t.extentIndex=nt,t.falsy=m,t.fastmap=at,t.field=c,t.flush=ut,t.font=ty,t.fontFamily=Km,t.fontSize=Gm,t.format=Yo,t.formatLocale=mo,t.formats=Vo,t.hasOwnProperty=it,t.id=f,t.identity=h,t.inferType=Lo,t.inferTypes=Uo,t.ingest=ia,t.inherits=st,t.inrange=lt,t.interpolate=jd,t.interpolateColors=Ld,t.interpolateRange=qd,t.intersect=Lv,t.intersectBoxLine=Yg,t.intersectPath=jg,t.intersectPoint=Ig,t.intersectRule=Hg,t.isArray=_,t.isBoolean=ct,t.isDate=ft,t.isFunction=Y,t.isIterable=ht,t.isNumber=dt,t.isObject=x,t.isRegExp=pt,t.isString=gt,t.isTuple=ea,t.key=mt,t.lerp=yt,t.lineHeight=Xm,t.loader=Jo,t.locale=ko,t.logger=v,t.lruCache=vt,t.markup=hv,t.merge=_t,t.mergeConfig=w,t.multiLineOffset=Zm,t.one=p,t.pad=bt,t.panLinear=z,t.panLog=N,t.panPow=O,t.panSymlog=R,t.parse=function(t,e,n){return x(t)||s("Input Vega specification must be an object."),vR(t,new xR(e=w(function(){const t="sans-serif",e="#4c78a8",n="#000",r="#888",i="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:e},area:{fill:e},image:null,line:{stroke:e,strokeWidth:2},path:{stroke:e},rect:{fill:e},rule:{stroke:n},shape:{stroke:e},symbol:{fill:e,size:64},text:{fill:n,font:t,fontSize:11},trail:{fill:e,size:2},style:{"guide-label":{fill:n,font:t,fontSize:10},"guide-title":{fill:n,font:t,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:t,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:t,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:i}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,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:i,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:r,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"]}}}(),e,t.config),n)).toRuntime()},t.parseExpression=MS,t.parseSelector=zT,t.pathCurves=xp,t.pathEqual=Yv,t.pathParse=kp,t.pathRectangle=Vp,t.pathRender=Np,t.pathSymbols=qp,t.pathTrail=Gp,t.peek=M,t.point=ky,t.projection=VA,t.quantileLogNormal=iu,t.quantileNormal=Qa,t.quantileUniform=cu,t.quantiles=Ua,t.quantizeInterpolator=Ud,t.quarter=j,t.quartiles=Pa,t.randomInteger=function(e,n){let r,i,o;null==n&&(n=e,e=0);const a={min(t){return arguments.length?(r=t||0,o=i-r,a):r},max(t){return arguments.length?(i=t||0,o=i-r,a):i},sample:()=>r+Math.floor(o*t.random()),pdf:t=>t===Math.floor(t)&&t>=r&&t<i?1/o:0,cdf(t){const e=Math.floor(t);return e<r?0:e>=i?1:(e-r+1)/o},icdf:t=>t>=0&&t<=1?r-1+Math.floor(t*o):NaN};return a.min(e).max(n)},t.randomKDE=tu,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=ou,t.randomMixture=au,t.randomNormal=Ka,t.randomUniform=fu,t.read=Xo,t.regressionExp=vu,t.regressionLinear=mu,t.regressionLoess=ku,t.regressionLog=yu,t.regressionPoly=bu,t.regressionPow=_u,t.regressionQuad=xu,t.renderModule=qv,t.repeat=xt,t.resetDefaultLocale=function(){return po(),_o(),Ao()},t.resetSVGClipId=lg,t.resetSVGDefIds=function(){lg(),dp=0},t.responseType=Go,t.runtimeContext=BB,t.sampleCurve=Du,t.sampleLogNormal=eu,t.sampleNormal=Xa,t.sampleUniform=uu,t.scale=Cd,t.sceneEqual=Hv,t.sceneFromJSON=py,t.scenePickVisit=rm,t.sceneToJSON=dy,t.sceneVisit=nm,t.sceneZOrder=em,t.scheme=Yd,t.serializeXML=dv,t.setRandom=function(e){t.random=e},t.span=wt,t.splitAccessPath=l,t.stringValue=kt,t.textMetrics=jm,t.timeBin=Rr,t.timeFloor=sr,t.timeFormatLocale=bo,t.timeInterval=pr,t.timeOffset=yr,t.timeSequence=xr,t.timeUnitSpecifier=In,t.timeUnits=Pn,t.toBoolean=At,t.toDate=Et,t.toNumber=E,t.toSet=Ct,t.toString=Dt,t.transform=qa,t.transforms=Ra,t.truncate=Ft,t.truthy=g,t.tupleid=na,t.typeParsers=Ro,t.utcFloor=fr,t.utcInterval=gr,t.utcOffset=vr,t.utcSequence=br,t.utcdayofyear=Qn,t.utcquarter=I,t.utcweek=Kn,t.version=MR,t.visitArray=St,t.week=Vn,t.writeConfig=k,t.zero=d,t.zoomLinear=q,t.zoomLog=L,t.zoomPow=U,t.zoomSymlog=P,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=vega.min.js.map

A web/vega-embed-6.20.2.js => web/vega-embed-6.20.2.js +22 -0
@@ 0,0 1,22 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vega"),require("vega-lite")):"function"==typeof define&&define.amd?define(["vega","vega-lite"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).vegaEmbed=t(e.vega,e.vegaLite)}(this,(function(e,t){"use strict";function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o,r=n(e),i=n(t),a=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},o(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=Object.prototype.hasOwnProperty;function c(e,t){return s.call(e,t)}function l(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);t=[];for(var o in e)c(e,o)&&t.push(o);return t}function h(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function p(e){for(var t,n=0,o=e.length;n<o;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function u(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function d(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function f(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(f(e[t]))return!0}else if("object"==typeof e){var o=l(e),r=o.length;for(t=0;t<r;t++)if(f(e[o[t]]))return!0}return!1}function g(e,t){var n=[e];for(var o in t){var r="object"==typeof t[o]?JSON.stringify(t[o],null,2):t[o];void 0!==r&&n.push(o+": "+r)}return n.join("\n")}var v=function(e){function t(t,n,o,r,i){var a=this.constructor,s=e.call(this,g(t,{name:n,index:o,operation:r,tree:i}))||this;return s.name=n,s.index=o,s.operation=r,s.tree=i,Object.setPrototypeOf(s,a.prototype),s.message=g(t,{name:n,index:o,operation:r,tree:i}),s}return a(t,e),t}(Error),m=v,E=h,b={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var o=e[t];return delete e[t],{newDocument:n,removed:o}},replace:function(e,t,n){var o=e[t];return e[t]=this.value,{newDocument:n,removed:o}},move:function(e,t,n){var o=w(n,this.path);o&&(o=h(o));var r=O(n,{op:"remove",path:this.from}).removed;return O(n,{op:"add",path:this.path,value:r}),{newDocument:n,removed:o}},copy:function(e,t,n){var o=w(n,this.from);return O(n,{op:"add",path:this.path,value:h(o)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:N(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},y={add:function(e,t,n){return p(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var o=e[t];return e[t]=this.value,{newDocument:n,removed:o}},move:b.move,copy:b.copy,test:b.test,_get:b._get};function w(e,t){if(""==t)return e;var n={op:"_get",path:t};return O(e,n),n.value}function O(e,t,n,o,r,i){if(void 0===n&&(n=!1),void 0===o&&(o=!0),void 0===r&&(r=!0),void 0===i&&(i=0),n&&("function"==typeof n?n(t,0,e,t.path):x(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=w(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=N(e,t.value),!1===a.test)throw new m("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(n)throw new m("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}o||(e=h(e));var s=(t.path||"").split("/"),c=e,l=1,u=s.length,f=void 0,g=void 0,v=void 0;for(v="function"==typeof n?n:x;;){if((g=s[l])&&-1!=g.indexOf("~")&&(g=d(g)),r&&"__proto__"==g)throw new TypeError("JSON-Patch: modifying `__proto__` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===f&&(void 0===c[g]?f=s.slice(0,l).join("/"):l==u-1&&(f=t.path),void 0!==f&&v(t,0,e,f)),l++,Array.isArray(c)){if("-"===g)g=c.length;else{if(n&&!p(g))throw new m("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);p(g)&&(g=~~g)}if(l>=u){if(n&&"add"===t.op&&g>c.length)throw new m("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);if(!1===(a=y[t.op].call(t,c,g,e)).test)throw new m("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(l>=u){if(!1===(a=b[t.op].call(t,c,g,e)).test)throw new m("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}if(c=c[g],n&&l<u&&(!c||"object"!=typeof c))throw new m("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,t,e)}}function A(e,t,n,o,r){if(void 0===o&&(o=!0),void 0===r&&(r=!0),n&&!Array.isArray(t))throw new m("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");o||(e=h(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=O(e,t[a],n,!0,r,a),e=i[a].newDocument;return i.newDocument=e,i}function x(e,t,n,o){if("object"!=typeof e||null===e||Array.isArray(e))throw new m("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!b[e.op])throw new m("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new m("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new m('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new m("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new m("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&f(e.value))throw new m("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var r=e.path.split("/").length,i=o.split("/").length;if(r!==i+1&&r!==i)throw new m("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==o)throw new m("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=I([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new m("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function I(e,t,n){try{if(!Array.isArray(e))throw new m("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)A(h(t),h(e),n||!0);else{n=n||x;for(var o=0;o<e.length;o++)n(e[o],o,t,void 0)}}catch(e){if(e instanceof m)return e;throw e}}function N(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,o,r,i=Array.isArray(e),a=Array.isArray(t);if(i&&a){if((o=e.length)!=t.length)return!1;for(n=o;0!=n--;)if(!N(e[n],t[n]))return!1;return!0}if(i!=a)return!1;var s=Object.keys(e);if((o=s.length)!==Object.keys(t).length)return!1;for(n=o;0!=n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=o;0!=n--;)if(!N(e[r=s[n]],t[r]))return!1;return!0}return e!=e&&t!=t}var R=Object.freeze({__proto__:null,JsonPatchError:m,deepClone:E,getValueByPointer:w,applyOperation:O,applyPatch:A,applyReducer:function(e,t,n){var o=O(e,t);if(!1===o.test)throw new m("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return o.newDocument},validator:x,validate:I,_areEquals:N}),T=new WeakMap,L=function(e){this.observers=new Map,this.obj=e},S=function(e,t){this.callback=e,this.observer=t};
/*!
     * https://github.com/Starcounter-Jack/JSON-Patch
     * (c) 2017 Joachim Wester
     * MIT license
     */function D(e,t){void 0===t&&(t=!1);var n=T.get(e.object);C(n.value,e.object,e.patches,"",t),e.patches.length&&A(n.value,e.patches);var o=e.patches;return o.length>0&&(e.patches=[],e.callback&&e.callback(o)),o}function C(e,t,n,o,r){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var i=l(t),a=l(e),s=!1,p=a.length-1;p>=0;p--){var d=e[g=a[p]];if(!c(t,g)||void 0===t[g]&&void 0!==d&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:o+"/"+u(g),value:h(d)}),n.push({op:"remove",path:o+"/"+u(g)}),s=!0):(r&&n.push({op:"test",path:o,value:e}),n.push({op:"replace",path:o,value:t}));else{var f=t[g];"object"==typeof d&&null!=d&&"object"==typeof f&&null!=f&&Array.isArray(d)===Array.isArray(f)?C(d,f,n,o+"/"+u(g),r):d!==f&&(r&&n.push({op:"test",path:o+"/"+u(g),value:h(d)}),n.push({op:"replace",path:o+"/"+u(g),value:h(f)}))}}if(s||i.length!=a.length)for(p=0;p<i.length;p++){var g;c(e,g=i[p])||void 0===t[g]||n.push({op:"add",path:o+"/"+u(g),value:h(t[g])})}}}var F=Object.freeze({__proto__:null,unobserve:function(e,t){t.unobserve()},observe:function(e,t){var n,o=function(e){return T.get(e)}(e);if(o){var r=function(e,t){return e.observers.get(t)}(o,t);n=r&&r.observer}else o=new L(e),T.set(e,o);if(n)return n;if(n={},o.value=h(e),t){n.callback=t,n.next=null;var i=function(){D(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(i)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=e,n.unobserve=function(){D(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(o,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},o.observers.set(t,new S(t,n)),n},generate:D,compare:function(e,t,n){void 0===n&&(n=!1);var o=[];return C(e,t,o,"",n),o}});Object.assign({},R,F,{JsonPatchError:v,deepClone:h,escapePathComponent:u,unescapePathComponent:d});var k=/("(?:[^\\"]|\\.)*")|[:,]/g,P=function(e,t){var n,o,r;return t=t||{},n=JSON.stringify([1],void 0,void 0===t.indent?2:t.indent).slice(2,-3),o=""===n?1/0:void 0===t.maxLength?80:t.maxLength,r=t.replacer,function e(t,i,a){var s,c,l,h,p,u,d,f,g,v,m,E;if(t&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===(m=JSON.stringify(t,r)))return m;if(d=o-i.length-a,m.length<=d&&(g=m.replace(k,(function(e,t){return t||e+" "}))).length<=d)return g;if(null!=r&&(t=JSON.parse(m),r=void 0),"object"==typeof t&&null!==t){if(f=i+n,l=[],c=0,Array.isArray(t))for(v="[",s="]",d=t.length;c<d;c++)l.push(e(t[c],f,c===d-1?0:1)||"null");else for(v="{",s="}",d=(u=Object.keys(t)).length;c<d;c++)h=u[c],p=JSON.stringify(h)+": ",void 0!==(E=e(t[h],f,p.length+(c===d-1?0:1)))&&l.push(p+E);if(l.length>0)return[v,n+l.join(",\n"+f),s].join("\n"+i)}return m}(e,"",0)},_=M;function M(e){var t=this;if(t instanceof M||(t=new M),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var n=0,o=arguments.length;n<o;n++)t.push(arguments[n]);return t}function j(e,t,n){var o=t===e.head?new B(n,null,t,e):new B(n,t,t.next,e);return null===o.next&&(e.tail=o),null===o.prev&&(e.head=o),e.length++,o}function z(e,t){e.tail=new B(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function U(e,t){e.head=new B(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function B(e,t,n,o){if(!(this instanceof B))return new B(e,t,n,o);this.list=o,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}M.Node=B,M.create=M,M.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},M.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},M.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},M.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)z(this,arguments[e]);return this.length},M.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)U(this,arguments[e]);return this.length},M.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},M.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},M.prototype.forEach=function(e,t){t=t||this;for(var n=this.head,o=0;null!==n;o++)e.call(t,n.value,o,this),n=n.next},M.prototype.forEachReverse=function(e,t){t=t||this;for(var n=this.tail,o=this.length-1;null!==n;o--)e.call(t,n.value,o,this),n=n.prev},M.prototype.get=function(e){for(var t=0,n=this.head;null!==n&&t<e;t++)n=n.next;if(t===e&&null!==n)return n.value},M.prototype.getReverse=function(e){for(var t=0,n=this.tail;null!==n&&t<e;t++)n=n.prev;if(t===e&&null!==n)return n.value},M.prototype.map=function(e,t){t=t||this;for(var n=new M,o=this.head;null!==o;)n.push(e.call(t,o.value,this)),o=o.next;return n},M.prototype.mapReverse=function(e,t){t=t||this;for(var n=new M,o=this.tail;null!==o;)n.push(e.call(t,o.value,this)),o=o.prev;return n},M.prototype.reduce=function(e,t){var n,o=this.head;if(arguments.length>1)n=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");o=this.head.next,n=this.head.value}for(var r=0;null!==o;r++)n=e(n,o.value,r),o=o.next;return n},M.prototype.reduceReverse=function(e,t){var n,o=this.tail;if(arguments.length>1)n=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");o=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==o;r--)n=e(n,o.value,r),o=o.prev;return n},M.prototype.toArray=function(){for(var e=new Array(this.length),t=0,n=this.head;null!==n;t++)e[t]=n.value,n=n.next;return e},M.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,n=this.tail;null!==n;t++)e[t]=n.value,n=n.prev;return e},M.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new M;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var o=0,r=this.head;null!==r&&o<e;o++)r=r.next;for(;null!==r&&o<t;o++,r=r.next)n.push(r.value);return n},M.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var n=new M;if(t<e||t<0)return n;e<0&&(e=0),t>this.length&&(t=this.length);for(var o=this.length,r=this.tail;null!==r&&o>t;o--)r=r.prev;for(;null!==r&&o>e;o--,r=r.prev)n.push(r.value);return n},M.prototype.splice=function(e,t){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var n=0,o=this.head;null!==o&&n<e;n++)o=o.next;var r=[];for(n=0;o&&n<t;n++)r.push(o.value),o=this.removeNode(o);null===o&&(o=this.tail),o!==this.head&&o!==this.tail&&(o=o.prev);for(n=0;n<(arguments.length<=2?0:arguments.length-2);n++)o=j(this,o,n+2<2||arguments.length<=n+2?void 0:arguments[n+2]);return r},M.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;null!==n;n=n.prev){var o=n.prev;n.prev=n.next,n.next=o}return this.head=t,this.tail=e,this};try{require("./iterator.js")(M)}catch(e){}const G=_,X=Symbol("max"),V=Symbol("length"),W=Symbol("lengthCalculator"),H=Symbol("allowStale"),$=Symbol("maxAge"),q=Symbol("dispose"),Y=Symbol("noDisposeOnSet"),J=Symbol("lruList"),Q=Symbol("cache"),Z=Symbol("updateAgeOnGet"),K=()=>1;const ee=(e,t,n)=>{const o=e[Q].get(t);if(o){const t=o.value;if(te(e,t)){if(oe(e,o),!e[H])return}else n&&(e[Z]&&(o.value.now=Date.now()),e[J].unshiftNode(o));return t.value}},te=(e,t)=>{if(!t||!t.maxAge&&!e[$])return!1;const n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[$]&&n>e[$]},ne=e=>{if(e[V]>e[X])for(let t=e[J].tail;e[V]>e[X]&&null!==t;){const n=t.prev;oe(e,t),t=n}},oe=(e,t)=>{if(t){const n=t.value;e[q]&&e[q](n.key,n.value),e[V]-=n.length,e[Q].delete(n.key),e[J].removeNode(t)}};class re{constructor(e,t,n,o,r){this.key=e,this.value=t,this.length=n,this.now=o,this.maxAge=r||0}}const ie=(e,t,n,o)=>{let r=n.value;te(e,r)&&(oe(e,n),e[H]||(r=void 0)),r&&t.call(o,r.value,r.key,e)};var ae=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[X]=e.max||1/0;const t=e.length||K;if(this[W]="function"!=typeof t?K:t,this[H]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[$]=e.maxAge||0,this[q]=e.dispose,this[Y]=e.noDisposeOnSet||!1,this[Z]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[X]=e||1/0,ne(this)}get max(){return this[X]}set allowStale(e){this[H]=!!e}get allowStale(){return this[H]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[$]=e,ne(this)}get maxAge(){return this[$]}set lengthCalculator(e){"function"!=typeof e&&(e=K),e!==this[W]&&(this[W]=e,this[V]=0,this[J].forEach((e=>{e.length=this[W](e.value,e.key),this[V]+=e.length}))),ne(this)}get lengthCalculator(){return this[W]}get length(){return this[V]}get itemCount(){return this[J].length}rforEach(e,t){t=t||this;for(let n=this[J].tail;null!==n;){const o=n.prev;ie(this,e,n,t),n=o}}forEach(e,t){t=t||this;for(let n=this[J].head;null!==n;){const o=n.next;ie(this,e,n,t),n=o}}keys(){return this[J].toArray().map((e=>e.key))}values(){return this[J].toArray().map((e=>e.value))}reset(){this[q]&&this[J]&&this[J].length&&this[J].forEach((e=>this[q](e.key,e.value))),this[Q]=new Map,this[J]=new G,this[V]=0}dump(){return this[J].map((e=>!te(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[J]}set(e,t,n){if((n=n||this[$])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const o=n?Date.now():0,r=this[W](t,e);if(this[Q].has(e)){if(r>this[X])return oe(this,this[Q].get(e)),!1;const i=this[Q].get(e).value;return this[q]&&(this[Y]||this[q](e,i.value)),i.now=o,i.maxAge=n,i.value=t,this[V]+=r-i.length,i.length=r,this.get(e),ne(this),!0}const i=new re(e,t,r,o,n);return i.length>this[X]?(this[q]&&this[q](e,t),!1):(this[V]+=i.length,this[J].unshift(i),this[Q].set(e,this[J].head),ne(this),!0)}has(e){if(!this[Q].has(e))return!1;const t=this[Q].get(e).value;return!te(this,t)}get(e){return ee(this,e,!0)}peek(e){return ee(this,e,!1)}pop(){const e=this[J].tail;return e?(oe(this,e),e.value):null}del(e){oe(this,this[Q].get(e))}load(e){this.reset();const t=Date.now();for(let n=e.length-1;n>=0;n--){const o=e[n],r=o.e||0;if(0===r)this.set(o.k,o.v);else{const e=r-t;e>0&&this.set(o.k,o.v,e)}}}prune(){this[Q].forEach(((e,t)=>ee(this,t,!1)))}};const se=["includePrerelease","loose","rtl"];var ce=e=>e?"object"!=typeof e?{loose:!0}:se.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{},le={exports:{}};var he={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,MAX_SAFE_COMPONENT_LENGTH:16};const pe="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return console.error("SEMVER",...t)}:()=>{};var ue=pe;!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n}=he,o=ue,r=(t=e.exports={}).re=[],i=t.src=[],a=t.t={};let s=0;const c=(e,t,n)=>{const c=s++;o(c,t),a[e]=c,i[c]=t,r[c]=new RegExp(t,n?"g":void 0)};c("NUMERICIDENTIFIER","0|[1-9]\\d*"),c("NUMERICIDENTIFIERLOOSE","[0-9]+"),c("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),c("MAINVERSION","(".concat(i[a.NUMERICIDENTIFIER],")\\.")+"(".concat(i[a.NUMERICIDENTIFIER],")\\.")+"(".concat(i[a.NUMERICIDENTIFIER],")")),c("MAINVERSIONLOOSE","(".concat(i[a.NUMERICIDENTIFIERLOOSE],")\\.")+"(".concat(i[a.NUMERICIDENTIFIERLOOSE],")\\.")+"(".concat(i[a.NUMERICIDENTIFIERLOOSE],")")),c("PRERELEASEIDENTIFIER","(?:".concat(i[a.NUMERICIDENTIFIER],"|").concat(i[a.NONNUMERICIDENTIFIER],")")),c("PRERELEASEIDENTIFIERLOOSE","(?:".concat(i[a.NUMERICIDENTIFIERLOOSE],"|").concat(i[a.NONNUMERICIDENTIFIER],")")),c("PRERELEASE","(?:-(".concat(i[a.PRERELEASEIDENTIFIER],"(?:\\.").concat(i[a.PRERELEASEIDENTIFIER],")*))")),c("PRERELEASELOOSE","(?:-?(".concat(i[a.PRERELEASEIDENTIFIERLOOSE],"(?:\\.").concat(i[a.PRERELEASEIDENTIFIERLOOSE],")*))")),c("BUILDIDENTIFIER","[0-9A-Za-z-]+"),c("BUILD","(?:\\+(".concat(i[a.BUILDIDENTIFIER],"(?:\\.").concat(i[a.BUILDIDENTIFIER],")*))")),c("FULLPLAIN","v?".concat(i[a.MAINVERSION]).concat(i[a.PRERELEASE],"?").concat(i[a.BUILD],"?")),c("FULL","^".concat(i[a.FULLPLAIN],"$")),c("LOOSEPLAIN","[v=\\s]*".concat(i[a.MAINVERSIONLOOSE]).concat(i[a.PRERELEASELOOSE],"?").concat(i[a.BUILD],"?")),c("LOOSE","^".concat(i[a.LOOSEPLAIN],"$")),c("GTLT","((?:<|>)?=?)"),c("XRANGEIDENTIFIERLOOSE","".concat(i[a.NUMERICIDENTIFIERLOOSE],"|x|X|\\*")),c("XRANGEIDENTIFIER","".concat(i[a.NUMERICIDENTIFIER],"|x|X|\\*")),c("XRANGEPLAIN","[v=\\s]*(".concat(i[a.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(i[a.XRANGEIDENTIFIER],")")+"(?:\\.(".concat(i[a.XRANGEIDENTIFIER],")")+"(?:".concat(i[a.PRERELEASE],")?").concat(i[a.BUILD],"?")+")?)?"),c("XRANGEPLAINLOOSE","[v=\\s]*(".concat(i[a.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(i[a.XRANGEIDENTIFIERLOOSE],")")+"(?:\\.(".concat(i[a.XRANGEIDENTIFIERLOOSE],")")+"(?:".concat(i[a.PRERELEASELOOSE],")?").concat(i[a.BUILD],"?")+")?)?"),c("XRANGE","^".concat(i[a.GTLT],"\\s*").concat(i[a.XRANGEPLAIN],"$")),c("XRANGELOOSE","^".concat(i[a.GTLT],"\\s*").concat(i[a.XRANGEPLAINLOOSE],"$")),c("COERCE","".concat("(^|[^\\d])(\\d{1,").concat(n,"})")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:\\.(\\d{1,".concat(n,"}))?")+"(?:$|[^\\d])"),c("COERCERTL",i[a.COERCE],!0),c("LONETILDE","(?:~>?)"),c("TILDETRIM","(\\s*)".concat(i[a.LONETILDE],"\\s+"),!0),t.tildeTrimReplace="$1~",c("TILDE","^".concat(i[a.LONETILDE]).concat(i[a.XRANGEPLAIN],"$")),c("TILDELOOSE","^".concat(i[a.LONETILDE]).concat(i[a.XRANGEPLAINLOOSE],"$")),c("LONECARET","(?:\\^)"),c("CARETTRIM","(\\s*)".concat(i[a.LONECARET],"\\s+"),!0),t.caretTrimReplace="$1^",c("CARET","^".concat(i[a.LONECARET]).concat(i[a.XRANGEPLAIN],"$")),c("CARETLOOSE","^".concat(i[a.LONECARET]).concat(i[a.XRANGEPLAINLOOSE],"$")),c("COMPARATORLOOSE","^".concat(i[a.GTLT],"\\s*(").concat(i[a.LOOSEPLAIN],")$|^$")),c("COMPARATOR","^".concat(i[a.GTLT],"\\s*(").concat(i[a.FULLPLAIN],")$|^$")),c("COMPARATORTRIM","(\\s*)".concat(i[a.GTLT],"\\s*(").concat(i[a.LOOSEPLAIN],"|").concat(i[a.XRANGEPLAIN],")"),!0),t.comparatorTrimReplace="$1$2$3",c("HYPHENRANGE","^\\s*(".concat(i[a.XRANGEPLAIN],")")+"\\s+-\\s+"+"(".concat(i[a.XRANGEPLAIN],")")+"\\s*$"),c("HYPHENRANGELOOSE","^\\s*(".concat(i[a.XRANGEPLAINLOOSE],")")+"\\s+-\\s+"+"(".concat(i[a.XRANGEPLAINLOOSE],")")+"\\s*$"),c("STAR","(<|>)?=?\\s*\\*"),c("GTE0","^\\s*>=\\s*0.0.0\\s*$"),c("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")}(le,le.exports);const de=/^[0-9]+$/,fe=(e,t)=>{const n=de.test(e),o=de.test(t);return n&&o&&(e=+e,t=+t),e===t?0:n&&!o?-1:o&&!n?1:e<t?-1:1};var ge={compareIdentifiers:fe,rcompareIdentifiers:(e,t)=>fe(t,e)};const ve=ue,{MAX_LENGTH:me,MAX_SAFE_INTEGER:Ee}=he,{re:be,t:ye}=le.exports,we=ce,{compareIdentifiers:Oe}=ge;class Ae{constructor(e,t){if(t=we(t),e instanceof Ae){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: ".concat(e));if(e.length>me)throw new TypeError("version is longer than ".concat(me," characters"));ve("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?be[ye.LOOSE]:be[ye.FULL]);if(!n)throw new TypeError("Invalid Version: ".concat(e));if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Ee||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Ee||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Ee||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<Ee)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version="".concat(this.major,".").concat(this.minor,".").concat(this.patch),this.prerelease.length&&(this.version+="-".concat(this.prerelease.join("."))),this.version}toString(){return this.version}compare(e){if(ve("SemVer.compare",this.version,this.options,e),!(e instanceof Ae)){if("string"==typeof e&&e===this.version)return 0;e=new Ae(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof Ae||(e=new Ae(e,this.options)),Oe(this.major,e.major)||Oe(this.minor,e.minor)||Oe(this.patch,e.patch)}comparePre(e){if(e instanceof Ae||(e=new Ae(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],o=e.prerelease[t];if(ve("prerelease compare",t,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return Oe(n,o)}while(++t)}compareBuild(e){e instanceof Ae||(e=new Ae(e,this.options));let t=0;do{const n=this.build[t],o=e.build[t];if(ve("prerelease compare",t,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return Oe(n,o)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: ".concat(e))}return this.format(),this.raw=this.version,this}}var xe=Ae;const Ie=xe;var Ne=(e,t,n)=>new Ie(e,n).compare(new Ie(t,n));const Re=Ne;const Te=Ne;const Le=Ne;const Se=Ne;const De=Ne;const Ce=Ne;const Fe=(e,t,n)=>0===Re(e,t,n),ke=(e,t,n)=>0!==Te(e,t,n),Pe=(e,t,n)=>Le(e,t,n)>0,_e=(e,t,n)=>Se(e,t,n)>=0,Me=(e,t,n)=>De(e,t,n)<0,je=(e,t,n)=>Ce(e,t,n)<=0;var ze=(e,t,n,o)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return Fe(e,n,o);case"!=":return ke(e,n,o);case">":return Pe(e,n,o);case">=":return _e(e,n,o);case"<":return Me(e,n,o);case"<=":return je(e,n,o);default:throw new TypeError("Invalid operator: ".concat(t))}};const Ue=Symbol("SemVer ANY");class Be{static get ANY(){return Ue}constructor(e,t){if(t=Xe(t),e instanceof Be){if(e.loose===!!t.loose)return e;e=e.value}$e("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===Ue?this.value="":this.value=this.operator+this.semver.version,$e("comp",this)}parse(e){const t=this.options.loose?Ve[We.COMPARATORLOOSE]:Ve[We.COMPARATOR],n=e.match(t);if(!n)throw new TypeError("Invalid comparator: ".concat(e));this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new qe(n[2],this.options.loose):this.semver=Ue}toString(){return this.value}test(e){if($e("Comparator.test",e,this.options.loose),this.semver===Ue||e===Ue)return!0;if("string"==typeof e)try{e=new qe(e,this.options)}catch(e){return!1}return He(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Be))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new Ye(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new Ye(this.value,t).test(e.semver);const n=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),o=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),r=this.semver.version===e.semver.version,i=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=He(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),s=He(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return n||o||r&&i||a||s}}var Ge=Be;const Xe=ce,{re:Ve,t:We}=le.exports,He=ze,$e=ue,qe=xe,Ye=Qe;class Je{constructor(e,t){if(t=Ke(t),e instanceof Je)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new Je(e.raw,t);if(e instanceof et)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError("Invalid SemVer Range: ".concat(e));if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!ct(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&lt(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=Object.keys(this.options).join(","),n="parseRange:".concat(t,":").concat(e),o=Ze.get(n);if(o)return o;const r=this.options.loose,i=r?ot[rt.HYPHENRANGELOOSE]:ot[rt.HYPHENRANGE];e=e.replace(i,wt(this.options.includePrerelease)),tt("hyphen replace",e),e=e.replace(ot[rt.COMPARATORTRIM],it),tt("comparator trim",e,ot[rt.COMPARATORTRIM]),e=(e=(e=e.replace(ot[rt.TILDETRIM],at)).replace(ot[rt.CARETTRIM],st)).split(/\s+/).join(" ");const a=r?ot[rt.COMPARATORLOOSE]:ot[rt.COMPARATOR],s=e.split(" ").map((e=>pt(e,this.options))).join(" ").split(/\s+/).map((e=>yt(e,this.options))).filter(this.options.loose?e=>!!e.match(a):()=>!0).map((e=>new et(e,this.options)));s.length;const c=new Map;for(const e of s){if(ct(e))return[e];c.set(e.value,e)}c.size>1&&c.has("")&&c.delete("");const l=[...c.values()];return Ze.set(n,l),l}intersects(e,t){if(!(e instanceof Je))throw new TypeError("a Range is required");return this.set.some((n=>ht(n,t)&&e.set.some((e=>ht(e,t)&&n.every((n=>e.every((e=>n.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new nt(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(Ot(this.set[t],e,this.options))return!0;return!1}}var Qe=Je;const Ze=new ae({max:1e3}),Ke=ce,et=Ge,tt=ue,nt=xe,{re:ot,t:rt,comparatorTrimReplace:it,tildeTrimReplace:at,caretTrimReplace:st}=le.exports,ct=e=>"<0.0.0-0"===e.value,lt=e=>""===e.value,ht=(e,t)=>{let n=!0;const o=e.slice();let r=o.pop();for(;n&&o.length;)n=o.every((e=>r.intersects(e,t))),r=o.pop();return n},pt=(e,t)=>(tt("comp",e,t),e=gt(e,t),tt("caret",e),e=dt(e,t),tt("tildes",e),e=mt(e,t),tt("xrange",e),e=bt(e,t),tt("stars",e),e),ut=e=>!e||"x"===e.toLowerCase()||"*"===e,dt=(e,t)=>e.trim().split(/\s+/).map((e=>ft(e,t))).join(" "),ft=(e,t)=>{const n=t.loose?ot[rt.TILDELOOSE]:ot[rt.TILDE];return e.replace(n,((t,n,o,r,i)=>{let a;return tt("tilde",e,t,n,o,r,i),ut(n)?a="":ut(o)?a=">=".concat(n,".0.0 <").concat(+n+1,".0.0-0"):ut(r)?a=">=".concat(n,".").concat(o,".0 <").concat(n,".").concat(+o+1,".0-0"):i?(tt("replaceTilde pr",i),a=">=".concat(n,".").concat(o,".").concat(r,"-").concat(i," <").concat(n,".").concat(+o+1,".0-0")):a=">=".concat(n,".").concat(o,".").concat(r," <").concat(n,".").concat(+o+1,".0-0"),tt("tilde return",a),a}))},gt=(e,t)=>e.trim().split(/\s+/).map((e=>vt(e,t))).join(" "),vt=(e,t)=>{tt("caret",e,t);const n=t.loose?ot[rt.CARETLOOSE]:ot[rt.CARET],o=t.includePrerelease?"-0":"";return e.replace(n,((t,n,r,i,a)=>{let s;return tt("caret",e,t,n,r,i,a),ut(n)?s="":ut(r)?s=">=".concat(n,".0.0").concat(o," <").concat(+n+1,".0.0-0"):ut(i)?s="0"===n?">=".concat(n,".").concat(r,".0").concat(o," <").concat(n,".").concat(+r+1,".0-0"):">=".concat(n,".").concat(r,".0").concat(o," <").concat(+n+1,".0.0-0"):a?(tt("replaceCaret pr",a),s="0"===n?"0"===r?">=".concat(n,".").concat(r,".").concat(i,"-").concat(a," <").concat(n,".").concat(r,".").concat(+i+1,"-0"):">=".concat(n,".").concat(r,".").concat(i,"-").concat(a," <").concat(n,".").concat(+r+1,".0-0"):">=".concat(n,".").concat(r,".").concat(i,"-").concat(a," <").concat(+n+1,".0.0-0")):(tt("no pr"),s="0"===n?"0"===r?">=".concat(n,".").concat(r,".").concat(i).concat(o," <").concat(n,".").concat(r,".").concat(+i+1,"-0"):">=".concat(n,".").concat(r,".").concat(i).concat(o," <").concat(n,".").concat(+r+1,".0-0"):">=".concat(n,".").concat(r,".").concat(i," <").concat(+n+1,".0.0-0")),tt("caret return",s),s}))},mt=(e,t)=>(tt("replaceXRanges",e,t),e.split(/\s+/).map((e=>Et(e,t))).join(" ")),Et=(e,t)=>{e=e.trim();const n=t.loose?ot[rt.XRANGELOOSE]:ot[rt.XRANGE];return e.replace(n,((n,o,r,i,a,s)=>{tt("xRange",e,n,o,r,i,a,s);const c=ut(r),l=c||ut(i),h=l||ut(a),p=h;return"="===o&&p&&(o=""),s=t.includePrerelease?"-0":"",c?n=">"===o||"<"===o?"<0.0.0-0":"*":o&&p?(l&&(i=0),a=0,">"===o?(o=">=",l?(r=+r+1,i=0,a=0):(i=+i+1,a=0)):"<="===o&&(o="<",l?r=+r+1:i=+i+1),"<"===o&&(s="-0"),n="".concat(o+r,".").concat(i,".").concat(a).concat(s)):l?n=">=".concat(r,".0.0").concat(s," <").concat(+r+1,".0.0-0"):h&&(n=">=".concat(r,".").concat(i,".0").concat(s," <").concat(r,".").concat(+i+1,".0-0")),tt("xRange return",n),n}))},bt=(e,t)=>(tt("replaceStars",e,t),e.trim().replace(ot[rt.STAR],"")),yt=(e,t)=>(tt("replaceGTE0",e,t),e.trim().replace(ot[t.includePrerelease?rt.GTE0PRE:rt.GTE0],"")),wt=e=>(t,n,o,r,i,a,s,c,l,h,p,u,d)=>(n=ut(o)?"":ut(r)?">=".concat(o,".0.0").concat(e?"-0":""):ut(i)?">=".concat(o,".").concat(r,".0").concat(e?"-0":""):a?">=".concat(n):">=".concat(n).concat(e?"-0":""),c=ut(l)?"":ut(h)?"<".concat(+l+1,".0.0-0"):ut(p)?"<".concat(l,".").concat(+h+1,".0-0"):u?"<=".concat(l,".").concat(h,".").concat(p,"-").concat(u):e?"<".concat(l,".").concat(h,".").concat(+p+1,"-0"):"<=".concat(c),"".concat(n," ").concat(c).trim()),Ot=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(tt(e[n].semver),e[n].semver!==et.ANY&&e[n].semver.prerelease.length>0){const o=e[n].semver;if(o.major===t.major&&o.minor===t.minor&&o.patch===t.patch)return!0}return!1}return!0},At=Qe;var xt=(e,t,n)=>{try{t=new At(t,n)}catch(e){return!1}return t.test(e)};var It={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},Nt={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},Rt={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const Tt=Array.prototype.slice,Lt=(e,t,n)=>{const o=n?n(t[0]):t[0];return o[e].apply(o,Tt.call(t,1))};var St={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t,n,o,r,i,a)=>new Date(e,t||0,null!=n?n:1,o||0,r||0,i||0,a||0),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return Lt("join",arguments)},indexof:function(){return Lt("indexOf",arguments)},lastindexof:function(){return Lt("lastIndexOf",arguments)},slice:function(){return Lt("slice",arguments)},reverse:e=>e.slice().reverse(),parseFloat:parseFloat,parseInt:parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return Lt("substring",arguments,String)},split:function(){return Lt("split",arguments,String)},replace:function(){return Lt("replace",arguments,String)},trim:e=>String(e).trim(),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const Dt=["view","item","group","xy","x","y"],Ct={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:It[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,o=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);return n&&(e.memberDepth-=1),o[r]},CallExpression:(e,t)=>{const n=t.arguments;let o=t.callee.name;return o.startsWith("_")&&(o=o.slice(1)),"if"===o?e(n[0])?e(n[1]):e(n[2]):(e.fn[o]||St[o]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>Nt[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>Rt[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce(((t,n)=>{e.memberDepth+=1;const o=e(n.key);return e.memberDepth-=1,t[o]=e(n.value),t}),{})};function Ft(e,t,n,o,r,i){const a=e=>Ct[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=o,a.event=r,a.item=i,Dt.forEach((e=>a.fn[e]=function(){return r.vega[e](...arguments)})),a(e)}var kt={operator(e,t){const n=t.ast,o=e.functions;return e=>Ft(n,o,e)},parameter(e,t){const n=t.ast,o=e.functions;return(e,t)=>Ft(n,o,t,e)},event(e,t){const n=t.ast,o=e.functions;return e=>Ft(n,o,void 0,void 0,e)},handler(e,t){const n=t.ast,o=e.functions;return(e,t)=>{const r=t.item&&t.item.datum;return Ft(n,o,e,r,t)}},encode(e,t){const{marktype:n,channels:o}=t,r=e.functions,i="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,c=0;for(const n in o)s=Ft(o[n].ast,r,t,a,void 0,e),e[n]!==s&&(e[n]=s,c=1);return"rule"!==n&&function(e,t,n){let o;t.x2&&(t.x?(n&&e.x>e.x2&&(o=e.x,e.x=e.x2,e.x2=o),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(o=e.y,e.y=e.y2,e.y2=o),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,o,i),c}}};function Pt(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}const _t="#fff",Mt={background:"#333",title:{color:_t,subtitleColor:_t},style:{"guide-label":{fill:_t},"guide-title":{fill:_t}},axis:{domainColor:_t,gridColor:"#888",tickColor:_t}},jt="#4572a7",zt={background:"#fff",arc:{fill:jt},area:{fill:jt},line:{stroke:jt,strokeWidth:2},path:{stroke:jt},rect:{fill:jt},shape:{stroke:jt},symbol:{fill:jt,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},Ut="#30a2da",Bt="#cbcbcb",Gt="#f0f0f0",Xt="#333",Vt={arc:{fill:Ut},area:{fill:Ut},axis:{domainColor:Bt,grid:!0,gridColor:Bt,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:Bt,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:Gt,group:{fill:Gt},legend:{labelColor:Xt,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:Xt,titleFontSize:14,titlePadding:10},line:{stroke:Ut,strokeWidth:2},path:{stroke:Ut,strokeWidth:.5},rect:{fill:Ut},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:Ut},bar:{binSpacing:2,fill:Ut,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Wt="#000",Ht={group:{fill:"#e5e5e5"},arc:{fill:Wt},area:{fill:Wt},line:{stroke:Wt},path:{stroke:Wt},rect:{fill:Wt},shape:{stroke:Wt},symbol:{fill:Wt,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},$t="Benton Gothic, sans-serif",qt="#82c6df",Yt="Benton Gothic Bold, sans-serif",Jt="normal",Qt={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},Zt={background:"#ffffff",title:{anchor:"start",color:"#000000",font:Yt,fontSize:22,fontWeight:"normal"},arc:{fill:qt},area:{fill:qt},line:{stroke:qt,strokeWidth:2},path:{stroke:qt},rect:{fill:qt},shape:{stroke:qt},symbol:{fill:qt,size:30},axis:{labelFont:$t,labelFontSize:11.5,labelFontWeight:"normal",titleFont:Yt,titleFontSize:13,titleFontWeight:Jt},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:$t,labelFontSize:11.5,symbolType:"square",titleFont:Yt,titleFontSize:13,titleFontWeight:Jt},range:{category:Qt["category-6"],diverging:Qt["fireandice-6"],heatmap:Qt["fire-7"],ordinal:Qt["fire-7"],ramp:Qt["fire-7"]}},Kt="#ab5787",en="#979797",tn={background:"#f9f9f9",arc:{fill:Kt},area:{fill:Kt},line:{stroke:Kt},path:{stroke:Kt},rect:{fill:Kt},shape:{stroke:Kt},symbol:{fill:Kt,size:30},axis:{domainColor:en,domainWidth:.5,gridWidth:.2,labelColor:en,tickColor:en,tickWidth:.2,titleColor:en},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},nn="#3e5c69",on={background:"#fff",arc:{fill:nn},area:{fill:nn},line:{stroke:nn},path:{stroke:nn},rect:{fill:nn},shape:{stroke:nn},symbol:{fill:nn},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},rn="#1696d2",an="#000000",sn="Lato",cn="Lato",ln={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},hn={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:sn},axisX:{domain:!0,domainColor:an,domainWidth:1,grid:!1,labelFontSize:12,labelFont:cn,labelAngle:0,tickColor:an,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:sn},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:cn,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:sn,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:cn,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:sn,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:ln["six-groups-cat-1"],diverging:ln["diverging-colors"],heatmap:ln["diverging-colors"],ordinal:ln["six-groups-seq"],ramp:ln["shades-blue"]},area:{fill:rn},rect:{fill:rn},line:{color:rn,stroke:rn,strokeWidth:5},trail:{color:rn,stroke:rn,strokeWidth:0,size:1},path:{stroke:rn,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:rn,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:rn,stroke:null}},arc:{fill:rn},shape:{stroke:rn},symbol:{fill:rn,size:30}},pn="#3366CC",un="#ccc",dn="Arial, sans-serif",fn={arc:{fill:pn},area:{fill:pn},path:{stroke:pn},rect:{fill:pn},shape:{stroke:pn},symbol:{stroke:pn},circle:{fill:pn},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:dn,fontSize:12},"guide-title":{font:dn,fontSize:12},"group-title":{font:dn,fontSize:12}},title:{font:dn,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:un,tickColor:un,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},gn="2.10.0";var vn=Object.freeze({__proto__:null,dark:Mt,excel:zt,fivethirtyeight:Vt,ggplot2:Ht,googlecharts:fn,latimes:Zt,quartz:tn,urbaninstitute:hn,version:gn,vox:on});function mn(e,t,n){return e.fields=t||[],e.fname=n,e}function En(e){return 1===e.length?bn(e[0]):yn(e)}const bn=e=>function(t){return t[e]},yn=e=>{const t=e.length;return function(n){for(let o=0;o<t;++o)n=n[e[o]];return n}};function wn(e){throw Error(e)}!function(e,t,n){const o=function(e){const t=[],n=e.length;let o,r,i,a=null,s=0,c="";function l(){t.push(c+e.substring(o,r)),c="",o=r+1}for(e+="",o=r=0;r<n;++r)if(i=e[r],"\\"===i)c+=e.substring(o,r),c+=e.substring(++r,++r),o=r;else if(i===a)l(),a=null,s=-1;else{if(a)continue;o===s&&'"'===i||o===s&&"'"===i?(o=r+1,a=i):"."!==i||s?"["===i?(r>o&&l(),s=o=r+1):"]"===i&&(s||wn("Access path missing open bracket: "+e),s>0&&l(),s=0,o=r+1):r>o?l():o=r+1}return s&&wn("Access path missing closing bracket: "+e),a&&wn("Access path missing closing quote: "+e),r>o&&(r++,l()),t}(e);e=1===o.length?o[0]:e,mn((n&&n.get||En)(o),[e],t||e)}("id"),mn((e=>e),[],"identity"),mn((()=>0),[],"zero"),mn((()=>1),[],"one"),mn((()=>!0),[],"true"),mn((()=>!1),[],"false");var On=Array.isArray;function An(e){return e===Object(e)}function xn(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,o){if("object"!=typeof o||null===o)return o;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(o)>=0?"[Circular]":(t.push(o),o)}}(t))}const In="vg-tooltip-element",Nn={offsetX:10,offsetY:10,id:In,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(e,t,n){if(On(e))return"[".concat(e.map((e=>t("string"==typeof e?e:xn(e,n)))).join(", "),"]");if(An(e)){let o="";const r=e,{title:i,image:a}=r,s=
/*! *****************************************************************************
    Copyright (c) Microsoft Corporation.

    Permission to use, copy, modify, and/or distribute this software for any
    purpose with or without fee is hereby granted.

    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
    REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
    INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
    LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
    OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
    PERFORMANCE OF THIS SOFTWARE.
    ***************************************************************************** */
function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(r,["title","image"]);i&&(o+="<h2>".concat(t(i),"</h2>")),a&&(o+='<img src="'.concat(t(a),'">'));const c=Object.keys(s);if(c.length>0){o+="<table>";for(const e of c){let r=s[e];void 0!==r&&(An(r)&&(r=xn(r,n)),o+='<tr><td class="key">'.concat(t(e),':</td><td class="value">').concat(t(r),"</td></tr>"))}o+="</table>"}return o||"{}"}return t(e)}};class Rn{constructor(e){this.options=Object.assign(Object.assign({},Nn),e);const t=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n  visibility: hidden;\n  padding: 8px;\n  position: fixed;\n  z-index: 1000;\n  font-family: sans-serif;\n  font-size: 11px;\n  border-radius: 3px;\n  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n  /* The default theme is the light theme. */\n  background-color: rgba(255, 255, 255, 0.95);\n  border: 1px solid #d9d9d9;\n  color: black; }\n  #vg-tooltip-element.visible {\n    visibility: visible; }\n  #vg-tooltip-element h2 {\n    margin-top: 0;\n    margin-bottom: 10px;\n    font-size: 13px; }\n  #vg-tooltip-element img {\n    max-width: 200px;\n    max-height: 200px; }\n  #vg-tooltip-element table {\n    border-spacing: 0; }\n    #vg-tooltip-element table tr {\n      border: none; }\n      #vg-tooltip-element table tr td {\n        overflow: hidden;\n        text-overflow: ellipsis;\n        padding-top: 2px;\n        padding-bottom: 2px; }\n        #vg-tooltip-element table tr td.key {\n          color: #808080;\n          max-width: 150px;\n          text-align: right;\n          padding-right: 4px; }\n        #vg-tooltip-element table tr td.value {\n          display: block;\n          max-width: 300px;\n          max-height: 7em;\n          text-align: left; }\n  #vg-tooltip-element.dark-theme {\n    background-color: rgba(32, 32, 32, 0.9);\n    border: 1px solid #f5f5f5;\n    color: white; }\n    #vg-tooltip-element.dark-theme td.key {\n      color: #bfbfbf; }\n".toString().replace(In,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,o){var r;this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el));if((null!==(r=document.fullscreenElement)&&void 0!==r?r:document.body).appendChild(this.el),null==o||""===o)return void this.el.classList.remove("visible","".concat(this.options.theme,"-theme"));this.el.innerHTML=this.options.formatTooltip(o,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible","".concat(this.options.theme,"-theme"));const{x:i,y:a}=function(e,t,n,o){let r=e.clientX+n;r+t.width>window.innerWidth&&(r=+e.clientX-n-t.width);let i=e.clientY+o;return i+t.height>window.innerHeight&&(i=+e.clientY-o-t.height),{x:r,y:i}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style","top: ".concat(a,"px; left: ").concat(i,"px"))}}function Tn(e,t,n){const o=e.open(t),{origin:r}=new URL(t);let i=40;e.addEventListener("message",(function t(n){n.source===o&&(i=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){i<=0||(o.postMessage(n,r),setTimeout(e,250),i-=1)}),250)}var Ln='.vega-embed {\n  position: relative;\n  display: inline-block;\n  box-sizing: border-box;\n}\n.vega-embed.has-actions {\n  padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n  display: none !important;\n}\n.vega-embed summary {\n  list-style: none;\n  position: absolute;\n  top: 0;\n  right: 0;\n  padding: 6px;\n  z-index: 1000;\n  background: white;\n  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n  color: #1b1e23;\n  border: 1px solid #aaa;\n  border-radius: 999px;\n  opacity: 0.2;\n  transition: opacity 0.4s ease-in;\n  outline: none;\n  cursor: pointer;\n  line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n  display: none;\n}\n.vega-embed summary:active {\n  box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n  width: 14px;\n  height: 14px;\n}\n.vega-embed details[open] summary {\n  opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus summary {\n  opacity: 1 !important;\n  transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n  position: absolute;\n  z-index: 1001;\n  top: 35px;\n  right: -9px;\n  display: flex;\n  flex-direction: column;\n  padding-bottom: 8px;\n  padding-top: 8px;\n  border-radius: 4px;\n  box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n  border: 1px solid #d9d9d9;\n  background: white;\n  animation-duration: 0.15s;\n  animation-name: scale-in;\n  animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);\n  text-align: left;\n}\n.vega-embed .vega-actions a {\n  padding: 8px 16px;\n  font-family: sans-serif;\n  font-size: 14px;\n  font-weight: 600;\n  white-space: nowrap;\n  color: #434a56;\n  text-decoration: none;\n}\n.vega-embed .vega-actions a:hover {\n  background-color: #f7f7f9;\n  color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n  content: "";\n  display: inline-block;\n  position: absolute;\n}\n.vega-embed .vega-actions::before {\n  left: auto;\n  right: 14px;\n  top: -16px;\n  border: 8px solid #0000;\n  border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n  left: auto;\n  right: 15px;\n  top: -14px;\n  border: 7px solid #0000;\n  border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n  width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n  height: 100%;\n}\n\n.vega-embed-wrapper {\n  max-width: 100%;\n  overflow: auto;\n  padding-right: 14px;\n}\n\n@keyframes scale-in {\n  from {\n    opacity: 0;\n    transform: scale(0.6);\n  }\n  to {\n    opacity: 1;\n    transform: scale(1);\n  }\n}\n';function Sn(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")}function Dn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];for(const t of n)Cn(e,t);return e}function Cn(t,n){for(const o of Object.keys(n))e.writeConfig(t,o,n[o],!0)}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e});var Fn;const kn="6.20.2",Pn=r;let _n=i;const Mn="undefined"!=typeof window?window:void 0;void 0===_n&&null!=Mn&&null!==(Fn=Mn.vl)&&void 0!==Fn&&Fn.compile&&(_n=Mn.vl);const jn={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},zn={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},Un={vega:"Vega","vega-lite":"Vega-Lite"},Bn={vega:Pn.version,"vega-lite":_n?_n.version:"not available"},Gn={vega:e=>e,"vega-lite":(e,t)=>_n.compile(e,{config:t}).spec},Xn='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">\n  <circle r="2" cy="8" cx="2"></circle>\n  <circle r="2" cy="8" cx="8"></circle>\n  <circle r="2" cy="8" cx="14"></circle>\n</svg>',Vn="chart-wrapper";function Wn(e){return"function"==typeof e}function Hn(e,t,n,o){const r="<html><head>".concat(t,'</head><body><pre><code class="json">'),i="</code></pre>".concat(n,"</body></html>"),a=window.open("");a.document.write(r+e+i),a.document.title="".concat(Un[o]," JSON Source")}function $n(e,t){if(e.$schema){const o=Pt(e.$schema);var n;if(t&&t!==o.library)console.warn("The given visualization spec is written in ".concat(Un[o.library],", but mode argument sets ").concat(null!==(n=Un[t])&&void 0!==n?n:t,"."));const r=o.library;return xt(Bn[r],"^".concat(o.version.slice(1)))||console.warn("The input spec uses ".concat(Un[r]," ").concat(o.version,", but the current version of ").concat(Un[r]," is v").concat(Bn[r],".")),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":null!=t?t:"vega"}function qn(e){return(t=e)&&"load"in t?e:Pn.loader(e);var t}function Yn(e){var t;return null!==(t=e.usermeta&&e.usermeta.embedOptions)&&void 0!==t?t:{}}async function Jn(t,n){var o,r;let i,a,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e.isString(n)?(a=qn(s.loader),i=JSON.parse(await a.load(n))):i=n;const c=Yn(i).loader;var l;a&&!c||(a=qn(null!==(l=s.loader)&&void 0!==l?l:c));const h=await Qn(Yn(i),a),p=await Qn(s,a),u={...Dn(p,h),config:e.mergeConfig(null!==(o=p.config)&&void 0!==o?o:{},null!==(r=h.config)&&void 0!==r?r:{})};return await Kn(t,i,u,a)}async function Qn(t,n){var o;const r=e.isString(t.config)?JSON.parse(await n.load(t.config)):null!==(o=t.config)&&void 0!==o?o:{},i=e.isString(t.patch)?JSON.parse(await n.load(t.patch)):t.patch;return{...t,...i?{patch:i}:{},...r?{config:r}:{}}}function Zn(e){var t;const n=e.getRootNode?e.getRootNode():document;return n instanceof ShadowRoot?{root:n,rootContainer:n}:{root:document,rootContainer:null!==(t=document.head)&&void 0!==t?t:document.body}}async function Kn(t,n){var o,r,i,a,s,c,l;let h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=arguments.length>3?arguments[3]:void 0;const u=h.theme?e.mergeConfig(vn[h.theme],null!==(o=h.config)&&void 0!==o?o:{}):h.config,d=e.isBoolean(h.actions)?h.actions:Dn({},jn,null!==(r=h.actions)&&void 0!==r?r:{}),f={...zn,...h.i18n},g=null!==(i=h.renderer)&&void 0!==i?i:"canvas",v=null!==(a=h.logLevel)&&void 0!==a?a:Pn.Warn,m=null!==(s=h.downloadFileName)&&void 0!==s?s:"visualization",E="string"==typeof t?document.querySelector(t):t;if(!E)throw new Error("".concat(t," does not exist"));if(!1!==h.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:n}=Zn(E);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerText=void 0===h.defaultStyle||!0===h.defaultStyle?Ln.toString():h.defaultStyle,n.appendChild(t)}}const b=$n(n,h.mode);let y=Gn[b](n,u);if("vega-lite"===b&&y.$schema){const e=Pt(y.$schema);xt(Bn.vega,"^".concat(e.version.slice(1)))||console.warn("The compiled spec uses Vega ".concat(e.version,", but current version is v").concat(Bn.vega,"."))}E.classList.add("vega-embed"),d&&E.classList.add("has-actions"),E.innerHTML="";let w=E;if(d){const e=document.createElement("div");e.classList.add(Vn),E.appendChild(e),w=e}const O=h.patch;O&&(y=O instanceof Function?O(y):A(y,O,!0,!1).newDocument),h.formatLocale&&Pn.formatLocale(h.formatLocale),h.timeFormatLocale&&Pn.timeFormatLocale(h.timeFormatLocale);const{ast:x}=h,I=Pn.parse(y,"vega-lite"===b?{}:u,{ast:x}),N=new(h.viewClass||Pn.View)(I,{loader:p,logLevel:v,renderer:g,...x?{expr:null!==(c=null!==(l=Pn.expressionInterpreter)&&void 0!==l?l:h.expr)&&void 0!==c?c:kt}:{}});if(N.addSignalListener("autosize",((e,t)=>{const{type:n}=t;"fit-x"==n?(w.classList.add("fit-x"),w.classList.remove("fit-y")):"fit-y"==n?(w.classList.remove("fit-x"),w.classList.add("fit-y")):"fit"==n?w.classList.add("fit-x","fit-y"):w.classList.remove("fit-x","fit-y")})),!1!==h.tooltip){const e=Wn(h.tooltip)?h.tooltip:new Rn(!0===h.tooltip?{}:h.tooltip).call;N.tooltip(e)}let R,{hover:T}=h;if(void 0===T&&(T="vega"===b),T){const{hoverSet:e,updateSet:t}="boolean"==typeof T?{}:T;N.hover(e,t)}if(h&&(null!=h.width&&N.width(h.width),null!=h.height&&N.height(h.height),null!=h.padding&&N.padding(h.padding)),await N.initialize(w,h.bind).runAsync(),!1!==d){let e=E;if(!1!==h.defaultStyle){const t=document.createElement("details");t.title=f.CLICK_TO_VIEW_ACTIONS,E.append(t),e=t;const n=document.createElement("summary");n.innerHTML=Xn,t.append(n),R=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",R)}const t=document.createElement("div");if(e.append(t),t.classList.add("vega-actions"),!0===d||!1!==d.export)for(const e of["svg","png"])if(!0===d||!0===d.export||d.export[e]){const n=f["".concat(e.toUpperCase(),"_ACTION")],o=document.createElement("a");o.text=n,o.href="#",o.target="_blank",o.download="".concat(m,".").concat(e),o.addEventListener("mousedown",(async function(t){t.preventDefault();const n=await N.toImageURL(e,h.scaleFactor);this.href=n})),t.append(o)}if(!0===d||!1!==d.source){const e=document.createElement("a");e.text=f.SOURCE_ACTION,e.href="#",e.addEventListener("click",(function(e){var t,o;Hn(P(n),null!==(t=h.sourceHeader)&&void 0!==t?t:"",null!==(o=h.sourceFooter)&&void 0!==o?o:"",b),e.preventDefault()})),t.append(e)}if("vega-lite"===b&&(!0===d||!1!==d.compiled)){const e=document.createElement("a");e.text=f.COMPILED_ACTION,e.href="#",e.addEventListener("click",(function(e){var t,n;Hn(P(y),null!==(t=h.sourceHeader)&&void 0!==t?t:"",null!==(n=h.sourceFooter)&&void 0!==n?n:"","vega"),e.preventDefault()})),t.append(e)}if(!0===d||!1!==d.editor){var L;const e=null!==(L=h.editorUrl)&&void 0!==L?L:"https://vega.github.io/editor/",o=document.createElement("a");o.text=f.EDITOR_ACTION,o.href="#",o.addEventListener("click",(function(t){Tn(window,e,{config:u,mode:b,renderer:g,spec:P(n)}),t.preventDefault()})),t.append(o)}}function S(){R&&document.removeEventListener("click",R),N.finalize()}return{view:N,spec:n,vgSpec:y,finalize:S}}async function eo(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=document.createElement("div");o.classList.add("vega-embed-wrapper");const r=document.createElement("div");o.appendChild(r);const i=!0===n.actions||!1===n.actions?n.actions:{export:!0,source:!1,compiled:!0,editor:!0,...null!==(t=n.actions)&&void 0!==t?t:{}},a=await Jn(r,e,{actions:i,...null!=n?n:{}});return o.value=a.view,o}function to(e){return e instanceof HTMLElement}const no=function(){return arguments.length>1&&(e.isString(arguments.length<=0?void 0:arguments[0])&&!Sn(arguments.length<=0?void 0:arguments[0])||to(arguments.length<=0?void 0:arguments[0])||3===arguments.length)?Jn(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1],arguments.length<=2?void 0:arguments[2]):eo(arguments.length<=0?void 0:arguments[0],arguments.length<=1?void 0:arguments[1])};return no.vegaLite=_n,no.vl=_n,no.container=eo,no.embed=Jn,no.vega=Pn,no.default=Jn,no.version=kn,no}));
//# sourceMappingURL=vega-embed.min.js.map

A web/vega-lite-5.2.0.js => web/vega-lite-5.2.0.js +2 -0
@@ 0,0 1,2 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega")):"function"==typeof define&&define.amd?define(["exports","vega"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vegaLite={},e.vega)}(this,(function(e,t){"use strict";var n="5.2.0";Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function e(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,(function(n,i){return Array.isArray(i)?n.push.apply(n,e.call(i,t-1)):n.push(i),n}),[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(e){return Array.prototype.map.apply(this,arguments).flat()},writable:!0});var i={exports:{}};!function(e){var t=function(){function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function o(r,s,c,l,u){"object"==typeof s&&(c=s.depth,l=s.prototype,u=s.includeNonEnumerable,s=s.circular);var d=[],f=[],p="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===c&&(c=1/0),function r(c,m){if(null===c)return null;if(0===m)return c;var g,h;if("object"!=typeof c)return c;if(e(c,t))g=new t;else if(e(c,n))g=new n;else if(e(c,i))g=new i((function(e,t){c.then((function(t){e(r(t,m-1))}),(function(e){t(r(e,m-1))}))}));else if(o.__isArray(c))g=[];else if(o.__isRegExp(c))g=new RegExp(c.source,a(c)),c.lastIndex&&(g.lastIndex=c.lastIndex);else if(o.__isDate(c))g=new Date(c.getTime());else{if(p&&Buffer.isBuffer(c))return g=Buffer.allocUnsafe?Buffer.allocUnsafe(c.length):new Buffer(c.length),c.copy(g),g;e(c,Error)?g=Object.create(c):void 0===l?(h=Object.getPrototypeOf(c),g=Object.create(h)):(g=Object.create(l),h=l)}if(s){var v=d.indexOf(c);if(-1!=v)return f[v];d.push(c),f.push(g)}for(var y in e(c,t)&&c.forEach((function(e,t){var n=r(t,m-1),i=r(e,m-1);g.set(n,i)})),e(c,n)&&c.forEach((function(e){var t=r(e,m-1);g.add(t)})),c){var b;h&&(b=Object.getOwnPropertyDescriptor(h,y)),b&&null==b.set||(g[y]=r(c[y],m-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(c);for(y=0;y<x.length;y++){var w=x[y];(!(S=Object.getOwnPropertyDescriptor(c,w))||S.enumerable||u)&&(g[w]=r(c[w],m-1),S.enumerable||Object.defineProperty(g,w,{enumerable:!1}))}}if(u){var k=Object.getOwnPropertyNames(c);for(y=0;y<k.length;y++){var S,D=k[y];(S=Object.getOwnPropertyDescriptor(c,D))&&S.enumerable||(g[D]=r(c[D],m-1),Object.defineProperty(g,D,{enumerable:!1}))}}return g}(r,c)}function r(e){return Object.prototype.toString.call(e)}function a(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return o.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},o.__objToStr=r,o.__isDate=function(e){return"object"==typeof e&&"[object Date]"===r(e)},o.__isArray=function(e){return"object"==typeof e&&"[object Array]"===r(e)},o.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===r(e)},o.__getRegExpFlags=a,o}();e.exports&&(e.exports=t)}(i);var o=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,o=t.cmp&&(n=t.cmp,function(e){return function(t,i){var o={key:t,value:e[t]},r={key:i,value:e[i]};return n(o,r)}}),r=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,a;if(Array.isArray(t)){for(a="[",n=0;n<t.length;n++)n&&(a+=","),a+=e(t[n])||"null";return a+"]"}if(null===t)return"null";if(-1!==r.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var s=r.push(t)-1,c=Object.keys(t).sort(o&&o(t));for(a="",n=0;n<c.length;n++){var l=c[n],u=e(t[l]);u&&(a&&(a+=","),a+=JSON.stringify(l)+":"+u)}return r.splice(s,1),"{"+a+"}"}}(e)};function r(e){return!!e.or}function a(e){return!!e.and}function s(e){return!!e.not}function c(e,t){if(s(e))c(e.not,t);else if(a(e))for(const n of e.and)c(n,t);else if(r(e))for(const n of e.or)c(n,t);else t(e)}function l(e,t){return s(e)?{not:l(e.not,t)}:a(e)?{and:e.and.map((e=>l(e,t)))}:r(e)?{or:e.or.map((e=>l(e,t)))}:t(e)}const u=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,o,r;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(o=i;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(r=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=i;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,r[o]))return!1;for(o=i;0!=o--;){var a=r[o];if(!e(t[a],n[a]))return!1}return!0}return t!=t&&n!=n},d=i.exports;function f(e){throw new Error(e)}function p(e,n){const i={};for(const o of n)t.hasOwnProperty(e,o)&&(i[o]=e[o]);return i}function m(e,t){const n={...e};for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return"Set(".concat([...this].map((e=>o(e))).join(","),")")};const g=o;function h(e){if(t.isNumber(e))return e;const n=t.isString(e)?e:o(e);if(n.length<250)return n;let i=0;for(let e=0;e<n.length;e++){i=(i<<5)-i+n.charCodeAt(e),i&=i}return i}function v(e){return!1===e||null===e}function y(e,t){return e.includes(t)}function b(e,t){let n=0;for(const[i,o]of e.entries())if(t(o,i,n++))return!0;return!1}function x(e,t){let n=0;for(const[i,o]of e.entries())if(!t(o,i,n++))return!1;return!0}function w(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];for(const t of n)k(e,null!=t?t:{});return e}function k(e,n){for(const i of C(n))t.writeConfig(e,i,n[i],!0)}function S(e,t){const n=[],i={};let o;for(const r of e)o=t(r),o in i||(i[o]=1,n.push(r));return n}function D(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function F(e,t){for(const n of e)if(t.has(n))return!0;return!1}function O(e){const n=new Set;for(const i of e){const e=t.splitAccessPath(i).map(((e,t)=>0===t?e:"[".concat(e,"]"))),o=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of o)n.add(e)}return n}function _(e,t){return void 0===e||void 0===t||F(O(e),O(t))}function z(e){return 0===C(e).length}const C=Object.keys,P=Object.values,A=Object.entries;function N(e){return!0===e||!1===e}function j(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function E(e,t){return s(e)?"!(".concat(E(e.not,t),")"):a(e)?"(".concat(e.and.map((e=>E(e,t))).join(") && ("),")"):r(e)?"(".concat(e.or.map((e=>E(e,t))).join(") || ("),")"):t(e)}function M(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&M(e[n],t)&&delete e[n],z(e)}function T(e){return e.charAt(0).toUpperCase()+e.substr(1)}function L(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"datum";const i=t.splitAccessPath(e),o=[];for(let e=1;e<=i.length;e++){const r="[".concat(i.slice(0,e).map(t.stringValue).join("]["),"]");o.push("".concat(n).concat(r))}return o.join(" && ")}function q(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"datum";return"".concat(n,"[").concat(t.stringValue(t.splitAccessPath(e).join(".")),"]")}function W(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function R(e){return"".concat(t.splitAccessPath(e).map(W).join("\\."))}function U(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function B(e){return"".concat(t.splitAccessPath(e).join("."))}function H(e){return e?t.splitAccessPath(e).length:0}function V(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(const e of t)if(void 0!==e)return e}let I=42;function G(e){const t=++I;return e?String(e)+t:t}function Y(e){return X(e)?e:"__".concat(e)}function X(e){return e.startsWith("__")}function J(e){if(void 0!==e)return(e%360+360)%360}function Q(e){return!!t.isNumber(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const $="row",K="column",Z="facet",ee="x",te="y",ne="x2",ie="y2",oe="xOffset",re="yOffset",ae="radius",se="radius2",ce="theta",le="theta2",ue="latitude",de="longitude",fe="latitude2",pe="longitude2",me="color",ge="fill",he="stroke",ve="shape",ye="size",be="angle",xe="opacity",we="fillOpacity",ke="strokeOpacity",Se="strokeWidth",De="strokeDash",Fe="text",Oe="order",_e="detail",ze="key",Ce="tooltip",Pe="href",Ae="url",Ne="description",je={theta:1,theta2:1,radius:1,radius2:1};function Ee(e){return e in je}const Me={longitude:1,longitude2:1,latitude:1,latitude2:1};const Te=C(Me),Le={x:1,y:1,x2:1,y2:1,...je,...Me,xOffset:1,yOffset:1,color:1,fill:1,stroke: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 qe(e){return e===me||e===ge||e===he}const We={row:1,column:1,facet:1},Re=C(We),Ue={...Le,...We},Be=C(Ue),{order:He,detail:Ve,tooltip:Ie,...Ge}=Ue,{row:Ye,column:Xe,facet:Je,...Qe}=Ge;function $e(e){return!!Ue[e]}const Ke=[ne,ie,fe,pe,le,se];function Ze(e){return et(e)!==e}function et(e){switch(e){case ne:return ee;case ie:return te;case fe:return ue;case pe:return de;case le:return ce;case se:return ae}return e}function tt(e){if(Ee(e))switch(e){case ce:return"startAngle";case le:return"endAngle";case ae:return"outerRadius";case se:return"innerRadius"}return e}function nt(e){switch(e){case ee:return ne;case te:return ie;case ue:return fe;case de:return pe;case ce:return le;case ae:return se}}function it(e){switch(e){case ee:case ne:return"width";case te:case ie:return"height"}}function ot(e){switch(e){case ee:return"xOffset";case te:return"yOffset"}}function rt(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const at=C(Le),{x:st,y:ct,x2:lt,y2:ut,xOffset:dt,yOffset:ft,latitude:pt,longitude:mt,latitude2:gt,longitude2:ht,theta:vt,theta2:yt,radius:bt,radius2:xt,...wt}=Le,kt=C(wt),St={x:1,y:1},Dt=C(St);function Ft(e){return e in St}const Ot={theta:1,radius:1},_t=C(Ot);function zt(e){return"width"===e?ee:te}const Ct={xOffset:1,yOffset:1};function Pt(e){return e in Ct}const{text:At,tooltip:Nt,href:jt,url:Et,description:Mt,detail:Tt,key:Lt,order:qt,...Wt}=wt,Rt=C(Wt);const Ut={...St,...Ot,...Ct,...Wt},Bt=C(Ut);function Ht(e){return!!Ut[e]}function Vt(e,t){return function(e){switch(e){case me:case ge:case he:case Ne:case _e:case ze:case Ce:case Pe:case Oe:case xe:case we:case ke:case Se:case Z:case $:case K:return It;case ee:case te:case oe:case re:case ue:case de:return Yt;case ne:case ie:case fe:case pe:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case ye:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case De:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case ve:return{point:"always",geoshape:"always"};case Fe:return{text:"always"};case be:return{point:"always",square:"always",text:"always"};case Ae:return{image:"always"};case ce:case ae:return{text:"always",arc:"always"};case le:case se:return{arc:"always"}}}(e)[t]}const It={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:Gt,...Yt}=It;function Xt(e){switch(e){case ee:case te:case ce:case ae:case oe:case re:case ye:case be:case Se:case xe:case we:case ke:case ne:case ie:case le:case se:return;case Z:case $:case K:case ve:case De:case Fe:case Ce:case Pe:case Ae:case Ne:return"discrete";case me:case ge:case he:return"flexible";case ue:case de:case fe:case pe:case _e:case ze:case Oe:return}}const Jt={argmax:1,argmin:1,average:1,count:1,distinct: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},Qt={count:1,min:1,max:1};function $t(e){return!!e&&!!e.argmin}function Kt(e){return!!e&&!!e.argmax}function Zt(e){return t.isString(e)&&!!Jt[e]}const en=new Set(["count","valid","missing","distinct"]);function tn(e){return t.isString(e)&&en.has(e)}const nn=new Set(["count","sum","distinct","valid","missing"]),on=new Set(["mean","average","median","q1","q3","min","max"]);function rn(e){return t.isBoolean(e)&&(e=Wa(e,void 0)),"bin"+C(e).map((t=>ln(e[t])?j("_".concat(t,"_").concat(A(e[t]))):j("_".concat(t,"_").concat(e[t])))).join("")}function an(e){return!0===e||cn(e)&&!e.binned}function sn(e){return"binned"===e||cn(e)&&!0===e.binned}function cn(e){return t.isObject(e)}function ln(e){return null==e?void 0:e.param}function un(e){switch(e){case $:case K:case ye:case me:case ge:case he:case Se:case xe:case we:case ke:case ve:return 6;case De:return 4;default:return 10}}function dn(e){return e&&!!e.expr}function fn(e){const t=C(e||{}),n={};for(const i of t)n[i]=kn(e[i]);return n}function pn(e){const{anchor:t,frame:n,offset:i,orient:o,angle:r,limit:a,color:s,subtitleColor:c,subtitleFont:l,subtitleFontSize:u,subtitleFontStyle:d,subtitleFontWeight:f,subtitleLineHeight:m,subtitlePadding:g,...h}=e,v={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...o?{orient:o}:{},...void 0!==r?{angle:r}:{},...void 0!==a?{limit:a}:{}},y={...c?{subtitleColor:c}:{},...l?{subtitleFont:l}:{},...u?{subtitleFontSize:u}:{},...d?{subtitleFontStyle:d}:{},...f?{subtitleFontWeight:f}:{},...m?{subtitleLineHeight:m}:{},...g?{subtitlePadding:g}:{}};return{titleMarkConfig:{...h,...s?{fill:s}:{}},subtitleMarkConfig:p(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:v,subtitle:y}}function mn(e){return t.isString(e)||t.isArray(e)&&t.isString(e[0])}function gn(e){return e&&!!e.signal}function hn(e){return!!e.step}function vn(e){return!t.isArray(e)&&("field"in e&&"data"in e)}const yn=C({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}),bn={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},xn=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function wn(e){const n=t.isArray(e.condition)?e.condition.map(Sn):Sn(e.condition);return{...kn(e),condition:n}}function kn(e){if(dn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Sn(e){if(dn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Dn(e){if(dn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return gn(e)?e:void 0!==e?{value:e}:void 0}function Fn(e){return gn(e)?e.signal:t.stringValue(e.value)}function On(e){return gn(e)?e.signal:null==e?null:t.stringValue(e)}function _n(e,t,n){for(const i of n){const n=Pn(i,t.markDef,t.config);void 0!==n&&(e[i]=Dn(n))}return e}function zn(e){var t;return[].concat(e.type,null!==(t=e.style)&&void 0!==t?t:[])}function Cn(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{vgChannel:o,ignoreVgConfig:r}=i;return o&&void 0!==t[o]?t[o]:void 0!==t[e]?t[e]:!r||o&&o!==e?Pn(e,t,n,i):void 0}function Pn(e,t,n){let{vgChannel:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return V(i?An(e,t,n.style):void 0,An(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function An(e,t,n){return Nn(e,zn(t),n)}function Nn(e,n,i){let o;n=t.array(n);for(const t of n){const n=i[t];n&&void 0!==n[e]&&(o=n[e])}return o}function jn(e,n){return t.array(e).reduce(((e,t)=>{var i;return e.field.push(ka(t,n)),e.order.push(null!==(i=t.sort)&&void 0!==i?i:"ascending"),e}),{field:[],order:[]})}function En(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(u(t,e))return;n.push(e)})),n}function Mn(e,n){return u(e,n)||!n?e:e?[...t.array(e),...t.array(n)].join(", "):n}function Tn(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((mn(n)||gn(n))&&(mn(i)||gn(i)))return{explicit:e.explicit,value:Mn(n,i)};if(mn(n)||gn(n))return{explicit:e.explicit,value:n};if(mn(i)||gn(i))return{explicit:e.explicit,value:i};if(!(mn(n)||gn(n)||mn(i)||gn(i)))return{explicit:e.explicit,value:En(n,i)};throw new Error("It should never reach here")}function Ln(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qn(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,Wn(e,t,"set"),n),n}function Wn(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function Rn(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}function Un(e){return"Invalid specification ".concat(g(e),'. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".')}const Bn='Autosize "fit" only works for single views and layered views.';function Hn(e){return"".concat("width"==e?"Width":"Height",' "container" only works for single views and layered views.')}function Vn(e){const t="width"==e?"x":"y";return"".concat("width"==e?"Width":"Height",' "container" only works well with autosize "fit" or "fit-').concat(t,'".')}function In(e){return e?'Dropping "fit-'.concat(e,'" because spec has discrete ').concat(it(e),"."):'Dropping "fit" because spec has discrete size.'}function Gn(e){return"Unknown field for ".concat(e,". Cannot calculate view size.")}function Yn(e){return'Cannot project a selection on encoding channel "'.concat(e,'", which has no field.')}function Xn(e,t){return'Cannot project a selection on encoding channel "'.concat(e,'" as it uses an aggregate function ("').concat(t,'").')}function Jn(e){return"Selection not supported for ".concat(e," yet.")}const Qn="The same selection must be used to override scale domains in a layered view.";function $n(e){return'The "columns" property cannot be used when "'.concat(e,'" has nested row/column.')}function Kn(e,t,n){return'An ancestor parsed field "'.concat(e,'" as ').concat(n," but a child wants to parse the field as ").concat(t,".")}function Zn(e){return"Config.customFormatTypes is not true, thus custom format type and format for channel ".concat(e," are dropped.")}function ei(e){return"".concat(e,"Offset dropped because ").concat(e," is continuous")}function ti(e){return"There is no ".concat(e," encoding. Replacing ").concat(e,"Offset encoding as ").concat(e,".")}function ni(e,t,n){return"Channel ".concat(e," is a ").concat(t,". Converted to {value: ").concat(g(n),"}.")}function ii(e){return'Invalid field type "'.concat(e,'".')}function oi(e,t){return'Invalid field type "'.concat(e,'" for aggregate: "').concat(t,'", using "quantitative" instead.')}function ri(e){return'Invalid aggregation operator "'.concat(e,'".')}function ai(e,t){const{fill:n,stroke:i}=t;return"Dropping color ".concat(e," as the plot also has ").concat(n&&i?"fill and stroke":n?"fill":"stroke",".")}function si(e,t){return"Dropping ".concat(g(e),' from channel "').concat(t,'" since it does not contain any data field, datum, value, or signal.')}function ci(e,t,n){return"".concat(e,' dropped as it is incompatible with "').concat(t,'"').concat(n?" when ".concat(n):"",".")}function li(e){return"".concat(e," encoding has no scale, so specified scale is ignored.")}function ui(e){return"".concat(e," encoding should be discrete (ordinal / nominal / binned).")}function di(e){return"".concat(e," encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).")}function fi(e,t){return'Using discrete channel "'.concat(e,'" to encode "').concat(t,'" field can be misleading as it does not encode ').concat("ordinal"===t?"order":"magnitude",".")}function pi(e){return"The ".concat(e," for range marks cannot be an expression")}function mi(e){return"Using unaggregated domain with raw field has no effect (".concat(g(e),").")}function gi(e){return'Unaggregated domain not applicable for "'.concat(e,'" since it produces values outside the origin domain of the source data.')}function hi(e){return"Unaggregated domain is currently unsupported for log scale (".concat(g(e),").")}function vi(e,t,n){return'Channel "'.concat(e,'" does not work with "').concat(t,'" scale. We are using "').concat(n,'" scale instead.')}function yi(e,t){return'FieldDef does not work with "'.concat(e,'" scale. We are using "').concat(t,'" scale instead.')}function bi(e,t,n){return"".concat(n,"-scale's \"").concat(t,'" is dropped as it does not work with ').concat(e," scale.")}function xi(e){return'The step for "'.concat(e,'" is dropped because the ').concat("width"===e?"x":"y"," is continuous.")}const wi="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function ki(e){return'Cannot stack "'.concat(e,'" if there is already "').concat(e,'2".')}function Si(e){return"Cannot stack non-linear scale (".concat(e,").")}function Di(e){return'Stacking is applied even though the aggregate function is non-summative ("'.concat(e,'").')}function Fi(e,t){return"Invalid ".concat(e,": ").concat(g(t),".")}function Oi(e){return"1D error band does not support ".concat(e,".")}function _i(e){return"Channel ".concat(e,' is required for "binned" bin.')}function zi(e){return"Channel ".concat(e,' should not be used with "binned" bin.')}const Ci=t.logger(t.Warn);let Pi=Ci;function Ai(e){return Pi=e,Pi}function Ni(){return Pi=Ci,Pi}function ji(){Pi.warn(...arguments)}function Ei(e){if(e&&t.isObject(e))for(const t of Vi)if(t in e)return!0;return!1}const Mi=["january","february","march","april","may","june","july","august","september","october","november","december"],Ti=Mi.map((e=>e.substr(0,3))),Li=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],qi=Li.map((e=>e.substr(0,3)));function Wi(e,n){const i=[];if(n&&void 0!==e.day&&C(e).length>1&&(ji(function(e){return"Dropping day from datetime ".concat(g(e)," as day cannot be combined with other units.")}(e)),delete(e=d(e)).day),void 0!==e.year?i.push(e.year):i.push(2012),void 0!==e.month){const o=n?function(e){if(Q(e)&&(e=+e),t.isNumber(e))return e-1;{const t=e.toLowerCase(),n=Mi.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),o=Ti.indexOf(i);if(-1!==o)return o;throw new Error(Fi("month",e))}}(e.month):e.month;i.push(o)}else if(void 0!==e.quarter){const o=n?function(e){if(Q(e)&&(e=+e),t.isNumber(e))return e>4&&ji(Fi("quarter",e)),e-1;throw new Error(Fi("quarter",e))}(e.quarter):e.quarter;i.push(t.isNumber(o)?3*o:"".concat(o,"*3"))}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const o=n?function(e){if(Q(e)&&(e=+e),t.isNumber(e))return e%7;{const t=e.toLowerCase(),n=Li.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),o=qi.indexOf(i);if(-1!==o)return o;throw new Error(Fi("day",e))}}(e.day):e.day;i.push(t.isNumber(o)?o+1:"".concat(o,"+1"))}else i.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];i.push(void 0===n?0:n)}return i}function Ri(e){const t=Wi(e,!0).join(", ");return e.utc?"utc(".concat(t,")"):"datetime(".concat(t,")")}function Ui(e){const t=Wi(e,!1).join(", ");return e.utc?"utc(".concat(t,")"):"datetime(".concat(t,")")}function Bi(e){const t=Wi(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}const Hi={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Vi=C(Hi);function Ii(e){return e.startsWith("utc")}const Gi={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Yi(e){return Vi.filter((t=>Xi(e,t)))}function Xi(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 Ji(e,t){let{end:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{end:!1};const i=L(t),o=Ii(e)?"utc":"";function r(e){return"quarter"===e?"(".concat(o,"quarter(").concat(i,")-1)"):"".concat(o).concat(e,"(").concat(i,")")}let a;const s={};for(const t of Vi)Xi(e,t)&&(s[t]=r(t),a=t);return n&&(s[a]+="+1"),Ui(s)}function Qi(e){if(!e)return;const t=Yi(e);return"timeUnitSpecifier(".concat(g(t),", ").concat(g(Gi),")")}function $i(e){if(!e)return;let n;return t.isString(e)?n={unit:e}:t.isObject(e)&&(n={...e,...e.unit?{unit:e.unit}:{}}),Ii(n.unit)&&(n.utc=!0,n.unit=n.unit.substr(3)),n}function Ki(e){const{utc:t,...n}=$i(e);return n.unit?(t?"utc":"")+C(n).map((e=>j("".concat("unit"===e?"":"_".concat(e,"_")).concat(n[e])))).join(""):(t?"utc":"")+"timeunit"+C(n).map((e=>j("_".concat(e,"_").concat(n[e])))).join("")}function Zi(e){return e&&!!e.field&&void 0!==e.equal}function eo(e){return e&&!!e.field&&void 0!==e.lt}function to(e){return e&&!!e.field&&void 0!==e.lte}function no(e){return e&&!!e.field&&void 0!==e.gt}function io(e){return e&&!!e.field&&void 0!==e.gte}function oo(e){if(null!=e&&e.field){if(t.isArray(e.range)&&2===e.range.length)return!0;if(gn(e.range))return!0}return!1}function ro(e){return e&&!!e.field&&(t.isArray(e.oneOf)||t.isArray(e.in))}function ao(e){return e&&!!e.field&&void 0!==e.valid}function so(e){return ro(e)||Zi(e)||oo(e)||eo(e)||no(e)||to(e)||io(e)}function co(e,t){return Ha(e,{timeUnit:t,wrapTime:!0})}function lo(e,t){return e.map((e=>co(e,t)))}function uo(e){var t;let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{field:i}=e,o=null===(t=$i(e.timeUnit))||void 0===t?void 0:t.unit,r=o?"time(".concat(Ji(o,i),")"):ka(e,{expr:"datum"});if(Zi(e))return"".concat(r,"===").concat(co(e.equal,o));if(eo(e)){const t=e.lt;return"".concat(r,"<").concat(co(t,o))}if(no(e)){const t=e.gt;return"".concat(r,">").concat(co(t,o))}if(to(e)){const t=e.lte;return"".concat(r,"<=").concat(co(t,o))}if(io(e)){const t=e.gte;return"".concat(r,">=").concat(co(t,o))}if(ro(e))return"indexof([".concat(lo(e.oneOf,o).join(","),"], ").concat(r,") !== -1");if(ao(e))return fo(r,e.valid);if(oo(e)){const{range:t}=e,i=gn(t)?{signal:"".concat(t.signal,"[0]")}:t[0],a=gn(t)?{signal:"".concat(t.signal,"[1]")}:t[1];if(null!==i&&null!==a&&n)return"inrange("+r+", ["+co(i,o)+", "+co(a,o)+"])";const s=[];return null!==i&&s.push("".concat(r," >= ").concat(co(i,o))),null!==a&&s.push("".concat(r," <= ").concat(co(a,o))),s.length>0?s.join(" && "):"true"}throw new Error("Invalid field predicate: ".concat(g(e)))}function fo(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t?"isValid(".concat(e,") && isFinite(+").concat(e,")"):"!isValid(".concat(e,") || !isFinite(+").concat(e,")")}function po(e){var t;return so(e)&&e.timeUnit?{...e,timeUnit:null===(t=$i(e.timeUnit))||void 0===t?void 0:t.unit}:e}function mo(e){return"quantitative"===e||"temporal"===e}function go(e){return"ordinal"===e||"nominal"===e}const ho="quantitative",vo="ordinal",yo="temporal",bo="nominal",xo="geojson";function wo(e){if(e)switch(e=e.toLowerCase()){case"q":case ho:return"quantitative";case"t":case yo:return"temporal";case"o":case vo:return"ordinal";case"n":case bo:return"nominal";case xo:return"geojson"}}const ko="linear",So="log",Do="time",Fo="utc",Oo="point",_o="band",zo={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 Co(e,t){const n=zo[e],i=zo[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const Po={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 Ao(e){return Po[e]}const No=new Set(["linear","log","pow","sqrt","symlog"]),jo=new Set([...No,"time","utc"]);function Eo(e){return No.has(e)}const Mo=new Set(["quantile","quantize","threshold"]),To=new Set([...jo,...Mo,"sequential","identity"]),Lo=new Set(["ordinal","bin-ordinal","point","band"]);function qo(e){return Lo.has(e)}function Wo(e){return To.has(e)}function Ro(e){return jo.has(e)}function Uo(e){return Mo.has(e)}function Bo(e){return null==e?void 0:e.param}const{type:Ho,domain:Vo,range:Io,rangeMax:Go,rangeMin:Yo,scheme:Xo,...Jo}={type:1,domain:1,domainMax:1,domainMin:1,domainMid: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},Qo=C(Jo);function $o(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 Ro(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return Ro(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"clamp":return Ro(e);case"nice":return Ro(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return Wo(e)&&!y(["log","time","utc","threshold","quantile"],e)}}function Ko(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return qe(e)?void 0:'Cannot use the scale property "'.concat(e,'" with non-color channel.');case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function Zo(e,t){return y([vo,bo],t)?void 0===e||qo(e):t===yo?y([Do,Fo,void 0],e):t!==ho||(Eo(e)||Uo(e)||void 0===e)}function er(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!Ht(e))return!1;switch(e){case ee:case te:case oe:case re:case ce:case ae:return!!Ro(t)||("band"===t||"point"===t&&!n);case ye:case Se:case xe:case we:case ke:case be:return Ro(t)||Uo(t)||y(["band","point","ordinal"],t);case me:case ge:case he:return"band"!==t;case De:case ve:return"ordinal"===t||Uo(t)}}const tr={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"},nr=tr.arc,ir=tr.area,or=tr.bar,rr=tr.image,ar=tr.line,sr=tr.point,cr=tr.rect,lr=tr.rule,ur=tr.text,dr=tr.tick,fr=tr.trail,pr=tr.circle,mr=tr.square,gr=tr.geoshape;function hr(e){return["line","area","trail"].includes(e)}function vr(e){return["rect","bar","image","arc"].includes(e)}const yr=new Set(C(tr));function br(e){return e.type}const xr=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],wr=C({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),kr=C({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 Sr(e){return e&&null!=e.band}const Dr={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},Fr={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},Or={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function _r(e){const{channel:t,channelDef:n,markDef:i,scale:o,config:r}=e,a=Nr(e);return ca(n)&&!tn(n.aggregate)&&o&&Ro(o.get("type"))?function(e){let{fieldDef:t,channel:n,markDef:i,ref:o,config:r}=e;if(hr(i.type))return o;if(null===Cn("invalid",i,r))return[zr(t,n),o];return o}({fieldDef:n,channel:t,markDef:i,ref:a,config:r}):a}function zr(e,t){return{test:Cr(e,!0),..."y"===et(t)?{field:{group:"height"}}:{value:0}}}function Cr(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return fo(t.isString(e)?e:ka(e,{expr:"datum"}),!n)}function Pr(e,t,n,i){const o={};if(t&&(o.scale=t),ua(e)){const{datum:t}=e;Ei(t)?o.signal=Ri(t):gn(t)?o.signal=t.signal:dn(t)?o.signal=t.expr:o.value=t}else o.field=ka(e,n);if(i){const{offset:e,band:t}=i;e&&(o.offset=e),t&&(o.band=t)}return o}function Ar(e){let{scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:i,offset:o,startSuffix:r,bandPosition:a=.5}=e;const s=0<a&&a<1?"datum":void 0,c=ka(n,{expr:s,suffix:r}),l=void 0!==i?ka(i,{expr:s}):ka(n,{suffix:"end",expr:s}),u={};if(0===a||1===a){u.scale=t;const e=0===a?c:l;u.field=e}else{const e=gn(a)?"".concat(a.signal," * ").concat(c," + (1-").concat(a.signal,") * ").concat(l):"".concat(a," * ").concat(c," + ").concat(1-a," * ").concat(l);u.signal='scale("'.concat(t,'", ').concat(e,")")}return o&&(u.offset=o),u}function Nr(e){let{channel:n,channelDef:i,channel2Def:o,markDef:r,config:a,scaleName:s,scale:c,stack:l,offset:u,defaultRef:d,bandPosition:f}=e;if(i){if(pa(i)){var p,m;const e=null==c?void 0:c.get("type");if(ma(i)){var g;null!==(g=f)&&void 0!==g||(f=na({fieldDef:i,fieldDef2:o,markDef:r,config:a}));const{bin:t,timeUnit:c,type:d}=i;if(an(t)||f&&c&&d===yo)return null!=l&&l.impute?Pr(i,s,{binSuffix:"mid"},{offset:u}):f&&!qo(e)?Ar({scaleName:s,fieldOrDatumDef:i,bandPosition:f,offset:u}):Pr(i,s,Ia(i,n)?{binSuffix:"range"}:{},{offset:u});if(sn(t)){if(ca(o))return Ar({scaleName:s,fieldOrDatumDef:i,fieldOrDatumDef2:o,bandPosition:f,offset:u});ji(_i(n===ee?ne:ie))}}return Pr(i,s,qo(e)?{binSuffix:"range"}:{},{offset:u,band:"band"===e?null!==(p=null!==(m=f)&&void 0!==m?m:i.bandPosition)&&void 0!==p?p:.5:void 0})}if(ga(i)){const e=u?{offset:u}:{};return{...jr(n,i.value),...e}}}return t.isFunction(d)&&(d=d()),d?{...d,...u?{offset:u}:{}}:d}function jr(e,t){return y(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:y(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:Dn(t)}function Er(e){return e&&"number"!==e&&"time"!==e}function Mr(e,t,n){return"".concat(e,"(").concat(t).concat(n?", ".concat(g(n)):"",")")}function Tr(e){let{fieldOrDatumDef:n,format:i,formatType:o,expr:r,normalizeStack:a,config:s}=e;if(Er(o))return qr({fieldOrDatumDef:n,format:i,formatType:o,expr:r,config:s});const c=Lr(n,r,a);if(Ba(n)){var l,u;const e=function(e,n,i,o,r){return!n||i?(i=t.isString(i)?i:o,"".concat(r?"utc":"time","Format(").concat(e,", '").concat(i,"')")):function(e,t,n){if(!e)return;const i=Qi(e),o=n||Ii(e);return"".concat(o?"utc":"time","Format(").concat(t,", ").concat(i,")")}(n,e,r)}(c,ca(n)?null===(l=$i(n.timeUnit))||void 0===l?void 0:l.unit:void 0,i,s.timeFormat,ha(n)&&(null===(u=n.scale)||void 0===u?void 0:u.type)===Fo);return e?{signal:e}:void 0}if(i=Ur(la(n),i,s),ca(n)&&an(n.bin)){return{signal:Vr(c,ka(n,{expr:r,binSuffix:"end"}),i,o,s)}}return i||"quantitative"===la(n)?{signal:"".concat(Br(c,i))}:{signal:"isValid(".concat(c,") ? ").concat(c,' : ""+').concat(c)}}function Lr(e,t,n){return ca(e)?n?"".concat(ka(e,{expr:t,suffix:"end"}),"-").concat(ka(e,{expr:t,suffix:"start"})):ka(e,{expr:t}):function(e){const{datum:t}=e;return Ei(t)?Ri(t):"".concat(g(t))}(e)}function qr(e){var t;let{fieldOrDatumDef:n,format:i,formatType:o,expr:r,normalizeStack:a,config:s,field:c}=e;if(null!==(t=c)&&void 0!==t||(c=Lr(n,r,a)),ca(n)&&an(n.bin)){return{signal:Vr(c,ka(n,{expr:r,binSuffix:"end"}),i,o,s)}}return{signal:Mr(o,c,i)}}function Wr(e,t,n,i,o,r){if(!Er(i)){if(Ba(e)){var a;return function(e,t,n,i){if(e)return e;if(t)return{signal:Qi(t)};return i?void 0:n.timeFormat}(n,ca(e)?null===(a=$i(e.timeUnit))||void 0===a?void 0:a.unit:void 0,o,r)}return Ur(t,n,o)}}function Rr(e,t,n){return e&&(gn(e)||"number"===e||"time"===e)?e:Ba(t)&&"time"!==n&&"utc"!==n?"time":void 0}function Ur(e,n,i){return t.isString(n)?n:e===ho?i.numberFormat:void 0}function Br(e,t){return"format(".concat(e,', "').concat(t||"",'")')}function Hr(e,n,i,o){var r;return Er(i)?Mr(i,e,n):Br(e,null!==(r=t.isString(n)?n:void 0)&&void 0!==r?r:o.numberFormat)}function Vr(e,t,n,i,o){const r=Hr(e,n,i,o),a=Hr(t,n,i,o);return"".concat(fo(e,!1),' ? "null" : ').concat(r,' + "').concat(" – ",'" + ').concat(a)}const Ir="min",Gr={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 Yr(e){return e in Gr}function Xr(e){return!!e&&!!e.encoding}function Jr(e){return!(!e||"count"!==e.op&&!e.field)}function Qr(e){return!!e&&t.isArray(e)}function $r(e){return"row"in e||"column"in e}function Kr(e){return!!e&&"header"in e}function Zr(e){return"facet"in e}function ea(e){const{field:t,timeUnit:n,bin:i,aggregate:o}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...o?{aggregate:o}:{},field:t}}function ta(e){return"sort"in e}function na(e){let{fieldDef:t,fieldDef2:n,markDef:i,config:o}=e;if(pa(t)&&void 0!==t.bandPosition)return t.bandPosition;if(ca(t)){const{timeUnit:e,bin:r}=t;if(e&&!n)return vr(i.type)?0:Pn("timeUnitBandPosition",i,o);if(an(r))return.5}}function ia(e){let{channel:t,fieldDef:n,fieldDef2:i,markDef:o,config:r,scaleType:a,useVlSizeChannel:s}=e;const c=it(t),l=Cn(s?"size":c,o,r,{vgChannel:c});if(void 0!==l)return l;if(ca(n)){const{timeUnit:e,bin:t}=n;if(e&&!i)return{band:Pn("timeUnitBandSize",o,r)};if(an(t)&&!qo(a))return{band:1}}var u,d,f;return vr(o.type)?a?qo(a)?(null===(d=r[o.type])||void 0===d?void 0:d.discreteBandSize)||{band:1}:null===(f=r[o.type])||void 0===f?void 0:f.continuousBandSize:null===(u=r[o.type])||void 0===u?void 0:u.discreteBandSize:void 0}function oa(e,t,n,i){return!!(an(e.bin)||e.timeUnit&&ma(e)&&"temporal"===e.type)&&void 0!==na({fieldDef:e,fieldDef2:t,markDef:n,config:i})}function ra(e){return e&&"condition"in e}function aa(e){const n=e&&e.condition;return!!n&&!t.isArray(n)&&ca(n)}function sa(e){const n=e&&e.condition;return!!n&&!t.isArray(n)&&pa(n)}function ca(e){return e&&(!!e.field||"count"===e.aggregate)}function la(e){return e&&e.type}function ua(e){return e&&"datum"in e}function da(e){return ma(e)&&!Sa(e)||fa(e)}function fa(e){return ua(e)&&t.isNumber(e.datum)}function pa(e){return ca(e)||ua(e)}function ma(e){return e&&("field"in e||"count"===e.aggregate)&&"type"in e}function ga(e){return e&&"value"in e&&"value"in e}function ha(e){return e&&("scale"in e||"sort"in e)}function va(e){return e&&("axis"in e||"stack"in e||"impute"in e)}function ya(e){return e&&"legend"in e}function ba(e){return e&&("format"in e||"formatType"in e)}function xa(e){return m(e,["legend","axis","header","scale"])}function wa(e){return"op"in e}function ka(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.field;const i=t.prefix;let o=t.suffix,r="";if(Da(e))n=Y("count");else{let i;if(!t.nofn)if(wa(e))i=e.op;else{const{bin:l,aggregate:u,timeUnit:d}=e;var a,s;if(an(l))i=rn(l),o=(null!==(a=t.binSuffix)&&void 0!==a?a:"")+(null!==(s=t.suffix)&&void 0!==s?s:"");else if(u)Kt(u)?(r='["'.concat(n,'"]'),n="argmax_".concat(u.argmax)):$t(u)?(r='["'.concat(n,'"]'),n="argmin_".concat(u.argmin)):i=String(u);else if(d){var c;i=Ki(d),o=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(null!==(c=t.suffix)&&void 0!==c?c:"")}}i&&(n=n?"".concat(i,"_").concat(n):i)}return o&&(n="".concat(n,"_").concat(o)),i&&(n="".concat(i,"_").concat(n)),t.forAs?B(n):t.expr?q(n,t.expr)+r:R(n)+r}function Sa(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return ca(e)&&!!e.bin;case"temporal":return!1}throw new Error(ii(e.type))}function Da(e){return"count"===e.aggregate}const Fa=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:o}=e;if(Kt(t))return"".concat(o," for argmax(").concat(t.argmax,")");if($t(t))return"".concat(o," for argmin(").concat(t.argmin,")");const r=$i(i),a=t||(null==r?void 0:r.unit)||(null==r?void 0:r.maxbins)&&"timeunit"||an(n)&&"bin";return a?"".concat(a.toUpperCase(),"(").concat(o,")"):o}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:o,aggregate:r}=e;if("count"===r)return t.countTitle;if(an(i))return"".concat(n," (binned)");if(o){var a;const e=null===(a=$i(o))||void 0===a?void 0:a.unit;if(e)return"".concat(n," (").concat(Yi(e).join("-"),")")}else if(r)return Kt(r)?"".concat(n," for max ").concat(r.argmax):$t(r)?"".concat(n," for min ").concat(r.argmin):"".concat(T(r)," of ").concat(n);return n}(e,t)}};let Oa=Fa;function _a(e){Oa=e}function za(){_a(Fa)}function Ca(e,t,n){var i;let{allowDisabling:o,includeDefault:r=!0}=n;const a=null===(i=Pa(e))||void 0===i?void 0:i.title;if(!ca(e))return null!=a?a:e.title;const s=e,c=r?Aa(s,t):void 0;return o?V(a,s.title,c):null!==(l=null!=a?a:s.title)&&void 0!==l?l:c;var l}function Pa(e){return va(e)&&e.axis?e.axis:ya(e)&&e.legend?e.legend:Kr(e)&&e.header?e.header:void 0}function Aa(e,t){return Oa(e,t)}function Na(e){if(ba(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{var t;const n=null!==(t=Pa(e))&&void 0!==t?t:{},{format:i,formatType:o}=n;return{format:i,formatType:o}}}function ja(e,n){var i;switch(n){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(ta(e)&&t.isArray(e.sort))return"ordinal";const{aggregate:o,bin:r,timeUnit:a}=e;if(a)return"temporal";if(r||o&&!Kt(o)&&!$t(o))return"quantitative";if(ha(e)&&null!==(i=e.scale)&&void 0!==i&&i.type)switch(zo[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function Ea(e){return ca(e)?e:aa(e)?e.condition:void 0}function Ma(e){return pa(e)?e:sa(e)?e.condition:void 0}function Ta(e,n,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(t.isString(e)||t.isNumber(e)||t.isBoolean(e)){return ji(ni(n,t.isString(e)?"string":t.isNumber(e)?"number":"boolean",e)),{value:e}}return pa(e)?La(e,n,i,o):sa(e)?{...e,condition:La(e.condition,n,i,o)}:e}function La(e,n,i,o){if(ba(e)){const{format:t,formatType:r,...a}=e;if(Er(r)&&!i.customFormatTypes)return ji(Zn(n)),La(a,n,i,o)}else{const t=va(e)?"axis":ya(e)?"legend":Kr(e)?"header":null;if(t&&e[t]){const{format:r,formatType:a,...s}=e[t];if(Er(a)&&!i.customFormatTypes)return ji(Zn(n)),La({...e,[t]:s},n,i,o)}}return ca(e)?qa(e,n,o):function(e){let n=e.type;if(n)return e;const{datum:i}=e;return n=t.isNumber(i)?"quantitative":t.isString(i)?"nominal":Ei(i)?"temporal":void 0,{...e,type:n}}(e)}function qa(e,n){let{compositeMark:i=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{aggregate:o,timeUnit:r,bin:a,field:s}=e,c={...e};if(i||!o||Zt(o)||Kt(o)||$t(o)||(ji(ri(o)),delete c.aggregate),r&&(c.timeUnit=$i(r)),s&&(c.field="".concat(s)),an(a)&&(c.bin=Wa(a,n)),sn(a)&&!Ft(n)&&ji(zi(n)),ma(c)){const{type:e}=c,t=wo(e);e!==t&&(c.type=t),"quantitative"!==e&&tn(o)&&(ji(oi(e,o)),c.type="quantitative")}else if(!Ze(n)){const e=ja(c,n);c.type=e}if(ma(c)){const{compatible:e,warning:t}=Ua(c,n)||{};!1===e&&ji(t)}if(ta(c)&&t.isString(c.sort)){const{sort:e}=c;if(Yr(e))return{...c,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&Yr(t))return{...c,sort:{encoding:t,order:"descending"}}}if(Kr(c)){const{header:e}=c;if(e){const{orient:t,...n}=e;if(t)return{...c,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return c}function Wa(e,n){return t.isBoolean(e)?{maxbins:un(n)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:un(n)}}const Ra={compatible:!0};function Ua(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:"Channel ".concat(t," should not be used with a geojson data.")};switch(t){case $:case K:case Z:return Sa(e)?Ra:{compatible:!1,warning:ui(t)};case ee:case te:case oe:case re:case me:case ge:case he:case Fe:case _e:case ze:case Ce:case Pe:case Ae:case be:case ce:case ae:case Ne:return Ra;case de:case pe:case ue:case fe:return n!==ho?{compatible:!1,warning:"Channel ".concat(t," should be used with a quantitative field only, not ").concat(e.type," field.")}:Ra;case xe:case we:case ke:case Se:case ye:case le:case se:case ne:case ie:return"nominal"!==n||e.sort?Ra:{compatible:!1,warning:"Channel ".concat(t," should not be used with an unsorted discrete field.")};case ve:case De:return Sa(e)||ha(i=e)&&Uo(null===(o=i.scale)||void 0===o?void 0:o.type)?Ra:{compatible:!1,warning:di(t)};case Oe:return"nominal"!==e.type||"sort"in e?Ra:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i,o}function Ba(e){const{formatType:t}=Na(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||ca(n)&&!!n.timeUnit));var n}function Ha(e,n){var i;let{timeUnit:o,type:r,wrapTime:a,undefinedIfExprNotRequired:s}=n;const c=o&&(null===(i=$i(o))||void 0===i?void 0:i.unit);let l,u=c||"temporal"===r;return dn(e)?l=e.expr:gn(e)?l=e.signal:Ei(e)?(u=!0,l=Ri(e)):(t.isString(e)||t.isNumber(e))&&u&&(l="datetime(".concat(g(e),")"),function(e){return!!Hi[e]}(c)&&(t.isNumber(e)&&e<1e4||t.isString(e)&&isNaN(Date.parse(e)))&&(l=Ri({[c]:e}))),l?a&&u?"time(".concat(l,")"):l:s?void 0:g(e)}function Va(e,t){const{type:n}=e;return t.map((t=>{const i=Ha(t,{timeUnit:ca(e)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function Ia(e,t){return an(e.bin)?Ht(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const Ga={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 Ya(e){return e&&e.condition}const Xa=["domain","grid","labels","ticks","title"],Ja={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"},Qa={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},$a={...Qa,style:1,labelExpr:1,encoding:1};function Ka(e){return!!$a[e]}const Za=C({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 es(e){return"mark"in e}class ts{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!es(e)&&(br(t=e.mark)?t.type:t)===this.name;var t}}function ns(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?b(i,(e=>!!e.field)):ca(i)||aa(i))}function is(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?b(i,(e=>!!e.field)):ca(i)||ua(i)||sa(i))}function os(e,t){if(Ft(t)){const n=e[t];if((ca(n)||ua(n))&&go(n.type)){return is(e,ot(t))}}return!1}function rs(e){return b(Be,(n=>{if(ns(e,n)){const i=e[n];if(t.isArray(i))return b(i,(e=>!!e.aggregate));{const e=Ea(i);return e&&!!e.aggregate}}return!1}))}function as(e,t){const n=[],i=[],o=[],r=[],a={};return us(e,((s,c)=>{if(ca(s)){const{field:l,aggregate:u,bin:d,timeUnit:f,...p}=s;if(u||f||d){const e=Pa(s),m=null==e?void 0:e.title;let g=ka(s,{forAs:!0});const h={...m?[]:{title:Ca(s,t,{allowDisabling:!0})},...p,field:g};if(u){let e;if(Kt(u)?(e="argmax",g=ka({op:"argmax",field:u.argmax},{forAs:!0}),h.field="".concat(g,".").concat(l)):$t(u)?(e="argmin",g=ka({op:"argmin",field:u.argmin},{forAs:!0}),h.field="".concat(g,".").concat(l)):"boxplot"!==u&&"errorbar"!==u&&"errorband"!==u&&(e=u),e){const t={op:e,as:g};l&&(t.field=l),r.push(t)}}else if(n.push(g),ma(s)&&an(d)){if(i.push({bin:d,field:l,as:g}),n.push(ka(s,{binSuffix:"end"})),Ia(s,c)&&n.push(ka(s,{binSuffix:"range"})),Ft(c)){const e={field:"".concat(g,"_end")};a["".concat(c,"2")]=e}h.bin="binned",Ze(c)||(h.type=ho)}else if(f){o.push({timeUnit:f,field:l,as:g});const e=ma(s)&&s.type!==yo&&"time";e&&(c===Fe||c===Ce?h.formatType=e:!function(e){return!!wt[e]}(c)?Ft(c)&&(h.axis={formatType:e,...h.axis}):h.legend={formatType:e,...h.legend})}a[c]=h}else n.push(l),a[c]=e[c]}else a[c]=e[c]})),{bins:i,timeUnits:o,aggregate:r,groupby:n,encoding:a}}function ss(e,t,n){const i=Vt(t,n);if(!i)return!1;if("binned"===i){const n=e[t===ne?ee:te];return!!(ca(n)&&ca(e[t])&&sn(n.bin))}return!0}function cs(e,t){const n={};for(const i of C(e)){const o=Ta(e[i],i,t,{compositeMark:!0});n[i]=o}return n}function ls(e){const n=[];for(const i of C(e))if(ns(e,i)){const o=e[i],r=t.array(o);for(const e of r)ca(e)?n.push(e):aa(e)&&n.push(e.condition)}return n}function us(e,n,i){if(e)for(const o of C(e)){const r=e[o];if(t.isArray(r))for(const e of r)n.call(i,e,o);else n.call(i,r,o)}}function ds(e,n){return C(n).reduce(((i,o)=>{switch(o){case ee:case te:case Pe:case Ne:case Ae:case ne:case ie:case oe:case re:case ce:case le:case ae:case se:case ue:case de:case fe:case pe:case Fe:case ve:case be:case Ce:return i;case Oe:if("line"===e||"trail"===e)return i;case _e:case ze:{const e=n[o];if(t.isArray(e)||ca(e))for(const n of t.array(e))n.aggregate||i.push(ka(n,{}));return i}case ye:if("trail"===e)return i;case me:case ge:case he:case xe:case we:case ke:case De:case Se:{const e=Ea(n[o]);return e&&!e.aggregate&&i.push(ka(e,{})),i}}}),[])}function fs(e,t,n){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if("tooltip"in n)return{tooltip:n.tooltip};const o=e.map((e=>{let{fieldPrefix:n,titlePrefix:o}=e;const r=i?" of ".concat(ps(t)):"";return{field:n+t.field,type:t.type,title:gn(o)?{signal:"".concat(o,'"').concat(escape(r),'"')}:o+r}})),r=ls(n).map(xa);return{tooltip:[...o,...S(r,h)]}}function ps(e){const{title:t,field:n}=e;return V(t,n)}function ms(e,n,i,o,r){const{scale:a,axis:s}=i;return c=>{let{partName:l,mark:u,positionPrefix:d,endPositionPrefix:f,extraEncoding:p={}}=c;const m=ps(i);return gs(e,l,r,{mark:u,encoding:{[n]:{field:"".concat(d,"_").concat(i.field),type:i.type,...void 0!==m?{title:m}:{},...void 0!==a?{scale:a}:{},...void 0!==s?{axis:s}:{}},...t.isString(f)?{["".concat(n,"2")]:{field:"".concat(f,"_").concat(i.field)}}:{},...o,...p}})}}function gs(e,n,i,o){const{clip:r,color:a,opacity:s}=e,c=e.type;return e[n]||void 0===e[n]&&i[n]?[{...o,mark:{...i[n],...r?{clip:r}:{},...a?{color:a}:{},...s?{opacity:s}:{},...br(o.mark)?o.mark:{type:o.mark},style:"".concat(c,"-").concat(n),...t.isBoolean(e[n])?{}:e[n]}}]:[]}function hs(e,t,n){const{encoding:i}=e,o="vertical"===t?"y":"x",r=i[o],a=i["".concat(o,"2")],s=i["".concat(o,"Error")],c=i["".concat(o,"Error2")];return{continuousAxisChannelDef:vs(r,n),continuousAxisChannelDef2:vs(a,n),continuousAxisChannelDefError:vs(s,n),continuousAxisChannelDefError2:vs(c,n),continuousAxis:o}}function vs(e,t){if(null!=e&&e.aggregate){const{aggregate:n,...i}=e;return n!==t&&ji(function(e,t){return"Continuous axis should not have customized aggregation function ".concat(e,"; ").concat(t," already agregates the axis.")}(n,t)),i}return e}function ys(e,t){const{mark:n,encoding:i}=e,{x:o,y:r}=i;if(br(n)&&n.orient)return n.orient;if(da(o)){if(da(r)){const e=ca(o)&&o.aggregate,n=ca(r)&&r.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 Ba(r)&&!Ba(o)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(da(r))return"vertical";throw new Error("Need a valid continuous axis for ".concat(t,"s"))}const bs="boxplot",xs=new ts(bs,ks);function ws(e){return t.isNumber(e)?"tukey":e}function ks(e,n){var i;let{config:o}=n;e={...e,encoding:cs(e.encoding,o)};const{mark:r,encoding:a,params:s,projection:c,...l}=e,u=br(r)?r:{type:r};s&&ji(Jn("boxplot"));const d=null!==(i=u.extent)&&void 0!==i?i:o.boxplot.extent,f=Cn("size",u,o),p=ws(d),{bins:g,timeUnits:h,transform:v,continuousAxisChannelDef:y,continuousAxis:b,groupby:x,aggregate:w,encodingWithoutContinuousAxis:k,ticksOrient:S,boxOrient:D,customTooltipWithoutAggregatedField:F}=function(e,n,i){const o=ys(e,bs),{continuousAxisChannelDef:r,continuousAxis:a}=hs(e,o,bs),s=r.field,c=ws(n),l=[...Ss(s),{op:"median",field:s,as:"mid_box_".concat(s)},{op:"min",field:s,as:("min-max"===c?"lower_whisker_":"min_")+s},{op:"max",field:s,as:("min-max"===c?"upper_whisker_":"max_")+s}],u="min-max"===c||"tukey"===c?[]:[{calculate:'datum["upper_box_'.concat(s,'"] - datum["lower_box_').concat(s,'"]'),as:"iqr_".concat(s)},{calculate:'min(datum["upper_box_'.concat(s,'"] + datum["iqr_').concat(s,'"] * ').concat(n,', datum["max_').concat(s,'"])'),as:"upper_whisker_".concat(s)},{calculate:'max(datum["lower_box_'.concat(s,'"] - datum["iqr_').concat(s,'"] * ').concat(n,', datum["min_').concat(s,'"])'),as:"lower_whisker_".concat(s)}],{[a]:d,...f}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:m}=function(e){const{tooltip:n,...i}=e;if(!n)return{filteredEncoding:i};let o,r;if(t.isArray(n)){for(const e of n)e.aggregate?(o||(o=[]),o.push(e)):(r||(r=[]),r.push(e));o&&(i.tooltip=o)}else n.aggregate?i.tooltip=n:r=n;return t.isArray(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:i}}(f),{bins:g,timeUnits:h,aggregate:v,groupby:y,encoding:b}=as(m,i),x="vertical"===o?"horizontal":"vertical",w=o,k=[...g,...h,{aggregate:[...v,...l],groupby:y},...u];return{bins:g,timeUnits:h,transform:k,groupby:y,aggregate:v,continuousAxisChannelDef:r,continuousAxis:a,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:p}}(e,d,o),{color:O,size:_,...C}=k,P=e=>ms(u,b,y,e,o.boxplot),A=P(C),N=P(k),j=P({...C,..._?{size:_}:{}}),E=fs([{fieldPrefix:"min-max"===p?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===p?"lower_whisker_":"min_",titlePrefix:"Min"}],y,k),M={type:"tick",color:"black",opacity:1,orient:S,invalid:null,aria:!1},T="min-max"===p?E:fs([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],y,k),L=[...A({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:T}),...A({partName:"rule",mark:{type:"rule",invalid:null,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:T}),...A({partName:"ticks",mark:M,positionPrefix:"lower_whisker",extraEncoding:T}),...A({partName:"ticks",mark:M,positionPrefix:"upper_whisker",extraEncoding:T})],q=[..."tukey"!==p?L:[],...N({partName:"box",mark:{type:"bar",...f?{size:f}:{},orient:D,invalid:null,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:E}),...j({partName:"median",mark:{type:"tick",invalid:null,...t.isObject(o.boxplot.median)&&o.boxplot.median.color?{color:o.boxplot.median.color}:{},...f?{size:f}:{},orient:S,aria:!1},positionPrefix:"mid_box",extraEncoding:E})];var W;if("min-max"===p)return{...l,transform:(null!==(W=l.transform)&&void 0!==W?W:[]).concat(v),layer:q};const R='datum["lower_box_'.concat(y.field,'"]'),U='datum["upper_box_'.concat(y.field,'"]'),B="(".concat(U," - ").concat(R,")"),H="".concat(R," - ").concat(d," * ").concat(B),V="".concat(U," + ").concat(d," * ").concat(B),I='datum["'.concat(y.field,'"]'),G={joinaggregate:Ss(y.field),groupby:x},Y={transform:[{filter:"(".concat(H," <= ").concat(I,") && (").concat(I," <= ").concat(V,")")},{aggregate:[{op:"min",field:y.field,as:"lower_whisker_".concat(y.field)},{op:"max",field:y.field,as:"upper_whisker_".concat(y.field)},{op:"min",field:"lower_box_".concat(y.field),as:"lower_box_".concat(y.field)},{op:"max",field:"upper_box_".concat(y.field),as:"upper_box_".concat(y.field)},...w],groupby:x}],layer:L},{tooltip:X,...J}=C,{scale:Q,axis:$}=y,K=ps(y),Z=m($,["title"]),ee=gs(u,"outliers",o.boxplot,{transform:[{filter:"(".concat(I," < ").concat(H,") || (").concat(I," > ").concat(V,")")}],mark:"point",encoding:{[b]:{field:y.field,type:y.type,...void 0!==K?{title:K}:{},...void 0!==Q?{scale:Q}:{},...z(Z)?{}:{axis:Z}},...J,...O?{color:O}:{},...F?{tooltip:F}:{}}})[0];let te;const ne=[...g,...h,G];return ee?te={transform:ne,layer:[ee,Y]}:(te=Y,te.transform.unshift(...ne)),{...l,layer:[te,{transform:v,layer:q}]}}function Ss(e){return[{op:"q1",field:e,as:"lower_box_".concat(e)},{op:"q3",field:e,as:"upper_box_".concat(e)}]}const Ds="errorbar",Fs=new ts(Ds,Os);function Os(e,t){let{config:n}=t;e={...e,encoding:cs(e.encoding,n)};const{transform:i,continuousAxisChannelDef:o,continuousAxis:r,encodingWithoutContinuousAxis:a,ticksOrient:s,markDef:c,outerSpec:l,tooltipEncoding:u}=zs(e,Ds,n);delete a.size;const d=ms(c,r,o,a,n.errorbar),f=c.thickness,p=c.size,m={type:"tick",orient:s,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==p?{size:p}:{}},g=[...d({partName:"ticks",mark:m,positionPrefix:"lower",extraEncoding:u}),...d({partName:"ticks",mark:m,positionPrefix:"upper",extraEncoding:u}),...d({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...l,transform:i,...g.length>1?{layer:g}:{...g[0]}}}function _s(e,t){const{encoding:n}=e;if(function(e){return(pa(e.x)||pa(e.y))&&!pa(e.x2)&&!pa(e.y2)&&!pa(e.xError)&&!pa(e.xError2)&&!pa(e.yError)&&!pa(e.yError2)}(n))return{orient:ys(e,t),inputType:"raw"};const i=function(e){return pa(e.x2)||pa(e.y2)}(n),o=function(e){return pa(e.xError)||pa(e.xError2)||pa(e.yError)||pa(e.yError2)}(n),r=n.x,a=n.y;if(i){if(o)throw new Error("".concat(t," cannot be both type aggregated-upper-lower and aggregated-error"));const e=n.x2,i=n.y2;if(pa(e)&&pa(i))throw new Error("".concat(t," cannot have both x2 and y2"));if(pa(e)){if(da(r))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in ".concat(t))}if(pa(i)){if(da(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error("Both y and y2 have to be quantitative in ".concat(t))}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,o=n.yError,s=n.yError2;if(pa(i)&&!pa(e))throw new Error("".concat(t," cannot have xError2 without xError"));if(pa(s)&&!pa(o))throw new Error("".concat(t," cannot have yError2 without yError"));if(pa(e)&&pa(o))throw new Error("".concat(t," cannot have both xError and yError with both are quantiative"));if(pa(e)){if(da(r))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(pa(o)){if(da(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 zs(e,t,n){var i;const{mark:o,encoding:r,params:a,projection:s,...c}=e,l=br(o)?o:{type:o};a&&ji(Jn(t));const{orient:u,inputType:d}=_s(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:p,continuousAxisChannelDefError:m,continuousAxisChannelDefError2:g,continuousAxis:h}=hs(e,u,t),{errorBarSpecificAggregate:v,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:x}=function(e,t,n,i,o,r,a,s){let c=[],l=[];const u=t.field;let d,f=!1;if("raw"===r){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)&&ji(function(e,t,n){return"".concat(e," is not usually used with ").concat(t," for ").concat(n,".")}(t,n,a)),"stderr"===n||"stdev"===n)c=[{op:n,field:u,as:"extent_".concat(u)},{op:t,field:u,as:"center_".concat(u)}],l=[{calculate:'datum["center_'.concat(u,'"] + datum["extent_').concat(u,'"]'),as:"upper_".concat(u)},{calculate:'datum["center_'.concat(u,'"] - datum["extent_').concat(u,'"]'),as:"lower_".concat(u)}],d=[{fieldPrefix:"center_",titlePrefix:T(t)},{fieldPrefix:"upper_",titlePrefix:Cs(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:Cs(t,n,"-")}],f=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),c=[{op:t,field:u,as:"lower_".concat(u)},{op:i,field:u,as:"upper_".concat(u)},{op:e,field:u,as:"center_".concat(u)}],d=[{fieldPrefix:"upper_",titlePrefix:Ca({field:u,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Ca({field:u,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Ca({field:u,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&ji((p=e.center,m=e.extent,"".concat(m?"extent ":"").concat(m&&p?"and ":"").concat(p?"center ":"").concat(m&&p?"are ":"is ","not needed when data are aggregated."))),"aggregated-upper-lower"===r?(d=[],l=[{calculate:'datum["'.concat(n.field,'"]'),as:"upper_".concat(u)},{calculate:'datum["'.concat(u,'"]'),as:"lower_".concat(u)}]):"aggregated-error"===r&&(d=[{fieldPrefix:"",titlePrefix:u}],l=[{calculate:'datum["'.concat(u,'"] + datum["').concat(i.field,'"]'),as:"upper_".concat(u)}],o?l.push({calculate:'datum["'.concat(u,'"] + datum["').concat(o.field,'"]'),as:"lower_".concat(u)}):l.push({calculate:'datum["'.concat(u,'"] - datum["').concat(i.field,'"]'),as:"lower_".concat(u)}));for(const e of l)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:U(U(e.calculate,'datum["',""),'"]',"")})}var p,m;return{postAggregateCalculates:l,errorBarSpecificAggregate:c,tooltipSummary:d,tooltipTitleWithFieldName:f}}(l,f,p,m,g,d,t,n),{[h]:w,["x"===h?"x2":"y2"]:k,["x"===h?"xError":"yError"]:S,["x"===h?"xError2":"yError2"]:D,...F}=r,{bins:O,timeUnits:_,aggregate:z,groupby:C,encoding:P}=as(F,n),A=[...z,...v],N="raw"!==d?[]:C,j=fs(b,f,P,x);return{transform:[...null!==(i=c.transform)&&void 0!==i?i:[],...O,..._,...0===A.length?[]:[{aggregate:A,groupby:N}],...y],groupby:N,continuousAxisChannelDef:f,continuousAxis:h,encodingWithoutContinuousAxis:P,ticksOrient:"vertical"===u?"horizontal":"vertical",markDef:l,outerSpec:c,tooltipEncoding:j}}function Cs(e,t,n){return"".concat(T(e)," ").concat(n," ").concat(t)}const Ps="errorband",As=new ts(Ps,Ns);function Ns(e,t){let{config:n}=t;e={...e,encoding:cs(e.encoding,n)};const{transform:i,continuousAxisChannelDef:o,continuousAxis:r,encodingWithoutContinuousAxis:a,markDef:s,outerSpec:c,tooltipEncoding:l}=zs(e,Ps,n),u=s,d=ms(u,r,o,a,n.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let p={type:f?"area":"rect"},m={type:f?"line":"rule"};const g={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return f?(p={...p,...g,ariaRoleDescription:"errorband"},m={...m,...g,aria:!1}):u.interpolate?ji(Oi("interpolate")):u.tension&&ji(Oi("tension")),{...c,transform:i,layer:[...d({partName:"band",mark:p,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l}),...d({partName:"borders",mark:m,positionPrefix:"lower",extraEncoding:l}),...d({partName:"borders",mark:m,positionPrefix:"upper",extraEncoding:l})]}}const js={};function Es(e,t,n){const i=new ts(e,t);js[e]={normalizer:i,parts:n}}Es(bs,ks,["box","median","outliers","rule","ticks"]),Es(Ds,Os,["ticks","rule"]),Es(Ps,Ns,["band","borders"]);const Ms=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],Ts={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"},Ls={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"},qs=C(Ts),Ws=C(Ls),Rs=C({header:1,headerRow:1,headerColumn:1,headerFacet:1}),Us=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],Bs="_vgsid_",Hs={point:{on:"click",fields:[Bs],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Vs(e){return!(!e||"legend"!==e&&!e.legend)}function Is(e){return Vs(e)&&t.isObject(e)}function Gs(e){return!!e.select}function Ys(e){const t=[];for(const n of e||[]){if(Gs(n))continue;const{expr:e,bind:i,...o}=n;if(i&&e){const n={...o,bind:i,init:e};t.push(n)}else{const n={...o,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function Xs(e){return"concat"in e}function Js(e){return"vconcat"in e}function Qs(e){return"hconcat"in e}const $s=["background","padding"];function Ks(e,t){const n={};for(const t of $s)e&&void 0!==e[t]&&(n[t]=kn(e[t]));return t&&(n.params=e.params),n}function Zs(e){let{step:t,offsetIsDiscrete:n}=e;var i;return n?null!==(i=t.for)&&void 0!==i?i:"offset":"position"}function ec(e){return t.isObject(e)&&void 0!==e.step}function tc(e){return e.view||e.width||e.height}const nc=C({align:1,bounds:1,center:1,columns:1,spacing:1});function ic(e,t){var n;return null!==(n=e[t])&&void 0!==n?n:e["width"===t?"continuousWidth":"continuousHeight"]}function oc(e,t){const n=rc(e,t);return ec(n)?n.step:ac}function rc(e,t){var n;return V(null!==(n=e[t])&&void 0!==n?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const ac=20,sc={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:ac},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:Fr,circle:{},geoshape:{},image:{},line:{},point:{},rect:Or,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Hs,style:{},title:{},facet:{spacing:20},concat:{spacing:20}},cc=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],lc={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},uc={blue:cc[0],orange:cc[1],red:cc[2],teal:cc[3],green:cc[4],yellow:cc[5],purple:cc[6],pink:cc[7],brown:cc[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 dc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{signals:[{name:"color",value:t.isObject(e)?{...uc,...e}:uc}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}function fc(e){return{signals:[{name:"fontSize",value:t.isObject(e)?{...lc,...e}:lc}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}function pc(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function mc(e){const t=C(e||{}),n={};for(const i of t){const t=e[i];n[i]=Ya(t)?wn(t):kn(t)}return n}function gc(e){const t=C(e),n={};for(const i of t)n[i]=mc(e[i]);return n}const hc=[...kr,...Za,...Rs,"background","padding","legend","lineBreak","scale","style","title","view"];function vc(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:n,font:i,fontSize:o,selection:r,...a}=e,s=t.mergeConfig({},d(sc),i?pc(i):{},n?dc(n):{},o?fc(o):{},a||{});r&&t.writeConfig(s,"selection",r,!0);const c=m(s,hc);for(const e of["background","lineBreak","padding"])s[e]&&(c[e]=kn(s[e]));for(const e of kr)s[e]&&(c[e]=fn(s[e]));for(const e of Za)s[e]&&(c[e]=mc(s[e]));for(const e of Rs)s[e]&&(c[e]=fn(s[e]));return s.legend&&(c.legend=fn(s.legend)),s.scale&&(c.scale=fn(s.scale)),s.style&&(c.style=gc(s.style)),s.title&&(c.title=fn(s.title)),s.view&&(c.view=fn(s.view)),c}const yc=new Set(["view",...yr]),bc=["color","fontSize","background","padding","facet","concat","numberFormat","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],xc={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]};function wc(e){e=d(e);for(const t of bc)delete e[t];if(e.axis)for(const t in e.axis)Ya(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of Ms)delete e.legend[t];if(e.mark){for(const t of wr)delete e.mark[t];e.mark.tooltip&&t.isObject(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(Ys(e.params)),delete e.params);for(const t of yc){for(const n of wr)delete e[t][n];const n=xc[t];if(n)for(const i of n)delete e[t][i];kc(e,t)}for(const t of C(js))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=pn(e.title);z(t)||(e.style["group-title"]={...e.style["group-title"],...t});z(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});z(i)?delete e.title:e.title=i}(e);for(const n in e)t.isObject(e[n])&&z(e[n])&&delete e[n];return z(e)?void 0:e}function kc(e,t,n,i){var o;"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[null!==(o=n)&&void 0!==o?o:t]};var a;z(r)||(e.style[null!==(a=n)&&void 0!==a?a:t]=r);i||delete e[t]}function Sc(e){return"layer"in e}class Dc{map(e,t){return Zr(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):Qs(e)?this.mapHConcat(e,t):Js(e)?this.mapVConcat(e,t):Xs(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Sc(e))return this.mapLayer(e,t);if(es(e))return this.mapUnit(e,t);throw new Error(Un(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 Fc={zero:1,center:1,normalize:1};function Oc(e){return e in Fc}const _c=new Set([nr,or,ir,lr,sr,pr,mr,ar,ur,dr]),zc=new Set([or,ir,nr]);function Cc(e){return ca(e)&&"quantitative"===la(e)&&!e.bin}function Pc(e,t){const n="x"===t?"y":"radius",i=e[t],o=e[n];if(ca(i)&&ca(o))if(Cc(i)&&Cc(o)){if(i.stack)return t;if(o.stack)return n;const e=ca(i)&&!!i.aggregate;if(e!==(ca(o)&&!!o.aggregate))return e?t:n;{var r,a;const e=null===(r=i.scale)||void 0===r?void 0:r.type,s=null===(a=o.scale)||void 0===a?void 0:a.type;if(e&&"linear"!==e)return n;if(s&&"linear"!==s)return t}}else{if(Cc(i))return t;if(Cc(o))return n}else{if(Cc(i))return t;if(Cc(o))return n}}function Ac(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function Nc(e,n){var i,o;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=br(e)?e.type:e;if(!_c.has(a))return null;const s=Pc(n,"x")||Pc(n,"theta");if(!s)return null;const c=n[s],l=ca(c)?ka(c,{}):void 0,u=Ac(s),d=[],f=new Set;if(n[u]){const e=n[u],t=ca(e)?ka(e,{}):void 0;t&&t!==l&&(d.push(u),f.add(t));const i="x"===u?"xOffset":"yOffset",o=n[i],r=ca(o)?ka(o,{}):void 0;r&&r!==l&&(d.push(i),f.add(r))}const p=kt.reduce(((e,i)=>{if("tooltip"!==i&&ns(n,i)){const o=n[i];for(const n of t.array(o)){const t=Ea(n);if(t.aggregate)continue;const o=ka(t,{});o&&f.has(o)||e.push({channel:i,fieldDef:t})}}return e}),[]);let m;if(void 0!==c.stack?m=t.isBoolean(c.stack)?c.stack?"zero":null:c.stack:zc.has(a)&&(m="zero"),!m||!Oc(m))return null;if(rs(n)&&0===p.length)return null;if(null!=c&&null!==(i=c.scale)&&void 0!==i&&i.type&&(null==c||null===(o=c.scale)||void 0===o?void 0:o.type)!==ko){if(r.disallowNonLinearStack)return null;ji(Si(c.scale.type))}return pa(n[nt(s)])?(void 0!==c.stack&&ji(ki(s)),null):(ca(c)&&c.aggregate&&!nn.has(c.aggregate)&&ji(Di(c.aggregate)),{groupbyChannels:d,groupbyFields:f,fieldChannel:s,impute:null!==c.impute&&hr(a),stackBy:p,offset:m})}function jc(e){const{point:t,line:n,...i}=e;return C(i).length>1?i:i.type}function Ec(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:m(e[t],["point","line"])});return e}function Mc(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;return"transparent"===e.point?{opacity:0}:e.point?t.isObject(e.point)?e.point:{}:void 0!==e.point?null:n.point||i.shape?t.isObject(n.point)?n.point:{}:void 0}function Tc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class Lc{constructor(){Ln(this,"name","path-overlay")}hasMatchingType(e,t){if(es(e)){const{mark:n,encoding:i}=e,o=br(n)?n:{type:n};switch(o.type){case"line":case"rule":case"trail":return!!Mc(o,t[o.type],i);case"area":return!!Mc(o,t[o.type],i)||!!Tc(o,t[o.type])}}return!1}run(e,t,n){const{config:i}=t,{params:o,projection:r,mark:a,encoding:s,...c}=e,l=cs(s,i),u=br(a)?a:{type:a},d=Mc(u,i[u.type],l),f="area"===u.type&&Tc(u,i[u.type]),g=[{...o?{params:o}:{},mark:jc({..."area"===u.type&&void 0===u.opacity&&void 0===u.fillOpacity?{opacity:.7}:{},...u}),encoding:m(l,["shape"])}],h=Nc(u,l);let v=l;if(h){const{fieldChannel:e,offset:t}=h;v={...l,[e]:{...l[e],...t?{stack:t}:{}}}}return f&&g.push({...r?{projection:r}:{},mark:{type:"line",...p(u,["clip","interpolate","tension","tooltip"]),...f},encoding:v}),d&&g.push({...r?{projection:r}:{},mark:{type:"point",opacity:1,filled:!0,...p(u,["clip","tooltip"]),...d},encoding:v}),n({...c,layer:g},{...t,config:Ec(i)})}}function qc(e,t){return t?$r(e)?Vc(e,t):Uc(e,t):e}function Wc(e,t){return t?Vc(e,t):e}function Rc(e,n,i){const o=n[e];return(r=o)&&!t.isString(r)&&"repeat"in r?o.repeat in i?{...n,[e]:i[o.repeat]}:void ji(function(e){return'Unknown repeated value "'.concat(e,'".')}(o.repeat)):n;var r}function Uc(e,t){if(void 0!==(e=Rc("field",e,t))){if(null===e)return null;if(ta(e)&&Jr(e.sort)){const n=Rc("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function Bc(e,t){if(ca(e))return Uc(e,t);{const n=Rc("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function Hc(e,t){if(!pa(e)){if(sa(e)){const n=Bc(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=Bc(e,t);if(n)return n;if(ra(e))return{condition:e.condition}}}function Vc(e,n){const i={};for(const o in e)if(t.hasOwnProperty(e,o)){const r=e[o];if(t.isArray(r))i[o]=r.map((e=>Hc(e,n))).filter((e=>e));else{const e=Hc(r,n);void 0!==e&&(i[o]=e)}}return i}class Ic{constructor(){Ln(this,"name","RuleForRangedLine")}hasMatchingType(e){if(es(e)){const{encoding:t,mark:n}=e;if("line"===n||br(n)&&"line"===n.type)for(const e of Ke){const n=t[et(e)];if(t[e]&&(ca(n)&&!sn(n.bin)||ua(n)))return!0}}return!1}run(e,n,i){const{encoding:o,mark:r}=e;var a,s;return ji((a=!!o.x2,s=!!o.y2,"Line mark is for continuous lines and thus cannot be used with ".concat(a&&s?"x2 and y2":a?"x2":"y2",". We will use the rule mark (line segments) instead."))),i({...e,mark:t.isObject(r)?{...r,type:"rule"}:"rule"},n)}}function Gc(e){let{parentEncoding:n,encoding:i={},layer:o}=e,r={};if(n){const e=new Set([...C(n),...C(i)]);for(const a of e){const e=i[a],s=n[a];if(pa(e)){const t={...s,...e};r[a]=t}else sa(e)?r[a]={...e,condition:{...s,...e.condition}}:e||null===e?r[a]=e:(o||ga(s)||gn(s)||pa(s)||t.isArray(s))&&(r[a]=s)}}else r=i;return!r||z(r)?void 0:r}function Yc(e){const{parentProjection:t,projection:n}=e;return t&&n&&ji(function(e){const{parentProjection:t,projection:n}=e;return"Layer's shared projection ".concat(g(t)," is overridden by a child projection ").concat(g(n),".")}({parentProjection:t,projection:n})),null!=n?n:t}function Xc(e){return"filter"in e}function Jc(e){return"lookup"in e}function Qc(e){return"pivot"in e}function $c(e){return"density"in e}function Kc(e){return"quantile"in e}function Zc(e){return"regression"in e}function el(e){return"loess"in e}function tl(e){return"sample"in e}function nl(e){return"window"in e}function il(e){return"joinaggregate"in e}function ol(e){return"flatten"in e}function rl(e){return"calculate"in e}function al(e){return"bin"in e}function sl(e){return"impute"in e}function cl(e){return"timeUnit"in e}function ll(e){return"aggregate"in e}function ul(e){return"stack"in e}function dl(e){return"fold"in e}function fl(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(Xc(e))return{filter:gl(e,t)};if(al(e)&&cn(e.bin))return{...e,bin:ml(e.bin)};if(Jc(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function pl(e,n){var i,o;const r=d(e);if(ca(r)&&cn(r.bin)&&(r.bin=ml(r.bin)),ha(r)&&null!==(i=r.scale)&&void 0!==i&&null!==(o=i.domain)&&void 0!==o&&o.selection){const{selection:e,...t}=r.scale.domain;r.scale.domain={...t,...e?{param:e}:{}}}if(ra(r))if(t.isArray(r.condition))r.condition=r.condition.map((e=>{const{selection:t,param:i,test:o,...r}=e;return i?e:{...r,test:gl(e,n)}}));else{const{selection:e,param:t,test:i,...o}=pl(r.condition,n);r.condition=t?r.condition:{...o,test:gl(r.condition,n)}}return r}function ml(e){const t=e.extent;if(null!=t&&t.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function gl(e,t){const n=e=>l(e,(e=>{var n,i,o;const r={param:e,empty:null===(n=t.emptySelections[e])||void 0===n||n};return null!==(o=(i=t.selectionPredicates)[e])&&void 0!==o||(i[e]=[]),t.selectionPredicates[e].push(r),r}));return e.selection?n(e.selection):l(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class hl extends Dc{map(e,t){var n;const i=null!==(n=t.selections)&&void 0!==n?n:[];if(e.params&&!es(e)){const t=[];for(const n of e.params)Gs(n)?i.push(n):t.push(n);e.params=t}return t.selections=i,super.map(e,vl(e,t))}mapUnit(e,n){var i;const o=n.selections;if(!o||!o.length)return e;const r=(null!==(i=n.path)&&void 0!==i?i:[]).concat(e.name),a=[];for(const n of o)if(n.views&&n.views.length)for(const i of n.views)(t.isString(i)&&(i===e.name||r.indexOf(i)>=0)||t.isArray(i)&&i.map((e=>r.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&a.push(n);else a.push(n);return a.length&&(e.params=a),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=hl.prototype[e];hl.prototype[e]=function(e,n){return t.call(this,e,vl(e,n))}}function vl(e,t){var n;return e.name?{...t,path:(null!==(n=t.path)&&void 0!==n?n:[]).concat(e.name)}:t}function yl(e,t){void 0===t&&(t=vc(e.config));const n=function(e){const t={config:arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}};return wl.map(bl.map(xl.map(e,t),t),t)}(e,t),{width:i,height:o}=e,r=function(e,t,n){let{width:i,height:o}=t;const r=es(e)||Sc(e),a={};r?"container"==i&&"container"==o?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==o&&(a.type="fit-y",a.contains="padding"):("container"==i&&(ji(Hn("width")),i=void 0),"container"==o&&(ji(Hn("height")),o=void 0));const s={type:"pad",...a,...n?kl(n.autosize):{},...kl(e.autosize)};"fit"!==s.type||r||(ji(Bn),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&ji(Vn("width"));"container"==o&&"fit"!=s.type&&"fit-y"!=s.type&&ji(Vn("height"));if(u(s,{type:"pad"}))return;return s}(n,{width:i,height:o,autosize:e.autosize},t);return{...n,...r?{autosize:r}:{}}}const bl=new class extends Dc{constructor(){super(...arguments),Ln(this,"nonFacetUnitNormalizers",[xs,Fs,As,new Lc,new Ic])}map(e,t){if(es(e)){const n=ns(e.encoding,$),i=ns(e.encoding,K),o=ns(e.encoding,Z);if(n||i||o)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,o=Wc(e.encoding,t.repeater),r={...e,...o?{encoding:o}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(r,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(r,t.config))return e.run(r,t,a);return r}mapRepeat(e,n){return function(e){return!t.isArray(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,n):this.mapNonLayerRepeat(e,n)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...o}=e,{row:r,column:a,layer:s}=n,{repeater:c={},repeaterPrefix:l=""}=t;return r||a?this.mapRepeat({...e,repeat:{...r?{row:r}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...o,layer:s.map((e=>{const n={...c,layer:e},o="".concat((i.name||"")+l,"child__layer_").concat(j(e)),r=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:o});return r.name=o,r}))}}mapNonLayerRepeat(e,n){var i;const{repeat:o,spec:r,data:a,...s}=e;!t.isArray(o)&&e.columns&&(e=m(e,["columns"]),ji($n("repeat")));const c=[],{repeater:l={},repeaterPrefix:u=""}=n,d=!t.isArray(o)&&o.row||[l?l.row:null],f=!t.isArray(o)&&o.column||[l?l.column:null],p=t.isArray(o)&&o||[l?l.repeat:null];for(const e of p)for(const i of d)for(const a of f){const s={repeat:e,row:i,column:a,layer:l.layer},d=(r.name||"")+u+"child__"+(t.isArray(o)?"".concat(j(e)):(o.row?"row_".concat(j(i)):"")+(o.column?"column_".concat(j(a)):"")),f=this.map(r,{...n,repeater:s,repeaterPrefix:d});f.name=d,c.push(m(f,["data"]))}const g=t.isArray(o)?e.columns:o.column?o.column.length:1;return{data:null!==(i=r.data)&&void 0!==i?i:a,align:"all",...s,columns:g,concat:c}}mapFacet(e,t){const{facet:n}=e;return $r(n)&&e.columns&&(e=m(e,["columns"]),ji($n("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:o,parentProjection:r,config:a}=t,s=Yc({parentProjection:r,projection:i}),c=Gc({parentEncoding:o,encoding:Wc(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...c?{encoding:c}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:o,...r}=e.encoding,{mark:a,width:s,projection:c,height:l,view:u,params:d,encoding:f,...p}=e,{facetMapping:m,layout:g}=this.getFacetMappingAndLayout({row:n,column:i,facet:o},t),h=Wc(r,t.repeater);return this.mapFacet({...p,...g,facet:m,spec:{...s?{width:s}:{},...l?{height:l}:{},...u?{view:u}:{},...c?{projection:c}:{},mark:a,encoding:h,...d?{params:d}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:o}=e;if(n||i){o&&ji((a=[...n?[$]:[],...i?[K]:[]],"Facet encoding dropped as ".concat(a.join(" and ")," ").concat(a.length>1?"are":"is"," also specified.")));const t={},s={};for(const n of[$,K]){const i=e[n];if(i){const{align:e,center:o,spacing:a,columns:c,...l}=i;t[n]=l;for(const e of["align","center","spacing"]){var r;if(void 0!==i[e])null!==(r=s[e])&&void 0!==r||(s[e]={}),s[e][n]=i[e]}}}return{facetMapping:t,layout:s}}{const{align:e,center:n,spacing:i,columns:r,...a}=o;return{facetMapping:qc(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...r?{columns:r}:{}}}}var a}mapLayer(e,t){let{parentEncoding:n,parentProjection:i,...o}=t;const{encoding:r,projection:a,...s}=e,c={...o,parentEncoding:Gc({parentEncoding:n,encoding:r,layer:!0}),parentProjection:Yc({parentProjection:i,projection:a})};return super.mapLayer(s,c)}},xl=new class extends Dc{map(e,t){var n,i;return null!==(n=t.emptySelections)&&void 0!==n||(t.emptySelections={}),null!==(i=t.selectionPredicates)&&void 0!==i||(t.selectionPredicates={}),e=fl(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=fl(e,t)).encoding){const n={};for(const[i,o]of A(e.encoding))n[i]=pl(o,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:A(n).map((e=>{let[n,i]=e;const{init:o,bind:r,empty:a,...s}=i;"single"===s.type?(s.type="point",s.toggle=!1):"multi"===s.type&&(s.type="point"),t.emptySelections[n]="none"!==a;for(const e of P(null!==(c=t.selectionPredicates[n])&&void 0!==c?c:{})){var c;e.empty="none"!==a}return{name:n,value:o,select:s,bind:r}}))}:e}},wl=new hl;function kl(e){return t.isString(e)?{type:e}:null!=e?e:{}}class Sl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.explicit=e,this.implicit=t}clone(){return new Sl(d(this.explicit),d(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return V(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){let{value:n,explicit:i}=t;void 0!==n&&this.set(e,n,i)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){let{explicit:n,implicit:i}=t;void 0!==n[e]?this.set(e,n[e],!0):void 0!==i[e]&&this.set(e,i[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of C(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function Dl(e){return{explicit:!0,value:e}}function Fl(e){return{explicit:!1,value:e}}function Ol(e){return(t,n,i,o)=>{const r=e(t.value,n.value);return r>0?t:r<0?n:_l(t,n,i,o)}}function _l(e,t,n,i){return e.explicit&&t.explicit&&ji(function(e,t,n,i){return"Conflicting ".concat(t.toString(),' property "').concat(e.toString(),'" (').concat(g(n)," and ").concat(g(i),"). Using ").concat(g(n),".")}(n,i,e.value,t.value)),e}function zl(e,t,n,i){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:_l;return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:u(e.value,t.value)?e:o(e,t,n,i)}class Cl extends Sl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function Pl(e){return"url"in e}function Al(e){return"values"in e}function Nl(e){return"name"in e&&!Pl(e)&&!Al(e)&&!jl(e)}function jl(e){return e&&(El(e)||Ml(e)||Tl(e))}function El(e){return"sequence"in e}function Ml(e){return"sphere"in e}function Tl(e){return"graticule"in e}let Ll;function ql(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.identity;if(t.isArray(e)){const t=e.map((e=>ql(e,n,i)));return n?"[".concat(t.join(", "),"]"):t}return Ei(e)?i(n?Ri(e):Bi(e)):n?i(g(e)):e}function Wl(e,n){for(const o of P(null!==(i=e.component.selection)&&void 0!==i?i:{})){var i;const r=o.name;let a="".concat(r).concat(Qu,", ").concat("global"===o.resolve?"true":"{unit: ".concat(td(e),"}"));for(const t of Zu)t.defined(o)&&(t.signals&&(n=t.signals(e,o,n)),t.modifyExpr&&(a=t.modifyExpr(e,o,a)));n.push({name:r+$u,on:[{events:{signal:o.name+Qu},update:"modify(".concat(t.stringValue(o.name+Ju),", ").concat(a,")")}]})}return Bl(n)}function Rl(e,n){if(e.component.selection&&C(e.component.selection).length){const i=t.stringValue(e.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:t.parseSelector("mousemove","scope"),update:"isTuple(facet) ? facet : group(".concat(i,").datum")}]})}return Bl(n)}function Ul(e,t){for(const i of P(null!==(n=e.component.selection)&&void 0!==n?n:{})){var n;for(const n of Zu)n.defined(i)&&n.marks&&(t=n.marks(e,i,t))}return t}function Bl(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup"}(Ll||(Ll={}));class Hl{constructor(e,t){this.debugName=t,Ln(this,"_children",[]),Ln(this,"_parent",null),Ln(this,"_hash",void 0),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)?ji("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this),e.parent.removeChild(e),this.parent=t,e.parent=this}}class Vl extends Hl{clone(){const e=new this.constructor;return e.debugName="clone_".concat(this.debugName),e._source=this._source,e._name="clone_".concat(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,Ln(this,"_source",void 0),Ln(this,"_name",void 0),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 ".concat(G())),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class Il extends Hl{clone(){return new Il(null,d(this.formula))}constructor(e,t){super(e),this.formula=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,t)=>{const{field:n,timeUnit:i}=t;if(i){const o=ka(t,{forAs:!0});e[h({as:o,field:n,timeUnit:i})]={as:o,field:n,timeUnit:i}}return e}),{});return z(n)?null:new Il(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},o={...i,timeUnit:$i(n)};return new Il(e,{[h(o)]:o})}merge(e){this.formula={...this.formula};for(const t in e.formula)this.formula[t]||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of A(this.formula))e.has(i.as)||(t[n]=i);this.formula=t}producedFields(){return new Set(P(this.formula).map((e=>e.as)))}dependentFields(){return new Set(P(this.formula).map((e=>e.field)))}hash(){return"TimeUnit ".concat(h(this.formula))}assemble(){const e=[];for(const t of P(this.formula)){const{field:n,as:i,timeUnit:o}=t,{unit:r,utc:a,...s}=$i(o);e.push({field:R(n),type:"timeunit",...r?{units:Yi(r)}:{},...a?{timezone:"utc"}:{},...s,as:[i,"".concat(i,"_end")]})}return e}}const Gl="_tuple_fields";class Yl{constructor(){Ln(this,"hasChannel",void 0),Ln(this,"hasField",void 0),Ln(this,"timeUnit",void 0),Ln(this,"items",void 0);for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];this.items=t,this.hasChannel={},this.hasField={}}}const Xl={defined:()=>!0,parse:(e,n,i)=>{var o;const r=n.name,a=null!==(o=n.project)&&void 0!==o?o:n.project=new Yl,s={},c={},l=new Set,u=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=j("".concat(r,"_").concat(n));for(let e=1;l.has(i);e++)i=j("".concat(r,"_").concat(n,"_").concat(e));return l.add(i),{[t]:i}},d=n.type,f=e.config.selection[d],p=void 0!==i.value?t.array(i.value):null;let{fields:m,encodings:g}=t.isObject(i.select)?i.select:{};if(!m&&!g&&p)for(const e of p)if(t.isObject(e))for(const t of C(e))Qe[t]?(g||(g=[])).push(t):"interval"===d?(ji('Interval selections should be initialized using "x" and/or "y" keys.'),g=f.encodings):(m||(m=[])).push(t);m||g||(g=f.encodings,"fields"in f&&(m=f.fields));for(const t of null!==(v=g)&&void 0!==v?v:[]){var v;const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){ji(Xn(t,n.aggregate));continue}if(!i){ji(Yn(t));continue}if(n.timeUnit){i=e.vgField(t);const o={timeUnit:n.timeUnit,as:i,field:n.field};c[h(o)]=o}if(!s[i]){let o="E";if("interval"===d){Wo(e.getScaleComponent(t).get("type"))&&(o="R")}else n.bin&&(o="R-RE");const r={field:i,channel:t,type:o};r.signals={...u(r,"data"),...u(r,"visual")},a.items.push(s[i]=r),a.hasField[i]=a.hasChannel[t]=s[i]}}else ji(Yn(t))}for(const e of null!==(y=m)&&void 0!==y?y:[]){var y;if(a.hasField[e])continue;const t={type:"E",field:e};t.signals={...u(t,"data")},a.items.push(t),a.hasField[e]=t}p&&(n.init=p.map((e=>a.items.map((n=>t.isObject(e)?void 0!==e[n.channel]?e[n.channel]:e[n.field]:e))))),z(c)||(a.timeUnit=new Il(null,c))},signals:(e,t,n)=>{const i=t.name+Gl;return n.filter((e=>e.name===i)).length>0?n:n.concat({name:i,value:t.project.items.map((e=>{const{signals:t,hasLegend:n,...i}=e;return i.field=R(i.field),i}))})}},Jl={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 o=i.channel;if(!Ht(o))continue;const r=e.getScaleComponent(o),a=r?r.get("type"):void 0;r&&Wo(a)?(r.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):ji("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,n,i)=>{const o=n.scales.filter((e=>0===i.filter((t=>t.name===e.signals.data)).length));if(!e.parent||$l(e)||0===o.length)return i;const r=i.filter((e=>e.name===n.name))[0];let a=r.update;if(a.indexOf(Ku)>=0)r.update="{".concat(o.map((e=>"".concat(t.stringValue(R(e.field)),": ").concat(e.signals.data))).join(", "),"}");else{for(const e of o){const n="".concat(t.stringValue(R(e.field)),": ").concat(e.signals.data);a.includes(n)||(a="".concat(a.substring(0,a.length-1),", ").concat(n,"}"))}r.update=a}return i.concat(o.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!$l(e))for(const e of t.scales){const t=n.filter((t=>t.name===e.signals.data))[0];t.push="outer",delete t.value,delete t.update}return n}};function Ql(e,n){const i=t.stringValue(e.scaleName(n));return"domain(".concat(i,")")}function $l(e){var t;return e.parent&&Bp(e.parent)&&(null!==(t=!e.parent.parent)&&void 0!==t?t:$l(e.parent.parent))}const Kl="_brush",Zl="_scale_trigger",eu={defined:e=>"interval"===e.type,signals:(e,n,i)=>{const o=n.name,r=o+Gl,a=Jl.defined(n),s=n.init?n.init[0]:null,c=[],l=[];if(n.translate&&!a){const e="!event.item || event.item.mark.name !== ".concat(t.stringValue(o+Kl));tu(n,((n,i)=>{var o,r;const a=t.array(null!==(r=(o=i.between[0]).filter)&&void 0!==r?r:o.filter=[]);return a.includes(e)||a.push(e),n}))}n.project.items.forEach(((o,r)=>{const a=o.channel;if(a!==ee&&a!==te)return void ji("Interval selections only support x and y encoding channels.");const u=s?s[r]:null,d=function(e,n,i,o){const r=i.channel,a=i.signals.visual,s=i.signals.data,c=Jl.defined(n),l=t.stringValue(e.scaleName(r)),u=e.getScaleComponent(r),d=u?u.get("type"):void 0,f=e=>"scale(".concat(l,", ").concat(e,")"),p=e.getSizeSignalRef(r===ee?"width":"height").signal,m="".concat(r,"(unit)"),g=tu(n,((e,t)=>[...e,{events:t.between[0],update:"[".concat(m,", ").concat(m,"]")},{events:t,update:"[".concat(a,"[0], clamp(").concat(m,", 0, ").concat(p,")]")}]));return g.push({events:{signal:n.name+Zl},update:Wo(d)?"[".concat(f("".concat(s,"[0]")),", ").concat(f("".concat(s,"[1]")),"]"):"[0, 0]"}),c?[{name:s,on:[]}]:[{name:a,...o?{init:ql(o,!0,f)}:{value:[]},on:g},{name:s,...o?{init:ql(o)}:{},on:[{events:{signal:a},update:"".concat(a,"[0] === ").concat(a,"[1] ? null : invert(").concat(l,", ").concat(a,")")}]}]}(e,n,o,u),f=o.signals.data,p=o.signals.visual,m=t.stringValue(e.scaleName(a)),g=Wo(e.getScaleComponent(a).get("type"))?"+":"";i.push(...d),c.push(f),l.push({scaleName:e.scaleName(a),expr:"(!isArray(".concat(f,") || ")+"(".concat(g,"invert(").concat(m,", ").concat(p,")[0] === ").concat(g).concat(f,"[0] && ")+"".concat(g,"invert(").concat(m,", ").concat(p,")[1] === ").concat(g).concat(f,"[1]))")})})),!a&&l.length&&i.push({name:o+Zl,value:{},on:[{events:l.map((e=>({scale:e.scaleName}))),update:"".concat(l.map((e=>e.expr)).join(" && ")," ? ").concat(o+Zl," : {}")}]});const u="unit: ".concat(td(e),", fields: ").concat(r,", values");return i.concat({name:o+Qu,...s?{init:"{".concat(u,": ").concat(ql(s),"}")}:{},...c.length?{on:[{events:[{signal:c.join(" || ")}],update:"".concat(c.join(" && ")," ? {").concat(u,": [").concat(c,"]} : null")}]}:{}})},marks:(e,n,i)=>{const o=n.name,{x:r,y:a}=n.project.hasChannel,s=null==r?void 0:r.signals.visual,c=null==a?void 0:a.signals.visual,l="data(".concat(t.stringValue(n.name+Ju),")");if(Jl.defined(n)||!r&&!a)return i;const u={x:void 0!==r?{signal:"".concat(s,"[0]")}:{value:0},y:void 0!==a?{signal:"".concat(c,"[0]")}:{value:0},x2:void 0!==r?{signal:"".concat(s,"[1]")}:{field:{group:"width"}},y2:void 0!==a?{signal:"".concat(c,"[1]")}:{field:{group:"height"}}};if("global"===n.resolve)for(const t of C(u))u[t]=[{test:"".concat(l,".length && ").concat(l,"[0].unit === ").concat(td(e)),...u[t]},{value:0}];const{fill:d,fillOpacity:f,cursor:p,...m}=n.mark,g=C(m).reduce(((e,t)=>(e[t]=[{test:[void 0!==r&&"".concat(s,"[0] !== ").concat(s,"[1]"),void 0!==a&&"".concat(c,"[0] !== ").concat(c,"[1]")].filter((e=>e)).join(" && "),value:m[t]},{value:null}],e)),{});return[{name:"".concat(o+Kl,"_bg"),type:"rect",clip:!0,encode:{enter:{fill:{value:d},fillOpacity:{value:f}},update:u}},...i,{name:o+Kl,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...u,...g}}}]}};function tu(e,t){return e.events.reduce(((e,n)=>n.between?t(e,n):(ji("".concat(n," is not an ordered event stream for interval selections.")),e)),[])}const nu={defined:e=>"point"===e.type,signals:(e,n,i)=>{var o;const r=n.name,a=r+Gl,s=n.project,c="(item().isVoronoi ? datum.datum : datum)",l=s.items.map((n=>{const i=e.fieldDef(n.channel);return null!=i&&i.bin?"[".concat(c,"[").concat(t.stringValue(e.vgField(n.channel,{})),"], ")+"".concat(c,"[").concat(t.stringValue(e.vgField(n.channel,{binSuffix:"end"})),"]]"):"".concat(c,"[").concat(t.stringValue(n.field),"]")})).join(", "),u="unit: ".concat(td(e),", fields: ").concat(a,", values"),d=n.events,f=P(null!==(o=e.component.selection)&&void 0!==o?o:{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+Kl):e),[]).map((e=>"indexof(item().mark.name, '".concat(e,"') < 0"))).join(" && "),p="datum && item().mark.marktype !== 'group'".concat(f?" && ".concat(f):"");return i.concat([{name:r+Qu,on:d?[{events:d,update:"".concat(p," ? {").concat(u,": [").concat(l,"]} : null"),force:!0}]:[]}])}};function iu(e,n,i,o){const r=ra(n)&&n.condition,a=o(n);if(r){return{[i]:[...t.array(r).map((t=>{const n=o(t);if(function(e){return e.param}(t)){const{param:i,empty:o}=t;return{test:cd(e,{param:i,empty:o}),...n}}return{test:ud(e,t.test),...n}})),...void 0!==a?[a]:[]]}}return void 0!==a?{[i]:a}:{}}function ou(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";const n=e.encoding[t];return iu(e,n,t,(t=>ru(t,e.config)))}function ru(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"datum";if(e){if(ga(e))return Dn(e.value);if(pa(e)){const{format:i,formatType:o}=Na(e);return Tr({fieldOrDatumDef:e,format:i,formatType:o,expr:n,config:t})}}}function au(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{encoding:i,markDef:o,config:r,stack:a}=e,s=i.tooltip;if(t.isArray(s))return{tooltip:cu({tooltip:s},a,r,n)};{const c=n.reactiveGeom?"datum.datum":"datum";return iu(e,s,"tooltip",(e=>{const s=ru(e,r,c);if(s)return s;if(null===e)return;let l=Cn("tooltip",o,r);return!0===l&&(l={content:"encoding"}),t.isString(l)?{value:l}:t.isObject(l)?gn(l)?l:"encoding"===l.content?cu(i,a,r,n):{signal:c}:void 0}))}}function su(e,n,i){let{reactiveGeom:o}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r={},a=o?"datum.datum":"datum",s=[];function c(o,c){var l;const u=et(c),d=ma(o)?o:{...o,type:e[u].type},f=d.title||Aa(d,i),p=t.array(f).join(", ");let m;if(Ft(c)){const t="x"===c?"x2":"y2",o=Ea(e[t]);if(sn(d.bin)&&o){const e=ka(d,{expr:a}),n=ka(o,{expr:a}),{format:s,formatType:c}=Na(d);m=Vr(e,n,s,c,i),r[t]=!0}else if(n&&n.fieldChannel===c&&"normalize"===n.offset){const{format:e,formatType:t}=Na(d);m=Tr({fieldOrDatumDef:d,format:e,formatType:t,expr:a,config:i,normalizeStack:!0}).signal}}null!==(l=m)&&void 0!==l||(m=ru(d,i,a).signal),s.push({channel:c,key:p,value:m})}us(e,((e,t)=>{ca(e)?c(e,t):aa(e)&&c(e.condition,t)}));const l={};for(const{channel:e,key:t,value:n}of s)r[e]||l[t]||(l[t]=n);return l}function cu(e,t,n){let{reactiveGeom:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=su(e,t,n,{reactiveGeom:i}),r=A(o).map((e=>{let[t,n]=e;return'"'.concat(t,'": ').concat(n)}));return r.length>0?{signal:"{".concat(r.join(", "),"}")}:void 0}function lu(e){const{markDef:t,config:n}=e,i=Cn("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...uu(e),...du(e)}}function uu(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const o=Cn("ariaRoleDescription",n,i);return null!=o?{ariaRoleDescription:{value:o}}:t in bn?{}:{ariaRoleDescription:{value:t}}}function du(e){const{encoding:t,markDef:n,config:i,stack:o}=e,r=t.description;if(r)return iu(e,r,"description",(t=>ru(t,e.config)));const a=Cn("description",n,i);if(null!=a)return{description:Dn(a)};if(!1===i.aria)return{};const s=su(t,o,i);return z(s)?void 0:{description:{signal:A(s).map(((e,t)=>{let[n,i]=e;return'"'.concat(t>0?"; ":"").concat(n,': " + (').concat(i,")")})).join(" + ")}}}function fu(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{markDef:i,encoding:o,config:r}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:c}=n;var l;void 0===s&&(null!==(l=c)&&void 0!==l||(c=Cn(e,i,r,{vgChannel:a,ignoreVgConfig:!0})),void 0!==c&&(s=Dn(c)));const u=o[e];return iu(t,u,null!=a?a:e,(n=>Nr({channel:e,channelDef:n,markDef:i,config:r,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function pu(e){var t,n,i,o;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{filled:void 0};const{markDef:a,encoding:s,config:c}=e,{type:l}=a,u=null!==(t=r.filled)&&void 0!==t?t:Cn("filled",a,c),d=y(["bar","point","circle","square","geoshape"],l)?"transparent":void 0,f=null!==(n=null!==(i=Cn(!0===u?"color":void 0,a,c,{vgChannel:"fill"}))&&void 0!==i?i:c.mark[!0===u&&"color"])&&void 0!==n?n:d,p=null!==(o=Cn(!1===u?"color":void 0,a,c,{vgChannel:"stroke"}))&&void 0!==o?o:c.mark[!1===u&&"color"],m=u?"fill":"stroke",g={...f?{fill:Dn(f)}:{},...p?{stroke:Dn(p)}:{}};return a.color&&(u?a.fill:a.stroke)&&ji(ai("property",{fill:"fill"in a,stroke:"stroke"in a})),{...g,...fu("color",e,{vgChannel:m,defaultValue:u?f:p}),...fu("fill",e,{defaultValue:s.fill?f:void 0}),...fu("stroke",e,{defaultValue:s.stroke?p:void 0})}}function mu(e){const{encoding:t,mark:n}=e,i=t.order;return!hr(n)&&ga(i)?iu(e,i,"zindex",(e=>Dn(e.value))):{}}function gu(e){let{channel:t,markDef:n,encoding:i={},model:o,bandPosition:r}=e;const a="".concat(t,"Offset"),s=n[a],c=i[a];if(("xOffset"===a||"yOffset"===a)&&c){return{offsetType:"encoding",offset:Nr({channel:a,channelDef:c,markDef:n,config:null==o?void 0:o.config,scaleName:o.scaleName(a),scale:o.getScaleComponent(a),stack:null,defaultRef:Dn(s),bandPosition:r})}}const l=n[a];return l?{offsetType:"visual",offset:l}:{}}function hu(e,t,n){let{defaultPos:i,vgChannel:o}=n;const{encoding:r,markDef:a,config:s,stack:c}=t,l=r[e],u=r[nt(e)],d=t.scaleName(e),f=t.getScaleComponent(e),{offset:p,offsetType:m}=gu({channel:e,markDef:a,encoding:r,model:t,bandPosition:.5}),g=vu({model:t,defaultPos:i,channel:e,scaleName:d,scale:f}),h=!l&&Ft(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:o,offset:r,markDef:a}=e;if(pa(n)&&o&&t===o.fieldChannel){if(ca(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return Ar({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:r})}return Pr(n,i,{suffix:"end"},{offset:r})}return _r(e)}({channel:e,channelDef:l,channel2Def:u,markDef:a,config:s,scaleName:d,scale:f,stack:c,offset:p,defaultRef:g,bandPosition:"encoding"===m?0:void 0});return h?{[o||e]:h}:void 0}function vu(e){let{model:t,defaultPos:n,channel:i,scaleName:o,scale:r}=e;const{markDef:a,config:s}=t;return()=>{const e=et(i),c=tt(i),l=Cn(i,a,s,{vgChannel:c});if(void 0!==l)return jr(i,l);switch(n){case"zeroOrMin":case"zeroOrMax":if(o){const e=r.get("type");if(y([So,Do,Fo],e));else if(r.domainDefinitelyIncludesZero())return{scale:o,value:0}}if("zeroOrMin"===n)return"y"===e?{field:{group:"height"}}:{value:0};switch(e){case"radius":return{signal:"min(".concat(t.width.signal,",").concat(t.height.signal,")/2")};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...t[it(i)],mult:.5}}}}const yu={left:"x",center:"xc",right:"x2"},bu={top:"y",middle:"yc",bottom:"y2"};function xu(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle";if("radius"===e||"theta"===e)return tt(e);const o="x"===e?"align":"baseline",r=Cn(o,t,n);let a;return gn(r)?(ji(pi(o)),a=void 0):a=r,"x"===e?yu[a||("top"===i?"left":"center")]:bu[a||i]}function wu(e,t,n){let{defaultPos:i,defaultPos2:o,range:r}=n;return r?ku(e,t,{defaultPos:i,defaultPos2:o}):hu(e,t,{defaultPos:i})}function ku(e,t,n){let{defaultPos:i,defaultPos2:o}=n;const{markDef:r,config:a}=t,s=nt(e),c=it(e),l=function(e,t,n){const{encoding:i,mark:o,markDef:r,stack:a,config:s}=e,c=et(n),l=it(n),u=tt(n),d=i[c],f=e.scaleName(c),p=e.getScaleComponent(c),{offset:m}=gu(n in i||n in r?{channel:n,markDef:r,encoding:i,model:e}:{channel:c,markDef:r,encoding:i,model:e});if(!d&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=it(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[u]:{field:e.getName(n)}}}const g=function(e){let{channel:t,channelDef:n,channel2Def:i,markDef:o,config:r,scaleName:a,scale:s,stack:c,offset:l,defaultRef:u}=e;if(pa(n)&&c&&t.charAt(0)===c.fieldChannel.charAt(0))return Pr(n,a,{suffix:"start"},{offset:l});return _r({channel:t,channelDef:i,scaleName:a,scale:s,stack:c,markDef:o,config:r,offset:l,defaultRef:u})}({channel:n,channelDef:d,channel2Def:i[n],markDef:r,config:s,scaleName:f,scale:p,stack:a,offset:m,defaultRef:void 0});if(void 0!==g)return{[u]:g};return Su(n,r)||Su(n,{[n]:An(n,r,s.style),[l]:An(l,r,s.style)})||Su(n,s[o])||Su(n,s.mark)||{[u]:vu({model:e,defaultPos:t,channel:n,scaleName:f,scale:p})()}}(t,o,s);return{...hu(e,t,{defaultPos:i,vgChannel:l[c]?xu(e,r,a):tt(e)}),...l}}function Su(e,t){const n=it(e),i=tt(e);if(void 0!==t[i])return{[i]:jr(e,t[i])};if(void 0!==t[e])return{[i]:jr(e,t[e])};if(t[n]){const i=t[n];if(!Sr(i))return{[n]:jr(e,i)};ji(function(e){return"Position range does not support relative band size for ".concat(e,".")}(n))}}function Du(e,n){var i,o;const{config:r,encoding:a,markDef:s}=e,c=s.type,l=nt(n),u=it(n),d=a[n],f=a[l],p=e.getScaleComponent(n),m=p?p.get("type"):void 0,g=s.orient,h=null!==(i=null!==(o=a[u])&&void 0!==o?o:a.size)&&void 0!==i?i:Cn("size",s,r,{vgChannel:u}),v="bar"===c&&("x"===n?"vertical"===g:"horizontal"===g);return!ca(d)||!(an(d.bin)||sn(d.bin)||d.timeUnit&&!f)||h&&!Sr(h)||qo(m)?(pa(d)&&qo(m)||v)&&!f?function(e,n,i){const{markDef:o,encoding:r,config:a,stack:s}=i,c=o.orient,l=i.scaleName(n),u=i.getScaleComponent(n),d=it(n),f=nt(n),p=function(e){switch(e){case ee:return"xOffset";case te:return"yOffset";case ne:return"x2Offset";case ie:return"y2Offset";case ce:return"thetaOffset";case ae:return"radiusOffset";case le:return"theta2Offset";case se:return"radius2Offset"}}(n),m=i.scaleName(p),g="horizontal"===c&&"y"===n||"vertical"===c&&"x"===n;let h;(r.size||o.size)&&(g?h=fu("size",i,{vgChannel:d,defaultRef:Dn(o.size)}):ji(function(e){return'Cannot apply size to non-oriented mark "'.concat(e,'".')}(o.type)));const v=ia({channel:n,fieldDef:e,markDef:o,config:a,scaleType:null==u?void 0:u.get("type"),useVlSizeChannel:g});h=h||{[d]:Fu(d,m||l,u,a,v)};const y="band"===(null==u?void 0:u.get("type"))&&"band"in h[d]?"top":"middle",b=xu(n,o,a,y),x="xc"===b||"yc"===b,{offset:w,offsetType:k}=gu({channel:n,markDef:o,encoding:r,model:i,bandPosition:x?.5:0}),S=_r({channel:n,channelDef:e,markDef:o,config:a,scaleName:l,scale:u,stack:s,offset:w,defaultRef:vu({model:i,defaultPos:"mid",channel:n,scaleName:l,scale:u}),bandPosition:x?"encoding"===k?0:.5:gn(v)?{signal:"(1-".concat(v,")/2")}:Sr(v)?(1-v.band)/2:0});if(d)return{[b]:S,...h};{const e=tt(f),n=h[d],i=w?{...n,offset:w}:n;return{[b]:S,[e]:t.isArray(S)?[S[0],{...S[1],offset:i}]:{...S,offset:i}}}}(d,n,e):ku(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function(e){var t,n,i;let{fieldDef:o,fieldDef2:r,channel:a,model:s}=e;const{config:c,markDef:l,encoding:u}=s,d=s.getScaleComponent(a),f=s.scaleName(a),p=d?d.get("type"):void 0,m=d.get("reverse"),g=ia({channel:a,fieldDef:o,markDef:l,config:c,scaleType:p}),h=null===(t=s.component.axes[a])||void 0===t?void 0:t[0],v=null!==(n=null==h?void 0:h.get("translate"))&&void 0!==n?n:.5,y=Ft(a)&&null!==(i=Cn("binSpacing",l,c))&&void 0!==i?i:0,b=nt(a),x=tt(a),w=tt(b),{offset:k}=gu({channel:a,markDef:l,encoding:u,model:s,bandPosition:0}),S=gn(g)?{signal:"(1-".concat(g.signal,")/2")}:Sr(g)?(1-g.band)/2:.5;if(an(o.bin)||o.timeUnit)return{[w]:_u({fieldDef:o,scaleName:f,bandPosition:S,offset:Ou(b,y,m,v,k)}),[x]:_u({fieldDef:o,scaleName:f,bandPosition:gn(S)?{signal:"1-".concat(S.signal)}:1-S,offset:Ou(a,y,m,v,k)})};if(sn(o.bin)){const e=Pr(o,f,{},{offset:Ou(b,y,m,v,k)});if(ca(r))return{[w]:e,[x]:Pr(r,f,{},{offset:Ou(a,y,m,v,k)})};if(cn(o.bin)&&o.bin.step)return{[w]:e,[x]:{signal:'scale("'.concat(f,'", ').concat(ka(o,{expr:"datum"})," + ").concat(o.bin.step,")"),offset:Ou(a,y,m,v,k)}}}return void ji(_i(b))}({fieldDef:d,fieldDef2:f,channel:n,model:e})}function Fu(e,n,i,o,r){if(Sr(r)){if(!i)return{mult:r.band,field:{group:e}};{const e=i.get("type");if("band"===e)return{scale:n,band:r.band};1!==r.band&&(ji(function(e){return"Cannot use the relative band size with ".concat(e," scale.")}(e)),r=void 0)}}else{if(gn(r))return r;if(r)return{value:r}}if(i){const e=i.get("range");if(hn(e)&&t.isNumber(e.step))return{value:e.step-2}}return{value:oc(o.view,e)-2}}function Ou(e,t,n,i,o){if(Ee(e))return 0;const r="x"===e||"y2"===e?-t/2:t/2;if(gn(n)||gn(o)||gn(i)){const e=On(n),t=On(o),a=On(i);return{signal:(a?"".concat(a," + "):"")+(e?"(".concat(e," ? -1 : 1) * "):"")+(t?"(".concat(t," + ").concat(r,")"):r)}}return o=o||0,i+(n?-o-r:+o+r)}function _u(e){let{fieldDef:t,scaleName:n,bandPosition:i,offset:o}=e;return Ar({scaleName:n,fieldOrDatumDef:t,bandPosition:i,offset:o})}const zu=new Set(["aria","width","height"]);function Cu(e,t){const{fill:n,stroke:i}="include"===t.color?pu(e):{};return{...Au(e.markDef,t),...Pu(e,"fill",n),...Pu(e,"stroke",i),...fu("opacity",e),...fu("fillOpacity",e),...fu("strokeOpacity",e),...fu("strokeWidth",e),...fu("strokeDash",e),...mu(e),...au(e),...ou(e,"href"),...lu(e)}}function Pu(e,n,i){const{config:o,mark:r,markDef:a}=e;if("hide"===Cn("invalid",a,o)&&i&&!hr(r)){const o=function(e,t){let{invalid:n=!1,channels:i}=t;const o=i.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const o=i.get("type"),r=e.vgField(n,{expr:"datum"});r&&Wo(o)&&(t[r]=!0)}return t}),{}),r=C(o);if(r.length>0){const e=n?"||":"&&";return r.map((e=>Cr(e,n))).join(" ".concat(e," "))}return}(e,{invalid:!0,channels:Bt});if(o)return{[n]:[{test:o,value:null},...t.array(i)]}}return i?{[n]:i}:{}}function Au(e,t){return yn.reduce(((n,i)=>(zu.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=Dn(e[i])),n)),{})}function Nu(e){const{config:t,markDef:n}=e;if(Cn("invalid",n,t)){const t=function(e,t){let{invalid:n=!1,channels:i}=t;const o=i.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const o=i.get("type"),r=e.vgField(n,{expr:"datum"});r&&Wo(o)&&(t[r]=!0)}return t}),{}),r=C(o);if(r.length>0){const e=n?"||":"&&";return r.map((e=>Cr(e,n))).join(" ".concat(e," "))}return}(e,{channels:Dt});if(t)return{defined:{signal:t}}}return{}}function ju(e,t){if(void 0!==t)return{[e]:Dn(t)}}const Eu="voronoi",Mu={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(Eu)},marks:(e,t,n)=>{const{x:i,y:o}=t.project.hasChannel,r=e.mark;if(hr(r))return ji('The "nearest" transform is not supported for '.concat(r," marks.")),n;const a={name:e.getName(Eu),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...au(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!o?"datum.datum.x || 0":"0"},y:{expr:o||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,c=!1;return n.forEach(((t,n)=>{var i;const o=null!==(i=t.name)&&void 0!==i?i:"";o===e.component.mark[0].name?s=n:o.indexOf(Eu)>=0&&(c=!0)})),c||n.splice(s+1,0,a),n}},Tu={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Vs(e.bind),parse:(e,t,n)=>id(t,n),topLevelSignals:(e,n,i)=>{const o=n.name,r=n.project,a=n.bind,s=n.init&&n.init[0],c=Mu.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach(((e,r)=>{const l=j("".concat(o,"_").concat(e.field));var u,d;i.filter((e=>e.name===l)).length||i.unshift({name:l,...s?{init:ql(s[r])}:{value:null},on:n.events?[{events:n.events,update:"datum && item().mark.marktype !== 'group' ? ".concat(c,"[").concat(t.stringValue(e.field),"] : null")}]:[],bind:null!==(u=null!==(d=a[e.field])&&void 0!==d?d:a[e.channel])&&void 0!==u?u:a})})),i},signals:(e,t,n)=>{const i=t.name,o=t.project,r=n.filter((e=>e.name===i+Qu))[0],a=i+Gl,s=o.items.map((e=>j("".concat(i,"_").concat(e.field)))),c=s.map((e=>"".concat(e," !== null"))).join(" && ");return s.length&&(r.update="".concat(c," ? {fields: ").concat(a,", values: [").concat(s.join(", "),"]} : null")),delete r.value,delete r.on,n}},Lu="_toggle",qu={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+Lu,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Qu,i=t.name+Lu;return"".concat(i," ? null : ").concat(n,", ")+("global"===t.resolve?"".concat(i," ? null : true, "):"".concat(i," ? null : {unit: ").concat(td(e),"}, "))+"".concat(i," ? ").concat(n," : null")}},Wu={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,n)=>{n.clear&&(n.clear=t.isString(n.clear)?t.parseSelector(n.clear,"view"):n.clear)},topLevelSignals:(e,t,n)=>{if(Tu.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===j("".concat(t.name,"_").concat(e.field))));-1!==i&&n[i].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 e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));if(i(t,"[0, 0]"),-1===t){i(n.findIndex((t=>t.name===e.signals.data)),"null")}}else{let e=n.findIndex((e=>e.name===t.name+Qu));i(e,"null"),qu.defined(t)&&(e=n.findIndex((e=>e.name===t.name+Lu)),i(e,"false"))}return n}},Ru={defined:e=>{const t="global"===e.resolve&&e.bind&&Vs(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==Bs;return t&&!n&&ji("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,n,i)=>{const o=d(i);if(o.select=t.isString(o.select)?{type:o.select,toggle:n.toggle}:{...o.select,toggle:n.toggle},id(n,o),t.isObject(i.select)&&(i.select.on||i.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const i of n.events){var r;i.filter=t.array(null!==(r=i.filter)&&void 0!==r?r:[]),i.filter.includes(e)||i.filter.push(e)}}const a=Is(n.bind)?n.bind.legend:"click",s=t.isString(a)?t.parseSelector(a,"view"):t.array(a);n.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,o=Is(t.bind)&&t.bind.legend,r=e=>t=>{const n=d(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a="".concat(j(e.field),"_legend"),s="".concat(i,"_").concat(a);if(0===n.filter((e=>e.name===s)).length){const e=o.merge.map(r("".concat(a,"_symbols"))).concat(o.merge.map(r("".concat(a,"_labels")))).concat(o.merge.map(r("".concat(a,"_entries"))));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:o.merge,update:"!event.item || !datum ? null : ".concat(s),force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,o=t.project,r=n.find((e=>e.name===i+Qu)),a=i+Gl,s=o.items.filter((e=>e.hasLegend)).map((e=>j("".concat(i,"_").concat(j(e.field),"_legend")))),c=s.map((e=>"".concat(e," !== null"))).join(" && "),l="".concat(c," ? {fields: ").concat(a,", values: [").concat(s.join(", "),"]} : null");t.events&&s.length>0?r.on.push({events:s.map((e=>({signal:e}))),update:l}):s.length>0&&(r.update=l,delete r.value,delete r.on);const u=n.find((e=>e.name===i+Lu)),d=Is(t.bind)&&t.bind.legend;return u&&(t.events?u.on.push({...u.on[0],events:d}):u.on[0].events=d),n}};const Uu="_translate_anchor",Bu="_translate_delta",Hu={defined:e=>"interval"===e.type&&e.translate,signals:(e,n,i)=>{const o=n.name,r=Jl.defined(n),a=o+Uu,{x:s,y:c}=n.project.hasChannel;let l=t.parseSelector(n.translate,"scope");return r||(l=l.map((e=>(e.between[0].markname=o+Kl,e)))),i.push({name:a,value:{},on:[{events:l.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==s?", extent_x: ".concat(r?Ql(e,ee):"slice(".concat(s.signals.visual,")")):"")+(void 0!==c?", extent_y: ".concat(r?Ql(e,te):"slice(".concat(c.signals.visual,")")):"")+"}"}]},{name:o+Bu,value:{},on:[{events:l,update:"{x: ".concat(a,".x - x(unit), y: ").concat(a,".y - y(unit)}")}]}),void 0!==s&&Vu(e,n,s,"width",i),void 0!==c&&Vu(e,n,c,"height",i),i}};function Vu(e,t,n,i,o){var r,a;const s=t.name,c=s+Uu,l=s+Bu,u=n.channel,d=Jl.defined(t),f=o.filter((e=>e.name===n.signals[d?"data":"visual"]))[0],p=e.getSizeSignalRef(i).signal,m=e.getScaleComponent(u),g=m.get("type"),h=m.get("reverse"),v=d?u===ee?h?"":"-":h?"-":"":"",y="".concat(c,".extent_").concat(u),b="".concat(v).concat(l,".").concat(u," / ").concat(d?"".concat(p):"span(".concat(y,")")),x=d?"log"===g?"panLog":"symlog"===g?"panSymlog":"pow"===g?"panPow":"panLinear":"panLinear",w=d?"pow"===g?", ".concat(null!==(r=m.get("exponent"))&&void 0!==r?r:1):"symlog"===g?", ".concat(null!==(a=m.get("constant"))&&void 0!==a?a:1):"":"",k="".concat(x,"(").concat(y,", ").concat(b).concat(w,")");f.on.push({events:{signal:l},update:d?k:"clampRange(".concat(k,", 0, ").concat(p,")")})}const Iu="_zoom_anchor",Gu="_zoom_delta",Yu={defined:e=>"interval"===e.type&&e.zoom,signals:(e,n,i)=>{const o=n.name,r=Jl.defined(n),a=o+Gu,{x:s,y:c}=n.project.hasChannel,l=t.stringValue(e.scaleName(ee)),u=t.stringValue(e.scaleName(te));let d=t.parseSelector(n.zoom,"scope");return r||(d=d.map((e=>(e.markname=o+Kl,e)))),i.push({name:o+Iu,on:[{events:d,update:r?"{"+[l?"x: invert(".concat(l,", x(unit))"):"",u?"y: invert(".concat(u,", y(unit))"):""].filter((e=>!!e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:d,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&Xu(e,n,s,"width",i),void 0!==c&&Xu(e,n,c,"height",i),i}};function Xu(e,t,n,i,o){var r,a;const s=t.name,c=n.channel,l=Jl.defined(t),u=o.filter((e=>e.name===n.signals[l?"data":"visual"]))[0],d=e.getSizeSignalRef(i).signal,f=e.getScaleComponent(c),p=f.get("type"),m=l?Ql(e,c):u.name,g=s+Gu,h="".concat(s).concat(Iu,".").concat(c),v=l?"log"===p?"zoomLog":"symlog"===p?"zoomSymlog":"pow"===p?"zoomPow":"zoomLinear":"zoomLinear",y=l?"pow"===p?", ".concat(null!==(r=f.get("exponent"))&&void 0!==r?r:1):"symlog"===p?", ".concat(null!==(a=f.get("constant"))&&void 0!==a?a:1):"":"",b="".concat(v,"(").concat(m,", ").concat(h,", ").concat(g).concat(y,")");u.on.push({events:{signal:g},update:l?b:"clampRange(".concat(b,", 0, ").concat(d,")")})}const Ju="_store",Qu="_tuple",$u="_modify",Ku="vlSelectionResolve",Zu=[nu,eu,Xl,qu,Tu,Jl,Ru,Wu,Hu,Yu,Mu];function ed(e){let t=e.parent;for(;t&&!Rp(t);)t=t.parent;return t}function td(e){let{escape:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{escape:!0},i=n?t.stringValue(e.name):e.name;const o=ed(e);if(o){const{facet:e}=o;for(const n of Re)e[n]&&(i+=" + '__facet_".concat(n,"_' + (facet[").concat(t.stringValue(o.vgField(n)),"])"))}return i}function nd(e){var t;return P(null!==(t=e.component.selection)&&void 0!==t?t:{}).reduce(((e,t)=>e||t.project.items.some((e=>e.field===Bs))),!1)}function id(e,n){!t.isString(n.select)&&n.select.on||delete e.events,!t.isString(n.select)&&n.select.clear||delete e.clear,!t.isString(n.select)&&n.select.toggle||delete e.toggle}function od(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...od(e.object)),t.push(...od(e.property))),t)}function rd(e){return"MemberExpression"===e.object.type?rd(e.object):"datum"===e.object.name}function ad(e){const n=t.parseExpression(e),i=new Set;return n.visit((e=>{"MemberExpression"===e.type&&rd(e)&&i.add(od(e).slice(1).join("."))})),i}class sd extends Hl{clone(){return new sd(null,this.model,d(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,Ln(this,"expr",void 0),Ln(this,"_dependentFields",void 0),this.expr=ud(this.model,this.filter,this),this._dependentFields=ad(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return"Filter ".concat(this.expr)}}function cd(e,n,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"datum";const r=t.isString(n)?n:n.param,a=j(r),s=t.stringValue(a+Ju);let c;try{c=e.getSelectionComponent(a,r)}catch(e){return"!!".concat(a)}if(c.project.timeUnit){const t=null!=i?i:e.component.data.raw,n=c.project.timeUnit.clone();t.parent?n.insertAsParentOf(t):t.parent=n}const l="vlSelectionTest(".concat(s,", ").concat(o).concat("global"===c.resolve?")":", ".concat(t.stringValue(c.resolve),")")),u="length(data(".concat(s,"))");return!1===n.empty?"".concat(u," && ").concat(l):"!".concat(u," || ").concat(l)}function ld(e,n,i){const o=j(n),r=i.encoding;let a,s=i.field;try{a=e.getSelectionComponent(o,n)}catch(e){return o}if(r||s){if(r&&!s){const e=a.project.items.filter((e=>e.channel===r));!e.length||e.length>1?(s=a.project.items[0].field,ji((e.length?"Multiple ":"No ")+"matching ".concat(t.stringValue(r)," encoding found for selection ").concat(t.stringValue(i.param),". ")+'Using "field": '.concat(t.stringValue(s),"."))):s=e[0].field}}else s=a.project.items[0].field,a.project.items.length>1&&ji('A "field" or "encoding" must be specified when using a selection as a scale domain. '+'Using "field": '.concat(t.stringValue(s),"."));return"".concat(a.name,"[").concat(t.stringValue(R(s)),"]")}function ud(e,n,i){return E(n,(n=>t.isString(n)?n:function(e){return null==e?void 0:e.param}(n)?cd(e,n,i):uo(n)))}function dd(e,n){if(e)return t.isArray(e)&&!mn(e)?e.map((e=>Aa(e,n))).join(", "):e}function fd(e,t,n,i){var o,r,a,s,c;null!==(o=e.encode)&&void 0!==o||(e.encode={}),null!==(a=(r=e.encode)[t])&&void 0!==a||(r[t]={}),null!==(c=(s=e.encode[t]).update)&&void 0!==c||(s.update={}),e.encode[t].update[n]=i}function pd(e,n,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{header:!1};const{disable:r,orient:a,scale:s,labelExpr:c,title:l,zindex:u,...d}=e.combine();if(!r){for(const e in d){const i=Ja[e],o=d[e];if(i&&i!==n&&"both"!==i)delete d[e];else if(Ya(o)){const{condition:n,...i}=o,r=t.array(n),a=Ga[e];if(a){const{vgProp:t,part:n}=a;fd(d,n,t,[...r.map((e=>{const{test:t,...n}=e;return{test:ud(null,t),...n}})),i]),delete d[e]}else if(null===a){const t={signal:r.map((e=>{const{test:t,...n}=e;return"".concat(ud(null,t)," ? ").concat(Fn(n)," : ")})).join("")+Fn(i)};d[e]=t}}else if(gn(o)){const t=Ga[e];if(t){const{vgProp:n,part:i}=t;fd(d,i,n,o),delete d[e]}}y(["labelAlign","labelBaseline"],e)&&null===d[e]&&delete d[e]}if("grid"===n){if(!d.grid)return;if(d.encode){const{grid:e}=d.encode;d.encode={...e?{grid:e}:{}},z(d.encode)&&delete d.encode}return{scale:s,orient:a,...d,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:V(u,0)}}{if(!o.header&&e.mainExtracted)return;if(void 0!==c){var f,p;let e=c;null!==(f=d.encode)&&void 0!==f&&null!==(p=f.labels)&&void 0!==p&&p.update&&gn(d.encode.labels.update.text)&&(e=U(c,"datum.label",d.encode.labels.update.text.signal)),fd(d,"labels","text",{signal:e})}if(null===d.labelAlign&&delete d.labelAlign,d.encode){for(const t of Xa)e.hasAxisPart(t)||delete d.encode[t];z(d.encode)&&delete d.encode}const t=dd(l,i);return{scale:s,orient:a,grid:!1,...t?{title:t}:{},...d,...!1===i.aria?{aria:!1}:{},zindex:V(u,0)}}}}function md(e){const{axes:t}=e.component,n=[];for(const i of Dt)if(t[i])for(const o of t[i])if(!o.get("disable")&&!o.get("gridScale")){const t="x"===i?"height":"width",o=e.getSizeSignalRef(t).signal;t!==o&&n.push({name:t,update:o})}return n}function gd(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",o=t["x"===n?"axisBottom":"axisLeft"]||{},r=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...C(o),...C(r)]),s={};for(const t of a.values())s[t]={signal:"".concat(i.signal,' === "').concat(e,'" ? ').concat(On(o[t])," : ").concat(On(r[t]))};return s}return t[e]}))])}function hd(e,n){const i=[{}];for(const r of e){var o;let e=null===(o=n[r])||void 0===o?void 0:o.style;if(e){e=t.array(e);for(const t of e)i.push(n.style[t])}}return Object.assign.apply(null,i)}function vd(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=Nn(e,n,t);if(void 0!==o)return{configFrom:"style",configValue:o};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"]){var r;if(void 0!==(null===(r=i[t])||void 0===r?void 0:r[e]))return{configFrom:t,configValue:i[t][e]}}return{}}const yd={scale:e=>{let{model:t,channel:n}=e;return t.scaleName(n)},format:e=>{let{fieldOrDatumDef:t,config:n,axis:i}=e;const{format:o,formatType:r}=i;return Wr(t,t.type,o,r,n,!0)},formatType:e=>{let{axis:t,fieldOrDatumDef:n,scaleType:i}=e;const{formatType:o}=t;return Rr(o,n,i)},grid:e=>{var t;let{fieldOrDatumDef:n,axis:i,scaleType:o}=e;return null!==(t=i.grid)&&void 0!==t?t:function(e,t){return!qo(e)&&ca(t)&&!an(null==t?void 0:t.bin)&&!sn(null==t?void 0:t.bin)}(o,n)},gridScale:e=>{let{model:t,channel:n}=e;return function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(t,n)},labelAlign:e=>{let{axis:t,labelAngle:n,orient:i,channel:o}=e;return t.labelAlign||wd(n,i,o)},labelAngle:e=>{let{labelAngle:t}=e;return t},labelBaseline:e=>{let{axis:t,labelAngle:n,orient:i,channel:o}=e;return t.labelBaseline||xd(n,i,o)},labelFlush:e=>{var t;let{axis:n,fieldOrDatumDef:i,channel:o}=e;return null!==(t=n.labelFlush)&&void 0!==t?t:function(e,t){if("x"===t&&y(["quantitative","temporal"],e))return!0;return}(i.type,o)},labelOverlap:e=>{var n;let{axis:i,fieldOrDatumDef:o,scaleType:r}=e;return null!==(n=i.labelOverlap)&&void 0!==n?n:function(e,n,i,o){if(i&&!t.isObject(o)||"nominal"!==e&&"ordinal"!==e)return"log"!==n&&"symlog"!==n||"greedy";return}(o.type,r,ca(o)&&!!o.timeUnit,ca(o)?o.sort:void 0)},orient:e=>{let{orient:t}=e;return t},tickCount:e=>{var t;let{channel:n,model:i,axis:o,fieldOrDatumDef:r,scaleType:a}=e;const s="x"===n?"width":"y"===n?"height":void 0,c=s?i.getSizeSignalRef(s):void 0;return null!==(t=o.tickCount)&&void 0!==t?t:function(e){let{fieldOrDatumDef:t,scaleType:n,size:i,values:o}=e;if(!o&&!qo(n)&&"log"!==n){if(ca(t)){var r;if(an(t.bin))return{signal:"ceil(".concat(i.signal,"/10)")};if(t.timeUnit&&y(["month","hours","day","quarter"],null===(r=$i(t.timeUnit))||void 0===r?void 0:r.unit))return}return{signal:"ceil(".concat(i.signal,"/40)")}}return}({fieldOrDatumDef:r,scaleType:a,size:c,values:o.values})},title:e=>{let{axis:t,model:n,channel:i}=e;if(void 0!==t.title)return t.title;const o=kd(n,i);if(void 0!==o)return o;const r=n.typedFieldDef(i),a="x"===i?"x2":"y2",s=n.fieldDef(a);return En(r?[ea(r)]:[],ca(s)?[ea(s)]:[])},values:e=>{let{axis:n,fieldOrDatumDef:i}=e;return function(e,n){const i=e.values;if(t.isArray(i))return Va(n,i);if(gn(i))return i;return}(n,i)},zindex:e=>{var t;let{axis:n,fieldOrDatumDef:i,mark:o}=e;return null!==(t=n.zindex)&&void 0!==t?t:function(e,t){if("rect"===e&&Sa(t))return 1;return 0}(o,i)}};function bd(e){return"(((".concat(e.signal," % 360) + 360) % 360)")}function xd(e,t,n,i){if(void 0!==e){if("x"===n){if(gn(e)){const n=bd(e),i=gn(t)?"(".concat(t.signal,' === "top")'):"top"===t;return{signal:"(45 < ".concat(n," && ").concat(n," < 135) || (225 < ").concat(n," && ").concat(n,' < 315) ? "middle" :')+"(".concat(n," <= 45 || 315 <= ").concat(n,") === ").concat(i,' ? "bottom" : "top"')}}if(45<e&&e<135||225<e&&e<315)return"middle";if(gn(t)){const n=e<=45||315<=e?"===":"!==";return{signal:"".concat(t.signal," ").concat(n,' "top" ? "bottom" : "top"')}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(gn(e)){const n=bd(e),o=gn(t)?"(".concat(t.signal,' === "left")'):"left"===t,r=i?'"middle"':"null";return{signal:"".concat(n," <= 45 || 315 <= ").concat(n," || (135 <= ").concat(n," && ").concat(n," <= 225) ? ").concat(r," : (45 <= ").concat(n," && ").concat(n," <= 135) === ").concat(o,' ? "top" : "bottom"')}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(gn(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:"".concat(t.signal," ").concat(n,' "left" ? "top" : "bottom"')}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function wd(e,t,n){if(void 0===e)return;const i="x"===n,o=i?0:90,r=i?"bottom":"left";if(gn(e)){const n=bd(e),a=gn(t)?"(".concat(t.signal,' === "').concat(r,'")'):t===r;return{signal:"(".concat(o?"(".concat(n," + 90)"):n," % 180 === 0) ? ").concat(i?null:'"center"'," :")+"(".concat(o," < ").concat(n," && ").concat(n," < ").concat(180+o,") === ").concat(a,' ? "left" : "right"')}}if((e+o)%180==0)return i?null:"center";if(gn(t)){const n=o<e&&e<180+o?"===":"!==",i="".concat(t.signal," ").concat(n,' "').concat(r,'"');return{signal:"".concat(i,' ? "left" : "right"')}}return(o<e&&e<180+o)==(t===r)?"left":"right"}function kd(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),o=e.fieldDef(n),r=i?i.title:void 0,a=o?o.title:void 0;return r&&a?Mn(r,a):r||(a||(void 0!==r?r:void 0!==a?a:void 0))}class Sd extends Hl{clone(){return new Sd(null,d(this.transform))}constructor(e,t){super(e),this.transform=t,Ln(this,"_dependentFields",void 0),this._dependentFields=ad(this.transform.calculate)}static parseAllForSortIndex(e,t){return t.forEachFieldDef(((t,n)=>{if(ha(t)&&Qr(t.sort)){const{field:i,timeUnit:o}=t,r=t.sort,a=r.map(((e,t)=>"".concat(uo({field:i,timeUnit:o,equal:e})," ? ").concat(t," : "))).join("")+r.length;e=new Sd(e,{calculate:a,as:Dd(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 ".concat(h(this.transform))}}function Dd(e,t,n){return ka(e,{prefix:t,suffix:"sort_index",...null!=n?n:{}})}function Fd(e,t){return y(["top","bottom"],t)?"column":y(["left","right"],t)||"row"===e?"row":"column"}function Od(e,t,n,i){const o="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return V((t||{})[e],o[e],n.header[e])}function _d(e,t,n,i){const o={};for(const r of e){const e=Od(r,t||{},n,i);void 0!==e&&(o[r]=e)}return o}const zd=["row","column"],Cd=["header","footer"];function Pd(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,o=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:r,titleAngle:a,titleOrient:s}=_d(["titleAnchor","titleAngle","titleOrient"],o.header,i,t),c=Fd(t,s),l=J(a);return{name:"".concat(t,"-title"),type:"group",role:"".concat(c,"-title"),title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...Nd(l,c),...Ad(c,l,r),...Wd(i,o,t,qs,Ts)}}}function Ad(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"middle";switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=wd(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function Nd(e,t){const n=xd(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function jd(e,t){const n=e.component.layoutHeaders[t],i=[];for(const o of Cd)if(n[o])for(const r of n[o]){const a=Td(e,t,o,n,r);null!=a&&i.push(a)}return i}function Ed(e,n){const{sort:i}=e;var o;return Jr(i)?{field:ka(i,{expr:"datum"}),order:null!==(o=i.order)&&void 0!==o?o:"ascending"}:t.isArray(i)?{field:Dd(e,n,{expr:"datum"}),order:"ascending"}:{field:ka(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function Md(e,t,n){const{format:i,formatType:o,labelAngle:r,labelAnchor:a,labelOrient:s,labelExpr:c}=_d(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=Tr({fieldOrDatumDef:e,format:i,formatType:o,expr:"parent",config:n}).signal,u=Fd(t,s);return{text:{signal:c?U(U(c,"datum.label",l),"datum.value",ka(e,{expr:"parent"})):l},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...Nd(r,u),...Ad(u,r,a),...Wd(n,e,t,Ws,Ls)}}function Td(e,t,n,i,o){if(o){let r=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&o.labels){const{labelOrient:e}=_d(["labelOrient"],a.header,s,t);("row"===t&&!y(["top","bottom"],e)||"column"===t&&!y(["left","right"],e))&&(r=Md(a,t,s))}const c=Rp(e)&&!$r(e.facet),l=o.axes,u=(null==l?void 0:l.length)>0;if(r||u){const s="row"===t?"height":"width";return{name:e.getName("".concat(t,"_").concat(n)),type:"group",role:"".concat(t,"-").concat(n),...i.facetFieldDef?{from:{data:e.getName("".concat(t,"_domain"))},sort:Ed(a,t)}:{},...u&&c?{from:{data:e.getName("facet_domain_".concat(t))}}:{},...r?{title:r}:{},...o.sizeSignal?{encode:{update:{[s]:o.sizeSignal}}}:{},...u?{axes:l}:{}}}}return null}const Ld={column:{start:0,end:1},row:{start:1,end:0}};function qd(e,t){return Ld[t][e]}function Wd(e,t,n,i,o){const r={};for(const a of i){if(!o[a])continue;const i=Od(a,null==t?void 0:t.header,e,n);void 0!==i&&(r[o[a]]=i)}return r}function Rd(e){return[...Ud(e,"width"),...Ud(e,"height"),...Ud(e,"childWidth"),...Ud(e,"childHeight")]}function Ud(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const o=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),r=t.get("range");if(qo(i)&&hn(r)){const i=e.scaleName(n);if(Rp(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[Bd(i,r)]}return[Bd(i,r),{name:o,update:Hd(i,t,"domain('".concat(i,"').length"))}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=o.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=ic(e.config.view,t?"width":"height"),r="isFinite(".concat(n,") ? ").concat(n," : ").concat(i);return[{name:o,init:r,on:[{update:r,events:"window:resize"}]}]}return[{name:o,value:i}]}function Bd(e,t){const n="".concat(e,"_step");return gn(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function Hd(e,t,n){const i=t.get("type"),o=t.get("padding"),r=V(t.get("paddingOuter"),o);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:o:1,"bandspace(".concat(n,", ").concat(On(a),", ").concat(On(r),") * ").concat(e,"_step")}function Vd(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function Id(e,t){return C(e).reduce(((n,i)=>{const o=e[i];return{...n,...iu(t,o,i,(e=>Dn(e.value)))}}),{})}function Gd(e,t){if(Rp(t))return"theta"===e?"independent":"shared";if(Bp(t))return"shared";if(Up(t))return Ft(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function Yd(e,t){const n=e.scale[t],i=Ft(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&ji(function(e){return'Setting the scale to be independent for "'.concat(e,'" means we also have to set the guide (axis or legend) to be independent.')}(t)),"independent"):e[i][t]||"shared"}const Xd=C({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 Jd extends Sl{}const Qd={symbols:function(e,n){var i,o,r,a;let{fieldOrDatumDef:s,model:c,channel:l,legendCmpt:u,legendType:d}=n;if("symbol"!==d)return;const{markDef:f,encoding:p,config:m,mark:g}=c,h=f.filled&&"trail"!==g;let v={..._n({},c,xr),...pu(c,{filled:h})};const y=null!==(i=u.get("symbolOpacity"))&&void 0!==i?i:m.legend.symbolOpacity,b=null!==(o=u.get("symbolFillColor"))&&void 0!==o?o:m.legend.symbolFillColor,x=null!==(r=u.get("symbolStrokeColor"))&&void 0!==r?r:m.legend.symbolStrokeColor,w=void 0===y?null!==(a=$d(p.opacity))&&void 0!==a?a:f.opacity:void 0;if(v.fill){var k;if("fill"===l||h&&l===me)delete v.fill;else if(v.fill.field)if(b)delete v.fill;else v.fill=Dn(null!==(k=m.legend.symbolBaseFillColor)&&void 0!==k?k:"black"),v.fillOpacity=Dn(null!=w?w:1);else if(t.isArray(v.fill)){var S,D,F;const e=null!==(S=null!==(D=Kd(null!==(F=p.fill)&&void 0!==F?F:p.color))&&void 0!==D?D:f.fill)&&void 0!==S?S:h&&f.color;e&&(v.fill=Dn(e))}}if(v.stroke)if("stroke"===l||!h&&l===me)delete v.stroke;else if(v.stroke.field||x)delete v.stroke;else if(t.isArray(v.stroke)){const e=V(Kd(p.stroke||p.color),f.stroke,h?f.color:void 0);e&&(v.stroke={value:e})}if(l!==xe){const e=ca(s)&&ef(c,u,s);e?v.opacity=[{test:e,...Dn(null!=w?w:1)},Dn(m.legend.unselectedOpacity)]:w&&(v.opacity=Dn(w))}return v={...v,...e},z(v)?void 0:v},gradient:function(e,t){var n;let{model:i,legendType:o,legendCmpt:r}=t;if("gradient"!==o)return;const{config:a,markDef:s,encoding:c}=i;let l={};const u=void 0===(null!==(n=r.get("gradientOpacity"))&&void 0!==n?n:a.legend.gradientOpacity)?$d(c.opacity)||s.opacity:void 0;u&&(l.opacity=Dn(u));return l={...l,...e},z(l)?void 0:l},labels:function(e,t){let{fieldOrDatumDef:n,model:i,channel:o,legendCmpt:r}=t;const a=i.legend(o)||{},s=i.config,c=ca(n)?ef(i,r,n):void 0,l=c?[{test:c,value:1},{value:s.legend.unselectedOpacity}]:void 0,{format:u,formatType:d}=a,f=Er(d)?qr({fieldOrDatumDef:n,field:"datum.value",format:u,formatType:d,config:s}):void 0,p={...l?{opacity:l}:{},...f?{text:f}:{},...e};return z(p)?void 0:p},entries:function(e,t){let{legendCmpt:n}=t;const i=n.get("selections");return null!=i&&i.length?{...e,fill:{value:"transparent"}}:e}};function $d(e){return Zd(e,((e,t)=>Math.max(e,t.value)))}function Kd(e){return Zd(e,((e,t)=>V(e,t.value)))}function Zd(e,n){return function(e){const n=e&&e.condition;return!!n&&(t.isArray(n)||ga(n))}(e)?t.array(e.condition).reduce(n,e.value):ga(e)?e.value:void 0}function ef(e,n,i){const o=n.get("selections");if(null==o||!o.length)return;const r=t.stringValue(i.field);return o.map((e=>{const n=t.stringValue(j(e)+Ju);return"(!length(data(".concat(n,")) || (").concat(e,"[").concat(r,"] && indexof(").concat(e,"[").concat(r,"], datum.value) >= 0))")})).join(" || ")}const tf={direction:e=>{let{direction:t}=e;return t},format:e=>{let{fieldOrDatumDef:t,legend:n,config:i}=e;const{format:o,formatType:r}=n;return Wr(t,t.type,o,r,i,!1)},formatType:e=>{let{legend:t,fieldOrDatumDef:n,scaleType:i}=e;const{formatType:o}=t;return Rr(o,n,i)},gradientLength:e=>{var t,n;const{legend:i,legendConfig:o}=e;return null!==(t=null!==(n=i.gradientLength)&&void 0!==n?n:o.gradientLength)&&void 0!==t?t:function(e){let{legendConfig:t,model:n,direction:i,orient:o,scaleType:r}=e;const{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:s,gradientVerticalMaxLength:c,gradientVerticalMinLength:l}=t;if(Ro(r))return"horizontal"===i?"top"===o||"bottom"===o?rf(n,"width",s,a):s:rf(n,"height",l,c);return}(e)},labelOverlap:e=>{var t,n;let{legend:i,legendConfig:o,scaleType:r}=e;return null!==(t=null!==(n=i.labelOverlap)&&void 0!==n?n:o.labelOverlap)&&void 0!==t?t:function(e){if(y(["quantile","threshold","log","symlog"],e))return"greedy";return}(r)},symbolType:e=>{var t;let{legend:n,markDef:i,channel:o,encoding:r}=e;return null!==(t=n.symbolType)&&void 0!==t?t:function(e,t,n,i){if("shape"!==t){var o;const e=null!==(o=Kd(n))&&void 0!==o?o: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"}}(i.type,o,r.shape,i.shape)},title:e=>{let{fieldOrDatumDef:t,config:n}=e;return Ca(t,n,{allowDisabling:!0})},type:e=>{let{legendType:t,scaleType:n,channel:i}=e;if(qe(i)&&Ro(n)){if("gradient"===t)return}else if("symbol"===t)return;return t},values:e=>{let{fieldOrDatumDef:n,legend:i}=e;return function(e,n){const i=e.values;if(t.isArray(i))return Va(n,i);if(gn(i))return i;return}(i,n)}};function nf(e){const{legend:t}=e;return V(t.type,function(e){let{channel:t,timeUnit:n,scaleType:i}=e;if(qe(t)){if(y(["quarter","month","day"],n))return"symbol";if(Ro(i))return"gradient"}return"symbol"}(e))}function of(e){var t,n;let{legendConfig:i,legendType:o,orient:r,legend:a}=e;return null!==(t=null!==(n=a.direction)&&void 0!==n?n:i[o?"gradientDirection":"symbolDirection"])&&void 0!==t?t: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}}(r,o)}function rf(e,t,n,i){const o=e.getSizeSignalRef(t).signal;return{signal:"clamp(".concat(o,", ").concat(n,", ").concat(i,")")}}function af(e){const t=Wp(e)?function(e){const{encoding:t}=e,n={};for(const i of[me,...Us]){const o=Ma(t[i]);o&&e.getScaleComponent(i)&&(i===ve&&ca(o)&&o.type===xo||(n[i]=cf(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){af(i);for(const o of C(i.component.legends))n.legend[o]=Yd(e.component.resolve,o),"shared"===n.legend[o]&&(t[o]=lf(t[o],i.component.legends[o]),t[o]||(n.legend[o]="independent",delete t[o]))}for(const i of C(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 sf(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!(null==n||!n.values);case"title":if("title"===t&&e===(null==i?void 0:i.title))return!0}return e===(n||{})[t]}function cf(e,t){var n,i,o;let r=e.legend(t);const{markDef:a,encoding:s,config:c}=e,l=c.legend,u=new Jd({},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 o=null===(i=e.fieldDef(t))||void 0===i?void 0:i.field;for(const i of P(null!==(r=e.component.selection)&&void 0!==r?r:{})){var r,a;const e=null!==(a=i.project.hasField[o])&&void 0!==a?a:i.project.hasChannel[t];if(e&&Ru.defined(i)){var s;const t=null!==(s=n.get("selections"))&&void 0!==s?s:[];t.push(i.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,u);const d=void 0!==r?!r:l.disable;if(u.set("disable",d,void 0!==r),d)return u;r=r||{};const f=e.getScaleComponent(t).get("type"),p=Ma(s[t]),m=ca(p)?null===(n=$i(p.timeUnit))||void 0===n?void 0:n.unit:void 0,g=r.orient||c.legend.orient||"right",h=nf({legend:r,channel:t,timeUnit:m,scaleType:f}),v={legend:r,channel:t,model:e,markDef:a,encoding:s,fieldOrDatumDef:p,legendConfig:l,config:c,scaleType:f,orient:g,legendType:h,direction:of({legend:r,legendType:h,orient:g,legendConfig:l})};for(const n of Xd){if("gradient"===h&&n.startsWith("symbol")||"symbol"===h&&n.startsWith("gradient"))continue;const i=n in tf?tf[n](v):r[n];if(void 0!==i){const o=sf(i,n,r,e.fieldDef(t));(o||void 0===c.legend[n])&&u.set(n,i,o)}}const y=null!==(i=null===(o=r)||void 0===o?void 0:o.encoding)&&void 0!==i?i:{},b=u.get("selections"),x={},w={fieldOrDatumDef:p,model:e,channel:t,legendCmpt:u,legendType:h};for(const t of["labels","legend","title","symbols","gradient","entries"]){var k;const n=Id(null!==(k=y[t])&&void 0!==k?k:{},e),i=t in Qd?Qd[t](n,w):n;void 0===i||z(i)||(x[t]={...null!=b&&b.length&&ca(p)?{name:"".concat(j(p.field),"_legend_").concat(t)}:{},...null!=b&&b.length?{interactive:!!b}:{},update:i})}var S;z(x)||u.set("encode",x,!(null===(S=r)||void 0===S||!S.encoding));return u}function lf(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let o=!1;for(const n of Xd){const i=zl(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return uf(e,t);case"title":return Tn(e,t);case"type":return o=!0,Fl("symbol")}return _l(e,t,n,"legend")}));e.setWithExplicit(n,i)}var r,a,s,c;o&&(null!==(r=e.implicit)&&void 0!==r&&null!==(a=r.encode)&&void 0!==a&&a.gradient&&M(e.implicit,["encode","gradient"]),null!==(s=e.explicit)&&void 0!==s&&null!==(c=s.encode)&&void 0!==c&&c.gradient&&M(e.explicit,["encode","gradient"]));return e}function uf(e,t){return"circle"===t.value?t:e}function df(e){const t=e.component.legends,n={};for(const i of C(t)){const o=e.getScaleComponent(i),r=g(o.get("domains"));if(n[r])for(const e of n[r]){lf(e,t[i])||n[r].push(t[i])}else n[r]=[t[i].clone()]}return P(n).flat().map((t=>function(e,t){var n;const{disable:i,labelExpr:o,selections:r,...a}=e.combine();if(i)return;!1===t.aria&&null==a.aria&&(a.aria=!1);if(null!==(n=a.encode)&&void 0!==n&&n.symbols){const e=a.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||a.stroke||(e.stroke={value:"transparent"});for(const t of Us)a[t]&&delete e[t]}a.title||delete a.title;if(void 0!==o){var s,c;let e=o;null!==(s=a.encode)&&void 0!==s&&null!==(c=s.labels)&&void 0!==c&&c.update&&gn(a.encode.labels.update.text)&&(e=U(o,"datum.label",a.encode.labels.update.text.signal)),function(e,t,n,i){var o,r,a,s,c;null!==(o=e.encode)&&void 0!==o||(e.encode={}),null!==(a=(r=e.encode)[t])&&void 0!==a||(r[t]={}),null!==(c=(s=e.encode[t]).update)&&void 0!==c||(s.update={}),e.encode[t].update[n]=i}(a,"labels","text",{signal:e})}return a}(t,e.config))).filter((e=>void 0!==e))}function ff(e){return Bp(e)||Up(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),pf(e))}(e):pf(e)}function pf(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const o={signal:"[".concat(t.size.map((e=>e.signal)).join(", "),"]")},r=t.data.reduce(((t,n)=>{const i=gn(n)?n.signal:"data('".concat(e.lookupDataSource(n),"')");return y(t,i)||t.push(i),t}),[]);if(r.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:o,fit:{signal:r.length>1?"[".concat(r.join(", "),"]"):r[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const mf=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class gf extends Sl{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,Ln(this,"merged",!1)}get isFit(){return!!this.data}}function hf(e){e.component.projection=Wp(e)?function(e){if(e.hasProjection){var t;const n=fn(e.specifiedProjection),i=!(n&&(null!=n.scale||null!=n.translate)),o=i?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=i?function(e){const t=[],{encoding:n}=e;for(const i of[[de,ue],[pe,fe]])(Ma(n[i[0]])||Ma(n[i[1]]))&&t.push({signal:e.getName("geojson_".concat(t.length))});e.channelHasField(ve)&&e.typedFieldDef(ve).type===xo&&t.push({signal:e.getName("geojson_".concat(t.length))});0===t.length&&t.push(e.requestDataName(Ll.Main));return t}(e):void 0,a=new gf(e.projectionName(!0),{...null!==(t=fn(e.config.projection))&&void 0!==t?t:{},...null!=n?n:{}},o,r);return a.get("type")||a.set("type","equalEarth",!1),a}return}(e):function(e){if(0===e.children.length)return;let n;for(const t of e.children)hf(t);const i=x(e.children,(e=>{const i=e.component.projection;if(i){if(n){const e=function(e,n){const i=x(mf,(i=>!t.hasOwnProperty(e.explicit,i)&&!t.hasOwnProperty(n.explicit,i)||!!(t.hasOwnProperty(e.explicit,i)&&t.hasOwnProperty(n.explicit,i)&&u(e.get(i),n.get(i)))));if(u(e.size,n.size)){if(i)return e;if(u(e.explicit,{}))return n;if(u(n.explicit,{}))return e}return null}(n,i);return e&&(n=e),!!e}return n=i,!0}return!0}));if(n&&i){const t=e.projectionName(!0),i=new gf(t,n.specifiedProjection,n.size,d(n.data));for(const n of e.children){const e=n.component.projection;e&&(e.isFit&&i.data.push(...n.component.projection.data),n.renameProjection(e.get("name"),t),e.merged=!0)}return i}return}(e)}function vf(e,t,n,i){if(Ia(t,n)){var o,r;const a=Wp(e)&&null!==(o=null!==(r=e.axis(n))&&void 0!==r?r:e.legend(n))&&void 0!==o?o:{},s=ka(t,{expr:"datum"}),c=ka(t,{expr:"datum",binSuffix:"end"});return{formulaAs:ka(t,{binSuffix:"range",forAs:!0}),formula:Vr(s,c,a.format,a.formatType,i)}}return{}}function yf(e,t){return"".concat(rn(e),"_").concat(t)}function bf(e,t,n){var i;const o=yf(null!==(i=Wa(n,void 0))&&void 0!==i?i:{},t);return e.getName("".concat(o,"_bins"))}function xf(e,n,i){let o,r;o=function(e){return"as"in e}(e)?t.isString(e.as)?[e.as,"".concat(e.as,"_end")]:[e.as[0],e.as[1]]:[ka(e,{forAs:!0}),ka(e,{binSuffix:"end",forAs:!0})];const a={...Wa(n,void 0)},s=yf(a,e.field),{signal:c,extentSignal:l}=function(e,t){return{signal:e.getName("".concat(t,"_bins")),extentSignal:e.getName("".concat(t,"_extent"))}}(i,s);if(ln(a.extent)){const e=a.extent;r=ld(i,e.param,e),delete a.extent}return{key:s,binComponent:{bin:a,field:e.field,as:[o],...c?{signal:c}:{},...l?{extentSignal:l}:{},...r?{span:r}:{}}}}class wf extends Hl{clone(){return new wf(null,d(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(ma(n)&&an(n.bin)){const{key:o,binComponent:r}=xf(n,n.bin,t);e[o]={...r,...e[o],...vf(t,n,i,t.config)}}return e}),{});return z(n)?null:new wf(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:o}=xf(t,t.bin,n);return new wf(e,{[i]:o})}merge(e,t){for(const n of C(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=S([...this.bins[n].as,...e.bins[n].as],h)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(P(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(P(this.bins).map((e=>e.field)))}hash(){return"Bin ".concat(h(this.bins))}assemble(){return P(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:o,...r}=e.bin,a={type:"bin",field:R(e.field),as:n,signal:e.signal,...ln(o)?{extent:null}:{extent:o},...e.span?{span:{signal:"span(".concat(e.span,")")}}:{},...r};!o&&e.extentSignal&&(t.push({type:"extent",field:R(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:ka({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function kf(e,n,i,o){var r;const a=Wp(o)?o.encoding[nt(n)]:void 0;if(ma(i)&&Wp(o)&&oa(i,a,o.markDef,o.config))e.add(ka(i,{})),e.add(ka(i,{suffix:"end"})),i.bin&&Ia(i,n)&&e.add(ka(i,{binSuffix:"range"}));else if(n in Me){const t=function(e){switch(e){case ue:return"y";case fe:return"y2";case de:return"x";case pe:return"x2"}}(n);e.add(o.getName(t))}else e.add(ka(i));return ha(i)&&function(e){return t.isObject(e)&&"field"in e}(null===(r=i.scale)||void 0===r?void 0:r.range)&&e.add(i.scale.range.field),e}class Sf extends Hl{clone(){return new Sf(null,new Set(this.dimensions),d(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={},o=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:r,field:a}=e;if(r)if("count"===r){var s;null!==(s=i["*"])&&void 0!==s||(i["*"]={}),i["*"].count=new Set([ka(e,{forAs:!0})])}else{if($t(r)||Kt(r)){var c;const e=$t(r)?"argmin":"argmax",t=r[e];null!==(c=i[t])&&void 0!==c||(i[t]={}),i[t][e]=new Set([ka({op:e,field:t},{forAs:!0})])}else{var l;null!==(l=i[a])&&void 0!==l||(i[a]={}),i[a][r]=new Set([ka(e,{forAs:!0})])}var u;if(Ht(n)&&"unaggregated"===t.scaleDomain(n))null!==(u=i[a])&&void 0!==u||(i[a]={}),i[a].min=new Set([ka({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([ka({field:a,aggregate:"max"},{forAs:!0})])}else kf(o,n,e,t)})),o.size+C(i).length===0?null:new Sf(e,o,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:a}=e;var o,r;if(t)if("count"===t)null!==(o=i["*"])&&void 0!==o||(i["*"]={}),i["*"].count=new Set([a||ka(e,{forAs:!0})]);else null!==(r=i[n])&&void 0!==r||(i[n]={}),i[n][t]=new Set([a||ka(e,{forAs:!0})])}for(const e of null!==(a=t.groupby)&&void 0!==a?a:[]){var a;n.add(e)}return n.size+C(i).length===0?null:new Sf(e,n,i)}merge(e){return D(this.dimensions,e.dimensions)?(function(e,t){for(const i of C(t)){const o=t[i];for(const t of C(o)){var n;i in e?e[i][t]=new Set([...null!==(n=e[i][t])&&void 0!==n?n:[],...o[t]]):e[i]={[t]:o[t]}}}}(this.measures,e.measures),!0):(function(){Pi.debug(...arguments)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...C(this.measures)])}producedFields(){const e=new Set;for(const t of C(this.measures))for(const n of C(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add("".concat(n,"_").concat(t)):i.forEach(e.add,e)}return e}hash(){return"Aggregate ".concat(h({dimensions:this.dimensions,measures:this.measures}))}assemble(){const e=[],t=[],n=[];for(const i of C(this.measures))for(const o of C(this.measures[i]))for(const r of this.measures[i][o])n.push(r),e.push(o),t.push("*"===i?null:R(i));return{type:"aggregate",groupby:[...this.dimensions].map(R),ops:e,fields:t,as:n}}}class Df extends Hl{constructor(e,n,i,o){super(e),this.model=n,this.name=i,this.data=o,Ln(this,"column",void 0),Ln(this,"row",void 0),Ln(this,"facet",void 0),Ln(this,"childModel",void 0);for(const e of Re){const i=n.facet[e];if(i){const{bin:o,sort:r}=i;this[e]={name:n.getName("".concat(e,"_domain")),fields:[ka(i),...an(o)?[ka(i,{binSuffix:"end"})]:[]],...Jr(r)?{sortField:r}:t.isArray(r)?{sortIndexField:Dd(i,e)}:{}}}}this.childModel=n.child}hash(){let e="Facet";for(const t of Re)this[t]&&(e+=" ".concat(t.charAt(0),":").concat(h(this[t])));return e}get fields(){const e=[];for(const n of Re){var t;null!==(t=this[n])&&void 0!==t&&t.fields&&e.push(...this[n].fields)}return e}dependentFields(){const e=new Set(this.fields);for(const t of Re)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 Dt){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),o=n.get("range");if(qo(i)&&hn(o)){const n=gp(hp(this.childModel,t));n?e[t]=n:ji(Gn(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],o=[],r=[],a=[];i&&n&&n[i]&&(t?(o.push("distinct_".concat(n[i])),r.push("max")):(o.push(n[i]),r.push("distinct")),a.push("distinct_".concat(n[i])));const{sortField:s,sortIndexField:c}=this[e];if(s){const{op:e=Ir,field:t}=s;o.push(t),r.push(e),a.push(ka(s,{forAs:!0}))}else c&&(o.push(c),r.push("max"),a.push(c));return{name:this[e].name,source:null!=t?t:this.data,transform:[{type:"aggregate",groupby:this[e].fields,...o.length?{fields:o,ops:r,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],o={};for(const e of zd){for(const t of Cd){var r;const i=null!==(r=n[e]&&n[e][t])&&void 0!==r?r:[];for(const t of i){var a;if((null===(a=t.axes)||void 0===a?void 0:a.length)>0){o[e]=!0;break}}}if(o[e]){const n='length(data("'.concat(this.facet.name,'"))'),o="row"===e?t?{signal:"ceil(".concat(n," / ").concat(t,")")}:1:t?{signal:"min(".concat(n,", ").concat(t,")")}:{signal:n};i.push({name:"".concat(this.facet.name,"_").concat(e),transform:[{type:"sequence",start:0,stop:o}]})}}const{row:s,column:c}=o;return(s||c)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:o,facet:r}=this;if(i&&o&&(n.x||n.y)){var a,s;t="cross_".concat(this.column.name,"_").concat(this.row.name);const i=[].concat(null!==(a=n.x)&&void 0!==a?a:[],null!==(s=n.y)&&void 0!==s?s:[]),o=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:o}]})}for(const i of[K,$])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(r){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function Ff(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function Of(e){const n={};return c(e.filter,(e=>{if(so(e)){let o=null;if(Zi(e))o=kn(e.equal);else if(to(e))o=kn(e.lte);else if(eo(e))o=kn(e.lt);else if(no(e))o=kn(e.gt);else if(io(e))o=kn(e.gte);else if(oo(e))o=e.range[0];else if(ro(e)){var i;o=(null!==(i=e.oneOf)&&void 0!==i?i:e.in)[0]}o&&(Ei(o)?n[e.field]="date":t.isNumber(o)?n[e.field]="number":t.isString(o)&&(n[e.field]="string")),e.timeUnit&&(n[e.field]="date")}})),n}function _f(e){const n={};function i(e){var i;Ba(e)?n[e.field]="date":"quantitative"===e.type&&(i=e.aggregate,t.isString(i)&&y(["min","max"],i))?n[e.field]="number":H(e.field)>1?e.field in n||(n[e.field]="flatten"):ha(e)&&Jr(e.sort)&&H(e.sort.field)>1&&(e.sort.field in n||(n[e.sort.field]="flatten"))}if((Wp(e)||Rp(e))&&e.forEachFieldDef(((t,n)=>{if(ma(t))i(t);else{const o=et(n),r=e.fieldDef(o);i({...t,type:r.type})}})),Wp(e)){const{mark:t,markDef:i,encoding:o}=e;if(hr(t)&&!e.encoding.order){const e=o["horizontal"===i.orient?"y":"x"];ca(e)&&"quantitative"===e.type&&!(e.field in n)&&(n[e.field]="number")}}return n}class zf extends Hl{clone(){return new zf(null,d(this._parse))}constructor(e,t){super(e),Ln(this,"_parse",void 0),this._parse=t}hash(){return"Parse ".concat(h(this._parse))}static makeExplicit(e,t,n){var i;let o={};const r=t.data;return!jl(r)&&null!=r&&null!==(i=r.format)&&void 0!==i&&i.parse&&(o=r.format.parse),this.makeWithAncestors(e,o,{},n)}static makeWithAncestors(e,t,n,i){for(const e of C(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:ji(Kn(e,n[e],t.value)))}for(const e of C(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:ji(Kn(e,t[e],n)))}const o=new Sl(t,n);i.copyAll(o);const r={};for(const e of C(o.combine())){const t=o.get(e);null!==t&&(r[e]=t)}return 0===C(r).length||i.parseNothing?null:new zf(e,r)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of C(this._parse)){const n=this._parse[t];1===H(t)&&(e[t]=n)}return e}producedFields(){return new Set(C(this._parse))}dependentFields(){return new Set(C(this._parse))}assembleTransforms(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return C(this._parse).filter((t=>!e||H(t)>1)).map((e=>{const t=function(e,t){const n=L(e);if("number"===t)return"toNumber(".concat(n,")");if("boolean"===t)return"toBoolean(".concat(n,")");if("string"===t)return"toString(".concat(n,")");if("date"===t)return"toDate(".concat(n,")");if("flatten"===t)return n;if(t.startsWith("date:")){const e=Ff(t.slice(5,t.length));return"timeParse(".concat(n,",'").concat(e,"')")}if(t.startsWith("utc:")){const e=Ff(t.slice(4,t.length));return"utcParse(".concat(n,",'").concat(e,"')")}return ji('Unrecognized parse "'.concat(t,'".')),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:B(e)}})).filter((e=>null!==e))}}class Cf extends Hl{clone(){return new Cf(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([Bs])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:Bs}}}class Pf extends Hl{clone(){return new Pf(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return"Graticule ".concat(h(this.params))}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class Af extends Hl{clone(){return new Af(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){var e;return new Set([null!==(e=this.params.as)&&void 0!==e?e:"data"])}hash(){return"Hash ".concat(h(this.params))}assemble(){return{type:"sequence",...this.params}}}class Nf extends Hl{constructor(e){var t;let n;if(super(null),Ln(this,"_data",void 0),Ln(this,"_name",void 0),Ln(this,"_generator",void 0),null!==(t=e)&&void 0!==t||(e={name:"source"}),jl(e)||(n=e.format?{...m(e.format,["parse"])}:{}),Al(e))this._data={values:e.values};else if(Pl(e)){if(this._data={url:e.url},!n.type){let t=/(?:\.([^.]+))?$/.exec(e.url)[1];y(["json","csv","tsv","dsv","topojson"],t)||(t="json"),n.type=t}}else Ml(e)?this._data={values:[{type:"Sphere"}]}:(Nl(e)||jl(e))&&(this._data={});this._generator=jl(e),e.name&&(this._name=e.name),n&&!z(n)&&(this._data.format=n)}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:[]}}}function jf(e){return e instanceof Nf||e instanceof Pf||e instanceof Af}var Ef=new WeakMap;class Mf{constructor(){Rn(this,Ef,{writable:!0,value:void 0}),qn(this,Ef,!1)}setModified(){qn(this,Ef,!0)}get modifiedFlag(){return function(e,t){return t.get?t.get.call(e):t.value}(e=this,Wn(e,Ef,"get"));var e}}class Tf extends Mf{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 e of t)this.run(e[0]);return this.modifiedFlag}}class Lf extends Mf{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class qf extends Lf{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 t of C(n))n[t].length>1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class Wf extends Lf{constructor(e){super(),Ln(this,"requiresSelectionId",void 0),this.requiresSelectionId=e&&nd(e)}run(e){e instanceof Cf&&(this.requiresSelectionId&&(jf(e.parent)||e.parent instanceof Sf||e.parent instanceof zf)||(this.setModified(),e.remove()))}}class Rf extends Mf{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof Il&&(n=e.producedFields(),F(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 Uf extends Lf{constructor(){super()}run(e){e instanceof Vl&&!e.isRequired()&&(this.setModified(),e.remove())}}class Bf extends Tf{run(e){if(!(jf(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof zf)if(e instanceof zf)this.setModified(),e.merge(t);else{if(_(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class Hf extends Tf{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof zf));if(e.numChildren()>1&&n.length>=1){const i={},o=new Set;for(const e of n){const t=e.parse;for(const e of C(t))e in i?i[e]!==t[e]&&o.add(e):i[e]=t[e]}for(const e of o)delete i[e];if(!z(i)){this.setModified();const n=new zf(e,i);for(const o of t){if(o instanceof zf)for(const e of C(i))delete o.parse[e];e.removeChild(o),o.parent=n,o instanceof zf&&0===C(o.parse).length&&o.remove()}}}}}class Vf extends Tf{run(e){e instanceof Vl||e.numChildren()>0||e instanceof Df||e instanceof Nf||(this.setModified(),e.remove())}}class If extends Tf{run(e){const t=e.children.filter((e=>e instanceof Il)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class Gf extends Tf{run(e){const t=e.children.filter((e=>e instanceof Sf)),n={};for(const e of t){const t=h(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of C(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class Yf extends Tf{constructor(e){super(),this.model=e}run(e){const t=!(jf(e)||e instanceof sd||e instanceof zf||e instanceof Cf),n=[],i=[];for(const o of e.children)o instanceof wf&&(t&&!_(e.producedFields(),o.dependentFields())?n.push(o):i.push(o));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 wf?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 Xf extends Tf{run(e){const t=[...e.children];if(!b(t,(e=>e instanceof Vl))||e.numChildren()<=1)return;const n=[];let i;for(const o of t)if(o instanceof Vl){let t=o;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof Vl))break;t=e}n.push(...t.children),i?(e.removeChild(o),o.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(o);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class Jf extends Hl{clone(){return new Jf(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=S(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){var t;return null!==(t=e.as)&&void 0!==t?t:ka(e)}hash(){return"JoinAggregateTransform ".concat(h(this.transform))}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class Qf extends Hl{clone(){return new Qf(null,d(this._stack))}constructor(e,t){super(e),Ln(this,"_stack",void 0),this._stack=t}static makeFromTransform(e,n){const{stack:i,groupby:o,as:r,offset:a="zero"}=n,s=[],c=[];if(void 0!==n.sort)for(const e of n.sort)s.push(e.field),c.push(V(e.order,"ascending"));const l={field:s,order:c};let u;return u=function(e){return t.isArray(e)&&e.every((e=>t.isString(e)))&&e.length>1}(r)?r:t.isString(r)?[r,"".concat(r,"_end")]:["".concat(n.stack,"_start"),"".concat(n.stack,"_end")],new Qf(e,{dimensionFieldDefs:[],stackField:i,groupby:o,offset:a,sort:l,facetby:[],as:u})}static makeFromEncoding(e,n){const i=n.stack,{encoding:o}=n;if(!i)return null;const{groupbyChannels:r,fieldChannel:a,offset:s,impute:c}=i,l=r.map((e=>Ea(o[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=ka(t.fieldDef);return n&&e.push(n),e}),[])}(n),d=n.encoding.order;let f;return f=t.isArray(d)||ca(d)?jn(d):u.reduce(((e,t)=>(e.field.push(t),e.order.push("y"===a?"descending":"ascending"),e)),{field:[],order:[]}),new Qf(e,{dimensionFieldDefs:l,stackField:n.vgField(a),facetby:[],stackby:u,sort:f,offset:s,impute:c,as:[n.vgField(a,{suffix:"start",forAs:!0}),n.vgField(a,{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 ".concat(h(this._stack))}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[ka(e,{binSuffix:"mid"})]:[ka(e,{}),ka(e,{binSuffix:"end"})]:[ka(e)])).flat():null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:o,sort:r,offset:a,impute:s,as:c}=this._stack;if(s)for(const r of n){const{bandPosition:n=.5,bin:a}=r;if(a){const t=ka(r,{expr:"datum"}),i=ka(r,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:"".concat(n,"*").concat(t,"+").concat(1-n,"*").concat(i),as:ka(r,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...o,...t],key:ka(r,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:r,as:c,offset:a}),e}}class $f extends Hl{clone(){return new $f(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=S(this.transform.groupby.concat(e),(e=>e))}dependentFields(){var e,t;const n=new Set;return(null!==(e=this.transform.groupby)&&void 0!==e?e:[]).forEach(n.add,n),(null!==(t=this.transform.sort)&&void 0!==t?t:[]).forEach((e=>n.add(e.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!==(t=e.as)&&void 0!==t?t:ka(e)}hash(){return"WindowTransform ".concat(h(this.transform))}assemble(){const e=[],t=[],n=[],i=[];for(const o of this.transform.window)t.push(o.op),n.push(this.getDefaultName(o)),i.push(void 0===o.param?null:o.param),e.push(void 0===o.field?null:o.field);const o=this.transform.frame,r=this.transform.groupby;if(o&&null===o[0]&&null===o[1]&&t.every((e=>Zt(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==r?{groupby:r}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort){var c;a.push(e.field),s.push(null!==(c=e.order)&&void 0!==c?c:"ascending")}const l={field:a,order:s},u=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==u?{ignorePeers:u}:{},...void 0!==r?{groupby:r}:{},...void 0!==o?{frame:o}:{}}}}function Kf(e){if(e instanceof Df)if(1!==e.numChildren()||e.children[0]instanceof Vl){const n=e.model.component.data.main;Zf(n);const i=(t=e,function e(n){if(!(n instanceof Df)){const i=n.clone();if(i instanceof Vl){const e=ep+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof Sf||i instanceof Qf||i instanceof $f||i instanceof Jf)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),o=e.children.map(i).flat();for(const e of o)e.parent=n}else{const t=e.children[0];(t instanceof Sf||t instanceof Qf||t instanceof $f||t instanceof Jf)&&t.addDimensions(e.fields),t.swapWithParent(),Kf(e)}else e.children.map(Kf);var t}function Zf(e){if(e instanceof Vl&&e.type===Ll.Main&&1===e.numChildren()){const t=e.children[0];t instanceof Df||(t.swapWithParent(),Zf(e))}}const ep="scale_";function tp(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!tp(t.children))return!1}return!0}function np(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function ip(e,t,n){let i=e.sources,o=!1;return o=np(new Uf,i)||o,o=np(new Wf(t),i)||o,i=i.filter((e=>e.numChildren()>0)),o=np(new Vf,i)||o,i=i.filter((e=>e.numChildren()>0)),n||(o=np(new Bf,i)||o,o=np(new Yf(t),i)||o,o=np(new Rf,i)||o,o=np(new Hf,i)||o,o=np(new Gf,i)||o,o=np(new If,i)||o,o=np(new qf,i)||o,o=np(new Xf,i)||o),e.sources=i,o}function op(e,t){tp(e.sources);let n=0,i=0;for(let i=0;i<5&&ip(e,t,!0);i++)n++;e.sources.map(Kf);for(let n=0;n<5&&ip(e,t,!1);n++)i++;tp(e.sources),5===Math.max(n,i)&&ji("Maximum optimization runs(".concat(5,") reached."))}class rp{constructor(e){Ln(this,"signal",void 0),Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new rp((()=>e(t)))}}function ap(e){Wp(e)?function(e){const t=e.component.scales;for(const n of C(t)){const i=sp(e,n);if(t[n].setWithExplicit("domains",i),dp(e,n),e.component.data.isFaceted){let t=e;for(;!Rp(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)vn(e)&&(e.data=ep+e.data.replace(ep,""))}}}(e):function(e){for(const t of e.children)ap(t);const t=e.component.scales;for(const n of C(t)){let i,o=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):zl(i,e.getWithExplicit("domains"),"domains","scale",pp);const t=e.get("selectionExtent");o&&t&&o.param!==t.param&&ji(Qn),o=t}}t[n].setWithExplicit("domains",i),o&&t[n].set("selectionExtent",o,!0)}}(e)}function sp(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,o=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=fp(t,n);if(!e)return void ji(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=fp(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return o!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:o}),"x"===t&&Ma(i.x2)?Ma(i.x)?zl(lp(n,o,e,"x"),lp(n,o,e,"x2"),"domain","scale",pp):lp(n,o,e,"x2"):"y"===t&&Ma(i.y2)?Ma(i.y)?zl(lp(n,o,e,"y"),lp(n,o,e,"y2"),"domain","scale",pp):lp(n,o,e,"y2"):lp(n,o,e,t)}function cp(e,t,n){var i;const o=null===(i=$i(n))||void 0===i?void 0:i.unit;return"temporal"===t||o?function(e,t,n){return e.map((e=>{const i=Ha(e,{timeUnit:n,type:t});return{signal:"{data: ".concat(i,"}")}}))}(e,t,o):[e]}function lp(e,n,i,o){const{encoding:r}=i,a=Ma(r[o]),{type:s}=a,c=a.timeUnit;if(function(e){return e&&e.unionWith}(n)){const t=lp(e,void 0,i,o),r=cp(n.unionWith,s,c);return Dl([...t.value,...r])}if(gn(n))return Dl([n]);if(n&&"unaggregated"!==n&&!Bo(n))return Dl(cp(n,s,c));const l=i.stack;if(l&&o===l.fieldChannel){if("normalize"===l.offset)return Fl([[0,1]]);const e=i.requestDataName(Ll.Main);return Fl([{data:e,field:i.vgField(o,{suffix:"start"})},{data:e,field:i.vgField(o,{suffix:"end"})}])}const u=Ht(o)&&ca(a)?function(e,t,n){if(!qo(n))return;const i=e.fieldDef(t),o=i.sort;if(Qr(o))return{op:"min",field:Dd(i,t),order:"ascending"};const{stack:r}=e,a=r?new Set([...r.groupbyFields,...r.stackBy.map((e=>e.fieldDef.field))]):void 0;if(Jr(o)){return up(o,r&&!a.has(o.field))}if(Xr(o)){const{encoding:t,order:n}=o,i=e.fieldDef(t),{aggregate:s,field:c}=i,l=r&&!a.has(c);if($t(s)||Kt(s))return up({field:ka(i),order:n},l);if(Zt(s)||!s)return up({op:s,field:c,order:n},l)}else{if("descending"===o)return{op:"min",field:e.vgField(t),order:"descending"};if(y(["ascending",void 0],o))return!0}return}(i,o,e):void 0;if(ua(a)){return Fl(cp([a.datum],s,c))}const d=a;if("unaggregated"===n){const e=i.requestDataName(Ll.Main),{field:t}=a;return Fl([{data:e,field:ka({field:t,aggregate:"min"})},{data:e,field:ka({field:t,aggregate:"max"})}])}if(an(d.bin)){if(qo(e))return Fl("bin-ordinal"===e?[]:[{data:N(u)?i.requestDataName(Ll.Main):i.requestDataName(Ll.Raw),field:i.vgField(o,Ia(d,o)?{binSuffix:"range"}:{}),sort:!0!==u&&t.isObject(u)?u:{field:i.vgField(o,{}),op:"min"}}]);{const{bin:e}=d;if(an(e)){const t=bf(i,d.field,e);return Fl([new rp((()=>{const e=i.getSignalName(t);return"[".concat(e,".start, ").concat(e,".stop]")}))])}return Fl([{data:i.requestDataName(Ll.Main),field:i.vgField(o,{})}])}}if(d.timeUnit&&y(["time","utc"],e)&&oa(d,Wp(i)?i.encoding[nt(o)]:void 0,i.markDef,i.config)){const e=i.requestDataName(Ll.Main);return Fl([{data:e,field:i.vgField(o)},{data:e,field:i.vgField(o,{suffix:"end"})}])}return Fl(u?[{data:N(u)?i.requestDataName(Ll.Main):i.requestDataName(Ll.Raw),field:i.vgField(o),sort:u}]:[{data:i.requestDataName(Ll.Main),field:i.vgField(o)}])}function up(e,t){const{op:n,field:i,order:o}=e;return{op:null!=n?n:t?"sum":Ir,...i?{field:R(i)}:{},...o?{order:o}:{}}}function dp(e,t){var n;const i=e.component.scales[t],o=e.specifiedScales[t].domain,r=null===(n=e.fieldDef(t))||void 0===n?void 0:n.bin,a=Bo(o)&&o,s=cn(r)&&ln(r.extent)&&r.extent;(a||s)&&i.set("selectionExtent",null!=a?a:s,!0)}function fp(e,n){const{aggregate:i,type:o}=e;return i?t.isString(i)&&!on.has(i)?{valid:!1,reason:gi(i)}:"quantitative"===o&&"log"===n?{valid:!1,reason:hi(e)}:{valid:!0}:{valid:!1,reason:mi(e)}}function pp(e,t,n,i){return e.explicit&&t.explicit&&ji(function(e,t,n,i){return"Conflicting ".concat(t.toString(),' property "').concat(e.toString(),'" (').concat(g(n)," and ").concat(g(i),"). Using the union of the two domains.")}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function mp(e){const n=S(e.map((e=>{if(vn(e)){const{sort:t,...n}=e;return n}return e})),h),i=S(e.map((e=>{if(vn(e)){const t=e.sort;return void 0===t||N(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),h);if(0===n.length)return;if(1===n.length){const n=e[0];if(vn(n)&&i.length>0){let e=i[0];if(i.length>1)ji(wi),e=!0;else if(t.isObject(e)&&"field"in e){const t=e.field;n.field===t&&(e=!e.order||{order:e.order})}return{...n,sort:e}}return n}const o=S(i.map((e=>N(e)||!("op"in e)||t.isString(e.op)&&e.op in Qt?e:(ji(function(e){return"Dropping sort property ".concat(g(e),' as unioned domains only support boolean or op "count", "min", and "max".')}(e)),!0))),h);let r;1===o.length?r=o[0]:o.length>1&&(ji(wi),r=!0);const a=S(e.map((e=>vn(e)?e.data:null)),(e=>e));if(1===a.length&&null!==a[0]){return{data:a[0],fields:n.map((e=>e.field)),...r?{sort:r}:{}}}return{fields:n,...r?{sort:r}:{}}}function gp(e){if(vn(e)&&t.isString(e.field))return e.field;if(function(e){return!t.isArray(e)&&"fields"in e&&!("data"in e)}(e)){let n;for(const i of e.fields)if(vn(i)&&t.isString(i.field))if(n){if(n!==i.field)return ji("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."),n}else n=i.field;return ji("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."),n}if(function(e){return!t.isArray(e)&&"fields"in e&&"data"in e}(e)){ji("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 n=e.fields[0];return t.isString(n)?n:void 0}}function hp(e,t){const n=e.component.scales[t].get("domains").map((t=>(vn(t)&&(t.data=e.lookupDataSource(t.data)),t)));return mp(n)}function vp(e){return Bp(e)||Up(e)?e.children.reduce(((e,t)=>e.concat(vp(t))),yp(e)):yp(e)}function yp(e){return C(e.component.scales).reduce(((n,i)=>{const o=e.component.scales[i];if(o.merged)return n;const r=o.combine(),{name:a,type:s,selectionExtent:c,domains:l,range:u,reverse:d,...f}=r,p=function(e,n,i,o){if(Ft(i)){if(hn(e))return{step:{signal:"".concat(n,"_step")}}}else if(t.isObject(e)&&vn(e))return{...e,data:o.lookupDataSource(e.data)};return e}(r.range,a,i,e),m=hp(e,i),g=c?function(e,n,i,o){const r=ld(e,n.param,n);return{signal:Wo(i.get("type"))&&t.isArray(o)&&o[0]>o[1]?"isValid(".concat(r,") && reverse(").concat(r,")"):r}}(e,c,o,m):null;return n.push({name:a,type:s,...m?{domain:m}:{},...g?{domainRaw:g}:{},range:p,...void 0!==d?{reverse:d}:{},...f}),n}),[])}class bp extends Sl{constructor(e,t){super({},{name:e}),Ln(this,"merged",!1),this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||b(this.get("domains"),(e=>t.isArray(e)&&2===e.length&&e[0]<=0&&e[1]>=0))}}const xp=["range","scheme"];function wp(e,n){const i=e.fieldDef(n);if(null!=i&&i.bin){const{bin:o,field:r}=i,a=it(n),s=e.getName(a);if(t.isObject(o)&&o.binned&&void 0!==o.step)return new rp((()=>{const t=e.scaleName(n),i='(domain("'.concat(t,'")[1] - domain("').concat(t,'")[0]) / ').concat(o.step);return"".concat(e.getSignalName(s)," / (").concat(i,")")}));if(an(o)){const t=bf(e,r,o);return new rp((()=>{const n=e.getSignalName(t),i="(".concat(n,".stop - ").concat(n,".start) / ").concat(n,".step");return"".concat(e.getSignalName(s)," / (").concat(i,")")}))}}}function kp(e,n){const i=n.specifiedScales[e],{size:o}=n,r=n.getScaleComponent(e).get("type");for(const o of xp)if(void 0!==i[o]){const a=$o(r,o),s=Ko(e,o);if(a)if(s)ji(s);else switch(o){case"range":{const o=i.range;if(t.isArray(o)){if(Ft(e))return Dl(o.map((e=>{if("width"===e||"height"===e){const t=n.getName(e),i=n.getSignalName.bind(n);return rp.fromName(i,t)}return e})))}else if(t.isObject(o))return Dl({data:n.requestDataName(Ll.Main),field:o.field,sort:{op:"min",field:n.vgField(e)}});return Dl(o)}case"scheme":return Dl(Sp(i[o]))}else ji(bi(r,o,e))}const a=e===ee||"xOffset"===e?"width":"height",s=o[a];if(ec(s))if(Ft(e))if(qo(r)){const t=Dp(s,n,e);if(t)return Dl({step:t})}else ji(xi(a));else if(Pt(e)){const t=e===oe?"x":"y";if("band"===n.getScaleComponent(t).get("type")){const e=Fp(s,r);if(e)return Dl(e)}}const{rangeMin:c,rangeMax:l}=i,u=function(e,n){const{size:i,config:o,mark:r,encoding:a}=n,s=n.getSignalName.bind(n),{type:c}=Ma(a[e]),l=n.getScaleComponent(e).get("type"),{domain:u,domainMid:d}=n.specifiedScales[e];switch(e){case ee:case te:{if(y(["point","band"],l)){const t=Op(e,i,o.view);if(ec(t)){return{step:Dp(t,n,e)}}}const t=it(e),r=n.getName(t);return e===te&&Wo(l)?[rp.fromName(s,r),0]:[0,rp.fromName(s,r)]}case oe:case re:return function(e,t,n){const i=e===oe?"x":"y",o=t.getScaleComponent(i).get("type"),r=t.scaleName(i);if("band"===o){const e=Op(i,t.size,t.config.view);if(ec(e)){const t=Fp(e,n);if(t)return t}return[0,{signal:"bandwidth('".concat(r,"')")}]}return f("Cannot use ".concat(e," scale if ").concat(i," scale is not discrete."))}(e,n,l);case ye:{const a=_p(r,n.component.scales[e].get("zero"),o),s=function(e,n,i,o){const r={x:wp(i,"x"),y:wp(i,"y")};switch(e){case"bar":case"tick":{if(void 0!==o.scale.maxBandSize)return o.scale.maxBandSize;const e=Cp(n,r,o.view);return t.isNumber(e)?e-1:new rp((()=>"".concat(e.signal," - 1")))}case"line":case"trail":case"rule":return o.scale.maxStrokeWidth;case"text":return o.scale.maxFontSize;case"point":case"square":case"circle":{if(o.scale.maxSize)return o.scale.maxSize;const e=Cp(n,r,o.view);return t.isNumber(e)?Math.pow(zp*e,2):new rp((()=>"pow(".concat(zp," * ").concat(e.signal,", 2)")))}}throw new Error(ci("size",e))}(r,i,n,o);return Uo(l)?function(e,t,n){const i=()=>{const i=On(t),o=On(e),r="(".concat(i," - ").concat(o,") / (").concat(n," - 1)");return"sequence(".concat(o,", ").concat(i," + ").concat(r,", ").concat(r,")")};return gn(t)?new rp(i):{signal:i()}}(a,s,function(e,n,i,o){switch(e){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==i&&t.isArray(i)?i.length+1:(ji(function(e){return"Domain for ".concat(e," is required for threshold scale.")}(o)),3)}}(l,o,u,e)):[a,s]}case ce:return[0,2*Math.PI];case be:return[0,360];case ae:return[0,new rp((()=>{const e=n.getSignalName("width"),t=n.getSignalName("height");return"min(".concat(e,",").concat(t,")/2")}))];case Se:return[o.scale.minStrokeWidth,o.scale.maxStrokeWidth];case De:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case ve:return"symbol";case me:case ge:case he:return"ordinal"===l?"nominal"===c?"category":"ordinal":void 0!==d?"diverging":"rect"===r||"geoshape"===r?"heatmap":"ramp";case xe:case we:case ke:return[o.scale.minOpacity,o.scale.maxOpacity]}}(e,n);return(void 0!==c||void 0!==l)&&$o(r,"rangeMin")&&t.isArray(u)&&2===u.length?Dl([null!=c?c:u[0],null!=l?l:u[1]]):Fl(u)}function Sp(e){return function(e){return!t.isString(e)&&!!e.name}(e)?{scheme:e.name,...m(e,["name"])}:{scheme:e}}function Dp(e,n,i){const{encoding:o}=n,r=n.getScaleComponent(i),a=ot(i),s=o[a];if("offset"===Zs({step:e,offsetIsDiscrete:pa(s)&&go(s.type)})&&is(o,a)){var c;const i=n.getScaleComponent(a),o=n.scaleName(a);let s="domain('".concat(o,"').length");if("band"===i.get("type")){var l,u,d,f;const e=null!==(l=null!==(u=i.get("paddingInner"))&&void 0!==u?u:i.get("padding"))&&void 0!==l?l:0,t=null!==(d=null!==(f=i.get("paddingOuter"))&&void 0!==f?f:i.get("padding"))&&void 0!==d?d:0;s="bandspace(".concat(s,", ").concat(e,", ").concat(t,")")}const m=null!==(c=r.get("paddingInner"))&&void 0!==c?c:r.get("padding");return{signal:"".concat(e.step," * ").concat(s," / (1-").concat((p=m,gn(p)?p.signal:t.stringValue(p)),")")}}return e.step;var p}function Fp(e,t){if("offset"===Zs({step:e,offsetIsDiscrete:qo(t)}))return{step:e.step}}function Op(e,t,n){const i=e===ee?"width":"height",o=t[i];return o||rc(n,i)}function _p(e,t,n){if(t)return gn(t)?{signal:"".concat(t.signal," ? 0 : ").concat(_p(e,!1,n))}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(ci("size",e))}const zp=.95;function Cp(e,t,n){const i=ec(e.width)?e.width.step:oc(n,"width"),o=ec(e.height)?e.height.step:oc(n,"height");return t.x||t.y?new rp((()=>{const e=[t.x?t.x.signal:i,t.y?t.y.signal:o];return"min(".concat(e.join(", "),")")})):Math.min(i,o)}function Pp(e,t){Wp(e)?function(e,t){const n=e.component.scales,{config:i,encoding:o,markDef:r,specifiedScales:a}=e;for(const s of C(n)){const c=a[s],l=n[s],u=e.getScaleComponent(s),d=Ma(o[s]),f=c[t],p=u.get("type"),m=u.get("padding"),g=u.get("paddingInner"),h=$o(p,t),v=Ko(s,t);if(void 0!==f&&(h?v&&ji(v):ji(bi(p,t,s))),h&&void 0===v)if(void 0!==f){const e=d.timeUnit,n=d.type;switch(t){case"domainMax":case"domainMin":Ei(c[t])||"temporal"===n||e?l.set(t,{signal:Ha(c[t],{type:n,timeUnit:e})},!0):l.set(t,c[t],!0);break;default:l.copyKeyFromObject(t,c)}}else{const n=t in Ap?Ap[t]({model:e,channel:s,fieldOrDatumDef:d,scaleType:p,scalePadding:m,scalePaddingInner:g,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:r,config:i,hasNestedOffsetScale:os(o,s)}):i.scale[t];void 0!==n&&l.set(t,n,!1)}}}(e,t):jp(e,t)}const Ap={bins:e=>{let{model:t,fieldOrDatumDef:n}=e;return ca(n)?function(e,t){const n=t.bin;if(an(n)){const i=bf(e,t.field,n);return new rp((()=>e.getSignalName(i)))}if(sn(n)&&cn(n)&&void 0!==n.step)return{step:n.step};return}(t,n):void 0},interpolate:e=>{let{channel:t,fieldOrDatumDef:n}=e;return function(e,t){if(y([me,ge,he],e)&&"nominal"!==t)return"hcl";return}(t,n.type)},nice:e=>{let{scaleType:n,channel:i,domain:o,domainMin:r,domainMax:a,fieldOrDatumDef:s}=e;return function(e,n,i,o,r,a){var s;if(null!==(s=Ea(a))&&void 0!==s&&s.bin||t.isArray(i)||null!=r||null!=o||y([Do,Fo],e))return;return!!Ft(n)||void 0}(n,i,o,r,a,s)},padding:e=>{let{channel:t,scaleType:n,fieldOrDatumDef:i,markDef:o,config:r}=e;return function(e,t,n,i,o,r){if(Ft(e)){if(Ro(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=o;if("bar"===t&&(!ca(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return r.continuousBandSize}if(t===Oo)return n.pointPadding}return}(t,n,r.scale,i,o,r.bar)},paddingInner:e=>{let{scalePadding:t,channel:n,markDef:i,scaleType:o,config:r,hasNestedOffsetScale:a}=e;return function(e,t,n,i,o){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(void 0!==e)return;if(Ft(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=o;return r?a:V(e,"bar"===n?t:i)}if(Pt(t)&&i===_o)return o.offsetBandPaddingInner;return}(t,n,i.type,o,r.scale,a)},paddingOuter:e=>{let{scalePadding:t,channel:n,scaleType:i,scalePaddingInner:o,config:r,hasNestedOffsetScale:a}=e;return function(e,t,n,i,o){let r=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(void 0!==e)return;if(Ft(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=o;if(r)return t;if(n===_o)return V(e,gn(i)?{signal:"".concat(i.signal,"/2")}:i/2)}else if(Pt(t)){if(n===Oo)return.5;if(n===_o)return o.offsetBandPaddingOuter}return}(t,n,i,o,r.scale,a)},reverse:e=>{let{fieldOrDatumDef:t,scaleType:n,channel:i,config:o}=e;return function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return Wo(e)&&"descending"===t?gn(i.xReverse)?{signal:"!".concat(i.xReverse.signal)}:!i.xReverse:i.xReverse;if(Wo(e)&&"descending"===t)return!0;return}(n,ca(t)?t.sort:void 0,i,o.scale)},zero:e=>{let{channel:n,fieldOrDatumDef:i,domain:o,markDef:r,scaleType:a}=e;return function(e,n,i,o,r){if(i&&"unaggregated"!==i&&Wo(r)){if(t.isArray(i)){const e=i[0],t=i[i.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===n.type&&!Uo(r))return!0;if((!ca(n)||!n.bin)&&y([...Dt,..._t],e)){const{orient:t,type:n}=o;return!y(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(n,i,o,r,a)}};function Np(e){Wp(e)?function(e){const t=e.component.scales;for(const n of Bt){const i=t[n];if(!i)continue;const o=kp(n,e);i.setWithExplicit("range",o)}}(e):jp(e,"range")}function jp(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?Np(n):Pp(n,t);for(const i of C(n)){let o;for(const n of e.children){const e=n.component.scales[i];if(e){o=zl(o,e.getWithExplicit(t),t,"scale",Ol(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0)))}}n[i].setWithExplicit(t,o)}}function Ep(e,t,n,i){let o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=Mp(t,n,i,o),{type:a}=e;return Ht(t)?void 0!==a?er(t,a)?ca(n)&&!Zo(a,n.type)?(ji(yi(a,r)),r):a:(ji(vi(t,a,r)),r):r:null}function Mp(e,t,n,i){switch(t.type){case"nominal":case"ordinal":var o;if(qe(e)||"discrete"===Xt(e))return"shape"===e&&"ordinal"===t.type&&ji(fi(e,"ordinal")),"ordinal";if(Ft(e)||Pt(e)){if(y(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in Ot)return"band";return Sr(n[it(e)])||va(t)&&null!==(o=t.axis)&&void 0!==o&&o.tickBand?"band":"point";case"temporal":return qe(e)?"time":"discrete"===Xt(e)?(ji(fi(e,"temporal")),"ordinal"):ca(t)&&t.timeUnit&&$i(t.timeUnit).utc?"utc":"time";case"quantitative":return qe(e)?ca(t)&&an(t.bin)?"bin-ordinal":"linear":"discrete"===Xt(e)?(ji(fi(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(ii(t.type))}function Tp(e){Wp(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,o={};for(const a of Bt){const s=Ma(t[a]);if(s&&n===gr&&a===ve&&s.type===xo)continue;let c=s&&s.scale;if(Pt(a)){if(!os(t,rt(a))){c&&ji(li(a));continue}}if(s&&null!==c&&!1!==c){var r;null!==(r=c)&&void 0!==r||(c={});const n=Ep(c,a,s,i,os(t,a));o[a]=new bp(e.scaleName("".concat(a),!0),{value:n,explicit:c.type===n})}}return o}(e):e.component.scales=function(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const t of e.children){Tp(t);for(const a of C(t.component.scales)){var o,r;if(null!==(r=(o=i.scale)[a])&&void 0!==r||(o[a]=Gd(a,e)),"shared"===i.scale[a]){const e=n[a],o=t.component.scales[a].getWithExplicit("type");e?Co(e.value,o.value)?n[a]=zl(e,o,"type","scale",Lp):(i.scale[a]="independent",delete n[a]):n[a]=o}}}for(const i of C(n)){const o=e.scaleName(i,!0),r=n[i];t[i]=new bp(o,r);for(const t of e.children){const e=t.component.scales[i];e&&(t.renameScale(e.get("name"),o),e.merged=!0)}}return t}(e)}const Lp=Ol(((e,t)=>Ao(e)-Ao(t)));class qp{constructor(){Ln(this,"nameMap",void 0),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 Wp(e){return"unit"===(null==e?void 0:e.type)}function Rp(e){return"facet"===(null==e?void 0:e.type)}function Up(e){return"concat"===(null==e?void 0:e.type)}function Bp(e){return"layer"===(null==e?void 0:e.type)}class Hp{constructor(e,n,i,o,r,a,s){var c,u;this.type=n,this.parent=i,this.config=r,Ln(this,"name",void 0),Ln(this,"size",void 0),Ln(this,"title",void 0),Ln(this,"description",void 0),Ln(this,"data",void 0),Ln(this,"transforms",void 0),Ln(this,"layout",void 0),Ln(this,"scaleNameMap",void 0),Ln(this,"projectionNameMap",void 0),Ln(this,"signalNameMap",void 0),Ln(this,"component",void 0),Ln(this,"view",void 0),Ln(this,"children",void 0),Ln(this,"correctDataNames",(e=>{var t,n,i;return null!==(t=e.from)&&void 0!==t&&t.data&&(e.from.data=this.lookupDataSource(e.from.data)),null!==(n=e.from)&&void 0!==n&&null!==(i=n.facet)&&void 0!==i&&i.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e})),this.parent=i,this.config=r,this.view=fn(s),this.name=null!==(c=e.name)&&void 0!==c?c:o,this.title=mn(e.title)?{text:e.title}:e.title?fn(e.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new qp,this.projectionNameMap=i?i.projectionNameMap:new qp,this.signalNameMap=i?i.signalNameMap:new qp,this.data=e.data,this.description=e.description,this.transforms=(null!==(u=e.transform)&&void 0!==u?u:[]).map((e=>Xc(e)?{filter:l(e.filter,po)}:e)),this.layout="layer"===n||"unit"===n?{}:function(e,n,i){const o=i[n],r={},{spacing:a,columns:s}=o;void 0!==a&&(r.spacing=a),void 0!==s&&(Zr(e)&&!$r(e.facet)||Xs(e))&&(r.columns=s),Js(e)&&(r.columns=1);for(const n of nc)if(void 0!==e[n])if("spacing"===n){var c,l;const i=e[n];r[n]=t.isNumber(i)?i:{row:null!==(c=i.row)&&void 0!==c?c:a,column:null!==(l=i.column)&&void 0!==l?l:a}}else r[n]=e[n];return r}(e,n,r),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:Zr(e)||(null==i?void 0:i.component.data.isFaceted)&&void 0===e.data},layoutSize:new Sl,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?d(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e){let{ignoreRange:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Tp(e),ap(e);for(const t of Qo)Pp(e,t);t||Np(e)}(this)}parseProjection(){hf(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){af(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of C(n)){const t=n[e];void 0!==t&&(i[e]=Dn(t))}return i}assembleGroupEncodeEntry(e){let t={};var n;if((this.view&&(t=this.assembleEncodeFromView(this.view)),!e)&&(this.description&&(t.description=Dn(this.description)),"unit"===this.type||"layer"===this.type))return{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...null!==(n=t)&&void 0!==n?n:{}};return z(t)?void 0:t}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,o=function(e,t){const n={};for(const i of Re){const o=e[i];if(null!=o&&o.facetFieldDef){const{titleAnchor:e,titleOrient:r}=_d(["titleAnchor","titleOrient"],o.facetFieldDef.header,t,i),a=Fd(i,r),s=qd(e,a);void 0!==s&&(n[a]=s)}}return z(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...o?{titleBand:o}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of Re)e[n].title&&t.push(Pd(this,n));for(const e of zd)t=t.concat(jd(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>pd(e,"grid",t))),...i.map((e=>pd(e,"grid",t))),...n.map((e=>pd(e,"main",t))),...i.map((e=>pd(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return df(this)}assembleProjections(){return ff(this)}assembleTitle(){var e;const{encoding:t,...n}=null!==(e=this.title)&&void 0!==e?e:{},i={...pn(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(i.text){var o,r;if(y(["unit","layer"],this.type)){if(y(["middle",void 0],i.anchor))null!==(o=i.frame)&&void 0!==o||(i.frame="group")}else null!==(r=i.anchor)&&void 0!==r||(i.anchor="start");return z(i)?void 0:i}}assembleGroup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t={};e=e.concat(this.assembleSignals()),e.length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||Rp(this.parent)?vp(this):[];i.length>0&&(t.scales=i);const o=this.assembleAxes();o.length>0&&(t.axes=o);const r=this.assembleLegends();return r.length>0&&(t.legends=r),t}getName(e){return j((this.name?"".concat(this.name,"_"):"")+e)}getDataName(e){return this.getName(Ll[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(Rp(this.parent)){const t=zt(Vd(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(qo(e)&&hn(i)){const e=n.get("name"),i=gp(hp(this,t));if(i){return{signal:Hd(e,n,ka({aggregate:"distinct",field:i},{expr:"datum"}))}}return ji(Gn(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):$e(e)&&Ht(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(function(e){return'Cannot find a selection named "'.concat(e,'".')}(t));return n}hasAxisOrientSignalRef(){var e,t;return(null===(e=this.component.axes.x)||void 0===e?void 0:e.some((e=>e.hasOrientSignalRef())))||(null===(t=this.component.axes.y)||void 0===t?void 0:t.some((e=>e.hasOrientSignalRef())))}}class Vp extends Hp{vgField(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.fieldDef(e);if(n)return ka(n,t)}reduceFieldDef(e,n){return function(e,n,i,o){return e?C(e).reduce(((i,r)=>{const a=e[r];return t.isArray(a)?a.reduce(((e,t)=>n.call(o,e,t,r)),i):n.call(o,i,a,r)}),i):i}(this.getMapping(),((t,n,i)=>{const o=Ea(n);return o?e(t,o,i):t}),n)}forEachFieldDef(e,t){us(this.getMapping(),((t,n)=>{const i=Ea(t);i&&e(i,n)}),t)}}class Ip extends Hl{clone(){return new Ip(null,d(this.transform))}constructor(e,t){var n,i,o;super(e),this.transform=t,this.transform=d(t);const r=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=r[0])&&void 0!==i?i:"value",null!==(o=r[1])&&void 0!==o?o:"density"]}dependentFields(){var e;return new Set([this.transform.density,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"DensityTransform ".concat(h(this.transform))}assemble(){const{density:e,...t}=this.transform;return{type:"kde",field:e,...t}}}class Gp extends Hl{clone(){return new Gp(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:o}=t;if("filter"!==Cn("invalid",o,n))return null;const r=t.reduceFieldDef(((e,n,o)=>{const r=Ht(o)&&t.getScaleComponent(o);if(r){Wo(r.get("type"))&&"count"!==n.aggregate&&!hr(i)&&(e[n.field]=n)}return e}),{});return C(r).length?new Gp(e,r):null}dependentFields(){return new Set(C(this.filter))}producedFields(){return new Set}hash(){return"FilterInvalid ".concat(h(this.filter))}assemble(){const e=C(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=ka(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push("(isDate(".concat(i,") || (isValid(").concat(i,") && isFinite(+").concat(i,")))")):"quantitative"===n.type&&(e.push("isValid(".concat(i,")")),e.push("isFinite(+".concat(i,")")))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class Yp extends Hl{clone(){return new Yp(this.parent,d(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=d(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>{var n;return null!==(n=i[t])&&void 0!==n?n:e}))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return"FlattenTransform ".concat(h(this.transform))}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Xp extends Hl{clone(){return new Xp(null,d(this.transform))}constructor(e,t){var n,i,o;super(e),this.transform=t,this.transform=d(t);const r=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=r[0])&&void 0!==i?i:"key",null!==(o=r[1])&&void 0!==o?o:"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return"FoldTransform ".concat(h(this.transform))}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Jp extends Hl{clone(){return new Jp(null,d(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[[de,ue],[pe,fe]]){const o=i.map((e=>{const n=Ma(t.encoding[e]);return ca(n)?n.field:ua(n)?{expr:"".concat(n.datum)}:ga(n)?{expr:"".concat(n.value)}:void 0}));(o[0]||o[1])&&(e=new Jp(e,o,null,t.getName("geojson_".concat(n++))))}if(t.channelHasField(ve)){const i=t.typedFieldDef(ve);i.type===xo&&(e=new Jp(e,null,i.field,t.getName("geojson_".concat(n++))))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){var e;const n=(null!==(e=this.fields)&&void 0!==e?e:[]).filter(t.isString);return new Set([...this.geojson?[this.geojson]:[],...n])}producedFields(){return new Set}hash(){return"GeoJSON ".concat(this.geojson," ").concat(this.signal," ").concat(h(this.fields))}assemble(){return[...this.geojson?[{type:"filter",expr:'isValid(datum["'.concat(this.geojson,'"])')}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Qp extends Hl{clone(){return new Qp(null,this.projection,d(this.fields),d(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[[de,ue],[pe,fe]]){const i=n.map((e=>{const n=Ma(t.encoding[e]);return ca(n)?n.field:ua(n)?{expr:"".concat(n.datum)}:ga(n)?{expr:"".concat(n.value)}:void 0})),o=n[0]===pe?"2":"";(i[0]||i[1])&&(e=new Qp(e,t.projectionName(),i,[t.getName("x".concat(o)),t.getName("y".concat(o))]))}return e}dependentFields(){return new Set(this.fields.filter(t.isString))}producedFields(){return new Set(this.as)}hash(){return"Geopoint ".concat(this.projection," ").concat(h(this.fields)," ").concat(h(this.as))}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class $p extends Hl{clone(){return new $p(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e,o=[t,n,...i?[i]:[]].join(",");return{signal:"sequence(".concat(o,")")}}static makeFromTransform(e,t){return new $p(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,o=n.y;if(ca(i)&&ca(o)){const r=i.impute?i:o.impute?o:void 0;if(void 0===r)return;const a=i.impute?o:o.impute?i:void 0,{method:s,value:c,frame:l,keyvals:u}=r.impute,d=ds(t.mark,n);return new $p(e,{impute:r.field,key:a.field,...s?{method:s}:{},...void 0!==c?{value:c}:{},...l?{frame:l}:{},...void 0!==u?{keyvals:u}:{},...d.length?{groupby:d}:{}})}return null}hash(){return"Impute ".concat(h(this.transform))}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:o,value:r,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(c=n,void 0!==(null==c?void 0:c.stop)?this.processSequence(n):n)}:{},method:"value",...o?{groupby:o}:{},value:i&&"value"!==i?null:r};var c;if(i&&"value"!==i){return[s,{type:"window",as:["imputed_".concat(e,"_value")],ops:[i],fields:[e],frame:a,ignorePeers:!1,...o?{groupby:o}:{}},{type:"formula",expr:"datum.".concat(e," === null ? datum.imputed_").concat(e,"_value : datum.").concat(e),as:e}]}return[s]}}class Kp extends Hl{clone(){return new Kp(null,d(this.transform))}constructor(e,t){var n,i,o;super(e),this.transform=t,this.transform=d(t);const r=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=r[0])&&void 0!==i?i:t.on,null!==(o=r[1])&&void 0!==o?o:t.loess]}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"LoessTransform ".concat(h(this.transform))}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class Zp extends Hl{clone(){return new Zp(null,d(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const o=t.component.data.sources,{from:r}=n;let a=null;if(function(e){return"data"in e}(r)){let e=gm(r.data,o);e||(e=new Nf(r.data),o.push(e));const n=t.getName("lookup_".concat(i));a=new Vl(e,n,Ll.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(r)){const e=r.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(j(e),e)}catch(t){throw new Error(function(e){return'Lookups can only be performed on selection parameters. "'.concat(e,'" is a variable parameter.')}(e))}if(a=i.materialized,!a)throw new Error(function(e){return'Cannot define and lookup the "'.concat(e,'" selection in the same view. ')+"Try moving the lookup into a second, layered view?"}(e))}return new Zp(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?t.array(this.transform.as):this.transform.from.fields)}hash(){return"Lookup ".concat(h({transform:this.transform,secondary:this.secondary}))}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:t.array(this.transform.as)}:{}};else{let n=this.transform.as;t.isString(n)||(ji('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.'),n="_lookup"),e={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class em extends Hl{clone(){return new em(null,d(this.transform))}constructor(e,t){var n,i,o;super(e),this.transform=t,this.transform=d(t);const r=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=r[0])&&void 0!==i?i:"prob",null!==(o=r[1])&&void 0!==o?o:"value"]}dependentFields(){var e;return new Set([this.transform.quantile,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"QuantileTransform ".concat(h(this.transform))}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class tm extends Hl{clone(){return new tm(null,d(this.transform))}constructor(e,t){var n,i,o;super(e),this.transform=t,this.transform=d(t);const r=null!==(n=this.transform.as)&&void 0!==n?n:[void 0,void 0];this.transform.as=[null!==(i=r[0])&&void 0!==i?i:t.on,null!==(o=r[1])&&void 0!==o?o:t.regression]}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}producedFields(){return new Set(this.transform.as)}hash(){return"RegressionTransform ".concat(h(this.transform))}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class nm extends Hl{clone(){return new nm(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){var t;this.transform.groupby=S((null!==(t=this.transform.groupby)&&void 0!==t?t:[]).concat(e),(e=>e))}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...null!==(e=this.transform.groupby)&&void 0!==e?e:[]])}hash(){return"PivotTransform ".concat(h(this.transform))}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:o}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==o?{op:o}:{},...void 0!==n?{groupby:n}:{}}}}class im extends Hl{clone(){return new im(null,d(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return"SampleTransform ".concat(h(this.transform))}assemble(){return{type:"sample",size:this.transform.sample}}}function om(e){let t=0;return function n(i,o){if(i instanceof Nf&&!i.isGenerator&&!Pl(i.data)){e.push(o);o={name:null,source:o.name,transform:[]}}var r;if(i instanceof zf&&(i.parent instanceof Nf&&!o.source?(o.format={...null!==(r=o.format)&&void 0!==r?r:{},parse:i.assembleFormatParse()},o.transform.push(...i.assembleTransforms(!0))):o.transform.push(...i.assembleTransforms())),i instanceof Df)return o.name||(o.name="data_".concat(t++)),!o.source||o.transform.length>0?(e.push(o),i.data=o.name):i.data=o.source,void e.push(...i.assemble());if((i instanceof Pf||i instanceof Af||i instanceof Gp||i instanceof sd||i instanceof Sd||i instanceof Qp||i instanceof Sf||i instanceof Zp||i instanceof $f||i instanceof Jf||i instanceof Xp||i instanceof Yp||i instanceof Ip||i instanceof Kp||i instanceof em||i instanceof tm||i instanceof Cf||i instanceof im||i instanceof nm)&&o.transform.push(i.assemble()),(i instanceof wf||i instanceof Il||i instanceof $p||i instanceof Qf||i instanceof Jp)&&o.transform.push(...i.assemble()),i instanceof Vl)if(o.source&&0===o.transform.length)i.setSource(o.source);else if(i.parent instanceof Vl)i.setSource(o.name);else if(o.name||(o.name="data_".concat(t++)),i.setSource(o.name),1===i.numChildren()){e.push(o);o={name:null,source:o.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof Vl&&(!o.source||o.transform.length>0)&&e.push(o);break;case 1:n(i.children[0],o);break;default:{o.name||(o.name="data_".concat(t++));let r=o.name;!o.source||o.transform.length>0?e.push(o):r=o.source;for(const e of i.children){n(e,{name:null,source:r,transform:[]})}break}}}}function rm(e,t){const n=[],i=om(n);let o=0;for(const t of e.sources){t.hasName()||(t.dataName="source_".concat(o++));const e=t.assemble();i(t,e)}for(const e of n)0===e.transform.length&&delete e.transform;let r=0;for(const[e,t]of n.entries()){var a;0!==(null!==(a=t.transform)&&void 0!==a?a:[]).length||t.source||n.splice(r++,0,n.splice(e,1)[0])}for(const t of n)for(const n of null!==(s=t.transform)&&void 0!==s?s:[]){var s;"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource())}for(const e of n)e.name in t&&(e.values=t[e.name]);return n}function am(e){return"top"===e||"left"===e||gn(e)?"header":"footer"}function sm(e,n){const{facet:i,config:o,child:r,component:a}=e;if(e.channelHasField(n)){var s;const c=i[n],l=Od("title",null,o,n);let u=Ca(c,o,{allowDisabling:!0,includeDefault:void 0===l||!!l});r.component.layoutHeaders[n].title&&(u=t.isArray(u)?u.join(", "):u,u+=" / ".concat(r.component.layoutHeaders[n].title),r.component.layoutHeaders[n].title=null);const d=Od("labelOrient",c.header,o,n),f=null!==c.header&&V(null===(s=c.header)||void 0===s?void 0:s.labels,o.header.labels,!0),p=y(["bottom","right"],d)?"footer":"header";a.layoutHeaders[n]={title:null!==c.header?u:null,facetFieldDef:c,[p]:"facet"===n?[]:[cm(e,n,f)]}}}function cm(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 lm(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:o,resolve:r}=e.component;if(r.axis[t]=Yd(r,t),"shared"===r.axis[t]){const r="x"===t?"column":"row",a=o[r];for(const o of n.component.axes[t]){var i;const t=am(o.get("orient"));null!==(i=a[t])&&void 0!==i||(a[t]=[cm(e,r,!1)]);const n=pd(o,"main",e.config,{header:!0});n&&a[t][0].axes.push(n),o.mainExtracted=!0}}}}function um(e){for(const t of e.children)t.parseLayoutSize()}function dm(e,t){const n=Vd(t),i=zt(n),o=e.component.resolve,r=e.component.layoutSize;let a;for(const t of e.children){var s;const r=t.component.layoutSize.getWithExplicit(n),c=null!==(s=o.scale[i])&&void 0!==s?s:Gd(i,e);if("independent"===c&&"step"===r.value){a=void 0;break}if(a){if("independent"===c&&a.value!==r.value){a=void 0;break}a=zl(a,r,n,"")}else a=r}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);r.setWithExplicit(t,a)}else r.setWithExplicit(t,{explicit:!1,value:void 0})}function fm(e,t){const n="width"===t?"x":"y",i=e.config,o=e.getScaleComponent(n);if(o){const e=o.get("type"),n=o.get("range");if(qo(e)){const e=rc(i.view,t);return hn(n)||ec(e)?"step":e}return ic(i.view,t)}if(e.hasProjection||"arc"===e.mark)return ic(i.view,t);{const e=rc(i.view,t);return ec(e)?e.step:e}}function pm(e,t,n){return ka(t,{suffix:"by_".concat(ka(e)),...null!=n?n:{}})}class mm extends Vp{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),Ln(this,"facet",void 0),Ln(this,"child",void 0),Ln(this,"children",void 0),this.child=Gm(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!$r(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=C(e),n={};for(const i of t){if(![$,K].includes(i)){ji(ci(i,"facet"));break}const t=e[i];if(void 0===t.field){ji(si(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=qa(e,t);return n.header?n.header=fn(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=hm(this),this.child.parseData()}parseLayoutSize(){um(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of Re)sm(e,t);lm(e,"x"),lm(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 o of Re)for(const r of Cd){const a=this.component.layoutHeaders[o],s=a[r],{facetFieldDef:c}=a;if(c){const n=Od("titleOrient",c.header,this.config,o);if(["right","bottom"].includes(n)){var t;const i=Fd(o,n);null!==(t=e.titleAnchor)&&void 0!==t||(e.titleAnchor={}),e.titleAnchor[i]="end"}}if(null!=s&&s[0]){const t="row"===o?"height":"width",s="header"===r?"headerBand":"footerBand";var n,i;if("facet"!==o&&!this.child.component.layoutSize.get(t))null!==(n=e[s])&&void 0!==n||(e[s]={}),e[s][o]=.5;if(a.title)null!==(i=e.offset)&&void 0!==i||(e.offset={}),e.offset["row"===o?"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 mm)){const e=this.getName("column_domain");return{signal:"length(data('".concat(e,"'))")}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof mm?{...this.channelHasField("column")?{encode:{update:{columns:{field:ka(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof mm){if(this.child.channelHasField("column")){const i=ka(this.child.facet.column);e.push(i),t.push("distinct"),n.push("distinct_".concat(i))}}else for(const i of Dt){const o=this.child.component.scales[i];if(o&&!o.merged){const r=o.get("type"),a=o.get("range");if(qo(r)&&hn(a)){const o=gp(hp(this.child,i));o?(e.push(o),t.push("distinct"),n.push("distinct_".concat(o))):ji(Gn(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:n}=this.component.data.facetRoot,{row:i,column:o}=this.facet,{fields:r,ops:a,as:s}=this.getCardinalityAggregateForChild(),c=[];for(const e of Re){const n=this.facet[e];if(n){c.push(ka(n));const{bin:l,sort:u}=n;if(an(l)&&c.push(ka(n,{binSuffix:"end"})),Jr(u)){const{field:e,op:t=Ir}=u,c=pm(n,u);i&&o?(r.push(c),a.push("max"),s.push(c)):(r.push(e),a.push(t),s.push(c))}else if(t.isArray(u)){const t=Dd(n,e);r.push(t),a.push("max"),s.push(t)}}}const l=!!i&&!!o;return{name:e,data:n,groupby:c,...l||r.length>0?{aggregate:{...l?{cross:l}:{},...r.length?{fields:r,ops:a,as:s}:{}}}:{}}}facetSortFields(e){const{facet:n}=this,i=n[e];return i?Jr(i.sort)?[pm(i,i.sort,{expr:"datum"})]:t.isArray(i.sort)?[Dd(i,e,{expr:"datum"})]:[ka(i,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:n}=this,i=n[e];if(i){const{sort:e}=i;return[(Jr(e)?e.order:!t.isArray(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return Md(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const o of zd)if(e[o]){var i;const r=Od("labelOrient",null===(i=e[o])||void 0===i?void 0:i.header,t,o);if(n[o].includes(r))return Md(e[o],o,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=om(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),o=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...o?{style:o}:{},from:{facet:this.assembleFacet()},sort:{field:Re.map((e=>this.facetSortFields(e))).flat(),order:Re.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(Rl(this,[]))}]}getMapping(){return this.facet}}function gm(e,t){for(const a of t){var n,i,o,r;const t=a.data;if(e.name&&a.hasName()&&e.name!==a.dataName)continue;const s=null===(n=e.format)||void 0===n?void 0:n.mesh,c=null===(i=t.format)||void 0===i?void 0:i.feature;if(s&&c)continue;const l=null===(o=e.format)||void 0===o?void 0:o.feature;if((l||c)&&l!==c)continue;const d=null===(r=t.format)||void 0===r?void 0:r.mesh;if(!s&&!d||s===d)if(Al(e)&&Al(t)){if(u(e.values,t.values))return a}else if(Pl(e)&&Pl(t)){if(e.url===t.url)return a}else if(Nl(e)&&e.name===a.dataName)return a}return null}function hm(e){var t,n,i;let o=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new Nf({values:[]});return t.push(e),e}const n=gm(e.data,t);if(n)return jl(e.data)||(n.data.format=w({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new Nf(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:r,outputNodeRefCounts:a}=e.component.data,s=e.data,c=!(s&&(jl(s)||Pl(s)||Al(s)))&&e.parent?e.parent.component.data.ancestorParse.clone():new Cl;jl(s)?(El(s)?o=new Af(o,s.sequence):Tl(s)&&(o=new Pf(o,s.graticule)),c.parseNothing=!0):null===(null==s||null===(t=s.format)||void 0===t?void 0:t.parse)&&(c.parseNothing=!0),o=null!==(n=zf.makeExplicit(o,e,c))&&void 0!==n?n:o,o=new Cf(o);const l=e.parent&&Bp(e.parent);var u;(Wp(e)||Rp(e))&&(l&&(o=null!==(u=wf.makeFromEncoding(o,e))&&void 0!==u?u:o));e.transforms.length>0&&(o=function(e,t,n){let i=0;for(const a of t.transforms){let s,c;if(rl(a))c=e=new Sd(e,a),s="derived";else if(Xc(a)){var o;const i=Of(a);c=e=null!==(o=zf.makeWithAncestors(e,{},i,n))&&void 0!==o?o:e,e=new sd(e,t,a.filter)}else if(al(a))c=e=wf.makeFromTransform(e,a,t),s="number";else if(cl(a))s="date",void 0===n.getWithExplicit(a.field).value&&(e=new zf(e,{[a.field]:s}),n.set(a.field,s,!1)),c=e=Il.makeFromTransform(e,a);else if(ll(a))c=e=Sf.makeFromTransform(e,a),s="number",nd(t)&&(e=new Cf(e));else if(Jc(a))c=e=Zp.make(e,t,a,i++),s="derived";else if(nl(a))c=e=new $f(e,a),s="number";else if(il(a))c=e=new Jf(e,a),s="number";else if(ul(a))c=e=Qf.makeFromTransform(e,a),s="derived";else if(dl(a))c=e=new Xp(e,a),s="derived";else if(ol(a))c=e=new Yp(e,a),s="derived";else if(Qc(a))c=e=new nm(e,a),s="derived";else if(tl(a))e=new im(e,a);else if(sl(a))c=e=$p.makeFromTransform(e,a),s="derived";else if($c(a))c=e=new Ip(e,a),s="derived";else if(Kc(a))c=e=new em(e,a),s="derived";else if(Zc(a))c=e=new tm(e,a),s="derived";else{if(!el(a)){ji("Ignoring an invalid transform: ".concat(g(a),"."));continue}c=e=new Kp(e,a),s="derived"}if(c&&void 0!==s)for(const e of null!==(r=c.producedFields())&&void 0!==r?r:[]){var r;n.set(e,s,!1)}}return e}(o,e,c));const d=function(e){const t={};if(Wp(e)&&e.component.selection)for(const n of C(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&H(e.field)>1&&(t[e.field]="flatten")}return t}(e),f=_f(e);if(o=null!==(i=zf.makeWithAncestors(o,{},{...d,...f},c))&&void 0!==i?i:o,Wp(e)&&(o=Jp.parseAll(o,e),o=Qp.parseAll(o,e)),Wp(e)||Rp(e)){var p,m;if(!l)o=null!==(m=wf.makeFromEncoding(o,e))&&void 0!==m?m:o;o=null!==(p=Il.makeFromEncoding(o,e))&&void 0!==p?p:o,o=Sd.parseAllForSortIndex(o,e)}const h=e.getDataName(Ll.Raw),v=new Vl(o,h,Ll.Raw,a);if(r[h]=v,o=v,Wp(e)){var y,b;const t=Sf.makeFromEncoding(o,e);t&&(o=t,nd(e)&&(o=new Cf(o))),o=null!==(y=$p.makeFromEncoding(o,e))&&void 0!==y?y:o,o=null!==(b=Qf.makeFromEncoding(o,e))&&void 0!==b?b:o}var x;Wp(e)&&(o=null!==(x=Gp.make(o,e))&&void 0!==x?x:o);const k=e.getDataName(Ll.Main),S=new Vl(o,k,Ll.Main,a);r[k]=S,o=S,Wp(e)&&function(e,t){for(const[i,o]of A(null!==(n=e.component.selection)&&void 0!==n?n:{})){var n;const r=e.getName("lookup_".concat(i));e.component.data.outputNodes[r]=o.materialized=new Vl(new sd(t,e,{param:i}),r,Ll.Lookup,e.component.data.outputNodeRefCounts)}}(e,S);let D=null;if(Rp(e)){var F;const t=e.getName("facet");o=null!==(F=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const o of[n,i])if(Jr(o.sort)){const{field:n,op:i=Ir}=o.sort;e=t=new Jf(e,{joinaggregate:[{op:i,field:n,as:pm(o,o.sort,{forAs:!0})}],groupby:[ka(o)]})}return t}return null}(o,e.facet))&&void 0!==F?F:o,D=new Df(o,e,t,S.getSource()),r[t]=D}return{...e.component.data,outputNodes:r,outputNodeRefCounts:a,raw:v,main:S,facetRoot:D,ancestorParse:c}}class vm extends Hp{constructor(e,t,n,i){var o,r,a,s;super(e,"concat",t,n,i,e.resolve),Ln(this,"children",void 0),"shared"!==(null===(o=e.resolve)||void 0===o||null===(r=o.axis)||void 0===r?void 0:r.x)&&"shared"!==(null===(a=e.resolve)||void 0===a||null===(s=a.axis)||void 0===s?void 0:s.y)||ji("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)=>Gm(e,this,this.getName("concat_".concat(t)),void 0,i)))}parseData(){this.component.data=hm(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 C(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return Js(e)?e.vconcat:Qs(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){um(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";dm(e,t),dm(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=Rd(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 ym={disable:1,gridScale:1,scale:1,...Qa,labelExpr:1,encode:1},bm=C(ym);class xm extends Sl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new xm(d(this.explicit),d(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 gn(this.explicit.orient)}}const wm={bottom:"top",top:"bottom",left:"right",right:"left"};function km(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],o=t[i];if(!!n!=!!o)return;if(n&&o){const t=n.getWithExplicit("orient"),r=o.getWithExplicit("orient");if(t.explicit&&r.explicit&&t.value!==r.value)return;e[i]=Sm(n,o)}}}return e}function Sm(e,t){for(const n of bm){const i=zl(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",((e,t)=>{switch(n){case"title":return Tn(e,t);case"gridScale":return{explicit:e.explicit,value:V(e.value,t.value)}}return _l(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function Dm(e,t,n,i,o){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(gn(n.labelAngle)?n.labelAngle:J(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===kd(i,o))return!0}return e===n[t]}const Fm=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function Om(e,t){var n,i,o,r,a;let s=t.axis(e);const c=new xm,l=Ma(t.encoding[e]),{mark:u,config:d}=t,f=(null===(n=s)||void 0===n?void 0:n.orient)||(null===(i=d["x"===e?"axisX":"axisY"])||void 0===i?void 0:i.orient)||(null===(o=d.axis)||void 0===o?void 0:o.orient)||function(e){return"x"===e?"bottom":"left"}(e),p=t.getScaleComponent(e).get("type"),m=function(e,t,n,i){const o="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:Eo(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],r="x"===e?"axisX":"axisY",a=gn(n)?"axisOrient":"axis".concat(T(n)),s=[...o,...o.map((e=>r+e.substr(4)))],c=["axis",a,r];return{vlOnlyAxisConfig:gd(s,i,e,n),vgAxisConfig:gd(c,i,e,n),axisConfigStyle:hd([...c,...s],i)}}(e,p,f,t.config),g=void 0!==s?!s:vd("disable",d.style,null===(r=s)||void 0===r?void 0:r.style,m).configValue;if(c.set("disable",g,void 0!==s),g)return c;s=s||{};const h=function(e,t,n,i,o){const r=null==t?void 0:t.labelAngle;if(void 0!==r)return gn(r)?r:J(r);{const{configValue:r}=vd("labelAngle",i,null==t?void 0:t.style,o);return void 0!==r?J(r):n!==ee||!y([bo,vo],e.type)||ca(e)&&e.timeUnit?void 0:270}}(l,s,e,d.style,m),v={fieldOrDatumDef:l,axis:s,channel:e,model:t,scaleType:p,orient:f,labelAngle:h,mark:u,config:d};for(const n of bm){const i=n in yd?yd[n](v):Ka(n)?s[n]:void 0,o=void 0!==i,r=Dm(i,n,s,t,e);if(o&&r)c.set(n,i,r);else{const{configValue:e,configFrom:t}=Ka(n)&&"values"!==n?vd(n,d.style,s.style,m):{},a=void 0!==e;o&&!a?c.set(n,i,r):("vgAxisConfig"!==t||Fm.has(n)&&a||Ya(e)||gn(e))&&c.set(n,e,!1)}}const b=null!==(a=s.encoding)&&void 0!==a?a:{},x=Xa.reduce(((n,i)=>{var o;if(!c.hasAxisPart(i))return n;const r=Id(null!==(o=b[i])&&void 0!==o?o:{},t),a="labels"===i?function(e,t,n){var i;const{encoding:o,config:r}=e,a=null!==(i=Ma(o[t]))&&void 0!==i?i:Ma(o[nt(t)]),s=e.axis(t)||{},{format:c,formatType:l}=s;return Er(l)?{text:qr({fieldOrDatumDef:a,field:"datum.value",format:c,formatType:l,config:r}),...n}:n}(t,e,r):r;return void 0===a||z(a)||(n[i]={update:a}),n}),{});return z(x)||c.set("encode",x,!!s.encoding||void 0!==s.labelAngle),c}function _m(e,t,n){const i=fn(e),o=Cn("orient",i,n);var r,a;if(i.orient=function(e,t,n){switch(e){case sr:case pr:case mr:case ur:case cr:case rr:return}const{x:i,y:o,x2:r,y2:a}=t;switch(e){case or:if(ca(i)&&(sn(i.bin)||ca(o)&&o.aggregate&&!i.aggregate))return"vertical";if(ca(o)&&(sn(o.bin)||ca(i)&&i.aggregate&&!o.aggregate))return"horizontal";if(a||r){if(n)return n;if(!r&&(ca(i)&&i.type===ho&&!an(i.bin)||fa(i)))return"horizontal";if(!a&&(ca(o)&&o.type===ho&&!an(o.bin)||fa(o)))return"vertical"}case lr:if(r&&(!ca(i)||!sn(i.bin))&&a&&(!ca(o)||!sn(o.bin)))return;case ir:if(a)return ca(o)&&sn(o.bin)?"horizontal":"vertical";if(r)return ca(i)&&sn(i.bin)?"vertical":"horizontal";if(e===lr){if(i&&!o)return"vertical";if(o&&!i)return"horizontal"}case ar:case dr:{const t=da(i),r=da(o);if(n)return n;if(t&&!r)return"tick"!==e?"horizontal":"vertical";if(!t&&r)return"tick"!==e?"vertical":"horizontal";if(t&&r){const t=i,n=o,r=t.type===yo,a=n.type===yo;return r&&!a?"tick"!==e?"vertical":"horizontal":!r&&a?"tick"!==e?"horizontal":"vertical":!t.aggregate&&n.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!n.aggregate&&"tick"!==e?"horizontal":"vertical"}return}}return"vertical"}(i.type,t,o),void 0!==o&&o!==i.orient&&ji((r=i.orient,a=o,'Specified orient "'.concat(r,'" overridden with "').concat(a,'".'))),"bar"===i.type&&i.orient){const e=Cn("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:Dr[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}void 0===Cn("opacity",i,n)&&(i.opacity=function(e,t){if(y([sr,dr,pr,mr],e)&&!rs(t))return.7;return}(i.type,t));return void 0===Cn("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||Cn("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function zm(e,t){const{config:n}=e;return{...Cu(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...hu("x",e,{defaultPos:"mid"}),...hu("y",e,{defaultPos:"mid"}),...fu("size",e),...fu("angle",e),...Cm(e,n,t)}}function Cm(e,t,n){return n?{shape:{value:n}}:fu("shape",e)}const Pm={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...Cu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wu("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...wu("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...fu("size",e,{vgChannel:"strokeWidth"})}:{}}};function Am(e,t,n){if(void 0===Cn("align",e,n))return"center"}function Nm(e,t,n){if(void 0===Cn("baseline",e,n))return"middle"}const jm={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,o="horizontal"===i?"width":"height",r="horizontal"===i?"height":"width";return{...Cu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...hu("x",e,{defaultPos:"mid",vgChannel:"xc"}),...hu("y",e,{defaultPos:"mid",vgChannel:"yc"}),...fu("size",e,{defaultValue:Em(e),vgChannel:o}),[r]:Dn(Cn("thickness",n,t))}}};function Em(e){var n;const{config:i,markDef:o}=e,{orient:r}=o,a="horizontal"===r?"width":"height",s=e.getScaleComponent("horizontal"===r?"x":"y"),c=null!==(n=Cn("size",o,i,{vgChannel:a}))&&void 0!==n?n:i.tick.bandSize;if(void 0!==c)return c;{const e=s?s.get("range"):void 0;if(e&&hn(e)&&t.isNumber(e.step))return 3*e.step/4;return 3*oc(i.view,a)/4}}const Mm={arc:{vgMark:"arc",encodeEntry:e=>({...Cu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...hu("x",e,{defaultPos:"mid"}),...hu("y",e,{defaultPos:"mid"}),...Du(e,"radius"),...Du(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...Cu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...wu("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...wu("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...Nu(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...Cu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Du(e,"x"),...Du(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>zm(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...Cu(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&&ca(n)&&n.type===xo?{field:ka(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...Cu(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Du(e,"x"),...Du(e,"y"),...ou(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...Cu(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...hu("x",e,{defaultPos:"mid"}),...hu("y",e,{defaultPos:"mid"}),...fu("size",e,{vgChannel:"strokeWidth"}),...Nu(e)})},point:{vgMark:"symbol",encodeEntry:e=>zm(e)},rect:{vgMark:"rect",encodeEntry:e=>({...Cu(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Du(e,"x"),...Du(e,"y")})},rule:Pm,square:{vgMark:"symbol",encodeEntry:e=>zm(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...Cu(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...hu("x",e,{defaultPos:"mid"}),...hu("y",e,{defaultPos:"mid"}),...ou(e),...fu("size",e,{vgChannel:"fontSize"}),...fu("angle",e),...ju("align",Am(e.markDef,n,t)),...ju("baseline",Nm(e.markDef,n,t)),...hu("radius",e,{defaultPos:null}),...hu("theta",e,{defaultPos:null})}}},tick:jm,trail:{vgMark:"trail",encodeEntry:e=>({...Cu(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...hu("x",e,{defaultPos:"mid"}),...hu("y",e,{defaultPos:"mid"}),...fu("size",e),...Nu(e)})}};function Tm(e){if(y([ar,ir,fr],e.mark)){const t=ds(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:Lm+e.requestDataName(Ll.Main),data:e.requestDataName(Ll.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Rm(e,{fromPrefix:Lm})}]}(e,t)}else if(e.mark===or){const t=xn.some((t=>Cn(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){var t;const[n]=Rm(e,{fromPrefix:qm}),i=e.scaleName(e.stack.fieldChannel),o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.vgField(e.stack.fieldChannel,t)},r=(e,t)=>{const n=[o({prefix:"min",suffix:"start",expr:t}),o({prefix:"max",suffix:"start",expr:t}),o({prefix:"min",suffix:"end",expr:t}),o({prefix:"max",suffix:"end",expr:t})];return"".concat(e,"(").concat(n.map((e=>"scale('".concat(i,"',").concat(e,")"))).join(","),")")};let a,s;"x"===e.stack.fieldChannel?(a={...p(n.encode.update,["y","yc","y2","height",...xn]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...m(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(a={...p(n.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...m(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const t of xn){const i=Pn(t,e.markDef,e.config);n.encode.update[t]?(a[t]=n.encode.update[t],delete n.encode.update[t]):i&&(a[t]=Dn(i)),i&&(n.encode.update[t]={value:0})}const c=[];if((null===(t=e.stack.groupbyChannels)||void 0===t?void 0:t.length)>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=ka(n);i&&c.push(i),(null!=n&&n.bin||null!=n&&n.timeUnit)&&c.push(ka(n,{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=Pn(i,e.markDef,e.config);return void 0!==n?{...t,[i]:Dn(n)}:t}}),a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(Ll.Main),name:qm+e.requestDataName(Ll.Main),groupby:c,aggregate:{fields:[o({suffix:"start"}),o({suffix:"start"}),o({suffix:"end"}),o({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:s},marks:[n]}]}]}(e)}return Rm(e)}const Lm="faceted_path_";const qm="stack_group_";function Wm(e){const{encoding:n,stack:i,mark:o,markDef:r,config:a}=e,s=n.order;if(!(!t.isArray(s)&&ga(s)&&v(s.value)||!s&&v(Cn("order",r,a)))){if((t.isArray(s)||ca(s))&&!i)return jn(s,{expr:"datum"});if(hr(o)){const i="horizontal"===r.orient?"y":"x",o=n[i];if(ca(o)){const n=o.sort;if(t.isArray(n))return{field:ka(o,{prefix:i,suffix:"sort_index",expr:"datum"})};if(Jr(n))return{field:ka({aggregate:rs(e.encoding)?n.op:void 0,field:n.field},{expr:"datum"})};if(Xr(n)){return{field:ka(e.fieldDef(n.encoding),{expr:"datum"}),order:n.order}}if(null===n)return;var c;return{field:ka(o,{binSuffix:null!==(c=e.stack)&&void 0!==c&&c.impute?"mid":void 0,expr:"datum"})}}}else;}}function Rm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fromPrefix:""};const{mark:n,markDef:i,encoding:o,config:r}=e,a=V(i.clip,Um(e),Bm(e)),s=zn(i),c=o.key,l=Wm(e),u=Hm(e),d=Cn("aria",i,r),f=Mm[n].postEncodingTransform?Mm[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:Mm[n].vgMark,...a?{clip:!0}:{},...s?{style:s}:{},...c?{key:c.field}:{},...l?{sort:l}:{},...u||{},...!1===d?{aria:d}:{},from:{data:t.fromPrefix+e.requestDataName(Ll.Main)},encode:{update:Mm[n].encodeEntry(e)},...f?{transform:f}:{}}]}function Um(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(null!=t&&t.get("selectionExtent")||null!=n&&n.get("selectionExtent"))||void 0}function Bm(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}function Hm(e){if(!e.component.selection)return null;const t=C(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=C(i.component.selection).length,i=i.parent;return n?{interactive:t>0||!!e.encoding.tooltip}:null}class Vm extends Vp{constructor(e,n,i){var o;let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4?arguments[4]:void 0;super(e,"unit",n,i,a,void 0,tc(e)?e.view:void 0),Ln(this,"markDef",void 0),Ln(this,"encoding",void 0),Ln(this,"specifiedScales",{}),Ln(this,"stack",void 0),Ln(this,"specifiedAxes",{}),Ln(this,"specifiedLegends",{}),Ln(this,"specifiedProjection",{}),Ln(this,"selection",[]),Ln(this,"children",[]);const s=br(e.mark)?{...e.mark}:{type:e.mark},c=s.type;void 0===s.filled&&(s.filled=function(e,t,n){let{graticule:i}=n;if(i)return!1;const o=Pn("filled",e,t),r=e.type;return V(o,r!==sr&&r!==ar&&r!==lr)}(s,a,{graticule:e.data&&Tl(e.data)}));const l=this.encoding=function(e,n,i,o){const r={};for(const t of C(e))$e(t)||ji("".concat(a=t,"-encoding is dropped as ").concat(a," is not a valid encoding channel."));var a;for(let a of at){if(!e[a])continue;const s=e[a];if(Pt(a)){const e=rt(a),t=r[e];if(ca(t)){if(mo(t.type)&&ca(s)){ji(ei(e));continue}}else a=e,ji(ti(e))}if("angle"!==a||"arc"!==n||e.theta||(ji("Arc marks uses theta channel rather than angle, replacing angle with theta."),a=ce),ss(e,a,n)){if(a===ye&&"line"===n){const t=Ea(e[a]);if(null!=t&&t.aggregate){ji("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(a===me&&(i?"fill"in e:"stroke"in e))ji(ai("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(a===_e||a===Oe&&!t.isArray(s)&&!ga(s)||a===Ce&&t.isArray(s))s&&(r[a]=t.array(s).reduce(((e,t)=>(ca(t)?e.push(qa(t,a)):ji(si(t,a)),e)),[]));else{if(a===Ce&&null===s)r[a]=null;else if(!(ca(s)||ua(s)||ga(s)||ra(s)||gn(s))){ji(si(s,a));continue}r[a]=Ta(s,a,o)}}else ji(ci(a,n))}return r}(e.encoding||{},c,s.filled,a);this.markDef=_m(s,l,a),this.size=function(e){let{encoding:t,size:n}=e;for(const e of Dt){const i=it(e);ec(n[i])&&da(t[e])&&(delete n[i],ji(xi(i)))}return n}({encoding:l,size:tc(e)?{...r,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:r}),this.stack=Nc(c,l),this.specifiedScales=this.initScales(c,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegends(l),this.specifiedProjection=e.projection,this.selection=(null!==(o=e.params)&&void 0!==o?o:[]).filter((e=>Gs(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===gr,n=e&&Te.some((t=>pa(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 Bt.reduce(((e,n)=>{const i=Ma(t[n]);var o;i&&(e[n]=this.initScale(null!==(o=i.scale)&&void 0!==o?o:{}));return e}),{})}initScale(e){const{domain:n,range:i}=e,o=fn(e);return t.isArray(n)&&(o.domain=n.map(kn)),t.isArray(i)&&(o.range=i.map(kn)),o}initAxes(e){return Dt.reduce(((t,n)=>{const i=e[n];if(pa(i)||n===ee&&pa(e.x2)||n===te&&pa(e.y2)){const e=pa(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=C(e),n={};for(const i of t){const t=e[i];n[i]=Ya(t)?wn(t):kn(t)}return n}initLegends(e){return Rt.reduce(((t,n)=>{const i=Ma(e[n]);if(i&&function(e){switch(e){case me:case ge:case he:case ye:case ve:case xe:case Se:case De:return!0;case we:case ke:case be:return!1}}(n)){const e=i.legend;t[n]=e?fn(e):e}return t}),{})}parseData(){this.component.data=hm(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Dt){const o=it(i);if(t[o]){const e=t[o];n.layoutSize.set(o,ec(e)?"step":e,!0)}else{const t=fm(e,o);n.layoutSize.set(o,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,n){const i={},o=e.config.selection;if(!n||!n.length)return i;for(const a of n){const n=j(a.name),s=a.select,c=t.isString(s)?s:s.type,l=t.isObject(s)?d(s):{type:c},u=o[c];for(const e in u){var r;"fields"!==e&&"encodings"!==e&&("mark"===e&&(l[e]={...u[e],...l[e]}),(void 0===l[e]||!0===l[e])&&(l[e]=null!==(r=u[e])&&void 0!==r?r:l[e]))}const f=i[n]={...l,name:n,type:c,init:a.value,bind:a.bind,events:t.isString(l.on)?t.parseSelector(l.on,"scope"):t.array(d(l.on))};for(const t of Zu)t.defined(f)&&t.parse&&t.parse(e,f,a)}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=Tm(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Dt.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[Om(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,n){let i=!1;for(const r of P(null!==(o=e.component.selection)&&void 0!==o?o:{})){var o;const a=r.name,s=t.stringValue(a+Ju);if(0===n.filter((e=>e.name===a)).length){const e="global"===r.resolve?"union":r.resolve,i="point"===r.type?", true, true)":")";n.push({name:r.name,update:"".concat(Ku,"(").concat(s,", ").concat(t.stringValue(e)).concat(i)})}i=!0;for(const t of Zu)t.defined(r)&&t.topLevelSignals&&(n=t.topLevelSignals(e,r,n))}i&&0===n.filter((e=>"unit"===e.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]});return Bl(n)}(this,e)}assembleSignals(){return[...md(this),...Wl(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t];for(const t of P(null!==(i=e.component.selection)&&void 0!==i?i:{})){var i;const o={name:t.name+Ju};if(t.init){const n=t.project.items.map((e=>{const{signals:t,...n}=e;return n}));o.values=t.init.map((t=>({unit:td(e,{escape:!1}),fields:n,values:ql(t,!1)})))}n.filter((e=>e.name===t.name+Ju)).length||n.push(o)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return Rd(this)}assembleMarks(){var e;let t=null!==(e=this.component.mark)&&void 0!==e?e:[];return this.parent&&Bp(this.parent)||(t=Ul(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":void 0}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return ns(this.encoding,e)}fieldDef(e){return Ea(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return ma(t)?t:null}}class Im extends Hp{constructor(e,t,n,i,o){super(e,"layer",t,n,o,e.resolve,e.view),Ln(this,"children",void 0);const r={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(Sc(e))return new Im(e,this,this.getName("layer_".concat(t)),r,o);if(es(e))return new Vm(e,this,this.getName("layer_".concat(t)),r,o);throw new Error(Un(e))}))}parseData(){this.component.data=hm(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;um(e=this),dm(e,"width"),dm(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of C(e.component.selection))this.component.selection[t]=e.component.selection[t]}}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 i of e.children){i.parseAxesAndHeaders();for(const o of C(i.component.axes))n.axis[o]=Yd(e.component.resolve,o),"shared"===n.axis[o]&&(t[o]=km(t[o],i.component.axes[o]),t[o]||(n.axis[o]="independent",delete t[o]))}for(const r of Dt){for(const a of e.children)if(a.component.axes[r]){if("independent"===n.axis[r]){var o;t[r]=(null!==(o=t[r])&&void 0!==o?o:[]).concat(a.component.axes[r]);for(const e of a.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!gn(t)){if(i[t]>0&&!n){const n=wm[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete a.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const e of t[r])e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),md(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),Rd(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 i of t.array(n.assembleGroupStyle()))e.add(i);const n=Array.from(e);return n.length>1?n:1===n.length?n[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)Wp(n)&&(t=Ul(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),df(this))}}function Gm(e,t,n,i,o){if(Zr(e))return new mm(e,t,n,o);if(Sc(e))return new Im(e,t,n,i,o);if(es(e))return new Vm(e,t,n,i,o);if(function(e){return Js(e)||Qs(e)||Xs(e)}(e))return new vm(e,t,n,o);throw new Error(Un(e))}function Ym(e,n,i,o){const r=o.component.layoutSize.get("width"),a=o.component.layoutSize.get("height");if(void 0===n?(n={type:"pad"},o.hasAxisOrientSignalRef()&&(n.resize=!0)):t.isString(n)&&(n={type:n}),r&&a&&("fit"===(s=n.type)||"fit-x"===s||"fit-y"===s))if("step"===r&&"step"===a)ji(In()),n.type="pad";else if("step"===r||"step"===a){const e="step"===r?"width":"height";ji(In(zt(e)));const t="width"===e?"height":"width";n.type=function(e){return e?"fit-".concat(zt(e)):"fit"}(t)}var s;return{...1===C(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...Ks(i,!1),...Ks(e,!0)}}function Xm(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;const o=e.config?wc(e.config):void 0,r=[].concat(e.assembleSelectionData([]),rm(e.component.data,n)),a=e.assembleProjections(),s=e.assembleTitle(),c=e.assembleGroupStyle(),l=e.assembleGroupEncodeEntry(!0);let u=e.assembleLayoutSignals();u=u.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:d,...f}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...f,...s?{title:s}:{},...c?{style:c}:{},...l?{encode:{update:l}}:{},data:r,...a.length>0?{projections:a}:{},...e.assembleGroup([...u,...e.assembleSelectionTopLevelSignals([]),...Ys(d)]),...o?{config:o}:{},...i?{usermeta:i}:{}}}const Jm=n;e.accessPathDepth=H,e.accessPathWithDatum=L,e.compile=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n.logger&&Ai(n.logger),n.fieldTitle&&_a(n.fieldTitle);try{const i=vc(t.mergeConfig(n.config,e.config)),o=yl(e,i),r=Gm(o,null,"",void 0,i);r.parse(),op(r.component.data,r);return{spec:Xm(r,Ym(e,o.autosize,i,r),e.datasets,e.usermeta),normalized:o}}finally{n.logger&&Ni(),n.fieldTitle&&za()}},e.contains=y,e.deepEqual=u,e.deleteNestedProperty=M,e.duplicate=d,e.entries=A,e.every=x,e.fieldIntersection=_,e.flatAccessWithDatum=q,e.getFirstDefined=V,e.hasIntersection=F,e.hash=h,e.internalField=Y,e.isBoolean=N,e.isEmpty=z,e.isEqual=function(e,t){const n=C(e),i=C(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0},e.isInternalField=X,e.isNullOrFalse=v,e.isNumeric=Q,e.keys=C,e.logicalExpr=E,e.mergeDeep=w,e.never=f,e.normalize=yl,e.normalizeAngle=J,e.omit=m,e.pick=p,e.prefixGenerator=O,e.removePathFromField=B,e.replaceAll=U,e.replacePathInField=R,e.resetIdCounter=function(){I=42},e.setEqual=D,e.some=b,e.stringify=g,e.titleCase=T,e.unique=S,e.uniqueId=G,e.vals=P,e.varName=j,e.version=Jm,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=vega-lite.min.js.map