crossnote 0.9.17 → 0.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/cjs/index.cjs CHANGED
@@ -1,16 +1,16 @@
1
- var Y3=Object.create;var Lw=Object.defineProperty;var K3=Object.getOwnPropertyDescriptor;var X3=Object.getOwnPropertyNames;var Z3=Object.getPrototypeOf,J3=Object.prototype.hasOwnProperty;var rA=(p,b)=>()=>(b||p((b={exports:{}}).exports,b),b.exports),Q3=(p,b)=>{for(var S in b)Lw(p,S,{get:b[S],enumerable:!0})},kD=(p,b,S,T)=>{if(b&&typeof b=="object"||typeof b=="function")for(let R of X3(b))!J3.call(p,R)&&R!==S&&Lw(p,R,{get:()=>b[R],enumerable:!(T=K3(b,R))||T.enumerable});return p};var Ve=(p,b,S)=>(S=p!=null?Y3(Z3(p)):{},kD(b||!p||!p.__esModule?Lw(S,"default",{value:p,enumerable:!0}):S,p)),ez=p=>kD(Lw({},"__esModule",{value:!0}),p);var wA=rA((Ww,gM)=>{(function(p,b){typeof Ww=="object"&&typeof gM<"u"?b(Ww):typeof define=="function"&&define.amd?define(["exports"],b):b((p=typeof globalThis<"u"?globalThis:p||self).vega={})})(Ww,(function(p){"use strict";function b(e,t,n){return e.fields=t||[],e.fname=n,e}function S(e){return e==null?null:e.fname}function T(e){return e==null?null:e.fields}function R(e){return e.length===1?$(e[0]):P(e)}let $=e=>function(t){return t[e]},P=e=>{let t=e.length;return function(n){for(let a=0;a<t;++a)n=n[e[a]];return n}};function F(e){throw Error(e)}function j(e){let t=[],n=e.length,a,r,i,o=null,u=0,c="";function f(){t.push(c+e.substring(a,r)),c="",a=r+1}for(e+="",a=r=0;r<n;++r)if(i=e[r],i==="\\")c+=e.substring(a,r++),a=r;else if(i===o)f(),o=null,u=-1;else{if(o)continue;a===u&&i==='"'||a===u&&i==="'"?(a=r+1,o=i):i!=="."||u?i==="["?(r>a&&f(),u=a=r+1):i==="]"&&(u||F("Access path missing open bracket: "+e),u>0&&f(),u=0,a=r+1):r>a?f():a=r+1}return u&&F("Access path missing closing bracket: "+e),o&&F("Access path missing closing quote: "+e),r>a&&(r++,f()),t}function W(e,t,n){let a=j(e);return e=a.length===1?a[0]:e,b((n&&n.get||R)(a),[e],t||e)}let V=W("id"),ee=b((e=>e),[],"identity"),ne=b((()=>0),[],"zero"),he=b((()=>1),[],"one"),Z=b((()=>!0),[],"true"),ae=b((()=>!1),[],"false");function oe(e,t,n){let a=[t].concat([].slice.call(n));console[e].apply(console,a)}let ce=0,de=1,_e=2,Ce=3,Me=4;function Ge(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oe,a=e||ce;return{level(r){return arguments.length?(a=+r,this):a},error(){return a>=de&&n(t||"error","ERROR",arguments),this},warn(){return a>=_e&&n(t||"warn","WARN",arguments),this},info(){return a>=Ce&&n(t||"log","INFO",arguments),this},debug(){return a>=Me&&n(t||"log","DEBUG",arguments),this}}}var Ee=Array.isArray;function ye(e){return e===Object(e)}let be=e=>e!=="__proto__";function Te(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(((a,r)=>{for(let i in r)if(i==="signals")a.signals=Ye(a.signals,r.signals);else{let o=i==="legend"?{layout:1}:i==="style"||null;ke(a,i,r[i],o)}return a}),{})}function ke(e,t,n,a){if(!be(t))return;let r,i;if(ye(n)&&!Ee(n))for(r in i=ye(e[t])?e[t]:e[t]={},n)a&&(a===!0||a[r])?ke(i,r,n[r]):be(r)&&(i[r]=n[r]);else e[t]=n}function Ye(e,t){if(e==null)return t;let n={},a=[];function r(i){n[i.name]||(n[i.name]=1,a.push(i))}return t.forEach(r),e.forEach(r),a}function $e(e){return e[e.length-1]}function Le(e){return e==null||e===""?null:+e}let dt=e=>t=>e*Math.exp(t),yt=e=>t=>Math.log(e*t),xt=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),rn=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,hn=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function jt(e,t,n,a){let r=n(e[0]),i=n($e(e)),o=(i-r)*t;return[a(r-o),a(i-o)]}function St(e,t){return jt(e,t,Le,ee)}function Tt(e,t){var n=Math.sign(e[0]);return jt(e,t,yt(n),dt(n))}function Xt(e,t,n){return jt(e,t,hn(n),hn(1/n))}function Ke(e,t,n){return jt(e,t,xt(n),rn(n))}function et(e,t,n,a,r){let i=a(e[0]),o=a($e(e)),u=t!=null?a(t):(i+o)/2;return[r(u+(i-u)*n),r(u+(o-u)*n)]}function Zt(e,t,n){return et(e,t,n,Le,ee)}function Et(e,t,n){let a=Math.sign(e[0]);return et(e,t,n,yt(a),dt(a))}function Jt(e,t,n,a){return et(e,t,n,hn(a),hn(1/a))}function Lt(e,t,n,a){return et(e,t,n,xt(a),rn(a))}function Ct(e){return 1+~~(new Date(e).getMonth()/3)}function ht(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Ie(e){return e!=null?Ee(e)?e:[e]:[]}function Xe(e,t,n){let a,r=e[0],i=e[1];return i<r&&(a=i,i=r,r=a),a=i-r,a>=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-a),r+a]}function tt(e){return typeof e=="function"}let Kr="descending";function Fl(e,t,n){n=n||{},t=Ie(t)||[];let a=[],r=[],i={},o=n.comparator||Bn;return Ie(e).forEach(((u,c)=>{u!=null&&(a.push(t[c]===Kr?-1:1),r.push(u=tt(u)?u:W(u,null,n)),(T(u)||[]).forEach((f=>i[f]=1)))})),r.length===0?null:b(o(r,a),Object.keys(i))}let Qt=(e,t)=>(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0),Bn=(e,t)=>e.length===1?Xr(e[0],t[0]):ki(e,t,e.length),Xr=(e,t)=>function(n,a){return Qt(e(n),e(a))*t},ki=(e,t,n)=>(t.push(0),function(a,r){let i,o=0,u=-1;for(;o===0&&++u<n;)i=e[u],o=Qt(i(a),i(r));return o*t[u]});function mn(e){return tt(e)?e:()=>e}function Zo(e,t){let n;return a=>{n&&clearTimeout(n),n=setTimeout((()=>(t(a),n=null)),e)}}function mt(e){for(let t,n,a=1,r=arguments.length;a<r;++a)for(n in t=arguments[a],t)e[n]=t[n];return e}function Un(e,t){let n,a,r,i,o=0;if(e&&(n=e.length))if(t==null){for(a=e[o];o<n&&(a==null||a!=a);a=e[++o]);for(r=i=a;o<n;++o)a=e[o],a!=null&&(a<r&&(r=a),a>i&&(i=a))}else{for(a=t(e[o]);o<n&&(a==null||a!=a);a=t(e[++o]));for(r=i=a;o<n;++o)a=t(e[o]),a!=null&&(a<r&&(r=a),a>i&&(i=a))}return[r,i]}function ar(e,t){let n=e.length,a,r,i,o,u,c=-1;if(t==null){for(;++c<n;)if(r=e[c],r!=null&&r>=r){a=i=r;break}if(c===n)return[-1,-1];for(o=u=c;++c<n;)r=e[c],r!=null&&(a>r&&(a=r,o=c),i<r&&(i=r,u=c))}else{for(;++c<n;)if(r=t(e[c],c,e),r!=null&&r>=r){a=i=r;break}if(c===n)return[-1,-1];for(o=u=c;++c<n;)r=t(e[c],c,e),r!=null&&(a>r&&(a=r,o=c),i<r&&(i=r,u=c))}return[o,u]}let co=Object.prototype.hasOwnProperty;function nt(e,t){return co.call(e,t)}let $a={};function da(e){let t,n={};function a(i){return nt(n,i)&&n[i]!==$a}let r={size:0,empty:0,object:n,has:a,get:i=>a(i)?n[i]:void 0,set(i,o){return a(i)||(++r.size,n[i]===$a&&--r.empty),n[i]=o,this},delete(i){return a(i)&&(--r.size,++r.empty,n[i]=$a),this},clear(){r.size=r.empty=0,r.object=n={}},test(i){return arguments.length?(t=i,r):t},clean(){let i={},o=0;for(let u in n){let c=n[u];c===$a||t&&t(c)||(i[u]=c,++o)}r.size=o,r.empty=0,r.object=n=i}};return e&&Object.keys(e).forEach((i=>{r.set(i,e[i])})),r}function rr(e,t,n,a,r,i){if(!n&&n!==0)return i;let o=+n,u,c=e[0],f=$e(e);f<c&&(u=c,c=f,f=u),u=Math.abs(t-c);let m=Math.abs(f-t);return u<m&&u<=o?a:m<=o?r:i}function Fe(e,t,n){let a=e.prototype=Object.create(t.prototype);return Object.defineProperty(a,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),mt(a,n)}function Sa(e,t,n,a){let r,i=t[0],o=t[t.length-1];return i>o&&(r=i,i=o,o=r),a=a===void 0||a,((n=n===void 0||n)?i<=e:i<e)&&(a?e<=o:e<o)}function Zr(e){return typeof e=="boolean"}function Sn(e){return Object.prototype.toString.call(e)==="[object Date]"}function Si(e){return e&&tt(e[Symbol.iterator])}function Ba(e){return typeof e=="number"}function xi(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Ft(e){return typeof e=="string"}function Ai(e,t,n){e&&(e=t?Ie(e).map((u=>u.replace(/\\(.)/g,"$1"))):Ie(e));let a=e&&e.length,r=n&&n.get||R,i=u=>r(t?[u]:j(u)),o;if(a)if(a===1){let u=i(e[0]);o=function(c){return""+u(c)}}else{let u=e.map(i);o=function(c){let f=""+u[0](c),m=0;for(;++m<a;)f+="|"+u[m](c);return f}}else o=function(){return""};return b(o,e,"key")}function fo(e,t){let n=e[0],a=$e(e),r=+t;return r?r===1?a:n+r*(a-n):n}let Jo=1e4;function Pl(e){let t,n,a;e=+e||Jo;let r=()=>{t={},n={},a=0},i=(o,u)=>(++a>e&&(n=t,t={},a=1),t[o]=u);return r(),{clear:r,has:o=>nt(t,o)||nt(n,o),get:o=>nt(t,o)?t[o]:nt(n,o)?i(o,n[o]):void 0,set:(o,u)=>nt(t,o)?t[o]=u:i(o,u)}}function Bs(e,t,n,a){let r=t.length,i=n.length;if(!i)return t;if(!r)return n;let o=a||new t.constructor(r+i),u=0,c=0,f=0;for(;u<r&&c<i;++f)o[f]=e(t[u],n[c])>0?n[c++]:t[u++];for(;u<r;++u,++f)o[f]=t[u];for(;c<i;++c,++f)o[f]=n[c];return o}function po(e,t){let n="";for(;--t>=0;)n+=e;return n}function Ku(e,t,n,a){let r=n||" ",i=e+"",o=t-i.length;return o<=0?i:a==="left"?po(r,o)+i:a==="center"?po(r,~~(o/2))+i+po(r,Math.ceil(o/2)):i+po(r,o)}function Jr(e){return e&&$e(e)-e[0]||0}function st(e){return Ee(e)?"["+e.map(st)+"]":ye(e)||Ft(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function $l(e){return e==null||e===""?null:!(!e||e==="false"||e==="0")&&!!e}let Md=e=>Ba(e)||Sn(e)?e:Date.parse(e);function Ld(e,t){return t=t||Md,e==null||e===""?null:t(e)}function Fd(e){return e==null||e===""?null:e+""}function ir(e){let t={},n=e.length;for(let a=0;a<n;++a)t[e[a]]=!0;return t}function gh(e,t,n,a){let r=a??"\u2026",i=e+"",o=i.length,u=Math.max(0,t-r.length);return o<=t?i:n==="left"?r+i.slice(o-u):n==="center"?i.slice(0,Math.ceil(u/2))+r+i.slice(o-~~(u/2)):i.slice(0,u)+r}function Qo(e,t,n){if(e)if(t){let a=e.length;for(let r=0;r<a;++r){let i=t(e[r]);i&&n(i,r,e)}}else e.forEach(n)}var m0={},Xu={},es=34,Bl=10,Ua=13;function Pd(e){return new Function("d","return {"+e.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function g0(e){var t=Object.create(null),n=[];return e.forEach((function(a){for(var r in a)r in t||n.push(t[r]=r)})),n}function or(e,t){var n=e+"",a=n.length;return a<t?new Array(t-a+1).join(0)+n:n}function $A(e){var t,n=e.getUTCHours(),a=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+or(-t,6):t>9999?"+"+or(t,6):or(t,4))+"-"+or(e.getUTCMonth()+1,2)+"-"+or(e.getUTCDate(),2)+(i?"T"+or(n,2)+":"+or(a,2)+":"+or(r,2)+"."+or(i,3)+"Z":r?"T"+or(n,2)+":"+or(a,2)+":"+or(r,2)+"Z":a||n?"T"+or(n,2)+":"+or(a,2)+"Z":"")}function BA(e){var t=new RegExp('["'+e+`
1
+ var Y3=Object.create;var Lw=Object.defineProperty;var K3=Object.getOwnPropertyDescriptor;var X3=Object.getOwnPropertyNames;var Z3=Object.getPrototypeOf,J3=Object.prototype.hasOwnProperty;var rA=(p,b)=>()=>(b||p((b={exports:{}}).exports,b),b.exports),Q3=(p,b)=>{for(var S in b)Lw(p,S,{get:b[S],enumerable:!0})},kD=(p,b,S,T)=>{if(b&&typeof b=="object"||typeof b=="function")for(let R of X3(b))!J3.call(p,R)&&R!==S&&Lw(p,R,{get:()=>b[R],enumerable:!(T=K3(b,R))||T.enumerable});return p};var Ve=(p,b,S)=>(S=p!=null?Y3(Z3(p)):{},kD(b||!p||!p.__esModule?Lw(S,"default",{value:p,enumerable:!0}):S,p)),ez=p=>kD(Lw({},"__esModule",{value:!0}),p);var wA=rA((Ww,gM)=>{(function(p,b){typeof Ww=="object"&&typeof gM<"u"?b(Ww):typeof define=="function"&&define.amd?define(["exports"],b):b((p=typeof globalThis<"u"?globalThis:p||self).vega={})})(Ww,(function(p){"use strict";function b(e,t,n){return e.fields=t||[],e.fname=n,e}function S(e){return e==null?null:e.fname}function T(e){return e==null?null:e.fields}function R(e){return e.length===1?$(e[0]):P(e)}let $=e=>function(t){return t[e]},P=e=>{let t=e.length;return function(n){for(let a=0;a<t;++a)n=n[e[a]];return n}};function F(e){throw Error(e)}function j(e){let t=[],n=e.length,a,r,i,o=null,u=0,c="";function f(){t.push(c+e.substring(a,r)),c="",a=r+1}for(e+="",a=r=0;r<n;++r)if(i=e[r],i==="\\")c+=e.substring(a,r++),a=r;else if(i===o)f(),o=null,u=-1;else{if(o)continue;a===u&&i==='"'||a===u&&i==="'"?(a=r+1,o=i):i!=="."||u?i==="["?(r>a&&f(),u=a=r+1):i==="]"&&(u||F("Access path missing open bracket: "+e),u>0&&f(),u=0,a=r+1):r>a?f():a=r+1}return u&&F("Access path missing closing bracket: "+e),o&&F("Access path missing closing quote: "+e),r>a&&(r++,f()),t}function W(e,t,n){let a=j(e);return e=a.length===1?a[0]:e,b((n&&n.get||R)(a),[e],t||e)}let V=W("id"),ee=b((e=>e),[],"identity"),ne=b((()=>0),[],"zero"),he=b((()=>1),[],"one"),Z=b((()=>!0),[],"true"),ae=b((()=>!1),[],"false");function oe(e,t,n){let a=[t].concat([].slice.call(n));console[e].apply(console,a)}let ce=0,de=1,_e=2,Ce=3,Me=4;function Ge(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:oe,a=e||ce;return{level(r){return arguments.length?(a=+r,this):a},error(){return a>=de&&n(t||"error","ERROR",arguments),this},warn(){return a>=_e&&n(t||"warn","WARN",arguments),this},info(){return a>=Ce&&n(t||"log","INFO",arguments),this},debug(){return a>=Me&&n(t||"log","DEBUG",arguments),this}}}var Ee=Array.isArray;function ye(e){return e===Object(e)}let be=e=>e!=="__proto__";function Te(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(((a,r)=>{for(let i in r)if(i==="signals")a.signals=Ye(a.signals,r.signals);else{let o=i==="legend"?{layout:1}:i==="style"||null;ke(a,i,r[i],o)}return a}),{})}function ke(e,t,n,a){if(!be(t))return;let r,i;if(ye(n)&&!Ee(n))for(r in i=ye(e[t])?e[t]:e[t]={},n)a&&(a===!0||a[r])?ke(i,r,n[r]):be(r)&&(i[r]=n[r]);else e[t]=n}function Ye(e,t){if(e==null)return t;let n={},a=[];function r(i){n[i.name]||(n[i.name]=1,a.push(i))}return t.forEach(r),e.forEach(r),a}function $e(e){return e[e.length-1]}function Le(e){return e==null||e===""?null:+e}let dt=e=>t=>e*Math.exp(t),yt=e=>t=>Math.log(e*t),xt=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),rn=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,hn=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function jt(e,t,n,a){let r=n(e[0]),i=n($e(e)),o=(i-r)*t;return[a(r-o),a(i-o)]}function St(e,t){return jt(e,t,Le,ee)}function Tt(e,t){var n=Math.sign(e[0]);return jt(e,t,yt(n),dt(n))}function Xt(e,t,n){return jt(e,t,hn(n),hn(1/n))}function Ke(e,t,n){return jt(e,t,xt(n),rn(n))}function et(e,t,n,a,r){let i=a(e[0]),o=a($e(e)),u=t!=null?a(t):(i+o)/2;return[r(u+(i-u)*n),r(u+(o-u)*n)]}function Zt(e,t,n){return et(e,t,n,Le,ee)}function wt(e,t,n){let a=Math.sign(e[0]);return et(e,t,n,yt(a),dt(a))}function Jt(e,t,n,a){return et(e,t,n,hn(a),hn(1/a))}function Lt(e,t,n,a){return et(e,t,n,xt(a),rn(a))}function Ct(e){return 1+~~(new Date(e).getMonth()/3)}function ht(e){return 1+~~(new Date(e).getUTCMonth()/3)}function Ie(e){return e!=null?Ee(e)?e:[e]:[]}function Xe(e,t,n){let a,r=e[0],i=e[1];return i<r&&(a=i,i=r,r=a),a=i-r,a>=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-a),r+a]}function tt(e){return typeof e=="function"}let Kr="descending";function Fl(e,t,n){n=n||{},t=Ie(t)||[];let a=[],r=[],i={},o=n.comparator||Bn;return Ie(e).forEach(((u,c)=>{u!=null&&(a.push(t[c]===Kr?-1:1),r.push(u=tt(u)?u:W(u,null,n)),(T(u)||[]).forEach((f=>i[f]=1)))})),r.length===0?null:b(o(r,a),Object.keys(i))}let Qt=(e,t)=>(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0),Bn=(e,t)=>e.length===1?Xr(e[0],t[0]):ki(e,t,e.length),Xr=(e,t)=>function(n,a){return Qt(e(n),e(a))*t},ki=(e,t,n)=>(t.push(0),function(a,r){let i,o=0,u=-1;for(;o===0&&++u<n;)i=e[u],o=Qt(i(a),i(r));return o*t[u]});function mn(e){return tt(e)?e:()=>e}function Zo(e,t){let n;return a=>{n&&clearTimeout(n),n=setTimeout((()=>(t(a),n=null)),e)}}function mt(e){for(let t,n,a=1,r=arguments.length;a<r;++a)for(n in t=arguments[a],t)e[n]=t[n];return e}function Un(e,t){let n,a,r,i,o=0;if(e&&(n=e.length))if(t==null){for(a=e[o];o<n&&(a==null||a!=a);a=e[++o]);for(r=i=a;o<n;++o)a=e[o],a!=null&&(a<r&&(r=a),a>i&&(i=a))}else{for(a=t(e[o]);o<n&&(a==null||a!=a);a=t(e[++o]));for(r=i=a;o<n;++o)a=t(e[o]),a!=null&&(a<r&&(r=a),a>i&&(i=a))}return[r,i]}function ar(e,t){let n=e.length,a,r,i,o,u,c=-1;if(t==null){for(;++c<n;)if(r=e[c],r!=null&&r>=r){a=i=r;break}if(c===n)return[-1,-1];for(o=u=c;++c<n;)r=e[c],r!=null&&(a>r&&(a=r,o=c),i<r&&(i=r,u=c))}else{for(;++c<n;)if(r=t(e[c],c,e),r!=null&&r>=r){a=i=r;break}if(c===n)return[-1,-1];for(o=u=c;++c<n;)r=t(e[c],c,e),r!=null&&(a>r&&(a=r,o=c),i<r&&(i=r,u=c))}return[o,u]}let co=Object.prototype.hasOwnProperty;function nt(e,t){return co.call(e,t)}let $a={};function da(e){let t,n={};function a(i){return nt(n,i)&&n[i]!==$a}let r={size:0,empty:0,object:n,has:a,get:i=>a(i)?n[i]:void 0,set(i,o){return a(i)||(++r.size,n[i]===$a&&--r.empty),n[i]=o,this},delete(i){return a(i)&&(--r.size,++r.empty,n[i]=$a),this},clear(){r.size=r.empty=0,r.object=n={}},test(i){return arguments.length?(t=i,r):t},clean(){let i={},o=0;for(let u in n){let c=n[u];c===$a||t&&t(c)||(i[u]=c,++o)}r.size=o,r.empty=0,r.object=n=i}};return e&&Object.keys(e).forEach((i=>{r.set(i,e[i])})),r}function rr(e,t,n,a,r,i){if(!n&&n!==0)return i;let o=+n,u,c=e[0],f=$e(e);f<c&&(u=c,c=f,f=u),u=Math.abs(t-c);let m=Math.abs(f-t);return u<m&&u<=o?a:m<=o?r:i}function Fe(e,t,n){let a=e.prototype=Object.create(t.prototype);return Object.defineProperty(a,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),mt(a,n)}function Sa(e,t,n,a){let r,i=t[0],o=t[t.length-1];return i>o&&(r=i,i=o,o=r),a=a===void 0||a,((n=n===void 0||n)?i<=e:i<e)&&(a?e<=o:e<o)}function Zr(e){return typeof e=="boolean"}function Sn(e){return Object.prototype.toString.call(e)==="[object Date]"}function Si(e){return e&&tt(e[Symbol.iterator])}function Ba(e){return typeof e=="number"}function xi(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Ft(e){return typeof e=="string"}function Ai(e,t,n){e&&(e=t?Ie(e).map((u=>u.replace(/\\(.)/g,"$1"))):Ie(e));let a=e&&e.length,r=n&&n.get||R,i=u=>r(t?[u]:j(u)),o;if(a)if(a===1){let u=i(e[0]);o=function(c){return""+u(c)}}else{let u=e.map(i);o=function(c){let f=""+u[0](c),m=0;for(;++m<a;)f+="|"+u[m](c);return f}}else o=function(){return""};return b(o,e,"key")}function fo(e,t){let n=e[0],a=$e(e),r=+t;return r?r===1?a:n+r*(a-n):n}let Jo=1e4;function Pl(e){let t,n,a;e=+e||Jo;let r=()=>{t={},n={},a=0},i=(o,u)=>(++a>e&&(n=t,t={},a=1),t[o]=u);return r(),{clear:r,has:o=>nt(t,o)||nt(n,o),get:o=>nt(t,o)?t[o]:nt(n,o)?i(o,n[o]):void 0,set:(o,u)=>nt(t,o)?t[o]=u:i(o,u)}}function Bs(e,t,n,a){let r=t.length,i=n.length;if(!i)return t;if(!r)return n;let o=a||new t.constructor(r+i),u=0,c=0,f=0;for(;u<r&&c<i;++f)o[f]=e(t[u],n[c])>0?n[c++]:t[u++];for(;u<r;++u,++f)o[f]=t[u];for(;c<i;++c,++f)o[f]=n[c];return o}function po(e,t){let n="";for(;--t>=0;)n+=e;return n}function Ku(e,t,n,a){let r=n||" ",i=e+"",o=t-i.length;return o<=0?i:a==="left"?po(r,o)+i:a==="center"?po(r,~~(o/2))+i+po(r,Math.ceil(o/2)):i+po(r,o)}function Jr(e){return e&&$e(e)-e[0]||0}function st(e){return Ee(e)?"["+e.map(st)+"]":ye(e)||Ft(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function $l(e){return e==null||e===""?null:!(!e||e==="false"||e==="0")&&!!e}let Md=e=>Ba(e)||Sn(e)?e:Date.parse(e);function Ld(e,t){return t=t||Md,e==null||e===""?null:t(e)}function Fd(e){return e==null||e===""?null:e+""}function ir(e){let t={},n=e.length;for(let a=0;a<n;++a)t[e[a]]=!0;return t}function gh(e,t,n,a){let r=a??"\u2026",i=e+"",o=i.length,u=Math.max(0,t-r.length);return o<=t?i:n==="left"?r+i.slice(o-u):n==="center"?i.slice(0,Math.ceil(u/2))+r+i.slice(o-~~(u/2)):i.slice(0,u)+r}function Qo(e,t,n){if(e)if(t){let a=e.length;for(let r=0;r<a;++r){let i=t(e[r]);i&&n(i,r,e)}}else e.forEach(n)}var m0={},Xu={},es=34,Bl=10,Ua=13;function Pd(e){return new Function("d","return {"+e.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function g0(e){var t=Object.create(null),n=[];return e.forEach((function(a){for(var r in a)r in t||n.push(t[r]=r)})),n}function or(e,t){var n=e+"",a=n.length;return a<t?new Array(t-a+1).join(0)+n:n}function $A(e){var t,n=e.getUTCHours(),a=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+or(-t,6):t>9999?"+"+or(t,6):or(t,4))+"-"+or(e.getUTCMonth()+1,2)+"-"+or(e.getUTCDate(),2)+(i?"T"+or(n,2)+":"+or(a,2)+":"+or(r,2)+"."+or(i,3)+"Z":r?"T"+or(n,2)+":"+or(a,2)+":"+or(r,2)+"Z":a||n?"T"+or(n,2)+":"+or(a,2)+"Z":"")}function BA(e){var t=new RegExp('["'+e+`
2
2
  \r]`),n=e.charCodeAt(0);function a(u,c){var f,m=[],g=u.length,v=0,E=0,k=g<=0,_=!1;function N(){if(k)return Xu;if(_)return _=!1,m0;var I,B,M=v;if(u.charCodeAt(M)===es){for(;v++<g&&u.charCodeAt(v)!==es||u.charCodeAt(++v)===es;);return(I=v)>=g?k=!0:(B=u.charCodeAt(v++))===Bl?_=!0:B===Ua&&(_=!0,u.charCodeAt(v)===Bl&&++v),u.slice(M+1,I-1).replace(/""/g,'"')}for(;v<g;){if((B=u.charCodeAt(I=v++))===Bl)_=!0;else if(B===Ua)_=!0,u.charCodeAt(v)===Bl&&++v;else if(B!==n)continue;return u.slice(M,I)}return k=!0,u.slice(M,g)}for(u.charCodeAt(g-1)===Bl&&--g,u.charCodeAt(g-1)===Ua&&--g;(f=N())!==Xu;){for(var O=[];f!==m0&&f!==Xu;)O.push(f),f=N();c&&(O=c(O,E++))==null||m.push(O)}return m}function r(u,c){return u.map((function(f){return c.map((function(m){return o(f[m])})).join(e)}))}function i(u){return u.map(o).join(e)}function o(u){return u==null?"":u instanceof Date?$A(u):t.test(u+="")?'"'+u.replace(/"/g,'""')+'"':u}return{parse:function(u,c){var f,m,g=a(u,(function(v,E){if(f)return f(v,E-1);m=v,f=c?(function(k,_){var N=Pd(k);return function(O,I){return _(N(O),I,k)}})(v,c):Pd(v)}));return g.columns=m||[],g},parseRows:a,format:function(u,c){return c==null&&(c=g0(u)),[c.map(o).join(e)].concat(r(u,c)).join(`
3
3
  `)},formatBody:function(u,c){return c==null&&(c=g0(u)),r(u,c).join(`
4
4
  `)},formatRows:function(u){return u.map(i).join(`
5
5
  `)},formatRow:i,formatValue:o}}function h_(e){return e}function UA(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map((function(n){return m_(e,n)}))}:m_(e,t)}function m_(e,t){var n=t.id,a=t.bbox,r=t.properties==null?{}:t.properties,i=g_(e,t);return n==null&&a==null?{type:"Feature",properties:r,geometry:i}:a==null?{type:"Feature",id:n,properties:r,geometry:i}:{type:"Feature",id:n,bbox:a,properties:r,geometry:i}}function g_(e,t){var n=(function(f){if(f==null)return h_;var m,g,v=f.scale[0],E=f.scale[1],k=f.translate[0],_=f.translate[1];return function(N,O){O||(m=g=0);var I=2,B=N.length,M=new Array(B);for(M[0]=(m+=N[0])*v+k,M[1]=(g+=N[1])*E+_;I<B;)M[I]=N[I],++I;return M}})(e.transform),a=e.arcs;function r(f,m){m.length&&m.pop();for(var g=a[f<0?~f:f],v=0,E=g.length;v<E;++v)m.push(n(g[v],v));f<0&&(function(k,_){for(var N,O=k.length,I=O-_;I<--O;)N=k[I],k[I++]=k[O],k[O]=N})(m,E)}function i(f){return n(f)}function o(f){for(var m=[],g=0,v=f.length;g<v;++g)r(f[g],m);return m.length<2&&m.push(m[0]),m}function u(f){for(var m=o(f);m.length<4;)m.push(m[0]);return m}function c(f){return f.map(u)}return(function f(m){var g,v=m.type;switch(v){case"GeometryCollection":return{type:v,geometries:m.geometries.map(f)};case"Point":g=i(m.coordinates);break;case"MultiPoint":g=m.coordinates.map(i);break;case"LineString":g=o(m.arcs);break;case"MultiLineString":g=m.arcs.map(o);break;case"Polygon":g=c(m.arcs);break;case"MultiPolygon":g=m.arcs.map(c);break;default:return null}return{type:v,coordinates:g}})(t)}function b_(e,t){var n={},a={},r={},i=[],o=-1;function u(c,f){for(var m in c){var g=c[m];delete f[g.start],delete g.start,delete g.end,g.forEach((function(v){n[v<0?~v:v]=1})),i.push(g)}}return t.forEach((function(c,f){var m,g=e.arcs[c<0?~c:c];g.length<3&&!g[1][0]&&!g[1][1]&&(m=t[++o],t[o]=c,t[f]=m)})),t.forEach((function(c){var f,m,g=(function(N){var O,I=e.arcs[N<0?~N:N],B=I[0];return e.transform?(O=[0,0],I.forEach((function(M){O[0]+=M[0],O[1]+=M[1]}))):O=I[I.length-1],N<0?[O,B]:[B,O]})(c),v=g[0],E=g[1];if(f=r[v])if(delete r[f.end],f.push(c),f.end=E,m=a[E]){delete a[m.start];var k=m===f?f:f.concat(m);a[k.start=f.start]=r[k.end=m.end]=k}else a[f.start]=r[f.end]=f;else if(f=a[E])if(delete a[f.start],f.unshift(c),f.start=v,m=r[v]){delete r[m.end];var _=m===f?f:m.concat(f);a[_.start=m.start]=r[_.end=f.end]=_}else a[f.start]=r[f.end]=f;else a[(f=[c]).start=v]=r[f.end=E]=f})),u(r,a),u(a,r),t.forEach((function(c){n[c<0?~c:c]||i.push([c])})),i}function b0(e){return g_(e,y_.apply(this,arguments))}function y_(e,t,n){var a,r,i;if(arguments.length>1)a=(function(o,u,c){var f,m=[],g=[];function v(O){var I=O<0?~O:O;(g[I]||(g[I]=[])).push({i:O,g:f})}function E(O){O.forEach(v)}function k(O){O.forEach(E)}function _(O){O.forEach(k)}function N(O){switch(f=O,O.type){case"GeometryCollection":O.geometries.forEach(N);break;case"LineString":E(O.arcs);break;case"MultiLineString":case"Polygon":k(O.arcs);break;case"MultiPolygon":_(O.arcs)}}return N(u),g.forEach(c==null?function(O){m.push(O[0].i)}:function(O){c(O[0].g,O[O.length-1].g)&&m.push(O[0].i)}),m})(0,t,n);else for(r=0,a=new Array(i=e.arcs.length);r<i;++r)a[r]=r;return{type:"MultiLineString",arcs:b_(e,a)}}function Ti(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Us(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function sr(e){let t,n,a;function r(i,o){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:i.length;if(u<c){if(t(o,o)!==0)return c;do{let f=u+c>>>1;n(i[f],o)<0?u=f+1:c=f}while(u<c)}return u}return e.length!==2?(t=Ti,n=(i,o)=>Ti(e(i),o),a=(i,o)=>e(i)-o):(t=e===Ti||e===Us?e:Ci,n=e,a=e),{left:r,center:function(i,o){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,c=r(i,o,u,(arguments.length>3&&arguments[3]!==void 0?arguments[3]:i.length)-1);return c>u&&a(i[c-1],o)>-a(i[c],o)?c-1:c},right:function(i,o){let u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:i.length;if(u<c){if(t(o,o)!==0)return c;do{let f=u+c>>>1;n(i[f],o)<=0?u=f+1:c=f}while(u<c)}return u}}}function Ci(){return 0}function xa(e){return e===null?NaN:+e}let bh=sr(Ti),Ul=bh.right,v_=bh.left;sr(xa).center;var Zu=Ul;class za{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,a=0;for(let r=0;r<this._n&&r<32;r++){let i=n[r],o=t+i,u=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);u&&(n[a++]=u),t=o}return n[a]=t,this._n=a+1,this}valueOf(){let t=this._partials,n,a,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,a=t[--i],o=n+a,r=a-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(a=2*r,n=o+a,a==n-o&&(o=n))}return o}}class E_ extends Map{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k_;if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[a,r]of t)this.set(a,r)}get(t){return super.get(y0(this,t))}has(t){return super.has(y0(this,t))}set(t,n){return super.set(w_(this,t),n)}delete(t){return super.delete(__(this,t))}}class yh extends Set{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k_;if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let a of t)this.add(a)}has(t){return super.has(y0(this,t))}add(t){return super.add(w_(this,t))}delete(t){return super.delete(__(this,t))}}function y0(e,t){let{_intern:n,_key:a}=e,r=a(t);return n.has(r)?n.get(r):t}function w_(e,t){let{_intern:n,_key:a}=e,r=a(t);return n.has(r)?n.get(r):(n.set(r,t),t)}function __(e,t){let{_intern:n,_key:a}=e,r=a(t);return n.has(r)&&(t=n.get(r),n.delete(r)),t}function k_(e){return e!==null&&typeof e=="object"?e.valueOf():e}function S_(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}let zA=Math.sqrt(50),GA=Math.sqrt(10),jA=Math.sqrt(2);function vh(e,t,n){let a=(t-e)/Math.max(0,n),r=Math.floor(Math.log10(a)),i=a/Math.pow(10,r),o=i>=zA?10:i>=GA?5:i>=jA?2:1,u,c,f;return r<0?(f=Math.pow(10,-r)/o,u=Math.round(e*f),c=Math.round(t*f),u/f<e&&++u,c/f>t&&--c,f=-f):(f=Math.pow(10,r)*o,u=Math.round(e/f),c=Math.round(t/f),u*f<e&&++u,c*f>t&&--c),c<u&&.5<=n&&n<2?vh(e,t,2*n):[u,c,f]}function v0(e,t,n){if(!((n=+n)>0))return[];if((e=+e)==(t=+t))return[e];let a=t<e,[r,i,o]=a?vh(t,e,n):vh(e,t,n);if(!(i>=r))return[];let u=i-r+1,c=new Array(u);if(a)if(o<0)for(let f=0;f<u;++f)c[f]=(i-f)/-o;else for(let f=0;f<u;++f)c[f]=(i-f)*o;else if(o<0)for(let f=0;f<u;++f)c[f]=(r+f)/-o;else for(let f=0;f<u;++f)c[f]=(r+f)*o;return c}function E0(e,t,n){return vh(e=+e,t=+t,n=+n)[2]}function Ri(e,t,n){n=+n;let a=(t=+t)<(e=+e),r=a?E0(t,e,n):E0(e,t,n);return(a?-1:1)*(r<0?1/-r:r)}function zs(e,t){let n;if(t===void 0)for(let a of e)a!=null&&(n<a||n===void 0&&a>=a)&&(n=a);else{let a=-1;for(let r of e)(r=t(r,++a,e))!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}return n}function Ju(e,t){let n;if(t===void 0)for(let a of e)a!=null&&(n>a||n===void 0&&a>=a)&&(n=a);else{let a=-1;for(let r of e)(r=t(r,++a,e))!=null&&(n>r||n===void 0&&r>=r)&&(n=r)}return n}function Qr(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1/0,r=arguments.length>4?arguments[4]:void 0;if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),a=Math.floor(Math.min(e.length-1,a)),!(n<=t&&t<=a))return e;for(r=r===void 0?S_:(function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ti;if(i===Ti)return S_;if(typeof i!="function")throw new TypeError("compare is not a function");return(o,u)=>{let c=i(o,u);return c||c===0?c:(i(u,u)===0)-(i(o,o)===0)}})(r);a>n;){if(a-n>600){let c=a-n+1,f=t-n+1,m=Math.log(c),g=.5*Math.exp(2*m/3),v=.5*Math.sqrt(m*g*(c-g)/c)*(f-c/2<0?-1:1);Qr(e,t,Math.max(n,Math.floor(t-f*g/c+v)),Math.min(a,Math.floor(t+(c-f)*g/c+v)),r)}let i=e[t],o=n,u=a;for(un(e,n,t),r(e[a],i)>0&&un(e,n,a);o<u;){for(un(e,o,u),++o,--u;r(e[o],i)<0;)++o;for(;r(e[u],i)>0;)--u}r(e[n],i)===0?un(e,n,u):(++u,un(e,u,a)),u<=t&&(n=u+1),t<=u&&(a=u-1)}return e}function un(e,t,n){let a=e[t];e[t]=e[n],e[n]=a}function Qu(e,t,n){if(e=Float64Array.from((function*(u,c){if(c===void 0)for(let f of u)f!=null&&(f=+f)>=f&&(yield f);else{let f=-1;for(let m of u)(m=c(m,++f,u))!=null&&(m=+m)>=m&&(yield m)}})(e,n)),(a=e.length)&&!isNaN(t=+t)){if(t<=0||a<2)return Ju(e);if(t>=1)return zs(e);var a,r=(a-1)*t,i=Math.floor(r),o=zs(Qr(e,i).subarray(0,i+1));return o+(Ju(e.subarray(i+1))-o)*(r-i)}}function w0(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xa;if((a=e.length)&&!isNaN(t=+t)){if(t<=0||a<2)return+n(e[0],0,e);if(t>=1)return+n(e[a-1],a-1,e);var a,r=(a-1)*t,i=Math.floor(r),o=+n(e[i],i,e);return o+(+n(e[i+1],i+1,e)-o)*(r-i)}}function ec(e,t){return Qu(e,.5,t)}function Eh(e){return Array.from((function*(t){for(let n of t)yield*n})(e))}function Qn(e,t,n){e=+e,t=+t,n=(r=arguments.length)<2?(t=e,e=0,1):r<3?1:+n;for(var a=-1,r=0|Math.max(0,Math.ceil((t-e)/n)),i=new Array(r);++a<r;)i[a]=e+a*n;return i}function x_(e,t){let n=0;if(t===void 0)for(let a of e)(a=+a)&&(n+=a);else{let a=-1;for(let r of e)(r=+t(r,++a,e))&&(n+=r)}return n}function HA(e){return e instanceof yh?e:new yh(e)}function wh(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,a=e.slice(0,n);return[a.length>1?a[0]+a.slice(2):a,+e.slice(n+1)]}function tc(e){return(e=wh(Math.abs(e)))?e[1]:NaN}var A_,qA=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zl(e){if(!(t=qA.exec(e)))throw new Error("invalid format: "+e);var t;return new _0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}function _0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}function _h(e,t){var n=wh(e,t);if(!n)return e+"";var a=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+a:a.length>r+1?a.slice(0,r+1)+"."+a.slice(r+1):a+new Array(r-a.length+2).join("0")}zl.prototype=_0.prototype,_0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,0|this.width))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var k0={"%":(e,t)=>(100*e).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:function(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)},e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>_h(100*e,t),r:_h,s:function(e,t){var n=wh(e,t);if(!n)return e+"";var a=n[0],r=n[1],i=r-(A_=3*Math.max(-8,Math.min(8,Math.floor(r/3))))+1,o=a.length;return i===o?a:i>o?a+new Array(i-o+1).join("0"):i>0?a.slice(0,i)+"."+a.slice(i):"0."+new Array(1-i).join("0")+wh(e,Math.max(0,t+i-1))[0]},X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function kh(e){return e}var Gl,Nr,Sh,xh=Array.prototype.map,T_=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function S0(e){var t,n,a=e.grouping===void 0||e.thousands===void 0?kh:(t=xh.call(e.grouping,Number),n=e.thousands+"",function(v,E){for(var k=v.length,_=[],N=0,O=t[0],I=0;k>0&&O>0&&(I+O+1>E&&(O=Math.max(1,E-I)),_.push(v.substring(k-=O,k+O)),!((I+=O+1)>E));)O=t[N=(N+1)%t.length];return _.reverse().join(n)}),r=e.currency===void 0?"":e.currency[0]+"",i=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",u=e.numerals===void 0?kh:(function(v){return function(E){return E.replace(/[0-9]/g,(function(k){return v[+k]}))}})(xh.call(e.numerals,String)),c=e.percent===void 0?"%":e.percent+"",f=e.minus===void 0?"\u2212":e.minus+"",m=e.nan===void 0?"NaN":e.nan+"";function g(v){var E=(v=zl(v)).fill,k=v.align,_=v.sign,N=v.symbol,O=v.zero,I=v.width,B=v.comma,M=v.precision,U=v.trim,z=v.type;z==="n"?(B=!0,z="g"):k0[z]||(M===void 0&&(M=12),U=!0,z="g"),(O||E==="0"&&k==="=")&&(O=!0,E="0",k="=");var q=N==="$"?r:N==="#"&&/[boxX]/.test(z)?"0"+z.toLowerCase():"",Y=N==="$"?i:/[%p]/.test(z)?c:"",K=k0[z],re=/[defgprs%]/.test(z);function Q(ie){var se,ue,fe,ve=q,we=Y;if(z==="c")we=K(ie)+we,ie="";else{var Oe=(ie=+ie)<0||1/ie<0;if(ie=isNaN(ie)?m:K(Math.abs(ie),M),U&&(ie=(function(De){e:for(var ut,ct=De.length,bt=1,Nt=-1;bt<ct;++bt)switch(De[bt]){case".":Nt=ut=bt;break;case"0":Nt===0&&(Nt=bt),ut=bt;break;default:if(!+De[bt])break e;Nt>0&&(Nt=0)}return Nt>0?De.slice(0,Nt)+De.slice(ut+1):De})(ie)),Oe&&+ie==0&&_!=="+"&&(Oe=!1),ve=(Oe?_==="("?_:f:_==="-"||_==="("?"":_)+ve,we=(z==="s"?T_[8+A_/3]:"")+we+(Oe&&_==="("?")":""),re){for(se=-1,ue=ie.length;++se<ue;)if(48>(fe=ie.charCodeAt(se))||fe>57){we=(fe===46?o+ie.slice(se+1):ie.slice(se))+we,ie=ie.slice(0,se);break}}}B&&!O&&(ie=a(ie,1/0));var Ue=ve.length+ie.length+we.length,He=Ue<I?new Array(I-Ue+1).join(E):"";switch(B&&O&&(ie=a(He+ie,He.length?I-we.length:1/0),He=""),k){case"<":ie=ve+ie+we+He;break;case"=":ie=ve+He+ie+we;break;case"^":ie=He.slice(0,Ue=He.length>>1)+ve+ie+we+He.slice(Ue);break;default:ie=He+ve+ie+we}return u(ie)}return M=M===void 0?6:/[gprs]/.test(z)?Math.max(1,Math.min(21,M)):Math.max(0,Math.min(20,M)),Q.toString=function(){return v+""},Q}return{format:g,formatPrefix:function(v,E){var k=g(((v=zl(v)).type="f",v)),_=3*Math.max(-8,Math.min(8,Math.floor(tc(E)/3))),N=Math.pow(10,-_),O=T_[8+_/3];return function(I){return k(N*I)+O}}}}function $d(e){return Math.max(0,-tc(Math.abs(e)))}function x0(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(tc(t)/3)))-tc(Math.abs(e)))}function A0(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,tc(t)-tc(e))+1}(function(e){Gl=S0(e),Nr=Gl.format,Sh=Gl.formatPrefix})({thousands:",",grouping:[3],currency:["$",""]});let ei=new Date,Ni=new Date;function xn(e,t,n,a){function r(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return r.floor=i=>(e(i=new Date(+i)),i),r.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),r.round=i=>{let o=r(i),u=r.ceil(i);return i-o<u-i?o:u},r.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),r.range=(i,o,u)=>{let c=[];if(i=r.ceil(i),u=u==null?1:Math.floor(u),!(i<o&&u>0))return c;let f;do c.push(f=new Date(+i)),t(i,u),e(i);while(f<i&&i<o);return c},r.filter=i=>xn((o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)}),((o,u)=>{if(o>=o)if(u<0)for(;++u<=0;)for(;t(o,-1),!i(o););else for(;--u>=0;)for(;t(o,1),!i(o););})),n&&(r.count=(i,o)=>(ei.setTime(+i),Ni.setTime(+o),e(ei),e(Ni),Math.floor(n(ei,Ni))),r.every=i=>(i=Math.floor(i),isFinite(i)&&i>0?i>1?r.filter(a?o=>a(o)%i==0:o=>r.count(0,o)%i==0):r:null)),r}let jl=xn((()=>{}),((e,t)=>{e.setTime(+e+t)}),((e,t)=>t-e));jl.every=e=>(e=Math.floor(e),isFinite(e)&&e>0?e>1?xn((t=>{t.setTime(Math.floor(t/e)*e)}),((t,n)=>{t.setTime(+t+n*e)}),((t,n)=>(n-t)/e)):jl:null),jl.range;let Ii=1e3,Ir=60*Ii,ho=60*Ir,Oi=24*ho,Vt=7*Oi,zn=30*Oi,mo=365*Oi,Or=xn((e=>{e.setTime(e-e.getMilliseconds())}),((e,t)=>{e.setTime(+e+t*Ii)}),((e,t)=>(t-e)/Ii),(e=>e.getUTCSeconds()));Or.range;let nc=xn((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ii)}),((e,t)=>{e.setTime(+e+t*Ir)}),((e,t)=>(t-e)/Ir),(e=>e.getMinutes()));nc.range;let ts=xn((e=>{e.setUTCSeconds(0,0)}),((e,t)=>{e.setTime(+e+t*Ir)}),((e,t)=>(t-e)/Ir),(e=>e.getUTCMinutes()));ts.range;let ea=xn((e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ii-e.getMinutes()*Ir)}),((e,t)=>{e.setTime(+e+t*ho)}),((e,t)=>(t-e)/ho),(e=>e.getHours()));ea.range;let ac=xn((e=>{e.setUTCMinutes(0,0,0)}),((e,t)=>{e.setTime(+e+t*ho)}),((e,t)=>(t-e)/ho),(e=>e.getUTCHours()));ac.range;let fa=xn((e=>e.setHours(0,0,0,0)),((e,t)=>e.setDate(e.getDate()+t)),((e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ir)/Oi),(e=>e.getDate()-1));fa.range;let Ze=xn((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Oi),(e=>e.getUTCDate()-1));Ze.range;let go=xn((e=>{e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCDate(e.getUTCDate()+t)}),((e,t)=>(t-e)/Oi),(e=>Math.floor(e/Oi)));function Aa(e){return xn((t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ir)/Vt))}go.range;let Hl=Aa(0),Bd=Aa(1),Ah=Aa(2),T0=Aa(3),Gn=Aa(4),C0=Aa(5),on=Aa(6);function ns(e){return xn((t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/Vt))}Hl.range,Bd.range,Ah.range,T0.range,Gn.range,C0.range,on.range;let pa=ns(0),Ud=ns(1),R0=ns(2),Ht=ns(3),Ga=ns(4),zd=ns(5),N0=ns(6);pa.range,Ud.range,R0.range,Ht.range,Ga.range,zd.range,N0.range;let ql=xn((e=>{e.setDate(1),e.setHours(0,0,0,0)}),((e,t)=>{e.setMonth(e.getMonth()+t)}),((e,t)=>t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())),(e=>e.getMonth()));ql.range;let Wl=xn((e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)}),((e,t)=>t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())),(e=>e.getUTCMonth()));Wl.range;let ti=xn((e=>{e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,t)=>{e.setFullYear(e.getFullYear()+t)}),((e,t)=>t.getFullYear()-e.getFullYear()),(e=>e.getFullYear()));ti.every=e=>isFinite(e=Math.floor(e))&&e>0?xn((t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n*e)})):null,ti.range;let ni=xn((e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)}),((e,t)=>t.getUTCFullYear()-e.getUTCFullYear()),(e=>e.getUTCFullYear()));function at(e,t,n,a,r,i){let o=[[Or,1,Ii],[Or,5,5*Ii],[Or,15,15*Ii],[Or,30,30*Ii],[i,1,Ir],[i,5,5*Ir],[i,15,15*Ir],[i,30,30*Ir],[r,1,ho],[r,3,3*ho],[r,6,6*ho],[r,12,12*ho],[a,1,Oi],[a,2,2*Oi],[n,1,Vt],[t,1,zn],[t,3,3*zn],[e,1,mo]];function u(c,f,m){let g=Math.abs(f-c)/m,v=sr((_=>{let[,,N]=_;return N})).right(o,g);if(v===o.length)return e.every(Ri(c/mo,f/mo,m));if(v===0)return jl.every(Math.max(Ri(c,f,m),1));let[E,k]=o[g/o[v-1][2]<o[v][2]/g?v-1:v];return E.every(k)}return[function(c,f,m){let g=f<c;g&&([c,f]=[f,c]);let v=m&&typeof m.range=="function"?m:u(c,f,m),E=v?v.range(c,+f+1):[];return g?E.reverse():E},u]}ni.every=e=>isFinite(e=Math.floor(e))&&e>0?xn((t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null,ni.range;let[I0,O0]=at(ni,Wl,pa,go,ac,ts),[C_,Th]=at(ti,ql,Hl,fa,ea,nc),ta="year",Ta="quarter",na="month",Cn="week",ha="date",aa="day",Di="dayofyear",ja="hours",lr="minutes",ur="seconds",Dr="milliseconds",Gd=[ta,Ta,na,Cn,ha,aa,Di,ja,lr,ur,Dr],Ch=Gd.reduce(((e,t,n)=>(e[t]=1+n,e)),{});function jd(e){let t=Ie(e).slice(),n={};return t.length||F("Missing time unit."),t.forEach((a=>{nt(Ch,a)?n[a]=1:F(`Invalid time unit: ${a}.`)})),(n[Cn]||n[aa]?1:0)+(n[Ta]||n[na]||n[ha]?1:0)+(n[Di]?1:0)>1&&F(`Incompatible time units: ${e}`),t.sort(((a,r)=>Ch[a]-Ch[r])),t}let D0={[ta]:"%Y ",[Ta]:"Q%q ",[na]:"%b ",[ha]:"%d ",[Cn]:"W%U ",[aa]:"%a ",[Di]:"%j ",[ja]:"%H:00",[lr]:"00:%M",[ur]:":%S",[Dr]:".%L",[`${ta}-${na}`]:"%Y-%m ",[`${ta}-${na}-${ha}`]:"%Y-%m-%d ",[`${ja}-${lr}`]:"%H:%M"};function Hd(e,t){let n=mt({},D0,t),a=jd(e),r=a.length,i,o,u="",c=0;for(c=0;c<r;)for(i=a.length;i>c;--i)if(o=a.slice(c,i).join("-"),n[o]!=null){u+=n[o],c=i;break}return u.trim()}let Mi=new Date;function Rh(e){return Mi.setFullYear(e),Mi.setMonth(0),Mi.setDate(1),Mi.setHours(0,0,0,0),Mi}function M0(e){return L0(new Date(e))}function qd(e){return Nh(new Date(e))}function L0(e){return fa.count(Rh(e.getFullYear())-1,e)}function Nh(e){return Hl.count(Rh(e.getFullYear())-1,e)}function Ih(e){return Rh(e).getDay()}function F0(e,t,n,a,r,i,o){if(0<=e&&e<100){let u=new Date(-1,t,n,a,r,i,o);return u.setFullYear(e),u}return new Date(e,t,n,a,r,i,o)}function Oh(e){return rc(new Date(e))}function Dh(e){return Wd(new Date(e))}function rc(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return Ze.count(t-1,e)}function Wd(e){let t=Date.UTC(e.getUTCFullYear(),0,1);return pa.count(t-1,e)}function Vd(e){return Mi.setTime(Date.UTC(e,0,1)),Mi.getUTCDay()}function P0(e,t,n,a,r,i,o){if(0<=e&&e<100){let u=new Date(Date.UTC(-1,t,n,a,r,i,o));return u.setUTCFullYear(n.y),u}return new Date(Date.UTC(e,t,n,a,r,i,o))}function ic(e,t,n,a,r){let i=t||1,o=$e(e),u=(O,I,B)=>(function(M,U,z,q){let Y=z<=1?M:q?(K,re)=>q+z*Math.floor((M(K,re)-q)/z):(K,re)=>z*Math.floor(M(K,re)/z);return U?(K,re)=>U(Y(K,re),re):Y})(n[B=B||O],a[B],O===o&&i,I),c=new Date,f=ir(e),m=f[ta]?u(ta):mn(2012),g=f[na]?u(na):f[Ta]?u(Ta):ne,v=f[Cn]&&f[aa]?u(aa,1,Cn+aa):f[Cn]?u(Cn,1):f[aa]?u(aa,1):f[ha]?u(ha,1):f[Di]?u(Di,1):he,E=f[ja]?u(ja):ne,k=f[lr]?u(lr):ne,_=f[ur]?u(ur):ne,N=f[Dr]?u(Dr):ne;return function(O){c.setTime(+O);let I=m(c);return r(I,g(c),v(c,I),E(c),k(c),_(c),N(c))}}function Be(e,t,n){return t+7*e-(n+6)%7}let Gs={[ta]:e=>e.getFullYear(),[Ta]:e=>Math.floor(e.getMonth()/3),[na]:e=>e.getMonth(),[ha]:e=>e.getDate(),[ja]:e=>e.getHours(),[lr]:e=>e.getMinutes(),[ur]:e=>e.getSeconds(),[Dr]:e=>e.getMilliseconds(),[Di]:e=>L0(e),[Cn]:e=>Nh(e),[Cn+aa]:(e,t)=>Be(Nh(e),e.getDay(),Ih(t)),[aa]:(e,t)=>Be(1,e.getDay(),Ih(t))},$0={[Ta]:e=>3*e,[Cn]:(e,t)=>Be(e,0,Ih(t))};function B0(e,t){return ic(e,t||1,Gs,$0,F0)}let U0={[ta]:e=>e.getUTCFullYear(),[Ta]:e=>Math.floor(e.getUTCMonth()/3),[na]:e=>e.getUTCMonth(),[ha]:e=>e.getUTCDate(),[ja]:e=>e.getUTCHours(),[lr]:e=>e.getUTCMinutes(),[ur]:e=>e.getUTCSeconds(),[Dr]:e=>e.getUTCMilliseconds(),[Di]:e=>rc(e),[Cn]:e=>Wd(e),[aa]:(e,t)=>Be(1,e.getUTCDay(),Vd(t)),[Cn+aa]:(e,t)=>Be(Wd(e),e.getUTCDay(),Vd(t))},R_={[Ta]:e=>3*e,[Cn]:(e,t)=>Be(e,0,Vd(t))};function Yd(e,t){return ic(e,t||1,U0,R_,P0)}let js={[ta]:ti,[Ta]:ql.every(3),[na]:ql,[Cn]:Hl,[ha]:fa,[aa]:fa,[Di]:fa,[ja]:ea,[lr]:nc,[ur]:Or,[Dr]:jl},z0={[ta]:ni,[Ta]:Wl.every(3),[na]:Wl,[Cn]:pa,[ha]:Ze,[aa]:Ze,[Di]:Ze,[ja]:ac,[lr]:ts,[ur]:Or,[Dr]:jl};function as(e){return js[e]}function Mr(e){return z0[e]}function Mh(e,t,n){return e?e.offset(t,n):void 0}function Kd(e,t,n){return Mh(as(e),t,n)}function G0(e,t,n){return Mh(Mr(e),t,n)}function oc(e,t,n,a){return e?e.range(t,n,a):void 0}function Lh(e,t,n,a){return oc(as(e),t,n,a)}function Fh(e,t,n,a){return oc(Mr(e),t,n,a)}let N_=1e3,j0=6e4,jn=36e5,H0=864e5,I_=2592e6,Xd=31536e6,Zd=[ta,na,ha,ja,lr,ur,Dr],Hs=Zd.slice(0,-1),qs=Hs.slice(0,-1),Ws=qs.slice(0,-1),Ph=Ws.slice(0,-1),Jd=[ta,na],Qd=[ta],Vl=[[Hs,1,N_],[Hs,5,5e3],[Hs,15,15e3],[Hs,30,3e4],[qs,1,j0],[qs,5,3e5],[qs,15,9e5],[qs,30,18e5],[Ws,1,jn],[Ws,3,108e5],[Ws,6,216e5],[Ws,12,432e5],[Ph,1,H0],[[ta,Cn],1,6048e5],[Jd,1,I_],[Jd,3,7776e6],[Qd,1,Xd]];function ai(e){let t=e.extent,n=e.maxbins||40,a=Math.abs(Jr(t))/n,r,i,o=sr((u=>u[2])).right(Vl,a);return o===Vl.length?(r=Qd,i=Ri(t[0]/Xd,t[1]/Xd,n)):o?(o=Vl[a/Vl[o-1][2]<Vl[o][2]/a?o-1:o],r=o[0],i=o[1]):(r=Zd,i=Math.max(Ri(t[0],t[1],n),1)),{units:r,step:i}}function ef(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function sc(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function lc(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function q0(e){var t=e.dateTime,n=e.date,a=e.time,r=e.periods,i=e.days,o=e.shortDays,u=e.months,c=e.shortMonths,f=Kl(r),m=Xl(r),g=Kl(i),v=Xl(i),E=Kl(o),k=Xl(o),_=Kl(u),N=Xl(u),O=Kl(c),I=Xl(c),B={a:function(K){return o[K.getDay()]},A:function(K){return i[K.getDay()]},b:function(K){return c[K.getMonth()]},B:function(K){return u[K.getMonth()]},c:null,d:Uh,e:Uh,f:of,g:G_,G:j_,H:af,I:rf,j:B_,L:uc,m:U_,M:sf,p:function(K){return r[+(K.getHours()>=12)]},q:function(K){return 1+~~(K.getMonth()/3)},Q:Yh,s:Kh,S:Z0,u:zh,U:z_,V:Gh,w:J0,W:is,x:null,X:null,y:cc,Y:Li,Z:Q0,"%":cf},M={a:function(K){return o[K.getUTCDay()]},A:function(K){return i[K.getUTCDay()]},b:function(K){return c[K.getUTCMonth()]},B:function(K){return u[K.getUTCMonth()]},c:null,d:jh,e:jh,f:Hh,g:ny,G:ay,H:Ys,I:H_,j:q_,L:ey,m:W_,M:qh,p:function(K){return r[+(K.getUTCHours()>=12)]},q:function(K){return 1+~~(K.getUTCMonth()/3)},Q:Yh,s:Kh,S:Ks,u:uf,U:Wh,V:Xs,w:ty,W:V_,x:null,X:null,y:Vh,Y:ri,Z:ry,"%":cf},U={a:function(K,re,Q){var ie=E.exec(re.slice(Q));return ie?(K.w=k.get(ie[0].toLowerCase()),Q+ie[0].length):-1},A:function(K,re,Q){var ie=g.exec(re.slice(Q));return ie?(K.w=v.get(ie[0].toLowerCase()),Q+ie[0].length):-1},b:function(K,re,Q){var ie=O.exec(re.slice(Q));return ie?(K.m=I.get(ie[0].toLowerCase()),Q+ie[0].length):-1},B:function(K,re,Q){var ie=_.exec(re.slice(Q));return ie?(K.m=N.get(ie[0].toLowerCase()),Q+ie[0].length):-1},c:function(K,re,Q){return Y(K,t,re,Q)},d:L_,e:L_,f:$_,g:Lr,G:Ha,H:F_,I:F_,j:VA,L:P_,m:WA,M:YA,p:function(K,re,Q){var ie=f.exec(re.slice(Q));return ie?(K.p=m.get(ie[0].toLowerCase()),Q+ie[0].length):-1},q:K0,Q:X0,s:Ca,S:KA,u:Y0,U:D_,V:M_,w:V0,W:Hn,x:function(K,re,Q){return Y(K,n,re,Q)},X:function(K,re,Q){return Y(K,a,re,Q)},y:Lr,Y:Ha,Z:Zl,"%":Bh};function z(K,re){return function(Q){var ie,se,ue,fe=[],ve=-1,we=0,Oe=K.length;for(Q instanceof Date||(Q=new Date(+Q));++ve<Oe;)K.charCodeAt(ve)===37&&(fe.push(K.slice(we,ve)),(se=Vs[ie=K.charAt(++ve)])!=null?ie=K.charAt(++ve):se=ie==="e"?" ":"0",(ue=re[ie])&&(ie=ue(Q,se)),fe.push(ie),we=ve+1);return fe.push(K.slice(we,ve)),fe.join("")}}function q(K,re){return function(Q){var ie,se,ue=lc(1900,void 0,1);if(Y(ue,K,Q+="",0)!=Q.length)return null;if("Q"in ue)return new Date(ue.Q);if("s"in ue)return new Date(1e3*ue.s+("L"in ue?ue.L:0));if(re&&!("Z"in ue)&&(ue.Z=0),"p"in ue&&(ue.H=ue.H%12+12*ue.p),ue.m===void 0&&(ue.m="q"in ue?ue.q:0),"V"in ue){if(ue.V<1||ue.V>53)return null;"w"in ue||(ue.w=1),"Z"in ue?(se=(ie=sc(lc(ue.y,0,1))).getUTCDay(),ie=se>4||se===0?Ud.ceil(ie):Ud(ie),ie=Ze.offset(ie,7*(ue.V-1)),ue.y=ie.getUTCFullYear(),ue.m=ie.getUTCMonth(),ue.d=ie.getUTCDate()+(ue.w+6)%7):(se=(ie=ef(lc(ue.y,0,1))).getDay(),ie=se>4||se===0?Bd.ceil(ie):Bd(ie),ie=fa.offset(ie,7*(ue.V-1)),ue.y=ie.getFullYear(),ue.m=ie.getMonth(),ue.d=ie.getDate()+(ue.w+6)%7)}else("W"in ue||"U"in ue)&&("w"in ue||(ue.w="u"in ue?ue.u%7:"W"in ue?1:0),se="Z"in ue?sc(lc(ue.y,0,1)).getUTCDay():ef(lc(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+7*ue.W-(se+5)%7:ue.w+7*ue.U-(se+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,sc(ue)):ef(ue)}}function Y(K,re,Q,ie){for(var se,ue,fe=0,ve=re.length,we=Q.length;fe<ve;){if(ie>=we)return-1;if((se=re.charCodeAt(fe++))===37){if(se=re.charAt(fe++),!(ue=U[se in Vs?re.charAt(fe++):se])||(ie=ue(K,Q,ie))<0)return-1}else if(se!=Q.charCodeAt(ie++))return-1}return ie}return B.x=z(n,B),B.X=z(a,B),B.c=z(t,B),M.x=z(n,M),M.X=z(a,M),M.c=z(t,M),{format:function(K){var re=z(K+="",B);return re.toString=function(){return K},re},parse:function(K){var re=q(K+="",!1);return re.toString=function(){return K},re},utcFormat:function(K){var re=z(K+="",M);return re.toString=function(){return K},re},utcParse:function(K){var re=q(K+="",!0);return re.toString=function(){return K},re}}}var Yl,bo,tf,rs,nf,Vs={"-":"",_:" ",0:"0"},Gt=/^\s*\d+/,$h=/^%/,O_=/[\\^$*+?|[\]().{}]/g;function Pt(e,t,n){var a=e<0?"-":"",r=(a?-e:e)+"",i=r.length;return a+(i<n?new Array(n-i+1).join(t)+r:r)}function W0(e){return e.replace(O_,"\\$&")}function Kl(e){return new RegExp("^(?:"+e.map(W0).join("|")+")","i")}function Xl(e){return new Map(e.map(((t,n)=>[t.toLowerCase(),n])))}function V0(e,t,n){var a=Gt.exec(t.slice(n,n+1));return a?(e.w=+a[0],n+a[0].length):-1}function Y0(e,t,n){var a=Gt.exec(t.slice(n,n+1));return a?(e.u=+a[0],n+a[0].length):-1}function D_(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.U=+a[0],n+a[0].length):-1}function M_(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.V=+a[0],n+a[0].length):-1}function Hn(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.W=+a[0],n+a[0].length):-1}function Ha(e,t,n){var a=Gt.exec(t.slice(n,n+4));return a?(e.y=+a[0],n+a[0].length):-1}function Lr(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.y=+a[0]+(+a[0]>68?1900:2e3),n+a[0].length):-1}function Zl(e,t,n){var a=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return a?(e.Z=a[1]?0:-(a[2]+(a[3]||"00")),n+a[0].length):-1}function K0(e,t,n){var a=Gt.exec(t.slice(n,n+1));return a?(e.q=3*a[0]-3,n+a[0].length):-1}function WA(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.m=a[0]-1,n+a[0].length):-1}function L_(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.d=+a[0],n+a[0].length):-1}function VA(e,t,n){var a=Gt.exec(t.slice(n,n+3));return a?(e.m=0,e.d=+a[0],n+a[0].length):-1}function F_(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.H=+a[0],n+a[0].length):-1}function YA(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.M=+a[0],n+a[0].length):-1}function KA(e,t,n){var a=Gt.exec(t.slice(n,n+2));return a?(e.S=+a[0],n+a[0].length):-1}function P_(e,t,n){var a=Gt.exec(t.slice(n,n+3));return a?(e.L=+a[0],n+a[0].length):-1}function $_(e,t,n){var a=Gt.exec(t.slice(n,n+6));return a?(e.L=Math.floor(a[0]/1e3),n+a[0].length):-1}function Bh(e,t,n){var a=$h.exec(t.slice(n,n+1));return a?n+a[0].length:-1}function X0(e,t,n){var a=Gt.exec(t.slice(n));return a?(e.Q=+a[0],n+a[0].length):-1}function Ca(e,t,n){var a=Gt.exec(t.slice(n));return a?(e.s=+a[0],n+a[0].length):-1}function Uh(e,t){return Pt(e.getDate(),t,2)}function af(e,t){return Pt(e.getHours(),t,2)}function rf(e,t){return Pt(e.getHours()%12||12,t,2)}function B_(e,t){return Pt(1+fa.count(ti(e),e),t,3)}function uc(e,t){return Pt(e.getMilliseconds(),t,3)}function of(e,t){return uc(e,t)+"000"}function U_(e,t){return Pt(e.getMonth()+1,t,2)}function sf(e,t){return Pt(e.getMinutes(),t,2)}function Z0(e,t){return Pt(e.getSeconds(),t,2)}function zh(e){var t=e.getDay();return t===0?7:t}function z_(e,t){return Pt(Hl.count(ti(e)-1,e),t,2)}function lf(e){var t=e.getDay();return t>=4||t===0?Gn(e):Gn.ceil(e)}function Gh(e,t){return e=lf(e),Pt(Gn.count(ti(e),e)+(ti(e).getDay()===4),t,2)}function J0(e){return e.getDay()}function is(e,t){return Pt(Bd.count(ti(e)-1,e),t,2)}function cc(e,t){return Pt(e.getFullYear()%100,t,2)}function G_(e,t){return Pt((e=lf(e)).getFullYear()%100,t,2)}function Li(e,t){return Pt(e.getFullYear()%1e4,t,4)}function j_(e,t){var n=e.getDay();return Pt((e=n>=4||n===0?Gn(e):Gn.ceil(e)).getFullYear()%1e4,t,4)}function Q0(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Pt(t/60|0,"0",2)+Pt(t%60,"0",2)}function jh(e,t){return Pt(e.getUTCDate(),t,2)}function Ys(e,t){return Pt(e.getUTCHours(),t,2)}function H_(e,t){return Pt(e.getUTCHours()%12||12,t,2)}function q_(e,t){return Pt(1+Ze.count(ni(e),e),t,3)}function ey(e,t){return Pt(e.getUTCMilliseconds(),t,3)}function Hh(e,t){return ey(e,t)+"000"}function W_(e,t){return Pt(e.getUTCMonth()+1,t,2)}function qh(e,t){return Pt(e.getUTCMinutes(),t,2)}function Ks(e,t){return Pt(e.getUTCSeconds(),t,2)}function uf(e){var t=e.getUTCDay();return t===0?7:t}function Wh(e,t){return Pt(pa.count(ni(e)-1,e),t,2)}function Jl(e){var t=e.getUTCDay();return t>=4||t===0?Ga(e):Ga.ceil(e)}function Xs(e,t){return e=Jl(e),Pt(Ga.count(ni(e),e)+(ni(e).getUTCDay()===4),t,2)}function ty(e){return e.getUTCDay()}function V_(e,t){return Pt(Ud.count(ni(e)-1,e),t,2)}function Vh(e,t){return Pt(e.getUTCFullYear()%100,t,2)}function ny(e,t){return Pt((e=Jl(e)).getUTCFullYear()%100,t,2)}function ri(e,t){return Pt(e.getUTCFullYear()%1e4,t,4)}function ay(e,t){var n=e.getUTCDay();return Pt((e=n>=4||n===0?Ga(e):Ga.ceil(e)).getUTCFullYear()%1e4,t,4)}function ry(){return"+0000"}function cf(){return"%"}function Yh(e){return+e}function Kh(e){return Math.floor(+e/1e3)}function yo(e){let t={};return n=>t[n]||(t[n]=e(n))}function dc(e){let t=yo(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(a){let r=zl(a||",");if(r.precision==null){switch(r.precision=12,r.type){case"%":r.precision-=2;break;case"e":r.precision-=1}return i=t(r),o=t(".1f")(1)[1],u=>{let c=i(u),f=c.indexOf(o);if(f<0)return c;let m=(function(v,E){let k,_=v.lastIndexOf("e");if(_>0)return _;for(_=v.length;--_>E;)if(k=v.charCodeAt(_),k>=48&&k<=57)return _+1})(c,f),g=m<c.length?c.slice(m):"";for(;--m>f;)if(c[m]!=="0"){++m;break}return c.slice(0,m)+g}}return t(r);var i,o},formatSpan(a,r,i,o){o=zl(o??",f");let u=Ri(a,r,i),c=Math.max(Math.abs(a),Math.abs(r)),f;if(o.precision==null)switch(o.type){case"s":return isNaN(f=x0(u,c))||(o.precision=f),n(o,c);case"":case"e":case"g":case"p":case"r":isNaN(f=A0(u,c))||(o.precision=f-(o.type==="e"));break;case"f":case"%":isNaN(f=$d(u))||(o.precision=f-2*(o.type==="%"))}return t(o)}}}let Xh,df;function Zh(){return Xh=dc({format:Nr,formatPrefix:Sh})}function ii(e){return dc(S0(e))}function fc(e){return arguments.length?Xh=ii(e):Xh}function Ql(e,t,n){ye(n=n||{})||F(`Invalid time multi-format specifier: ${n}`);let a=t(ur),r=t(lr),i=t(ja),o=t(ha),u=t(Cn),c=t(na),f=t(Ta),m=t(ta),g=e(n[Dr]||".%L"),v=e(n[ur]||":%S"),E=e(n[lr]||"%I:%M"),k=e(n[ja]||"%I %p"),_=e(n[ha]||n[aa]||"%a %d"),N=e(n[Cn]||"%b %d"),O=e(n[na]||"%B"),I=e(n[Ta]||"%B"),B=e(n[ta]||"%Y");return M=>(a(M)<M?g:r(M)<M?v:i(M)<M?E:o(M)<M?k:c(M)<M?u(M)<M?_:N:m(M)<M?f(M)<M?O:I:B)(M)}function ff(e){let t=yo(e.format),n=yo(e.utcFormat);return{timeFormat:a=>Ft(a)?t(a):Ql(t,as,a),utcFormat:a=>Ft(a)?n(a):Ql(n,Mr,a),timeParse:yo(e.parse),utcParse:yo(e.utcParse)}}function pc(){return df=ff({format:bo,parse:tf,utcFormat:rs,utcParse:nf})}function Jh(e){return ff(q0(e))}function Zs(e){return arguments.length?df=Jh(e):df}(function(e){Yl=q0(e),bo=Yl.format,tf=Yl.parse,rs=Yl.utcFormat,nf=Yl.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"]}),Zh(),pc();let Fi=(e,t)=>mt({},e,t);function Qh(e,t){let n=e?ii(e):fc(),a=t?Jh(t):Zs();return Fi(n,a)}function pf(e,t){let n=arguments.length;return n&&n!==2&&F("defaultLocale expects either zero or two arguments."),n?Fi(fc(e),Zs(t)):Fi(fc(),Zs())}let iy=/^(data:|([A-Za-z]+:)?\/\/)/,hf=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,mf=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,eu="file://";async function ze(e,t){let n=await this.sanitize(e,t),a=n.href;return n.localFile?this.file(a):this.http(a,t)}async function tu(e,t){t=mt({},this.options,t);let n=this.fileAccess,a={href:null},r,i,o,u=hf.test(e.replace(mf,""));e!=null&&typeof e=="string"&&u||F("Sanitize failure, invalid URI: "+st(e));let c=iy.test(e);return(o=t.baseURL)&&!c&&(e.startsWith("/")||o.endsWith("/")||(e="/"+e),e=o+e),i=(r=e.startsWith(eu))||t.mode==="file"||t.mode!=="http"&&!c&&n,r?e=e.slice(eu.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),i=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(a,"localFile",{value:!!i}),a.href=e,t.target&&(a.target=t.target+""),t.rel&&(a.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(a.crossOrigin=t.crossOrigin+""),a}function Pi(e){return e?t=>new Promise(((n,a)=>{e.readFile(t,((r,i)=>{r?a(r):n(i)}))})):os}async function os(){F("No file system access.")}function oy(e){return e?async function(t,n){let a=mt({},this.options.http,n),r=n&&n.response,i=await e(t,a);return i.ok?tt(i[r])?i[r]():i.text():F(i.status+""+i.statusText)}:gf}async function gf(){F("No HTTP fetch method available.")}let _t=e=>e!=null&&e==e,ma=e=>!(Number.isNaN(+e)||e instanceof Date),cr={boolean:$l,integer:Le,number:Le,date:Ld,string:Fd,unknown:ee},$i=[e=>e==="true"||e==="false"||e===!0||e===!1,e=>ma(e)&&Number.isInteger(+e),ma,e=>!Number.isNaN(Date.parse(e))],nu=["boolean","integer","number","date"];function em(e,t){if(!e||!e.length)return"unknown";let n=e.length,a=$i.length,r=$i.map(((i,o)=>o+1));for(let i,o,u=0,c=0;u<n;++u)for(o=t?e[u][t]:e[u],i=0;i<a;++i)if(r[i]&&_t(o)&&!$i[i](o)&&(r[i]=0,++c,c===$i.length))return"string";return nu[r.reduce(((i,o)=>i===0?o:i),0)-1]}function tm(e,t){return t.reduce(((n,a)=>(n[a]=em(e,a),n)),{})}function sy(e){let t=function(n,a){let r={delimiter:e};return je(n,a?mt(a,r):r)};return t.responseType="text",t}function je(e,t){return t.header&&(e=t.header.map(st).join(t.delimiter)+`
6
6
  `+e),BA(t.delimiter).parse(e+"")}function au(e,t){let n=t&&t.property?W(t.property):ee;return!ye(e)||(a=e,typeof Buffer=="function"&&tt(Buffer.isBuffer)&&Buffer.isBuffer(a))?n(JSON.parse(e)):(function(r,i){return!Ee(r)&&Si(r)&&(r=[...r]),i&&i.copy?JSON.parse(JSON.stringify(r)):r})(n(e),t);var a}je.responseType="text",au.responseType="json";let ly={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function nm(e,t){let n,a,r,i;return e=au(e,t),t&&t.feature?(n=UA,r=t.feature):t&&t.mesh?(n=b0,r=t.mesh,i=ly[t.filter]):F("Missing TopoJSON feature or mesh parameter."),a=(a=e.objects[r])?n(e,a,i):F("Invalid TopoJSON object: "+r),a&&a.features||[a]}nm.responseType="json";let hc={dsv:je,csv:sy(","),tsv:sy(" "),json:au,topojson:nm};function ss(e,t){return arguments.length>1?(hc[e]=t,this):nt(hc,e)?hc[e]:null}function bf(e){let t=ss(e);return t&&t.responseType||"text"}function yf(e,t,n,a){let r=ss((t=t||{}).type||"json");return r||F("Unknown data format type: "+t.type),e=r(e,t),t.parse&&(function(i,o,u,c){if(!i.length)return;let f=Zs();u=u||f.timeParse,c=c||f.utcParse;let m,g,v,E,k,_,N=i.columns||Object.keys(i[0]);o==="auto"&&(o=tm(i,N)),N=Object.keys(o);let O=N.map((I=>{let B=o[I],M,U;if(B&&(B.startsWith("date:")||B.startsWith("utc:")))return M=B.split(/:(.+)?/,2),U=M[1],(U[0]==="'"&&U[U.length-1]==="'"||U[0]==='"'&&U[U.length-1]==='"')&&(U=U.slice(1,-1)),(M[0]==="utc"?c:u)(U);if(!cr[B])throw Error("Illegal format pattern: "+I+":"+B);return cr[B]}));for(v=0,k=i.length,_=N.length;v<k;++v)for(m=i[v],E=0;E<_;++E)g=N[E],m[g]=O[E](m[g])})(e,t.parse,n,a),nt(e,"columns")&&delete e.columns,e}let Js=(function(e,t){return n=>({options:n||{},sanitize:tu,load:ze,fileAccess:!!t,file:Pi(t),http:oy(e)})})(typeof fetch<"u"&&fetch,null);function dr(e){let t=e||ee,n=[],a={};return n.add=r=>{let i=t(r);return a[i]||(a[i]=1,n.push(r)),n},n.remove=r=>{let i=t(r);if(a[i]){a[i]=0;let o=n.indexOf(r);o>=0&&n.splice(o,1)}return n},n}async function vn(e,t){try{await t(e)}catch(n){e.error(n)}}let am=Symbol("vega_id"),vf=1;function ru(e){return!(!e||!rt(e))}function rt(e){return e[am]}function Qs(e,t){return e[am]=t,e}function It(e){let t=e===Object(e)?e:{data:e};return rt(t)?t:Qs(t,vf++)}function iu(e){return mc(e,It({}))}function mc(e,t){for(let n in e)t[n]=e[n];return t}function ou(e,t){return Qs(t,rt(e))}function ls(e,t){return e?t?(n,a)=>e(n,a)||rt(t(n))-rt(t(a)):(n,a)=>e(n,a)||rt(n)-rt(a):null}function su(e){return e&&e.constructor===us}function us(){let e=[],t=[],n=[],a=[],r=[],i=null,o=!1;return{constructor:us,insert(u){let c=Ie(u),f=c.length;for(let m=0;m<f;++m)e.push(c[m]);return this},remove(u){let c=tt(u)?a:t,f=Ie(u),m=f.length;for(let g=0;g<m;++g)c.push(f[g]);return this},modify(u,c,f){let m={field:c,value:mn(f)};return tt(u)?(m.filter=u,r.push(m)):(m.tuple=u,n.push(m)),this},encode(u,c){return tt(u)?r.push({filter:u,field:c}):n.push({tuple:u,field:c}),this},clean(u){return i=u,this},reflow(){return o=!0,this},pulse(u,c){let f={},m={},g,v,E,k,_,N;for(g=0,v=c.length;g<v;++g)f[rt(c[g])]=1;for(g=0,v=t.length;g<v;++g)_=t[g],f[rt(_)]=-1;for(g=0,v=a.length;g<v;++g)k=a[g],c.forEach((I=>{k(I)&&(f[rt(I)]=-1)}));for(g=0,v=e.length;g<v;++g)_=e[g],N=rt(_),f[N]?f[N]=1:u.add.push(It(e[g]));for(g=0,v=c.length;g<v;++g)_=c[g],f[rt(_)]<0&&u.rem.push(_);function O(I,B,M){M?I[B]=M(I):u.encode=B,o||(m[rt(I)]=I)}for(g=0,v=n.length;g<v;++g)E=n[g],_=E.tuple,k=E.field,N=f[rt(_)],N>0&&(O(_,k,E.value),u.modifies(k));for(g=0,v=r.length;g<v;++g)E=r[g],k=E.filter,c.forEach((I=>{k(I)&&f[rt(I)]>0&&O(I,E.field,E.value)})),u.modifies(E.field);if(o)u.mod=t.length||a.length?c.filter((I=>f[rt(I)]>0)):c.slice();else for(N in m)u.mod.push(m[N]);return(i||i==null&&(t.length||a.length))&&u.clean(!0),u}}}let Ef="_:mod:_";function gc(){Object.defineProperty(this,Ef,{writable:!0,value:{}})}gc.prototype={set(e,t,n,a){let r=this,i=r[e],o=r[Ef];return t!=null&&t>=0?(i[t]!==n||a)&&(i[t]=n,o[t+":"+e]=-1,o[e]=-1):(i!==n||a)&&(r[e]=n,o[e]=Ee(n)?1+n.length:-1),r},modified(e,t){let n=this[Ef];if(!arguments.length){for(let a in n)if(n[a])return!0;return!1}if(Ee(e)){for(let a=0;a<e.length;++a)if(n[e[a]])return!0;return!1}return t!=null&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[Ef]={},this}};let Y_=0,uy=new gc;function Yt(e,t,n,a){this.id=++Y_,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,a)}function Bi(e){return function(t){let n=this.flags;return arguments.length===0?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Yt.prototype={targets(){return this._targets||(this._targets=dr(V))},set(e){return this.value!==e?(this.value=e,1):0},skip:Bi(1),modified:Bi(2),parameters(e,t,n){t=t!==!1;let a=this._argval=this._argval||new gc,r=this._argops=this._argops||[],i=[],o,u,c,f,m=(g,v,E)=>{E instanceof Yt?(E!==this&&(t&&E.targets().add(this),i.push(E)),r.push({op:E,name:g,index:v})):a.set(g,v,E)};for(o in e)if(u=e[o],o==="pulse")Ie(u).forEach((g=>{g instanceof Yt?g!==this&&(g.targets().add(this),i.push(g)):F("Pulse parameters must be operator instances.")})),this.source=u;else if(Ee(u))for(a.set(o,-1,Array(c=u.length)),f=0;f<c;++f)m(o,f,u[f]);else m(o,-1,u);return this.marshall().clear(),n&&(r.initonly=!0),i},marshall(e){let t=this._argval||uy,n=this._argops,a,r,i,o;if(n){let u=n.length;for(r=0;r<u;++r)a=n[r],i=a.op,o=i.modified()&&i.stamp===e,t.set(a.name,a.index,i.value,o);if(n.initonly){for(r=0;r<u;++r)a=n[r],a.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){let e=this._argops,t,n,a,r;if(e)for(t=0,n=e.length;t<n;++t)a=e[t],r=a.op,r._targets&&r._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){let t=this._update;if(t){let n=this.marshall(e.stamp),a=t.call(this,n,e);if(n.clear(),a!==this.value)this.value=a;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};let wf=0;function Ui(e,t,n){this.id=++wf,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function vo(e,t,n){return new Ui(e,t,n)}Ui.prototype={_filter:Z,_apply:ee,targets(){return this._targets||(this._targets=dr(V))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){let t=this.value=this._apply(e),n=this._targets,a=n?n.length:0;for(let r=0;r<a;++r)n[r].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){let t=vo(e);return this.targets().add(t),t},apply(e){let t=vo(null,e);return this.targets().add(t),t},merge(){let e=vo();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter((()=>{let n=Date.now();return n-t>e?(t=n,1):0}))},debounce(e){let t=vo();return this.targets().add(vo(null,null,Zo(e,(n=>{let a=n.dataflow;t.receive(n),a&&a.run&&a.run()})))),t},between(e,t){let n=!1;return e.targets().add(vo(null,null,(()=>n=!0))),t.targets().add(vo(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=Z,this._targets=null}};let cy={skip:!0};function rm(e,t,n,a,r,i){let o=mt({},i,cy),u,c;tt(n)||(n=mn(n)),a===void 0?u=f=>e.touch(n(f)):tt(a)?(c=new Yt(null,a,r,!1),u=f=>{c.evaluate(f);let m=n(f),g=c.value;su(g)?e.pulse(m,g,i):e.update(m,g,o)}):u=f=>e.update(n(f),a,o),t.apply(u)}function dy(e,t,n,a,r,i){if(a===void 0)t.targets().add(n);else{let o=i||{},u=new Yt(null,(function(c,f){return f=tt(f)?f:mn(f),c?function(m,g){let v=f(m,g);return c.skip()||(c.skip(v!==this.value).value=v),v}:f})(n,a),r,!1);u.modified(o.force),u.rank=t.rank,t.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),e.connect(n,[u]))}}let _f={};function oi(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function bc(e,t){let n=[];return Qo(e,t,(a=>n.push(a))),n}function im(e,t){let n={};return e.visit(t,(a=>{n[rt(a)]=1})),a=>n[rt(a)]?null:a}function lu(e,t){return e?(n,a)=>e(n,a)&&t(n,a):t}function yc(e,t,n,a){let r=this,i=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=a||null,this.pulses=n;for(let o of n)if(o.stamp===t){if(o.fields){let u=r.fields||(r.fields={});for(let c in o.fields)u[c]=1}o.changed(r.ADD)&&(i|=r.ADD),o.changed(r.REM)&&(i|=r.REM),o.changed(r.MOD)&&(i|=r.MOD)}this.changes=i}function kf(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}oi.prototype={StopPropagation:_f,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(e){return new oi(this.dataflow).init(this,e)},clone(){let e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new oi(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){let n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){let t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow(e){if(e)return this.fork(7).reflow();let t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,im(this,1))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){let t=this.fields||(this.fields={});return Ee(e)?e.forEach((n=>t[n]=!0)):t[e]=!0,this},modified(e,t){let n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?Ee(e)?e.some((a=>n[a])):n[e]:!!n)},filter(e,t){let n=this;return 1&e&&(n.addF=lu(n.addF,t)),2&e&&(n.remF=lu(n.remF,t)),4&e&&(n.modF=lu(n.modF,t)),16&e&&(n.srcF=lu(n.srcF,t)),n},materialize(e){let t=this;return 1&(e=e||7)&&t.addF&&(t.add=bc(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=bc(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=bc(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){let n=this,a=t;if(16&e)return Qo(n.source,n.srcF,a),n;1&e&&Qo(n.add,n.addF,a),2&e&&Qo(n.rem,n.remF,a),4&e&&Qo(n.mod,n.modF,a);let r=n.source;if(8&e&&r){let i=n.add.length+n.mod.length;i===r.length||Qo(r,i?im(n,5):n.srcF,a)}return n}},Fe(yc,oi,{fork(e){let t=new oi(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,(n=>t.add.push(n))),e&t.REM&&this.visit(t.REM,(n=>t.rem.push(n))),e&t.MOD&&this.visit(t.MOD,(n=>t.mod.push(n)))),t},changed(e){return this.changes&e},modified(e){let t=this,n=t.fields;return n&&t.changes&t.MOD?Ee(e)?e.some((a=>n[a])):n[e]:0},filter(){F("MultiPulse does not support filtering.")},materialize(){F("MultiPulse does not support materialization.")},visit(e,t){let n=this,a=n.pulses,r=a.length,i=0;if(e&n.SOURCE)for(;i<r;++i)a[i].visit(e,t);else for(;i<r;++i)a[i].stamp===n.stamp&&a[i].visit(e,t);return n}});let Sf={skip:!1,force:!1};function fy(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),vc(t,0,t.length-1,e)),pop:()=>{let n=t.pop(),a;return t.length?(a=t[0],t[0]=n,(function(r,i,o){let u=i,c=r.length,f=r[i],m,g=1+(i<<1);for(;g<c;)m=g+1,m<c&&o(r[g],r[m])>=0&&(g=m),r[i]=r[g],g=1+((i=g)<<1);r[i]=f,vc(r,u,i,o)})(t,0,e)):a=n,a}}}function vc(e,t,n,a){let r,i,o=e[n];for(;n>t&&(i=n-1>>1,r=e[i],a(o,r)<0);)e[n]=r,n=i;return e[n]=o}function el(){this.logger(Ge()),this.logLevel(de),this._clock=0,this._rank=0,this._locale=pf();try{this._loader=Js()}catch{}this._touched=dr(V),this._input={},this._pulse=null,this._heap=fy(((e,t)=>e.qrank-t.qrank)),this._postrun=[]}function cs(e){return function(){return this._log[e].apply(this,arguments)}}function Se(e,t){Yt.call(this,e,null,t)}el.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:cs("error"),warn:cs("warn"),info:cs("info"),debug:cs("debug"),logLevel:cs("level"),cleanThreshold:1e4,add:function(e,t,n,a){let r,i=1;return e instanceof Yt?r=e:e&&e.prototype instanceof Yt?r=new e:tt(e)?r=new Yt(null,e):(i=0,r=new Yt(e,t)),this.rank(r),i&&(a=n,n=t),n&&this.connect(r,r.parameters(n,a)),this.touch(r),r},connect:function(e,t){let n=e.rank,a=t.length;for(let r=0;r<a;++r)if(n<t[r].rank)return void this.rerank(e)},rank:function(e){e.rank=++this._rank},rerank:function(e){let t=[e],n,a,r;for(;t.length;)if(this.rank(n=t.pop()),a=n._targets)for(r=a.length;--r>=0;)t.push(n=a[r]),n===e&&F("Cycle detected in dataflow graph.")},pulse:function(e,t,n){this.touch(e,n||Sf);let a=new oi(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return a.target=e,this._input[e.id]=t.pulse(a,r),this},touch:function(e,t){let n=t||Sf;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this},update:function(e,t,n){let a=n||Sf;return(e.set(t)||a.force)&&this.touch(e,a),this},changeset:us,ingest:function(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))},parse:function(e,t){let n=this.locale();return yf(e,t,n.timeParse,n.utcParse)},preload:async function(e,t,n){let a=this,r=a._pending||(function(o){let u,c=new Promise((f=>u=f));return c.requests=0,c.done=()=>{--c.requests==0&&(o._pending=null,u(o))},o._pending=c})(a);r.requests+=1;let i=await a.request(t,n);return a.pulse(e,a.changeset().remove(Z).insert(i.data||[])),r.done(),i},request:async function(e,t){let n=this,a,r=0;try{a=await n.loader().load(e,{context:"dataflow",response:bf(t&&t.type)});try{a=n.parse(a,t)}catch(i){r=-2,n.warn("Data ingestion failed",e,i)}}catch(i){r=-1,n.warn("Loading failed",e,i)}return{data:a,status:r}},events:function(e,t,n,a){let r=this,i=vo(n,a),o=function(f){f.dataflow=r;try{i.receive(f)}catch(m){r.error(m)}finally{r.run()}},u;u=typeof e=="string"&&typeof document<"u"?document.querySelectorAll(e):Ie(e);let c=u.length;for(let f=0;f<c;++f)u[f].addEventListener(t,o);return i},on:function(e,t,n,a,r){return(e instanceof Yt?dy:rm)(this,e,t,n,a,r),this},evaluate:async function(e,t,n){let a=this,r=[];if(a._pulse)return kf(a);if(a._pending&&await a._pending,t&&await vn(a,t),!a._touched.length)return a.debug("Dataflow invoked, but nothing to do."),a;let i=++a._clock;a._pulse=new oi(a,i,e),a._touched.forEach((m=>a._enqueue(m,!0))),a._touched=dr(V);let o,u,c,f=0;try{for(;a._heap.size()>0;)o=a._heap.pop(),o.rank===o.qrank?(u=o.run(a._getPulse(o,e)),u.then?u=await u:u.async&&(r.push(u.async),u=_f),u!==_f&&o._targets&&o._targets.forEach((m=>a._enqueue(m))),++f):a._enqueue(o,!0)}catch(m){a._heap.clear(),c=m}if(a._input={},a._pulse=null,a.debug(`Pulse ${i}: ${f} operators`),c&&(a._postrun=[],a.error(c)),a._postrun.length){let m=a._postrun.sort(((g,v)=>v.priority-g.priority));a._postrun=[];for(let g=0;g<m.length;++g)await vn(a,m[g].callback)}return n&&await vn(a,n),r.length&&Promise.all(r).then((m=>a.runAsync(null,(()=>{m.forEach((g=>{try{g(a)}catch(v){a.error(v)}}))})))),a},run:function(e,t,n){return this._pulse?kf(this):(this.evaluate(e,t,n),this)},runAsync:async function(e,t,n){for(;this._running;)await this._running;let a=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(a,a),this._running},runAfter:function(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(a){this.error(a)}},_enqueue:function(e,t){let n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))},_getPulse:function(e,t){let n=e.source,a=this._clock;return n&&Ee(n)?new yc(this,a,n.map((r=>r.pulse)),t):this._input[e.id]||(function(r,i){return i&&i.stamp===r.stamp?i:(r=r.fork(),i&&i!==_f&&(r.source=i.source),r)})(this._pulse,n&&n.pulse)}},Fe(Se,Yt,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then((n=>this.pulse=n)):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){let t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});let tl={};function om(e){let t=sm(e);return t&&t.Definition||null}function sm(e){return e=e&&e.toLowerCase(),nt(tl,e)?tl[e]:null}function*xf(e,t){if(t==null)for(let n of e)n!=null&&n!==""&&(n=+n)>=n&&(yield n);else{let n=-1;for(let a of e)a=t(a,++n,e),a!=null&&a!==""&&(a=+a)>=a&&(yield a)}}function lm(e,t,n){let a=Float64Array.from(xf(e,n));return a.sort(Ti),t.map((r=>w0(a,r)))}function Af(e,t){return lm(e,[.25,.5,.75],t)}function um(e,t){let n=e.length,a=(function(o,u){let c=(function(f,m){let g,v=0,E=0,k=0;if(m===void 0)for(let _ of f)_!=null&&(_=+_)>=_&&(g=_-E,E+=g/++v,k+=g*(_-E));else{let _=-1;for(let N of f)(N=m(N,++_,f))!=null&&(N=+N)>=N&&(g=N-E,E+=g/++v,k+=g*(N-E))}if(v>1)return k/(v-1)})(o,u);return c&&Math.sqrt(c)})(e,t),r=Af(e,t),i=(r[2]-r[0])/1.34;return 1.06*(Math.min(a,i)||a||Math.abs(r[0])||1)*Math.pow(n,-.2)}function cm(e){let t=e.maxbins||20,n=e.base||10,a=Math.log(n),r=e.divide||[5,2],i,o,u,c,f,m,g=e.extent[0],v=e.extent[1],E=e.span||v-g||Math.abs(g)||1;if(e.step)i=e.step;else if(e.steps){for(c=E/t,f=0,m=e.steps.length;f<m&&e.steps[f]<c;++f);i=e.steps[Math.max(0,f-1)]}else{for(o=Math.ceil(Math.log(t)/a),u=e.minstep||0,i=Math.max(u,Math.pow(n,Math.round(Math.log(E)/a)-o));Math.ceil(E/i)>t;)i*=n;for(f=0,m=r.length;f<m;++f)c=i/r[f],c>=u&&E/c<=t&&(i=c)}c=Math.log(i);let k=c>=0?0:1+~~(-c/a),_=Math.pow(n,-k-1);return(e.nice||e.nice===void 0)&&(c=Math.floor(g/i+_)*i,g=g<c?c-i:c,v=Math.ceil(v/i)*i),{start:g,stop:v===g?g+i:v,step:i}}function dm(e,t,n,a){if(!e.length)return[void 0,void 0];let r=Float64Array.from(xf(e,a)),i=r.length,o=t,u,c,f,m;for(f=0,m=Array(o);f<o;++f){for(u=0,c=0;c<i;++c)u+=r[~~(p.random()*i)];m[f]=u/i}return m.sort(Ti),[Qu(m,n/2),Qu(m,1-n/2)]}function Tf(e,t,n,a){a=a||(v=>v);let r=e.length,i=new Float64Array(r),o,u=0,c=1,f=a(e[0]),m=f,g=f+t;for(;c<r;++c){if(o=a(e[c]),o>=g){for(m=(f+m)/2;u<c;++u)i[u]=m;g=o+t,f=o}m=o}for(m=(f+m)/2;u<c;++u)i[u]=m;return n?(function(v,E){let k=v.length,_,N,O=0,I=1;for(;v[O]===v[I];)++I;for(;I<k;){for(_=I+1;v[I]===v[_];)++_;if(v[I]-v[I-1]<E){for(N=I+(O+_-I-I>>1);N<I;)v[N++]=v[I];for(;N>I;)v[N--]=v[O]}O=I,I=_}return v})(i,t+t/4):i}p.random=Math.random;let py=Math.sqrt(2*Math.PI),hy=Math.SQRT2,uu=NaN;function cu(e,t){e=e||0,t=t??1;let n,a,r=0,i=0;if(uu==uu)r=uu,uu=NaN;else{do r=2*p.random()-1,i=2*p.random()-1,n=r*r+i*i;while(n===0||n>1);a=Math.sqrt(-2*Math.log(n)/n),r*=a,uu=i*a}return e+r*t}function fm(e,t,n){let a=(e-(t||0))/(n=n??1);return Math.exp(-.5*a*a)/(n*py)}function Ec(e,t,n){let a=(e-(t=t||0))/(n=n??1),r=Math.abs(a),i;if(r>37)i=0;else{let o=Math.exp(-r*r/2),u;r<7.07106781186547?(u=.0352624965998911*r+.700383064443688,u=u*r+6.37396220353165,u=u*r+33.912866078383,u=u*r+112.079291497871,u=u*r+221.213596169931,u=u*r+220.206867912376,i=o*u,u=.0883883476483184*r+1.75566716318264,u=u*r+16.064177579207,u=u*r+86.7807322029461,u=u*r+296.564248779674,u=u*r+637.333633378831,u=u*r+793.826512519948,u=u*r+440.413735824752,i/=u):(u=r+.65,u=r+4/u,u=r+3/u,u=r+2/u,u=r+1/u,i=o/u/2.506628274631)}return a>0?1-i:i}function wc(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*hy*(function(a){let r,i=-Math.log((1-a)*(1+a));return i<6.25?(i-=3.125,r=-364441206401782e-35,r=r*i-16850591381820166e-35,r=128584807152564e-32+r*i,r=11157877678025181e-33+r*i,r=r*i-1333171662854621e-31,r=20972767875968562e-33+r*i,r=6637638134358324e-30+r*i,r=r*i-4054566272975207e-29,r=r*i-8151934197605472e-29,r=26335093153082323e-28+r*i,r=r*i-12975133253453532e-27,r=r*i-5415412054294628e-26,r=10512122733215323e-25+r*i,r=r*i-4112633980346984e-24,r=r*i-29070369957882005e-24,r=42347877827932404e-23+r*i,r=r*i-13654692000834679e-22,r=r*i-13882523362786469e-21,r=.00018673420803405714+r*i,r=r*i-.000740702534166267,r=r*i-.006033670871430149,r=.24015818242558962+r*i,r=1.6536545626831027+r*i):i<16?(i=Math.sqrt(i)-3.25,r=22137376921775787e-25,r=9075656193888539e-23+r*i,r=r*i-27517406297064545e-23,r=18239629214389228e-24+r*i,r=15027403968909828e-22+r*i,r=r*i-4013867526981546e-21,r=29234449089955446e-22+r*i,r=12475304481671779e-21+r*i,r=r*i-47318229009055734e-21,r=6828485145957318e-20+r*i,r=24031110387097894e-21+r*i,r=r*i-.0003550375203628475,r=.0009532893797373805+r*i,r=r*i-.0016882755560235047,r=.002491442096107851+r*i,r=r*i-.003751208507569241,r=.005370914553590064+r*i,r=1.0052589676941592+r*i,r=3.0838856104922208+r*i):Number.isFinite(i)?(i=Math.sqrt(i)-5,r=-27109920616438573e-27,r=r*i-2555641816996525e-25,r=15076572693500548e-25+r*i,r=r*i-3789465440126737e-24,r=761570120807834e-23+r*i,r=r*i-1496002662714924e-23,r=2914795345090108e-23+r*i,r=r*i-6771199775845234e-23,r=22900482228026655e-23+r*i,r=r*i-99298272942317e-20,r=4526062597223154e-21+r*i,r=r*i-1968177810553167e-20,r=7599527703001776e-20+r*i,r=r*i-.00021503011930044477,r=r*i-.00013871931833623122,r=1.0103004648645344+r*i,r=4.849906401408584+r*i):r=1/0,r*a})(2*e-1)}function pm(e,t){let n,a,r={mean(i){return arguments.length?(n=i||0,r):n},stdev(i){return arguments.length?(a=i??1,r):a},sample:()=>cu(n,a),pdf:i=>fm(i,n,a),cdf:i=>Ec(i,n,a),icdf:i=>wc(i,n,a)};return r.mean(e).stdev(t)}function hm(e,t){let n=pm(),a=0,r={data(i){return arguments.length?(e=i,a=i?i.length:0,r.bandwidth(t)):e},bandwidth(i){return arguments.length?(!(t=i)&&e&&(t=um(e)),r):t},sample:()=>e[~~(p.random()*a)]+t*n.sample(),pdf(i){let o=0,u=0;for(;u<a;++u)o+=n.pdf((i-e[u])/t);return o/t/a},cdf(i){let o=0,u=0;for(;u<a;++u)o+=n.cdf((i-e[u])/t);return o/a},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function Cf(e,t){return e=e||0,t=t??1,Math.exp(e+cu()*t)}function Rf(e,t,n){if(e<=0)return 0;t=t||0,n=n??1;let a=(Math.log(e)-t)/n;return Math.exp(-.5*a*a)/(n*py*e)}function fr(e,t,n){return Ec(Math.log(e),t,n)}function mm(e,t,n){return Math.exp(wc(e,t,n))}function Nf(e,t){let n,a,r={mean(i){return arguments.length?(n=i||0,r):n},stdev(i){return arguments.length?(a=i??1,r):a},sample:()=>Cf(n,a),pdf:i=>Rf(i,n,a),cdf:i=>fr(i,n,a),icdf:i=>mm(i,n,a)};return r.mean(e).stdev(t)}function If(e,t){let n,a=0,r={weights(i){return arguments.length?(n=(function(o){let u=[],c,f=0;for(c=0;c<a;++c)f+=u[c]=o[c]==null?1:+o[c];for(c=0;c<a;++c)u[c]/=f;return u})(t=i||[]),r):t},distributions(i){return arguments.length?(i?(a=i.length,e=i):(a=0,e=[]),r.weights(t)):e},sample(){let i=p.random(),o=e[a-1],u=n[0],c=0;for(;c<a-1;u+=n[++c])if(i<u){o=e[c];break}return o.sample()},pdf(i){let o=0,u=0;for(;u<a;++u)o+=n[u]*e[u].pdf(i);return o},cdf(i){let o=0,u=0;for(;u<a;++u)o+=n[u]*e[u].cdf(i);return o},icdf(){throw Error("Mixture icdf not supported.")}};return r.distributions(e).weights(t)}function _c(e,t){return t==null&&(t=e??1,e=0),e+(t-e)*p.random()}function Of(e,t,n){return n==null&&(n=t??1,t=0),e>=t&&e<=n?1/(n-t):0}function kc(e,t,n){return n==null&&(n=t??1,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function du(e,t,n){return n==null&&(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function Df(e,t){let n,a,r={min(i){return arguments.length?(n=i||0,r):n},max(i){return arguments.length?(a=i??1,r):a},sample:()=>_c(n,a),pdf:i=>Of(i,n,a),cdf:i=>kc(i,n,a),icdf:i=>du(i,n,a)};return t==null&&(t=e??1,e=0),r.min(e).max(t)}function Mf(e,t,n){let a=0,r=0;for(let i of e){let o=n(i);t(i)==null||o==null||isNaN(o)||(a+=(o-a)/++r)}return{coef:[a],predict:()=>a,rSquared:0}}function qa(e,t,n,a){let r=a-e*e,i=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-i*e,i]}function Sc(e,t,n,a){e=e.filter((E=>{let k=t(E),_=n(E);return k!=null&&(k=+k)>=k&&_!=null&&(_=+_)>=_})),a&&e.sort(((E,k)=>t(E)-t(k)));let r=e.length,i=new Float64Array(r),o=new Float64Array(r),u,c,f,m=0,g=0,v=0;for(f of e)i[m]=u=+t(f),o[m]=c=+n(f),++m,g+=(u-g)/m,v+=(c-v)/m;for(m=0;m<r;++m)i[m]-=g,o[m]-=v;return[i,o,g,v]}function xc(e,t,n,a){let r,i,o=-1;for(let u of e)r=t(u),i=n(u),r!=null&&(r=+r)>=r&&i!=null&&(i=+i)>=i&&a(r,i,++o)}function ds(e,t,n,a,r){let i=0,o=0;return xc(e,t,n,((u,c)=>{let f=c-r(u),m=c-a;i+=f*f,o+=m*m})),1-i/o}function fu(e,t,n){let a=0,r=0,i=0,o=0,u=0;xc(e,t,n,((m,g)=>{++u,a+=(m-a)/u,r+=(g-r)/u,i+=(m*g-i)/u,o+=(m*m-o)/u}));let c=qa(a,r,i,o),f=m=>c[0]+c[1]*m;return{coef:c,predict:f,rSquared:ds(e,t,n,r,f)}}function Ac(e,t,n){let a=0,r=0,i=0,o=0,u=0;xc(e,t,n,((m,g)=>{++u,m=Math.log(m),a+=(m-a)/u,r+=(g-r)/u,i+=(m*g-i)/u,o+=(m*m-o)/u}));let c=qa(a,r,i,o),f=m=>c[0]+c[1]*Math.log(m);return{coef:c,predict:f,rSquared:ds(e,t,n,r,f)}}function gm(e,t,n){let[a,r,i,o]=Sc(e,t,n),u,c,f,m=0,g=0,v=0,E=0,k=0;xc(e,t,n,((I,B)=>{u=a[k++],c=Math.log(B),f=u*B,m+=(B*c-m)/k,g+=(f-g)/k,v+=(f*c-v)/k,E+=(u*f-E)/k}));let[_,N]=qa(g/o,m/o,v/o,E/o),O=I=>Math.exp(_+N*(I-i));return{coef:[Math.exp(_-N*i),N],predict:O,rSquared:ds(e,t,n,o,O)}}function my(e,t,n){let a=0,r=0,i=0,o=0,u=0,c=0;xc(e,t,n,((g,v)=>{let E=Math.log(g),k=Math.log(v);++c,a+=(E-a)/c,r+=(k-r)/c,i+=(E*k-i)/c,o+=(E*E-o)/c,u+=(v-u)/c}));let f=qa(a,r,i,o),m=g=>f[0]*Math.pow(g,f[1]);return f[0]=Math.exp(f[0]),{coef:f,predict:m,rSquared:ds(e,t,n,u,m)}}function si(e,t,n){let[a,r,i,o]=Sc(e,t,n),u=a.length,c,f,m,g,v=0,E=0,k=0,_=0,N=0;for(c=0;c<u;)f=a[c],m=r[c++],g=f*f,v+=(g-v)/c,E+=(g*f-E)/c,k+=(g*g-k)/c,_+=(f*m-_)/c,N+=(g*m-N)/c;let O=k-v*v,I=v*O-E*E,B=(N*v-_*E)/I,M=(_*O-N*E)/I,U=-B*v,z=q=>B*(q-=i)*q+M*q+U+o;return{coef:[U-M*i+B*i*i+o,M-2*B*i,B],predict:z,rSquared:ds(e,t,n,o,z)}}function bm(e,t,n,a){if(a===0)return Mf(e,t,n);if(a===1)return fu(e,t,n);if(a===2)return si(e,t,n);let[r,i,o,u]=Sc(e,t,n),c=r.length,f=[],m=[],g=a+1,v,E,k,_,N;for(v=0;v<g;++v){for(k=0,_=0;k<c;++k)_+=Math.pow(r[k],v)*i[k];for(f.push(_),N=new Float64Array(g),E=0;E<g;++E){for(k=0,_=0;k<c;++k)_+=Math.pow(r[k],v+E);N[E]=_}m.push(N)}m.push(f);let O=(function(B){let M=B.length-1,U=[],z,q,Y,K,re;for(z=0;z<M;++z){for(K=z,q=z+1;q<M;++q)Math.abs(B[z][q])>Math.abs(B[z][K])&&(K=q);for(Y=z;Y<M+1;++Y)re=B[Y][z],B[Y][z]=B[Y][K],B[Y][K]=re;for(q=z+1;q<M;++q)for(Y=M;Y>=z;Y--)B[Y][q]-=B[Y][z]*B[z][q]/B[z][z]}for(q=M-1;q>=0;--q){for(re=0,Y=q+1;Y<M;++Y)re+=B[Y][q]*U[Y];U[q]=(B[M][q]-re)/B[q][q]}return U})(m),I=B=>{B-=o;let M=u+O[0]+O[1]*B+O[2]*B*B;for(v=3;v<g;++v)M+=O[v]*Math.pow(B,v);return M};return{coef:gy(g,O,-o,u),predict:I,rSquared:ds(e,t,n,u,I)}}function gy(e,t,n,a){let r=Array(e),i,o,u,c;for(i=0;i<e;++i)r[i]=0;for(i=e-1;i>=0;--i)for(u=t[i],c=1,r[i]+=u,o=1;o<=i;++o)c*=(i+1-o)/o,r[i-o]+=u*Math.pow(n,o)*c;return r[0]+=a,r}let ym=2,by=1e-12;function vm(e,t,n,a){let[r,i,o,u]=Sc(e,t,n,!0),c=r.length,f=Math.max(2,~~(a*c)),m=new Float64Array(c),g=new Float64Array(c),v=new Float64Array(c).fill(1);for(let E=-1;++E<=ym;){let k=[0,f-1];for(let N=0;N<c;++N){let O=r[N],I=k[0],B=k[1],M=O-r[I]>r[B]-O?I:B,U=0,z=0,q=0,Y=0,K=0,re=1/Math.abs(r[M]-O||1);for(let se=I;se<=B;++se){let ue=r[se],fe=i[se],ve=K_(Math.abs(O-ue)*re)*v[se],we=ue*ve;U+=ve,z+=we,q+=fe*ve,Y+=fe*we,K+=ue*we}let[Q,ie]=qa(z/U,q/U,Y/U,K/U);m[N]=Q+ie*O,g[N]=Math.abs(i[N]-m[N]),X_(r,N+1,k)}if(E===ym)break;let _=ec(g);if(Math.abs(_)<by)break;for(let N,O,I=0;I<c;++I)N=g[I]/(6*_),v[I]=N>=1?by:(O=1-N*N)*O}return(function(E,k,_,N){let O=E.length,I=[],B,M=0,U=0,z=[];for(;M<O;++M)B=E[M]+_,z[0]===B?z[1]+=(k[M]-z[1])/++U:(U=0,z[1]+=N,z=[B,k[M]],I.push(z));return z[1]+=N,I})(r,m,o,u)}function K_(e){return(e=1-e*e*e)*e*e}function X_(e,t,n){let a=e[t],r=n[0],i=n[1]+1;if(!(i>=e.length))for(;t>r&&e[i]-a<=a-e[r];)n[0]=++r,n[1]=i,++i}let Z_=.5*Math.PI/180;function Lf(e,t,n,a){n=n||25,a=Math.max(n,a||200);let r=_=>[_,e(_)],i=t[0],o=t[1],u=o-i,c=u/a,f=[r(i)],m=[];if(n===a){for(let _=1;_<a;++_)f.push(r(i+_/n*u));return f.push(r(o)),f}m.push(r(o));for(let _=n;--_>0;)m.push(r(i+_/n*u));let g=f[0],v=m[m.length-1],E=1/u,k=(function(_,N){let O=_,I=_,B=N.length;for(let M=0;M<B;++M){let U=N[M][1];U<O&&(O=U),U>I&&(I=U)}return 1/(I-O)})(g[1],m);for(;v;){let _=r((g[0]+v[0])/2);_[0]-g[0]>=c&&J_(g,_,v,E,k)>Z_?m.push(_):(g=v,f.push(v),m.pop()),v=m[m.length-1]}return f}function J_(e,t,n,a,r){let i=Math.atan2(r*(n[1]-e[1]),a*(n[0]-e[0])),o=Math.atan2(r*(t[1]-e[1]),a*(t[0]-e[0]));return Math.abs(i-o)}function pu(e){return e&&e.length?e.length===1?e[0]:(t=e,n=>{let a=t.length,r=1,i=String(t[0](n));for(;r<a;++r)i+="|"+t[r](n);return i}):function(){return""};var t}function Ff(e,t,n){return n||e+(t?"_"+t:"")}let Em=()=>{},Q_={init:Em,add:Em,rem:Em,idx:0},Tc={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.sum,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t<e.min||e.min===void 0)&&(e.min=t)},rem:(e,t)=>{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t<e.min&&(e.argmin=n)},rem:(e,t)=>{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3}},zi=Object.keys(Tc).filter((e=>e!=="__count__"));function wm(e,t){return Tc[e](t)}function _m(e,t){return e.idx-t.idx}function yy(){this.valid=0,this.missing=0,this._ops.forEach((e=>e.init(this)))}function e1(e,t){e!=null&&e!==""?e==e&&(++this.valid,this._ops.forEach((n=>n.add(this,e,t)))):++this.missing}function t1(e,t){e!=null&&e!==""?e==e&&(--this.valid,this._ops.forEach((n=>n.rem(this,e,t)))):--this.missing}function km(e){return this._out.forEach((t=>e[t.out]=t.value(this))),e}function Sm(e,t){let n=t||ee,a=(function(o){let u={};o.forEach((f=>u[f.name]=f));let c=f=>{f.req&&f.req.forEach((m=>{u[m]||c(u[m]=Tc[m]())}))};return o.forEach(c),Object.values(u).sort(_m)})(e),r=e.slice().sort(_m);function i(o){this._ops=a,this._out=r,this.cell=o,this.init()}return i.prototype.init=yy,i.prototype.add=e1,i.prototype.rem=t1,i.prototype.set=km,i.prototype.get=n,i.fields=e.map((o=>o.out)),i}function xm(e){this._key=e?W(e):rt,this.reset()}[...zi,"__count__"].forEach((e=>{Tc[e]=(function(t,n){return a=>mt({name:t,out:a||t},Q_,n)})(e,Tc[e])}));let ra=xm.prototype;function Gi(e){Se.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}ra.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},ra.add=function(e){this._add.push(e)},ra.rem=function(e){this._rem.push(e)},ra.values=function(){if(this._get=null,this._rem.length===0)return this._add;let e=this._add,t=this._rem,n=this._key,a=e.length,r=t.length,i=Array(a-r),o={},u,c,f;for(u=0;u<r;++u)o[n(t[u])]=1;for(u=0,c=0;u<a;++u)o[n(f=e[u])]?o[n(f)]=0:i[c++]=f;return this._rem=[],this._add=i},ra.distinct=function(e){let t=this.values(),n={},a,r=t.length,i=0;for(;--r>=0;)a=e(t[r])+"",nt(n,a)||(n[a]=1,++i);return i},ra.extent=function(e){if(this._get!==e||!this._ext){let t=this.values(),n=ar(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},ra.argmin=function(e){return this.extent(e)[0]||{}},ra.argmax=function(e){return this.extent(e)[1]||{}},ra.min=function(e){let t=this.extent(e)[0];return t!=null?e(t):void 0},ra.max=function(e){let t=this.extent(e)[1];return t!=null?e(t):void 0},ra.quartile=function(e){return this._get===e&&this._q||(this._q=Af(this.values(),e),this._get=e),this._q},ra.q1=function(e){return this.quartile(e)[0]},ra.q2=function(e){return this.quartile(e)[1]},ra.q3=function(e){return this.quartile(e)[2]},ra.ci=function(e){return this._get===e&&this._ci||(this._ci=dm(this.values(),1e3,.05,e),this._get=e),this._ci},ra.ci0=function(e){return this.ci(e)[0]},ra.ci1=function(e){return this.ci(e)[1]},Gi.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:zi},{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"}]},Fe(Gi,Se,{transform(e,t){let n=this,a=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=a.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,(i=>n.add(i)))):(n.value=n.value||n.init(e),t.visit(t.REM,(i=>n.rem(i))),t.visit(t.ADD,(i=>n.add(i)))),a.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&a.clean(!0).runAfter((()=>this.clean())),n.changes(a)},cross(){let e=this,t=e.value,n=e._dnames,a=n.map((()=>({}))),r=n.length;function i(o){let u,c,f,m;for(u in o)for(f=o[u].tuple,c=0;c<r;++c)a[c][m=f[n[c]]]=m}i(e._prev),i(t),(function o(u,c,f){let m=n[f],g=a[f++];for(let v in g){let E=u?u+"|"+v:v;c[m]=g[v],f<r?o(E,c,f):t[E]||e.cell(E,c)}})("",{},0)},init(e){let t=this._inputs=[],n=this._outputs=[],a={};function r(N){let O=Ie(T(N)),I=O.length,B,M=0;for(;M<I;++M)a[B=O[M]]||(a[B]=1,t.push(B))}this._dims=Ie(e.groupby),this._dnames=this._dims.map((N=>{let O=S(N);return r(N),n.push(O),O})),this.cellkey=e.key?e.key:pu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];let i=e.fields||[null],o=e.ops||["count"],u=e.as||[],c=i.length,f={},m,g,v,E,k,_;for(c!==o.length&&F("Unmatched number of fields and aggregate ops."),_=0;_<c;++_)m=i[_],g=o[_],m==null&&g!=="count"&&F("Null aggregate field specified."),E=S(m),k=Ff(g,E,u[_]),n.push(k),g!=="count"?(v=f[E],v||(r(m),v=f[E]=[],v.field=m,this._measures.push(v)),g!=="count"&&(this._countOnly=!1),v.push(wm(g,k))):this._counts.push(k);return this._measures=this._measures.map((N=>Sm(N,N.field))),Object.create(null)},cellkey:pu(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){let n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){let a=this._measures,r=a.length;n.agg=Array(r);for(let i=0;i<r;++i)n.agg[i]=new a[i](n)}return n.store&&(n.data=new xm),n},newtuple(e,t){let n=this._dnames,a=this._dims,r=a.length,i={};for(let o=0;o<r;++o)i[n[o]]=a[o](e);return t?ou(t.tuple,i):It(i)},clean(){let e=this.value;for(let t in e)e[t].num===0&&delete e[t]},add(e){let t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);let a=n.agg;for(let r=0,i=a.length;r<i;++r)a[r].add(a[r].get(e),e)},rem(e){let t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);let a=n.agg;for(let r=0,i=a.length;r<i;++r)a[r].rem(a[r].get(e),e)},celltuple(e){let t=e.tuple,n=this._counts;e.store&&e.data.values();for(let a=0,r=n.length;a<r;++a)t[n[a]]=e.num;if(!this._countOnly){let a=e.agg;for(let r=0,i=a.length;r<i;++r)a[r].set(t)}return t},changes(e){let t=this._adds,n=this._mods,a=this._prev,r=this._drop,i=e.add,o=e.rem,u=e.mod,c,f,m,g;if(a)for(f in a)c=a[f],r&&!c.num||o.push(c.tuple);for(m=0,g=this._alen;m<g;++m)i.push(this.celltuple(t[m])),t[m]=null;for(m=0,g=this._mlen;m<g;++m)c=n[m],(c.num===0&&r?o:u).push(this.celltuple(c)),n[m]=null;return this._alen=this._mlen=0,this._prev=null,e}});function Cc(e){Se.call(this,null,e)}function Am(e,t,n){let a=e,r=t||[],i=n||[],o={},u=0;return{add:c=>i.push(c),remove:c=>o[a(c)]=++u,size:()=>r.length,data:(c,f)=>(u&&(r=r.filter((m=>!o[a(m)])),o={},u=0),f&&c&&r.sort(c),i.length&&(r=c?Bs(c,r,i.sort(c)):r.concat(i),i=[]),r)}}function Pf(e){Se.call(this,[],e)}function Tm(e){Yt.call(this,null,vy,e)}function vy(e){return this.value&&!e.modified()?this.value:Fl(e.fields,e.orders)}function Cm(e){Se.call(this,null,e)}function $f(e){Se.call(this,null,e)}Cc.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"]}]},Fe(Cc,Se,{transform(e,t){let n=e.interval!==!1,a=this._bins(e),r=a.start,i=a.step,o=e.as||["bin0","bin1"],u=o[0],c=o[1],f;return f=e.modified()?(t=t.reflow(!0)).SOURCE:t.modified(T(e.field))?t.ADD_MOD:t.ADD,t.visit(f,n?m=>{let g=a(m);m[u]=g,m[c]=g==null?null:r+i*(1+(g-r)/i)}:m=>m[u]=a(m)),t.modifies(n?o:u)},_bins(e){if(this.value&&!e.modified())return this.value;let t=e.field,n=cm(e),a=n.step,r,i,o=n.start,u=o+Math.ceil((n.stop-o)/a)*a;(r=e.anchor)!=null&&(i=r-(o+a*Math.floor((r-o)/a)),o+=i,u+=i);let c=function(f){let m=Le(t(f));return m==null?null:m<o?-1/0:m>u?1/0:(m=Math.max(o,Math.min(m,u-a)),o+a*Math.floor(1e-14+(m-o)/a))};return c.start=o,c.stop=n.stop,c.step=a,this.value=b(c,T(t),e.name||"bin_"+S(t))}}),Pf.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Fe(Pf,Se,{transform(e,t){let n=t.fork(t.ALL),a=Am(rt,this.value,n.materialize(n.ADD).add),r=e.sort,i=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,a.remove),this.modified(i),this.value=n.source=a.data(ls(r),i),t.source&&t.source.root&&(this.value.root=t.source.root),n}}),Fe(Tm,Yt),Cm.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"]}]},Fe(Cm,Se,{transform(e,t){let n=g=>v=>{for(var E,k=(function(O,I,B){switch(I){case"upper":O=O.toUpperCase();break;case"lower":O=O.toLowerCase()}return O.match(B)})(u(v),e.case,i)||[],_=0,N=k.length;_<N;++_)o.test(E=k[_])||g(E)},a=this._parameterCheck(e,t),r=this._counts,i=this._match,o=this._stop,u=e.field,c=e.as||["text","count"],f=n((g=>r[g]=1+(r[g]||0))),m=n((g=>r[g]-=1));return a?t.visit(t.SOURCE,f):(t.visit(t.ADD,f),t.visit(t.REM,m)),this._finish(t,c)},_parameterCheck(e,t){let n=!1;return!e.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),!e.modified("pattern")&&this._match||(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){let n=this._counts,a=this._tuples||(this._tuples={}),r=t[0],i=t[1],o=e.fork(e.NO_SOURCE|e.NO_FIELDS),u,c,f;for(u in n)c=a[u],f=n[u]||0,!c&&f?(a[u]=c=It({}),c[r]=u,c[i]=f,o.add.push(c)):f===0?(c&&o.rem.push(c),n[u]=null,a[u]=null):c[i]!==f&&(c[i]=f,o.mod.push(c));return o.modifies(t)}}),$f.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},Fe($f,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE),a=e.as||["a","b"],r=a[0],i=a[1],o=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter"),u=this.value;return o?(u&&(n.rem=u),u=t.materialize(t.SOURCE).source,n.add=this.value=(function(c,f,m,g){for(var v,E,k=[],_={},N=c.length,O=0;O<N;++O)for(_[f]=E=c[O],v=0;v<N;++v)_[m]=c[v],g(_)&&(k.push(It(_)),(_={})[f]=E);return k})(u,r,i,e.filter||Z)):n.mod=u,n.source=this.value,n.modifies(a)}});let Rm={kde:hm,mixture:If,normal:pm,lognormal:Nf,uniform:Df},Nm="distributions",Im="function",n1="field";function Ey(e,t){let n=e[Im];nt(Rm,n)||F("Unknown distribution function: "+n);let a=Rm[n]();for(let r in e)r===n1?a.data((e.from||t()).map(e[r])):r===Nm?a[r](e[r].map((i=>Ey(i,t)))):typeof a[r]===Im&&a[r](e[r]);return a}function Om(e){Se.call(this,null,e)}let wy=[{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}]}],a1={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:wy},{name:"weights",type:"number",array:!0}]};function _y(e,t){return e?e.map(((n,a)=>t[a]||S(n))):null}function Dm(e,t,n){let a=[],r=g=>g(c),i,o,u,c,f,m;if(t==null)a.push(e.map(n));else for(i={},o=0,u=e.length;o<u;++o)c=e[o],f=t.map(r),m=i[f],m||(i[f]=m=[],m.dims=f,a.push(m)),m.push(n(c));return a}Om.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:wy.concat(a1)},{name:"as",type:"string",array:!0,default:["value","density"]}]},Fe(Om,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let a=Ey(e.distribution,(function(f){return()=>f.materialize(f.SOURCE).source})(t)),r=e.steps||e.minsteps||25,i=e.steps||e.maxsteps||200,o=e.method||"pdf";o!=="pdf"&&o!=="cdf"&&F("Invalid density method: "+o),e.extent||a.data||F("Missing density extent parameter."),o=a[o];let u=e.as||["value","density"],c=Lf(o,e.extent||Un(a.data()),r,i).map((f=>{let m={};return m[u[0]]=f[0],m[u[1]]=f[1],It(m)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=c}return n}});function Mm(e){Se.call(this,null,e)}Mm.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 ky(e){Yt.call(this,null,r1,e),this.modified(!0)}function r1(e){let t=e.expr;return this.value&&!e.modified("expr")?this.value:b((n=>t(n,e)),T(t),S(t))}function Bf(e){Se.call(this,[void 0,void 0],e)}function Lm(e,t){Yt.call(this,e),this.parent=t,this.count=0}function Uf(e){Se.call(this,{},e),this._keys=da();let t=this._targets=[];t.active=0,t.forEach=n=>{for(let a=0,r=t.active;a<r;++a)n(t[a],a,t)}}function Sy(e){Yt.call(this,null,i1,e)}function i1(e){return this.value&&!e.modified()?this.value:Ee(e.name)?Ie(e.name).map((t=>W(t))):W(e.name,e.as)}function Fm(e){Se.call(this,da(),e)}function Pm(e){Se.call(this,[],e)}function zf(e){Se.call(this,[],e)}function Gf(e){Se.call(this,null,e)}function $m(e){Se.call(this,[],e)}Fe(Mm,Se,{transform(e,t){if(this.value&&!e.modified()&&!t.changed())return t;let n=t.materialize(t.SOURCE).source,a=Dm(t.source,e.groupby,ee),r=e.smooth||!1,i=e.field,o=e.step||((k,_)=>Jr(Un(k,_))/30)(n,i),u=ls(((k,_)=>i(k)-i(_))),c=e.as||"bin",f=a.length,m,g=1/0,v=-1/0,E=0;for(;E<f;++E){let k=a[E].sort(u);m=-1;for(let _ of Tf(k,o,r,i))_<g&&(g=_),_>v&&(v=_),k[++m][c]=_}return this.value={start:g,stop:v,step:o},t.reflow(!0).modifies(c)}}),Fe(ky,Yt),Bf.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},Fe(Bf,Se,{transform(e,t){let n=this.value,a=e.field,r=t.changed()||t.modified(a.fields)||e.modified("field"),i=n[0],o=n[1];if((r||i==null)&&(i=1/0,o=-1/0),t.visit(r?t.SOURCE:t.ADD,(u=>{let c=Le(a(u));c!=null&&(c<i&&(i=c),c>o&&(o=c))})),!Number.isFinite(i)||!Number.isFinite(o)){let u=S(a);u&&(u=` for field "${u}"`),t.dataflow.warn(`Infinite extent${u}: [${i}, ${o}]`),i=o=void 0}this.value=[i,o]}}),Fe(Lm,Yt,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}}),Fe(Uf,Se,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,a){let r=this.value,i,o,u=nt(r,e)&&r[e];return u?u.value.stamp<n.stamp&&(u.init(n),this.activate(u)):(o=a||(o=this._group[e])&&o.tuple,i=n.dataflow,u=new Lm(n.fork(n.NO_SOURCE),this),i.add(u).connect(t(i,e,o)),r[e]=u,this.activate(u)),u},clean(){let e=this.value,t=0;for(let n in e)if(e[n].count===0){let a=e[n].detachSubflow;a&&a(),delete e[n],++t}if(t){let n=this._targets.filter((a=>a&&a.count>0));this.initTargets(n)}},initTargets(e){let t=this._targets,n=t.length,a=e?e.length:0,r=0;for(;r<a;++r)t[r]=e[r];for(;r<n&&t[r]!=null;++r)t[r]=null;t.active=a},transform(e,t){let n=t.dataflow,a=e.key,r=e.subflow,i=this._keys,o=e.modified("key"),u=c=>this.subflow(c,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,(c=>{let f=rt(c),m=i.get(f);m!==void 0&&(i.delete(f),u(m).rem(c))})),t.visit(t.ADD,(c=>{let f=a(c);i.set(rt(c),f),u(f).add(c)})),o||t.modified(a.fields)?t.visit(t.MOD,(c=>{let f=rt(c),m=i.get(f),g=a(c);m===g?u(g).mod(c):(i.set(f,g),u(m).rem(c),u(g).add(c))})):t.changed(t.MOD)&&t.visit(t.MOD,(c=>{u(i.get(rt(c))).mod(c)})),o&&t.visit(t.REFLOW,(c=>{let f=rt(c),m=i.get(f),g=a(c);m!==g&&(i.set(f,g),u(m).rem(c),u(g).add(c))})),t.clean()?n.runAfter((()=>{this.clean(),i.clean()})):i.empty>n.cleanThreshold&&n.runAfter(i.clean),t}}),Fe(Sy,Yt),Fm.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},Fe(Fm,Se,{transform(e,t){let n=t.dataflow,a=this.value,r=t.fork(),i=r.add,o=r.rem,u=r.mod,c=e.expr,f=!0;function m(g){let v=rt(g),E=c(g,e),k=a.get(v);E&&k?(a.delete(v),i.push(g)):E||k?f&&E&&!k&&u.push(g):(a.set(v,1),o.push(g))}return t.visit(t.REM,(g=>{let v=rt(g);a.has(v)?a.delete(v):o.push(g)})),t.visit(t.ADD,(g=>{c(g,e)?i.push(g):a.set(rt(g),1)})),t.visit(t.MOD,m),e.modified()&&(f=!1,t.visit(t.REFLOW,m)),a.empty>n.cleanThreshold&&n.runAfter(a.clean),r}}),Pm.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}]},Fe(Pm,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE),a=e.fields,r=_y(a,e.as||[]),i=e.index||null,o=r.length;return n.rem=this.value,t.visit(t.SOURCE,(u=>{let c=a.map((k=>k(u))),f=c.reduce(((k,_)=>Math.max(k,_.length)),0),m,g,v,E=0;for(;E<f;++E){for(g=iu(u),m=0;m<o;++m)g[r[m]]=(v=c[m][E])==null?null:v;i&&(g[i]=E),n.add.push(g)}})),this.value=n.source=n.add,i&&n.modifies(i),n.modifies(r)}}),zf.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"]}]},Fe(zf,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE),a=e.fields,r=a.map(S),i=e.as||["key","value"],o=i[0],u=i[1],c=a.length;return n.rem=this.value,t.visit(t.SOURCE,(f=>{for(let m,g=0;g<c;++g)m=iu(f),m[o]=r[g],m[u]=a[g](f),n.add.push(m)})),this.value=n.source=n.add,n.modifies(i)}}),Gf.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},Fe(Gf,Se,{transform(e,t){let n=e.expr,a=e.as,r=e.modified(),i=e.initonly?t.ADD:r?t.SOURCE:t.modified(n.fields)||t.modified(a)?t.ADD_MOD:t.ADD;return r&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(a),t.visit(i,(o=>o[a]=n(o,e)))}}),Fe($m,Se,{transform(e,t){let n=t.fork(t.ALL),a=e.generator,r,i,o,u=this.value,c=e.size-u.length;if(c>0){for(r=[];--c>=0;)r.push(o=It(a(e))),u.push(o);n.add=n.add.length?n.materialize(n.ADD).add.concat(r):r}else i=u.slice(0,-c),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(i):i,u=u.slice(-c);return n.source=this.value=u,n}});let hu={value:"value",median:ec,mean:function(e,t){let n=0,a=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(++n,a+=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&(++n,a+=i)}if(n)return a/n},min:Ju,max:zs},Bm=[];function Um(e){Se.call(this,[],e)}function jf(e){Gi.call(this,e)}function zm(e){Se.call(this,null,e)}function xy(e){Yt.call(this,null,o1,e)}function o1(e){return this.value&&!e.modified()?this.value:Ai(e.fields,e.flat)}function Gm(e){Se.call(this,[],e),this._pending=null}function jm(e,t,n){n.forEach(It);let a=t.fork(t.NO_FIELDS&t.NO_SOURCE);return a.rem=e.value,e.value=a.source=a.add=n,e._pending=null,a.rem.length&&a.clean(!0),a}function Hf(e){Se.call(this,{},e)}function ji(e){Yt.call(this,null,Hi,e)}function Hi(e){if(this.value&&!e.modified())return this.value;let t=e.extents,n=t.length,a,r,i=1/0,o=-1/0;for(a=0;a<n;++a)r=t[a],r[0]<i&&(i=r[0]),r[1]>o&&(o=r[1]);return[i,o]}function Fr(e){Yt.call(this,null,Ay,e)}function Ay(e){return this.value&&!e.modified()?this.value:e.values.reduce(((t,n)=>t.concat(n)),[])}function Rc(e){Se.call(this,null,e)}function qi(e){Gi.call(this,e)}function Ty(e){Uf.call(this,e)}function fs(e){Se.call(this,null,e)}function mu(e){Se.call(this,null,e)}function qf(e){Se.call(this,null,e)}Um.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}]},Fe(Um,Se,{transform(e,t){var n,a,r,i,o,u,c,f,m,g,v=t.fork(t.ALL),E=(function(z){var q,Y=z.method||hu.value;if(hu[Y]!=null)return Y===hu.value?(q=z.value!==void 0?z.value:0,()=>q):hu[Y];F("Unrecognized imputation method: "+Y)})(e),k=(function(z){let q=z.field;return Y=>Y?q(Y):NaN})(e),_=S(e.field),N=S(e.key),O=(e.groupby||[]).map(S),I=(function(z,q,Y,K){var re,Q,ie,se,ue,fe,ve,we,Oe=ct=>ct(we),Ue=[],He=K?K.slice():[],De={},ut={};for(He.forEach(((ct,bt)=>De[ct]=bt+1)),se=0,ve=z.length;se<ve;++se)fe=Y(we=z[se]),ue=De[fe]||(De[fe]=He.push(fe)),(ie=ut[Q=(re=q?q.map(Oe):Bm)+""])||(ie=ut[Q]=[],Ue.push(ie),ie.values=re),ie[ue-1]=we;return Ue.domain=He,Ue})(t.source,e.groupby,e.key,e.keyvals),B=[],M=this.value,U=I.domain.length;for(o=0,f=I.length;o<f;++o)for(r=(n=I[o]).values,a=NaN,c=0;c<U;++c)if(n[c]==null){for(i=I.domain[c],g={_impute:!0},u=0,m=r.length;u<m;++u)g[O[u]]=r[u];g[N]=i,g[_]=Number.isNaN(a)?a=E(n,k):a,B.push(It(g))}return B.length&&(v.add=v.materialize(v.ADD).add.concat(B)),M.length&&(v.rem=v.materialize(v.REM).rem.concat(M)),this.value=B,v}}),jf.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:zi},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},Fe(jf,Gi,{transform(e,t){let n=this,a=e.modified(),r;return n.value&&(a||t.modified(n._inputs,!0))?(r=n.value=a?n.init(e):{},t.visit(t.SOURCE,(i=>n.add(i)))):(r=n.value=n.value||this.init(e),t.visit(t.REM,(i=>n.rem(i))),t.visit(t.ADD,(i=>n.add(i)))),n.changes(),t.visit(t.SOURCE,(i=>{mt(i,r[n.cellkey(i)].tuple)})),t.reflow(a).modifies(this._outputs)},changes(){let e=this._adds,t=this._mods,n,a;for(n=0,a=this._alen;n<a;++n)this.celltuple(e[n]),e[n]=null;for(n=0,a=this._mlen;n<a;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}}),zm.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"]}]},Fe(zm,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let a=t.materialize(t.SOURCE).source,r=Dm(a,e.groupby,e.field),i=(e.groupby||[]).map(S),o=e.bandwidth,u=e.cumulative?"cdf":"pdf",c=e.as||["value","density"],f=[],m=e.extent,g=e.steps||e.minsteps||25,v=e.steps||e.maxsteps||200;u!=="pdf"&&u!=="cdf"&&F("Invalid density method: "+u),e.resolve==="shared"&&(m||(m=Un(a,e.field)),g=v=e.steps||v),r.forEach((E=>{let k=hm(E,o)[u],_=e.counts?E.length:1;Lf(k,m||Un(E),g,v).forEach((N=>{let O={};for(let I=0;I<i.length;++I)O[i[I]]=E.dims[I];O[c[0]]=N[0],O[c[1]]=N[1]*_,f.push(It(O))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}}),Fe(xy,Yt),Fe(Gm,Se,{transform(e,t){let n=t.dataflow;return this._pending?jm(this,t,this._pending):(function(a){return a.modified("async")&&!(a.modified("values")||a.modified("url")||a.modified("format"))})(e)?t.StopPropagation:e.values?jm(this,t,n.parse(e.values,e.format)):e.async?{async:n.request(e.url,e.format).then((r=>(this._pending=Ie(r.data),i=>i.touch(this))))}:n.request(e.url,e.format).then((a=>jm(this,t,Ie(a.data))))}}),Hf.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}]},Fe(Hf,Se,{transform(e,t){let n=e.fields,a=e.index,r=e.values,i=e.default==null?null:e.default,o=e.modified(),u=n.length,c,f,m,g=o?t.SOURCE:t.ADD,v=t,E=e.as;return r?(f=r.length,u>1&&!E&&F('Multi-field lookup requires explicit "as" parameter.'),E&&E.length!==u*f&&F('The "as" parameter has too few output field names.'),E=E||r.map(S),c=function(k){for(var _,N,O=0,I=0;O<u;++O)if((N=a.get(n[O](k)))==null)for(_=0;_<f;++_,++I)k[E[I]]=i;else for(_=0;_<f;++_,++I)k[E[I]]=r[_](N)}):(E||F("Missing output field names."),c=function(k){for(var _,N=0;N<u;++N)_=a.get(n[N](k)),k[E[N]]=_??i}),o?v=t.reflow(!0):(m=n.some((k=>t.modified(k.fields))),g|=m?t.MOD:0),t.visit(g,c),v.modifies(E)}}),Fe(ji,Yt),Fe(Fr,Yt),Fe(Rc,Se,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),qi.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:zi,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},Fe(qi,Gi,{_transform:Gi.prototype.transform,transform(e,t){return this._transform((function(n,a){let r=n.field,i=n.value,o=(n.op==="count"?"__count__":n.op)||"sum",u=T(r).concat(T(i)),c=(function(f,m,g){let v={},E=[];return g.visit(g.SOURCE,(k=>{let _=f(k);v[_]||(v[_]=1,E.push(_))})),E.sort(Qt),m?E.slice(0,m):E})(r,n.limit||0,a);return a.changed()&&n.set("__pivot__",null,null,!0),{key:n.key,groupby:n.groupby,ops:c.map((()=>o)),fields:c.map((f=>(function(m,g,v,E){return b((k=>g(k)===m?v(k):NaN),E,m+"")})(f,r,i,u))),as:c.map((f=>f+"")),modified:n.modified.bind(n)}})(e,t),t)}}),Fe(Ty,Uf,{transform(e,t){let n=e.subflow,a=e.field,r=i=>this.subflow(rt(i),n,t,i);return(e.modified("field")||a&&t.modified(T(a)))&&F("PreFacet does not support field modification."),this.initTargets(),a?(t.visit(t.MOD,(i=>{let o=r(i);a(i).forEach((u=>o.mod(u)))})),t.visit(t.ADD,(i=>{let o=r(i);a(i).forEach((u=>o.add(It(u))))})),t.visit(t.REM,(i=>{let o=r(i);a(i).forEach((u=>o.rem(u)))}))):(t.visit(t.MOD,(i=>r(i).mod(i))),t.visit(t.ADD,(i=>r(i).add(i))),t.visit(t.REM,(i=>r(i).rem(i)))),t.clean()&&t.runAfter((()=>this.clean())),t}}),fs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},Fe(fs,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE),a=e.fields,r=_y(e.fields,e.as||[]),i=a?(u,c)=>(function(f,m,g,v){for(let E=0,k=g.length;E<k;++E)m[v[E]]=g[E](f);return m})(u,c,a,r):mc,o;return this.value?o=this.value:(t=t.addAll(),o=this.value={}),t.visit(t.REM,(u=>{let c=rt(u);n.rem.push(o[c]),o[c]=null})),t.visit(t.ADD,(u=>{let c=i(u,It({}));o[rt(u)]=c,n.add.push(c)})),t.visit(t.MOD,(u=>{n.mod.push(i(u,o[rt(u)]))})),n}}),Fe(mu,Se,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}}),qf.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 Eo(e){Se.call(this,null,e)}function Wf(e){Se.call(this,[],e),this.count=0}function Vf(e){Se.call(this,null,e)}function Yf(e){Se.call(this,null,e),this.modified(!0)}function nn(e){Se.call(this,null,e)}Fe(qf,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS),a=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;let r=Dm(t.materialize(t.SOURCE).source,e.groupby,e.field),i=(e.groupby||[]).map(S),o=[],u=e.step||.01,c=e.probs||Qn(u/2,1-1e-14,u),f=c.length;return r.forEach((m=>{let g=lm(m,c);for(let v=0;v<f;++v){let E={};for(let k=0;k<i.length;++k)E[i[k]]=m.dims[k];E[a[0]]=c[v],E[a[1]]=g[v],o.push(It(E))}})),this.value&&(n.rem=this.value),this.value=n.add=n.source=o,n}}),Fe(Eo,Se,{transform(e,t){let n,a;return this.value?a=this.value:(n=t=t.addAll(),a=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,(r=>{let i=rt(r);n.rem.push(a[i]),a[i]=null})),t.visit(t.ADD,(r=>{let i=iu(r);a[rt(r)]=i,n.add.push(i)})),t.visit(t.MOD,(r=>{let i=a[rt(r)];for(let o in r)i[o]=r[o],n.modifies(o);n.mod.push(i)}))),n}}),Wf.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},Fe(Wf,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE),a=e.modified("size"),r=e.size,i=this.value.reduce(((m,g)=>(m[rt(g)]=1,m)),{}),o=this.value,u=this.count,c=0;function f(m){let g,v;o.length<r?o.push(m):(v=~~((u+1)*p.random()),v<o.length&&v>=c&&(g=o[v],i[rt(g)]&&n.rem.push(g),o[v]=m)),++u}if(t.rem.length&&(t.visit(t.REM,(m=>{let g=rt(m);i[g]&&(i[g]=-1,n.rem.push(m)),--u})),o=o.filter((m=>i[rt(m)]!==-1))),(t.rem.length||a)&&o.length<r&&t.source&&(c=u=o.length,t.visit(t.SOURCE,(m=>{i[rt(m)]||f(m)})),c=-1),a&&o.length>r){let m=o.length-r;for(let g=0;g<m;++g)i[rt(o[g])]=-1,n.rem.push(o[g]);o=o.slice(m)}return t.mod.length&&t.visit(t.MOD,(m=>{i[rt(m)]&&n.mod.push(m)})),t.add.length&&t.visit(t.ADD,f),(t.add.length||c<0)&&(n.add=o.filter((m=>!i[rt(m)]))),this.count=u,this.value=n.source=o,n}}),Vf.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"}]},Fe(Vf,Se,{transform(e,t){if(this.value&&!e.modified())return;let n=t.materialize().fork(t.MOD),a=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Qn(e.start,e.stop,e.step||1).map((r=>{let i={};return i[a]=r,It(i)})),n.add=t.add.concat(this.value),n}}),Fe(Yf,Se,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});let Hm=["unit0","unit1"];function ps(e){Se.call(this,da(),e)}function Cy(e){Se.call(this,null,e)}nn.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Gd,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:Hm}]},Fe(nn,Se,{transform(e,t){let n=e.field,a=e.interval!==!1,r=e.timezone==="utc",i=this._floor(e,t),o=(r?Mr:as)(i.unit).offset,u=e.as||Hm,c=u[0],f=u[1],m=i.step,g=i.start||1/0,v=i.stop||-1/0,E=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(T(n)))&&(E=(t=t.reflow(!0)).SOURCE,g=1/0,v=-1/0),t.visit(E,(k=>{let _=n(k),N,O;_==null?(k[c]=null,a&&(k[f]=null)):(k[c]=N=O=i(_),a&&(k[f]=O=o(N,m)),N<g&&(g=N),O>v&&(v=O))})),i.start=g,i.stop=v,t.modifies(a?u:c)},_floor(e,t){let n=e.timezone==="utc",{units:a,step:r}=e.units?{units:e.units,step:e.step||1}:ai({extent:e.extent||Un(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),i=jd(a),o=this.value||{},u=(n?Yd:B0)(i,r);return u.unit=$e(i),u.units=i,u.step=r,u.start=o.start,u.stop=o.stop,this.value=u}}),Fe(ps,Se,{transform(e,t){let n=t.dataflow,a=e.field,r=this.value,i=u=>r.set(a(u),u),o=!0;return e.modified("field")||t.modified(a.fields)?(r.clear(),t.visit(t.SOURCE,i)):t.changed()?(t.visit(t.REM,(u=>r.delete(a(u)))),t.visit(t.ADD,i)):o=!1,this.modified(o),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}}),Fe(Cy,Se,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(ls(e.sort)):t.source).map(e.field))}});let Nc={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,a=t.data;return n&&t.compare(a[n-1],a[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{let n=t.index,a=t.data;return n&&t.compare(a[n-1],a[n])?++e:e}}},percent_rank:function(){let e=Nc.rank(),t=e.next;return{init:e.init,next:n=>(t(n)-1)/(n.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{let n=t.data,a=t.compare,r=t.index;if(e<r){for(;r+1<n.length&&!a(n[r],n[r+1]);)++r;e=r}return(1+e)/n.length}}},ntile:function(e,t){(t=+t)>0||F("ntile num must be greater than zero.");let n=Nc.cume_dist(),a=n.next;return{init:n.init,next:r=>Math.ceil(t*a(r))}},lag:function(e,t){return t=+t||1,{next:n=>{let a=n.index-t;return a>=0?e(n.data[a]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{let a=n.index+t,r=n.data;return a<r.length?e(r[a]):null}}},first_value:function(e){return{next:t=>e(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return(t=+t)>0||F("nth_value nth must be greater than zero."),{next:n=>{let a=n.i0+(t-1);return a<n.i1?e(n.data[a]):null}}},prev_value:function(e){let t;return{init:()=>t=null,next:n=>{let a=e(n.data[n.index]);return a!=null?t=a:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:a=>{let r=a.data;return a.index<=n?t:(n=(function(i,o,u){for(let c=o.length;u<c;++u)if(i(o[u])!=null)return u;return-1})(e,r,a.index))<0?(n=r.length,t=null):t=e(r[n])}}}},Ry=Object.keys(Nc);function Kf(e){let t=Ie(e.ops),n=Ie(e.fields),a=Ie(e.params),r=Ie(e.as),i=this.outputs=[],o=this.windows=[],u={},c={},f=[],m=[],g=!0;function v(E){Ie(T(E)).forEach((k=>u[k]=1))}v(e.sort),t.forEach(((E,k)=>{let _=n[k],N=S(_),O=Ff(E,N,r[k]);if(v(_),i.push(O),nt(Nc,E))o.push((function(I,B,M,U){let z=Nc[I](B,M);return{init:z.init||ne,update:function(q,Y){Y[U]=z.next(q)}}})(E,n[k],a[k],O));else{if(_==null&&E!=="count"&&F("Null aggregate field specified."),E==="count")return void f.push(O);g=!1;let I=c[N];I||(I=c[N]=[],I.field=_,m.push(I)),I.push(wm(E,O))}})),(f.length||m.length)&&(this.cell=(function(E,k,_){E=E.map((U=>Sm(U,U.field)));let N={num:0,agg:null,store:!1,count:k};if(!_)for(var O=E.length,I=N.agg=Array(O),B=0;B<O;++B)I[B]=new E[B](N);if(N.store)var M=N.data=new xm;return N.add=function(U){if(N.num+=1,!_){M&&M.add(U);for(let z=0;z<O;++z)I[z].add(I[z].get(U),U)}},N.rem=function(U){if(N.num-=1,!_){M&&M.rem(U);for(let z=0;z<O;++z)I[z].rem(I[z].get(U),U)}},N.set=function(U){let z,q;for(M&&M.values(),z=0,q=k.length;z<q;++z)U[k[z]]=N.num;if(!_)for(z=0,q=I.length;z<q;++z)I[z].set(U)},N.init=function(){N.num=0,M&&M.reset();for(let U=0;U<O;++U)I[U].init()},N})(m,f,g)),this.inputs=Object.keys(u)}let qt=Kf.prototype;function ia(e){Se.call(this,{},e),this._mlen=0,this._mods=[]}function qm(e,t,n,a){let r=a.sort,i=r&&!a.ignorePeers,o=a.frame||[null,0],u=e.data(n),c=u.length,f=i?sr(r):null,m={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:r||mn(-1)};t.init();for(let g=0;g<c;++g)Ny(m,o,g,c),i&&Wi(m,f),t.update(m,u[g])}function Ny(e,t,n,a){e.p0=e.i0,e.p1=e.i1,e.i0=t[0]==null?0:Math.max(0,n-Math.abs(t[0])),e.i1=t[1]==null?a:Math.min(a,n+Math.abs(t[1])+1),e.index=n}function Wi(e,t){let n=e.i0,a=e.i1-1,r=e.compare,i=e.data,o=i.length-1;n>0&&!r(i[n],i[n-1])&&(e.i0=t.left(i,i[n])),a<o&&!r(i[a],i[a+1])&&(e.i1=t.right(i,i[a]))}qt.init=function(){this.windows.forEach((e=>e.init())),this.cell&&this.cell.init()},qt.update=function(e,t){let n=this.cell,a=this.windows,r=e.data,i=a&&a.length,o;if(n){for(o=e.p0;o<e.i0;++o)n.rem(r[o]);for(o=e.p1;o<e.i1;++o)n.add(r[o]);n.set(t)}for(o=0;o<i;++o)a[o].update(e,t)},ia.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ry.concat(zi)},{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}]},Fe(ia,Se,{transform(e,t){this.stamp=t.stamp;let n=e.modified(),a=ls(e.sort),r=pu(e.groupby),i=u=>this.group(r(u)),o=this.state;o&&!n||(o=this.state=new Kf(e)),n||t.modified(o.inputs)?(this.value={},t.visit(t.SOURCE,(u=>i(u).add(u)))):(t.visit(t.REM,(u=>i(u).remove(u))),t.visit(t.ADD,(u=>i(u).add(u))));for(let u=0,c=this._mlen;u<c;++u)qm(this._mods[u],o,a,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(o.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=Am(rt),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}});var Xf=Object.freeze({__proto__:null,aggregate:Gi,bin:Cc,collect:Pf,compare:Tm,countpattern:Cm,cross:$f,density:Om,dotbin:Mm,expression:ky,extent:Bf,facet:Uf,field:Sy,filter:Fm,flatten:Pm,fold:zf,formula:Gf,generate:$m,impute:Um,joinaggregate:jf,kde:zm,key:xy,load:Gm,lookup:Hf,multiextent:ji,multivalues:Fr,params:Rc,pivot:qi,prefacet:Ty,project:fs,proxy:mu,quantile:qf,relay:Eo,sample:Wf,sequence:Vf,sieve:Yf,subflow:Lm,timeunit:nn,tupleindex:ps,values:Cy,window:ia});function $t(e){return function(){return e}}let Wm=Math.abs,oa=Math.atan2,hs=Math.cos,Ic=Math.max,Vm=Math.min,Vi=Math.sin,Ra=Math.sqrt,qn=1e-12,nl=Math.PI,wo=nl/2,Ym=2*nl;function gu(e){return e>=1?wo:e<=-1?-wo:Math.asin(e)}let Zf=Math.PI,Km=2*Zf,al=1e-6,bu=Km-al;function Jf(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}let yu=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?Jf:(function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return Jf;let a=10**n;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*a)/a+r[i]}})(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,a){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+a}`}bezierCurveTo(e,t,n,a,r,i){this._append`C${+e},${+t},${+n},${+a},${this._x1=+r},${this._y1=+i}`}arcTo(e,t,n,a,r){if(e=+e,t=+t,n=+n,a=+a,(r=+r)<0)throw new Error(`negative radius: ${r}`);let i=this._x1,o=this._y1,u=n-e,c=a-t,f=i-e,m=o-t,g=f*f+m*m;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(g>al)if(Math.abs(m*u-c*f)>al&&r){let v=n-i,E=a-o,k=u*u+c*c,_=v*v+E*E,N=Math.sqrt(k),O=Math.sqrt(g),I=r*Math.tan((Zf-Math.acos((k+g-_)/(2*N*O)))/2),B=I/O,M=I/N;Math.abs(B-1)>al&&this._append`L${e+B*f},${t+B*m}`,this._append`A${r},${r},0,0,${+(m*v>f*E)},${this._x1=e+M*u},${this._y1=t+M*c}`}else this._append`L${this._x1=e},${this._y1=t}`}arc(e,t,n,a,r,i){if(e=+e,t=+t,i=!!i,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(a),u=n*Math.sin(a),c=e+o,f=t+u,m=1^i,g=i?a-r:r-a;this._x1===null?this._append`M${c},${f}`:(Math.abs(this._x1-c)>al||Math.abs(this._y1-f)>al)&&this._append`L${c},${f}`,n&&(g<0&&(g=g%Km+Km),g>bu?this._append`A${n},${n},0,1,${m},${e-o},${t-u}A${n},${n},0,1,${m},${this._x1=c},${this._y1=f}`:g>al&&this._append`A${n},${n},0,${+(g>=Zf)},${m},${this._x1=e+n*Math.cos(r)},${this._y1=t+n*Math.sin(r)}`)}rect(e,t,n,a){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}};function Oc(){return new yu}function Dc(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let a=Math.floor(n);if(!(a>=0))throw new RangeError(`invalid digits: ${n}`);t=a}return e},()=>new yu(t)}function Iy(e){return e.innerRadius}function s1(e){return e.outerRadius}function l1(e){return e.startAngle}function u1(e){return e.endAngle}function Wn(e){return e&&e.padAngle}function Mc(e,t,n,a,r,i,o){var u=e-n,c=t-a,f=(o?i:-i)/Ra(u*u+c*c),m=f*c,g=-f*u,v=e+m,E=t+g,k=n+m,_=a+g,N=(v+k)/2,O=(E+_)/2,I=k-v,B=_-E,M=I*I+B*B,U=r-i,z=v*_-k*E,q=(B<0?-1:1)*Ra(Ic(0,U*U*M-z*z)),Y=(z*B-I*q)/M,K=(-z*I-B*q)/M,re=(z*B+I*q)/M,Q=(-z*I+B*q)/M,ie=Y-N,se=K-O,ue=re-N,fe=Q-O;return ie*ie+se*se>ue*ue+fe*fe&&(Y=re,K=Q),{cx:Y,cy:K,x01:-m,y01:-g,x11:Y*(r/U-1),y11:K*(r/U-1)}}function Oy(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vu(e){this._context=e}function Vn(e){return new vu(e)}function Qf(e){return e[0]}function Dy(e){return e[1]}function My(e,t){var n=$t(!0),a=null,r=Vn,i=null,o=Dc(u);function u(c){var f,m,g,v=(c=Oy(c)).length,E=!1;for(a==null&&(i=r(g=o())),f=0;f<=v;++f)!(f<v&&n(m=c[f],f,c))===E&&((E=!E)?i.lineStart():i.lineEnd()),E&&i.point(+e(m,f,c),+t(m,f,c));if(g)return i=null,g+""||null}return e=typeof e=="function"?e:e===void 0?Qf:$t(e),t=typeof t=="function"?t:t===void 0?Dy:$t(t),u.x=function(c){return arguments.length?(e=typeof c=="function"?c:$t(+c),u):e},u.y=function(c){return arguments.length?(t=typeof c=="function"?c:$t(+c),u):t},u.defined=function(c){return arguments.length?(n=typeof c=="function"?c:$t(!!c),u):n},u.curve=function(c){return arguments.length?(r=c,a!=null&&(i=r(a)),u):r},u.context=function(c){return arguments.length?(c==null?a=i=null:i=r(a=c),u):a},u}function Xm(e,t,n){var a=null,r=$t(!0),i=null,o=Vn,u=null,c=Dc(f);function f(g){var v,E,k,_,N,O=(g=Oy(g)).length,I=!1,B=new Array(O),M=new Array(O);for(i==null&&(u=o(N=c())),v=0;v<=O;++v){if(!(v<O&&r(_=g[v],v,g))===I)if(I=!I)E=v,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),k=v-1;k>=E;--k)u.point(B[k],M[k]);u.lineEnd(),u.areaEnd()}I&&(B[v]=+e(_,v,g),M[v]=+t(_,v,g),u.point(a?+a(_,v,g):B[v],n?+n(_,v,g):M[v]))}if(N)return u=null,N+""||null}function m(){return My().defined(r).curve(o).context(i)}return e=typeof e=="function"?e:e===void 0?Qf:$t(+e),t=typeof t=="function"?t:$t(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Dy:$t(+n),f.x=function(g){return arguments.length?(e=typeof g=="function"?g:$t(+g),a=null,f):e},f.x0=function(g){return arguments.length?(e=typeof g=="function"?g:$t(+g),f):e},f.x1=function(g){return arguments.length?(a=g==null?null:typeof g=="function"?g:$t(+g),f):a},f.y=function(g){return arguments.length?(t=typeof g=="function"?g:$t(+g),n=null,f):t},f.y0=function(g){return arguments.length?(t=typeof g=="function"?g:$t(+g),f):t},f.y1=function(g){return arguments.length?(n=g==null?null:typeof g=="function"?g:$t(+g),f):n},f.lineX0=f.lineY0=function(){return m().x(e).y(t)},f.lineY1=function(){return m().x(e).y(n)},f.lineX1=function(){return m().x(a).y(t)},f.defined=function(g){return arguments.length?(r=typeof g=="function"?g:$t(!!g),f):r},f.curve=function(g){return arguments.length?(o=g,i!=null&&(u=o(i)),f):o},f.context=function(g){return arguments.length?(g==null?i=u=null:u=o(i=g),f):i},f}Oc.prototype=yu.prototype,vu.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};var ep={draw(e,t){let n=Ra(t/nl);e.moveTo(n,0),e.arc(0,0,n,0,Ym)}};function _o(){}function rl(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function li(e){this._context=e}function Ly(e){this._context=e}function Zm(e){this._context=e}function Jm(e,t){this._basis=new li(e),this._beta=t}li.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:rl(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Ly.prototype={areaStart:_o,areaEnd:_o,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Zm.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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+e)/6,a=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,a):this._context.moveTo(n,a);break;case 3:this._point=4;default:rl(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}},Jm.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var a,r=e[0],i=t[0],o=e[n]-r,u=t[n]-i,c=-1;++c<=n;)a=c/n,this._basis.point(this._beta*e[c]+(1-this._beta)*(r+a*o),this._beta*t[c]+(1-this._beta)*(i+a*u));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var c1=(function e(t){function n(a){return t===1?new li(a):new Jm(a,t)}return n.beta=function(a){return e(+a)},n})(.85);function Na(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function tp(e,t){this._context=e,this._k=(1-t)/6}tp.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:Na(this,this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Na(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var d1=(function e(t){function n(a){return new tp(a,t)}return n.tension=function(a){return e(+a)},n})(0);function Lc(e,t){this._context=e,this._k=(1-t)/6}Lc.prototype={areaStart:_o,areaEnd:_o,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Na(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Fy=(function e(t){function n(a){return new Lc(a,t)}return n.tension=function(a){return e(+a)},n})(0);function Fc(e,t){this._context=e,this._k=(1-t)/6}Fc.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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:Na(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Py=(function e(t){function n(a){return new Fc(a,t)}return n.tension=function(a){return e(+a)},n})(0);function np(e,t,n){var a=e._x1,r=e._y1,i=e._x2,o=e._y2;if(e._l01_a>qn){var u=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);a=(a*u-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,r=(r*u-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>qn){var f=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,m=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*f+e._x1*e._l23_2a-t*e._l12_2a)/m,o=(o*f+e._y1*e._l23_2a-n*e._l12_2a)/m}e._context.bezierCurveTo(a,r,i,o,e._x2,e._y2)}function Pc(e,t){this._context=e,this._alpha=t}Pc.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||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,a=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+a*a,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:np(this,e,t)}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var $y=(function e(t){function n(a){return t?new Pc(a,t):new tp(a,0)}return n.alpha=function(a){return e(+a)},n})(.5);function By(e,t){this._context=e,this._alpha=t}By.prototype={areaStart:_o,areaEnd:_o,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(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,a=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+a*a,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:np(this,e,t)}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Uy=(function e(t){function n(a){return t?new By(a,t):new Lc(a,0)}return n.alpha=function(a){return e(+a)},n})(.5);function Qm(e,t){this._context=e,this._alpha=t}Qm.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,a=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+a*a,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:np(this,e,t)}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var zy=(function e(t){function n(a){return t?new Qm(a,t):new Fc(a,0)}return n.alpha=function(a){return e(+a)},n})(.5);function Gy(e){this._context=e}function eg(e){return e<0?-1:1}function tg(e,t,n){var a=e._x1-e._x0,r=t-e._x1,i=(e._y1-e._y0)/(a||r<0&&-0),o=(n-e._y1)/(r||a<0&&-0),u=(i*r+o*a)/(a+r);return(eg(i)+eg(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(u))||0}function ng(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ag(e,t,n){var a=e._x0,r=e._y0,i=e._x1,o=e._y1,u=(i-a)/3;e._context.bezierCurveTo(a+u,r+u*t,i-u,o-u*n,i,o)}function $c(e){this._context=e}function ms(e){this._context=new ko(e)}function ko(e){this._context=e}function jy(e){this._context=e}function rg(e){var t,n,a=e.length-1,r=new Array(a),i=new Array(a),o=new Array(a);for(r[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<a-1;++t)r[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(r[a-1]=2,i[a-1]=7,o[a-1]=8*e[a-1]+e[a],t=1;t<a;++t)n=r[t]/i[t-1],i[t]-=n,o[t]-=n*o[t-1];for(r[a-1]=o[a-1]/i[a-1],t=a-2;t>=0;--t)r[t]=(o[t]-r[t+1])/i[t];for(i[a-1]=(e[a]+r[a-1])/2,t=0;t<a-1;++t)i[t]=2*e[t+1]-r[t+1];return[r,i]}function il(e,t){this._context=e,this._t=t}function Wa(e,t){if(typeof document<"u"&&document.createElement){let n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}Gy.prototype={areaStart:_o,areaEnd:_o,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}},$c.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:ag(this,this._t0,ng(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(t=+t,(e=+e)!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ag(this,ng(this,n=tg(this,e,t)),n);break;default:ag(this,this._t0,n=tg(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}},(ms.prototype=Object.create($c.prototype)).point=function(e,t){$c.prototype.point.call(this,t,e)},ko.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,a,r,i){this._context.bezierCurveTo(t,e,a,n,i,r)}},jy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var a=rg(e),r=rg(t),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(a[0][i],r[0][i],a[1][i],r[1][i],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}},il.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&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};let ig=()=>typeof Image<"u"?Image:null;function ui(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function Yi(e,t){switch(arguments.length){case 0:break;case 1:typeof e=="function"?this.interpolator(e):this.range(e);break;default:this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t)}return this}let ap=Symbol("implicit");function rp(){var e=new E_,t=[],n=[],a=ap;function r(i){let o=e.get(i);if(o===void 0){if(a!==ap)return a;e.set(i,o=t.push(i)-1)}return n[o%n.length]}return r.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new E_;for(let o of i)e.has(o)||e.set(o,t.push(o)-1);return r},r.range=function(i){return arguments.length?(n=Array.from(i),r):n.slice()},r.unknown=function(i){return arguments.length?(a=i,r):a},r.copy=function(){return rp(t,n).unknown(a)},ui.apply(r,arguments),r}function ci(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Eu(e,t){var n=Object.create(e.prototype);for(var a in t)n[a]=t[a];return n}function So(){}var Ki=.7,gs=1/Ki,Xi="\\s*([+-]?\\d+)\\s*",wu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",di="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",f1=/^#([0-9a-f]{3,8})$/,og=new RegExp(`^rgb\\(${Xi},${Xi},${Xi}\\)$`),Hy=new RegExp(`^rgb\\(${di},${di},${di}\\)$`),sg=new RegExp(`^rgba\\(${Xi},${Xi},${Xi},${wu}\\)$`),qy=new RegExp(`^rgba\\(${di},${di},${di},${wu}\\)$`),Wy=new RegExp(`^hsl\\(${wu},${di},${di}\\)$`),Vy=new RegExp(`^hsla\\(${wu},${di},${di},${wu}\\)$`),ol={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 sl(){return this.rgb().formatHex()}function Bc(){return this.rgb().formatRgb()}function Zi(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=f1.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Uc(t):n===3?new Mn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):n===8?_u(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):n===4?_u(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=og.exec(e))?new Mn(t[1],t[2],t[3],1):(t=Hy.exec(e))?new Mn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=sg.exec(e))?_u(t[1],t[2],t[3],t[4]):(t=qy.exec(e))?_u(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Wy.exec(e))?Ky(t[1],t[2]/100,t[3]/100,1):(t=Vy.exec(e))?Ky(t[1],t[2]/100,t[3]/100,t[4]):ol.hasOwnProperty(e)?Uc(ol[e]):e==="transparent"?new Mn(NaN,NaN,NaN,0):null}function Uc(e){return new Mn(e>>16&255,e>>8&255,255&e,1)}function _u(e,t,n,a){return a<=0&&(e=t=n=NaN),new Mn(e,t,n,a)}function zc(e){return e instanceof So||(e=Zi(e)),e?new Mn((e=e.rgb()).r,e.g,e.b,e.opacity):new Mn}function bs(e,t,n,a){return arguments.length===1?zc(e):new Mn(e,t,n,a??1)}function Mn(e,t,n,a){this.r=+e,this.g=+t,this.b=+n,this.opacity=+a}function lg(){return`#${ll(this.r)}${ll(this.g)}${ll(this.b)}`}function Yy(){let e=ip(this.opacity);return`${e===1?"rgb(":"rgba("}${xo(this.r)}, ${xo(this.g)}, ${xo(this.b)}${e===1?")":`, ${e})`}`}function ip(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function xo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ll(e){return((e=xo(e))<16?"0":"")+e.toString(16)}function Ky(e,t,n,a){return a<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new pr(e,t,n,a)}function Xy(e){if(e instanceof pr)return new pr(e.h,e.s,e.l,e.opacity);if(e instanceof So||(e=Zi(e)),!e)return new pr;if(e instanceof pr)return e;var t=(e=e.rgb()).r/255,n=e.g/255,a=e.b/255,r=Math.min(t,n,a),i=Math.max(t,n,a),o=NaN,u=i-r,c=(i+r)/2;return u?(o=t===i?(n-a)/u+6*(n<a):n===i?(a-t)/u+2:(t-n)/u+4,u/=c<.5?i+r:2-i-r,o*=60):u=c>0&&c<1?0:o,new pr(o,u,c,e.opacity)}function Gc(e,t,n,a){return arguments.length===1?Xy(e):new pr(e,t,n,a??1)}function pr(e,t,n,a){this.h=+e,this.s=+t,this.l=+n,this.opacity=+a}function jc(e){return(e=(e||0)%360)<0?e+360:e}function Hc(e){return Math.max(0,Math.min(1,e||0))}function op(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}ci(So,Zi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:sl,formatHex:sl,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Xy(this).formatHsl()},formatRgb:Bc,toString:Bc}),ci(Mn,bs,Eu(So,{brighter(e){return e=e==null?gs:Math.pow(gs,e),new Mn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ki:Math.pow(Ki,e),new Mn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Mn(xo(this.r),xo(this.g),xo(this.b),ip(this.opacity))},displayable(){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:lg,formatHex:lg,formatHex8:function(){return`#${ll(this.r)}${ll(this.g)}${ll(this.b)}${ll(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Yy,toString:Yy})),ci(pr,Gc,Eu(So,{brighter(e){return e=e==null?gs:Math.pow(gs,e),new pr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ki:Math.pow(Ki,e),new pr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,a=n+(n<.5?n:1-n)*t,r=2*n-a;return new Mn(op(e>=240?e-240:e+120,r,a),op(e,r,a),op(e<120?e+240:e-120,r,a),this.opacity)},clamp(){return new pr(jc(this.h),Hc(this.s),Hc(this.l),ip(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=ip(this.opacity);return`${e===1?"hsl(":"hsla("}${jc(this.h)}, ${100*Hc(this.s)}%, ${100*Hc(this.l)}%${e===1?")":`, ${e})`}`}}));let ug=Math.PI/180,cg=180/Math.PI,dg=.96422,sp=1,fg=.82521,Zy=4/29,ul=6/29,pg=3*ul*ul,hg=ul*ul*ul;function mg(e){if(e instanceof fi)return new fi(e.l,e.a,e.b,e.opacity);if(e instanceof Ao)return yg(e);e instanceof Mn||(e=zc(e));var t,n,a=up(e.r),r=up(e.g),i=up(e.b),o=gg((.2225045*a+.7168786*r+.0606169*i)/sp);return a===r&&r===i?t=n=o:(t=gg((.4360747*a+.3850649*r+.1430804*i)/dg),n=gg((.0139322*a+.0971045*r+.7141733*i)/fg)),new fi(116*o-16,500*(t-o),200*(o-n),e.opacity)}function qc(e,t,n,a){return arguments.length===1?mg(e):new fi(e,t,n,a??1)}function fi(e,t,n,a){this.l=+e,this.a=+t,this.b=+n,this.opacity=+a}function gg(e){return e>hg?Math.pow(e,1/3):e/pg+Zy}function bg(e){return e>ul?e*e*e:pg*(e-Zy)}function lp(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function up(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function cp(e,t,n,a){return arguments.length===1?(function(r){if(r instanceof Ao)return new Ao(r.h,r.c,r.l,r.opacity);if(r instanceof fi||(r=mg(r)),r.a===0&&r.b===0)return new Ao(NaN,0<r.l&&r.l<100?0:NaN,r.l,r.opacity);var i=Math.atan2(r.b,r.a)*cg;return new Ao(i<0?i+360:i,Math.sqrt(r.a*r.a+r.b*r.b),r.l,r.opacity)})(e):new Ao(e,t,n,a??1)}function Ao(e,t,n,a){this.h=+e,this.c=+t,this.l=+n,this.opacity=+a}function yg(e){if(isNaN(e.h))return new fi(e.l,0,0,e.opacity);var t=e.h*ug;return new fi(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}ci(fi,qc,Eu(So,{brighter(e){return new fi(this.l+18*(e??1),this.a,this.b,this.opacity)},darker(e){return new fi(this.l-18*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return new Mn(lp(3.1338561*(t=dg*bg(t))-1.6168667*(e=sp*bg(e))-.4906146*(n=fg*bg(n))),lp(-.9787684*t+1.9161415*e+.033454*n),lp(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}})),ci(Ao,cp,Eu(So,{brighter(e){return new Ao(this.h,this.c,this.l+18*(e??1),this.opacity)},darker(e){return new Ao(this.h,this.c,this.l-18*(e??1),this.opacity)},rgb(){return yg(this).rgb()}}));var Jy=-.14861,dp=1.78277,vg=-.29227,Wc=-.90649,Vc=1.97294,Eg=Vc*Wc,wg=Vc*dp,Qy=dp*vg-Wc*Jy;function fp(e,t,n,a){return arguments.length===1?(function(r){if(r instanceof To)return new To(r.h,r.s,r.l,r.opacity);r instanceof Mn||(r=zc(r));var i=r.r/255,o=r.g/255,u=r.b/255,c=(Qy*u+Eg*i-wg*o)/(Qy+Eg-wg),f=u-c,m=(Vc*(o-c)-vg*f)/Wc,g=Math.sqrt(m*m+f*f)/(Vc*c*(1-c)),v=g?Math.atan2(m,f)*cg-120:NaN;return new To(v<0?v+360:v,g,c,r.opacity)})(e):new To(e,t,n,a??1)}function To(e,t,n,a){this.h=+e,this.s=+t,this.l=+n,this.opacity=+a}function _g(e,t,n,a,r){var i=e*e,o=i*e;return((1-3*e+3*i-o)*t+(4-6*i+3*o)*n+(1+3*e+3*i-3*o)*a+o*r)/6}function pi(e){var t=e.length-1;return function(n){var a=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[a],i=e[a+1],o=a>0?e[a-1]:2*r-i,u=a<t-1?e[a+2]:2*i-r;return _g((n-a/t)*t,o,r,i,u)}}function ev(e){var t=e.length;return function(n){var a=Math.floor(((n%=1)<0?++n:n)*t),r=e[(a+t-1)%t],i=e[a%t],o=e[(a+1)%t],u=e[(a+2)%t];return _g((n-a/t)*t,r,i,o,u)}}ci(To,fp,Eu(So,{brighter(e){return e=e==null?gs:Math.pow(gs,e),new To(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ki:Math.pow(Ki,e),new To(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*ug,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),a=Math.cos(e),r=Math.sin(e);return new Mn(255*(t+n*(Jy*a+dp*r)),255*(t+n*(vg*a+Wc*r)),255*(t+n*(Vc*a)),this.opacity)}}));var Va=e=>()=>e;function cl(e,t){return function(n){return e+n*t}}function Yc(e,t){var n=t-e;return n?cl(e,n>180||n<-180?n-360*Math.round(n/360):n):Va(isNaN(e)?t:e)}function p1(e){return(e=+e)==1?Yn:function(t,n){return n-t?(function(a,r,i){return a=Math.pow(a,i),r=Math.pow(r,i)-a,i=1/i,function(o){return Math.pow(a+o*r,i)}})(t,n,e):Va(isNaN(t)?n:t)}}function Yn(e,t){var n=t-e;return n?cl(e,n):Va(isNaN(e)?t:e)}var Kn=(function e(t){var n=p1(t);function a(r,i){var o=n((r=bs(r)).r,(i=bs(i)).r),u=n(r.g,i.g),c=n(r.b,i.b),f=Yn(r.opacity,i.opacity);return function(m){return r.r=o(m),r.g=u(m),r.b=c(m),r.opacity=f(m),r+""}}return a.gamma=e,a})(1);function Co(e){return function(t){var n,a,r=t.length,i=new Array(r),o=new Array(r),u=new Array(r);for(n=0;n<r;++n)a=bs(t[n]),i[n]=a.r||0,o[n]=a.g||0,u[n]=a.b||0;return i=e(i),o=e(o),u=e(u),a.opacity=1,function(c){return a.r=i(c),a.g=o(c),a.b=u(c),a+""}}}var Kc=Co(pi),Xc=Co(ev);function Ro(e,t){t||(t=[]);var n,a=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<a;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function pp(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Zc(e,t){var n,a=t?t.length:0,r=e?Math.min(a,e.length):0,i=new Array(r),o=new Array(a);for(n=0;n<r;++n)i[n]=ys(e[n],t[n]);for(;n<a;++n)o[n]=t[n];return function(u){for(n=0;n<r;++n)o[n]=i[n](u);return o}}function hp(e,t){var n=new Date;return e=+e,t=+t,function(a){return n.setTime(e*(1-a)+t*a),n}}function sa(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mp(e,t){var n,a={},r={};for(n in e!==null&&typeof e=="object"||(e={}),t!==null&&typeof t=="object"||(t={}),t)n in e?a[n]=ys(e[n],t[n]):r[n]=t[n];return function(i){for(n in a)r[n]=a[n](i);return r}}var kg=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sg=new RegExp(kg.source,"g");function tv(e,t){var n,a,r,i=kg.lastIndex=Sg.lastIndex=0,o=-1,u=[],c=[];for(e+="",t+="";(n=kg.exec(e))&&(a=Sg.exec(t));)(r=a.index)>i&&(r=t.slice(i,r),u[o]?u[o]+=r:u[++o]=r),(n=n[0])===(a=a[0])?u[o]?u[o]+=a:u[++o]=a:(u[++o]=null,c.push({i:o,x:sa(n,a)})),i=Sg.lastIndex;return i<t.length&&(r=t.slice(i),u[o]?u[o]+=r:u[++o]=r),u.length<2?c[0]?(function(f){return function(m){return f(m)+""}})(c[0].x):(function(f){return function(){return f}})(t):(t=c.length,function(f){for(var m,g=0;g<t;++g)u[(m=c[g]).i]=m.x(f);return u.join("")})}function ys(e,t){var n,a=typeof t;return t==null||a==="boolean"?Va(t):(a==="number"?sa:a==="string"?(n=Zi(t))?(t=n,Kn):tv:t instanceof Zi?Kn:t instanceof Date?hp:pp(t)?Ro:Array.isArray(t)?Zc:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?mp:sa)(e,t)}function Jc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var gp,nv=180/Math.PI,xg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function av(e,t,n,a,r,i){var o,u,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*a)&&(n-=e*c,a-=t*c),(u=Math.sqrt(n*n+a*a))&&(n/=u,a/=u,c/=u),e*a<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*nv,skewX:Math.atan(c)*nv,scaleX:o,scaleY:u}}function rv(e,t,n,a){function r(i){return i.length?i.pop()+" ":""}return function(i,o){var u=[],c=[];return i=e(i),o=e(o),(function(f,m,g,v,E,k){if(f!==g||m!==v){var _=E.push("translate(",null,t,null,n);k.push({i:_-4,x:sa(f,g)},{i:_-2,x:sa(m,v)})}else(g||v)&&E.push("translate("+g+t+v+n)})(i.translateX,i.translateY,o.translateX,o.translateY,u,c),(function(f,m,g,v){f!==m?(f-m>180?m+=360:m-f>180&&(f+=360),v.push({i:g.push(r(g)+"rotate(",null,a)-2,x:sa(f,m)})):m&&g.push(r(g)+"rotate("+m+a)})(i.rotate,o.rotate,u,c),(function(f,m,g,v){f!==m?v.push({i:g.push(r(g)+"skewX(",null,a)-2,x:sa(f,m)}):m&&g.push(r(g)+"skewX("+m+a)})(i.skewX,o.skewX,u,c),(function(f,m,g,v,E,k){if(f!==g||m!==v){var _=E.push(r(E)+"scale(",null,",",null,")");k.push({i:_-4,x:sa(f,g)},{i:_-2,x:sa(m,v)})}else g===1&&v===1||E.push(r(E)+"scale("+g+","+v+")")})(i.scaleX,i.scaleY,o.scaleX,o.scaleY,u,c),i=o=null,function(f){for(var m,g=-1,v=c.length;++g<v;)u[(m=c[g]).i]=m.x(f);return u.join("")}}}var h1=rv((function(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?xg:av(t.a,t.b,t.c,t.d,t.e,t.f)}),"px, ","px)","deg)"),dl=rv((function(e){return e==null?xg:(gp||(gp=document.createElementNS("http://www.w3.org/2000/svg","g")),gp.setAttribute("transform",e),(e=gp.transform.baseVal.consolidate())?av((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):xg)}),", ",")",")"),No=1e-12;function fl(e){return((e=Math.exp(e))+1/e)/2}var Ag=(function e(t,n,a){function r(i,o){var u,c,f=i[0],m=i[1],g=i[2],v=o[0],E=o[1],k=o[2],_=v-f,N=E-m,O=_*_+N*N;if(O<No)c=Math.log(k/g)/t,u=function(q){return[f+q*_,m+q*N,g*Math.exp(t*q*c)]};else{var I=Math.sqrt(O),B=(k*k-g*g+a*O)/(2*g*n*I),M=(k*k-g*g-a*O)/(2*k*n*I),U=Math.log(Math.sqrt(B*B+1)-B),z=Math.log(Math.sqrt(M*M+1)-M);c=(z-U)/t,u=function(q){var Y=q*c,K=fl(U),re=g/(n*I)*(K*(function(Q){return((Q=Math.exp(2*Q))-1)/(Q+1)})(t*Y+U)-(function(Q){return((Q=Math.exp(Q))-1/Q)/2})(U));return[f+re*_,m+re*N,g*K/fl(t*Y+U)]}}return u.duration=1e3*c*t/Math.SQRT2,u}return r.rho=function(i){var o=Math.max(.001,+i),u=o*o;return e(o,u,u*u)},r})(Math.SQRT2,2,4);function Tg(e){return function(t,n){var a=e((t=Gc(t)).h,(n=Gc(n)).h),r=Yn(t.s,n.s),i=Yn(t.l,n.l),o=Yn(t.opacity,n.opacity);return function(u){return t.h=a(u),t.s=r(u),t.l=i(u),t.opacity=o(u),t+""}}}var Cg=Tg(Yc),bp=Tg(Yn);function yp(e){return function(t,n){var a=e((t=cp(t)).h,(n=cp(n)).h),r=Yn(t.c,n.c),i=Yn(t.l,n.l),o=Yn(t.opacity,n.opacity);return function(u){return t.h=a(u),t.c=r(u),t.l=i(u),t.opacity=o(u),t+""}}}var hi=yp(Yc),iv=yp(Yn);function Ln(e){return(function t(n){function a(r,i){var o=e((r=fp(r)).h,(i=fp(i)).h),u=Yn(r.s,i.s),c=Yn(r.l,i.l),f=Yn(r.opacity,i.opacity);return function(m){return r.h=o(m),r.s=u(m),r.l=c(Math.pow(m,n)),r.opacity=f(m),r+""}}return n=+n,a.gamma=t,a})(1)}var ov=Ln(Yc),m1=Ln(Yn);function Qc(e,t){t===void 0&&(t=e,e=ys);for(var n=0,a=t.length-1,r=t[0],i=new Array(a<0?0:a);n<a;)i[n]=e(r,r=t[++n]);return function(o){var u=Math.max(0,Math.min(a-1,Math.floor(o*=a)));return i[u](o-u)}}var vs=Object.freeze({__proto__:null,interpolate:ys,interpolateArray:function(e,t){return(pp(t)?Ro:Zc)(e,t)},interpolateBasis:pi,interpolateBasisClosed:ev,interpolateCubehelix:ov,interpolateCubehelixLong:m1,interpolateDate:hp,interpolateDiscrete:function(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}},interpolateHcl:hi,interpolateHclLong:iv,interpolateHsl:Cg,interpolateHslLong:bp,interpolateHue:function(e,t){var n=Yc(+e,+t);return function(a){var r=n(a);return r-360*Math.floor(r/360)}},interpolateLab:function(e,t){var n=Yn((e=qc(e)).l,(t=qc(t)).l),a=Yn(e.a,t.a),r=Yn(e.b,t.b),i=Yn(e.opacity,t.opacity);return function(o){return e.l=n(o),e.a=a(o),e.b=r(o),e.opacity=i(o),e+""}},interpolateNumber:sa,interpolateNumberArray:Ro,interpolateObject:mp,interpolateRgb:Kn,interpolateRgbBasis:Kc,interpolateRgbBasisClosed:Xc,interpolateRound:Jc,interpolateString:tv,interpolateTransformCss:h1,interpolateTransformSvg:dl,interpolateZoom:Ag,piecewise:Qc,quantize:function(e,t){for(var n=new Array(t),a=0;a<t;++a)n[a]=e(a/(t-1));return n}});function ed(e){return+e}var sv=[0,1];function Ia(e){return e}function td(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:(function(n){return function(){return n}})(isNaN(t)?NaN:.5)}function g1(e,t,n){var a=e[0],r=e[1],i=t[0],o=t[1];return r<a?(a=td(r,a),i=n(o,i)):(a=td(a,r),i=n(i,o)),function(u){return i(a(u))}}function Rg(e,t,n){var a=Math.min(e.length,t.length)-1,r=new Array(a),i=new Array(a),o=-1;for(e[a]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<a;)r[o]=td(e[o],e[o+1]),i[o]=n(t[o],t[o+1]);return function(u){var c=Zu(e,u,1,a)-1;return i[c](r[c](u))}}function Es(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function nd(){var e,t,n,a,r,i,o=sv,u=sv,c=ys,f=Ia;function m(){var v=Math.min(o.length,u.length);return f!==Ia&&(f=(function(E,k){var _;return E>k&&(_=E,E=k,k=_),function(N){return Math.max(E,Math.min(k,N))}})(o[0],o[v-1])),a=v>2?Rg:g1,r=i=null,g}function g(v){return v==null||isNaN(v=+v)?n:(r||(r=a(o.map(e),u,c)))(e(f(v)))}return g.invert=function(v){return f(t((i||(i=a(u,o.map(e),sa)))(v)))},g.domain=function(v){return arguments.length?(o=Array.from(v,ed),m()):o.slice()},g.range=function(v){return arguments.length?(u=Array.from(v),m()):u.slice()},g.rangeRound=function(v){return u=Array.from(v),c=Jc,m()},g.clamp=function(v){return arguments.length?(f=!!v||Ia,m()):f!==Ia},g.interpolate=function(v){return arguments.length?(c=v,m()):c},g.unknown=function(v){return arguments.length?(n=v,g):n},function(v,E){return e=v,t=E,m()}}function Ng(){return nd()(Ia,Ia)}function Ig(e,t,n,a){var r,i=Ri(e,t,n);switch((a=zl(a??",f")).type){case"s":var o=Math.max(Math.abs(e),Math.abs(t));return a.precision!=null||isNaN(r=x0(i,o))||(a.precision=r),Sh(a,o);case"":case"e":case"g":case"p":case"r":a.precision!=null||isNaN(r=A0(i,Math.max(Math.abs(e),Math.abs(t))))||(a.precision=r-(a.type==="e"));break;case"f":case"%":a.precision!=null||isNaN(r=$d(i))||(a.precision=r-2*(a.type==="%"))}return Nr(a)}function pl(e){var t=e.domain;return e.ticks=function(n){var a=t();return v0(a[0],a[a.length-1],n??10)},e.tickFormat=function(n,a){var r=t();return Ig(r[0],r[r.length-1],n??10,a)},e.nice=function(n){n==null&&(n=10);var a,r,i=t(),o=0,u=i.length-1,c=i[o],f=i[u],m=10;for(f<c&&(r=c,c=f,f=r,r=o,o=u,u=r);m-- >0;){if((r=E0(c,f,n))===a)return i[o]=c,i[u]=f,t(i);if(r>0)c=Math.floor(c/r)*r,f=Math.ceil(f/r)*r;else{if(!(r<0))break;c=Math.ceil(c*r)/r,f=Math.floor(f*r)/r}a=r}return e},e}function Og(e,t){var n,a=0,r=(e=e.slice()).length-1,i=e[a],o=e[r];return o<i&&(n=a,a=r,r=n,n=i,i=o,o=n),e[a]=t.floor(i),e[r]=t.ceil(o),e}function lv(e){return Math.log(e)}function uv(e){return Math.exp(e)}function cv(e){return-Math.log(-e)}function dv(e){return-Math.exp(-e)}function fv(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Dg(e){return(t,n)=>-e(-t,n)}function vp(e){let t=e(lv,uv),n=t.domain,a,r,i=10;function o(){return a=(function(u){return u===Math.E?Math.log:u===10&&Math.log10||u===2&&Math.log2||(u=Math.log(u),c=>Math.log(c)/u)})(i),r=(function(u){return u===10?fv:u===Math.E?Math.exp:c=>Math.pow(u,c)})(i),n()[0]<0?(a=Dg(a),r=Dg(r),e(cv,dv)):e(lv,uv),t}return t.base=function(u){return arguments.length?(i=+u,o()):i},t.domain=function(u){return arguments.length?(n(u),o()):n()},t.ticks=u=>{let c=n(),f=c[0],m=c[c.length-1],g=m<f;g&&([f,m]=[m,f]);let v,E,k=a(f),_=a(m),N=u==null?10:+u,O=[];if(!(i%1)&&_-k<N){if(k=Math.floor(k),_=Math.ceil(_),f>0){for(;k<=_;++k)for(v=1;v<i;++v)if(E=k<0?v/r(-k):v*r(k),!(E<f)){if(E>m)break;O.push(E)}}else for(;k<=_;++k)for(v=i-1;v>=1;--v)if(E=k>0?v/r(-k):v*r(k),!(E<f)){if(E>m)break;O.push(E)}2*O.length<N&&(O=v0(f,m,N))}else O=v0(k,_,Math.min(_-k,N)).map(r);return g?O.reverse():O},t.tickFormat=(u,c)=>{if(u==null&&(u=10),c==null&&(c=i===10?"s":","),typeof c!="function"&&(i%1||(c=zl(c)).precision!=null||(c.trim=!0),c=Nr(c)),u===1/0)return c;let f=Math.max(1,i*u/t.ticks().length);return m=>{let g=m/r(Math.round(a(m)));return g*i<i-.5&&(g*=i),g<=f?c(m):""}},t.nice=()=>n(Og(n(),{floor:u=>r(Math.floor(a(u))),ceil:u=>r(Math.ceil(a(u)))})),t}function Mg(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Lg(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Ep(e){var t=1,n=e(Mg(t),Lg(t));return n.constant=function(a){return arguments.length?e(Mg(t=+a),Lg(t)):t},pl(n)}function Fg(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function pv(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function hv(e){return e<0?-e*e:e*e}function Pg(e){var t=e(Ia,Ia),n=1;return t.exponent=function(a){return arguments.length?(n=+a)==1?e(Ia,Ia):n===.5?e(pv,hv):e(Fg(n),Fg(1/n)):n},pl(t)}function wp(){var e=Pg(nd());return e.copy=function(){return Es(e,wp()).exponent(e.exponent())},ui.apply(e,arguments),e}function b1(e){return new Date(e)}function $g(e){return e instanceof Date?+e:+new Date(+e)}function cn(e,t,n,a,r,i,o,u,c,f){var m=Ng(),g=m.invert,v=m.domain,E=f(".%L"),k=f(":%S"),_=f("%I:%M"),N=f("%I %p"),O=f("%a %d"),I=f("%b %d"),B=f("%B"),M=f("%Y");function U(z){return(c(z)<z?E:u(z)<z?k:o(z)<z?_:i(z)<z?N:a(z)<z?r(z)<z?O:I:n(z)<z?B:M)(z)}return m.invert=function(z){return new Date(g(z))},m.domain=function(z){return arguments.length?v(Array.from(z,$g)):v().map(b1)},m.ticks=function(z){var q=v();return e(q[0],q[q.length-1],z??10)},m.tickFormat=function(z,q){return q==null?U:f(q)},m.nice=function(z){var q=v();return z&&typeof z.range=="function"||(z=t(q[0],q[q.length-1],z??10)),z?v(Og(q,z)):m},m.copy=function(){return Es(m,cn(e,t,n,a,r,i,o,u,c,f))},m}function Ya(){var e,t,n,a,r,i=0,o=1,u=Ia,c=!1;function f(g){return g==null||isNaN(g=+g)?r:u(n===0?.5:(g=(a(g)-e)*n,c?Math.max(0,Math.min(1,g)):g))}function m(g){return function(v){var E,k;return arguments.length?([E,k]=v,u=g(E,k),f):[u(0),u(1)]}}return f.domain=function(g){return arguments.length?([i,o]=g,e=a(i=+i),t=a(o=+o),n=e===t?0:1/(t-e),f):[i,o]},f.clamp=function(g){return arguments.length?(c=!!g,f):c},f.interpolator=function(g){return arguments.length?(u=g,f):u},f.range=m(ys),f.rangeRound=m(Jc),f.unknown=function(g){return arguments.length?(r=g,f):r},function(g){return a=g,e=g(i),t=g(o),n=e===t?0:1/(t-e),f}}function Ji(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ws(){var e=pl(Ya()(Ia));return e.copy=function(){return Ji(e,ws())},Yi.apply(e,arguments)}function ad(){var e=Pg(Ya());return e.copy=function(){return Ji(e,ad()).exponent(e.exponent())},Yi.apply(e,arguments)}function rd(){var e,t,n,a,r,i,o,u=0,c=.5,f=1,m=1,g=Ia,v=!1;function E(_){return isNaN(_=+_)?o:(_=.5+((_=+i(_))-t)*(m*_<m*t?a:r),g(v?Math.max(0,Math.min(1,_)):_))}function k(_){return function(N){var O,I,B;return arguments.length?([O,I,B]=N,g=Qc(_,[O,I,B]),E):[g(0),g(.5),g(1)]}}return E.domain=function(_){return arguments.length?([u,c,f]=_,e=i(u=+u),t=i(c=+c),n=i(f=+f),a=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),m=t<e?-1:1,E):[u,c,f]},E.clamp=function(_){return arguments.length?(v=!!_,E):v},E.interpolator=function(_){return arguments.length?(g=_,E):g},E.range=k(ys),E.rangeRound=k(Jc),E.unknown=function(_){return arguments.length?(o=_,E):o},function(_){return i=_,e=_(u),t=_(c),n=_(f),a=e===t?0:.5/(t-e),r=t===n?0:.5/(n-t),m=t<e?-1:1,E}}function ku(){var e=Pg(rd());return e.copy=function(){return Ji(e,ku()).exponent(e.exponent())},Yi.apply(e,arguments)}function Su(e,t,n){let a=e-t+2*n;return e?a>0?a:1:0}let Qi="linear",Pr="log",_s="pow",eo="sqrt",ks="symlog",hr="time",to="utc",Ka="sequential",Io="diverging",Oo="quantile",hl="quantize",ml="threshold",_p="ordinal",Bg="point",mv="band",kp="bin-ordinal",Rn="continuous",gl="discrete",Ss="discretizing",$r="interpolating",id="temporal";function bl(){let e=rp().unknown(void 0),t=e.domain,n=e.range,a,r,i=[0,1],o=!1,u=0,c=0,f=.5;function m(){let g=t().length,v=i[1]<i[0],E=i[1-v],k=Su(g,u,c),_=i[v-0];a=(E-_)/(k||1),o&&(a=Math.floor(a)),_+=(E-_-a*(g-u))*f,r=a*(1-u),o&&(_=Math.round(_),r=Math.round(r));let N=Qn(g).map((O=>_+a*O));return n(v?N.reverse():N)}return delete e.unknown,e.domain=function(g){return arguments.length?(t(g),m()):t()},e.range=function(g){return arguments.length?(i=[+g[0],+g[1]],m()):i.slice()},e.rangeRound=function(g){return i=[+g[0],+g[1]],o=!0,m()},e.bandwidth=function(){return r},e.step=function(){return a},e.round=function(g){return arguments.length?(o=!!g,m()):o},e.padding=function(g){return arguments.length?(c=Math.max(0,Math.min(1,g)),u=c,m()):u},e.paddingInner=function(g){return arguments.length?(u=Math.max(0,Math.min(1,g)),m()):u},e.paddingOuter=function(g){return arguments.length?(c=Math.max(0,Math.min(1,g)),m()):c},e.align=function(g){return arguments.length?(f=Math.max(0,Math.min(1,g)),m()):f},e.invertRange=function(g){if(g[0]==null||g[1]==null)return;let v=i[1]<i[0],E=v?n().reverse():n(),k=E.length-1,_,N,O,I=+g[0],B=+g[1];return I!=I||B!=B||(B<I&&(O=I,I=B,B=O),B<E[0]||I>i[1-v])?void 0:(_=Math.max(0,Ul(E,I)-1),N=I===B?_:Ul(E,B)-1,I-E[_]>r+1e-10&&++_,v&&(O=_,_=k-N,N=k-O),_>N?void 0:t().slice(_,N+1))},e.invert=function(g){let v=e.invertRange([g,g]);return v&&v[0]},e.copy=function(){return bl().domain(t()).range(i).round(o).paddingInner(u).paddingOuter(c).align(f)},m()}function Ug(e){let t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return Ug(t())},e}var Sp=Array.prototype.map;let y1=Array.prototype.slice,xp=new Map,zg=Symbol("vega_scale");function Ap(e){return e[zg]=!0,e}function Bt(e,t,n){return arguments.length>1?(xp.set(e,(function(a,r,i){let o=function(){let u=r();return u.invertRange||(u.invertRange=u.invert?(function(c){return function(f){let m,g=f[0],v=f[1];return v<g&&(m=g,g=v,v=m),[c.invert(g),c.invert(v)]}})(u):u.invertExtent?(function(c){return function(f){let m=c.range(),g,v,E,k,_=f[0],N=f[1],O=-1;for(N<_&&(v=_,_=N,N=v),E=0,k=m.length;E<k;++E)m[E]>=_&&m[E]<=N&&(O<0&&(O=E),g=E);if(!(O<0))return _=c.invertExtent(m[O]),N=c.invertExtent(m[g]),[_[0]===void 0?_[1]:_[0],N[1]===void 0?N[0]:N[1]]}})(u):void 0),u.type=a,Ap(u)};return o.metadata=ir(Ie(i)),o})(e,t,n)),this):gv(e)?xp.get(e):void 0}function gv(e){return xp.has(e)}function yl(e,t){let n=xp.get(e);return n&&n.metadata[t]}function Gg(e){return yl(e,Rn)}function xu(e){return yl(e,gl)}function jg(e){return yl(e,Ss)}function Tp(e){return yl(e,Pr)}function bv(e){return yl(e,$r)}function yv(e){return yl(e,Oo)}Bt("identity",(function e(t){var n;function a(r){return r==null||isNaN(r=+r)?n:r}return a.invert=a,a.domain=a.range=function(r){return arguments.length?(t=Array.from(r,ed),a):t.slice()},a.unknown=function(r){return arguments.length?(n=r,a):n},a.copy=function(){return e(t).unknown(n)},t=arguments.length?Array.from(t,ed):[0,1],pl(a)})),Bt(Qi,(function e(){var t=Ng();return t.copy=function(){return Es(t,e())},ui.apply(t,arguments),pl(t)}),Rn),Bt(Pr,(function e(){let t=vp(nd()).domain([1,10]);return t.copy=()=>Es(t,e()).base(t.base()),ui.apply(t,arguments),t}),[Rn,Pr]),Bt(_s,wp,Rn),Bt(eo,(function(){return wp.apply(null,arguments).exponent(.5)}),Rn),Bt(ks,(function e(){var t=Ep(nd());return t.copy=function(){return Es(t,e()).constant(t.constant())},ui.apply(t,arguments)}),Rn),Bt(hr,(function(){return ui.apply(cn(C_,Th,ti,ql,Hl,fa,ea,nc,Or,bo).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Rn,id]),Bt(to,(function(){return ui.apply(cn(I0,O0,ni,Wl,pa,Ze,ac,ts,Or,rs).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Rn,id]),Bt(Ka,ws,[Rn,$r]),Bt(`${Ka}-${Qi}`,ws,[Rn,$r]),Bt(`${Ka}-${Pr}`,(function e(){var t=vp(Ya()).domain([1,10]);return t.copy=function(){return Ji(t,e()).base(t.base())},Yi.apply(t,arguments)}),[Rn,$r,Pr]),Bt(`${Ka}-${_s}`,ad,[Rn,$r]),Bt(`${Ka}-${eo}`,(function(){return ad.apply(null,arguments).exponent(.5)}),[Rn,$r]),Bt(`${Ka}-${ks}`,(function e(){var t=Ep(Ya());return t.copy=function(){return Ji(t,e()).constant(t.constant())},Yi.apply(t,arguments)}),[Rn,$r]),Bt(`${Io}-${Qi}`,(function e(){var t=pl(rd()(Ia));return t.copy=function(){return Ji(t,e())},Yi.apply(t,arguments)}),[Rn,$r]),Bt(`${Io}-${Pr}`,(function e(){var t=vp(rd()).domain([.1,1,10]);return t.copy=function(){return Ji(t,e()).base(t.base())},Yi.apply(t,arguments)}),[Rn,$r,Pr]),Bt(`${Io}-${_s}`,ku,[Rn,$r]),Bt(`${Io}-${eo}`,(function(){return ku.apply(null,arguments).exponent(.5)}),[Rn,$r]),Bt(`${Io}-${ks}`,(function e(){var t=Ep(rd());return t.copy=function(){return Ji(t,e()).constant(t.constant())},Yi.apply(t,arguments)}),[Rn,$r]),Bt(Oo,(function e(){var t,n=[],a=[],r=[];function i(){var u=0,c=Math.max(1,a.length);for(r=new Array(c-1);++u<c;)r[u-1]=w0(n,u/c);return o}function o(u){return u==null||isNaN(u=+u)?t:a[Zu(r,u)]}return o.invertExtent=function(u){var c=a.indexOf(u);return c<0?[NaN,NaN]:[c>0?r[c-1]:n[0],c<r.length?r[c]:n[n.length-1]]},o.domain=function(u){if(!arguments.length)return n.slice();n=[];for(let c of u)c==null||isNaN(c=+c)||n.push(c);return n.sort(Ti),i()},o.range=function(u){return arguments.length?(a=Array.from(u),i()):a.slice()},o.unknown=function(u){return arguments.length?(t=u,o):t},o.quantiles=function(){return r.slice()},o.copy=function(){return e().domain(n).range(a).unknown(t)},ui.apply(o,arguments)}),[Ss,Oo]),Bt(hl,(function e(){var t,n=0,a=1,r=1,i=[.5],o=[0,1];function u(f){return f!=null&&f<=f?o[Zu(i,f,0,r)]:t}function c(){var f=-1;for(i=new Array(r);++f<r;)i[f]=((f+1)*a-(f-r)*n)/(r+1);return u}return u.domain=function(f){return arguments.length?([n,a]=f,n=+n,a=+a,c()):[n,a]},u.range=function(f){return arguments.length?(r=(o=Array.from(f)).length-1,c()):o.slice()},u.invertExtent=function(f){var m=o.indexOf(f);return m<0?[NaN,NaN]:m<1?[n,i[0]]:m>=r?[i[r-1],a]:[i[m-1],i[m]]},u.unknown=function(f){return arguments.length&&(t=f),u},u.thresholds=function(){return i.slice()},u.copy=function(){return e().domain([n,a]).range(o).unknown(t)},ui.apply(pl(u),arguments)}),Ss),Bt(ml,(function e(){var t,n=[.5],a=[0,1],r=1;function i(o){return o!=null&&o<=o?a[Zu(n,o,0,r)]:t}return i.domain=function(o){return arguments.length?(n=Array.from(o),r=Math.min(n.length,a.length-1),i):n.slice()},i.range=function(o){return arguments.length?(a=Array.from(o),r=Math.min(n.length,a.length-1),i):a.slice()},i.invertExtent=function(o){var u=a.indexOf(o);return[n[u-1],n[u]]},i.unknown=function(o){return arguments.length?(t=o,i):t},i.copy=function(){return e().domain(n).range(a).unknown(t)},ui.apply(i,arguments)}),Ss),Bt(kp,(function e(){let t=[],n=[];function a(r){return r==null||r!=r?void 0:n[(Zu(t,r)-1)%n.length]}return a.domain=function(r){return arguments.length?(t=(function(i){return Sp.call(i,Le)})(r),a):t.slice()},a.range=function(r){return arguments.length?(n=y1.call(r),a):n.slice()},a.tickFormat=function(r,i){return Ig(t[0],$e(t),r??10,i)},a.copy=function(){return e().domain(a.domain()).range(a.range())},a}),[gl,Ss]),Bt(_p,rp,gl),Bt(mv,bl,gl),Bt(Bg,(function(){return Ug(bl().paddingInner(1))}),gl);let v1=["clamp","base","constant","exponent"];function vv(e,t){let n=t[0],a=$e(t)-n;return function(r){return e(n+r*a)}}function Cp(e,t,n){return Qc(Hg(t||"rgb",n),e)}function Ev(e,t){let n=new Array(t),a=t+1;for(let r=0;r<t;)n[r]=e(++r/a);return n}function od(e,t,n){let a=n-t,r,i,o;return a&&Number.isFinite(a)?(r=(i=e.type).indexOf("-"),i=r<0?i:i.slice(r+1),o=Bt(i)().domain([t,n]).range([0,1]),v1.forEach((u=>e[u]?o[u](e[u]()):0)),o):mn(.5)}function Hg(e,t){let n=vs[(function(a){return"interpolate"+a.toLowerCase().split("-").map((r=>r[0].toUpperCase()+r.slice(1))).join("")})(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function qg(e){let t=e.length/6|0,n=new Array(t);for(let a=0;a<t;)n[a]="#"+e.slice(6*a,6*++a);return n}function Wg(e,t){for(let n in e)Np(n,t(e[n]))}let Rp={};function Np(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(Rp[e]=t,this):Rp[e]}Wg({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"},qg),Wg({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(e=>Cp(qg(e))));let Au="symbol",Vg="discrete",E1=e=>Ee(e)?e.map((t=>String(t))):String(e),s=(e,t)=>e[1]-t[1],l=(e,t)=>t[1]-e[1];function d(e,t,n){let a;return Ba(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null&&(t=Math.min(t,Math.floor(Jr(e.domain())/n||1)))),ye(t)&&(a=t.step,t=t.interval),Ft(t)&&(t=e.type===hr?as(t):e.type==to?Mr(t):F("Only time and utc scales accept interval strings."),a&&(t=t.every(a))),t}function h(e,t,n){let a=e.range(),r=a[0],i=$e(a),o=s;if(r>i&&(a=i,i=r,r=a,o=l),r=Math.floor(r),i=Math.ceil(i),t=t.map((u=>[u,e(u)])).filter((u=>r<=u[1]&&u[1]<=i)).sort(o).map((u=>u[0])),n>0&&t.length>1){let u=[t[0],$e(t)];for(;t.length>n&&t.length>=3;)t=t.filter(((c,f)=>!(f%2)));t.length<3&&(t=u)}return t}function y(e,t){return e.bins?h(e,e.bins):e.ticks?e.ticks(t):e.domain()}function w(e,t,n,a,r,i){let o=t.type,u=E1;if(o===hr||r===hr)u=e.timeFormat(a);else if(o===to||r===to)u=e.utcFormat(a);else if(Tp(o)){let c=e.formatFloat(a);if(i||t.bins)u=c;else{let f=x(t,n,!1);u=m=>f(m)?c(m):""}}else if(t.tickFormat){let c=t.domain();u=e.formatSpan(c[0],c[c.length-1],n,a)}else a&&(u=e.format(a));return u}function x(e,t,n){let a=y(e,t),r=e.base(),i=Math.log(r),o=Math.max(1,r*t/a.length),u=c=>{let f=c/Math.pow(r,Math.round(Math.log(c)/i));return f*r<r-.5&&(f*=r),f<=o};return n?a.filter(u):u}let A={[Oo]:"quantiles",[hl]:"thresholds",[ml]:"domain"},C={[Oo]:"quantiles",[hl]:"domain"};function L(e,t){return e.bins?(function(n){let a=n.slice(0,-1);return a.max=$e(n),a})(e.bins):e.type===Pr?x(e,t,!0):A[e.type]?(function(n){let a=[-1/0].concat(n);return a.max=1/0,a})(e[A[e.type]]()):y(e,t)}let G=e=>A[e.type]||e.bins;function H(e,t,n,a,r,i,o){let u=C[t.type]&&i!==hr&&i!==to?(function(c,f,m){let g=f[C[f.type]](),v=g.length,E,k=v>1?g[1]-g[0]:g[0];for(E=1;E<v;++E)k=Math.min(k,g[E]-g[E-1]);return c.formatSpan(0,k,30,m)})(e,t,r):w(e,t,n,r,i,o);return a===Au&&G(t)?X(u):a===Vg?le(u):te(u)}let X=e=>(t,n,a)=>{let r=J(a[n+1],J(a.max,1/0)),i=pe(t,e),o=pe(r,e);return i&&o?i+" \u2013 "+o:o?"< "+o:"\u2265 "+i},J=(e,t)=>e??t,le=e=>(t,n)=>n?e(t):null,te=e=>t=>e(t),pe=(e,t)=>Number.isFinite(e)?t(e):null;function ge(e,t,n,a){let r=a||t.type;return Ft(n)&&(function(i){return yl(i,id)})(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||r!==hr?n||r!==to?H(e,t,5,null,n,a,!0):e.utcFormat("%A, %d %B %Y, %X UTC"):e.timeFormat("%A, %d %B %Y, %X")}function xe(e,t,n){n=n||{};let a=Math.max(3,n.maxlen||7),r=ge(e,t,n.format,n.formatType);if(jg(t.type)){let i=L(t).slice(1).map(r),o=i.length;return`${o} boundar${o===1?"y":"ies"}: ${i.join(", ")}`}if(xu(t.type)){let i=t.domain(),o=i.length;return`${o} value${o===1?"":"s"}: ${o>a?i.slice(0,a-2).map(r).join(", ")+", ending with "+i.slice(-1).map(r):i.map(r).join(", ")}`}{let i=t.domain();return`values from ${r(i[0])} to ${r($e(i))}`}}let me=0,Ae="p_";function Re(e){return e&&e.gradient}function Pe(e,t,n){let a=e.gradient,r=e.id,i=a==="radial"?Ae:"";return r||(r=e.id="gradient_"+me++,a==="radial"?(e.x1=We(e.x1,.5),e.y1=We(e.y1,.5),e.r1=We(e.r1,0),e.x2=We(e.x2,.5),e.y2=We(e.y2,.5),e.r2=We(e.r2,.5),i=Ae):(e.x1=We(e.x1,0),e.y1=We(e.y1,0),e.x2=We(e.x2,1),e.y2=We(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+i+r+")"}function We(e,t){return e??t}function Je(e,t){var n,a=[];return n={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:a,stop:function(r,i){return a.push({offset:r,color:i}),n}}}let it={basis:{curve:function(e){return new li(e)}},"basis-closed":{curve:function(e){return new Ly(e)}},"basis-open":{curve:function(e){return new Zm(e)}},bundle:{curve:c1,tension:"beta",value:.85},cardinal:{curve:d1,tension:"tension",value:0},"cardinal-open":{curve:Py,tension:"tension",value:0},"cardinal-closed":{curve:Fy,tension:"tension",value:0},"catmull-rom":{curve:$y,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Uy,tension:"alpha",value:.5},"catmull-rom-open":{curve:zy,tension:"alpha",value:.5},linear:{curve:Vn},"linear-closed":{curve:function(e){return new Gy(e)}},monotone:{horizontal:function(e){return new ms(e)},vertical:function(e){return new $c(e)}},natural:{curve:function(e){return new jy(e)}},step:{curve:function(e){return new il(e,.5)}},"step-after":{curve:function(e){return new il(e,1)}},"step-before":{curve:function(e){return new il(e,0)}}};function Qe(e,t,n){var a=nt(it,e)&&it[e],r=null;return a&&(r=a.curve||a[t||"vertical"],a.tension&&n!=null&&(r=r[a.tension](n))),r}let lt={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},kt=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Fn=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,dn=/^((\s+,?\s*)|(,\s*))/,sn=/^[01]/;function Ut(e){let t=[];return(e.match(kt)||[]).forEach((n=>{let a=n[0],r=a.toLowerCase(),i=lt[r],o=(function(c,f,m){let g=[];for(let v=0;f&&v<m.length;)for(let E=0;E<f;++E){let k=c!=="a"||E!==3&&E!==4?Fn:sn,_=m.slice(v).match(k);if(_===null)throw Error("Invalid SVG path, incorrect parameter type");v+=_[0].length,g.push(+_[0]);let N=m.slice(v).match(dn);N!==null&&(v+=N[0].length)}return g})(r,i,n.slice(1).trim()),u=o.length;if(u<i||u&&u%i!=0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([a,...o.slice(0,i)]),u!==i){r==="m"&&(a=a==="M"?"L":"l");for(let c=i;c<u;c+=i)t.push([a,...o.slice(c,c+i)])}})),t}let Dt=Math.PI/180,En=1e-14,Nn=Math.PI/2,fn=2*Math.PI,Oa=Math.sqrt(3)/2;var Da={},Br={},Xn=[].join;function ga(e){let t=Xn.call(e);if(Br[t])return Br[t];var n=e[0],a=e[1],r=e[2],i=e[3],o=e[4],u=e[5],c=e[6],f=e[7];let m=f*o,g=-c*u,v=c*o,E=f*u,k=Math.cos(r),_=Math.sin(r),N=Math.cos(i),O=Math.sin(i),I=.5*(i-r),B=Math.sin(.5*I),M=8/3*B*B/Math.sin(I),U=n+k-M*_,z=a+_+M*k,q=n+N,Y=a+O,K=q+M*O,re=Y-M*N;return Br[t]=[m*U+g*z,v*U+E*z,m*K+g*re,v*K+E*re,m*q+g*Y,v*q+E*Y]}let ln=["l",0,0,0,0,0,0,0];function At(e,t,n){let a=ln[0]=e[0];if(a==="a"||a==="A")ln[1]=t*e[1],ln[2]=n*e[2],ln[3]=e[3],ln[4]=e[4],ln[5]=e[5],ln[6]=t*e[6],ln[7]=n*e[7];else if(a==="h"||a==="H")ln[1]=t*e[1];else if(a==="v"||a==="V")ln[1]=n*e[1];else for(var r=1,i=e.length;r<i;++r)ln[r]=(r%2==1?t:n)*e[r];return ln}function wn(e,t,n,a,r,i){var o,u,c,f,m,g=null,v=0,E=0,k=0,_=0,N=0,O=0;n==null&&(n=0),a==null&&(a=0),r==null&&(r=1),i==null&&(i=r),e.beginPath&&e.beginPath();for(var I=0,B=t.length;I<B;++I){switch(o=t[I],r===1&&i===1||(o=At(o,r,i)),o[0]){case"l":v+=o[1],E+=o[2],e.lineTo(v+n,E+a);break;case"L":v=o[1],E=o[2],e.lineTo(v+n,E+a);break;case"h":v+=o[1],e.lineTo(v+n,E+a);break;case"H":v=o[1],e.lineTo(v+n,E+a);break;case"v":E+=o[1],e.lineTo(v+n,E+a);break;case"V":E=o[1],e.lineTo(v+n,E+a);break;case"m":N=v+=o[1],O=E+=o[2],e.moveTo(v+n,E+a);break;case"M":N=v=o[1],O=E=o[2],e.moveTo(v+n,E+a);break;case"c":u=v+o[5],c=E+o[6],k=v+o[3],_=E+o[4],e.bezierCurveTo(v+o[1]+n,E+o[2]+a,k+n,_+a,u+n,c+a),v=u,E=c;break;case"C":v=o[5],E=o[6],k=o[3],_=o[4],e.bezierCurveTo(o[1]+n,o[2]+a,k+n,_+a,v+n,E+a);break;case"s":u=v+o[3],c=E+o[4],k=2*v-k,_=2*E-_,e.bezierCurveTo(k+n,_+a,v+o[1]+n,E+o[2]+a,u+n,c+a),k=v+o[1],_=E+o[2],v=u,E=c;break;case"S":u=o[3],c=o[4],k=2*v-k,_=2*E-_,e.bezierCurveTo(k+n,_+a,o[1]+n,o[2]+a,u+n,c+a),v=u,E=c,k=o[1],_=o[2];break;case"q":u=v+o[3],c=E+o[4],k=v+o[1],_=E+o[2],e.quadraticCurveTo(k+n,_+a,u+n,c+a),v=u,E=c;break;case"Q":u=o[3],c=o[4],e.quadraticCurveTo(o[1]+n,o[2]+a,u+n,c+a),v=u,E=c,k=o[1],_=o[2];break;case"t":u=v+o[1],c=E+o[2],g[0].match(/[QqTt]/)===null?(k=v,_=E):g[0]==="t"?(k=2*v-f,_=2*E-m):g[0]==="q"&&(k=2*v-k,_=2*E-_),f=k,m=_,e.quadraticCurveTo(k+n,_+a,u+n,c+a),E=c,k=(v=u)+o[1],_=E+o[2];break;case"T":u=o[1],c=o[2],k=2*v-k,_=2*E-_,e.quadraticCurveTo(k+n,_+a,u+n,c+a),v=u,E=c;break;case"a":mi(e,v+n,E+a,[o[1],o[2],o[3],o[4],o[5],o[6]+v+n,o[7]+E+a]),v+=o[6],E+=o[7];break;case"A":mi(e,v+n,E+a,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+a]),v=o[6],E=o[7];break;case"z":case"Z":v=N,E=O,e.closePath()}g=o}}function mi(e,t,n,a){let r=(function(i,o,u,c,f,m,g,v,E){let k=Xn.call(arguments);if(Da[k])return Da[k];let _=g*Dt,N=Math.sin(_),O=Math.cos(_),I=O*(v-i)*.5+N*(E-o)*.5,B=O*(E-o)*.5-N*(v-i)*.5,M=I*I/((u=Math.abs(u))*u)+B*B/((c=Math.abs(c))*c);M>1&&(M=Math.sqrt(M),u*=M,c*=M);let U=O/u,z=N/u,q=-N/c,Y=O/c,K=U*v+z*E,re=q*v+Y*E,Q=U*i+z*o,ie=q*i+Y*o,se=1/((Q-K)*(Q-K)+(ie-re)*(ie-re))-.25;se<0&&(se=0);let ue=Math.sqrt(se);m==f&&(ue=-ue);let fe=.5*(K+Q)-ue*(ie-re),ve=.5*(re+ie)+ue*(Q-K),we=Math.atan2(re-ve,K-fe),Oe=Math.atan2(ie-ve,Q-fe)-we;Oe<0&&m===1?Oe+=fn:Oe>0&&m===0&&(Oe-=fn);let Ue=Math.ceil(Math.abs(Oe/(Nn+.001))),He=[];for(let De=0;De<Ue;++De){let ut=we+De*Oe/Ue,ct=we+(De+1)*Oe/Ue;He[De]=[fe,ve,ut,ct,u,c,N,O]}return Da[k]=He})(a[5],a[6],a[0],a[1],a[3],a[4],a[2],t,n);for(let i=0;i<r.length;++i){let o=ga(r[i]);e.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5])}}let gi=.5773502691896257,xs={circle:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,fn)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,a=n/2.5;e.moveTo(-n,-a),e.lineTo(-n,a),e.lineTo(-a,a),e.lineTo(-a,n),e.lineTo(a,n),e.lineTo(a,a),e.lineTo(n,a),e.lineTo(n,-a),e.lineTo(a,-a),e.lineTo(a,-n),e.lineTo(-a,-n),e.lineTo(-a,-a),e.closePath()}},diamond:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),a=-n/2;e.rect(a,a,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,a=n/7,r=n/2.5,i=n/8;e.moveTo(-a,n),e.lineTo(a,n),e.lineTo(a,-i),e.lineTo(r,-i),e.lineTo(0,-n),e.lineTo(-r,-i),e.lineTo(-a,-i),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,a=Oa*n,r=a-n*gi,i=n/4;e.moveTo(0,-a-r),e.lineTo(-i,a-r),e.lineTo(i,a-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,a=Oa*n,r=a-n*gi;e.moveTo(0,-a-r),e.lineTo(-n,a-r),e.lineTo(n,a-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,a=Oa*n;e.moveTo(0,-a),e.lineTo(-n,a),e.lineTo(n,a),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,a=Oa*n;e.moveTo(0,a),e.lineTo(-n,-a),e.lineTo(n,-a),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,a=Oa*n;e.moveTo(a,0),e.lineTo(-a,-n),e.lineTo(-a,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,a=Oa*n;e.moveTo(-a,0),e.lineTo(a,-n),e.lineTo(a,n),e.closePath()}},stroke:{draw:function(e,t){let n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function Xa(e){return nt(xs,e)?xs[e]:(function(t){if(!nt(mr,t)){let n=Ut(t);mr[t]={draw:function(a,r){wn(a,n,0,0,Math.sqrt(r)/2)}}}return mr[t]})(e)}var mr={};let ba=.448084975506;function bi(e){return e.x}function Do(e){return e.y}function sd(e){return e.width}function Yg(e){return e.height}function Mo(e){return typeof e=="function"?e:()=>+e}function Tu(e,t,n){return Math.max(t,Math.min(e,n))}function Kg(){var e=bi,t=Do,n=sd,a=Yg,r=Mo(0),i=r,o=r,u=r,c=null;function f(m,g,v){var E,k=g??+e.call(this,m),_=v??+t.call(this,m),N=+n.call(this,m),O=+a.call(this,m),I=Math.min(N,O)/2,B=Tu(+r.call(this,m),0,I),M=Tu(+i.call(this,m),0,I),U=Tu(+o.call(this,m),0,I),z=Tu(+u.call(this,m),0,I);if(c||(c=E=Oc()),B<=0&&M<=0&&U<=0&&z<=0)c.rect(k,_,N,O);else{var q=k+N,Y=_+O;c.moveTo(k+B,_),c.lineTo(q-M,_),c.bezierCurveTo(q-ba*M,_,q,_+ba*M,q,_+M),c.lineTo(q,Y-z),c.bezierCurveTo(q,Y-ba*z,q-ba*z,Y,q-z,Y),c.lineTo(k+U,Y),c.bezierCurveTo(k+ba*U,Y,k,Y-ba*U,k,Y-U),c.lineTo(k,_+B),c.bezierCurveTo(k,_+ba*B,k+ba*B,_,k+B,_),c.closePath()}if(E)return c=null,E+""||null}return f.x=function(m){return arguments.length?(e=Mo(m),f):e},f.y=function(m){return arguments.length?(t=Mo(m),f):t},f.width=function(m){return arguments.length?(n=Mo(m),f):n},f.height=function(m){return arguments.length?(a=Mo(m),f):a},f.cornerRadius=function(m,g,v,E){return arguments.length?(r=Mo(m),i=g!=null?Mo(g):r,u=v!=null?Mo(v):r,o=E!=null?Mo(E):i,f):r},f.context=function(m){return arguments.length?(c=m??null,f):c},f}function Xg(){var e,t,n,a,r,i,o,u,c=null;function f(g,v,E){let k=E/2;if(r){var _=o-v,N=g-i;if(_||N){var O=Math.hypot(_,N),I=(_/=O)*u,B=(N/=O)*u,M=Math.atan2(N,_);c.moveTo(i-I,o-B),c.lineTo(g-_*k,v-N*k),c.arc(g,v,k,M-Math.PI,M),c.lineTo(i+I,o+B),c.arc(i,o,u,M,M+Math.PI)}else c.arc(g,v,k,0,fn);c.closePath()}else r=1;i=g,o=v,u=k}function m(g){var v,E,k,_=g.length,N=!1;for(c==null&&(c=k=Oc()),v=0;v<=_;++v)!(v<_&&a(E=g[v],v,g))===N&&(N=!N)&&(r=0),N&&f(+e(E,v,g),+t(E,v,g),+n(E,v,g));if(k)return c=null,k+""||null}return m.x=function(g){return arguments.length?(e=g,m):e},m.y=function(g){return arguments.length?(t=g,m):t},m.size=function(g){return arguments.length?(n=g,m):n},m.defined=function(g){return arguments.length?(a=g,m):a},m.context=function(g){return arguments.length?(c=g??null,m):c},m}function _n(e,t){return e??t}let As=e=>e.x||0,ld=e=>e.y||0,Ip=e=>e.defined!==!1,XA=(function(){var e=Iy,t=s1,n=$t(0),a=null,r=l1,i=u1,o=Wn,u=null,c=Dc(f);function f(){var m,g,v=+e.apply(this,arguments),E=+t.apply(this,arguments),k=r.apply(this,arguments)-wo,_=i.apply(this,arguments)-wo,N=Wm(_-k),O=_>k;if(u||(u=m=c()),E<v&&(g=E,E=v,v=g),E>qn)if(N>Ym-qn)u.moveTo(E*hs(k),E*Vi(k)),u.arc(0,0,E,k,_,!O),v>qn&&(u.moveTo(v*hs(_),v*Vi(_)),u.arc(0,0,v,_,k,O));else{var I,B,M=k,U=_,z=k,q=_,Y=N,K=N,re=o.apply(this,arguments)/2,Q=re>qn&&(a?+a.apply(this,arguments):Ra(v*v+E*E)),ie=Vm(Wm(E-v)/2,+n.apply(this,arguments)),se=ie,ue=ie;if(Q>qn){var fe=gu(Q/v*Vi(re)),ve=gu(Q/E*Vi(re));(Y-=2*fe)>qn?(z+=fe*=O?1:-1,q-=fe):(Y=0,z=q=(k+_)/2),(K-=2*ve)>qn?(M+=ve*=O?1:-1,U-=ve):(K=0,M=U=(k+_)/2)}var we=E*hs(M),Oe=E*Vi(M),Ue=v*hs(q),He=v*Vi(q);if(ie>qn){var De,ut=E*hs(U),ct=E*Vi(U),bt=v*hs(z),Nt=v*Vi(z);if(N<nl)if(De=(function($n,nr,ka,lo,Vr,Dl,Cd,Ls){var vD=ka-$n,ED=lo-nr,wD=Cd-Vr,_D=Ls-Dl,r0=_D*vD-wD*ED;if(!(r0*r0<qn))return[$n+(r0=(wD*(nr-Dl)-_D*($n-Vr))/r0)*vD,nr+r0*ED]})(we,Oe,bt,Nt,ut,ct,Ue,He)){var bn=we-De[0],Kt=Oe-De[1],wa=ut-De[0],Tn=ct-De[1],ca=1/Vi((function($n){return $n>1?0:$n<-1?nl:Math.acos($n)})((bn*wa+Kt*Tn)/(Ra(bn*bn+Kt*Kt)*Ra(wa*wa+Tn*Tn)))/2),_a=Ra(De[0]*De[0]+De[1]*De[1]);se=Vm(ie,(v-_a)/(ca-1)),ue=Vm(ie,(E-_a)/(ca+1))}else se=ue=0}K>qn?ue>qn?(I=Mc(bt,Nt,we,Oe,E,ue,O),B=Mc(ut,ct,Ue,He,E,ue,O),u.moveTo(I.cx+I.x01,I.cy+I.y01),ue<ie?u.arc(I.cx,I.cy,ue,oa(I.y01,I.x01),oa(B.y01,B.x01),!O):(u.arc(I.cx,I.cy,ue,oa(I.y01,I.x01),oa(I.y11,I.x11),!O),u.arc(0,0,E,oa(I.cy+I.y11,I.cx+I.x11),oa(B.cy+B.y11,B.cx+B.x11),!O),u.arc(B.cx,B.cy,ue,oa(B.y11,B.x11),oa(B.y01,B.x01),!O))):(u.moveTo(we,Oe),u.arc(0,0,E,M,U,!O)):u.moveTo(we,Oe),v>qn&&Y>qn?se>qn?(I=Mc(Ue,He,ut,ct,v,-se,O),B=Mc(we,Oe,bt,Nt,v,-se,O),u.lineTo(I.cx+I.x01,I.cy+I.y01),se<ie?u.arc(I.cx,I.cy,se,oa(I.y01,I.x01),oa(B.y01,B.x01),!O):(u.arc(I.cx,I.cy,se,oa(I.y01,I.x01),oa(I.y11,I.x11),!O),u.arc(0,0,v,oa(I.cy+I.y11,I.cx+I.x11),oa(B.cy+B.y11,B.cx+B.x11),O),u.arc(B.cx,B.cy,se,oa(B.y11,B.x11),oa(B.y01,B.x01),!O))):u.arc(0,0,v,q,z,O):u.lineTo(Ue,He)}else u.moveTo(0,0);if(u.closePath(),m)return u=null,m+""||null}return f.centroid=function(){var m=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,g=(+r.apply(this,arguments)+ +i.apply(this,arguments))/2-nl/2;return[hs(g)*m,Vi(g)*m]},f.innerRadius=function(m){return arguments.length?(e=typeof m=="function"?m:$t(+m),f):e},f.outerRadius=function(m){return arguments.length?(t=typeof m=="function"?m:$t(+m),f):t},f.cornerRadius=function(m){return arguments.length?(n=typeof m=="function"?m:$t(+m),f):n},f.padRadius=function(m){return arguments.length?(a=m==null?null:typeof m=="function"?m:$t(+m),f):a},f.startAngle=function(m){return arguments.length?(r=typeof m=="function"?m:$t(+m),f):r},f.endAngle=function(m){return arguments.length?(i=typeof m=="function"?m:$t(+m),f):i},f.padAngle=function(m){return arguments.length?(o=typeof m=="function"?m:$t(+m),f):o},f.context=function(m){return arguments.length?(u=m??null,f):u},f})().startAngle((e=>e.startAngle||0)).endAngle((e=>e.endAngle||0)).padAngle((e=>e.padAngle||0)).innerRadius((e=>e.innerRadius||0)).outerRadius((e=>e.outerRadius||0)).cornerRadius((e=>e.cornerRadius||0)),w1=Xm().x(As).y1(ld).y0((e=>(e.y||0)+(e.height||0))).defined(Ip),_1=Xm().y(ld).x1(As).x0((e=>(e.x||0)+(e.width||0))).defined(Ip),k1=My().x(As).y(ld).defined(Ip),wv=Kg().x(As).y(ld).width((e=>e.width||0)).height((e=>e.height||0)).cornerRadius((e=>_n(e.cornerRadiusTopLeft,e.cornerRadius)||0),(e=>_n(e.cornerRadiusTopRight,e.cornerRadius)||0),(e=>_n(e.cornerRadiusBottomRight,e.cornerRadius)||0),(e=>_n(e.cornerRadiusBottomLeft,e.cornerRadius)||0)),_v=(function(e,t){let n=null,a=Dc(r);function r(){let i;if(n||(n=i=a()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return e=typeof e=="function"?e:$t(e||ep),t=typeof t=="function"?t:$t(t===void 0?64:+t),r.type=function(i){return arguments.length?(e=typeof i=="function"?i:$t(i),r):e},r.size=function(i){return arguments.length?(t=typeof i=="function"?i:$t(+i),r):t},r.context=function(i){return arguments.length?(n=i??null,r):n},r})().type((e=>Xa(e.shape||"circle"))).size((e=>_n(e.size,64))),kv=Xg().x(As).y(ld).defined(Ip).size((e=>e.size||1));function Op(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function Cu(e,t,n,a){return wv.context(e)(t,n,a)}var Sv=1;function xv(){Sv=1}function Zg(e,t,n){var a=t.clip,r=e._defs,i=t.clip_id||(t.clip_id="clip"+Sv++),o=r.clipping[i]||(r.clipping[i]={id:i});return tt(a)?o.path=a(null):Op(n)?o.path=Cu(null,n,0,0):(o.width=n.width||0,o.height=n.height||0),"url(#"+i+")"}function In(e){this.clear(),e&&this.union(e)}function Lo(e){this.mark=e,this.bounds=this.bounds||new In}function vl(e){Lo.call(this,e),this.items=this.items||[]}function El(e){this._pending=0,this._loader=e||Js()}function no(e){e._pending+=1}function wl(e){e._pending-=1}function _l(e,t,n){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){let a=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(a+(n?(function(r,i){return r.strokeJoin&&r.strokeJoin!=="miter"?0:i})(t,a):0))}return e}In.prototype={clone(){return new In(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,a){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),a<t?(this.y2=t,this.y1=a):(this.y1=t,this.y2=a),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){let a=this.rotatedPoints(e,t,n);return this.clear().add(a[0],a[1]).add(a[2],a[3]).add(a[4],a[5]).add(a[6],a[7])},rotatedPoints(e,t,n){var{x1:a,y1:r,x2:i,y2:o}=this,u=Math.cos(e),c=Math.sin(e),f=t-t*u+n*c,m=n-t*c-n*u;return[u*a-c*r+f,c*a+u*r+m,u*a-c*o+f,c*a+u*o+m,u*i-c*r+f,c*i+u*r+m,u*i-c*o+f,c*i+u*o+m]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},Fe(vl,Lo),El.prototype={pending(){return this._pending},sanitizeURL(e){let t=this;return no(t),t._loader.sanitize(e,{context:"href"}).then((n=>(wl(t),n))).catch((()=>(wl(t),null)))},loadImage(e){let t=this,n=ig();return no(t),t._loader.sanitize(e,{context:"image"}).then((a=>{let r=a.href;if(!r||!n)throw{url:r};let i=new n,o=nt(a,"crossOrigin")?a.crossOrigin:"anonymous";return o!=null&&(i.crossOrigin=o),i.onload=()=>wl(t),i.onerror=()=>wl(t),i.src=r,i})).catch((a=>(wl(t),{complete:!1,width:0,height:0,src:a&&a.url||""})))},ready(){let e=this;return new Promise((t=>{(function n(a){e.pending()?setTimeout((()=>{n(!0)}),10):t(a)})(!1)}))}};let q2=fn-1e-8,Av,Tv,Cv,ud,S1,Rv,x1,A1,Ru=(e,t)=>Av.add(e,t),Nv=(e,t)=>Ru(Tv=e,Cv=t),ZA=e=>Ru(e,Av.y1),JA=e=>Ru(Av.x1,e),cd=(e,t)=>S1*e+x1*t,dd=(e,t)=>Rv*e+A1*t,T1=(e,t)=>Ru(cd(e,t),dd(e,t)),C1=(e,t)=>Nv(cd(e,t),dd(e,t));function Jg(e,t){return Av=e,t?(ud=t*Dt,S1=A1=Math.cos(ud),Rv=Math.sin(ud),x1=-Rv):(S1=A1=1,ud=Rv=x1=0),W2}let W2={beginPath(){},closePath(){},moveTo:C1,lineTo:C1,rect(e,t,n,a){ud?(T1(e+n,t),T1(e+n,t+a),T1(e,t+a),C1(e,t)):(Ru(e+n,t+a),Nv(e,t))},quadraticCurveTo(e,t,n,a){let r=cd(e,t),i=dd(e,t),o=cd(n,a),u=dd(n,a);QA(Tv,r,o,ZA),QA(Cv,i,u,JA),Nv(o,u)},bezierCurveTo(e,t,n,a,r,i){let o=cd(e,t),u=dd(e,t),c=cd(n,a),f=dd(n,a),m=cd(r,i),g=dd(r,i);eT(Tv,o,c,m,ZA),eT(Cv,u,f,g,JA),Nv(m,g)},arc(e,t,n,a,r,i){if(a+=ud,r+=ud,Tv=n*Math.cos(r)+e,Cv=n*Math.sin(r)+t,Math.abs(r-a)>q2)Ru(e-n,t-n),Ru(e+n,t+n);else{let o=f=>Ru(n*Math.cos(f)+e,n*Math.sin(f)+t),u,c;if(o(a),o(r),r!==a)if((a%=fn)<0&&(a+=fn),(r%=fn)<0&&(r+=fn),r<a&&(i=!i,u=a,a=r,r=u),i)for(r-=fn,u=a-a%Nn,c=0;c<4&&u>r;++c,u-=Nn)o(u);else for(u=a-a%Nn+Nn,c=0;c<4&&u<r;++c,u+=Nn)o(u)}}};function QA(e,t,n,a){let r=(e-t)/(e+n-2*t);0<r&&r<1&&a(e+(t-e)*r)}function eT(e,t,n,a,r){let i=a-e+3*t-3*n,o=e+n-2*t,u=e-t,c,f=0,m=0;Math.abs(i)>En?(c=o*o+u*i,c>=0&&(c=Math.sqrt(c),f=(-o+c)/i,m=(-o-c)/i)):f=.5*u/o,0<f&&f<1&&r(tT(f,e,t,n,a)),0<m&&m<1&&r(tT(m,e,t,n,a))}function tT(e,t,n,a,r){let i=1-e,o=i*i,u=e*e;return o*i*t+3*o*e*n+3*i*u*a+u*e*r}var Nu=(Nu=Wa(1,1))?Nu.getContext("2d"):null;let R1=new In;function N1(e){return function(t,n){if(!Nu)return!0;e(Nu,t),R1.clear().union(t.bounds).intersect(n).round();let{x1:a,y1:r,x2:i,y2:o}=R1;for(let u=r;u<=o;++u)for(let c=a;c<=i;++c)if(Nu.isPointInPath(c,u))return!0;return!1}}function I1(e,t){return t.contains(e.x||0,e.y||0)}function nT(e,t){let n=e.x||0,a=e.y||0,r=e.width||0,i=e.height||0;return t.intersects(R1.set(n,a,n+r,a+i))}function aT(e,t){let n=e.x||0,a=e.y||0;return Dp(t,n,a,e.x2!=null?e.x2:n,e.y2!=null?e.y2:a)}function Dp(e,t,n,a,r){let{x1:i,y1:o,x2:u,y2:c}=e,f=a-t,m=r-n,g,v,E,k,_=0,N=1;for(k=0;k<4;++k){if(k===0&&(g=-f,v=-(i-t)),k===1&&(g=f,v=u-t),k===2&&(g=-m,v=-(o-n)),k===3&&(g=m,v=c-n),Math.abs(g)<1e-10&&v<0)return!1;if(E=v/g,g<0){if(E>N)return!1;E>_&&(_=E)}else if(g>0){if(E<_)return!1;E<N&&(N=E)}}return!0}function Mp(e,t){e.globalCompositeOperation=t.blend||"source-over"}function Fo(e,t){return e??t}function rT(e,t){let n=t.length;for(let a=0;a<n;++a)e.addColorStop(t[a].offset,t[a].color);return e}function iT(e,t,n){return Re(n)?(function(a,r,i){let o=i.width(),u=i.height(),c;if(r.gradient==="radial")c=a.createRadialGradient(i.x1+Fo(r.x1,.5)*o,i.y1+Fo(r.y1,.5)*u,Math.max(o,u)*Fo(r.r1,0),i.x1+Fo(r.x2,.5)*o,i.y1+Fo(r.y2,.5)*u,Math.max(o,u)*Fo(r.r2,.5));else{let f=Fo(r.x1,0),m=Fo(r.y1,0),g=Fo(r.x2,1),v=Fo(r.y2,0);if(f!==g&&m!==v&&o!==u){let E=Wa(Math.ceil(o),Math.ceil(u)),k=E.getContext("2d");return k.scale(o,u),k.fillStyle=rT(k.createLinearGradient(f,m,g,v),r.stops),k.fillRect(0,0,o,u),a.createPattern(E,"no-repeat")}c=a.createLinearGradient(i.x1+f*o,i.y1+m*u,i.x1+g*o,i.y1+v*u)}return rT(c,r.stops)})(e,n,t.bounds):n}function Iv(e,t,n){return(n*=t.fillOpacity==null?1:t.fillOpacity)>0&&(e.globalAlpha=n,e.fillStyle=iT(e,t,t.fill),!0)}var V2=[];function Lp(e,t,n){var a=(a=t.strokeWidth)!=null?a:1;return!(a<=0)&&(n*=t.strokeOpacity==null?1:t.strokeOpacity)>0&&(e.globalAlpha=n,e.strokeStyle=iT(e,t,t.stroke),e.lineWidth=a,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||V2),e.lineDashOffset=t.strokeDashOffset||0),!0)}function Y2(e,t){return e.zindex-t.zindex||e.index-t.index}function O1(e){if(!e.zdirty)return e.zitems;var t,n,a,r=e.items,i=[];for(n=0,a=r.length;n<a;++n)(t=r[n]).index=n,t.zindex&&i.push(t);return e.zdirty=!1,e.zitems=i.sort(Y2)}function Po(e,t){var n,a,r=e.items;if(!r||!r.length)return;let i=O1(e);if(i&&i.length){for(n=0,a=r.length;n<a;++n)r[n].zindex||t(r[n]);r=i}for(n=0,a=r.length;n<a;++n)t(r[n])}function Ov(e,t){var n,a,r=e.items;if(!r||!r.length)return null;let i=O1(e);for(i&&i.length&&(r=i),a=r.length;--a>=0;)if(n=t(r[a]))return n;if(r===i){for(a=(r=e.items).length;--a>=0;)if(!r[a].zindex&&(n=t(r[a])))return n}return null}function D1(e){return function(t,n,a){Po(n,(r=>{a&&!a.intersects(r.bounds)||oT(e,t,r,r)}))}}function K2(e){return function(t,n,a){!n.items.length||a&&!a.intersects(n.bounds)||oT(e,t,n.items[0],n.items)}}function oT(e,t,n,a){var r=n.opacity==null?1:n.opacity;r!==0&&(e(t,a)||(Mp(t,n),n.fill&&Iv(t,n,r)&&t.fill(),n.stroke&&Lp(t,n,r)&&t.stroke()))}function Dv(e){return e=e||Z,function(t,n,a,r,i,o){return a*=t.pixelRatio,r*=t.pixelRatio,Ov(n,(u=>{let c=u.bounds;if((!c||c.contains(i,o))&&c)return e(t,u,a,r,i,o)?u:void 0}))}}function Qg(e,t){return function(n,a,r,i){var o,u,c=Array.isArray(a)?a[0]:a,f=t??c.fill,m=c.stroke&&n.isPointInStroke;return m&&(o=c.strokeWidth,u=c.strokeCap,n.lineWidth=o??1,n.lineCap=u??"butt"),!e(n,a)&&(f&&n.isPointInPath(r,i)||m&&n.isPointInStroke(r,i))}}function M1(e){return Dv(Qg(e))}function fd(e,t){return"translate("+e+","+t+")"}function L1(e){return"rotate("+e+")"}function sT(e){return fd(e.x||0,e.y||0)}function F1(e,t,n){function a(r,i){var o=i.x||0,u=i.y||0,c=i.angle||0;r.translate(o,u),c&&r.rotate(c*=Dt),r.beginPath(),t(r,i),c&&r.rotate(-c),r.translate(-o,-u)}return{type:e,tag:"path",nested:!1,attr:function(r,i){r("transform",(function(o){return fd(o.x||0,o.y||0)+(o.angle?" "+L1(o.angle):"")})(i)),r("d",t(null,i))},bound:function(r,i){return t(Jg(r,i.angle),i),_l(r,i).translate(i.x||0,i.y||0)},draw:D1(a),pick:M1(a),isect:n||N1(a)}}var X2=F1("arc",(function(e,t){return XA.context(e)(t)}));function P1(e,t,n){function a(i,o){i.beginPath(),t(i,o)}let r=Qg(a);return{type:e,tag:"path",nested:!0,attr:function(i,o){var u=o.mark.items;u.length&&i("d",t(null,u))},bound:function(i,o){var u=o.items;return u.length===0?i:(t(Jg(i),u),_l(i,u[0]))},draw:K2(a),pick:function(i,o,u,c,f,m){var g=o.items,v=o.bounds;return!g||!g.length||v&&!v.contains(f,m)?null:(u*=i.pixelRatio,c*=i.pixelRatio,r(i,g,u,c)?g[0]:null)},isect:I1,tip:n}}var Z2=P1("area",(function(e,t){let n=t[0],a=n.interpolate||"linear";return(n.orient==="horizontal"?_1:w1).curve(Qe(a,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,a,r=e[0].orient==="horizontal"?t[1]:t[0],i=e[0].orient==="horizontal"?"y":"x",o=e.length,u=1/0;--o>=0;)e[o].defined!==!1&&(a=Math.abs(e[o][i]-r))<u&&(u=a,n=e[o]);return n}));function lT(e,t){e.beginPath(),Op(t)?Cu(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function uT(e){let t=Fo(e.strokeWidth,1);return e.strokeOffset!=null?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function cT(e,t){let n=uT(t);e("d",Cu(null,t,n,n))}function eb(e,t,n,a){let r=uT(t);e.beginPath(),Cu(e,t,(n||0)+r,(a||0)+r)}let J2=Qg(eb),Q2=Qg(eb,!1),eL=Qg(eb,!0);var tL={type:"group",tag:"g",nested:!1,attr:function(e,t){e("transform",sT(t))},bound:function(e,t){if(!t.clip&&t.items){let n=t.items,a=n.length;for(let r=0;r<a;++r)e.union(n[r].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),_l(e,t),e.translate(t.x||0,t.y||0)},draw:function(e,t,n){Po(t,(a=>{let r=a.x||0,i=a.y||0,o=a.strokeForeground,u=a.opacity==null?1:a.opacity;(a.stroke||a.fill)&&u&&(eb(e,a,r,i),Mp(e,a),a.fill&&Iv(e,a,u)&&e.fill(),a.stroke&&!o&&Lp(e,a,u)&&e.stroke()),e.save(),e.translate(r,i),a.clip&&lT(e,a),n&&n.translate(-r,-i),Po(a,(c=>{this.draw(e,c,n)})),n&&n.translate(r,i),e.restore(),o&&a.stroke&&u&&(eb(e,a,r,i),Mp(e,a),Lp(e,a,u)&&e.stroke())}))},pick:function(e,t,n,a,r,i){if(t.bounds&&!t.bounds.contains(r,i)||!t.items)return null;let o=n*e.pixelRatio,u=a*e.pixelRatio;return Ov(t,(c=>{let f,m,g,v=c.bounds;if(v&&!v.contains(r,i))return;m=c.x||0,g=c.y||0;let E=m+(c.width||0),k=g+(c.height||0),_=c.clip;if(_&&(r<m||r>E||i<g||i>k))return;if(e.save(),e.translate(m,g),m=r-m,g=i-g,_&&Op(c)&&!eL(e,c,o,u))return e.restore(),null;let N=c.strokeForeground,O=t.interactive!==!1;return O&&N&&c.stroke&&Q2(e,c,o,u)?(e.restore(),c):(f=Ov(c,(I=>(function(B,M,U){return(B.interactive!==!1||B.marktype==="group")&&B.bounds&&B.bounds.contains(M,U)})(I,m,g)?this.pick(I,n,a,m,g):null)),!f&&O&&(c.fill||!N&&c.stroke)&&J2(e,c,o,u)&&(f=c),e.restore(),f||null)}))},isect:nT,content:function(e,t,n){e("clip-path",t.clip?Zg(n,t,t):null)},background:function(e,t){e("class","background"),e("aria-hidden",!0),cT(e,t)},foreground:function(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?cT(e,t):e("d","")}},tb={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function $1(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then((a=>{e.image=a,e.image.url=e.url}))),n}function B1(e,t){return e.width!=null?e.width:t&&t.width?e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width:0}function U1(e,t){return e.height!=null?e.height:t&&t.height?e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height:0}function Mv(e,t){return e==="center"?t/2:e==="right"?t:0}function Lv(e,t){return e==="middle"?t/2:e==="bottom"?t:0}var nL={type:"image",tag:"image",nested:!1,attr:function(e,t,n){let a=$1(t,n),r=B1(t,a),i=U1(t,a),o=(t.x||0)-Mv(t.align,r),u=(t.y||0)-Lv(t.baseline,i);e("href",!a.src&&a.toDataURL?a.toDataURL():a.src||"",tb["xmlns:xlink"],"xlink:href"),e("transform",fd(o,u)),e("width",r),e("height",i),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")},bound:function(e,t){let n=t.image,a=B1(t,n),r=U1(t,n),i=(t.x||0)-Mv(t.align,a),o=(t.y||0)-Lv(t.baseline,r);return e.set(i,o,i+a,o+r)},draw:function(e,t,n){Po(t,(a=>{if(n&&!n.intersects(a.bounds))return;let r=$1(a,this),i=B1(a,r),o=U1(a,r);if(i===0||o===0)return;let u,c,f,m,g=(a.x||0)-Mv(a.align,i),v=(a.y||0)-Lv(a.baseline,o);a.aspect!==!1&&(c=r.width/r.height,f=a.width/a.height,c==c&&f==f&&c!==f&&(f<c?(m=i/c,v+=(o-m)/2,o=m):(m=o*c,g+=(i-m)/2,i=m))),(r.complete||r.toDataURL)&&(Mp(e,a),e.globalAlpha=(u=a.opacity)!=null?u:1,e.imageSmoothingEnabled=a.smooth!==!1,e.drawImage(r,g,v,i,o))}))},pick:Dv(),isect:Z,get:$1,xOffset:Mv,yOffset:Lv},aL=P1("line",(function(e,t){let n=t[0],a=n.interpolate||"linear";return k1.curve(Qe(a,n.orient,n.tension)).context(e)(t)}),(function(e,t){for(var n,a,r=Math.pow(e[0].strokeWidth||1,2),i=e.length;--i>=0;)if(e[i].defined!==!1&&(n=e[i].x-t[0])*n+(a=e[i].y-t[1])*a<r)return e[i];return null}));function Fv(e,t){var n=t.path;if(n==null)return!0;var a=t.x||0,r=t.y||0,i=t.scaleX||1,o=t.scaleY||1,u=(t.angle||0)*Dt,c=t.pathCache;c&&c.path===n||((t.pathCache=c=Ut(n)).path=n),u&&e.rotate&&e.translate?(e.translate(a,r),e.rotate(u),wn(e,c,0,0,i,o),e.rotate(-u),e.translate(-a,-r)):wn(e,c,a,r,i,o)}var rL={type:"path",tag:"path",nested:!1,attr:function(e,t){var n=t.scaleX||1,a=t.scaleY||1;n===1&&a===1||e("vector-effect","non-scaling-stroke"),e("transform",(function(r){return fd(r.x||0,r.y||0)+(r.angle?" "+L1(r.angle):"")+(r.scaleX||r.scaleY?" "+(function(i,o){return"scale("+i+","+o+")"})(r.scaleX||1,r.scaleY||1):"")})(t)),e("d",t.path)},bound:function(e,t){return Fv(Jg(e,t.angle),t)?e.set(0,0,0,0):_l(e,t,!0)},draw:D1(Fv),pick:M1(Fv),isect:N1(Fv)};function dT(e,t){e.beginPath(),Cu(e,t)}var iL={type:"rect",tag:"path",nested:!1,attr:function(e,t){e("d",Cu(null,t))},bound:function(e,t){var n,a;return _l(e.set(n=t.x||0,a=t.y||0,n+t.width||0,a+t.height||0),t)},draw:D1(dT),pick:M1(dT),isect:nT};function fT(e,t,n){var a,r,i,o;return!(!t.stroke||!Lp(e,t,n))&&(a=t.x||0,r=t.y||0,i=t.x2!=null?t.x2:a,o=t.y2!=null?t.y2:r,e.beginPath(),e.moveTo(a,r),e.lineTo(i,o),!0)}var oL={type:"rule",tag:"line",nested:!1,attr:function(e,t){e("transform",sT(t)),e("x2",t.x2!=null?t.x2-(t.x||0):0),e("y2",t.y2!=null?t.y2-(t.y||0):0)},bound:function(e,t){var n,a;return _l(e.set(n=t.x||0,a=t.y||0,t.x2!=null?t.x2:n,t.y2!=null?t.y2:a),t)},draw:function(e,t,n){Po(t,(a=>{if(!n||n.intersects(a.bounds)){var r=a.opacity==null?1:a.opacity;r&&fT(e,a,r)&&(Mp(e,a),e.stroke())}}))},pick:Dv((function(e,t,n,a){return!!e.isPointInStroke&&fT(e,t,1)&&e.isPointInStroke(n,a)})),isect:aT},sL=F1("shape",(function(e,t){return(t.mark.shape||t.shape).context(e)(t)})),lL=F1("symbol",(function(e,t){return _v.context(e)(t)}),I1);let pT=Pl();var $o={height:Ts,measureWidth:G1,estimateWidth:z1,width:z1,canvas:hT};function hT(e){$o.width=e&&Nu?G1:z1}function z1(e,t){return mT(Ou(e,t),Ts(e))}function mT(e,t){return~~(.8*e.length*t)}function G1(e,t){return Ts(e)<=0||!(t=Ou(e,t))?0:gT(t,Pv(e))}function gT(e,t){let n=`(${t}) ${e}`,a=pT.get(n);return a===void 0&&(Nu.font=t,a=Nu.measureText(e).width,pT.set(n,a)),a}function Ts(e){return e.fontSize!=null?+e.fontSize||0:11}function Iu(e){return e.lineHeight!=null?e.lineHeight:Ts(e)+2}function nb(e){return t=e.lineBreak&&e.text&&!Ee(e.text)?e.text.split(e.lineBreak):e.text,Ee(t)?t.length>1?t:t[0]:t;var t}function j1(e){let t=nb(e);return(Ee(t)?t.length-1:0)*Iu(e)}function Ou(e,t){let n=t==null?"":(t+"").trim();return e.limit>0&&n.length?(function(a,r){var i=+a.limit,o=(function(v){if($o.width===G1){let E=Pv(v);return k=>gT(k,E)}{let E=Ts(v);return k=>mT(k,E)}})(a);if(o(r)<i)return r;var u,c=a.ellipsis||"\u2026",f=a.dir==="rtl",m=0,g=r.length;if(i-=o(c),f){for(;m<g;)u=m+g>>>1,o(r.slice(u))>i?m=u+1:g=u;return c+r.slice(m)}for(;m<g;)u=1+(m+g>>>1),o(r.slice(0,u))<i?m=u:g=u-1;return r.slice(0,m)+c})(e,n):n}function ab(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function Pv(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+Ts(e)+"px "+ab(e,t)}function H1(e){var t=e.baseline,n=Ts(e);return Math.round(t==="top"?.79*n:t==="middle"?.3*n:t==="bottom"?-.21*n:t==="line-top"?.29*n+.5*Iu(e):t==="line-bottom"?.29*n-.5*Iu(e):0)}hT(!0);let uL={left:"start",center:"middle",right:"end"},rb=new In;function $v(e){var t,n=e.x||0,a=e.y||0,r=e.radius||0;return r&&(t=(e.theta||0)-Nn,n+=r*Math.cos(t),a+=r*Math.sin(t)),rb.x1=n,rb.y1=a,rb}function q1(e,t,n){var a,r=$o.height(t),i=t.align,o=$v(t),u=o.x1,c=o.y1,f=t.dx||0,m=(t.dy||0)+H1(t)-Math.round(.8*r),g=nb(t);if(Ee(g)?(r+=Iu(t)*(g.length-1),a=g.reduce(((v,E)=>Math.max(v,$o.width(t,E))),0)):a=$o.width(t,g),i==="center"?f-=a/2:i==="right"&&(f-=a),e.set(f+=u,m+=c,f+a,m+r),t.angle&&!n)e.rotate(t.angle*Dt,u,c);else if(n===2)return e.rotatedPoints(t.angle*Dt,u,c);return e}var cL={type:"text",tag:"text",nested:!1,attr:function(e,t){var n,a=t.dx||0,r=(t.dy||0)+H1(t),i=$v(t),o=i.x1,u=i.y1,c=t.angle||0;e("text-anchor",uL[t.align]||"start"),c?(n=fd(o,u)+" "+L1(c),(a||r)&&(n+=" "+fd(a,r))):n=fd(o+a,u+r),e("transform",n)},bound:q1,draw:function(e,t,n){Po(t,(a=>{var r,i,o,u,c,f,m,g=a.opacity==null?1:a.opacity;if(!(n&&!n.intersects(a.bounds)||g===0||a.fontSize<=0||a.text==null||a.text.length===0)){if(e.font=Pv(a),e.textAlign=a.align||"left",i=(r=$v(a)).x1,o=r.y1,a.angle&&(e.save(),e.translate(i,o),e.rotate(a.angle*Dt),i=o=0),i+=a.dx||0,o+=(a.dy||0)+H1(a),f=nb(a),Mp(e,a),Ee(f))for(c=Iu(a),u=0;u<f.length;++u)m=Ou(a,f[u]),a.fill&&Iv(e,a,g)&&e.fillText(m,i,o),a.stroke&&Lp(e,a,g)&&e.strokeText(m,i,o),o+=c;else m=Ou(a,f),a.fill&&Iv(e,a,g)&&e.fillText(m,i,o),a.stroke&&Lp(e,a,g)&&e.strokeText(m,i,o);a.angle&&e.restore()}}))},pick:Dv((function(e,t,n,a,r,i){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var o=$v(t),u=o.x1,c=o.y1,f=q1(rb,t,1),m=-t.angle*Dt,g=Math.cos(m),v=Math.sin(m),E=g*r-v*i+(u-g*u+v*c),k=v*r+g*i+(c-v*u-g*c);return f.contains(E,k)})),isect:function(e,t){let n=q1(rb,e,2);return Dp(t,n[0],n[1],n[2],n[3])||Dp(t,n[0],n[1],n[4],n[5])||Dp(t,n[4],n[5],n[6],n[7])||Dp(t,n[2],n[3],n[6],n[7])}},dL=P1("trail",(function(e,t){return kv.context(e)(t)}),(function(e,t){for(var n,a,r=e.length;--r>=0;)if(e[r].defined!==!1&&(n=e[r].x-t[0])*n+(a=e[r].y-t[1])*a<(n=e[r].size||1)*n)return e[r];return null})),yi={arc:X2,area:Z2,group:tL,image:nL,line:aL,path:rL,rect:iL,rule:oL,shape:sL,symbol:lL,text:cL,trail:dL};function W1(e,t,n){var a=yi[e.mark.marktype],r=t||a.bound;return a.nested&&(e=e.mark),r(e.bounds||(e.bounds=new In),e,n)}var bT={mark:null};function yT(e,t,n){var a,r,i,o,u=yi[e.marktype],c=u.bound,f=e.items,m=f&&f.length;if(u.nested)return m?i=f[0]:(bT.mark=e,i=bT),o=W1(i,c,n),t=t&&t.union(o)||o;if(t=t||e.bounds&&e.bounds.clear()||new In,m)for(a=0,r=f.length;a<r;++a)t.union(W1(f[a],c,n));return e.bounds=t}let fL=["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 vT(e,t){return JSON.stringify(e,fL,t)}function ET(e){return wT(typeof e=="string"?JSON.parse(e):e)}function wT(e){var t,n,a,r=e.marktype,i=e.items;if(i)for(n=0,a=i.length;n<a;++n)t=r?"mark":"group",i[n][t]=e,i[n].zindex&&(i[n][t].zdirty=!0),(r||t)==="group"&&wT(i[n]);return r&&yT(e),e}function V1(e){arguments.length?this.root=ET(e):(this.root=_T({marktype:"group",name:"root",role:"frame"}),this.root.items=[new vl(this.root)])}function _T(e,t){let n={bounds:new In,clip:!!e.clip,group:t,interactive:e.interactive!==!1,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return e.aria!=null&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function Du(e,t,n){return!e&&typeof document<"u"&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function Y1(e,t){t=t.toLowerCase();for(var n=e.childNodes,a=0,r=n.length;a<r;++a)if(n[a].tagName.toLowerCase()===t)return n[a]}function Ur(e,t,n,a){var r,i=e.childNodes[t];return i&&i.tagName.toLowerCase()===n.toLowerCase()||(r=i||null,i=Du(e.ownerDocument,n,a),e.insertBefore(i,r)),i}function Bo(e,t){for(var n=e.childNodes,a=n.length;a>t;)e.removeChild(n[--a]);return e}function kT(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function Bv(e,t){let n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function Mu(e,t){this._active=null,this._handlers={},this._loader=e||Js(),this._tooltip=t||pL}function pL(e,t,n,a){e.element().setAttribute("title",a||"")}function Cs(e){this._el=null,this._bgcolor=null,this._loader=new El(e)}V1.prototype={toJSON(e){return vT(this.root,e||0)},mark(e,t,n){let a=_T(e,t=t||this.root.items[0]);return t.items[n]=a,a.zindex&&(a.group.zdirty=!0),a}},Mu.prototype={initialize(e,t,n){return this._el=e,this._obj=n||null,this.origin(t)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(e){return arguments.length?(this._origin=e||[0,0],this):this._origin.slice()},scene(e){return arguments.length?(this._scene=e,this):this._scene},on(){},off(){},_handlerIndex(e,t,n){for(let a=e?e.length:0;--a>=0;)if(e[a].type===t&&(!n||e[a].handler===n))return a;return-1},handlers(e){let t=this._handlers,n=[];if(e)n.push(...t[this.eventName(e)]);else for(let a in t)n.push(...t[a]);return n},eventName(e){let t=e.indexOf(".");return t<0?e:e.slice(0,t)},handleHref(e,t,n){this._loader.sanitize(n,{context:"href"}).then((a=>{let r=new MouseEvent(e.type,e),i=Du(null,"a");for(let o in a)i.setAttribute(o,a[o]);i.dispatchEvent(r)})).catch((()=>{}))},handleTooltip(e,t,n){if(t&&t.tooltip!=null){t=(function(r,i,o,u){var c,f,m=r&&r.mark;if(m&&(c=yi[m.marktype]).tip){for((f=Bv(i,o))[0]-=u[0],f[1]-=u[1];r=r.mark.group;)f[0]-=r.x||0,f[1]-=r.y||0;r=c.tip(m.items,f)}return r})(t,e,this.canvas(),this._origin);let a=n&&t&&t.tooltip||null;this._tooltip.call(this._obj,this,e,t,a)}},getItemBoundingClientRect(e){let t=this.canvas();if(!t)return;let n=t.getBoundingClientRect(),a=this._origin,r=e.bounds,i=r.width(),o=r.height(),u=r.x1+a[0]+n.left,c=r.y1+a[1]+n.top;for(;e.mark&&(e=e.mark.group);)u+=e.x||0,c+=e.y||0;return{x:u,y:c,width:i,height:o,left:u,top:c,right:u+i,bottom:c+o}}},Cs.prototype={initialize(e,t,n,a,r){return this._el=e,this.resize(t,n,a,r)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(e){return arguments.length===0?this._bgcolor:(this._bgcolor=e,this)},resize(e,t,n,a){return this._width=e,this._height=t,this._origin=n||[0,0],this._scale=a||1,this},dirty(){},render(e){let t=this;return t._call=function(){t._render(e)},t._call(),t._call=null,t},_render(){},renderAsync(e){let t=this.render(e);return this._ready?this._ready.then((()=>t)):Promise.resolve(t)},_load(e,t){var n=this,a=n._loader[e](t);if(!n._ready){let r=n._call;n._ready=n._loader.ready().then((i=>{i&&r(),n._ready=null}))}return a},sanitizeURL(e){return this._load("sanitizeURL",e)},loadImage(e){return this._load("loadImage",e)}};let ST="dragenter",Uv="dragleave",xT="dragover",K1="mousedown",zv="mousemove",ib="mouseout",AT="mouseover",Gv="click",TT="mousewheel",jv="touchstart",Hv="touchmove",qv="touchend",X1=zv,ob=ib,Z1=Gv;function sb(e,t){Mu.call(this,e,t),this._down=null,this._touch=null,this._first=!0,this._events={}}let hL=e=>e===jv||e===Hv||e===qv?[jv,Hv,qv]:[e];function CT(e,t){hL(t).forEach((n=>(function(a,r){let i=a.canvas();i&&!a._events[r]&&(a._events[r]=1,i.addEventListener(r,a[r]?o=>a[r](o):o=>a.fire(r,o)))})(e,n)))}function RT(e,t,n){return function(a){let r=this._active,i=this.pickEvent(a);i===r||(r&&r.exit||this.fire(n,a),this._active=i,this.fire(t,a)),this.fire(e,a)}}function NT(e){return function(t){this.fire(e,t),this._active=null}}Fe(sb,Mu,{initialize(e,t,n){return this._canvas=e&&Y1(e,"canvas"),[Gv,K1,zv,ib,Uv].forEach((a=>CT(this,a))),Mu.prototype.initialize.call(this,e,t,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",ST,Uv,xT,K1,"mouseup",zv,ib,AT,Gv,"dblclick","wheel",TT,jv,Hv,qv],DOMMouseScroll(e){this.fire(TT,e)},mousemove:RT(zv,AT,ib),dragover:RT(xT,ST,Uv),mouseout:NT(ib),dragleave:NT(Uv),mousedown(e){this._down=this._active,this.fire(K1,e)},click(e){this._down===this._active&&(this.fire(Gv,e),this._down=null)},touchstart(e){this._touch=this.pickEvent(e.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(jv,e,!0)},touchmove(e){this.fire(Hv,e,!0)},touchend(e){this.fire(qv,e,!0),this._touch=null},fire(e,t,n){let a=n?this._touch:this._active,r=this._handlers[e];if(t.vegaType=e,e===Z1&&a&&a.href?this.handleHref(t,a,a.href):e!==X1&&e!==ob||this.handleTooltip(t,a,e!==ob),r)for(let i=0,o=r.length;i<o;++i)r[i].handler.call(this._obj,t,a)},on(e,t){let n=this.eventName(e),a=this._handlers;return this._handlerIndex(a[n],e,t)<0&&(CT(this,e),(a[n]||(a[n]=[])).push({type:e,handler:t})),this},off(e,t){let n=this.eventName(e),a=this._handlers[n],r=this._handlerIndex(a,e,t);return r>=0&&a.splice(r,1),this},pickEvent(e){let t=Bv(e,this._canvas),n=this._origin;return this.pick(this._scene,t[0],t[1],t[0]-n[0],t[1]-n[1])},pick(e,t,n,a,r){let i=this.context();return yi[e.marktype].pick.call(this,i,e,t,n,a,r)}});var mL=typeof window<"u"&&window.devicePixelRatio||1;function Wv(e){Cs.call(this,e),this._options={},this._redraw=!1,this._dirty=new In,this._tempb=new In}let IT=Cs.prototype;function J1(e,t){Mu.call(this,e,t);let n=this;n._hrefHandler=Q1(n,((a,r)=>{r&&r.href&&n.handleHref(a,r,r.href)})),n._tooltipHandler=Q1(n,((a,r)=>{n.handleTooltip(a,r,a.type!==ob)}))}Fe(Wv,Cs,{initialize(e,t,n,a,r,i){return this._options=i||{},this._canvas=this._options.externalContext?null:Wa(1,1,this._options.type),e&&this._canvas&&(Bo(e,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),IT.initialize.call(this,e,t,n,a,r)},resize(e,t,n,a){if(IT.resize.call(this,e,t,n,a),this._canvas)(function(r,i,o,u,c,f){let m=typeof HTMLElement<"u"&&r instanceof HTMLElement&&r.parentNode!=null,g=r.getContext("2d"),v=m?mL:c;r.width=i*v,r.height=o*v;for(let E in f)g[E]=f[E];m&&v!==1&&(r.style.width=i+"px",r.style.height=o+"px"),g.pixelRatio=v,g.setTransform(v,0,0,v,v*u[0],v*u[1])})(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{let r=this._options.externalContext;r||F("CanvasRenderer is missing a valid canvas or context"),r.scale(this._scale,this._scale),r.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(e){let t=this._tempb.clear().union(e.bounds),n=e.mark.group;for(;n;)t.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(t)},_render(e){let t=this.context(),n=this._origin,a=this._width,r=this._height,i=this._dirty,o=((c,f,m)=>new In().set(0,0,f,m).translate(-c[0],-c[1]))(n,a,r);t.save();let u=this._redraw||i.empty()?(this._redraw=!1,o.expand(1)):(function(c,f,m){return f.expand(1).round(),c.pixelRatio%1&&f.scale(c.pixelRatio).round().scale(1/c.pixelRatio),f.translate(-m[0]%1,-m[1]%1),c.beginPath(),c.rect(f.x1,f.y1,f.width(),f.height()),c.clip(),f})(t,o.intersect(i),n);return this.clear(-n[0],-n[1],a,r),this.draw(t,e,u),t.restore(),i.clear(),this},draw(e,t,n){let a=yi[t.marktype];t.clip&&(function(r,i){var o=i.clip;r.save(),tt(o)?(r.beginPath(),o(r),r.clip()):lT(r,i.group)})(e,t),a.draw.call(this,e,t,n),t.clip&&e.restore()},clear(e,t,n,a){let r=this._options,i=this.context();r.type==="pdf"||r.externalContext||i.clearRect(e,t,n,a),this._bgcolor!=null&&(i.fillStyle=this._bgcolor,i.fillRect(e,t,n,a))}});let Q1=(e,t)=>n=>{let a=n.target.__data__;a=Array.isArray(a)?a[0]:a,n.vegaType=n.type,t.call(e._obj,n,a)};Fe(J1,Mu,{initialize(e,t,n){let a=this._svg;return a&&(a.removeEventListener(Z1,this._hrefHandler),a.removeEventListener(X1,this._tooltipHandler),a.removeEventListener(ob,this._tooltipHandler)),this._svg=a=e&&Y1(e,"svg"),a&&(a.addEventListener(Z1,this._hrefHandler),a.addEventListener(X1,this._tooltipHandler),a.addEventListener(ob,this._tooltipHandler)),Mu.prototype.initialize.call(this,e,t,n)},canvas(){return this._svg},on(e,t){let n=this.eventName(e),a=this._handlers;if(this._handlerIndex(a[n],e,t)<0){let r={type:e,handler:t,listener:Q1(this,t)};(a[n]||(a[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},off(e,t){let n=this.eventName(e),a=this._handlers[n],r=this._handlerIndex(a,e,t);return r>=0&&(this._svg&&this._svg.removeEventListener(n,a[r].listener),a.splice(r,1)),this}});let OT="aria-hidden",ek="aria-label",tk="role",nk="aria-roledescription",DT="graphics-object",ak="graphics-symbol",MT=(e,t,n)=>({[tk]:e,[nk]:t,[ek]:n||void 0}),gL=ir(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),LT={axis:{desc:"axis",caption:function(e){let t=e.datum,n=e.orient,a=t.title?UT(e):null,r=e.context,i=r.scales[t.scale].value,o=r.dataflow.locale(),u=i.type;return(n==="left"||n==="right"?"Y":"X")+"-axis"+(a?` titled '${a}'`:"")+` for a ${xu(u)?"discrete":u} scale with ${xe(o,i,e)}`}},legend:{desc:"legend",caption:function(e){let t=e.datum,n=t.title?UT(e):null,a=`${t.type||""} legend`.trim(),r=t.scales,i=Object.keys(r),o=e.context,u=o.scales[r[i[0]]].value,c=o.dataflow.locale();return f=a,(f.length?f[0].toUpperCase()+f.slice(1):f)+(n?` titled '${n}'`:"")+` for ${(function(m){return m=m.map((g=>g+(g==="fill"||g==="stroke"?" color":""))),m.length<2?m[0]:m.slice(0,-1).join(", ")+" and "+$e(m)})(i)} with ${xe(c,u,e)}`;var f}},"title-text":{desc:"title",caption:e=>`Title text '${BT(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${BT(e)}'`}},FT={ariaRole:tk,ariaRoleDescription:nk,description:ek};function PT(e,t){let n=t.aria===!1;if(e(OT,n||void 0),n||t.description==null)for(let a in FT)e(FT[a],void 0);else{let a=t.mark.marktype;e(ek,t.description),e(tk,t.ariaRole||(a==="group"?DT:ak)),e(nk,t.ariaRoleDescription||`${a} mark`)}}function $T(e){return e.aria===!1?{[OT]:!0}:gL[e.role]?null:LT[e.role]?(function(t,n){try{let a=t.items[0],r=n.caption||(()=>"");return MT(n.role||ak,n.desc,a.description||r(a))}catch{return null}})(e,LT[e.role]):(function(t){let n=t.marktype,a=n==="group"||n==="text"||t.items.some((r=>r.description!=null&&r.aria!==!1));return MT(a?DT:ak,`${n} mark container`,t.description)})(e)}function BT(e){return Ie(e.text).join(" ")}function UT(e){try{return Ie($e(e.items).items[0].text).join(" ")}catch{return null}}let zT=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),bL=e=>zT(e).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;");function rk(){let e="",t="",n="",a=[],r=()=>t=n="",i=(u,c)=>(c!=null&&(t+=` ${u}="${bL(c)}"`),o),o={open(u){(g=>{t&&(e+=`${t}>${n}`,r()),a.push(g)})(u),t="<"+u;for(var c=arguments.length,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];for(let g of f)for(let v in g)i(v,g[v]);return o},close(){let u=a.pop();return e+=t?t+(n?`>${n}</${u}>`:"/>"):`</${u}>`,r(),o},attr:i,text:u=>(n+=zT(u),o),toString:()=>e};return o}let GT=e=>jT(rk(),e)+"";function jT(e,t){if(e.open(t.tagName),t.hasAttributes()){let n=t.attributes,a=n.length;for(let r=0;r<a;++r)e.attr(n[r].name,n[r].value)}if(t.hasChildNodes()){let n=t.childNodes;for(let a of n)a.nodeType===3?e.text(a.nodeValue):jT(e,a)}return e.close()}let Vv={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"},Yv={blend:"mix-blend-mode"},HT={fill:"none","stroke-miterlimit":10},qT="http://www.w3.org/2000/xmlns/",la=tb.xmlns;function ik(e){Cs.call(this,e),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}let ok=Cs.prototype;function WT(e,t){for(;e&&e.dirty!==t;e=e.mark.group){if(e.dirty=t,!e.mark||e.mark.dirty===t)return;e.mark.dirty=t}}function yL(e,t,n){let a,r,i;if(t.gradient==="radial"){let o=Ur(e,n++,"pattern",la);Lu(o,{id:Ae+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),o=Ur(o,0,"rect",la),Lu(o,{width:1,height:1,fill:`url(${YT()}#${t.id})`}),Lu(e=Ur(e,n++,"radialGradient",la),{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else Lu(e=Ur(e,n++,"linearGradient",la),{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(a=0,r=t.stops.length;a<r;++a)i=Ur(e,a,"stop",la),i.setAttribute("offset",t.stops[a].offset),i.setAttribute("stop-color",t.stops[a].color);return Bo(e,a),n}function vL(e,t,n){let a;return(e=Ur(e,n,"clipPath",la)).setAttribute("id",t.id),t.path?(a=Ur(e,0,"path",la),a.setAttribute("d",t.path)):(a=Ur(e,0,"rect",la),Lu(a,{x:0,y:0,width:t.width,height:t.height})),Bo(e,1),n+1}function VT(e,t,n,a,r){let i,o=e._svg;if(!o&&(i=t.ownerDocument,o=Du(i,a,la),e._svg=o,e.mark&&(o.__data__=e,o.__values__={fill:"default"},a==="g"))){let u=Du(i,"path",la);o.appendChild(u),u.__data__=e;let c=Du(i,"g",la);o.appendChild(c),c.__data__=e;let f=Du(i,"path",la);o.appendChild(f),f.__data__=e,f.__values__={fill:"default"}}return(o.ownerSVGElement!==r||(function(u,c){return u.parentNode&&u.parentNode.childNodes.length>1&&u.previousSibling!=c})(o,n))&&t.insertBefore(o,n?n.nextSibling:t.firstChild),o}Fe(ik,Cs,{initialize(e,t,n,a,r){return this._defs={},this._clearDefs(),e&&(this._svg=Ur(e,0,"svg",la),this._svg.setAttributeNS(qT,"xmlns",la),this._svg.setAttributeNS(qT,"xmlns:xlink",tb["xmlns:xlink"]),this._svg.setAttribute("version",tb.version),this._svg.setAttribute("class","marks"),Bo(e,1),this._root=Ur(this._svg,0,"g",la),Lu(this._root,HT),Bo(this._svg,1)),this.background(this._bgcolor),ok.initialize.call(this,e,t,n,a,r)},background(e){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",e),ok.background.apply(this,arguments)},resize(e,t,n,a){return ok.resize.call(this,e,t,n,a),this._svg&&(Lu(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(){let e=this._svg,t=this._bgcolor;if(!e)return null;let n;t&&(e.removeAttribute("style"),n=Ur(e,0,"rect",la),Lu(n,{width:this._width,height:this._height,fill:t}));let a=GT(e);return t&&(e.removeChild(n),this._svg.style.setProperty("background-color",t)),a},_render(e){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,e),Bo(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(e){e.dirty!==this._dirtyID&&(e.dirty=this._dirtyID,this._dirty.push(e))},isDirty(e){return this._dirtyAll||!e._svg||!e._svg.ownerSVGElement||e.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;let e=this._dirty;if(!e.length||!this._dirtyID)return!0;let t=++this._dirtyID,n,a,r,i,o,u,c;for(o=0,u=e.length;o<u;++o)n=e[o],a=n.mark,a.marktype!==r&&(r=a.marktype,i=yi[r]),a.zdirty&&a.dirty!==t&&(this._dirtyAll=!1,WT(n,t),a.items.forEach((f=>{f.dirty=t}))),a.zdirty||(n.exit?(i.nested&&a.items.length?(c=a.items[0],c._svg&&this._update(i,c._svg,c)):n._svg&&(c=n._svg.parentNode,c&&c.removeChild(n._svg)),n._svg=null):(n=i.nested?a.items[0]:n,n._update!==t&&(n._svg&&n._svg.ownerSVGElement?this._update(i,n._svg,n):(this._dirtyAll=!1,WT(n,t)),n._update=t)));return!this._dirtyAll},mark(e,t,n){if(!this.isDirty(t))return t._svg;let a=this._svg,r=yi[t.marktype],i=t.interactive===!1?"none":null,o=r.tag==="g",u=VT(t,e,n,"g",a);u.setAttribute("class",kT(t));let c=$T(t);for(let v in c)gr(u,v,c[v]);o||gr(u,"pointer-events",i),gr(u,"clip-path",t.clip?Zg(this,t,t.group):null);let f=null,m=0,g=v=>{let E=this.isDirty(v),k=VT(v,u,f,r.tag,a);E&&(this._update(r,k,v),o&&(function(_,N,O){N=N.lastChild.previousSibling;let I,B=0;Po(O,(M=>{I=_.mark(N,M,I),++B})),Bo(N,1+B)})(this,k,v)),f=k,++m};return r.nested?t.items.length&&g(t.items[0]):Po(t,g),Bo(u,m),u},_update(e,t,n){kl=t,Za=t.__values__,PT(lb,n),e.attr(lb,n,this);let a=EL[e.type];a&&a.call(this,e,t,n),kl&&this.style(kl,n)},style(e,t){if(t!=null){for(let n in Vv){let a=n==="font"?ab(t):t[n];if(a===Za[n])continue;let r=Vv[n];a==null?e.removeAttribute(r):(Re(a)&&(a=Pe(a,this._defs.gradient,YT())),e.setAttribute(r,a+"")),Za[n]=a}for(let n in Yv)Kv(e,Yv[n],t[n])}},defs(){let e=this._svg,t=this._defs,n=t.el,a=0;for(let r in t.gradient)n||(t.el=n=Ur(e,1,"defs",la)),a=yL(n,t.gradient[r],a);for(let r in t.clipping)n||(t.el=n=Ur(e,1,"defs",la)),a=vL(n,t.clipping[r],a);n&&(a===0?(e.removeChild(n),t.el=null):Bo(n,a))},_clearDefs(){let e=this._defs;e.gradient={},e.clipping={}}});let kl=null,Za=null,EL={group(e,t,n){let a=kl=t.childNodes[2];Za=a.__values__,e.foreground(lb,n,this),Za=t.__values__,kl=t.childNodes[1],e.content(lb,n,this);let r=kl=t.childNodes[0];e.background(lb,n,this);let i=n.mark.interactive===!1?"none":null;if(i!==Za.events&&(gr(a,"pointer-events",i),gr(r,"pointer-events",i),Za.events=i),n.strokeForeground&&n.stroke){let o=n.fill;gr(a,"display",null),this.style(r,n),gr(r,"stroke",null),o&&(n.fill=null),Za=a.__values__,this.style(a,n),o&&(n.fill=o),kl=null}else gr(a,"display","none")},image(e,t,n){n.smooth===!1?(Kv(t,"image-rendering","optimizeSpeed"),Kv(t,"image-rendering","pixelated")):Kv(t,"image-rendering",null)},text(e,t,n){let a=nb(n),r,i,o,u;Ee(a)?(i=a.map((c=>Ou(n,c))),r=i.join(`
7
- `),r!==Za.text&&(Bo(t,0),o=t.ownerDocument,u=Iu(n),i.forEach(((c,f)=>{let m=Du(o,"tspan",la);m.__data__=n,m.textContent=c,f&&(m.setAttribute("x",0),m.setAttribute("dy",u)),t.appendChild(m)})),Za.text=r)):(i=Ou(n,a),i!==Za.text&&(t.textContent=i,Za.text=i)),gr(t,"font-family",ab(n)),gr(t,"font-size",Ts(n)+"px"),gr(t,"font-style",n.fontStyle),gr(t,"font-variant",n.fontVariant),gr(t,"font-weight",n.fontWeight)}};function lb(e,t,n){t!==Za[e]&&(n?(function(a,r,i,o){i!=null?a.setAttributeNS(o,r,i):a.removeAttributeNS(o,r)})(kl,e,t,n):gr(kl,e,t),Za[e]=t)}function Kv(e,t,n){n!==Za[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),Za[t]=n)}function Lu(e,t){for(let n in t)gr(e,n,t[n])}function gr(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function YT(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function sk(e){Cs.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}Fe(sk,Cs,{svg(){return this._text},_render(e){let t=rk();t.open("svg",mt({},tb,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));let n=this._bgcolor;return n&&n!=="transparent"&&n!=="none"&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",HT,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){let n=yi[t.marktype],a=n.tag,r=[PT,n.attr];e.open("g",{class:kT(t),"clip-path":t.clip?Zg(this,t,t.group):null},$T(t),{"pointer-events":a!=="g"&&t.interactive===!1?"none":null});let i=o=>{let u=this.href(o);if(u&&e.open("a",u),e.open(a,this.attr(t,o,r,a!=="g"?a:null)),a==="text"){let c=nb(o);if(Ee(c)){let f={x:0,dy:Iu(o)};for(let m=0;m<c.length;++m)e.open("tspan",m?f:null).text(Ou(o,c[m])).close()}else e.text(Ou(o,c))}else if(a==="g"){let c=o.strokeForeground,f=o.fill,m=o.stroke;c&&m&&(o.stroke=null),e.open("path",this.attr(t,o,n.background,"bgrect")).close(),e.open("g",this.attr(t,o,n.content)),Po(o,(g=>this.mark(e,g))),e.close(),c&&m?(f&&(o.fill=null),o.stroke=m,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),f&&(o.fill=f)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),u&&e.close()};return n.nested?t.items&&t.items.length&&i(t.items[0]):Po(t,i),e.close()},href(e){let t=e.href,n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((a=>{a["xlink:href"]=a.href,a.href=null,(this._hrefs||(this._hrefs={}))[t]=a}))}return null},attr(e,t,n,a){let r={},i=(o,u,c,f)=>{r[f||o]=u};return Array.isArray(n)?n.forEach((o=>o(i,t,this))):n(i,t,this),a&&(function(o,u,c,f,m){let g;if(u==null||(f==="bgrect"&&c.interactive===!1&&(o["pointer-events"]="none"),f==="bgfore"&&(c.interactive===!1&&(o["pointer-events"]="none"),o.display="none",u.fill!==null)))return o;f==="image"&&u.smooth===!1&&(g=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),f==="text"&&(o["font-family"]=ab(u),o["font-size"]=Ts(u)+"px",o["font-style"]=u.fontStyle,o["font-variant"]=u.fontVariant,o["font-weight"]=u.fontWeight);for(let v in Vv){let E=u[v],k=Vv[v];(E!=="transparent"||k!=="fill"&&k!=="stroke")&&E!=null&&(Re(E)&&(E=Pe(E,m.gradient,"")),o[k]=E)}for(let v in Yv){let E=u[v];E!=null&&(g=g||[],g.push(`${Yv[v]}: ${E};`))}g&&(o.style=g.join(" "))})(r,t,e,a,this._defs),r},defs(e){let t=this._defs.gradient,n=this._defs.clipping;if(Object.keys(t).length+Object.keys(n).length!==0){e.open("defs");for(let a in t){let r=t[a],i=r.stops;r.gradient==="radial"?(e.open("pattern",{id:Ae+a,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+a+")"}).close(),e.close(),e.open("radialGradient",{id:a,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e.open("linearGradient",{id:a,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let o=0;o<i.length;++o)e.open("stop",{offset:i[o].offset,"stop-color":i[o].color}).close();e.close()}for(let a in n){let r=n[a];e.open("clipPath",{id:a}),r.path?e.open("path",{d:r.path}).close():e.open("rect",{x:0,y:0,width:r.width,height:r.height}).close(),e.close()}e.close()}}});let KT="canvas",XT="none",Fu={Canvas:KT,PNG:"png",SVG:"svg",None:XT},Fp={};function Xv(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(Fp[e]=t,this):Fp[e]}function ZT(e,t,n){let a=[],r=new In().union(t),i=e.marktype;return i?JT(e,r,n,a):i==="group"?QT(e,r,n,a):F("Intersect scene must be mark node or group item.")}function JT(e,t,n,a){if((function(r,i,o){return r.bounds&&i.intersects(r.bounds)&&(r.marktype==="group"||r.interactive!==!1&&(!o||o(r)))})(e,t,n)){let r=e.items,i=e.marktype,o=r.length,u=0;if(i==="group")for(;u<o;++u)QT(r[u],t,n,a);else for(let c=yi[i].isect;u<o;++u){let f=r[u];eC(f,t,c)&&a.push(f)}}return a}function QT(e,t,n,a){n&&n(e.mark)&&eC(e,t,yi.group.isect)&&a.push(e);let r=e.items,i=r&&r.length;if(i){let o=e.x||0,u=e.y||0;t.translate(-o,-u);for(let c=0;c<i;++c)JT(r[c],t,n,a);t.translate(o,u)}return a}function eC(e,t,n){let a=e.bounds;return t.encloses(a)||t.intersects(a)&&n(e,t)}Fp[KT]=Fp.png={renderer:Wv,headless:Wv,handler:sb},Fp.svg={renderer:ik,headless:sk,handler:J1},Fp[XT]={};let lk=new In;function tC(e){let t=e.clip;if(tt(t))t(Jg(lk.clear()));else{if(!t)return;lk.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(lk)}let wL=1e-9;function uk(e,t,n){return e===t||(n==="path"?nC(e,t):e instanceof Date&&t instanceof Date?+e==+t:Ba(e)&&Ba(t)?Math.abs(e-t)<=wL:e&&t&&(ye(e)||ye(t))?(function(a,r){var i,o,u=Object.keys(a),c=Object.keys(r);if(u.length!==c.length)return!1;for(u.sort(),c.sort(),o=u.length-1;o>=0;o--)if(u[o]!=c[o])return!1;for(o=u.length-1;o>=0;o--)if(!uk(a[i=u[o]],r[i],i))return!1;return typeof a==typeof r})(e,t):e==t)}function nC(e,t){return uk(Ut(e),Ut(t))}let Pp="top",Uo="left",zo="right",Pu="bottom",_L="top-left",kL="top-right",SL="bottom-left",xL="bottom-right",ck="start",dk="middle",br="end",AL="x",TL="y",Zv="group",fk="axis",pk="title",CL="frame",RL="scope",hk="legend",aC="row-header",rC="row-footer",iC="row-title",oC="column-header",sC="column-footer",lC="column-title",NL="padding",IL="symbol",uC="fit",cC="fit-x",dC="fit-y",OL="pad",mk="none",Jv="all",gk="each",bk="flush",$u="column",Bu="row";function fC(e){Se.call(this,null,e)}function Qv(e,t,n){return t(e.bounds.clear(),e,n)}Fe(fC,Se,{transform(e,t){let n=t.dataflow,a=e.mark,r=a.marktype,i=yi[r],o=i.bound,u,c=a.bounds;if(i.nested)a.items.length&&n.dirty(a.items[0]),c=Qv(a,o),a.items.forEach((f=>{f.bounds.clear().union(c)}));else if(r===Zv||e.modified())switch(t.visit(t.MOD,(f=>n.dirty(f))),c.clear(),a.items.forEach((f=>c.union(Qv(f,o)))),a.role){case fk:case hk:case pk:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,(f=>{c.union(Qv(f,o))})),t.visit(t.MOD,(f=>{u=u||c.alignsWith(f.bounds),n.dirty(f),c.union(Qv(f,o))})),u&&(c.clear(),a.items.forEach((f=>c.union(f.bounds))));return tC(a),t.modifies("bounds")}});let pC=":vega_identifier:";function yk(e){Se.call(this,0,e)}function hC(e){Se.call(this,null,e)}function mC(e){Se.call(this,null,e)}yk.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},Fe(yk,Se,{transform(e,t){let n=(r=t.dataflow)._signals[pC]||(r._signals[pC]=r.add(0)),a=e.as;var r;let i=n.value;return t.visit(t.ADD,(o=>o[a]=o[a]||++i)),n.set(this.value=i),t}}),Fe(hC,Se,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,(function(r){let i=r.groups,o=r.parent;return i&&i.size===1?i.get(Object.keys(i.object)[0]):i&&o?i.lookup(o):null})(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);let a=n.marktype===Zv?vl:Lo;return t.visit(t.ADD,(r=>a.call(r,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});let gC={parity:e=>e.filter(((t,n)=>n%2?t.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((a,r)=>r&&bC(n.bounds,a.bounds,t)?a.opacity=0:(n=a,1)))}},bC=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),yC=(e,t)=>{for(var n,a=1,r=e.length,i=e[0].bounds;a<r;i=n,++a)if(bC(i,n=e[a].bounds,t))return!0},DL=e=>{let t=e.bounds;return t.width()>1&&t.height()>1},vC=e=>(e.forEach((t=>t.opacity=1)),e),EC=(e,t)=>e.reflow(t.modified()).modifies("opacity");function wC(e){Se.call(this,null,e)}Fe(mC,Se,{transform(e,t){let n=gC[e.method]||gC.parity,a=e.separation||0,r,i,o=t.materialize(t.SOURCE).source;if(!o||!o.length)return;if(!e.method)return e.modified("method")&&(vC(o),t=EC(t,e)),t;if(o=o.filter(DL),!o.length)return;if(e.sort&&(o=o.slice().sort(e.sort)),r=vC(o),t=EC(t,e),r.length>=3&&yC(r,a)){do r=n(r,a);while(r.length>=3&&yC(r,a));r.length<3&&!$e(o).opacity&&(r.length>1&&($e(r).opacity=0),$e(o).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(i=((c,f,m)=>{var g=c.range(),v=new In;return f===Pp||f===Pu?v.set(g[0],-1/0,g[1],1/0):v.set(-1/0,g[0],1/0,g[1]),v.expand(m||1),E=>v.encloses(E.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),o.forEach((c=>{i(c)||(c.opacity=0)})));let u=r[0].mark.bounds.clear();return o.forEach((c=>{c.opacity&&u.union(c.bounds)})),t}}),Fe(wC,Se,{transform(e,t){let n=t.dataflow;if(t.visit(t.ALL,(a=>n.dirty(a))),t.fields&&t.fields.zindex){let a=t.source&&t.source[0];a&&(a.mark.zdirty=!0)}}});let Ja=new In;function $p(e,t,n){return e[t]===n?0:(e[t]=n,1)}function ML(e){var t=e.items[0].orient;return t===Uo||t===zo}function LL(e,t,n,a){var r,i,o=t.items[0],u=o.datum,c=o.translate!=null?o.translate:.5,f=o.orient,m=(function(z){let q=+z.grid;return[z.ticks?q++:-1,z.labels?q++:-1,q+ +z.domain]})(u),g=o.range,v=o.offset,E=o.position,k=o.minExtent,_=o.maxExtent,N=u.title&&o.items[m[2]].items[0],O=o.titlePadding,I=o.bounds,B=N&&j1(N),M=0,U=0;switch(Ja.clear().union(I),I.clear(),(r=m[0])>-1&&I.union(o.items[r].bounds),(r=m[1])>-1&&I.union(o.items[r].bounds),f){case Pp:M=E||0,U=-v,i=Math.max(k,Math.min(_,-I.y1)),I.add(0,-i).add(g,0),N&&eE(e,N,i,O,B,0,-1,I);break;case Uo:M=-v,U=E||0,i=Math.max(k,Math.min(_,-I.x1)),I.add(-i,0).add(0,g),N&&eE(e,N,i,O,B,1,-1,I);break;case zo:M=n+v,U=E||0,i=Math.max(k,Math.min(_,I.x2)),I.add(0,0).add(i,g),N&&eE(e,N,i,O,B,1,1,I);break;case Pu:M=E||0,U=a+v,i=Math.max(k,Math.min(_,I.y2)),I.add(0,0).add(g,i),N&&eE(e,N,i,O,0,0,1,I);break;default:M=o.x,U=o.y}return _l(I.translate(M,U),o),$p(o,"x",M+c)|$p(o,"y",U+c)&&(o.bounds=Ja,e.dirty(o),o.bounds=I,e.dirty(o)),o.mark.bounds.clear().union(I)}function eE(e,t,n,a,r,i,o,u){let c=t.bounds;if(t.auto){let f=o*(n+r+a),m=0,g=0;e.dirty(t),i?m=(t.x||0)-(t.x=f):g=(t.y||0)-(t.y=f),t.mark.bounds.clear().union(c.translate(-m,-g)),e.dirty(t)}u.union(c)}let _C=(e,t)=>Math.floor(Math.min(e,t)),kC=(e,t)=>Math.ceil(Math.max(e,t));function FL(e){return new In().set(0,0,e.width||0,e.height||0)}function PL(e){let t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function kn(e,t,n){let a=ye(e)?e[t]:e;return a??(n!==void 0?n:0)}function SC(e){return e<0?Math.ceil(-e):0}function xC(e,t,n){var a,r,i,o,u,c,f,m,g,v,E,k=!n.nodirty,_=n.bounds===bk?FL:PL,N=Ja.set(0,0,0,0),O=kn(n.align,$u),I=kn(n.align,Bu),B=kn(n.padding,$u),M=kn(n.padding,Bu),U=n.columns||t.length,z=U<=0?1:Math.ceil(t.length/U),q=t.length,Y=Array(q),K=Array(U),re=0,Q=Array(q),ie=Array(z),se=0,ue=Array(q),fe=Array(q),ve=Array(q);for(r=0;r<U;++r)K[r]=0;for(r=0;r<z;++r)ie[r]=0;for(r=0;r<q;++r)c=t[r],u=ve[r]=_(c),c.x=c.x||0,ue[r]=0,c.y=c.y||0,fe[r]=0,i=r%U,o=~~(r/U),re=Math.max(re,f=Math.ceil(u.x2)),se=Math.max(se,m=Math.ceil(u.y2)),K[i]=Math.max(K[i],f),ie[o]=Math.max(ie[o],m),Y[r]=B+SC(u.x1),Q[r]=M+SC(u.y1),k&&e.dirty(t[r]);for(r=0;r<q;++r)r%U==0&&(Y[r]=0),r<U&&(Q[r]=0);if(O===gk)for(i=1;i<U;++i){for(E=0,r=i;r<q;r+=U)E<Y[r]&&(E=Y[r]);for(r=i;r<q;r+=U)Y[r]=E+K[i-1]}else if(O===Jv){for(E=0,r=0;r<q;++r)r%U&&E<Y[r]&&(E=Y[r]);for(r=0;r<q;++r)r%U&&(Y[r]=E+re)}else for(O=!1,i=1;i<U;++i)for(r=i;r<q;r+=U)Y[r]+=K[i-1];if(I===gk)for(o=1;o<z;++o){for(E=0,a=(r=o*U)+U;r<a;++r)E<Q[r]&&(E=Q[r]);for(r=o*U;r<a;++r)Q[r]=E+ie[o-1]}else if(I===Jv){for(E=0,r=U;r<q;++r)E<Q[r]&&(E=Q[r]);for(r=U;r<q;++r)Q[r]=E+se}else for(I=!1,o=1;o<z;++o)for(a=(r=o*U)+U;r<a;++r)Q[r]+=ie[o-1];for(g=0,r=0;r<q;++r)g=Y[r]+(r%U?g:0),ue[r]+=g-t[r].x;for(i=0;i<U;++i)for(v=0,r=i;r<q;r+=U)v+=Q[r],fe[r]+=v-t[r].y;if(O&&kn(n.center,$u)&&z>1)for(r=0;r<q;++r)(g=(u=O===Jv?re:K[r%U])-ve[r].x2-t[r].x-ue[r])>0&&(ue[r]+=g/2);if(I&&kn(n.center,Bu)&&U!==1)for(r=0;r<q;++r)(v=(u=I===Jv?se:ie[~~(r/U)])-ve[r].y2-t[r].y-fe[r])>0&&(fe[r]+=v/2);for(r=0;r<q;++r)N.union(ve[r].translate(ue[r],fe[r]));switch(g=kn(n.anchor,AL),v=kn(n.anchor,TL),kn(n.anchor,$u)){case br:g-=N.width();break;case dk:g-=N.width()/2}switch(kn(n.anchor,Bu)){case br:v-=N.height();break;case dk:v-=N.height()/2}for(g=Math.round(g),v=Math.round(v),N.clear(),r=0;r<q;++r)t[r].mark.bounds.clear();for(r=0;r<q;++r)(c=t[r]).x+=ue[r]+=g,c.y+=fe[r]+=v,N.union(c.mark.bounds.union(c.bounds.translate(ue[r],fe[r]))),k&&e.dirty(c);return N}function $L(e,t,n){var a,r,i,o,u,c,f,m=(function(I){var B,M,U=I.items,z=U.length,q=0;let Y={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;q<z;++q)if(M=(B=U[q]).items,B.marktype===Zv)switch(B.role){case fk:case hk:case pk:break;case aC:Y.rowheaders.push(...M);break;case rC:Y.rowfooters.push(...M);break;case oC:Y.colheaders.push(...M);break;case sC:Y.colfooters.push(...M);break;case iC:Y.rowtitle=M[0];break;case lC:Y.coltitle=M[0];break;default:Y.marks.push(...M)}return Y})(t),g=m.marks,v=n.bounds===bk?BL:UL,E=n.offset,k=n.columns||g.length,_=k<=0?1:Math.ceil(g.length/k),N=_*k;let O=xC(e,g,n);O.empty()&&O.set(0,0,0,0),m.rowheaders&&(c=kn(n.headerBand,Bu,null),a=tE(e,m.rowheaders,g,k,_,-kn(E,"rowHeader"),_C,0,v,"x1",0,k,1,c)),m.colheaders&&(c=kn(n.headerBand,$u,null),r=tE(e,m.colheaders,g,k,k,-kn(E,"columnHeader"),_C,1,v,"y1",0,1,k,c)),m.rowfooters&&(c=kn(n.footerBand,Bu,null),i=tE(e,m.rowfooters,g,k,_,kn(E,"rowFooter"),kC,0,v,"x2",k-1,k,1,c)),m.colfooters&&(c=kn(n.footerBand,$u,null),o=tE(e,m.colfooters,g,k,k,kn(E,"columnFooter"),kC,1,v,"y2",N-k,1,k,c)),m.rowtitle&&(u=kn(n.titleAnchor,Bu),f=kn(E,"rowTitle"),f=u===br?i+f:a-f,c=kn(n.titleBand,Bu,.5),AC(e,m.rowtitle,f,0,O,c)),m.coltitle&&(u=kn(n.titleAnchor,$u),f=kn(E,"columnTitle"),f=u===br?o+f:r-f,c=kn(n.titleBand,$u,.5),AC(e,m.coltitle,f,1,O,c))}function BL(e,t){return t==="x1"?e.x||0:t==="y1"?e.y||0:t==="x2"?(e.x||0)+(e.width||0):t==="y2"?(e.y||0)+(e.height||0):void 0}function UL(e,t){return e.bounds[t]}function tE(e,t,n,a,r,i,o,u,c,f,m,g,v,E){var k,_,N,O,I,B,M,U,z,q=n.length,Y=0,K=0;if(!q)return Y;for(k=m;k<q;k+=g)n[k]&&(Y=o(Y,c(n[k],f)));if(!t.length)return Y;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),Y+=i,_=0,O=t.length;_<O;++_)e.dirty(t[_]),t[_].mark.bounds.clear();for(k=m,_=0,O=t.length;_<O;++_,k+=g){for(I=(B=t[_]).mark.bounds,N=k;N>=0&&(M=n[N])==null;N-=v);u?(U=E==null?M.x:Math.round(M.bounds.x1+E*M.bounds.width()),z=Y):(U=Y,z=E==null?M.y:Math.round(M.bounds.y1+E*M.bounds.height())),I.union(B.bounds.translate(U-(B.x||0),z-(B.y||0))),B.x=U,B.y=z,e.dirty(B),K=o(K,I[f])}return K}function AC(e,t,n,a,r,i){if(t){e.dirty(t);var o=n,u=n;a?o=Math.round(r.x1+i*r.width()):u=Math.round(r.y1+i*r.height()),t.bounds.translate(o-(t.x||0),u-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=u,e.dirty(t)}}function zL(e,t,n,a,r,i,o){let u=(function(v,E){let k=v[E]||{};return(_,N)=>k[_]!=null?k[_]:v[_]!=null?v[_]:N})(n,t),c=(function(v,E){let k=-1/0;return v.forEach((_=>{_.offset!=null&&(k=Math.max(k,_.offset))})),k>-1/0?k:E})(e,u("offset",0)),f=u("anchor",ck),m=f===br?1:f===dk?.5:0,g={align:gk,bounds:u("bounds",bk),columns:u("direction")==="vertical"?1:e.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(t){case Uo:g.anchor={x:Math.floor(a.x1)-c,column:br,y:m*(o||a.height()+2*a.y1),row:f};break;case zo:g.anchor={x:Math.ceil(a.x2)+c,y:m*(o||a.height()+2*a.y1),row:f};break;case Pp:g.anchor={y:Math.floor(r.y1)-c,row:br,x:m*(i||r.width()+2*r.x1),column:f};break;case Pu:g.anchor={y:Math.ceil(r.y2)+c,x:m*(i||r.width()+2*r.x1),column:f};break;case _L:g.anchor={x:c,y:c};break;case kL:g.anchor={x:i-c,y:c,column:br};break;case SL:g.anchor={x:c,y:o-c,row:br};break;case xL:g.anchor={x:i-c,y:o-c,column:br,row:br}}return g}function GL(e,t){var n,a,r=t.items[0],i=r.datum,o=r.orient,u=r.bounds,c=r.x,f=r.y;return r._bounds?r._bounds.clear().union(u):r._bounds=u.clone(),u.clear(),(function(m,g,v){var E=g.padding,k=E-v.x,_=E-v.y;if(g.datum.title){var N=g.items[1].items[0],O=N.anchor,I=g.titlePadding||0,B=E-N.x,M=E-N.y;switch(N.orient){case Uo:k+=Math.ceil(N.bounds.width())+I;break;case zo:case Pu:break;default:_+=N.bounds.height()+I}switch((k||_)&&ub(m,v,k,_),N.orient){case Uo:M+=Bp(g,v,N,O,1,1);break;case zo:B+=Bp(g,v,N,br,0,0)+I,M+=Bp(g,v,N,O,1,1);break;case Pu:B+=Bp(g,v,N,O,0,0),M+=Bp(g,v,N,br,-1,0,1)+I;break;default:B+=Bp(g,v,N,O,0,0)}(B||M)&&ub(m,N,B,M),(B=Math.round(N.bounds.x1-E))<0&&(ub(m,v,-B,0),ub(m,N,-B,0))}else(k||_)&&ub(m,v,k,_)})(e,r,r.items[0].items[0]),u=(function(m,g){return m.items.forEach((v=>g.union(v.bounds))),g.x1=m.padding,g.y1=m.padding,g})(r,u),n=2*r.padding,a=2*r.padding,u.empty()||(n=Math.ceil(u.width()+n),a=Math.ceil(u.height()+a)),i.type===IL&&(function(m){let g=m.reduce(((v,E)=>(v[E.column]=Math.max(E.bounds.x2-E.x,v[E.column]||0),v)),{});m.forEach((v=>{v.width=g[v.column],v.height=v.bounds.y2-v.y}))})(r.items[0].items[0].items[0].items),o!==mk&&(r.x=c=0,r.y=f=0),r.width=n,r.height=a,_l(u.set(c,f,c+n,f+a),r),r.mark.bounds.clear().union(u),r}function Bp(e,t,n,a,r,i,o){let u=e.datum.type!=="symbol",c=n.datum.vgrad,f=(!u||!i&&c||o?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,m=c&&i?f:0,g=c&&i?0:f,v=r<=0?0:j1(n);return Math.round(a===ck?m:a===br?g-v:.5*(f-v))}function ub(e,t,n,a){t.x+=n,t.y+=a,t.bounds.translate(n,a),t.mark.bounds.translate(n,a),e.dirty(t)}function TC(e){Se.call(this,null,e)}Fe(TC,Se,{transform(e,t){let n=t.dataflow;return e.mark.items.forEach((a=>{e.layout&&$L(n,a,e.layout),(function(r,i,o){var u,c,f,m,g,v=i.items,E=Math.max(0,i.width||0),k=Math.max(0,i.height||0),_=new In().set(0,0,E,k),N=_.clone(),O=_.clone(),I=[];for(m=0,g=v.length;m<g;++m)switch((c=v[m]).role){case fk:(ML(c)?N:O).union(LL(r,c,E,k));break;case pk:u=c;break;case hk:I.push(GL(r,c));break;case CL:case RL:case aC:case rC:case iC:case oC:case sC:case lC:N.union(c.bounds),O.union(c.bounds);break;default:_.union(c.bounds)}if(I.length){let B={};I.forEach((M=>{(f=M.orient||zo)!==mk&&(B[f]||(B[f]=[])).push(M)}));for(let M in B){let U=B[M];xC(r,U,zL(U,M,o.legends,N,O,E,k))}I.forEach((M=>{let U=M.bounds;if(U.equals(M._bounds)||(M.bounds=M._bounds,r.dirty(M),M.bounds=U,r.dirty(M)),!o.autosize||o.autosize.type!==uC&&o.autosize.type!==cC&&o.autosize.type!==dC)_.union(U);else switch(M.orient){case Uo:case zo:_.add(U.x1,0).add(U.x2,0);break;case Pp:case Pu:_.add(0,U.y1).add(0,U.y2)}}))}_.union(N).union(O),u&&_.union((function(B,M,U,z,q){var Y,K=M.items[0],re=K.frame,Q=K.orient,ie=K.anchor,se=K.offset,ue=K.padding,fe=K.items[0].items[0],ve=K.items[1]&&K.items[1].items[0],we=Q===Uo||Q===zo?z:U,Oe=0,Ue=0,He=0,De=0,ut=0;if(re!==Zv?Q===Uo?(Oe=q.y2,we=q.y1):Q===zo?(Oe=q.y1,we=q.y2):(Oe=q.x1,we=q.x2):Q===Uo&&(Oe=z,we=0),Y=ie===ck?Oe:ie===br?we:(Oe+we)/2,ve&&ve.text){switch(Q){case Pp:case Pu:ut=fe.bounds.height()+ue;break;case Uo:De=fe.bounds.width()+ue;break;case zo:De=-fe.bounds.width()-ue}Ja.clear().union(ve.bounds),Ja.translate(De-(ve.x||0),ut-(ve.y||0)),$p(ve,"x",De)|$p(ve,"y",ut)&&(B.dirty(ve),ve.bounds.clear().union(Ja),ve.mark.bounds.clear().union(Ja),B.dirty(ve)),Ja.clear().union(ve.bounds)}else Ja.clear();switch(Ja.union(fe.bounds),Q){case Pp:Ue=Y,He=q.y1-Ja.height()-se;break;case Uo:Ue=q.x1-Ja.width()-se,He=Y;break;case zo:Ue=q.x2+Ja.width()+se,He=Y;break;case Pu:Ue=Y,He=q.y2+se;break;default:Ue=K.x,He=K.y}return $p(K,"x",Ue)|$p(K,"y",He)&&(Ja.translate(Ue,He),B.dirty(K),K.bounds.clear().union(Ja),M.bounds.clear().union(Ja),B.dirty(K)),K.bounds})(r,u,E,k,_)),i.clip&&_.set(0,0,i.width||0,i.height||0),(function(B,M,U,z){let q=z.autosize||{},Y=q.type;if(B._autosize<1||!Y)return;let K=B._width,re=B._height,Q=Math.max(0,M.width||0),ie=Math.max(0,Math.ceil(-U.x1)),se=Math.max(0,M.height||0),ue=Math.max(0,Math.ceil(-U.y1)),fe=Math.max(0,Math.ceil(U.x2-Q)),ve=Math.max(0,Math.ceil(U.y2-se));if(q.contains===NL){let we=B.padding();K-=we.left+we.right,re-=we.top+we.bottom}Y===mk?(ie=0,ue=0,Q=K,se=re):Y===uC?(Q=Math.max(0,K-ie-fe),se=Math.max(0,re-ue-ve)):Y===cC?(Q=Math.max(0,K-ie-fe),re=se+ue+ve):Y===dC?(K=Q+ie+fe,se=Math.max(0,re-ue-ve)):Y===OL&&(K=Q+ie+fe,re=se+ue+ve),B._resizeView(K,re,Q,se,[ie,ue],q.resize)})(r,i,_,o)})(n,a,e)})),(function(a){return a&&a.mark.role!=="legend-entry"})(e.mark.group)?t.reflow():t}});var jL=Object.freeze({__proto__:null,bound:fC,identifier:yk,mark:hC,overlap:mC,render:wC,viewlayout:TC});function CC(e){Se.call(this,null,e)}function RC(e){Se.call(this,null,e)}function HL(){return It({})}function NC(e){Se.call(this,null,e)}function IC(e){Se.call(this,[],e)}Fe(CC,Se,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),a=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,i=e.scale,o=d(i,e.count==null?e.values?e.values.length:10:e.count,e.minstep),u=e.format||w(n,i,o,e.formatSpecifier,e.formatType,!!e.values),c=e.values?h(i,e.values,o):y(i,o);return r&&(a.rem=r),r=c.map(((f,m)=>It({index:m/(c.length-1||1),value:f,label:u(f)}))),e.extra&&r.length&&r.push(It({index:-1,extra:{value:r[0].value},label:""})),a.source=r,a.add=r,this.value=r,a}}),Fe(RC,Se,{transform(e,t){var n=t.dataflow,a=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||HL,i=e.key||rt,o=this.value;return Ee(a.encode)&&(a.encode=null),o&&(e.modified("key")||t.modified(i))&&F("DataJoin does not support modified key function or fields."),o||(t=t.addAll(),this.value=o=(function(u){let c=da().test((f=>f.exit));return c.lookup=f=>c.get(u(f)),c})(i)),t.visit(t.ADD,(u=>{let c=i(u),f=o.get(c);f?f.exit?(o.empty--,a.add.push(f)):a.mod.push(f):(f=r(u),o.set(c,f),a.add.push(f)),f.datum=u,f.exit=!1})),t.visit(t.MOD,(u=>{let c=i(u),f=o.get(c);f&&(f.datum=u,a.mod.push(f))})),t.visit(t.REM,(u=>{let c=i(u),f=o.get(c);u!==f.datum||f.exit||(a.rem.push(f),f.exit=!0,++o.empty)})),t.changed(t.ADD_MOD)&&a.modifies("datum"),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),a}}),Fe(NC,Se,{transform(e,t){var n=t.fork(t.ADD_REM),a=e.mod||!1,r=e.encoders,i=t.encode;if(Ee(i)){if(!n.changed()&&!i.every((g=>r[g])))return t.StopPropagation;i=i[0],n.encode=null}var o=i==="enter",u=r.update||ae,c=r.enter||ae,f=r.exit||ae,m=(i&&!o?r[i]:u)||ae;if(t.changed(t.ADD)&&(t.visit(t.ADD,(g=>{c(g,e),u(g,e)})),n.modifies(c.output),n.modifies(u.output),m!==ae&&m!==u&&(t.visit(t.ADD,(g=>{m(g,e)})),n.modifies(m.output))),t.changed(t.REM)&&f!==ae&&(t.visit(t.REM,(g=>{f(g,e)})),n.modifies(f.output)),o||m!==ae){let g=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(g,(v=>{let E=c(v,e)||a;(m(v,e)||E)&&n.mod.push(v)})),n.mod.length&&n.modifies(c.output)):t.visit(g,(v=>{(m(v,e)||a)&&n.mod.push(v)})),n.mod.length&&n.modifies(m.output)}return n.changed()?n:t.StopPropagation}}),Fe(IC,Se,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n,a,r,i,o,u=t.dataflow.locale(),c=t.fork(t.NO_SOURCE|t.NO_FIELDS),f=this.value,m=e.type||Au,g=e.scale,v=+e.limit,E=d(g,e.count==null?5:e.count,e.minstep),k=!!e.values||m===Au,_=e.format||H(u,g,E,m,e.formatSpecifier,e.formatType,k),N=e.values||L(g,E);return f&&(c.rem=f),m===Au?(v&&N.length>v?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),f=N.slice(0,v-1),o=!0):f=N,tt(r=e.size)?(e.values||g(f[0])!==0||(f=f.slice(1)),i=f.reduce(((O,I)=>Math.max(O,r(I,e))),0)):r=mn(i=r||8),f=f.map(((O,I)=>It({index:I,label:_(O,I,f),value:O,offset:i,size:r(O,e)}))),o&&(o=N[f.length],f.push(It({index:f.length,label:`\u2026${N.length-f.length} entries`,value:o,offset:i,size:r(o,e)})))):m==="gradient"?(n=g.domain(),a=od(g,n[0],$e(n)),N.length<3&&!e.values&&n[0]!==$e(n)&&(N=[n[0],$e(n)]),f=N.map(((O,I)=>It({index:I,label:_(O,I,N),value:O,perc:a(O)})))):(r=N.length-1,a=(function(O){let I=O.domain(),B=I.length-1,M=+I[0],U=+$e(I),z=U-M;if(O.type===ml){let q=B?z/B:.1;M-=q,U+=q,z=U-M}return q=>(q-M)/z})(g),f=N.map(((O,I)=>It({index:I,label:_(O,I,N),value:O,perc:I?a(O):0,perc2:I===r?1:a(N[I+1])})))),c.source=f,c.add=f,this.value=f,c}});let qL=e=>e.source.x,WL=e=>e.source.y,VL=e=>e.target.x,YL=e=>e.target.y;function vk(e){Se.call(this,{},e)}vk.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"}]},Fe(vk,Se,{transform(e,t){var n=e.sourceX||qL,a=e.sourceY||WL,r=e.targetX||VL,i=e.targetY||YL,o=e.as||"path",u=e.orient||"vertical",c=e.shape||"line",f=LC.get(c+"-"+u)||LC.get(c);return f||F("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(m=>{m[o]=f(n(m),a(m),r(m),i(m))})),t.reflow(e.modified()).modifies(o)}});let OC=(e,t,n,a)=>"M"+e+","+t+"L"+n+","+a,DC=(e,t,n,a)=>{var r=n-e,i=a-t,o=Math.hypot(r,i)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(i,r)/Math.PI+" 0 1 "+n+","+a},MC=(e,t,n,a)=>{let r=n-e,i=a-t,o=.2*(r+i),u=.2*(i-r);return"M"+e+","+t+"C"+(e+o)+","+(t+u)+" "+(n+u)+","+(a-o)+" "+n+","+a},LC=da({line:OC,"line-radial":(e,t,n,a)=>OC(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),arc:DC,"arc-radial":(e,t,n,a)=>DC(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),curve:MC,"curve-radial":(e,t,n,a)=>MC(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),"orthogonal-horizontal":(e,t,n,a)=>"M"+e+","+t+"V"+a+"H"+n,"orthogonal-vertical":(e,t,n,a)=>"M"+e+","+t+"H"+n+"V"+a,"orthogonal-radial":(e,t,n,a)=>{let r=Math.cos(e),i=Math.sin(e),o=Math.cos(n),u=Math.sin(n);return"M"+t*r+","+t*i+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*u+"L"+a*o+","+a*u},"diagonal-horizontal":(e,t,n,a)=>{let r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+a+" "+n+","+a},"diagonal-vertical":(e,t,n,a)=>{let r=(t+a)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+a},"diagonal-radial":(e,t,n,a)=>{let r=Math.cos(e),i=Math.sin(e),o=Math.cos(n),u=Math.sin(n),c=(t+a)/2;return"M"+t*r+","+t*i+"C"+c*r+","+c*i+" "+c*o+","+c*u+" "+a*o+","+a*u}});function Ek(e){Se.call(this,null,e)}Ek.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"]}]},Fe(Ek,Se,{transform(e,t){var n,a,r,i=e.as||["startAngle","endAngle"],o=i[0],u=i[1],c=e.field||he,f=e.startAngle||0,m=e.endAngle!=null?e.endAngle:2*Math.PI,g=t.source,v=g.map(c),E=v.length,k=f,_=(m-f)/x_(v),N=Qn(E);for(e.sort&&N.sort(((O,I)=>v[O]-v[I])),n=0;n<E;++n)r=v[N[n]],(a=g[N[n]])[o]=k,a[u]=k+=r*_;return this.value=v,t.reflow(e.modified()).modifies(i)}});let KL=5;function FC(e){return Gg(e)&&e!==Ka}let XL=ir(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function PC(e){Se.call(this,null,e),this.modified(!0)}function $C(e,t,n){return Tp(e)&&Math.abs(t.reduce(((a,r)=>a+(r<0?-1:r>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+st(t)),t}function BC(e,t,n){return tt(e)&&(t||n)?vv(e,wk(t||[0,1],n)):e}function wk(e,t){return t?e.slice().reverse():e}function UC(e){Se.call(this,null,e)}Fe(PC,Se,{transform(e,t){var n=t.dataflow,a=this.value,r=(function(i){var o,u=i.type,c="";return u===Ka?Ka+"-"+Qi:((function(f){let m=f.type;return Gg(m)&&m!==hr&&m!==to&&(f.scheme||f.range&&f.range.length&&f.range.every(Ft))})(i)&&(c=(o=i.rawDomain?i.rawDomain.length:i.domain?i.domain.length+ +(i.domainMid!=null):0)===2?Ka+"-":o===3?Io+"-":""),(c+u||Qi).toLowerCase())})(e);for(r in a&&r===a.type||(this.value=a=Bt(r)()),e)if(!XL[r]){if(r==="padding"&&FC(a.type))continue;tt(a[r])?a[r](e[r]):n.warn("Unsupported scale property: "+r)}return(function(i,o,u){var c=i.type,f=o.round||!1,m=o.range;if(o.rangeStep!=null)m=(function(g,v,E){g!==mv&&g!==Bg&&F("Only band and point scales support rangeStep.");var k=(v.paddingOuter!=null?v.paddingOuter:v.padding)||0,_=g===Bg?1:(v.paddingInner!=null?v.paddingInner:v.padding)||0;return[0,v.rangeStep*Su(E,_,k)]})(c,o,u);else if(o.scheme&&(m=(function(g,v,E){var k,_=v.schemeExtent;return Ee(v.scheme)?k=Cp(v.scheme,v.interpolate,v.interpolateGamma):(k=Np(v.scheme.toLowerCase()))||F(`Unrecognized scheme name: ${v.scheme}`),E=g===ml?E+1:g===kp?E-1:g===Oo||g===hl?+v.schemeCount||KL:E,bv(g)?BC(k,_,v.reverse):tt(k)?Ev(BC(k,_),E):g===_p?k:k.slice(0,E)})(c,o,u),tt(m))){if(i.interpolator)return i.interpolator(m);F(`Scale type ${c} does not support interpolating color schemes.`)}if(m&&bv(c))return i.interpolator(Cp(wk(m,o.reverse),o.interpolate,o.interpolateGamma));m&&o.interpolate&&i.interpolate?i.interpolate(Hg(o.interpolate,o.interpolateGamma)):tt(i.round)?i.round(f):tt(i.rangeRound)&&i.interpolate(f?Jc:ys),m&&i.range(wk(m,o.reverse))})(a,e,(function(i,o,u){let c=o.bins;if(c&&!Ee(c)){let f=i.domain(),m=f[0],g=$e(f),v=c.step,E=c.start==null?m:c.start,k=c.stop==null?g:c.stop;v||F("Scale bins parameter missing step property."),E<m&&(E=v*Math.ceil(m/v)),k>g&&(k=v*Math.floor(g/v)),c=Qn(E,k+v/2,v)}return c?i.bins=c:i.bins&&delete i.bins,i.type===kp&&(c?o.domain||o.domainRaw||(i.domain(c),u=c.length):i.bins=i.domain()),u})(a,e,(function(i,o,u){let c=(function(k,_,N){return _?(k.domain($C(k.type,_,N)),_.length):-1})(i,o.domainRaw,u);if(c>-1)return c;var f,m,g=o.domain,v=i.type,E=o.zero||o.zero===void 0&&(function(k){let _=k.type;return!k.bins&&(_===Qi||_===_s||_===eo)})(i);if(!g)return 0;if(FC(v)&&o.padding&&g[0]!==$e(g)&&(g=(function(k,_,N,O,I,B){var M=Math.abs($e(N)-N[0]),U=M/(M-2*O),z=k===Pr?Et(_,null,U):k===eo?Jt(_,null,U,.5):k===_s?Jt(_,null,U,I||1):k===ks?Lt(_,null,U,B||1):Zt(_,null,U);return _=_.slice(),_[0]=z[0],_[_.length-1]=z[1],_})(v,g,o.range,o.padding,o.exponent,o.constant)),(E||o.domainMin!=null||o.domainMax!=null||o.domainMid!=null)&&(f=(g=g.slice()).length-1||1,E&&(g[0]>0&&(g[0]=0),g[f]<0&&(g[f]=0)),o.domainMin!=null&&(g[0]=o.domainMin),o.domainMax!=null&&(g[f]=o.domainMax),o.domainMid!=null)){let k=(m=o.domainMid)>g[f]?f+1:m<g[0]?0:f;k!==f&&u.warn("Scale domainMid exceeds domain min or max.",m),g.splice(k,0,m)}return i.domain($C(v,g,u)),v===_p&&i.unknown(o.domainImplicit?ap:void 0),o.nice&&i.nice&&i.nice(o.nice!==!0&&d(i,o.nice)||null),g.length})(a,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),Fe(UC,Se,{transform(e,t){let n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(ls(e.sort)),this.modified(n),t}});let zC="zero",GC="center",jC="normalize",HC=["y0","y1"];function _k(e){Se.call(this,null,e)}function ZL(e,t,n,a,r){for(var i,o=(t-e.sum)/2,u=e.length,c=0;c<u;++c)(i=e[c])[a]=o,i[r]=o+=Math.abs(n(i))}function JL(e,t,n,a,r){for(var i,o=1/e.sum,u=0,c=e.length,f=0,m=0;f<c;++f)(i=e[f])[a]=u,i[r]=u=o*(m+=Math.abs(n(i)))}function QL(e,t,n,a,r){for(var i,o,u=0,c=0,f=e.length,m=0;m<f;++m)(i=+n(o=e[m]))<0?(o[a]=c,o[r]=c+=i):(o[a]=u,o[r]=u+=i)}_k.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:zC,values:[zC,GC,jC]},{name:"as",type:"string",array:!0,length:2,default:HC}]},Fe(_k,Se,{transform(e,t){var n,a,r,i,o=e.as||HC,u=o[0],c=o[1],f=ls(e.sort),m=e.field||he,g=e.offset===GC?ZL:e.offset===jC?JL:QL;for(n=(function(v,E,k,_){var N,O,I,B,M,U,z,q,Y,K=[],re=Q=>Q(M);if(E==null)K.push(v.slice());else for(N={},O=0,I=v.length;O<I;++O)M=v[O],(z=N[U=E.map(re)])||(N[U]=z=[],K.push(z)),z.push(M);for(U=0,Y=0,B=K.length;U<B;++U){for(O=0,q=0,I=(z=K[U]).length;O<I;++O)q+=Math.abs(_(z[O]));z.sum=q,q>Y&&(Y=q),k&&z.sort(k)}return K.max=Y,K})(t.source,e.groupby,f,m),a=0,r=n.length,i=n.max;a<r;++a)g(n[a],i,m,u,c);return t.reflow(e.modified()).modifies(o)}});var eF=Object.freeze({__proto__:null,axisticks:CC,datajoin:RC,encode:NC,legendentries:IC,linkpath:vk,pie:Ek,scale:PC,sortitems:UC,stack:_k}),gt=1e-6,nE=1e-12,Ot=Math.PI,On=Ot/2,aE=Ot/4,yr=2*Ot,Pn=180/Ot,Rt=Ot/180,Mt=Math.abs,Up=Math.atan,ao=Math.atan2,vt=Math.cos,rE=Math.ceil,qC=Math.exp,kk=Math.hypot,iE=Math.log,Sk=Math.pow,ft=Math.sin,ro=Math.sign||function(e){return e>0?1:e<0?-1:0},vr=Math.sqrt,xk=Math.tan;function WC(e){return e>1?0:e<-1?Ot:Math.acos(e)}function zr(e){return e>1?On:e<-1?-On:Math.asin(e)}function Ma(){}function oE(e,t){e&&YC.hasOwnProperty(e.type)&&YC[e.type](e,t)}var VC={Feature:function(e,t){oE(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,a=-1,r=n.length;++a<r;)oE(n[a].geometry,t)}},YC={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,a=-1,r=n.length;++a<r;)e=n[a],t.point(e[0],e[1],e[2])},LineString:function(e,t){Ak(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,a=-1,r=n.length;++a<r;)Ak(n[a],t,0)},Polygon:function(e,t){KC(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,a=-1,r=n.length;++a<r;)KC(n[a],t)},GeometryCollection:function(e,t){for(var n=e.geometries,a=-1,r=n.length;++a<r;)oE(n[a],t)}};function Ak(e,t,n){var a,r=-1,i=e.length-n;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function KC(e,t){var n=-1,a=e.length;for(t.polygonStart();++n<a;)Ak(e[n],t,1);t.polygonEnd()}function Sl(e,t){e&&VC.hasOwnProperty(e.type)?VC[e.type](e,t):oE(e,t)}var XC,ZC,Tk,Ck,Rk,An,Gr,Dn,vi,pd,JC,QC,zp,cb,Uu,xl,sE=new za,lE=new za,Rs={point:Ma,lineStart:Ma,lineEnd:Ma,polygonStart:function(){sE=new za,Rs.lineStart=tF,Rs.lineEnd=nF},polygonEnd:function(){var e=+sE;lE.add(e<0?yr+e:e),this.lineStart=this.lineEnd=this.point=Ma},sphere:function(){lE.add(yr)}};function tF(){Rs.point=aF}function nF(){eR(XC,ZC)}function aF(e,t){Rs.point=eR,XC=e,ZC=t,Tk=e*=Rt,Ck=vt(t=(t*=Rt)/2+aE),Rk=ft(t)}function eR(e,t){var n=(e*=Rt)-Tk,a=n>=0?1:-1,r=a*n,i=vt(t=(t*=Rt)/2+aE),o=ft(t),u=Rk*o,c=Ck*i+u*vt(r),f=u*a*ft(r);sE.add(ao(f,c)),Tk=e,Ck=i,Rk=o}function uE(e){return[ao(e[1],e[0]),zr(e[2])]}function hd(e){var t=e[0],n=e[1],a=vt(n);return[a*vt(t),a*ft(t),ft(n)]}function cE(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Gp(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Nk(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function dE(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function fE(e){var t=vr(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var db,pE,hE,mE,gE,bE,yE,vE,Ik,Ok,Dk,tR,nR,Er,wr,_r,Al={point:Mk,lineStart:rR,lineEnd:iR,polygonStart:function(){Al.point=oR,Al.lineStart=rF,Al.lineEnd=iF,cb=new za,Rs.polygonStart()},polygonEnd:function(){Rs.polygonEnd(),Al.point=Mk,Al.lineStart=rR,Al.lineEnd=iR,sE<0?(An=-(Dn=180),Gr=-(vi=90)):cb>gt?vi=90:cb<-gt&&(Gr=-90),xl[0]=An,xl[1]=Dn},sphere:function(){An=-(Dn=180),Gr=-(vi=90)}};function Mk(e,t){Uu.push(xl=[An=e,Dn=e]),t<Gr&&(Gr=t),t>vi&&(vi=t)}function aR(e,t){var n=hd([e*Rt,t*Rt]);if(zp){var a=Gp(zp,n),r=Gp([a[1],-a[0],0],a);fE(r),r=uE(r);var i,o=e-pd,u=o>0?1:-1,c=r[0]*Pn*u,f=Mt(o)>180;f^(u*pd<c&&c<u*e)?(i=r[1]*Pn)>vi&&(vi=i):f^(u*pd<(c=(c+360)%360-180)&&c<u*e)?(i=-r[1]*Pn)<Gr&&(Gr=i):(t<Gr&&(Gr=t),t>vi&&(vi=t)),f?e<pd?Ei(An,e)>Ei(An,Dn)&&(Dn=e):Ei(e,Dn)>Ei(An,Dn)&&(An=e):Dn>=An?(e<An&&(An=e),e>Dn&&(Dn=e)):e>pd?Ei(An,e)>Ei(An,Dn)&&(Dn=e):Ei(e,Dn)>Ei(An,Dn)&&(An=e)}else Uu.push(xl=[An=e,Dn=e]);t<Gr&&(Gr=t),t>vi&&(vi=t),zp=n,pd=e}function rR(){Al.point=aR}function iR(){xl[0]=An,xl[1]=Dn,Al.point=Mk,zp=null}function oR(e,t){if(zp){var n=e-pd;cb.add(Mt(n)>180?n+(n>0?360:-360):n)}else JC=e,QC=t;Rs.point(e,t),aR(e,t)}function rF(){Rs.lineStart()}function iF(){oR(JC,QC),Rs.lineEnd(),Mt(cb)>gt&&(An=-(Dn=180)),xl[0]=An,xl[1]=Dn,zp=null}function Ei(e,t){return(t-=e)<0?t+360:t}function oF(e,t){return e[0]-t[0]}function sR(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var Go={sphere:Ma,point:Lk,lineStart:lR,lineEnd:uR,polygonStart:function(){Go.lineStart=uF,Go.lineEnd=cF},polygonEnd:function(){Go.lineStart=lR,Go.lineEnd=uR}};function Lk(e,t){e*=Rt;var n=vt(t*=Rt);fb(n*vt(e),n*ft(e),ft(t))}function fb(e,t,n){++db,hE+=(e-hE)/db,mE+=(t-mE)/db,gE+=(n-gE)/db}function lR(){Go.point=sF}function sF(e,t){e*=Rt;var n=vt(t*=Rt);Er=n*vt(e),wr=n*ft(e),_r=ft(t),Go.point=lF,fb(Er,wr,_r)}function lF(e,t){e*=Rt;var n=vt(t*=Rt),a=n*vt(e),r=n*ft(e),i=ft(t),o=ao(vr((o=wr*i-_r*r)*o+(o=_r*a-Er*i)*o+(o=Er*r-wr*a)*o),Er*a+wr*r+_r*i);pE+=o,bE+=o*(Er+(Er=a)),yE+=o*(wr+(wr=r)),vE+=o*(_r+(_r=i)),fb(Er,wr,_r)}function uR(){Go.point=Lk}function uF(){Go.point=dF}function cF(){cR(tR,nR),Go.point=Lk}function dF(e,t){tR=e,nR=t,e*=Rt,t*=Rt,Go.point=cR;var n=vt(t);Er=n*vt(e),wr=n*ft(e),_r=ft(t),fb(Er,wr,_r)}function cR(e,t){e*=Rt;var n=vt(t*=Rt),a=n*vt(e),r=n*ft(e),i=ft(t),o=wr*i-_r*r,u=_r*a-Er*i,c=Er*r-wr*a,f=kk(o,u,c),m=zr(f),g=f&&-m/f;Ik.add(g*o),Ok.add(g*u),Dk.add(g*c),pE+=m,bE+=m*(Er+(Er=a)),yE+=m*(wr+(wr=r)),vE+=m*(_r+(_r=i)),fb(Er,wr,_r)}function Fk(e,t){function n(a,r){return a=e(a,r),t(a[0],a[1])}return e.invert&&t.invert&&(n.invert=function(a,r){return(a=t.invert(a,r))&&e.invert(a[0],a[1])}),n}function Pk(e,t){return Mt(e)>Ot&&(e-=Math.round(e/yr)*yr),[e,t]}function dR(e,t,n){return(e%=yr)?t||n?Fk(pR(e),hR(t,n)):pR(e):t||n?hR(t,n):Pk}function fR(e){return function(t,n){return Mt(t+=e)>Ot&&(t-=Math.round(t/yr)*yr),[t,n]}}function pR(e){var t=fR(e);return t.invert=fR(-e),t}function hR(e,t){var n=vt(e),a=ft(e),r=vt(t),i=ft(t);function o(u,c){var f=vt(c),m=vt(u)*f,g=ft(u)*f,v=ft(c),E=v*n+m*a;return[ao(g*r-E*i,m*n-v*a),zr(E*r+g*i)]}return o.invert=function(u,c){var f=vt(c),m=vt(u)*f,g=ft(u)*f,v=ft(c),E=v*r-g*i;return[ao(g*r+v*i,m*n+E*a),zr(E*n-m*a)]},o}function mR(e,t){(t=hd(t))[0]-=e,fE(t);var n=WC(-t[1]);return((-t[2]<0?-n:n)+yr-gt)%yr}function gR(){var e,t=[];return{point:function(n,a,r){e.push([n,a,r])},lineStart:function(){t.push(e=[])},lineEnd:Ma,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function EE(e,t){return Mt(e[0]-t[0])<gt&&Mt(e[1]-t[1])<gt}function wE(e,t,n,a){this.x=e,this.z=t,this.o=n,this.e=a,this.v=!1,this.n=this.p=null}function bR(e,t,n,a,r){var i,o,u=[],c=[];if(e.forEach((function(k){if(!((_=k.length-1)<=0)){var _,N,O=k[0],I=k[_];if(EE(O,I)){if(!O[2]&&!I[2]){for(r.lineStart(),i=0;i<_;++i)r.point((O=k[i])[0],O[1]);return void r.lineEnd()}I[0]+=2*gt}u.push(N=new wE(O,k,null,!0)),c.push(N.o=new wE(O,null,N,!1)),u.push(N=new wE(I,k,null,!1)),c.push(N.o=new wE(I,null,N,!0))}})),u.length){for(c.sort(t),yR(u),yR(c),i=0,o=c.length;i<o;++i)c[i].e=n=!n;for(var f,m,g=u[0];;){for(var v=g,E=!0;v.v;)if((v=v.n)===g)return;f=v.z,r.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(i=0,o=f.length;i<o;++i)r.point((m=f[i])[0],m[1]);else a(v.x,v.n.x,1,r);v=v.n}else{if(E)for(f=v.p.z,i=f.length-1;i>=0;--i)r.point((m=f[i])[0],m[1]);else a(v.x,v.p.x,-1,r);v=v.p}f=(v=v.o).z,E=!E}while(!v.v);r.lineEnd()}}}function yR(e){if(t=e.length){for(var t,n,a=0,r=e[0];++a<t;)r.n=n=e[a],n.p=r,r=n;r.n=n=e[0],n.p=r}}function $k(e){return Mt(e[0])<=Ot?e[0]:ro(e[0])*((Mt(e[0])+Ot)%yr-Ot)}function vR(e,t,n,a){return function(r){var i,o,u,c=t(r),f=gR(),m=t(f),g=!1,v={point:E,lineStart:_,lineEnd:N,polygonStart:function(){v.point=O,v.lineStart=I,v.lineEnd=B,o=[],i=[]},polygonEnd:function(){v.point=E,v.lineStart=_,v.lineEnd=N,o=Eh(o);var M=(function(U,z){var q=$k(z),Y=z[1],K=ft(Y),re=[ft(q),-vt(q),0],Q=0,ie=0,se=new za;K===1?Y=On+gt:K===-1&&(Y=-On-gt);for(var ue=0,fe=U.length;ue<fe;++ue)if(we=(ve=U[ue]).length)for(var ve,we,Oe=ve[we-1],Ue=$k(Oe),He=Oe[1]/2+aE,De=ft(He),ut=vt(He),ct=0;ct<we;++ct,Ue=Nt,De=Kt,ut=wa,Oe=bt){var bt=ve[ct],Nt=$k(bt),bn=bt[1]/2+aE,Kt=ft(bn),wa=vt(bn),Tn=Nt-Ue,ca=Tn>=0?1:-1,_a=ca*Tn,$n=_a>Ot,nr=De*Kt;if(se.add(ao(nr*ca*ft(_a),ut*wa+nr*vt(_a))),Q+=$n?Tn+ca*yr:Tn,$n^Ue>=q^Nt>=q){var ka=Gp(hd(Oe),hd(bt));fE(ka);var lo=Gp(re,ka);fE(lo);var Vr=($n^Tn>=0?-1:1)*zr(lo[2]);(Y>Vr||Y===Vr&&(ka[0]||ka[1]))&&(ie+=$n^Tn>=0?1:-1)}}return(Q<-gt||Q<gt&&se<-nE)^1&ie})(i,a);o.length?(g||(r.polygonStart(),g=!0),bR(o,pF,M,n,r)):M&&(g||(r.polygonStart(),g=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),g&&(r.polygonEnd(),g=!1),o=i=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function E(M,U){e(M,U)&&r.point(M,U)}function k(M,U){c.point(M,U)}function _(){v.point=k,c.lineStart()}function N(){v.point=E,c.lineEnd()}function O(M,U){u.push([M,U]),m.point(M,U)}function I(){m.lineStart(),u=[]}function B(){O(u[0][0],u[0][1]),m.lineEnd();var M,U,z,q,Y=m.clean(),K=f.result(),re=K.length;if(u.pop(),i.push(u),u=null,re)if(1&Y){if((U=(z=K[0]).length-1)>0){for(g||(r.polygonStart(),g=!0),r.lineStart(),M=0;M<U;++M)r.point((q=z[M])[0],q[1]);r.lineEnd()}}else re>1&&2&Y&&K.push(K.pop().concat(K.shift())),o.push(K.filter(fF))}return v}}function fF(e){return e.length>1}function pF(e,t){return((e=e.x)[0]<0?e[1]-On-gt:On-e[1])-((t=t.x)[0]<0?t[1]-On-gt:On-t[1])}Pk.invert=Pk;var ER=vR((function(){return!0}),(function(e){var t,n=NaN,a=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var u=i>0?Ot:-Ot,c=Mt(i-n);Mt(c-Ot)<gt?(e.point(n,a=(a+o)/2>0?On:-On),e.point(r,a),e.lineEnd(),e.lineStart(),e.point(u,a),e.point(i,a),t=0):r!==u&&c>=Ot&&(Mt(n-r)<gt&&(n-=r*gt),Mt(i-u)<gt&&(i-=u*gt),a=(function(f,m,g,v){var E,k,_=ft(f-g);return Mt(_)>gt?Up((ft(m)*(k=vt(v))*ft(g)-ft(v)*(E=vt(m))*ft(f))/(E*k*_)):(m+v)/2})(n,a,i,o),e.point(r,a),e.lineEnd(),e.lineStart(),e.point(u,a),t=0),e.point(n=i,a=o),r=u},lineEnd:function(){e.lineEnd(),n=a=NaN},clean:function(){return 2-t}}}),(function(e,t,n,a){var r;if(e==null)r=n*On,a.point(-Ot,r),a.point(0,r),a.point(Ot,r),a.point(Ot,0),a.point(Ot,-r),a.point(0,-r),a.point(-Ot,-r),a.point(-Ot,0),a.point(-Ot,r);else if(Mt(e[0]-t[0])>gt){var i=e[0]<t[0]?Ot:-Ot;r=n*i/2,a.point(-i,r),a.point(0,r),a.point(i,r)}else a.point(t[0],t[1])}),[-Ot,-On]);function hF(e){var t=vt(e),n=6*Rt,a=t>0,r=Mt(t)>gt;function i(c,f){return vt(c)*vt(f)>t}function o(c,f,m){var g=[1,0,0],v=Gp(hd(c),hd(f)),E=cE(v,v),k=v[0],_=E-k*k;if(!_)return!m&&c;var N=t*E/_,O=-t*k/_,I=Gp(g,v),B=dE(g,N);Nk(B,dE(v,O));var M=I,U=cE(B,M),z=cE(M,M),q=U*U-z*(cE(B,B)-1);if(!(q<0)){var Y=vr(q),K=dE(M,(-U-Y)/z);if(Nk(K,B),K=uE(K),!m)return K;var re,Q=c[0],ie=f[0],se=c[1],ue=f[1];ie<Q&&(re=Q,Q=ie,ie=re);var fe=ie-Q,ve=Mt(fe-Ot)<gt;if(!ve&&ue<se&&(re=se,se=ue,ue=re),ve||fe<gt?ve?se+ue>0^K[1]<(Mt(K[0]-Q)<gt?se:ue):se<=K[1]&&K[1]<=ue:fe>Ot^(Q<=K[0]&&K[0]<=ie)){var we=dE(M,(-U+Y)/z);return Nk(we,B),[K,uE(we)]}}}function u(c,f){var m=a?e:Ot-e,g=0;return c<-m?g|=1:c>m&&(g|=2),f<-m?g|=4:f>m&&(g|=8),g}return vR(i,(function(c){var f,m,g,v,E;return{lineStart:function(){v=g=!1,E=1},point:function(k,_){var N,O=[k,_],I=i(k,_),B=a?I?0:u(k,_):I?u(k+(k<0?Ot:-Ot),_):0;if(!f&&(v=g=I)&&c.lineStart(),I!==g&&(!(N=o(f,O))||EE(f,N)||EE(O,N))&&(O[2]=1),I!==g)E=0,I?(c.lineStart(),N=o(O,f),c.point(N[0],N[1])):(N=o(f,O),c.point(N[0],N[1],2),c.lineEnd()),f=N;else if(r&&f&&a^I){var M;B&m||!(M=o(O,f,!0))||(E=0,a?(c.lineStart(),c.point(M[0][0],M[0][1]),c.point(M[1][0],M[1][1]),c.lineEnd()):(c.point(M[1][0],M[1][1]),c.lineEnd(),c.lineStart(),c.point(M[0][0],M[0][1],3)))}!I||f&&EE(f,O)||c.point(O[0],O[1]),f=O,g=I,m=B},lineEnd:function(){g&&c.lineEnd(),f=null},clean:function(){return E|(v&&g)<<1}}}),(function(c,f,m,g){(function(v,E,k,_,N,O){if(k){var I=vt(E),B=ft(E),M=_*k;N==null?(N=E+_*yr,O=E-M/2):(N=mR(I,N),O=mR(I,O),(_>0?N<O:N>O)&&(N+=_*yr));for(var U,z=N;_>0?z>O:z<O;z-=M)U=uE([I,-B*vt(z),-B*ft(z)]),v.point(U[0],U[1])}})(g,e,n,m,c,f)}),a?[0,-e]:[-Ot,e-Ot])}var pb=1e9,_E=-pb;function wR(e,t,n,a){function r(f,m){return e<=f&&f<=n&&t<=m&&m<=a}function i(f,m,g,v){var E=0,k=0;if(f==null||(E=o(f,g))!==(k=o(m,g))||c(f,m)<0^g>0)do v.point(E===0||E===3?e:n,E>1?a:t);while((E=(E+g+4)%4)!==k);else v.point(m[0],m[1])}function o(f,m){return Mt(f[0]-e)<gt?m>0?0:3:Mt(f[0]-n)<gt?m>0?2:1:Mt(f[1]-t)<gt?m>0?1:0:m>0?3:2}function u(f,m){return c(f.x,m.x)}function c(f,m){var g=o(f,1),v=o(m,1);return g!==v?g-v:g===0?m[1]-f[1]:g===1?f[0]-m[0]:g===2?f[1]-m[1]:m[0]-f[0]}return function(f){var m,g,v,E,k,_,N,O,I,B,M,U=f,z=gR(),q={point:Y,lineStart:function(){q.point=K,g&&g.push(v=[]),B=!0,I=!1,N=O=NaN},lineEnd:function(){m&&(K(E,k),_&&I&&z.rejoin(),m.push(z.result())),q.point=Y,I&&U.lineEnd()},polygonStart:function(){U=z,m=[],g=[],M=!0},polygonEnd:function(){var re=(function(){for(var se=0,ue=0,fe=g.length;ue<fe;++ue)for(var ve,we,Oe=g[ue],Ue=1,He=Oe.length,De=Oe[0],ut=De[0],ct=De[1];Ue<He;++Ue)ve=ut,we=ct,ut=(De=Oe[Ue])[0],ct=De[1],we<=a?ct>a&&(ut-ve)*(a-we)>(ct-we)*(e-ve)&&++se:ct<=a&&(ut-ve)*(a-we)<(ct-we)*(e-ve)&&--se;return se})(),Q=M&&re,ie=(m=Eh(m)).length;(Q||ie)&&(f.polygonStart(),Q&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),ie&&bR(m,u,re,i,f),f.polygonEnd()),U=f,m=g=v=null}};function Y(re,Q){r(re,Q)&&U.point(re,Q)}function K(re,Q){var ie=r(re,Q);if(g&&v.push([re,Q]),B)E=re,k=Q,_=ie,B=!1,ie&&(U.lineStart(),U.point(re,Q));else if(ie&&I)U.point(re,Q);else{var se=[N=Math.max(_E,Math.min(pb,N)),O=Math.max(_E,Math.min(pb,O))],ue=[re=Math.max(_E,Math.min(pb,re)),Q=Math.max(_E,Math.min(pb,Q))];(function(fe,ve,we,Oe,Ue,He){var De,ut=fe[0],ct=fe[1],bt=0,Nt=1,bn=ve[0]-ut,Kt=ve[1]-ct;if(De=we-ut,bn||!(De>0)){if(De/=bn,bn<0){if(De<bt)return;De<Nt&&(Nt=De)}else if(bn>0){if(De>Nt)return;De>bt&&(bt=De)}if(De=Ue-ut,bn||!(De<0)){if(De/=bn,bn<0){if(De>Nt)return;De>bt&&(bt=De)}else if(bn>0){if(De<bt)return;De<Nt&&(Nt=De)}if(De=Oe-ct,Kt||!(De>0)){if(De/=Kt,Kt<0){if(De<bt)return;De<Nt&&(Nt=De)}else if(Kt>0){if(De>Nt)return;De>bt&&(bt=De)}if(De=He-ct,Kt||!(De<0)){if(De/=Kt,Kt<0){if(De>Nt)return;De>bt&&(bt=De)}else if(Kt>0){if(De<bt)return;De<Nt&&(Nt=De)}return bt>0&&(fe[0]=ut+bt*bn,fe[1]=ct+bt*Kt),Nt<1&&(ve[0]=ut+Nt*bn,ve[1]=ct+Nt*Kt),!0}}}}})(se,ue,e,t,n,a)?(I||(U.lineStart(),U.point(se[0],se[1])),U.point(ue[0],ue[1]),ie||U.lineEnd(),M=!1):ie&&(U.lineStart(),U.point(re,Q),M=!1)}N=re,O=Q,I=ie}return q}}function _R(e,t,n){var a=Qn(e,t-gt,n).concat(t);return function(r){return a.map((function(i){return[r,i]}))}}function kR(e,t,n){var a=Qn(e,t-gt,n).concat(t);return function(r){return a.map((function(i){return[i,r]}))}}var SR,xR,Bk,Uk,hb=e=>e,zk=new za,Gk=new za,zu={point:Ma,lineStart:Ma,lineEnd:Ma,polygonStart:function(){zu.lineStart=mF,zu.lineEnd=bF},polygonEnd:function(){zu.lineStart=zu.lineEnd=zu.point=Ma,zk.add(Mt(Gk)),Gk=new za},result:function(){var e=zk/2;return zk=new za,e}};function mF(){zu.point=gF}function gF(e,t){zu.point=AR,SR=Bk=e,xR=Uk=t}function AR(e,t){Gk.add(Uk*e-Bk*t),Bk=e,Uk=t}function bF(){AR(SR,xR)}var TR=zu,jp=1/0,kE=jp,mb=-jp,SE=mb,yF={point:function(e,t){e<jp&&(jp=e),e>mb&&(mb=e),t<kE&&(kE=t),t>SE&&(SE=t)},lineStart:Ma,lineEnd:Ma,polygonStart:Ma,polygonEnd:Ma,result:function(){var e=[[jp,kE],[mb,SE]];return mb=SE=-(kE=jp=1/0),e}},CR,RR,Ns,Is,xE=yF,jk=0,Hk=0,gb=0,AE=0,TE=0,Hp=0,qk=0,Wk=0,bb=0,jo={point:md,lineStart:NR,lineEnd:IR,polygonStart:function(){jo.lineStart=wF,jo.lineEnd=_F},polygonEnd:function(){jo.point=md,jo.lineStart=NR,jo.lineEnd=IR},result:function(){var e=bb?[qk/bb,Wk/bb]:Hp?[AE/Hp,TE/Hp]:gb?[jk/gb,Hk/gb]:[NaN,NaN];return jk=Hk=gb=AE=TE=Hp=qk=Wk=bb=0,e}};function md(e,t){jk+=e,Hk+=t,++gb}function NR(){jo.point=vF}function vF(e,t){jo.point=EF,md(Ns=e,Is=t)}function EF(e,t){var n=e-Ns,a=t-Is,r=vr(n*n+a*a);AE+=r*(Ns+e)/2,TE+=r*(Is+t)/2,Hp+=r,md(Ns=e,Is=t)}function IR(){jo.point=md}function wF(){jo.point=kF}function _F(){OR(CR,RR)}function kF(e,t){jo.point=OR,md(CR=Ns=e,RR=Is=t)}function OR(e,t){var n=e-Ns,a=t-Is,r=vr(n*n+a*a);AE+=r*(Ns+e)/2,TE+=r*(Is+t)/2,Hp+=r,qk+=(r=Is*e-Ns*t)*(Ns+e),Wk+=r*(Is+t),bb+=3*r,md(Ns=e,Is=t)}var DR=jo;function MR(e){this._context=e}MR.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,yr)}},result:Ma};var Vk,LR,FR,yb,vb,Yk=new za,CE={point:Ma,lineStart:function(){CE.point=SF},lineEnd:function(){Vk&&PR(LR,FR),CE.point=Ma},polygonStart:function(){Vk=!0},polygonEnd:function(){Vk=null},result:function(){var e=+Yk;return Yk=new za,e}};function SF(e,t){CE.point=PR,LR=yb=e,FR=vb=t}function PR(e,t){yb-=e,vb-=t,Yk.add(vr(yb*yb+vb*vb)),yb=e,vb=t}var $R=CE;let BR,RE,UR,zR;class GR{constructor(t){this._append=t==null?jR:(function(n){let a=Math.floor(n);if(!(a>=0))throw new RangeError(`invalid digits: ${n}`);if(a>15)return jR;if(a!==BR){let r=10**a;BR=a,RE=function(i){let o=1;this._+=i[0];for(let u=i.length;o<u;++o)this._+=Math.round(arguments[o]*r)/r+i[o]}}return RE})(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:if(this._append`M${t},${n}`,this._radius!==UR||this._append!==RE){let a=this._radius,r=this._;this._="",this._append`m0,${a}a${a},${a} 0 1,1 0,${-2*a}a${a},${a} 0 1,1 0,${2*a}z`,UR=a,RE=this._append,zR=this._,this._=r}this._+=zR}}result(){let t=this._;return this._="",t.length?t:null}}function jR(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function HR(e,t){let n,a,r=3,i=4.5;function o(u){return u&&(typeof i=="function"&&a.pointRadius(+i.apply(this,arguments)),Sl(u,n(a))),a.result()}return o.area=function(u){return Sl(u,n(TR)),TR.result()},o.measure=function(u){return Sl(u,n($R)),$R.result()},o.bounds=function(u){return Sl(u,n(xE)),xE.result()},o.centroid=function(u){return Sl(u,n(DR)),DR.result()},o.projection=function(u){return arguments.length?(n=u==null?(e=null,hb):(e=u).stream,o):e},o.context=function(u){return arguments.length?(a=u==null?(t=null,new GR(r)):new MR(t=u),typeof i!="function"&&a.pointRadius(i),o):t},o.pointRadius=function(u){return arguments.length?(i=typeof u=="function"?u:(a.pointRadius(+u),+u),o):i},o.digits=function(u){if(!arguments.length)return r;if(u==null)r=null;else{let c=Math.floor(u);if(!(c>=0))throw new RangeError(`invalid digits: ${u}`);r=c}return t===null&&(a=new GR(r)),o},o.projection(e).digits(r).context(t)}function NE(e){return function(t){var n=new Kk;for(var a in e)n[a]=e[a];return n.stream=t,n}}function Kk(){}function Xk(e,t,n){var a=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),a!=null&&e.clipExtent(null),Sl(n,e.stream(xE)),t(xE.result()),a!=null&&e.clipExtent(a),e}function IE(e,t,n){return Xk(e,(function(a){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(a[1][0]-a[0][0]),i/(a[1][1]-a[0][1])),u=+t[0][0]+(r-o*(a[1][0]+a[0][0]))/2,c=+t[0][1]+(i-o*(a[1][1]+a[0][1]))/2;e.scale(150*o).translate([u,c])}),n)}function Zk(e,t,n){return IE(e,[[0,0],t],n)}function Jk(e,t,n){return Xk(e,(function(a){var r=+t,i=r/(a[1][0]-a[0][0]),o=(r-i*(a[1][0]+a[0][0]))/2,u=-i*a[0][1];e.scale(150*i).translate([o,u])}),n)}function Qk(e,t,n){return Xk(e,(function(a){var r=+t,i=r/(a[1][1]-a[0][1]),o=-i*a[0][0],u=(r-i*(a[1][1]+a[0][1]))/2;e.scale(150*i).translate([o,u])}),n)}Kk.prototype={constructor:Kk,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var qR=16,xF=vt(30*Rt);function WR(e,t){return+t?(function(n,a){function r(i,o,u,c,f,m,g,v,E,k,_,N,O,I){var B=g-i,M=v-o,U=B*B+M*M;if(U>4*a&&O--){var z=c+k,q=f+_,Y=m+N,K=vr(z*z+q*q+Y*Y),re=zr(Y/=K),Q=Mt(Mt(Y)-1)<gt||Mt(u-E)<gt?(u+E)/2:ao(q,z),ie=n(Q,re),se=ie[0],ue=ie[1],fe=se-i,ve=ue-o,we=M*fe-B*ve;(we*we/U>a||Mt((B*fe+M*ve)/U-.5)>.3||c*k+f*_+m*N<xF)&&(r(i,o,u,c,f,m,se,ue,Q,z/=K,q/=K,Y,O,I),I.point(se,ue),r(se,ue,Q,z,q,Y,g,v,E,k,_,N,O,I))}}return function(i){var o,u,c,f,m,g,v,E,k,_,N,O,I={point:B,lineStart:M,lineEnd:z,polygonStart:function(){i.polygonStart(),I.lineStart=q},polygonEnd:function(){i.polygonEnd(),I.lineStart=M}};function B(re,Q){re=n(re,Q),i.point(re[0],re[1])}function M(){E=NaN,I.point=U,i.lineStart()}function U(re,Q){var ie=hd([re,Q]),se=n(re,Q);r(E,k,v,_,N,O,E=se[0],k=se[1],v=re,_=ie[0],N=ie[1],O=ie[2],qR,i),i.point(E,k)}function z(){I.point=B,i.lineEnd()}function q(){M(),I.point=Y,I.lineEnd=K}function Y(re,Q){U(o=re,Q),u=E,c=k,f=_,m=N,g=O,I.point=U}function K(){r(E,k,v,_,N,O,u,c,o,f,m,g,qR,i),I.lineEnd=z,z()}return I}})(e,t):(function(n){return NE({point:function(a,r){a=n(a,r),this.stream.point(a[0],a[1])}})})(e)}var AF=NE({point:function(e,t){this.stream.point(e*Rt,t*Rt)}});function VR(e,t,n,a,r,i){if(!i)return(function(_,N,O,I,B){function M(U,z){return[N+_*(U*=I),O-_*(z*=B)]}return M.invert=function(U,z){return[(U-N)/_*I,(O-z)/_*B]},M})(e,t,n,a,r);var o=vt(i),u=ft(i),c=o*e,f=u*e,m=o/e,g=u/e,v=(u*n-o*t)/e,E=(u*t+o*n)/e;function k(_,N){return[c*(_*=a)-f*(N*=r)+t,n-f*_-c*N]}return k.invert=function(_,N){return[a*(m*_-g*N+v),r*(E-g*_-m*N)]},k}function Os(e){return YR((function(){return e}))()}function YR(e){var t,n,a,r,i,o,u,c,f,m,g=150,v=480,E=250,k=0,_=0,N=0,O=0,I=0,B=0,M=1,U=1,z=null,q=ER,Y=null,K=hb,re=.5;function Q(fe){return c(fe[0]*Rt,fe[1]*Rt)}function ie(fe){return(fe=c.invert(fe[0],fe[1]))&&[fe[0]*Pn,fe[1]*Pn]}function se(){var fe=VR(g,0,0,M,U,B).apply(null,t(k,_)),ve=VR(g,v-fe[0],E-fe[1],M,U,B);return n=dR(N,O,I),u=Fk(t,ve),c=Fk(n,u),o=WR(u,re),ue()}function ue(){return f=m=null,Q}return Q.stream=function(fe){return f&&m===fe?f:f=AF((function(ve){return NE({point:function(we,Oe){var Ue=ve(we,Oe);return this.stream.point(Ue[0],Ue[1])}})})(n)(q(o(K(m=fe)))))},Q.preclip=function(fe){return arguments.length?(q=fe,z=void 0,ue()):q},Q.postclip=function(fe){return arguments.length?(K=fe,Y=a=r=i=null,ue()):K},Q.clipAngle=function(fe){return arguments.length?(q=+fe?hF(z=fe*Rt):(z=null,ER),ue()):z*Pn},Q.clipExtent=function(fe){return arguments.length?(K=fe==null?(Y=a=r=i=null,hb):wR(Y=+fe[0][0],a=+fe[0][1],r=+fe[1][0],i=+fe[1][1]),ue()):Y==null?null:[[Y,a],[r,i]]},Q.scale=function(fe){return arguments.length?(g=+fe,se()):g},Q.translate=function(fe){return arguments.length?(v=+fe[0],E=+fe[1],se()):[v,E]},Q.center=function(fe){return arguments.length?(k=fe[0]%360*Rt,_=fe[1]%360*Rt,se()):[k*Pn,_*Pn]},Q.rotate=function(fe){return arguments.length?(N=fe[0]%360*Rt,O=fe[1]%360*Rt,I=fe.length>2?fe[2]%360*Rt:0,se()):[N*Pn,O*Pn,I*Pn]},Q.angle=function(fe){return arguments.length?(B=fe%360*Rt,se()):B*Pn},Q.reflectX=function(fe){return arguments.length?(M=fe?-1:1,se()):M<0},Q.reflectY=function(fe){return arguments.length?(U=fe?-1:1,se()):U<0},Q.precision=function(fe){return arguments.length?(o=WR(u,re=fe*fe),ue()):vr(re)},Q.fitExtent=function(fe,ve){return IE(Q,fe,ve)},Q.fitSize=function(fe,ve){return Zk(Q,fe,ve)},Q.fitWidth=function(fe,ve){return Jk(Q,fe,ve)},Q.fitHeight=function(fe,ve){return Qk(Q,fe,ve)},function(){return t=e.apply(this,arguments),Q.invert=t.invert&&ie,se()}}function eS(e){var t=0,n=Ot/3,a=YR(e),r=a(t,n);return r.parallels=function(i){return arguments.length?a(t=i[0]*Rt,n=i[1]*Rt):[t*Pn,n*Pn]},r}function TF(e,t){var n=ft(e),a=(n+ft(t))/2;if(Mt(a)<gt)return(function(u){var c=vt(u);function f(m,g){return[m*c,ft(g)/c]}return f.invert=function(m,g){return[m/c,zr(g*c)]},f})(e);var r=1+n*(2*a-n),i=vr(r)/a;function o(u,c){var f=vr(r-2*a*ft(c))/a;return[f*ft(u*=a),i-f*vt(u)]}return o.invert=function(u,c){var f=i-c,m=ao(u,Mt(f))*ro(f);return f*a<0&&(m-=Ot*ro(u)*ro(f)),[m/a,zr((r-(u*u+f*f)*a*a)/(2*a))]},o}function OE(){return eS(TF).scale(155.424).center([0,33.6442])}function KR(){return OE().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function XR(e){return function(t,n){var a=vt(t),r=vt(n),i=e(a*r);return i===1/0?[2,0]:[i*r*ft(t),i*ft(n)]}}function Eb(e){return function(t,n){var a=vr(t*t+n*n),r=e(a),i=ft(r),o=vt(r);return[ao(t*i,a*o),zr(a&&n*i/a)]}}var ZR=XR((function(e){return vr(2/(1+e))}));ZR.invert=Eb((function(e){return 2*zr(e/2)}));var JR=XR((function(e){return(e=WC(e))&&e/ft(e)}));function DE(e,t){return[e,iE(xk((On+t)/2))]}function QR(e){var t,n,a,r=Os(e),i=r.center,o=r.scale,u=r.translate,c=r.clipExtent,f=null;function m(){var g=Ot*o(),v=r((function(E){function k(_){return(_=E(_[0]*Rt,_[1]*Rt))[0]*=Pn,_[1]*=Pn,_}return E=dR(E[0]*Rt,E[1]*Rt,E.length>2?E[2]*Rt:0),k.invert=function(_){return(_=E.invert(_[0]*Rt,_[1]*Rt))[0]*=Pn,_[1]*=Pn,_},k})(r.rotate()).invert([0,0]));return c(f==null?[[v[0]-g,v[1]-g],[v[0]+g,v[1]+g]]:e===DE?[[Math.max(v[0]-g,f),t],[Math.min(v[0]+g,n),a]]:[[f,Math.max(v[1]-g,t)],[n,Math.min(v[1]+g,a)]])}return r.scale=function(g){return arguments.length?(o(g),m()):o()},r.translate=function(g){return arguments.length?(u(g),m()):u()},r.center=function(g){return arguments.length?(i(g),m()):i()},r.clipExtent=function(g){return arguments.length?(g==null?f=t=n=a=null:(f=+g[0][0],t=+g[0][1],n=+g[1][0],a=+g[1][1]),m()):f==null?null:[[f,t],[n,a]]},m()}function ME(e){return xk((On+e)/2)}function CF(e,t){var n=vt(e),a=e===t?ft(e):iE(n/vt(t))/iE(ME(t)/ME(e)),r=n*Sk(ME(e),a)/a;if(!a)return DE;function i(o,u){r>0?u<-On+gt&&(u=-On+gt):u>On-gt&&(u=On-gt);var c=r/Sk(ME(u),a);return[c*ft(a*o),r-c*vt(a*o)]}return i.invert=function(o,u){var c=r-u,f=ro(a)*vr(o*o+c*c),m=ao(o,Mt(c))*ro(c);return c*a<0&&(m-=Ot*ro(o)*ro(c)),[m/a,2*Up(Sk(r/f,1/a))-On]},i}function LE(e,t){return[e,t]}function RF(e,t){var n=vt(e),a=e===t?ft(e):(n-vt(t))/(t-e),r=n/a+e;if(Mt(a)<gt)return LE;function i(o,u){var c=r-u,f=a*o;return[c*ft(f),r-c*vt(f)]}return i.invert=function(o,u){var c=r-u,f=ao(o,Mt(c))*ro(c);return c*a<0&&(f-=Ot*ro(o)*ro(c)),[f/a,r-ro(a)*vr(o*o+c*c)]},i}JR.invert=Eb((function(e){return e})),DE.invert=function(e,t){return[e,2*Up(qC(t))-On]},LE.invert=LE;var wb=1.340264,_b=-.081106,kb=893e-6,Sb=.003796,FE=vr(3)/2;function eN(e,t){var n=zr(FE*ft(t)),a=n*n,r=a*a*a;return[e*vt(n)/(FE*(wb+3*_b*a+r*(7*kb+9*Sb*a))),n*(wb+_b*a+r*(kb+Sb*a))]}function tN(e,t){var n=vt(t),a=vt(e)*n;return[n*ft(e)/a,ft(t)/a]}function nN(e,t){var n=t*t,a=n*n;return[e*(.8707-.131979*n+a*(a*(.003971*n-.001529*a)-.013791)),t*(1.007226+n*(.015085+a*(.028874*n-.044475-.005916*a)))]}function aN(e,t){return[vt(t)*ft(e),ft(t)]}function rN(e,t){var n=vt(t),a=1+vt(e)*n;return[n*ft(e)/a,ft(t)/a]}function iN(e,t){return[iE(xk((On+t)/2)),-e]}eN.invert=function(e,t){for(var n,a=t,r=a*a,i=r*r*r,o=0;o<12&&(i=(r=(a-=n=(a*(wb+_b*r+i*(kb+Sb*r))-t)/(wb+3*_b*r+i*(7*kb+9*Sb*r)))*a)*r*r,!(Mt(n)<nE));++o);return[FE*e*(wb+3*_b*r+i*(7*kb+9*Sb*r))/vt(a),zr(ft(a)/FE)]},tN.invert=Eb(Up),nN.invert=function(e,t){var n,a=t,r=25;do{var i=a*a,o=i*i;a-=n=(a*(1.007226+i*(.015085+o*(.028874*i-.044475-.005916*o)))-t)/(1.007226+i*(.045255+o*(.259866*i-.311325-.005916*11*o)))}while(Mt(n)>gt&&--r>0);return[e/(.8707+(i=a*a)*(i*(i*i*i*(.003971-.001529*i)-.013791)-.131979)),a]},aN.invert=Eb(zr),rN.invert=Eb((function(e){return 2*Up(e)})),iN.invert=function(e,t){return[-t,2*Up(qC(e))-On]};var NF=Math.abs,tS=Math.cos,PE=Math.sin,IF=1e-6,oN=Math.PI,nS=oN/2,sN=(function(e){return e>0?Math.sqrt(e):0})(2);function lN(e){return e>1?nS:e<-1?-nS:Math.asin(e)}function OF(e,t){var n,a=e*PE(t),r=30;do t-=n=(t+PE(t)-a)/(1+tS(t));while(NF(n)>IF&&--r>0);return t/2}var DF=(function(e,t,n){function a(r,i){return[e*r*tS(i=OF(n,i)),t*PE(i)]}return a.invert=function(r,i){return i=lN(i/t),[r/(e*tS(i)),lN((2*i+PE(2*i))/n)]},a})(sN/nS,sN,oN);let MF=HR(),aS=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rS(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?($E[e]=(function(n,a){return function r(){let i=a();return i.type=n,i.path=HR().projection(i),i.copy=i.copy||function(){let o=r();return aS.forEach((u=>{i[u]&&o[u](i[u]())})),o.path.pointRadius(i.path.pointRadius()),o},Ap(i)}})(e,t),this):$E[e]||null}function uN(e){return e&&e.path||MF}let $E={albers:KR,albersusa:function(){var e,t,n,a,r,i,o=KR(),u=OE().rotate([154,0]).center([-2,58.5]).parallels([55,65]),c=OE().rotate([157,0]).center([-3,19.9]).parallels([8,18]),f={point:function(v,E){i=[v,E]}};function m(v){var E=v[0],k=v[1];return i=null,n.point(E,k),i||(a.point(E,k),i)||(r.point(E,k),i)}function g(){return e=t=null,m}return m.invert=function(v){var E=o.scale(),k=o.translate(),_=(v[0]-k[0])/E,N=(v[1]-k[1])/E;return(N>=.12&&N<.234&&_>=-.425&&_<-.214?u:N>=.166&&N<.234&&_>=-.214&&_<-.115?c:o).invert(v)},m.stream=function(v){return e&&t===v?e:(E=[o.stream(t=v),u.stream(v),c.stream(v)],k=E.length,e={point:function(_,N){for(var O=-1;++O<k;)E[O].point(_,N)},sphere:function(){for(var _=-1;++_<k;)E[_].sphere()},lineStart:function(){for(var _=-1;++_<k;)E[_].lineStart()},lineEnd:function(){for(var _=-1;++_<k;)E[_].lineEnd()},polygonStart:function(){for(var _=-1;++_<k;)E[_].polygonStart()},polygonEnd:function(){for(var _=-1;++_<k;)E[_].polygonEnd()}});var E,k},m.precision=function(v){return arguments.length?(o.precision(v),u.precision(v),c.precision(v),g()):o.precision()},m.scale=function(v){return arguments.length?(o.scale(v),u.scale(.35*v),c.scale(v),m.translate(o.translate())):o.scale()},m.translate=function(v){if(!arguments.length)return o.translate();var E=o.scale(),k=+v[0],_=+v[1];return n=o.translate(v).clipExtent([[k-.455*E,_-.238*E],[k+.455*E,_+.238*E]]).stream(f),a=u.translate([k-.307*E,_+.201*E]).clipExtent([[k-.425*E+gt,_+.12*E+gt],[k-.214*E-gt,_+.234*E-gt]]).stream(f),r=c.translate([k-.205*E,_+.212*E]).clipExtent([[k-.214*E+gt,_+.166*E+gt],[k-.115*E-gt,_+.234*E-gt]]).stream(f),g()},m.fitExtent=function(v,E){return IE(m,v,E)},m.fitSize=function(v,E){return Zk(m,v,E)},m.fitWidth=function(v,E){return Jk(m,v,E)},m.fitHeight=function(v,E){return Qk(m,v,E)},m.scale(1070)},azimuthalequalarea:function(){return Os(ZR).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return Os(JR).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return eS(CF).scale(109.5).parallels([30,30])},conicequalarea:OE,conicequidistant:function(){return eS(RF).scale(131.154).center([0,13.9389])},equalEarth:function(){return Os(eN).scale(177.158)},equirectangular:function(){return Os(LE).scale(152.63)},gnomonic:function(){return Os(tN).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,a,r,i,o,u=1,c=0,f=0,m=1,g=1,v=0,E=null,k=1,_=1,N=NE({point:function(M,U){var z=B([M,U]);this.stream.point(z[0],z[1])}}),O=hb;function I(){return k=u*m,_=u*g,i=o=null,B}function B(M){var U=M[0]*k,z=M[1]*_;if(v){var q=z*e-U*t;U=U*e+z*t,z=q}return[U+c,z+f]}return B.invert=function(M){var U=M[0]-c,z=M[1]-f;if(v){var q=z*e+U*t;U=U*e-z*t,z=q}return[U/k,z/_]},B.stream=function(M){return i&&o===M?i:i=N(O(o=M))},B.postclip=function(M){return arguments.length?(O=M,E=n=a=r=null,I()):O},B.clipExtent=function(M){return arguments.length?(O=M==null?(E=n=a=r=null,hb):wR(E=+M[0][0],n=+M[0][1],a=+M[1][0],r=+M[1][1]),I()):E==null?null:[[E,n],[a,r]]},B.scale=function(M){return arguments.length?(u=+M,I()):u},B.translate=function(M){return arguments.length?(c=+M[0],f=+M[1],I()):[c,f]},B.angle=function(M){return arguments.length?(t=ft(v=M%360*Rt),e=vt(v),I()):v*Pn},B.reflectX=function(M){return arguments.length?(m=M?-1:1,I()):m<0},B.reflectY=function(M){return arguments.length?(g=M?-1:1,I()):g<0},B.fitExtent=function(M,U){return IE(B,M,U)},B.fitSize=function(M,U){return Zk(B,M,U)},B.fitWidth=function(M,U){return Jk(B,M,U)},B.fitHeight=function(M,U){return Qk(B,M,U)},B},mercator:function(){return QR(DE).scale(961/yr)},mollweide:function(){return Os(DF).scale(169.529)},naturalEarth1:function(){return Os(nN).scale(175.295)},orthographic:function(){return Os(aN).scale(249.5).clipAngle(90+gt)},stereographic:function(){return Os(rN).scale(250).clipAngle(142)},transversemercator:function(){var e=QR(iN),t=e.center,n=e.rotate;return e.center=function(a){return arguments.length?t([-a[1],a[0]]):[(a=t())[1],-a[0]]},e.rotate=function(a){return arguments.length?n([a[0],a[1],a.length>2?a[2]+90:90]):[(a=n())[0],a[1],a[2]-90]},n([0,0,90]).scale(159.155)}};for(let e in $E)rS(e,$E[e]);function LF(){}let Tl=[[],[[[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 cN(){var e=1,t=1,n=o;function a(u,c){return c.map((f=>r(u,f)))}function r(u,c){var f=[],m=[];return(function(g,v,E){var k,_,N,O,I,B,M=new Array,U=new Array;for(k=_=-1,O=g[0]>=v,Tl[O<<1].forEach(z);++k<e-1;)N=O,O=g[k+1]>=v,Tl[N|O<<1].forEach(z);for(Tl[O<<0].forEach(z);++_<t-1;){for(k=-1,O=g[_*e+e]>=v,I=g[_*e]>=v,Tl[O<<1|I<<2].forEach(z);++k<e-1;)N=O,O=g[_*e+e+k+1]>=v,B=I,I=g[_*e+k+1]>=v,Tl[N|O<<1|I<<2|B<<3].forEach(z);Tl[O|I<<3].forEach(z)}for(k=-1,I=g[_*e]>=v,Tl[I<<2].forEach(z);++k<e-1;)B=I,I=g[_*e+k+1]>=v,Tl[I<<2|B<<3].forEach(z);function z(q){var Y,K,re=[q[0][0]+k,q[0][1]+_],Q=[q[1][0]+k,q[1][1]+_],ie=i(re),se=i(Q);(Y=U[ie])?(K=M[se])?(delete U[Y.end],delete M[K.start],Y===K?(Y.ring.push(Q),E(Y.ring)):M[Y.start]=U[K.end]={start:Y.start,end:K.end,ring:Y.ring.concat(K.ring)}):(delete U[Y.end],Y.ring.push(Q),U[Y.end=se]=Y):(Y=M[se])?(K=U[ie])?(delete M[Y.start],delete U[K.end],Y===K?(Y.ring.push(Q),E(Y.ring)):M[K.start]=U[Y.end]={start:K.start,end:Y.end,ring:K.ring.concat(Y.ring)}):(delete M[Y.start],Y.ring.unshift(re),M[Y.start=ie]=Y):M[ie]=U[se]={start:ie,end:se,ring:[re,Q]}}Tl[I<<3].forEach(z)})(u,c,(g=>{n(g,u,c),(function(v){for(var E=0,k=v.length,_=v[k-1][1]*v[0][0]-v[k-1][0]*v[0][1];++E<k;)_+=v[E-1][1]*v[E][0]-v[E-1][0]*v[E][1];return _})(g)>0?f.push([g]):m.push(g)})),m.forEach((g=>{for(var v,E=0,k=f.length;E<k;++E)if(FF((v=f[E])[0],g)!==-1)return void v.push(g)})),{type:"MultiPolygon",value:c,coordinates:f}}function i(u){return 2*u[0]+u[1]*(e+1)*4}function o(u,c,f){u.forEach((m=>{var g,v=m[0],E=m[1],k=0|v,_=0|E,N=c[_*e+k];v>0&&v<e&&k===v&&(g=c[_*e+k-1],m[0]=v+(f-g)/(N-g)-.5),E>0&&E<t&&_===E&&(g=c[(_-1)*e+k],m[1]=E+(f-g)/(N-g)-.5)}))}return a.contour=r,a.size=function(u){if(!arguments.length)return[e,t];var c=Math.floor(u[0]),f=Math.floor(u[1]);return c>=0&&f>=0||F("invalid size"),e=c,t=f,a},a.smooth=function(u){return arguments.length?(n=u?o:LF,a):n===o},a}function FF(e,t){for(var n,a=-1,r=t.length;++a<r;)if(n=PF(e,t[a]))return n;return 0}function PF(e,t){for(var n=t[0],a=t[1],r=-1,i=0,o=e.length,u=o-1;i<o;u=i++){var c=e[i],f=c[0],m=c[1],g=e[u],v=g[0],E=g[1];if($F(c,g,t))return 0;m>a!=E>a&&n<(v-f)*(a-m)/(E-m)+f&&(r=-r)}return r}function $F(e,t,n){var a,r,i,o;return(function(u,c,f){return(c[0]-u[0])*(f[1]-u[1])==(f[0]-u[0])*(c[1]-u[1])})(e,t,n)&&(r=e[a=+(e[0]===t[0])],i=n[a],o=t[a],r<=i&&i<=o||o<=i&&i<=r)}function dN(e,t,n){return function(a){var r=Un(a),i=n?Math.min(r[0],0):r[0],o=r[1],u=o-i,c=t?Ri(i,o,e):u/(e+1);return Qn(i+c,o,c)}}function iS(e){Se.call(this,null,e)}function fN(e,t,n,a,r){let i=e.x1||0,o=e.y1||0,u=t*n<0;function c(g){g.forEach(f)}function f(g){u&&g.reverse(),g.forEach(m)}function m(g){g[0]=(g[0]-i)*t+a,g[1]=(g[1]-o)*n+r}return function(g){return g.coordinates.forEach(c),g}}function pN(e,t,n){let a=e>=0?e:um(t,n);return Math.round((Math.sqrt(4*a*a+1)-1)/2)}function oS(e){return tt(e)?e:mn(+e)}function hN(){var e=c=>c[0],t=c=>c[1],n=he,a=[-1,-1],r=960,i=500,o=2;function u(c,f){let m=pN(a[0],c,e)>>o,g=pN(a[1],c,t)>>o,v=m?m+2:0,E=g?g+2:0,k=2*v+(r>>o),_=2*E+(i>>o),N=new Float32Array(k*_),O=new Float32Array(k*_),I=N;c.forEach((M=>{let U=v+(+e(M)>>o),z=E+(+t(M)>>o);U>=0&&U<k&&z>=0&&z<_&&(N[U+z*k]+=+n(M))})),m>0&&g>0?(qp(k,_,N,O,m),Wp(k,_,O,N,g),qp(k,_,N,O,m),Wp(k,_,O,N,g),qp(k,_,N,O,m),Wp(k,_,O,N,g)):m>0?(qp(k,_,N,O,m),qp(k,_,O,N,m),qp(k,_,N,O,m),I=O):g>0&&(Wp(k,_,N,O,g),Wp(k,_,O,N,g),Wp(k,_,N,O,g),I=O);let B=f?Math.pow(2,-2*o):1/x_(I);for(let M=0,U=k*_;M<U;++M)I[M]*=B;return{values:I,scale:1<<o,width:k,height:_,x1:v,y1:E,x2:v+(r>>o),y2:E+(i>>o)}}return u.x=function(c){return arguments.length?(e=oS(c),u):e},u.y=function(c){return arguments.length?(t=oS(c),u):t},u.weight=function(c){return arguments.length?(n=oS(c),u):n},u.size=function(c){if(!arguments.length)return[r,i];var f=+c[0],m=+c[1];return f>=0&&m>=0||F("invalid size"),r=f,i=m,u},u.cellSize=function(c){return arguments.length?((c=+c)>=1||F("invalid cell size"),o=Math.floor(Math.log(c)/Math.LN2),u):1<<o},u.bandwidth=function(c){return arguments.length?((c=Ie(c)).length===1&&(c=[+c[0],+c[0]]),c.length!==2&&F("invalid bandwidth"),a=c,u):a},u}function qp(e,t,n,a,r){let i=1+(r<<1);for(let o=0;o<t;++o)for(let u=0,c=0;u<e+r;++u)u<e&&(c+=n[u+o*e]),u>=r&&(u>=i&&(c-=n[u-i+o*e]),a[u-r+o*e]=c/Math.min(u+1,e-1+i-u,i))}function Wp(e,t,n,a,r){let i=1+(r<<1);for(let o=0;o<e;++o)for(let u=0,c=0;u<t+r;++u)u<t&&(c+=n[o+u*e]),u>=r&&(u>=i&&(c-=n[o+(u-i)*e]),a[o+(u-r)*e]=c/Math.min(u+1,t-1+i-u,i))}function sS(e){Se.call(this,null,e)}iS.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"}]},Fe(iS,Se,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),a=t.materialize(t.SOURCE).source,r=e.field||ee,i=cN().smooth(e.smooth!==!1),o=e.thresholds||(function(f,m,g){let v=dN(g.levels||10,g.nice,g.zero!==!1);return g.resolve!=="shared"?v:v(f.map((E=>zs(m(E).values))))})(a,r,e),u=e.as===null?null:e.as||"contour",c=[];return a.forEach((f=>{let m=r(f),g=i.size([m.width,m.height])(m.values,Ee(o)?o:o(m.values));(function(v,E,k,_){let N=_.scale||E.scale,O=_.translate||E.translate;if(tt(N)&&(N=N(k,_)),tt(O)&&(O=O(k,_)),(N===1||N==null)&&!O)return;let I=(Ba(N)?N:N[0])||1,B=(Ba(N)?N:N[1])||1,M=O&&O[0]||0,U=O&&O[1]||0;v.forEach(fN(E,I,B,M,U))})(g,m,f,e),g.forEach((v=>{c.push(mc(f,It(u!=null?{[u]:v}:v)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),sS.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"}]};let BF=["x","y","weight","size","cellSize","bandwidth"];function mN(e,t){return BF.forEach((n=>t[n]!=null?e[n](t[n]):0)),e}function lS(e){Se.call(this,null,e)}Fe(sS,Se,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,a=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=(function(c,f){var m,g,v,E,k,_,N=[],O=I=>I(E);if(f==null)N.push(c);else for(m={},g=0,v=c.length;g<v;++g)E=c[g],(_=m[k=f.map(O)])||(m[k]=_=[],_.dims=k,N.push(_)),_.push(E);return N})(t.materialize(t.SOURCE).source,e.groupby),i=(e.groupby||[]).map(S),o=mN(hN(),e),u=e.as||"grid";return n=r.map((c=>It((function(f,m){for(let g=0;g<i.length;++g)f[i[g]]=m[g];return f})({[u]:o(c,e.counts)},c.dims)))),this.value&&(a.rem=this.value),this.value=a.source=a.add=n,a}}),lS.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}]},Fe(lS,Se,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,a,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=cN().smooth(e.smooth!==!1),o=e.values,u=e.thresholds||dN(e.count||10,e.nice,!!o),c=e.size;return o||(o=t.materialize(t.SOURCE).source,a=fN(n=mN(hN(),e)(o,!0),n.scale||1,n.scale||1,0,0),c=[n.width,n.height],o=n.values),u=Ee(u)?u:u(o),o=i.size(c)(o,u),a&&o.forEach(a),this.value&&(r.rem=this.value),this.value=r.source=r.add=(o||[]).map(It),r}});let uS="Feature",cS="FeatureCollection";function dS(e){Se.call(this,null,e)}function fS(e){Se.call(this,null,e)}function pS(e){Se.call(this,null,e)}function hS(e){Se.call(this,null,e)}function mS(e){Se.call(this,[],e),this.generator=(function(){var t,n,a,r,i,o,u,c,f,m,g,v,E=10,k=E,_=90,N=360,O=2.5;function I(){return{type:"MultiLineString",coordinates:B()}}function B(){return Qn(rE(r/_)*_,a,_).map(g).concat(Qn(rE(c/N)*N,u,N).map(v)).concat(Qn(rE(n/E)*E,t,E).filter((function(M){return Mt(M%_)>gt})).map(f)).concat(Qn(rE(o/k)*k,i,k).filter((function(M){return Mt(M%N)>gt})).map(m))}return I.lines=function(){return B().map((function(M){return{type:"LineString",coordinates:M}}))},I.outline=function(){return{type:"Polygon",coordinates:[g(r).concat(v(u).slice(1),g(a).reverse().slice(1),v(c).reverse().slice(1))]}},I.extent=function(M){return arguments.length?I.extentMajor(M).extentMinor(M):I.extentMinor()},I.extentMajor=function(M){return arguments.length?(r=+M[0][0],a=+M[1][0],c=+M[0][1],u=+M[1][1],r>a&&(M=r,r=a,a=M),c>u&&(M=c,c=u,u=M),I.precision(O)):[[r,c],[a,u]]},I.extentMinor=function(M){return arguments.length?(n=+M[0][0],t=+M[1][0],o=+M[0][1],i=+M[1][1],n>t&&(M=n,n=t,t=M),o>i&&(M=o,o=i,i=M),I.precision(O)):[[n,o],[t,i]]},I.step=function(M){return arguments.length?I.stepMajor(M).stepMinor(M):I.stepMinor()},I.stepMajor=function(M){return arguments.length?(_=+M[0],N=+M[1],I):[_,N]},I.stepMinor=function(M){return arguments.length?(E=+M[0],k=+M[1],I):[E,k]},I.precision=function(M){return arguments.length?(O=+M,f=_R(o,i,90),m=kR(n,t,O),g=_R(c,u,90),v=kR(r,a,O),I):O},I.extentMajor([[-180,-90+gt],[180,90-gt]]).extentMinor([[-180,-80-gt],[180,80+gt]])})()}function gS(e){Se.call(this,null,e)}function gN(e){if(!tt(e))return!1;let t=ir(T(e));return t.$x||t.$y||t.$value||t.$max}function bN(e){Se.call(this,null,e),this.modified(!0)}function yN(e,t,n){tt(e[t])&&e[t](n)}dS.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},Fe(dS,Se,{transform(e,t){var n,a=this._features,r=this._points,i=e.fields,o=i&&i[0],u=i&&i[1],c=e.geojson||!i&&ee,f=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(T(c))||o&&t.modified(T(o))||u&&t.modified(T(u)),this.value&&!n||(f=t.SOURCE,this._features=a=[],this._points=r=[]),c&&t.visit(f,(m=>a.push(c(m)))),o&&u&&(t.visit(f,(m=>{var g=o(m),v=u(m);g!=null&&v!=null&&(g=+g)===g&&(v=+v)===v&&r.push([g,v])})),a=a.concat({type:uS,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:cS,features:a}}}),fS.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"}]},Fe(fS,Se,{transform(e,t){var n=t.fork(t.ALL),a=this.value,r=e.field||ee,i=e.as||"path",o=n.SOURCE;!a||e.modified()?(this.value=a=uN(e.projection),n.materialize().reflow()):o=r===ee||t.modified(r.fields)?n.ADD_MOD:n.ADD;let u=(function(c,f){let m=c.pointRadius();return c.context(null),f!=null&&c.pointRadius(f),m})(a,e.pointRadius);return n.visit(o,(c=>c[i]=a(r(c)))),a.pointRadius(u),n.modifies(i)}}),pS.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"]}]},Fe(pS,Se,{transform(e,t){var n,a=e.projection,r=e.fields[0],i=e.fields[1],o=e.as||["x","y"],u=o[0],c=o[1];function f(m){let g=a([r(m),i(m)]);g?(m[u]=g[0],m[c]=g[1]):(m[u]=void 0,m[c]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,f):(n=t.modified(r.fields)||t.modified(i.fields),t.visit(n?t.ADD_MOD:t.ADD,f)),t.modifies(o)}}),hS.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"}]},Fe(hS,Se,{transform(e,t){var n=t.fork(t.ALL),a=this.value,r=e.as||"shape",i=n.ADD;return a&&!e.modified()||(this.value=a=(function(o,u,c){let f=c==null?m=>o(u(m)):m=>{var g=o.pointRadius(),v=o.pointRadius(c)(u(m));return o.pointRadius(g),v};return f.context=m=>(o.context(m),f),f})(uN(e.projection),e.field||W("datum"),e.pointRadius),n.materialize().reflow(),i=n.SOURCE),n.visit(i,(o=>o[r]=a)),n.modifies(r)}}),mS.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}]},Fe(mS,Se,{transform(e,t){var n,a=this.value,r=this.generator;if(!a.length||e.modified())for(let i in e)tt(r[i])&&r[i](e[i]);return n=r(),a.length?t.mod.push(ou(a[0],n)):t.add.push(It(n)),a[0]=n,t}}),gS.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"}]},Fe(gS,Se,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,a=e.resolve==="shared",r=e.field||ee,i=(function(f,m){let g;return tt(f)?(g=v=>f(v,m),g.dep=gN(f)):f?g=mn(f):(g=v=>v.$value/v.$max||0,g.dep=!0),g})(e.opacity,e),o=(function(f,m){let g;return tt(f)?(g=v=>bs(f(v,m)),g.dep=gN(f)):g=mn(bs(f||"#888")),g})(e.color,e),u=e.as||"image",c={$x:0,$y:0,$value:0,$max:a?zs(n.map((f=>zs(r(f).values)))):0};return n.forEach((f=>{let m=r(f),g=mt({},f,c);a||(g.$max=zs(m.values||[])),f[u]=(function(v,E,k,_){let N=v.width,O=v.height,I=v.x1||0,B=v.y1||0,M=v.x2||N,U=v.y2||O,z=v.values,q=z?ie=>z[ie]:ne,Y=Wa(M-I,U-B),K=Y.getContext("2d"),re=K.getImageData(0,0,M-I,U-B),Q=re.data;for(let ie=B,se=0;ie<U;++ie){E.$y=ie-B;for(let ue=I,fe=ie*N;ue<M;++ue,se+=4){E.$x=ue-I,E.$value=q(ue+fe);let ve=k(E);Q[se+0]=ve.r,Q[se+1]=ve.g,Q[se+2]=ve.b,Q[se+3]=~~(255*_(E))}}return K.putImageData(re,0,0),Y})(m,g,o.dep?o:mn(o(g)),i.dep?i:mn(i(g)))})),t.reflow(!0).modifies(u)}}),Fe(bN,Se,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=(function(a){let r=rS((a||"mercator").toLowerCase());return r||F("Unrecognized projection type: "+a),r()})(e.type),aS.forEach((a=>{e[a]!=null&&yN(n,a,e[a])}))):aS.forEach((a=>{e.modified(a)&&yN(n,a,e[a])})),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&(function(a,r){let i=(function(o){return o=Ie(o),o.length===1?o[0]:{type:cS,features:o.reduce(((u,c)=>u.concat((function(f){return f.type===cS?f.features:Ie(f).filter((m=>m!=null)).map((m=>m.type===uS?m:{type:uS,geometry:m}))})(c))),[])}})(r.fit);r.extent?a.fitExtent(r.extent,i):r.size&&a.fitSize(r.size,i)})(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});var UF=Object.freeze({__proto__:null,contour:lS,geojson:dS,geopath:fS,geopoint:pS,geoshape:hS,graticule:mS,heatmap:gS,isocontour:iS,kde2d:sS,projection:bN});function vN(e,t,n,a){if(isNaN(t)||isNaN(n))return e;var r,i,o,u,c,f,m,g,v,E=e._root,k={data:a},_=e._x0,N=e._y0,O=e._x1,I=e._y1;if(!E)return e._root=k,e;for(;E.length;)if((f=t>=(i=(_+O)/2))?_=i:O=i,(m=n>=(o=(N+I)/2))?N=o:I=o,r=E,!(E=E[g=m<<1|f]))return r[g]=k,e;if(u=+e._x.call(null,E.data),c=+e._y.call(null,E.data),t===u&&n===c)return k.next=E,r?r[g]=k:e._root=k,e;do r=r?r[g]=new Array(4):e._root=new Array(4),(f=t>=(i=(_+O)/2))?_=i:O=i,(m=n>=(o=(N+I)/2))?N=o:I=o;while((g=m<<1|f)==(v=(c>=o)<<1|u>=i));return r[v]=E,r[g]=k,e}function kr(e,t,n,a,r){this.node=e,this.x0=t,this.y0=n,this.x1=a,this.y1=r}function zF(e){return e[0]}function GF(e){return e[1]}function bS(e,t,n){var a=new yS(t??zF,n??GF,NaN,NaN,NaN,NaN);return e==null?a:a.addAll(e)}function yS(e,t,n,a,r,i){this._x=e,this._y=t,this._x0=n,this._y0=a,this._x1=r,this._y1=i,this._root=void 0}function EN(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Sr=bS.prototype=yS.prototype;function xr(e){return function(){return e}}function Gu(e){return 1e-6*(e()-.5)}function jF(e){return e.x+e.vx}function HF(e){return e.y+e.vy}function qF(e){return e.index}function wN(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}Sr.copy=function(){var e,t,n=new yS(this._x,this._y,this._x0,this._y0,this._x1,this._y1),a=this._root;if(!a)return n;if(!a.length)return n._root=EN(a),n;for(e=[{source:a,target:n._root=new Array(4)}];a=e.pop();)for(var r=0;r<4;++r)(t=a.source[r])&&(t.length?e.push({source:t,target:a.target[r]=new Array(4)}):a.target[r]=EN(t));return n},Sr.add=function(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return vN(this.cover(t,n),t,n,e)},Sr.addAll=function(e){var t,n,a,r,i=e.length,o=new Array(i),u=new Array(i),c=1/0,f=1/0,m=-1/0,g=-1/0;for(n=0;n<i;++n)isNaN(a=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(o[n]=a,u[n]=r,a<c&&(c=a),a>m&&(m=a),r<f&&(f=r),r>g&&(g=r));if(c>m||f>g)return this;for(this.cover(c,f).cover(m,g),n=0;n<i;++n)vN(this,o[n],u[n],e[n]);return this},Sr.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,a=this._y0,r=this._x1,i=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,i=(a=Math.floor(t))+1;else{for(var o,u,c=r-n||1,f=this._root;n>e||e>=r||a>t||t>=i;)switch(u=(t<a)<<1|e<n,(o=new Array(4))[u]=f,f=o,c*=2,u){case 0:r=n+c,i=a+c;break;case 1:n=r-c,i=a+c;break;case 2:r=n+c,a=i-c;break;case 3:n=r-c,a=i-c}this._root&&this._root.length&&(this._root=f)}return this._x0=n,this._y0=a,this._x1=r,this._y1=i,this},Sr.data=function(){var e=[];return this.visit((function(t){if(!t.length)do e.push(t.data);while(t=t.next)})),e},Sr.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Sr.find=function(e,t,n){var a,r,i,o,u,c,f,m=this._x0,g=this._y0,v=this._x1,E=this._y1,k=[],_=this._root;for(_&&k.push(new kr(_,m,g,v,E)),n==null?n=1/0:(m=e-n,g=t-n,v=e+n,E=t+n,n*=n);c=k.pop();)if(!(!(_=c.node)||(r=c.x0)>v||(i=c.y0)>E||(o=c.x1)<m||(u=c.y1)<g))if(_.length){var N=(r+o)/2,O=(i+u)/2;k.push(new kr(_[3],N,O,o,u),new kr(_[2],r,O,N,u),new kr(_[1],N,i,o,O),new kr(_[0],r,i,N,O)),(f=(t>=O)<<1|e>=N)&&(c=k[k.length-1],k[k.length-1]=k[k.length-1-f],k[k.length-1-f]=c)}else{var I=e-+this._x.call(null,_.data),B=t-+this._y.call(null,_.data),M=I*I+B*B;if(M<n){var U=Math.sqrt(n=M);m=e-U,g=t-U,v=e+U,E=t+U,a=_.data}}return a},Sr.remove=function(e){if(isNaN(i=+this._x.call(null,e))||isNaN(o=+this._y.call(null,e)))return this;var t,n,a,r,i,o,u,c,f,m,g,v,E=this._root,k=this._x0,_=this._y0,N=this._x1,O=this._y1;if(!E)return this;if(E.length)for(;;){if((f=i>=(u=(k+N)/2))?k=u:N=u,(m=o>=(c=(_+O)/2))?_=c:O=c,t=E,!(E=E[g=m<<1|f]))return this;if(!E.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(n=t,v=g)}for(;E.data!==e;)if(a=E,!(E=E.next))return this;return(r=E.next)&&delete E.next,a?(r?a.next=r:delete a.next,this):t?(r?t[g]=r:delete t[g],(E=t[0]||t[1]||t[2]||t[3])&&E===(t[3]||t[2]||t[1]||t[0])&&!E.length&&(n?n[v]=E:this._root=E),this):(this._root=r,this)},Sr.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},Sr.root=function(){return this._root},Sr.size=function(){var e=0;return this.visit((function(t){if(!t.length)do++e;while(t=t.next)})),e},Sr.visit=function(e){var t,n,a,r,i,o,u=[],c=this._root;for(c&&u.push(new kr(c,this._x0,this._y0,this._x1,this._y1));t=u.pop();)if(!e(c=t.node,a=t.x0,r=t.y0,i=t.x1,o=t.y1)&&c.length){var f=(a+i)/2,m=(r+o)/2;(n=c[3])&&u.push(new kr(n,f,m,i,o)),(n=c[2])&&u.push(new kr(n,a,m,f,o)),(n=c[1])&&u.push(new kr(n,f,r,i,m)),(n=c[0])&&u.push(new kr(n,a,r,f,m))}return this},Sr.visitAfter=function(e){var t,n=[],a=[];for(this._root&&n.push(new kr(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var i,o=t.x0,u=t.y0,c=t.x1,f=t.y1,m=(o+c)/2,g=(u+f)/2;(i=r[0])&&n.push(new kr(i,o,u,m,g)),(i=r[1])&&n.push(new kr(i,m,u,c,g)),(i=r[2])&&n.push(new kr(i,o,g,m,f)),(i=r[3])&&n.push(new kr(i,m,g,c,f))}a.push(t)}for(;t=a.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},Sr.x=function(e){return arguments.length?(this._x=e,this):this._x},Sr.y=function(e){return arguments.length?(this._y=e,this):this._y};var WF={value:()=>{}};function _N(){for(var e,t=0,n=arguments.length,a={};t<n;++t){if(!(e=arguments[t]+"")||e in a||/[\s.]/.test(e))throw new Error("illegal type: "+e);a[e]=[]}return new BE(a)}function BE(e){this._=e}function VF(e,t){for(var n,a=0,r=e.length;a<r;++a)if((n=e[a]).name===t)return n.value}function kN(e,t,n){for(var a=0,r=e.length;a<r;++a)if(e[a].name===t){e[a]=WF,e=e.slice(0,a).concat(e.slice(a+1));break}return n!=null&&e.push({name:t,value:n}),e}BE.prototype=_N.prototype={constructor:BE,on:function(e,t){var n,a,r=this._,i=(a=r,(e+"").trim().split(/^|\s+/).map((function(c){var f="",m=c.indexOf(".");if(m>=0&&(f=c.slice(m+1),c=c.slice(0,m)),c&&!a.hasOwnProperty(c))throw new Error("unknown type: "+c);return{type:c,name:f}}))),o=-1,u=i.length;if(!(arguments.length<2)){if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<u;)if(n=(e=i[o]).type)r[n]=kN(r[n],e.name,t);else if(t==null)for(n in r)r[n]=kN(r[n],e.name,null);return this}for(;++o<u;)if((n=(e=i[o]).type)&&(n=VF(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new BE(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,a,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(a=this._[e]).length;i<n;++i)a[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)}};var UE,xb,Vp=0,Ab=0,Tb=0,SN=1e3,zE=0,gd=0,GE=0,Cb=typeof performance=="object"&&performance.now?performance:Date,xN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function vS(){return gd||(xN(YF),gd=Cb.now()+GE)}function YF(){gd=0}function jE(){this._call=this._time=this._next=null}function AN(e,t,n){var a=new jE;return a.restart(e,t,n),a}function TN(){gd=(zE=Cb.now())+GE,Vp=Ab=0;try{(function(){vS(),++Vp;for(var e,t=UE;t;)(e=gd-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Vp})()}finally{Vp=0,(function(){for(var e,t,n=UE,a=1/0;n;)n._call?(a>n._time&&(a=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:UE=t);xb=e,ES(a)})(),gd=0}}function KF(){var e=Cb.now(),t=e-zE;t>SN&&(GE-=t,zE=e)}function ES(e){Vp||(Ab&&(Ab=clearTimeout(Ab)),e-gd>24?(e<1/0&&(Ab=setTimeout(TN,e-Cb.now()-GE)),Tb&&(Tb=clearInterval(Tb))):(Tb||(zE=Cb.now(),Tb=setInterval(KF,SN)),Vp=1,xN(TN)))}jE.prototype=AN.prototype={constructor:jE,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?vS():+n)+(t==null?0:+t),this._next||xb===this||(xb?xb._next=this:UE=this,xb=this),this._call=e,this._time=n,ES()},stop:function(){this._call&&(this._call=null,this._time=1/0,ES())}};let XF=1664525,ZF=1013904223,CN=4294967296;function JF(e){return e.x}function QF(e){return e.y}var eP=10,tP=Math.PI*(3-Math.sqrt(5));function nP(e){var t,n=1,a=.001,r=1-Math.pow(a,1/300),i=0,o=.6,u=new Map,c=AN(g),f=_N("tick","end"),m=(function(){let _=1;return()=>(_=(XF*_+ZF)%CN)/CN})();function g(){v(),f.call("tick",t),n<a&&(c.stop(),f.call("end",t))}function v(_){var N,O,I=e.length;_===void 0&&(_=1);for(var B=0;B<_;++B)for(n+=(i-n)*r,u.forEach((function(M){M(n)})),N=0;N<I;++N)(O=e[N]).fx==null?O.x+=O.vx*=o:(O.x=O.fx,O.vx=0),O.fy==null?O.y+=O.vy*=o:(O.y=O.fy,O.vy=0);return t}function E(){for(var _,N=0,O=e.length;N<O;++N){if((_=e[N]).index=N,_.fx!=null&&(_.x=_.fx),_.fy!=null&&(_.y=_.fy),isNaN(_.x)||isNaN(_.y)){var I=eP*Math.sqrt(.5+N),B=N*tP;_.x=I*Math.cos(B),_.y=I*Math.sin(B)}(isNaN(_.vx)||isNaN(_.vy))&&(_.vx=_.vy=0)}}function k(_){return _.initialize&&_.initialize(e,m),_}return e==null&&(e=[]),E(),t={tick:v,restart:function(){return c.restart(g),t},stop:function(){return c.stop(),t},nodes:function(_){return arguments.length?(e=_,E(),u.forEach(k),t):e},alpha:function(_){return arguments.length?(n=+_,t):n},alphaMin:function(_){return arguments.length?(a=+_,t):a},alphaDecay:function(_){return arguments.length?(r=+_,t):+r},alphaTarget:function(_){return arguments.length?(i=+_,t):i},velocityDecay:function(_){return arguments.length?(o=1-_,t):1-o},randomSource:function(_){return arguments.length?(m=_,u.forEach(k),t):m},force:function(_,N){return arguments.length>1?(N==null?u.delete(_):u.set(_,k(N)),t):u.get(_)},find:function(_,N,O){var I,B,M,U,z,q=0,Y=e.length;for(O==null?O=1/0:O*=O,q=0;q<Y;++q)(M=(I=_-(U=e[q]).x)*I+(B=N-U.y)*B)<O&&(z=U,O=M);return z},on:function(_,N){return arguments.length>1?(f.on(_,N),t):f.on(_)}}}let RN={center:function(e,t){var n,a=1;function r(){var i,o,u=n.length,c=0,f=0;for(i=0;i<u;++i)c+=(o=n[i]).x,f+=o.y;for(c=(c/u-e)*a,f=(f/u-t)*a,i=0;i<u;++i)(o=n[i]).x-=c,o.y-=f}return e==null&&(e=0),t==null&&(t=0),r.initialize=function(i){n=i},r.x=function(i){return arguments.length?(e=+i,r):e},r.y=function(i){return arguments.length?(t=+i,r):t},r.strength=function(i){return arguments.length?(a=+i,r):a},r},collide:function(e){var t,n,a,r=1,i=1;function o(){for(var f,m,g,v,E,k,_,N=t.length,O=0;O<i;++O)for(m=bS(t,jF,HF).visitAfter(u),f=0;f<N;++f)g=t[f],k=n[g.index],_=k*k,v=g.x+g.vx,E=g.y+g.vy,m.visit(I);function I(B,M,U,z,q){var Y=B.data,K=B.r,re=k+K;if(!Y)return M>v+re||z<v-re||U>E+re||q<E-re;if(Y.index>g.index){var Q=v-Y.x-Y.vx,ie=E-Y.y-Y.vy,se=Q*Q+ie*ie;se<re*re&&(Q===0&&(se+=(Q=Gu(a))*Q),ie===0&&(se+=(ie=Gu(a))*ie),se=(re-(se=Math.sqrt(se)))/se*r,g.vx+=(Q*=se)*(re=(K*=K)/(_+K)),g.vy+=(ie*=se)*re,Y.vx-=Q*(re=1-re),Y.vy-=ie*re)}}}function u(f){if(f.data)return f.r=n[f.data.index];for(var m=f.r=0;m<4;++m)f[m]&&f[m].r>f.r&&(f.r=f[m].r)}function c(){if(t){var f,m,g=t.length;for(n=new Array(g),f=0;f<g;++f)m=t[f],n[m.index]=+e(m,f,t)}}return typeof e!="function"&&(e=xr(e==null?1:+e)),o.initialize=function(f,m){t=f,a=m,c()},o.iterations=function(f){return arguments.length?(i=+f,o):i},o.strength=function(f){return arguments.length?(r=+f,o):r},o.radius=function(f){return arguments.length?(e=typeof f=="function"?f:xr(+f),c(),o):e},o},nbody:function(){var e,t,n,a,r,i=xr(-30),o=1,u=1/0,c=.81;function f(E){var k,_=e.length,N=bS(e,JF,QF).visitAfter(g);for(a=E,k=0;k<_;++k)t=e[k],N.visit(v)}function m(){if(e){var E,k,_=e.length;for(r=new Array(_),E=0;E<_;++E)k=e[E],r[k.index]=+i(k,E,e)}}function g(E){var k,_,N,O,I,B=0,M=0;if(E.length){for(N=O=I=0;I<4;++I)(k=E[I])&&(_=Math.abs(k.value))&&(B+=k.value,M+=_,N+=_*k.x,O+=_*k.y);E.x=N/M,E.y=O/M}else{(k=E).x=k.data.x,k.y=k.data.y;do B+=r[k.data.index];while(k=k.next)}E.value=B}function v(E,k,_,N){if(!E.value)return!0;var O=E.x-t.x,I=E.y-t.y,B=N-k,M=O*O+I*I;if(B*B/c<M)return M<u&&(O===0&&(M+=(O=Gu(n))*O),I===0&&(M+=(I=Gu(n))*I),M<o&&(M=Math.sqrt(o*M)),t.vx+=O*E.value*a/M,t.vy+=I*E.value*a/M),!0;if(!(E.length||M>=u)){(E.data!==t||E.next)&&(O===0&&(M+=(O=Gu(n))*O),I===0&&(M+=(I=Gu(n))*I),M<o&&(M=Math.sqrt(o*M)));do E.data!==t&&(B=r[E.data.index]*a/M,t.vx+=O*B,t.vy+=I*B);while(E=E.next)}}return f.initialize=function(E,k){e=E,n=k,m()},f.strength=function(E){return arguments.length?(i=typeof E=="function"?E:xr(+E),m(),f):i},f.distanceMin=function(E){return arguments.length?(o=E*E,f):Math.sqrt(o)},f.distanceMax=function(E){return arguments.length?(u=E*E,f):Math.sqrt(u)},f.theta=function(E){return arguments.length?(c=E*E,f):Math.sqrt(c)},f},link:function(e){var t,n,a,r,i,o,u=qF,c=function(_){return 1/Math.min(r[_.source.index],r[_.target.index])},f=xr(30),m=1;function g(_){for(var N=0,O=e.length;N<m;++N)for(var I,B,M,U,z,q,Y,K=0;K<O;++K)B=(I=e[K]).source,U=(M=I.target).x+M.vx-B.x-B.vx||Gu(o),z=M.y+M.vy-B.y-B.vy||Gu(o),U*=q=((q=Math.sqrt(U*U+z*z))-n[K])/q*_*t[K],z*=q,M.vx-=U*(Y=i[K]),M.vy-=z*Y,B.vx+=U*(Y=1-Y),B.vy+=z*Y}function v(){if(a){var _,N,O=a.length,I=e.length,B=new Map(a.map(((M,U)=>[u(M,U,a),M])));for(_=0,r=new Array(O);_<I;++_)(N=e[_]).index=_,typeof N.source!="object"&&(N.source=wN(B,N.source)),typeof N.target!="object"&&(N.target=wN(B,N.target)),r[N.source.index]=(r[N.source.index]||0)+1,r[N.target.index]=(r[N.target.index]||0)+1;for(_=0,i=new Array(I);_<I;++_)N=e[_],i[_]=r[N.source.index]/(r[N.source.index]+r[N.target.index]);t=new Array(I),E(),n=new Array(I),k()}}function E(){if(a)for(var _=0,N=e.length;_<N;++_)t[_]=+c(e[_],_,e)}function k(){if(a)for(var _=0,N=e.length;_<N;++_)n[_]=+f(e[_],_,e)}return e==null&&(e=[]),g.initialize=function(_,N){a=_,o=N,v()},g.links=function(_){return arguments.length?(e=_,v(),g):e},g.id=function(_){return arguments.length?(u=_,g):u},g.iterations=function(_){return arguments.length?(m=+_,g):m},g.strength=function(_){return arguments.length?(c=typeof _=="function"?_:xr(+_),E(),g):c},g.distance=function(_){return arguments.length?(f=typeof _=="function"?_:xr(+_),k(),g):f},g},x:function(e){var t,n,a,r=xr(.1);function i(u){for(var c,f=0,m=t.length;f<m;++f)(c=t[f]).vx+=(a[f]-c.x)*n[f]*u}function o(){if(t){var u,c=t.length;for(n=new Array(c),a=new Array(c),u=0;u<c;++u)n[u]=isNaN(a[u]=+e(t[u],u,t))?0:+r(t[u],u,t)}}return typeof e!="function"&&(e=xr(e==null?0:+e)),i.initialize=function(u){t=u,o()},i.strength=function(u){return arguments.length?(r=typeof u=="function"?u:xr(+u),o(),i):r},i.x=function(u){return arguments.length?(e=typeof u=="function"?u:xr(+u),o(),i):e},i},y:function(e){var t,n,a,r=xr(.1);function i(u){for(var c,f=0,m=t.length;f<m;++f)(c=t[f]).vy+=(a[f]-c.y)*n[f]*u}function o(){if(t){var u,c=t.length;for(n=new Array(c),a=new Array(c),u=0;u<c;++u)n[u]=isNaN(a[u]=+e(t[u],u,t))?0:+r(t[u],u,t)}}return typeof e!="function"&&(e=xr(e==null?0:+e)),i.initialize=function(u){t=u,o()},i.strength=function(u){return arguments.length?(r=typeof u=="function"?u:xr(+u),o(),i):r},i.y=function(u){return arguments.length?(e=typeof u=="function"?u:xr(+u),o(),i):e},i}},Rb="forces",wS=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],aP=["static","iterations"],NN=["x","y","vx","vy"];function _S(e){Se.call(this,null,e)}function IN(e,t,n,a){var r,i,o,u,c=Ie(t.forces);for(r=0,i=wS.length;r<i;++r)(o=wS[r])!==Rb&&t.modified(o)&&e[o](t[o]);for(r=0,i=c.length;r<i;++r)u=Rb+r,(o=n||t.modified(Rb,r)?iP(c[r]):a&&rP(c[r],a)?e.force(u):null)&&e.force(u,o);for(i=e.numForces||0;r<i;++r)e.force(Rb+r,null);return e.numForces=c.length,e}function rP(e,t){var n,a;for(n in e)if(tt(a=e[n])&&t.modified(T(a)))return 1;return 0}function iP(e){var t,n;for(n in nt(RN,e.force)||F("Unrecognized force: "+e.force),t=RN[e.force](),e)tt(t[n])&&oP(t[n],e[n],e);return t}function oP(e,t,n){e(tt(t)?a=>t(a,n):t)}_S.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:NN}]},Fe(_S,Se,{transform(e,t){var n,a,r=this.value,i=t.changed(t.ADD_REM),o=e.modified(wS),u=e.iterations||300;if(r?(i&&(t.modifies("index"),r.nodes(t.source)),(o||t.changed(t.MOD))&&IN(r,e,0,t)):(this.value=r=(function(c,f){let m=nP(c),g=m.stop,v=m.restart,E=!1;return m.stopped=()=>E,m.restart=()=>(E=!1,v()),m.stop=()=>(E=!0,g()),IN(m,f,!0).on("end",(()=>E=!0))})(t.source,e),r.on("tick",(n=t.dataflow,a=this,()=>n.touch(a).run())),e.static||(i=!0,r.tick()),t.modifies("index")),o||i||e.modified(aP)||t.changed()&&e.restart){if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/u)),e.static)for(r.stop();--u>=0;)r.tick();else if(r.stopped()&&r.restart(),!i)return t.StopPropagation}return this.finish(e,t)},finish(e,t){let n=t.dataflow;for(let u,c=this._argops,f=0,m=c.length;f<m;++f)if(u=c[f],u.name===Rb&&u.op._argval.force==="link"){for(var a,r=u.op._argops,i=0,o=r.length;i<o;++i)if(r[i].name==="links"&&(a=r[i].op.source)){n.pulse(a,n.changeset().reflow());break}}return t.reflow(e.modified()).modifies(NN)}});var sP=Object.freeze({__proto__:null,force:_S});function lP(e,t){return e.parent===t.parent?1:2}function uP(e,t){return e+t.x}function cP(e,t){return Math.max(e,t.y)}function dP(e){var t=0,n=e.children,a=n&&n.length;if(a)for(;--a>=0;)t+=n[a].value;else t=1;e.value=t}function kS(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=pP)):t===void 0&&(t=fP);for(var n,a,r,i,o,u=new Yp(e),c=[u];n=c.pop();)if((r=t(n.data))&&(o=(r=Array.from(r)).length))for(n.children=r,i=o-1;i>=0;--i)c.push(a=r[i]=new Yp(r[i])),a.parent=n,a.depth=n.depth+1;return u.eachBefore(ON)}function fP(e){return e.children}function pP(e){return Array.isArray(e)?e[1]:null}function hP(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function ON(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Yp(e){this.data=e,this.depth=this.height=0,this.parent=null}function HE(e){return e==null?null:DN(e)}function DN(e){if(typeof e!="function")throw new Error;return e}function bd(){return 0}function Kp(e){return function(){return e}}Yp.prototype=kS.prototype={constructor:Yp,count:function(){return this.eachAfter(dP)},each:function(e,t){let n=-1;for(let a of this)e.call(t,a,++n,this);return this},eachAfter:function(e,t){for(var n,a,r,i=this,o=[i],u=[],c=-1;i=o.pop();)if(u.push(i),n=i.children)for(a=0,r=n.length;a<r;++a)o.push(n[a]);for(;i=u.pop();)e.call(t,i,++c,this);return this},eachBefore:function(e,t){for(var n,a,r=this,i=[r],o=-1;r=i.pop();)if(e.call(t,r,++o,this),n=r.children)for(a=n.length-1;a>=0;--a)i.push(n[a]);return this},find:function(e,t){let n=-1;for(let a of this)if(e.call(t,a,++n,this))return a},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,a=t.children,r=a&&a.length;--r>=0;)n+=a[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=(function(i,o){if(i===o)return i;var u=i.ancestors(),c=o.ancestors(),f=null;for(i=u.pop(),o=c.pop();i===o;)f=i,i=u.pop(),o=c.pop();return f})(t,e),a=[t];t!==n;)t=t.parent,a.push(t);for(var r=a.length;e!==n;)a.splice(r,0,e),e=e.parent;return a},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return kS(this).eachBefore(hP)},[Symbol.iterator]:function*(){var e,t,n,a,r=this,i=[r];do for(e=i.reverse(),i=[];r=e.pop();)if(yield r,t=r.children)for(n=0,a=t.length;n<a;++n)i.push(t[n]);while(i.length)}};let mP=1664525,gP=1013904223,MN=4294967296;function bP(e,t){var n,a;if(SS(t,e))return[t];for(n=0;n<e.length;++n)if(qE(t,e[n])&&SS(Nb(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(a=n+1;a<e.length;++a)if(qE(Nb(e[n],e[a]),t)&&qE(Nb(e[n],t),e[a])&&qE(Nb(e[a],t),e[n])&&SS(FN(e[n],e[a],t),e))return[e[n],e[a],t];throw new Error}function qE(e,t){var n=e.r-t.r,a=t.x-e.x,r=t.y-e.y;return n<0||n*n<a*a+r*r}function LN(e,t){var n=e.r-t.r+1e-9*Math.max(e.r,t.r,1),a=t.x-e.x,r=t.y-e.y;return n>0&&n*n>a*a+r*r}function SS(e,t){for(var n=0;n<t.length;++n)if(!LN(e,t[n]))return!1;return!0}function yP(e){switch(e.length){case 1:return(function(t){return{x:t.x,y:t.y,r:t.r}})(e[0]);case 2:return Nb(e[0],e[1]);case 3:return FN(e[0],e[1],e[2])}}function Nb(e,t){var n=e.x,a=e.y,r=e.r,i=t.x,o=t.y,u=t.r,c=i-n,f=o-a,m=u-r,g=Math.sqrt(c*c+f*f);return{x:(n+i+c/g*m)/2,y:(a+o+f/g*m)/2,r:(g+r+u)/2}}function FN(e,t,n){var a=e.x,r=e.y,i=e.r,o=t.x,u=t.y,c=t.r,f=n.x,m=n.y,g=n.r,v=a-o,E=a-f,k=r-u,_=r-m,N=c-i,O=g-i,I=a*a+r*r-i*i,B=I-o*o-u*u+c*c,M=I-f*f-m*m+g*g,U=E*k-v*_,z=(k*M-_*B)/(2*U)-a,q=(_*N-k*O)/U,Y=(E*B-v*M)/(2*U)-r,K=(v*O-E*N)/U,re=q*q+K*K-1,Q=2*(i+z*q+Y*K),ie=z*z+Y*Y-i*i,se=-(Math.abs(re)>1e-6?(Q+Math.sqrt(Q*Q-4*re*ie))/(2*re):ie/Q);return{x:a+z+q*se,y:r+Y+K*se,r:se}}function PN(e,t,n){var a,r,i,o,u=e.x-t.x,c=e.y-t.y,f=u*u+c*c;f?(r=t.r+n.r,r*=r,o=e.r+n.r,r>(o*=o)?(a=(f+o-r)/(2*f),i=Math.sqrt(Math.max(0,o/f-a*a)),n.x=e.x-a*u-i*c,n.y=e.y-a*c+i*u):(a=(f+r-o)/(2*f),i=Math.sqrt(Math.max(0,r/f-a*a)),n.x=t.x+a*u-i*c,n.y=t.y+a*c+i*u)):(n.x=t.x+n.r,n.y=t.y)}function $N(e,t){var n=e.r+t.r-1e-6,a=t.x-e.x,r=t.y-e.y;return n>0&&n*n>a*a+r*r}function BN(e){var t=e._,n=e.next._,a=t.r+n.r,r=(t.x*n.r+n.x*t.r)/a,i=(t.y*n.r+n.y*t.r)/a;return r*r+i*i}function WE(e){this._=e,this.next=null,this.previous=null}function vP(e,t){if(!(i=(e=(function(E){return typeof E=="object"&&"length"in E?E:Array.from(E)})(e)).length))return 0;var n,a,r,i,o,u,c,f,m,g,v;if((n=e[0]).x=0,n.y=0,!(i>1))return n.r;if(a=e[1],n.x=-a.r,a.x=n.r,a.y=0,!(i>2))return n.r+a.r;PN(a,n,r=e[2]),n=new WE(n),a=new WE(a),r=new WE(r),n.next=r.previous=a,a.next=n.previous=r,r.next=a.previous=n;e:for(c=3;c<i;++c){PN(n._,a._,r=e[c]),r=new WE(r),f=a.next,m=n.previous,g=a._.r,v=n._.r;do if(g<=v){if($N(f._,r._)){a=f,n.next=a,a.previous=n,--c;continue e}g+=f._.r,f=f.next}else{if($N(m._,r._)){(n=m).next=a,a.previous=n,--c;continue e}v+=m._.r,m=m.previous}while(f!==m.next);for(r.previous=n,r.next=a,n.next=a.previous=a=r,o=BN(n);(r=r.next)!==a;)(u=BN(r))<o&&(n=r,o=u);a=n.next}for(n=[a._],r=a;(r=r.next)!==a;)n.push(r._);for(r=(function(E,k){for(var _,N,O=0,I=(E=(function(M,U){let z,q,Y=M.length;for(;Y;)q=U()*Y--|0,z=M[Y],M[Y]=M[q],M[q]=z;return M})(Array.from(E),k)).length,B=[];O<I;)_=E[O],N&&LN(N,_)?++O:(N=yP(B=bP(B,_)),O=0);return N})(n,t),c=0;c<i;++c)(n=e[c]).x-=r.x,n.y-=r.y;return r.r}function EP(e){return Math.sqrt(e.value)}function UN(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function xS(e,t,n){return function(a){if(r=a.children){var r,i,o,u=r.length,c=e(a)*t||0;if(c)for(i=0;i<u;++i)r[i].r+=c;if(o=vP(r,n),c)for(i=0;i<u;++i)r[i].r-=c;a.r=o+c}}}function zN(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function GN(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ib(e,t,n,a,r){for(var i,o=e.children,u=-1,c=o.length,f=e.value&&(a-t)/e.value;++u<c;)(i=o[u]).y0=n,i.y1=r,i.x0=t,i.x1=t+=i.value*f}var wP={depth:-1},jN={},AS={};function _P(e){return e.id}function kP(e){return e.parentId}function HN(){var e,t=_P,n=kP;function a(r){var i,o,u,c,f,m,g,v,E=Array.from(r),k=t,_=n,N=new Map;if(e!=null){let O=E.map(((M,U)=>(function(z){z=`${z}`;let q=z.length;return TS(z,q-1)&&!TS(z,q-2)&&(z=z.slice(0,-1)),z[0]==="/"?z:`/${z}`})(e(M,U,r)))),I=O.map(qN),B=new Set(O).add("");for(let M of I)B.has(M)||(B.add(M),O.push(M),I.push(qN(M)),E.push(AS));k=(M,U)=>O[U],_=(M,U)=>I[U]}for(u=0,i=E.length;u<i;++u)o=E[u],m=E[u]=new Yp(o),(g=k(o,u,r))!=null&&(g+="")&&(v=m.id=g,N.set(v,N.has(v)?jN:m)),(g=_(o,u,r))!=null&&(g+="")&&(m.parent=g);for(u=0;u<i;++u)if(g=(m=E[u]).parent){if(!(f=N.get(g)))throw new Error("missing: "+g);if(f===jN)throw new Error("ambiguous: "+g);f.children?f.children.push(m):f.children=[m],m.parent=f}else{if(c)throw new Error("multiple roots");c=m}if(!c)throw new Error("no root");if(e!=null){for(;c.data===AS&&c.children.length===1;)c=c.children[0],--i;for(let O=E.length-1;O>=0&&(m=E[O]).data===AS;--O)m.data=null}if(c.parent=wP,c.eachBefore((function(O){O.depth=O.parent.depth+1,--i})).eachBefore(ON),c.parent=null,i>0)throw new Error("cycle");return c}return a.id=function(r){return arguments.length?(t=HE(r),a):t},a.parentId=function(r){return arguments.length?(n=HE(r),a):n},a.path=function(r){return arguments.length?(e=HE(r),a):e},a}function qN(e){let t=e.length;if(t<2)return"";for(;--t>1&&!TS(e,t););return e.slice(0,t)}function TS(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((1&n)==0)return!0}return!1}function SP(e,t){return e.parent===t.parent?1:2}function CS(e){var t=e.children;return t?t[0]:e.t}function RS(e){var t=e.children;return t?t[t.length-1]:e.t}function xP(e,t,n){var a=n/(t.i-e.i);t.c-=a,t.s+=n,e.c+=a,t.z+=n,t.m+=n}function AP(e,t,n){return e.a.parent===t.parent?e.a:n}function VE(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function YE(e,t,n,a,r){for(var i,o=e.children,u=-1,c=o.length,f=e.value&&(r-n)/e.value;++u<c;)(i=o[u]).x0=t,i.x1=a,i.y0=n,i.y1=n+=i.value*f}VE.prototype=Object.create(Yp.prototype);var WN=(1+Math.sqrt(5))/2;function VN(e,t,n,a,r,i){for(var o,u,c,f,m,g,v,E,k,_,N,O=[],I=t.children,B=0,M=0,U=I.length,z=t.value;B<U;){c=r-n,f=i-a;do m=I[M++].value;while(!m&&M<U);for(g=v=m,N=m*m*(_=Math.max(f/c,c/f)/(z*e)),k=Math.max(v/N,N/g);M<U;++M){if(m+=u=I[M].value,u<g&&(g=u),u>v&&(v=u),N=m*m*_,(E=Math.max(v/N,N/g))>k){m-=u;break}k=E}O.push(o={value:m,dice:c<f,children:I.slice(B,M)}),o.dice?Ib(o,n,a,r,z?a+=f*m/z:i):YE(o,n,a,z?n+=c*m/z:r,i),z-=m,B=M}return O}var YN=(function e(t){function n(a,r,i,o,u){VN(t,a,r,i,o,u)}return n.ratio=function(a){return e((a=+a)>1?a:1)},n})(WN),TP=(function e(t){function n(a,r,i,o,u){if((c=a._squarify)&&c.ratio===t)for(var c,f,m,g,v,E=-1,k=c.length,_=a.value;++E<k;){for(m=(f=c[E]).children,g=f.value=0,v=m.length;g<v;++g)f.value+=m[g].value;f.dice?Ib(f,r,i,o,_?i+=(u-i)*f.value/_:u):YE(f,r,i,_?r+=(o-r)*f.value/_:o,u),_-=f.value}else a._squarify=c=VN(t,a,r,i,o,u),c.ratio=t}return n.ratio=function(a){return e((a=+a)>1?a:1)},n})(WN);function NS(e,t,n){let a={};return e.each((r=>{let i=r.data;n(i)&&(a[t(i)]=r)})),e.lookup=a,e}function IS(e){Se.call(this,null,e)}IS.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};let CP=e=>e.values;function RP(){let e=[],t={entries:r=>a(n(r,0),0),key:r=>(e.push(r),t)};function n(r,i){if(i>=e.length)return r;let o=r.length,u=e[i++],c={},f={},m,g,v,E=-1;for(;++E<o;)m=u(g=r[E])+"",(v=c[m])?v.push(g):c[m]=[g];for(m in c)f[m]=n(c[m],i);return f}function a(r,i){if(++i>e.length)return r;let o=[];for(let u in r)o.push({key:u,values:a(r[u],i)});return o}return t}function Cl(e){Se.call(this,null,e)}Fe(IS,Se,{transform(e,t){t.source||F("Nest transform requires an upstream data source.");var n=e.generate,a=e.modified(),r=t.clone(),i=this.value;return(!i||a||t.changed())&&(i&&i.each((o=>{o.children&&ru(o.data)&&r.rem.push(o.data)})),this.value=i=kS({values:Ie(e.keys).reduce(((o,u)=>(o.key(u),o)),RP()).entries(r.source)},CP),n&&i.each((o=>{o.children&&(o=It(o.data),r.add.push(o),r.source.push(o))})),NS(i,rt,rt)),r.source.root=i,r}});let NP=(e,t)=>e.parent===t.parent?1:2;Fe(Cl,Se,{transform(e,t){t.source&&t.source.root||F(this.constructor.name+" transform requires a backing tree data source.");let n=this.layout(e.method),a=this.fields,r=t.source.root,i=e.as||a;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(ls(e.sort,(o=>o.data))),(function(o,u,c){for(let f,m=0,g=u.length;m<g;++m)f=u[m],f in c&&o[f](c[f])})(n,this.params,e),n.separation&&n.separation(e.separation!==!1?NP:he);try{this.value=n(r)}catch(o){F(o)}return r.each((o=>(function(u,c,f){let m=u.data,g=c.length-1;for(let v=0;v<g;++v)m[f[v]]=u[c[v]];m[f[g]]=u.children?u.children.length:0})(o,a,i))),t.reflow(e.modified()).modifies(i).modifies("leaf")}});let OS=["x","y","r","depth","children"];function DS(e){Cl.call(this,e)}DS.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:OS.length,default:OS}]},Fe(DS,Cl,{layout:function(){var e=null,t=1,n=1,a=bd;function r(i){let o=(function(){let u=1;return()=>(u=(mP*u+gP)%MN)/MN})();return i.x=t/2,i.y=n/2,e?i.eachBefore(UN(e)).eachAfter(xS(a,.5,o)).eachBefore(zN(1)):i.eachBefore(UN(EP)).eachAfter(xS(bd,1,o)).eachAfter(xS(a,i.r/Math.min(t,n),o)).eachBefore(zN(Math.min(t,n)/(2*i.r))),i}return r.radius=function(i){return arguments.length?(e=HE(i),r):e},r.size=function(i){return arguments.length?(t=+i[0],n=+i[1],r):[t,n]},r.padding=function(i){return arguments.length?(a=typeof i=="function"?i:Kp(+i),r):a},r},params:["radius","size","padding"],fields:OS});let MS=["x0","y0","x1","y1","depth","children"];function LS(e){Cl.call(this,e)}function FS(e){Se.call(this,null,e)}LS.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:MS.length,default:MS}]},Fe(LS,Cl,{layout:function(){var e=1,t=1,n=0,a=!1;function r(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore((function(u,c){return function(f){f.children&&Ib(f,f.x0,u*(f.depth+1)/c,f.x1,u*(f.depth+2)/c);var m=f.x0,g=f.y0,v=f.x1-n,E=f.y1-n;v<m&&(m=v=(m+v)/2),E<g&&(g=E=(g+E)/2),f.x0=m,f.y0=g,f.x1=v,f.y1=E}})(t,o)),a&&i.eachBefore(GN),i}return r.round=function(i){return arguments.length?(a=!!i,r):a},r.size=function(i){return arguments.length?(e=+i[0],t=+i[1],r):[e,t]},r.padding=function(i){return arguments.length?(n=+i,r):n},r},params:["size","round","padding"],fields:MS}),FS.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},Fe(FS,Se,{transform(e,t){t.source||F("Stratify transform requires an upstream data source.");let n=this.value,a=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),i=!n||a||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),i&&(n=r.source.length?NS(HN().id(e.key).parentId(e.parentKey)(r.source),e.key,Z):NS(HN()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});let KN={tidy:function(){var e=SP,t=1,n=1,a=null;function r(c){var f=(function(O){for(var I,B,M,U,z,q=new VE(O,0),Y=[q];I=Y.pop();)if(M=I._.children)for(I.children=new Array(z=M.length),U=z-1;U>=0;--U)Y.push(B=I.children[U]=new VE(M[U],U)),B.parent=I;return(q.parent=new VE(null,0)).children=[q],q})(c);if(f.eachAfter(i),f.parent.m=-f.z,f.eachBefore(o),a)c.eachBefore(u);else{var m=c,g=c,v=c;c.eachBefore((function(O){O.x<m.x&&(m=O),O.x>g.x&&(g=O),O.depth>v.depth&&(v=O)}));var E=m===g?1:e(m,g)/2,k=E-m.x,_=t/(g.x+E+k),N=n/(v.depth||1);c.eachBefore((function(O){O.x=(O.x+k)*_,O.y=O.depth*N}))}return c}function i(c){var f=c.children,m=c.parent.children,g=c.i?m[c.i-1]:null;if(f){(function(E){for(var k,_=0,N=0,O=E.children,I=O.length;--I>=0;)(k=O[I]).z+=_,k.m+=_,_+=k.s+(N+=k.c)})(c);var v=(f[0].z+f[f.length-1].z)/2;g?(c.z=g.z+e(c._,g._),c.m=c.z-v):c.z=v}else g&&(c.z=g.z+e(c._,g._));c.parent.A=(function(E,k,_){if(k){for(var N,O=E,I=E,B=k,M=O.parent.children[0],U=O.m,z=I.m,q=B.m,Y=M.m;B=RS(B),O=CS(O),B&&O;)M=CS(M),(I=RS(I)).a=E,(N=B.z+q-O.z-U+e(B._,O._))>0&&(xP(AP(B,E,_),E,N),U+=N,z+=N),q+=B.m,U+=O.m,Y+=M.m,z+=I.m;B&&!RS(I)&&(I.t=B,I.m+=q-z),O&&!CS(M)&&(M.t=O,M.m+=U-Y,_=E)}return _})(c,g,c.parent.A||m[0])}function o(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function u(c){c.x*=t,c.y=c.depth*n}return r.separation=function(c){return arguments.length?(e=c,r):e},r.size=function(c){return arguments.length?(a=!1,t=+c[0],n=+c[1],r):a?null:[t,n]},r.nodeSize=function(c){return arguments.length?(a=!0,t=+c[0],n=+c[1],r):a?[t,n]:null},r},cluster:function(){var e=lP,t=1,n=1,a=!1;function r(i){var o,u=0;i.eachAfter((function(v){var E=v.children;E?(v.x=(function(k){return k.reduce(uP,0)/k.length})(E),v.y=(function(k){return 1+k.reduce(cP,0)})(E)):(v.x=o?u+=e(v,o):0,v.y=0,o=v)}));var c=(function(v){for(var E;E=v.children;)v=E[0];return v})(i),f=(function(v){for(var E;E=v.children;)v=E[E.length-1];return v})(i),m=c.x-e(c,f)/2,g=f.x+e(f,c)/2;return i.eachAfter(a?function(v){v.x=(v.x-i.x)*t,v.y=(i.y-v.y)*n}:function(v){v.x=(v.x-m)/(g-m)*t,v.y=(1-(i.y?v.y/i.y:1))*n})}return r.separation=function(i){return arguments.length?(e=i,r):e},r.size=function(i){return arguments.length?(a=!1,t=+i[0],n=+i[1],r):a?null:[t,n]},r.nodeSize=function(i){return arguments.length?(a=!0,t=+i[0],n=+i[1],r):a?[t,n]:null},r}},PS=["x","y","depth","children"];function $S(e){Cl.call(this,e)}function BS(e){Se.call(this,[],e)}$S.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:PS.length,default:PS}]},Fe($S,Cl,{layout(e){let t=e||"tidy";if(nt(KN,t))return KN[t]();F("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:PS}),BS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},Fe(BS,Se,{transform(e,t){let n=this.value,a=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),i={};return a||F("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(o=>i[rt(o)]=1)),a.each((o=>{let u=o.data,c=o.parent&&o.parent.data;c&&i[rt(u)]&&i[rt(c)]&&r.add.push(It({source:c,target:u}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(o=>i[rt(o)]=1)),n.forEach((o=>{(i[rt(o.source)]||i[rt(o.target)])&&r.mod.push(o)}))),r}});let XN={binary:function(e,t,n,a,r){var i,o,u=e.children,c=u.length,f=new Array(c+1);for(f[0]=o=i=0;i<c;++i)f[i+1]=o+=u[i].value;(function m(g,v,E,k,_,N,O){if(g>=v-1){var I=u[g];return I.x0=k,I.y0=_,I.x1=N,void(I.y1=O)}for(var B=f[g],M=E/2+B,U=g+1,z=v-1;U<z;){var q=U+z>>>1;f[q]<M?U=q+1:z=q}M-f[U-1]<f[U]-M&&g+1<U&&--U;var Y=f[U]-B,K=E-Y;if(N-k>O-_){var re=E?(k*K+N*Y)/E:N;m(g,U,Y,k,_,re,O),m(U,v,K,re,_,N,O)}else{var Q=E?(_*K+O*Y)/E:O;m(g,U,Y,k,_,N,Q),m(U,v,K,k,Q,N,O)}})(0,c,e.value,t,n,a,r)},dice:Ib,slice:YE,slicedice:function(e,t,n,a,r){(1&e.depth?YE:Ib)(e,t,n,a,r)},squarify:YN,resquarify:TP},US=["x0","y0","x1","y1","depth","children"];function zS(e){Cl.call(this,e)}zS.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:US.length,default:US}]},Fe(zS,Cl,{layout(){let e=(function(){var t=YN,n=!1,a=1,r=1,i=[0],o=bd,u=bd,c=bd,f=bd,m=bd;function g(E){return E.x0=E.y0=0,E.x1=a,E.y1=r,E.eachBefore(v),i=[0],n&&E.eachBefore(GN),E}function v(E){var k=i[E.depth],_=E.x0+k,N=E.y0+k,O=E.x1-k,I=E.y1-k;O<_&&(_=O=(_+O)/2),I<N&&(N=I=(N+I)/2),E.x0=_,E.y0=N,E.x1=O,E.y1=I,E.children&&(k=i[E.depth+1]=o(E)/2,_+=m(E)-k,N+=u(E)-k,(O-=c(E)-k)<_&&(_=O=(_+O)/2),(I-=f(E)-k)<N&&(N=I=(N+I)/2),t(E,_,N,O,I))}return g.round=function(E){return arguments.length?(n=!!E,g):n},g.size=function(E){return arguments.length?(a=+E[0],r=+E[1],g):[a,r]},g.tile=function(E){return arguments.length?(t=DN(E),g):t},g.padding=function(E){return arguments.length?g.paddingInner(E).paddingOuter(E):g.paddingInner()},g.paddingInner=function(E){return arguments.length?(o=typeof E=="function"?E:Kp(+E),g):o},g.paddingOuter=function(E){return arguments.length?g.paddingTop(E).paddingRight(E).paddingBottom(E).paddingLeft(E):g.paddingTop()},g.paddingTop=function(E){return arguments.length?(u=typeof E=="function"?E:Kp(+E),g):u},g.paddingRight=function(E){return arguments.length?(c=typeof E=="function"?E:Kp(+E),g):c},g.paddingBottom=function(E){return arguments.length?(f=typeof E=="function"?E:Kp(+E),g):f},g.paddingLeft=function(E){return arguments.length?(m=typeof E=="function"?E:Kp(+E),g):m},g})();return e.ratio=t=>{let n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{nt(XN,t)?e.tile(XN[t]):F("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:US});var IP=Object.freeze({__proto__:null,nest:IS,pack:DS,partition:LS,stratify:FS,tree:$S,treelinks:BS,treemap:zS});let GS=4278190080;function jS(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function KE(e,t,n){if(!t.length)return;let a=t[0].mark.marktype;a==="group"?t.forEach((r=>{r.items.forEach((i=>KE(e,i.items,n)))})):yi[a].draw(e,{items:n?t.map(OP):t})}function OP(e){let t=mc(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}let Rl=5,Ar=31,Ob=32,ju=new Uint32Array(Ob+1),Ho=new Uint32Array(Ob+1);Ho[0]=0,ju[0]=~Ho[0];for(let e=1;e<=Ob;++e)Ho[e]=Ho[e-1]<<1|1,ju[e]=~Ho[e];function DP(e,t,n){let a=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+a)/a),i=~~((t+2*n+a)/a),o=u=>~~((u+n)/a);return o.invert=u=>u*a-n,o.bitmap=()=>(function(u,c){let f=new Uint32Array(~~((u*c+Ob)/Ob));function m(v,E){f[v]|=E}function g(v,E){f[v]&=E}return{array:f,get:(v,E)=>{let k=E*u+v;return f[k>>>Rl]&1<<(k&Ar)},set:(v,E)=>{let k=E*u+v;m(k>>>Rl,1<<(k&Ar))},clear:(v,E)=>{let k=E*u+v;g(k>>>Rl,~(1<<(k&Ar)))},getRange:(v,E,k,_)=>{let N,O,I,B,M=_;for(;M>=E;--M)if(N=M*u+v,O=M*u+k,I=N>>>Rl,B=O>>>Rl,I===B){if(f[I]&ju[N&Ar]&Ho[1+(O&Ar)])return!0}else{if(f[I]&ju[N&Ar]||f[B]&Ho[1+(O&Ar)])return!0;for(let U=I+1;U<B;++U)if(f[U])return!0}return!1},setRange:(v,E,k,_)=>{let N,O,I,B,M;for(;E<=_;++E)if(N=E*u+v,O=E*u+k,I=N>>>Rl,B=O>>>Rl,I===B)m(I,ju[N&Ar]&Ho[1+(O&Ar)]);else for(m(I,ju[N&Ar]),m(B,Ho[1+(O&Ar)]),M=I+1;M<B;++M)m(M,4294967295)},clearRange:(v,E,k,_)=>{let N,O,I,B,M;for(;E<=_;++E)if(N=E*u+v,O=E*u+k,I=N>>>Rl,B=O>>>Rl,I===B)g(I,Ho[N&Ar]|ju[1+(O&Ar)]);else for(g(I,Ho[N&Ar]),g(B,ju[1+(O&Ar)]),M=I+1;M<B;++M)g(M,0)},outOfBounds:(v,E,k,_)=>v<0||E<0||_>=c||k>=u}})(r,i),o.ratio=a,o.padding=n,o.width=e,o.height=t,o}function XE(e,t,n,a,r,i){let o=n/2;return e-o<0||e+o>r||t-(o=a/2)<0||t+o>i}function Hu(e,t,n,a,r,i,o,u){let c=r*i/(2*a),f=e(t-c),m=e(t+c),g=e(n-(i/=2)),v=e(n+i);return o.outOfBounds(f,g,m,v)||o.getRange(f,g,m,v)||u&&u.getRange(f,g,m,v)}let MP=[-1,-1,1,1],LP=[-1,1,-1,1],FP=["right","center","left"],PP=["bottom","middle","top"];function ZN(e,t,n,a,r,i,o,u,c,f,m,g){return!(r.outOfBounds(e,n,t,a)||(g&&i||r).getRange(e,n,t,a))}let $P={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},BP={naive:function(e,t,n,a){let r=e.width,i=e.height;return function(o){let u=o.datum.datum.items[a].items,c=u.length,f=o.datum.fontSize,m=$o.width(o.datum,o.datum.text),g,v,E,k,_,N,O,I=0;for(let B=0;B<c;++B)g=u[B].x,E=u[B].y,v=u[B].x2===void 0?g:u[B].x2,k=u[B].y2===void 0?E:u[B].y2,_=(g+v)/2,N=(E+k)/2,O=Math.abs(v-g+k-E),O>=I&&(I=O,o.x=_,o.y=N);return _=m/2,N=f/2,g=o.x-_,v=o.x+_,E=o.y-N,k=o.y+N,o.align="center",g<0&&v<=r?o.align="left":0<=g&&r<v&&(o.align="right"),o.baseline="middle",E<0&&k<=i?o.baseline="top":0<=E&&i<k&&(o.baseline="bottom"),!0}},"reduced-search":function(e,t,n,a){let r=e.width,i=e.height,o=t[0],u=t[1];function c(f,m,g,v,E){let k=e.invert(f),_=e.invert(m),N,O=g,I=i;if(!XE(k,_,v,E,r,i)&&!Hu(e,k,_,E,v,O,o,u)&&!Hu(e,k,_,E,v,E,o,null)){for(;I-O>=1;)N=(O+I)/2,Hu(e,k,_,E,v,N,o,u)?I=N:O=N;if(O>g)return[k,_,O,!0]}}return function(f){let m=f.datum.datum.items[a].items,g=m.length,v=f.datum.fontSize,E=$o.width(f.datum,f.datum.text),k,_,N,O,I,B,M,U,z,q,Y,K,re,Q,ie,se,ue,fe=n?v:0,ve=!1,we=!1,Oe=0;for(let Ue=0;Ue<g;++Ue){for(k=m[Ue].x,N=m[Ue].y,_=m[Ue].x2===void 0?k:m[Ue].x2,O=m[Ue].y2===void 0?N:m[Ue].y2,k>_&&(ue=k,k=_,_=ue),N>O&&(ue=N,N=O,O=ue),z=e(k),Y=e(_),q=~~((z+Y)/2),K=e(N),Q=e(O),re=~~((K+Q)/2),M=q;M>=z;--M)for(U=re;U>=K;--U)se=c(M,U,fe,E,v),se&&([f.x,f.y,fe,ve]=se);for(M=q;M<=Y;++M)for(U=re;U<=Q;++U)se=c(M,U,fe,E,v),se&&([f.x,f.y,fe,ve]=se);ve||n||(ie=Math.abs(_-k+O-N),I=(k+_)/2,B=(N+O)/2,ie>=Oe&&!XE(I,B,E,v,r,i)&&!Hu(e,I,B,v,E,v,o,null)&&(Oe=ie,f.x=I,f.y=B,we=!0))}return!(!ve&&!we)&&(I=E/2,B=v/2,o.setRange(e(f.x-I),e(f.y-B),e(f.x+I),e(f.y+B)),f.align="center",f.baseline="middle",!0)}},floodfill:function(e,t,n,a){let r=e.width,i=e.height,o=t[0],u=t[1],c=e.bitmap();return function(f){let m=f.datum.datum.items[a].items,g=m.length,v=f.datum.fontSize,E=$o.width(f.datum,f.datum.text),k=[],_,N,O,I,B,M,U,z,q,Y,K,re,Q=n?v:0,ie=!1,se=!1,ue=0;for(let fe=0;fe<g;++fe){for(_=m[fe].x,O=m[fe].y,N=m[fe].x2===void 0?_:m[fe].x2,I=m[fe].y2===void 0?O:m[fe].y2,k.push([e((_+N)/2),e((O+I)/2)]);k.length;)if([U,z]=k.pop(),!(o.get(U,z)||u.get(U,z)||c.get(U,z))){c.set(U,z);for(let ve=0;ve<4;++ve)B=U+MP[ve],M=z+LP[ve],c.outOfBounds(B,M,B,M)||k.push([B,M]);if(B=e.invert(U),M=e.invert(z),q=Q,Y=i,!XE(B,M,E,v,r,i)&&!Hu(e,B,M,v,E,q,o,u)&&!Hu(e,B,M,v,E,v,o,null)){for(;Y-q>=1;)K=(q+Y)/2,Hu(e,B,M,v,E,K,o,u)?Y=K:q=K;q>Q&&(f.x=B,f.y=M,Q=q,ie=!0)}}ie||n||(re=Math.abs(N-_+I-O),B=(_+N)/2,M=(O+I)/2,re>=ue&&!XE(B,M,E,v,r,i)&&!Hu(e,B,M,v,E,v,o,null)&&(ue=re,f.x=B,f.y=M,se=!0))}return!(!ie&&!se)&&(B=E/2,M=v/2,o.setRange(e(f.x-B),e(f.y-M),e(f.x+B),e(f.y+M)),f.align="center",f.baseline="middle",!0)}}};function UP(e,t,n,a,r,i,o,u,c,f,m){if(!e.length)return e;let g=Math.max(a.length,r.length),v=(function(Q,ie){let se=new Float64Array(ie),ue=Q.length;for(let fe=0;fe<ue;++fe)se[fe]=Q[fe]||0;for(let fe=ue;fe<ie;++fe)se[fe]=se[ue-1];return se})(a,g),E=(function(Q,ie){let se=new Int8Array(ie),ue=Q.length;for(let fe=0;fe<ue;++fe)se[fe]|=$P[Q[fe]];for(let fe=ue;fe<ie;++fe)se[fe]=se[ue-1];return se})(r,g),k=(M=e[0].datum)&&M.mark&&M.mark.marktype,_=k==="group"&&e[0].datum.items[c].marktype,N=_==="area",O=(function(Q,ie,se,ue){let fe=ve=>[ve.x,ve.x,ve.x,ve.y,ve.y,ve.y];return Q?Q==="line"||Q==="area"?ve=>fe(ve.datum):ie==="line"?ve=>{let we=ve.datum.items[ue].items;return fe(we.length?we[se==="start"?0:we.length-1]:{x:NaN,y:NaN})}:ve=>{let we=ve.datum.bounds;return[we.x1,(we.x1+we.x2)/2,we.x2,we.y1,(we.y1+we.y2)/2,we.y2]}:fe})(k,_,u,c),I=f===null||f===1/0,B=N&&m==="naive";var M;let U=-1,z=-1,q=e.map((Q=>{let ie=I?$o.width(Q,Q.text):void 0;return U=Math.max(U,ie),z=Math.max(z,Q.fontSize),{datum:Q,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:O(Q),textWidth:ie}}));f=f===null||f===1/0?Math.max(U,z)+Math.max(...a):f;let Y=DP(t[0],t[1],f),K;if(!B){n&&q.sort(((se,ue)=>n(se.datum,ue.datum)));let Q=!1;for(let se=0;se<E.length&&!Q;++se)Q=E[se]===5||v[se]<0;let ie=(k&&o||N)&&e.map((se=>se.datum));K=i.length||ie?(function(se,ue,fe,ve,we){let Oe=se.width,Ue=se.height,He=ve||we,De=Wa(Oe,Ue).getContext("2d"),ut=Wa(Oe,Ue).getContext("2d"),ct=He&&Wa(Oe,Ue).getContext("2d");fe.forEach((Dl=>KE(De,Dl,!1))),KE(ut,ue,!1),He&&KE(ct,ue,!0);let bt=jS(De,Oe,Ue),Nt=jS(ut,Oe,Ue),bn=He&&jS(ct,Oe,Ue),Kt=se.bitmap(),wa=He&&se.bitmap(),Tn,ca,_a,$n,nr,ka,lo,Vr;for(ca=0;ca<Ue;++ca)for(Tn=0;Tn<Oe;++Tn)nr=ca*Oe+Tn,ka=bt[nr]&GS,Vr=Nt[nr]&GS,lo=He&&bn[nr]&GS,(ka||lo||Vr)&&(_a=se(Tn),$n=se(ca),we||!ka&&!Vr||Kt.set(_a,$n),He&&(ka||lo)&&wa.set(_a,$n));return[Kt,wa]})(Y,ie||[],i,Q,N):(function(se,ue){let fe=se.bitmap();return(ue||[]).forEach((ve=>fe.set(se(ve.boundary[0]),se(ve.boundary[3])))),[fe,void 0]})(Y,o&&q)}let re=N?BP[m](Y,K,o,c):(function(Q,ie,se,ue){let fe=Q.width,ve=Q.height,we=ie[0],Oe=ie[1],Ue=ue.length;return function(He){let De=He.boundary,ut=He.datum.fontSize;if(De[2]<0||De[5]<0||De[0]>fe||De[3]>ve)return!1;let ct,bt,Nt,bn,Kt,wa,Tn,ca,_a,$n,nr,ka,lo,Vr,Dl,Cd=He.textWidth??0;for(let Ls=0;Ls<Ue;++Ls){if(ct=(3&se[Ls])-1,bt=(se[Ls]>>>2&3)-1,Nt=ct===0&&bt===0||ue[Ls]<0,bn=ct&&bt?Math.SQRT1_2:1,Kt=ue[Ls]<0?-1:1,wa=De[1+ct]+ue[Ls]*ct*bn,nr=De[4+bt]+Kt*ut*bt/2+ue[Ls]*bt*bn,ca=nr-ut/2,_a=nr+ut/2,ka=Q(wa),Vr=Q(ca),Dl=Q(_a),!Cd){if(!ZN(ka,ka,Vr,Dl,we,Oe,0,0,0,0,0,Nt))continue;Cd=$o.width(He.datum,He.datum.text)}if($n=wa+Kt*Cd*ct/2,wa=$n-Cd/2,Tn=$n+Cd/2,ka=Q(wa),lo=Q(Tn),ZN(ka,lo,Vr,Dl,we,Oe,0,0,0,0,0,Nt))return He.x=ct?ct*Kt<0?Tn:wa:$n,He.y=bt?bt*Kt<0?_a:ca:nr,He.align=FP[ct*Kt+1],He.baseline=PP[bt*Kt+1],we.setRange(ka,Vr,lo,Dl),!0}return!1}})(Y,K,E,v);return q.forEach((Q=>Q.opacity=+re(Q))),q}let HS=["x","y","opacity","align","baseline"],JN=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function qS(e){Se.call(this,null,e)}qS.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:JN},{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:HS.length,default:HS}]},Fe(qS,Se,{transform(e,t){let n=e.modified();if(!(n||t.changed(t.ADD_REM)||(function(r){let i=e[r];return tt(i)&&t.modified(i.fields)})("sort")))return;e.size&&e.size.length===2||F("Size parameter should be specified as a [width, height] array.");let a=e.as||HS;return UP(t.materialize(t.SOURCE).source||[],e.size,e.sort,Ie(e.offset==null?1:e.offset),Ie(e.anchor||JN),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach((r=>{let i=r.datum;i[a[0]]=r.x,i[a[1]]=r.y,i[a[2]]=r.opacity,i[a[3]]=r.align,i[a[4]]=r.baseline})),t.reflow(n).modifies(a)}});var zP=Object.freeze({__proto__:null,label:qS});function QN(e,t){var n,a,r,i,o,u,c=[],f=function(m){return m(i)};if(t==null)c.push(e);else for(n={},a=0,r=e.length;a<r;++a)i=e[a],(u=n[o=t.map(f)])||(n[o]=u=[],u.dims=o,c.push(u)),u.push(i);return c}function WS(e){Se.call(this,null,e)}WS.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}]},Fe(WS,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let a=QN(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(S),i=r.length,o=e.as||[S(e.x),S(e.y)],u=[];a.forEach((c=>{vm(c,e.x,e.y,e.bandwidth||.3).forEach((f=>{let m={};for(let g=0;g<i;++g)m[r[g]]=c.dims[g];m[o[0]]=f[0],m[o[1]]=f[1],u.push(It(m))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});let VS={constant:Mf,linear:fu,log:Ac,exp:gm,pow:my,quad:si,poly:bm};function YS(e){Se.call(this,null,e)}YS.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(VS)},{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}]},Fe(YS,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let a=QN(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(S),i=e.method||"linear",o=e.order==null?3:e.order,u=((v,E)=>v==="poly"?E:v==="quad"?2:1)(i,o),c=e.as||[S(e.x),S(e.y)],f=VS[i],m=[],g=e.extent;nt(VS,i)||F("Invalid regression method: "+i),g!=null&&i==="log"&&g[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),g=null),a.forEach((v=>{if(v.length<=u)return void t.dataflow.warn("Skipping regression with more parameters than data points.");let E=f(v,e.x,e.y,o);if(e.params)return void m.push(It({keys:v.dims,coef:E.coef,rSquared:E.rSquared}));let k=g||Un(v,e.x),_=N=>{let O={};for(let I=0;I<r.length;++I)O[r[I]]=v.dims[I];O[c[0]]=N[0],O[c[1]]=N[1],m.push(It(O))};i==="linear"||i==="constant"?k.forEach((N=>_([N,E.predict(N)]))):Lf(E.predict,k,25,200).forEach(_)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=m}return n}});var GP=Object.freeze({__proto__:null,loess:WS,regression:YS});let Qa=134217729,jP=33306690738754706e-32;function KS(e,t,n,a,r){let i,o,u,c,f=t[0],m=a[0],g=0,v=0;m>f==m>-f?(i=f,f=t[++g]):(i=m,m=a[++v]);let E=0;if(g<e&&v<n)for(m>f==m>-f?(o=f+i,u=i-(o-f),f=t[++g]):(o=m+i,u=i-(o-m),m=a[++v]),i=o,u!==0&&(r[E++]=u);g<e&&v<n;)m>f==m>-f?(o=i+f,c=o-i,u=i-(o-c)+(f-c),f=t[++g]):(o=i+m,c=o-i,u=i-(o-c)+(m-c),m=a[++v]),i=o,u!==0&&(r[E++]=u);for(;g<e;)o=i+f,c=o-i,u=i-(o-c)+(f-c),f=t[++g],i=o,u!==0&&(r[E++]=u);for(;v<n;)o=i+m,c=o-i,u=i-(o-c)+(m-c),m=a[++v],i=o,u!==0&&(r[E++]=u);return i===0&&E!==0||(r[E++]=i),E}function Db(e){return new Float64Array(e)}let HP=33306690738754716e-32,qP=22204460492503146e-32,WP=11093356479670487e-47,Xp=Db(4),eI=Db(8),tI=Db(12),nI=Db(16),Tr=Db(4);function ZE(e,t,n,a,r,i){let o=(t-i)*(n-r),u=(e-r)*(a-i),c=o-u;if(o===0||u===0||o>0!=u>0)return c;let f=Math.abs(o+u);return Math.abs(c)>=HP*f?c:-(function(m,g,v,E,k,_,N){let O,I,B,M,U,z,q,Y,K,re,Q,ie,se,ue,fe,ve,we,Oe,Ue=m-k,He=v-k,De=g-_,ut=E-_;ue=Ue*ut,z=Qa*Ue,q=z-(z-Ue),Y=Ue-q,z=Qa*ut,K=z-(z-ut),re=ut-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=De*He,z=Qa*De,q=z-(z-De),Y=De-q,z=Qa*He,K=z-(z-He),re=He-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Xp[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Xp[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Xp[2]=ie-(Oe-U)+(Q-U),Xp[3]=Oe;let ct=(function(wa,Tn){let ca=Tn[0];for(let _a=1;_a<wa;_a++)ca+=Tn[_a];return ca})(4,Xp),bt=qP*N;if(ct>=bt||-ct>=bt||(U=m-Ue,O=m-(Ue+U)+(U-k),U=v-He,B=v-(He+U)+(U-k),U=g-De,I=g-(De+U)+(U-_),U=E-ut,M=E-(ut+U)+(U-_),O===0&&I===0&&B===0&&M===0)||(bt=WP*N+jP*Math.abs(ct),ct+=Ue*M+ut*O-(De*B+He*I),ct>=bt||-ct>=bt))return ct;ue=O*ut,z=Qa*O,q=z-(z-O),Y=O-q,z=Qa*ut,K=z-(z-ut),re=ut-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=I*He,z=Qa*I,q=z-(z-I),Y=I-q,z=Qa*He,K=z-(z-He),re=He-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Tr[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Tr[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Tr[2]=ie-(Oe-U)+(Q-U),Tr[3]=Oe;let Nt=KS(4,Xp,4,Tr,eI);ue=Ue*M,z=Qa*Ue,q=z-(z-Ue),Y=Ue-q,z=Qa*M,K=z-(z-M),re=M-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=De*B,z=Qa*De,q=z-(z-De),Y=De-q,z=Qa*B,K=z-(z-B),re=B-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Tr[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Tr[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Tr[2]=ie-(Oe-U)+(Q-U),Tr[3]=Oe;let bn=KS(Nt,eI,4,Tr,tI);ue=O*M,z=Qa*O,q=z-(z-O),Y=O-q,z=Qa*M,K=z-(z-M),re=M-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=I*B,z=Qa*I,q=z-(z-I),Y=I-q,z=Qa*B,K=z-(z-B),re=B-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Tr[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Tr[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Tr[2]=ie-(Oe-U)+(Q-U),Tr[3]=Oe;let Kt=KS(bn,tI,4,Tr,nI);return nI[Kt-1]})(e,t,n,a,r,i,f)}let aI=Math.pow(2,-52),JE=new Uint32Array(512);class QE{static from(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:KP,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:XP,r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){let u=t[o];i[2*o]=n(u),i[2*o+1]=a(u)}return new QE(i)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let a=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*a),this._halfedges=new Int32Array(3*a),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:a,_hullTri:r,_hullHash:i}=this,o=t.length>>1,u=1/0,c=1/0,f=-1/0,m=-1/0;for(let re=0;re<o;re++){let Q=t[2*re],ie=t[2*re+1];Q<u&&(u=Q),ie<c&&(c=ie),Q>f&&(f=Q),ie>m&&(m=ie),this._ids[re]=re}let g=(u+f)/2,v=(c+m)/2,E,k,_,N=1/0;for(let re=0;re<o;re++){let Q=XS(g,v,t[2*re],t[2*re+1]);Q<N&&(E=re,N=Q)}let O=t[2*E],I=t[2*E+1];N=1/0;for(let re=0;re<o;re++){if(re===E)continue;let Q=XS(O,I,t[2*re],t[2*re+1]);Q<N&&Q>0&&(k=re,N=Q)}let B=t[2*k],M=t[2*k+1],U=1/0;for(let re=0;re<o;re++){if(re===E||re===k)continue;let Q=YP(O,I,B,M,t[2*re],t[2*re+1]);Q<U&&(_=re,U=Q)}let z=t[2*_],q=t[2*_+1];if(U===1/0){for(let ie=0;ie<o;ie++)this._dists[ie]=t[2*ie]-t[0]||t[2*ie+1]-t[1];Zp(this._ids,this._dists,0,o-1);let re=new Uint32Array(o),Q=0;for(let ie=0,se=-1/0;ie<o;ie++){let ue=this._ids[ie];this._dists[ue]>se&&(re[Q++]=ue,se=this._dists[ue])}return this.hull=re.subarray(0,Q),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ZE(O,I,B,M,z,q)<0){let re=k,Q=B,ie=M;k=_,B=z,M=q,_=re,z=Q,q=ie}let Y=(function(re,Q,ie,se,ue,fe){let ve=ie-re,we=se-Q,Oe=ue-re,Ue=fe-Q,He=ve*ve+we*we,De=Oe*Oe+Ue*Ue,ut=.5/(ve*Ue-we*Oe),ct=re+(Ue*He-we*De)*ut,bt=Q+(ve*De-Oe*He)*ut;return{x:ct,y:bt}})(O,I,B,M,z,q);this._cx=Y.x,this._cy=Y.y;for(let re=0;re<o;re++)this._dists[re]=XS(t[2*re],t[2*re+1],Y.x,Y.y);Zp(this._ids,this._dists,0,o-1),this._hullStart=E;let K=3;a[E]=n[_]=k,a[k]=n[E]=_,a[_]=n[k]=E,r[E]=0,r[k]=1,r[_]=2,i.fill(-1),i[this._hashKey(O,I)]=E,i[this._hashKey(B,M)]=k,i[this._hashKey(z,q)]=_,this.trianglesLen=0,this._addTriangle(E,k,_,-1,-1,-1);for(let re,Q,ie=0;ie<this._ids.length;ie++){let se=this._ids[ie],ue=t[2*se],fe=t[2*se+1];if(ie>0&&Math.abs(ue-re)<=aI&&Math.abs(fe-Q)<=aI||(re=ue,Q=fe,se===E||se===k||se===_))continue;let ve=0;for(let De=0,ut=this._hashKey(ue,fe);De<this._hashSize&&(ve=i[(ut+De)%this._hashSize],ve===-1||ve===a[ve]);De++);ve=n[ve];let we,Oe=ve;for(;we=a[Oe],ZE(ue,fe,t[2*Oe],t[2*Oe+1],t[2*we],t[2*we+1])>=0;)if(Oe=we,Oe===ve){Oe=-1;break}if(Oe===-1)continue;let Ue=this._addTriangle(Oe,se,a[Oe],-1,-1,r[Oe]);r[se]=this._legalize(Ue+2),r[Oe]=Ue,K++;let He=a[Oe];for(;we=a[He],ZE(ue,fe,t[2*He],t[2*He+1],t[2*we],t[2*we+1])<0;)Ue=this._addTriangle(He,se,we,r[se],-1,r[He]),r[se]=this._legalize(Ue+2),a[He]=He,K--,He=we;if(Oe===ve)for(;we=n[Oe],ZE(ue,fe,t[2*we],t[2*we+1],t[2*Oe],t[2*Oe+1])<0;)Ue=this._addTriangle(we,se,Oe,-1,r[Oe],r[we]),this._legalize(Ue+2),r[we]=Ue,a[Oe]=Oe,K--,Oe=we;this._hullStart=n[se]=Oe,a[Oe]=n[He]=se,a[se]=He,i[this._hashKey(ue,fe)]=se,i[this._hashKey(t[2*Oe],t[2*Oe+1])]=Oe}this.hull=new Uint32Array(K);for(let re=0,Q=this._hullStart;re<K;re++)this.hull[re]=Q,Q=a[Q];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor((function(a,r){let i=a/(Math.abs(a)+Math.abs(r));return(r>0?3-i:1+i)/4})(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:a,coords:r}=this,i=0,o=0;for(;;){let u=a[t],c=t-t%3;if(o=c+(t+2)%3,u===-1){if(i===0)break;t=JE[--i];continue}let f=u-u%3,m=c+(t+1)%3,g=f+(u+2)%3,v=n[o],E=n[t],k=n[m],_=n[g];if(VP(r[2*v],r[2*v+1],r[2*E],r[2*E+1],r[2*k],r[2*k+1],r[2*_],r[2*_+1])){n[t]=_,n[u]=v;let N=a[g];if(N===-1){let I=this._hullStart;do{if(this._hullTri[I]===g){this._hullTri[I]=t;break}I=this._hullPrev[I]}while(I!==this._hullStart)}this._link(t,N),this._link(u,a[o]),this._link(o,g);let O=f+(u+1)%3;i<JE.length&&(JE[i++]=O)}else{if(i===0)break;t=JE[--i]}}return o}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,a,r,i,o){let u=this.trianglesLen;return this._triangles[u]=t,this._triangles[u+1]=n,this._triangles[u+2]=a,this._link(u,r),this._link(u+1,i),this._link(u+2,o),this.trianglesLen+=3,u}}function XS(e,t,n,a){let r=e-n,i=t-a;return r*r+i*i}function VP(e,t,n,a,r,i,o,u){let c=e-o,f=t-u,m=n-o,g=a-u,v=r-o,E=i-u,k=m*m+g*g,_=v*v+E*E;return c*(g*_-k*E)-f*(m*_-k*v)+(c*c+f*f)*(m*E-g*v)<0}function YP(e,t,n,a,r,i){let o=n-e,u=a-t,c=r-e,f=i-t,m=o*o+u*u,g=c*c+f*f,v=.5/(o*f-u*c),E=(f*m-u*g)*v,k=(o*g-c*m)*v;return E*E+k*k}function Zp(e,t,n,a){if(a-n<=20)for(let r=n+1;r<=a;r++){let i=e[r],o=t[i],u=r-1;for(;u>=n&&t[e[u]]>o;)e[u+1]=e[u--];e[u+1]=i}else{let r=n+1,i=a;Mb(e,n+a>>1,r),t[e[n]]>t[e[a]]&&Mb(e,n,a),t[e[r]]>t[e[a]]&&Mb(e,r,a),t[e[n]]>t[e[r]]&&Mb(e,n,r);let o=e[r],u=t[o];for(;;){do r++;while(t[e[r]]<u);do i--;while(t[e[i]]>u);if(i<r)break;Mb(e,r,i)}e[n+1]=e[i],e[i]=o,a-r+1>=i-n?(Zp(e,t,r,a),Zp(e,t,n,i-1)):(Zp(e,t,n,i-1),Zp(e,t,r,a))}}function Mb(e,t,n){let a=e[t];e[t]=e[n],e[n]=a}function KP(e){return e[0]}function XP(e){return e[1]}let rI=1e-6;class yd{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,a){let r=(t=+t)+(a=+a),i=n=+n;if(a<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>rI||Math.abs(this._y1-i)>rI)&&(this._+="L"+r+","+i),a&&(this._+=`A${a},${a},0,1,1,${t-a},${n}A${a},${a},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,a,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+a}v${+r}h${-a}Z`}value(){return this._||null}}class ZS{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let ZP=2*Math.PI,Jp=Math.pow;function JP(e){return e[0]}function QP(e){return e[1]}function e$(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class JS{static from(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:JP,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:QP,r=arguments.length>3?arguments[3]:void 0;return new JS("length"in t?(function(i,o,u,c){let f=i.length,m=new Float64Array(2*f);for(let g=0;g<f;++g){let v=i[g];m[2*g]=o.call(c,v,g,i),m[2*g+1]=u.call(c,v,g,i)}return m})(t,n,a,r):Float64Array.from((function*(i,o,u,c){let f=0;for(let m of i)yield o.call(c,m,f,i),yield u.call(c,m,f,i),++f})(t,n,a,r)))}constructor(t){this._delaunator=new QE(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(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&(function(c){let{triangles:f,coords:m}=c;for(let g=0;g<f.length;g+=3){let v=2*f[g],E=2*f[g+1],k=2*f[g+2];if((m[k]-m[v])*(m[E+1]-m[v+1])-(m[E]-m[v])*(m[k+1]-m[v+1])>1e-10)return!1}return!0})(t)){this.collinear=Int32Array.from({length:n.length/2},((v,E)=>E)).sort(((v,E)=>n[2*v]-n[2*E]||n[2*v+1]-n[2*E+1]));let c=this.collinear[0],f=this.collinear[this.collinear.length-1],m=[n[2*c],n[2*c+1],n[2*f],n[2*f+1]],g=1e-8*Math.hypot(m[3]-m[1],m[2]-m[0]);for(let v=0,E=n.length/2;v<E;++v){let k=e$(n[2*v],n[2*v+1],g);n[2*v]=k[0],n[2*v+1]=k[1]}this._delaunator=new QE(n)}else delete this.collinear;let a=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),u=this._hullIndex.fill(-1);for(let c=0,f=a.length;c<f;++c){let m=i[c%3==2?c-2:c+1];a[c]!==-1&&o[m]!==-1||(o[m]=c)}for(let c=0,f=r.length;c<f;++c)u[r[c]]=c;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],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new class{constructor(n){let[a,r,i,o]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,960,500];if(!((i=+i)>=(a=+a)&&(o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=n,this._circumcenters=new Float64Array(2*n.points.length),this.vectors=new Float64Array(2*n.points.length),this.xmax=i,this.xmin=a,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:n,hull:a,triangles:r},vectors:i}=this,o,u,c=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let N,O,I=0,B=0,M=r.length;I<M;I+=3,B+=2){let U=2*r[I],z=2*r[I+1],q=2*r[I+2],Y=n[U],K=n[U+1],re=n[z],Q=n[z+1],ie=n[q],se=n[q+1],ue=re-Y,fe=Q-K,ve=ie-Y,we=se-K,Oe=2*(ue*we-fe*ve);if(Math.abs(Oe)<1e-9){if(o===void 0){o=u=0;for(let He of a)o+=n[2*He],u+=n[2*He+1];o/=a.length,u/=a.length}let Ue=1e9*Math.sign((o-Y)*we-(u-K)*ve);N=(Y+ie)/2-Ue*we,O=(K+se)/2+Ue*ve}else{let Ue=1/Oe,He=ue*ue+fe*fe,De=ve*ve+we*we;N=Y+(we*He-fe*De)*Ue,O=K+(ue*De-ve*He)*Ue}c[B]=N,c[B+1]=O}let f,m,g,v=a[a.length-1],E=4*v,k=n[2*v],_=n[2*v+1];i.fill(0);for(let N=0;N<a.length;++N)v=a[N],f=E,m=k,g=_,E=4*v,k=n[2*v],_=n[2*v+1],i[f+2]=i[E]=g-_,i[f+3]=i[E+1]=k-m}render(n){let a=n==null?n=new yd:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:u,vectors:c}=this;if(o.length<=1)return null;for(let g=0,v=r.length;g<v;++g){let E=r[g];if(E<g)continue;let k=2*Math.floor(g/3),_=2*Math.floor(E/3),N=u[k],O=u[k+1],I=u[_],B=u[_+1];this._renderSegment(N,O,I,B,n)}let f,m=o[o.length-1];for(let g=0;g<o.length;++g){f=m,m=o[g];let v=2*Math.floor(i[m]/3),E=u[v],k=u[v+1],_=4*f,N=this._project(E,k,c[_+2],c[_+3]);N&&this._renderSegment(E,k,N[0],N[1],n)}return a&&a.value()}renderBounds(n){let a=n==null?n=new yd:void 0;return n.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),a&&a.value()}renderCell(n,a){let r=a==null?a=new yd:void 0,i=this._clip(n);if(i===null||!i.length)return;a.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let u=2;u<o;u+=2)i[u]===i[u-2]&&i[u+1]===i[u-1]||a.lineTo(i[u],i[u+1]);return a.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:n}}=this;for(let a=0,r=n.length/2;a<r;++a){let i=this.cellPolygon(a);i&&(i.index=a,yield i)}}cellPolygon(n){let a=new ZS;return this.renderCell(n,a),a.value()}_renderSegment(n,a,r,i,o){let u,c=this._regioncode(n,a),f=this._regioncode(r,i);c===0&&f===0?(o.moveTo(n,a),o.lineTo(r,i)):(u=this._clipSegment(n,a,r,i,c,f))&&(o.moveTo(u[0],u[1]),o.lineTo(u[2],u[3]))}contains(n,a,r){return(a=+a)==a&&(r=+r)==r&&this.delaunay._step(n,a,r)===n}*neighbors(n){let a=this._clip(n);if(a)for(let r of this.delaunay.neighbors(n)){let i=this._clip(r);if(i){e:for(let o=0,u=a.length;o<u;o+=2)for(let c=0,f=i.length;c<f;c+=2)if(a[o]===i[c]&&a[o+1]===i[c+1]&&a[(o+2)%u]===i[(c+f-2)%f]&&a[(o+3)%u]===i[(c+f-1)%f]){yield r;break e}}}}_cell(n){let{circumcenters:a,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,u=r[n];if(u===-1)return null;let c=[],f=u;do{let m=Math.floor(f/3);if(c.push(a[2*m],a[2*m+1]),f=f%3==2?f-2:f+1,o[f]!==n)break;f=i[f]}while(f!==u&&f!==-1);return c}_clip(n){if(n===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let a=this._cell(n);if(a===null)return null;let{vectors:r}=this,i=4*n;return this._simplify(r[i]||r[i+1]?this._clipInfinite(n,a,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(n,a))}_clipFinite(n,a){let r=a.length,i,o,u,c,f=null,m=a[r-2],g=a[r-1],v=this._regioncode(m,g),E=0;for(let k=0;k<r;k+=2)if(i=m,o=g,m=a[k],g=a[k+1],u=v,v=this._regioncode(m,g),u===0&&v===0)c=E,E=0,f?f.push(m,g):f=[m,g];else{let _,N,O,I,B;if(u===0){if((_=this._clipSegment(i,o,m,g,u,v))===null)continue;[N,O,I,B]=_}else{if((_=this._clipSegment(m,g,i,o,v,u))===null)continue;[I,B,N,O]=_,c=E,E=this._edgecode(N,O),c&&E&&this._edge(n,c,E,f,f.length),f?f.push(N,O):f=[N,O]}c=E,E=this._edgecode(I,B),c&&E&&this._edge(n,c,E,f,f.length),f?f.push(I,B):f=[I,B]}if(f)c=E,E=this._edgecode(f[0],f[1]),c&&E&&this._edge(n,c,E,f,f.length);else if(this.contains(n,(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 f}_clipSegment(n,a,r,i,o,u){let c=o<u;for(c&&([n,a,r,i,o,u]=[r,i,n,a,u,o]);;){if(o===0&&u===0)return c?[r,i,n,a]:[n,a,r,i];if(o&u)return null;let f,m,g=o||u;8&g?(f=n+(r-n)*(this.ymax-a)/(i-a),m=this.ymax):4&g?(f=n+(r-n)*(this.ymin-a)/(i-a),m=this.ymin):2&g?(m=a+(i-a)*(this.xmax-n)/(r-n),f=this.xmax):(m=a+(i-a)*(this.xmin-n)/(r-n),f=this.xmin),o?(n=f,a=m,o=this._regioncode(n,a)):(r=f,i=m,u=this._regioncode(r,i))}}_clipInfinite(n,a,r,i,o,u){let c,f=Array.from(a);if((c=this._project(f[0],f[1],r,i))&&f.unshift(c[0],c[1]),(c=this._project(f[f.length-2],f[f.length-1],o,u))&&f.push(c[0],c[1]),f=this._clipFinite(n,f))for(let m,g=0,v=f.length,E=this._edgecode(f[v-2],f[v-1]);g<v;g+=2)m=E,E=this._edgecode(f[g],f[g+1]),m&&E&&(g=this._edge(n,m,E,f,g),v=f.length);else this.contains(n,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(f=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return f}_edge(n,a,r,i,o){for(;a!==r;){let u,c;switch(a){case 5:a=4;continue;case 4:a=6,u=this.xmax,c=this.ymin;break;case 6:a=2;continue;case 2:a=10,u=this.xmax,c=this.ymax;break;case 10:a=8;continue;case 8:a=9,u=this.xmin,c=this.ymax;break;case 9:a=1;continue;case 1:a=5,u=this.xmin,c=this.ymin}i[o]===u&&i[o+1]===c||!this.contains(n,u,c)||(i.splice(o,0,u,c),o+=2)}return o}_project(n,a,r,i){let o,u,c,f=1/0;if(i<0){if(a<=this.ymin)return null;(o=(this.ymin-a)/i)<f&&(c=this.ymin,u=n+(f=o)*r)}else if(i>0){if(a>=this.ymax)return null;(o=(this.ymax-a)/i)<f&&(c=this.ymax,u=n+(f=o)*r)}if(r>0){if(n>=this.xmax)return null;(o=(this.xmax-n)/r)<f&&(u=this.xmax,c=a+(f=o)*i)}else if(r<0){if(n<=this.xmin)return null;(o=(this.xmin-n)/r)<f&&(u=this.xmin,c=a+(f=o)*i)}return[u,c]}_edgecode(n,a){return(n===this.xmin?1:n===this.xmax?2:0)|(a===this.ymin?4:a===this.ymax?8:0)}_regioncode(n,a){return(n<this.xmin?1:n>this.xmax?2:0)|(a<this.ymin?4:a>this.ymax?8:0)}_simplify(n){if(n&&n.length>4){for(let a=0;a<n.length;a+=2){let r=(a+2)%n.length,i=(a+4)%n.length;(n[a]===n[r]&&n[r]===n[i]||n[a+1]===n[r+1]&&n[r+1]===n[i+1])&&(n.splice(r,2),a-=2)}n.length||(n=null)}return n}}(this,t)}*neighbors(t){let{inedges:n,hull:a,_hullIndex:r,halfedges:i,triangles:o,collinear:u}=this;if(u){let g=u.indexOf(t);return g>0&&(yield u[g-1]),void(g<u.length-1&&(yield u[g+1]))}let c=n[t];if(c===-1)return;let f=c,m=-1;do{if(yield m=o[f],f=f%3==2?f-2:f+1,o[f]!==t)return;if(f=i[f],f===-1){let g=a[(r[t]+1)%a.length];return void(g!==m&&(yield g))}}while(f!==c)}find(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if((t=+t)!=t||(n=+n)!=n)return-1;let r=a,i;for(;(i=this._step(a,t,n))>=0&&i!==a&&i!==r;)a=i;return i}_step(t,n,a){let{inedges:r,hull:i,_hullIndex:o,halfedges:u,triangles:c,points:f}=this;if(r[t]===-1||!f.length)return(t+1)%(f.length>>1);let m=t,g=Jp(n-f[2*t],2)+Jp(a-f[2*t+1],2),v=r[t],E=v;do{let k=c[E],_=Jp(n-f[2*k],2)+Jp(a-f[2*k+1],2);if(_<g&&(g=_,m=k),E=E%3==2?E-2:E+1,c[E]!==t)break;if(E=u[E],E===-1){if(E=i[(o[t]+1)%i.length],E!==k&&Jp(n-f[2*E],2)+Jp(a-f[2*E+1],2)<g)return E;break}}while(E!==v);return m}render(t){let n=t==null?t=new yd:void 0,{points:a,halfedges:r,triangles:i}=this;for(let o=0,u=r.length;o<u;++o){let c=r[o];if(c<o)continue;let f=2*i[o],m=2*i[c];t.moveTo(a[f],a[f+1]),t.lineTo(a[m],a[m+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n!==void 0||t&&typeof t.moveTo=="function"||(n=t,t=null),n=n==null?2:+n;let a=t==null?t=new yd:void 0,{points:r}=this;for(let i=0,o=r.length;i<o;i+=2){let u=r[i],c=r[i+1];t.moveTo(u+n,c),t.arc(u,c,n,0,ZP)}return a&&a.value()}renderHull(t){let n=t==null?t=new yd:void 0,{hull:a,points:r}=this,i=2*a[0],o=a.length;t.moveTo(r[i],r[i+1]);for(let u=1;u<o;++u){let c=2*a[u];t.lineTo(r[c],r[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new ZS;return this.renderHull(t),t.value()}renderTriangle(t,n){let a=n==null?n=new yd:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],u=2*i[t+1],c=2*i[t+2];return n.moveTo(r[o],r[o+1]),n.lineTo(r[u],r[u+1]),n.lineTo(r[c],r[c+1]),n.closePath(),a&&a.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,a=t.length/3;n<a;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new ZS;return this.renderTriangle(t,n),n.value()}}function QS(e){Se.call(this,null,e)}QS.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"}]};let t$=[-1e5,-1e5,1e5,1e5];function n$(e){let t=e[0][0],n=e[0][1],a=e.length-1;for(;e[a][0]===t&&e[a][1]===n;--a);return"M"+e.slice(0,a+1).join("L")+"Z"}Fe(QS,Se,{transform(e,t){let n=e.as||"path",a=t.source;if(!a||!a.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:t$;let i=this.value=JS.from(a,e.x,e.y).voronoi(r);for(let o=0,u=a.length;o<u;++o){let c=i.cellPolygon(o);a[o][n]=c?n$(c):null}return t.reflow(e.modified()).modifies(n)}});var a$=Object.freeze({__proto__:null,voronoi:QS}),ex=Math.PI/180,Lb=64,ew=2048;function r$(){var e,t,n,a,r,i,o,u=[256,256],c=iI,f=[],m=Math.random,g={};function v(E,k,_){for(var N,O,I,B=k.x,M=k.y,U=Math.hypot(u[0],u[1]),z=c(u),q=m()<.5?1:-1,Y=-q;(N=z(Y+=q))&&(O=~~N[0],I=~~N[1],!(Math.min(Math.abs(O),Math.abs(I))>=U));)if(k.x=B+O,k.y=M+I,!(k.x+k.x0<0||k.y+k.y0<0||k.x+k.x1>u[0]||k.y+k.y1>u[1])&&(!_||!o$(k,E,u[0]))&&(!_||l$(k,_))){for(var K,re=k.sprite,Q=k.width>>5,ie=u[0]>>5,se=k.x-(Q<<4),ue=127&se,fe=32-ue,ve=k.y1-k.y0,we=(k.y+k.y0)*ie+(se>>5),Oe=0;Oe<ve;Oe++){K=0;for(var Ue=0;Ue<=Q;Ue++)E[we+Ue]|=K<<fe|(Ue<Q?(K=re[Oe*Q+Ue])>>>ue:0);we+=ie}return k.sprite=null,!0}return!1}return g.layout=function(){for(var E=(function(U){U.width=U.height=1;var z=Math.sqrt(U.getContext("2d").getImageData(0,0,1,1).data.length>>2);U.width=(Lb<<5)/z,U.height=ew/z;var q=U.getContext("2d");return q.fillStyle=q.strokeStyle="red",q.textAlign="center",{context:q,ratio:z}})(Wa()),k=(function(U){for(var z=[],q=-1;++q<U;)z[q]=0;return z})((u[0]>>5)*u[1]),_=null,N=f.length,O=-1,I=[],B=f.map((U=>({text:e(U),font:t(U),style:a(U),weight:r(U),rotate:i(U),size:~~(n(U)+1e-14),padding:o(U),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:U}))).sort(((U,z)=>z.size-U.size));++O<N;){var M=B[O];M.x=u[0]*(m()+.5)>>1,M.y=u[1]*(m()+.5)>>1,i$(E,M,B,O),M.hasText&&v(k,M,_)&&(I.push(M),_?s$(_,M):_=[{x:M.x+M.x0,y:M.y+M.y0},{x:M.x+M.x1,y:M.y+M.y1}],M.x-=u[0]>>1,M.y-=u[1]>>1)}return I},g.words=function(E){return arguments.length?(f=E,g):f},g.size=function(E){return arguments.length?(u=[+E[0],+E[1]],g):u},g.font=function(E){return arguments.length?(t=vd(E),g):t},g.fontStyle=function(E){return arguments.length?(a=vd(E),g):a},g.fontWeight=function(E){return arguments.length?(r=vd(E),g):r},g.rotate=function(E){return arguments.length?(i=vd(E),g):i},g.text=function(E){return arguments.length?(e=vd(E),g):e},g.spiral=function(E){return arguments.length?(c=u$[E]||E,g):c},g.fontSize=function(E){return arguments.length?(n=vd(E),g):n},g.padding=function(E){return arguments.length?(o=vd(E),g):o},g.random=function(E){return arguments.length?(m=E,g):m},g}function i$(e,t,n,a){if(!t.sprite){var r=e.context,i=e.ratio;r.clearRect(0,0,(Lb<<5)/i,ew/i);var o,u,c,f,m,g=0,v=0,E=0,k=n.length;for(--a;++a<k;){if(t=n[a],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/i)+"px "+t.font,o=r.measureText(t.text+"m").width*i,c=t.size<<1,t.rotate){var _=Math.sin(t.rotate*ex),N=Math.cos(t.rotate*ex),O=o*N,I=o*_,B=c*N,M=c*_;o=Math.max(Math.abs(O+M),Math.abs(O-M))+31>>5<<5,c=~~Math.max(Math.abs(I+B),Math.abs(I-B))}else o=o+31>>5<<5;if(c>E&&(E=c),g+o>=Lb<<5&&(g=0,v+=E,E=0),v+c>=ew)break;r.translate((g+(o>>1))/i,(v+(c>>1))/i),t.rotate&&r.rotate(t.rotate*ex),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=o,t.height=c,t.xoff=g,t.yoff=v,t.x1=o>>1,t.y1=c>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,g+=o}for(var U=r.getImageData(0,0,(Lb<<5)/i,ew/i).data,z=[];--a>=0;)if((t=n[a]).hasText){for(u=(o=t.width)>>5,c=t.y1-t.y0,f=0;f<c*u;f++)z[f]=0;if((g=t.xoff)==null)return;v=t.yoff;var q=0,Y=-1;for(m=0;m<c;m++){for(f=0;f<o;f++){var K=u*m+(f>>5),re=U[(v+m)*(Lb<<5)+(g+f)<<2]?1<<31-f%32:0;z[K]|=re,q|=re}q?Y=m:(t.y0++,c--,m--,v++)}t.y1=t.y0+Y,t.sprite=z.slice(0,(t.y1-t.y0)*u)}}}function o$(e,t,n){n>>=5;for(var a,r=e.sprite,i=e.width>>5,o=e.x-(i<<4),u=127&o,c=32-u,f=e.y1-e.y0,m=(e.y+e.y0)*n+(o>>5),g=0;g<f;g++){a=0;for(var v=0;v<=i;v++)if((a<<c|(v<i?(a=r[g*i+v])>>>u:0))&t[m+v])return!0;m+=n}return!1}function s$(e,t){var n=e[0],a=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>a.x&&(a.x=t.x+t.x1),t.y+t.y1>a.y&&(a.y=t.y+t.y1)}function l$(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function iI(e){var t=e[0]/e[1];return function(n){return[t*(n*=.1)*Math.cos(n),n*Math.sin(n)]}}function vd(e){return typeof e=="function"?e:function(){return e}}var u$={archimedean:iI,rectangular:function(e){var t=4*e[0]/e[1],n=0,a=0;return function(r){var i=r<0?-1:1;switch(Math.sqrt(1+4*i*r)-i&3){case 0:n+=t;break;case 1:a+=4;break;case 2:n-=t;break;default:a-=4}return[n,a]}}};let oI=["x","y","font","fontSize","fontStyle","fontWeight","angle"],c$=["text","font","rotate","fontSize","fontStyle","fontWeight"];function tx(e){Se.call(this,r$(),e)}tx.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:oI}]},Fe(tx,Se,{transform(e,t){!e.size||e.size[0]&&e.size[1]||F("Wordcloud size dimensions must be non-zero.");let n=e.modified();if(!(n||t.changed(t.ADD_REM)||c$.some((function(E){let k=e[E];return tt(k)&&t.modified(k.fields)}))))return;let a=t.materialize(t.SOURCE).source,r=this.value,i=e.as||oI,o,u=e.fontSize||14;if(tt(u)?o=e.fontSizeRange:u=mn(u),o){let E=u,k=Bt("sqrt")().domain(Un(a,E)).range(o);u=_=>k(E(_))}a.forEach((E=>{E[i[0]]=NaN,E[i[1]]=NaN,E[i[3]]=0}));let c=r.words(a).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(u).random(p.random).layout(),f=r.size(),m=f[0]>>1,g=f[1]>>1,v=c.length;for(let E,k,_=0;_<v;++_)E=c[_],k=E.datum,k[i[0]]=E.x+m,k[i[1]]=E.y+g,k[i[2]]=E.font,k[i[3]]=E.size,k[i[4]]=E.style,k[i[5]]=E.weight,k[i[6]]=E.rotate;return t.reflow(n).modifies(i)}});var d$=Object.freeze({__proto__:null,wordcloud:tx});let f$=e=>new Uint8Array(e),p$=e=>new Uint16Array(e),Fb=e=>new Uint32Array(e);function tw(e,t,n){let a=(t<257?f$:t<65537?p$:Fb)(e);return n&&a.set(n),a}function sI(e,t,n){let a=1<<t;return{one:a,zero:~a,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(r,i){let o=this,u=o.bisect(o.range,r.value),c=r.index,f=u[0],m=u[1],g=c.length,v;for(v=0;v<f;++v)i[c[v]]|=a;for(v=m;v<g;++v)i[c[v]]|=a;return o}}}function lI(){let e=Fb(0),t=[],n=0;return{insert:function(a,r,i){if(!r.length)return[];let o=n,u=r.length,c=Fb(u),f,m,g,v=Array(u);for(g=0;g<u;++g)v[g]=a(r[g]),c[g]=g;if(v=(function(E,k){return E.sort.call(k,((_,N)=>{let O=E[_],I=E[N];return O<I?-1:O>I?1:0})),(function(_,N){return Array.from(N,(O=>_[O]))})(E,k)})(v,c),o)f=t,m=e,t=Array(o+u),e=Fb(o+u),(function(E,k,_,N,O,I,B,M,U){let z,q=0,Y=0;for(z=0;q<N&&Y<B;++z)k[q]<O[Y]?(M[z]=k[q],U[z]=_[q++]):(M[z]=O[Y],U[z]=I[Y++]+E);for(;q<N;++q,++z)M[z]=k[q],U[z]=_[q];for(;Y<B;++Y,++z)M[z]=O[Y],U[z]=I[Y]+E})(i,f,m,o,v,c,u,t,e);else{if(i>0)for(g=0;g<u;++g)c[g]+=i;t=v,e=c}return n=o+u,{index:c,value:v}},remove:function(a,r){let i=n,o,u,c;for(u=0;!r[e[u]]&&u<i;++u);for(c=u;u<i;++u)r[o=e[u]]||(e[c]=o,t[c]=t[u],++c);n=i-a},bisect:function(a,r){let i;return r?i=r.length:(r=t,i=n),[v_(r,a[0],0,i),Ul(r,a[1],0,i)]},reindex:function(a){for(let r=0,i=n;r<i;++r)e[r]=a[e[r]]},index:()=>e,size:()=>n}}function nx(e){Se.call(this,(function(){let t=8,n=[],a=Fb(0),r=tw(0,t),i=tw(0,t);return{data:()=>n,seen:()=>a=(function(o,u,c){return o.length>=u?o:((c=c||new o.constructor(u)).set(o),c)})(a,n.length),add(o){for(let u,c=0,f=n.length,m=o.length;c<m;++c)u=o[c],u._index=f++,n.push(u)},remove(o,u){let c=n.length,f=Array(c-o),m=n,g,v,E;for(v=0;!u[v]&&v<c;++v)f[v]=n[v],m[v]=v;for(E=v;v<c;++v)g=n[v],u[v]?m[v]=-1:(m[v]=E,r[E]=r[v],i[E]=i[v],f[E]=g,g._index=E++),r[v]=0;return n=f,m},size:()=>n.length,curr:()=>r,prev:()=>i,reset:o=>i[o]=r[o],all:()=>t<257?255:t<65537?65535:4294967295,set(o,u){r[o]|=u},clear(o,u){r[o]&=~u},resize(o,u){(o>r.length||u>t)&&(t=Math.max(u,t),r=tw(o,t,r),i=tw(o,t))}}})(),e),this._indices=null,this._dims=null}function ax(e){Se.call(this,null,e)}nx.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}}]},Fe(nx,Se,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((n=>t.modified(n.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){let n=e.fields,a=e.query,r=this._indices={},i=this._dims=[],o=a.length,u,c,f=0;for(;f<o;++f)u=n[f].fname,c=r[u]||(r[u]=lI()),i.push(sI(c,f,a[f]));return this.eval(e,t)},reinit(e,t){let n=t.materialize().fork(),a=e.fields,r=e.query,i=this._indices,o=this._dims,u=this.value,c=u.curr(),f=u.prev(),m=u.all(),g=n.rem=n.add,v=n.mod,E=r.length,k={},_,N,O,I,B,M,U,z,q;if(f.set(c),t.rem.length&&(B=this.remove(e,t,n)),t.add.length&&u.add(t.add),t.mod.length)for(M={},I=t.mod,U=0,z=I.length;U<z;++U)M[I[U]._index]=1;for(U=0;U<E;++U)q=a[U],(!o[U]||e.modified("fields",U)||t.modified(q.fields))&&(O=q.fname,(_=k[O])||(i[O]=N=lI(),k[O]=_=N.insert(q,t.source,0)),o[U]=sI(N,U,r[U]).onAdd(_,c));for(U=0,z=u.data().length;U<z;++U)B[U]||(f[U]!==c[U]?g.push(U):M[U]&&c[U]!==m&&v.push(U));return u.mask=(1<<E)-1,n},eval(e,t){let n=t.materialize().fork(),a=this._dims.length,r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<a)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<a)-1),t.mod.length&&(this.modify(t,n),r|=(1<<a)-1),this.value.mask=r,n},insert(e,t,n){let a=t.add,r=this.value,i=this._dims,o=this._indices,u=e.fields,c={},f=n.add,m=r.size()+a.length,g=i.length,v,E,k,_=r.size();r.resize(m,g),r.add(a);let N=r.curr(),O=r.prev(),I=r.all();for(v=0;v<g;++v)E=u[v].fname,k=c[E]||(c[E]=o[E].insert(u[v],a,_)),i[v].onAdd(k,N);for(;_<m;++_)O[_]=I,N[_]!==I&&f.push(_)},modify(e,t){let n=t.mod,a=this.value,r=a.curr(),i=a.all(),o=e.mod,u,c,f;for(u=0,c=o.length;u<c;++u)f=o[u]._index,r[f]!==i&&n.push(f)},remove(e,t,n){let a=this._indices,r=this.value,i=r.curr(),o=r.prev(),u=r.all(),c={},f=n.rem,m=t.rem,g,v,E,k;for(g=0,v=m.length;g<v;++g)E=m[g]._index,c[E]=1,o[E]=k=i[E],i[E]=u,k!==u&&f.push(E);for(E in a)a[E].remove(v,c);return this.reindex(t,v,c),c},reindex(e,t,n){let a=this._indices,r=this.value;e.runAfter((()=>{let i=r.remove(t,n);for(let o in a)a[o].reindex(i)}))},update(e,t,n){let a=this._dims,r=e.query,i=t.stamp,o=a.length,u,c,f=0;for(n.filters=0,c=0;c<o;++c)e.modified("query",c)&&(u=c,++f);if(f===1)f=a[u].one,this.incrementOne(a[u],r[u],n.add,n.rem);else for(c=0,f=0;c<o;++c)e.modified("query",c)&&(f|=a[c].one,this.incrementAll(a[c],r[c],i,n.add),n.rem=n.add);return f},incrementAll(e,t,n,a){let r=this.value,i=r.seen(),o=r.curr(),u=r.prev(),c=e.index(),f=e.bisect(e.range),m=e.bisect(t),g=m[0],v=m[1],E=f[0],k=f[1],_=e.one,N,O,I;if(g<E)for(N=g,O=Math.min(E,v);N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;else if(g>E)for(N=E,O=Math.min(g,k);N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;if(v>k)for(N=Math.max(g,k),O=v;N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;else if(v<k)for(N=Math.max(E,v),O=k;N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;e.range=t.slice()},incrementOne(e,t,n,a){let r=this.value.curr(),i=e.index(),o=e.bisect(e.range),u=e.bisect(t),c=u[0],f=u[1],m=o[0],g=o[1],v=e.one,E,k,_;if(c<m)for(E=c,k=Math.min(m,f);E<k;++E)_=i[E],r[_]^=v,n.push(_);else if(c>m)for(E=m,k=Math.min(c,g);E<k;++E)_=i[E],r[_]^=v,a.push(_);if(f>g)for(E=Math.max(c,g),k=f;E<k;++E)_=i[E],r[_]^=v,n.push(_);else if(f<g)for(E=Math.max(m,f),k=g;E<k;++E)_=i[E],r[_]^=v,a.push(_);e.range=t.slice()}}),ax.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."}]},Fe(ax,Se,{transform(e,t){let n=~(e.ignore||0),a=e.filter,r=a.mask;if((r&n)==0)return t.StopPropagation;let i=t.fork(t.ALL),o=a.data(),u=a.curr(),c=a.prev(),f=m=>u[m]&n?null:o[m];return i.filter(i.MOD,f),r&r-1?(i.filter(i.ADD,(m=>{let g=u[m]&n;return!g&&g^c[m]&n?o[m]:null})),i.filter(i.REM,(m=>{let g=u[m]&n;return g&&!(g^g^c[m]&n)?o[m]:null}))):(i.filter(i.ADD,f),i.filter(i.REM,(m=>(u[m]&n)===r?o[m]:null))),i.filter(i.SOURCE,(m=>f(m._index)))}});var h$=Object.freeze({__proto__:null,crossfilter:nx,resolvefilter:ax});let Qp="Literal",m$="Property",g$="ArrayExpression",b$="BinaryExpression",uI="CallExpression",y$="ConditionalExpression",v$="LogicalExpression",E$="MemberExpression",w$="ObjectExpression",_$="UnaryExpression";function qo(e){this.type=e}var Nl,ot,Ne,er,en;qo.prototype.visit=function(e){let t,n,a;if(e(this))return 1;for(t=(function(r){switch(r.type){case g$:return r.elements;case b$:case v$:return[r.left,r.right];case uI:return[r.callee].concat(r.arguments);case y$:return[r.test,r.consequent,r.alternate];case E$:return[r.object,r.property];case w$:return r.properties;case m$:return[r.key,r.value];case _$:return[r.argument];default:return[]}})(this),n=0,a=t.length;n<a;++n)if(t[n].visit(e))return 1};var nw=1,Pb=2,Ed=3,qu=4,aw=5,wd=6,jr=7,$b=8;(Nl={})[nw]="Boolean",Nl[Pb]="<end>",Nl[Ed]="Identifier",Nl[qu]="Keyword",Nl[aw]="Null",Nl[wd]="Numeric",Nl[jr]="Punctuator",Nl[$b]="String",Nl[9]="RegularExpression";var k$="ArrayExpression",S$="BinaryExpression",x$="CallExpression",A$="ConditionalExpression",cI="Identifier",T$="Literal",C$="LogicalExpression",R$="MemberExpression",N$="ObjectExpression",I$="Property",O$="UnaryExpression",ya="Unexpected token %0",D$="Unexpected number",M$="Unexpected string",L$="Unexpected identifier",F$="Unexpected reserved word",P$="Unexpected end of input",rx="Invalid regular expression",ix="Invalid regular expression: missing /",dI="Octal literals are not allowed in strict mode.",$$="Duplicate data property in object literal not allowed in strict mode",La="ILLEGAL",Bb="Disabled.",B$=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]"),U$=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 rw(e,t){if(!e)throw new Error("ASSERT: "+t)}function Il(e){return e>=48&&e<=57}function ox(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function Ub(e){return"01234567".indexOf(e)>=0}function z$(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function zb(e){return e===10||e===13||e===8232||e===8233}function Gb(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&B$.test(String.fromCharCode(e))}function iw(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&U$.test(String.fromCharCode(e))}let G$={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 fI(){for(;Ne<er;){let e=ot.charCodeAt(Ne);if(!z$(e)&&!zb(e))break;++Ne}}function sx(e){var t,n,a,r=0;for(n=e==="u"?4:2,t=0;t<n;++t)Ne<er&&ox(ot[Ne])?(a=ot[Ne++],r=16*r+"0123456789abcdef".indexOf(a.toLowerCase())):Wt({},ya,La);return String.fromCharCode(r)}function j$(){var e,t,n,a;for(t=0,(e=ot[Ne])==="}"&&Wt({},ya,La);Ne<er&&ox(e=ot[Ne++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||e!=="}")&&Wt({},ya,La),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),a=56320+(t-65536&1023),String.fromCharCode(n,a))}function pI(){var e,t;for(e=ot.charCodeAt(Ne++),t=String.fromCharCode(e),e===92&&(ot.charCodeAt(Ne)!==117&&Wt({},ya,La),++Ne,(e=sx("u"))&&e!=="\\"&&Gb(e.charCodeAt(0))||Wt({},ya,La),t=e);Ne<er&&iw(e=ot.charCodeAt(Ne));)++Ne,t+=String.fromCharCode(e),e===92&&(t=t.substr(0,t.length-1),ot.charCodeAt(Ne)!==117&&Wt({},ya,La),++Ne,(e=sx("u"))&&e!=="\\"&&iw(e.charCodeAt(0))||Wt({},ya,La),t+=e);return t}function H$(){var e,t;return e=Ne,t=ot.charCodeAt(Ne)===92?pI():(function(){var n,a;for(n=Ne++;Ne<er;){if((a=ot.charCodeAt(Ne))===92)return Ne=n,pI();if(!iw(a))break;++Ne}return ot.slice(n,Ne)})(),{type:t.length===1?Ed:G$.hasOwnProperty(t)?qu:t==="null"?aw:t==="true"||t==="false"?nw:Ed,value:t,start:e,end:Ne}}function lx(){var e,t,n,a,r=Ne,i=ot.charCodeAt(Ne),o=ot[Ne];switch(i){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++Ne,{type:jr,value:String.fromCharCode(i),start:r,end:Ne};default:if((e=ot.charCodeAt(Ne+1))===61)switch(i){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Ne+=2,{type:jr,value:String.fromCharCode(i)+String.fromCharCode(e),start:r,end:Ne};case 33:case 61:return Ne+=2,ot.charCodeAt(Ne)===61&&++Ne,{type:jr,value:ot.slice(r,Ne),start:r,end:Ne}}}return(a=ot.substr(Ne,4))===">>>="?{type:jr,value:a,start:r,end:Ne+=4}:(n=a.substr(0,3))===">>>"||n==="<<="||n===">>="?{type:jr,value:n,start:r,end:Ne+=3}:o===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(o)>=0||t==="=>"?{type:jr,value:t,start:r,end:Ne+=2}:(t==="//"&&Wt({},ya,La),"<>=!+-*%&|^/".indexOf(o)>=0?(++Ne,{type:jr,value:o,start:r,end:Ne}):void Wt({},ya,La))}function hI(){var e,t,n;if(rw(Il((n=ot[Ne]).charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point"),t=Ne,e="",n!=="."){if(e=ot[Ne++],n=ot[Ne],e==="0"){if(n==="x"||n==="X")return++Ne,(function(a){let r="";for(;Ne<er&&ox(ot[Ne]);)r+=ot[Ne++];return r.length===0&&Wt({},ya,La),Gb(ot.charCodeAt(Ne))&&Wt({},ya,La),{type:wd,value:parseInt("0x"+r,16),start:a,end:Ne}})(t);if(Ub(n))return(function(a){let r="0"+ot[Ne++];for(;Ne<er&&Ub(ot[Ne]);)r+=ot[Ne++];return(Gb(ot.charCodeAt(Ne))||Il(ot.charCodeAt(Ne)))&&Wt({},ya,La),{type:wd,value:parseInt(r,8),octal:!0,start:a,end:Ne}})(t);n&&Il(n.charCodeAt(0))&&Wt({},ya,La)}for(;Il(ot.charCodeAt(Ne));)e+=ot[Ne++];n=ot[Ne]}if(n==="."){for(e+=ot[Ne++];Il(ot.charCodeAt(Ne));)e+=ot[Ne++];n=ot[Ne]}if(n==="e"||n==="E")if(e+=ot[Ne++],(n=ot[Ne])!=="+"&&n!=="-"||(e+=ot[Ne++]),Il(ot.charCodeAt(Ne)))for(;Il(ot.charCodeAt(Ne));)e+=ot[Ne++];else Wt({},ya,La);return Gb(ot.charCodeAt(Ne))&&Wt({},ya,La),{type:wd,value:parseFloat(e),start:t,end:Ne}}function q$(){var e,t,n,a;return en=null,fI(),e=Ne,t=(function(){var r,i,o,u;for(rw((r=ot[Ne])==="/","Regular expression literal must start with a slash"),i=ot[Ne++],o=!1,u=!1;Ne<er;)if(i+=r=ot[Ne++],r==="\\")zb((r=ot[Ne++]).charCodeAt(0))&&Wt({},ix),i+=r;else if(zb(r.charCodeAt(0)))Wt({},ix);else if(o)r==="]"&&(o=!1);else{if(r==="/"){u=!0;break}r==="["&&(o=!0)}return u||Wt({},ix),{value:i.substr(1,i.length-2),literal:i}})(),n=(function(){var r,i,o;for(i="",o="";Ne<er&&iw((r=ot[Ne]).charCodeAt(0));)++Ne,r==="\\"&&Ne<er?Wt({},ya,La):(o+=r,i+=r);return o.search(/[^gimuy]/g)>=0&&Wt({},rx,o),{value:o,literal:i}})(),a=(function(r,i){let o=r;i.indexOf("u")>=0&&(o=o.replace(/\\u\{([0-9a-fA-F]+)\}/g,((u,c)=>{if(parseInt(c,16)<=1114111)return"x";Wt({},rx)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(o)}catch{Wt({},rx)}try{return new RegExp(r,i)}catch{return null}})(t.value,n.value),{literal:t.literal+n.literal,value:a,regex:{pattern:t.value,flags:n.value},start:e,end:Ne}}function mI(){if(fI(),Ne>=er)return{type:Pb,start:Ne,end:Ne};let e=ot.charCodeAt(Ne);return Gb(e)?H$():e===40||e===41||e===59?lx():e===39||e===34?(function(){var t,n,a,r,i="",o=!1;for(rw((t=ot[Ne])==="'"||t==='"',"String literal must starts with a quote"),n=Ne,++Ne;Ne<er;){if((a=ot[Ne++])===t){t="";break}if(a==="\\")if((a=ot[Ne++])&&zb(a.charCodeAt(0)))a==="\r"&&ot[Ne]===`
7
+ `),r!==Za.text&&(Bo(t,0),o=t.ownerDocument,u=Iu(n),i.forEach(((c,f)=>{let m=Du(o,"tspan",la);m.__data__=n,m.textContent=c,f&&(m.setAttribute("x",0),m.setAttribute("dy",u)),t.appendChild(m)})),Za.text=r)):(i=Ou(n,a),i!==Za.text&&(t.textContent=i,Za.text=i)),gr(t,"font-family",ab(n)),gr(t,"font-size",Ts(n)+"px"),gr(t,"font-style",n.fontStyle),gr(t,"font-variant",n.fontVariant),gr(t,"font-weight",n.fontWeight)}};function lb(e,t,n){t!==Za[e]&&(n?(function(a,r,i,o){i!=null?a.setAttributeNS(o,r,i):a.removeAttributeNS(o,r)})(kl,e,t,n):gr(kl,e,t),Za[e]=t)}function Kv(e,t,n){n!==Za[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),Za[t]=n)}function Lu(e,t){for(let n in t)gr(e,n,t[n])}function gr(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function YT(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}function sk(e){Cs.call(this,e),this._text=null,this._defs={gradient:{},clipping:{}}}Fe(sk,Cs,{svg(){return this._text},_render(e){let t=rk();t.open("svg",mt({},tb,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));let n=this._bgcolor;return n&&n!=="transparent"&&n!=="none"&&t.open("rect",{width:this._width,height:this._height,fill:n}).close(),t.open("g",HT,{transform:"translate("+this._origin+")"}),this.mark(t,e),t.close(),this.defs(t),this._text=t.close()+"",this},mark(e,t){let n=yi[t.marktype],a=n.tag,r=[PT,n.attr];e.open("g",{class:kT(t),"clip-path":t.clip?Zg(this,t,t.group):null},$T(t),{"pointer-events":a!=="g"&&t.interactive===!1?"none":null});let i=o=>{let u=this.href(o);if(u&&e.open("a",u),e.open(a,this.attr(t,o,r,a!=="g"?a:null)),a==="text"){let c=nb(o);if(Ee(c)){let f={x:0,dy:Iu(o)};for(let m=0;m<c.length;++m)e.open("tspan",m?f:null).text(Ou(o,c[m])).close()}else e.text(Ou(o,c))}else if(a==="g"){let c=o.strokeForeground,f=o.fill,m=o.stroke;c&&m&&(o.stroke=null),e.open("path",this.attr(t,o,n.background,"bgrect")).close(),e.open("g",this.attr(t,o,n.content)),Po(o,(g=>this.mark(e,g))),e.close(),c&&m?(f&&(o.fill=null),o.stroke=m,e.open("path",this.attr(t,o,n.foreground,"bgrect")).close(),f&&(o.fill=f)):e.open("path",this.attr(t,o,n.foreground,"bgfore")).close()}e.close(),u&&e.close()};return n.nested?t.items&&t.items.length&&i(t.items[0]):Po(t,i),e.close()},href(e){let t=e.href,n;if(t){if(n=this._hrefs&&this._hrefs[t])return n;this.sanitizeURL(t).then((a=>{a["xlink:href"]=a.href,a.href=null,(this._hrefs||(this._hrefs={}))[t]=a}))}return null},attr(e,t,n,a){let r={},i=(o,u,c,f)=>{r[f||o]=u};return Array.isArray(n)?n.forEach((o=>o(i,t,this))):n(i,t,this),a&&(function(o,u,c,f,m){let g;if(u==null||(f==="bgrect"&&c.interactive===!1&&(o["pointer-events"]="none"),f==="bgfore"&&(c.interactive===!1&&(o["pointer-events"]="none"),o.display="none",u.fill!==null)))return o;f==="image"&&u.smooth===!1&&(g=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),f==="text"&&(o["font-family"]=ab(u),o["font-size"]=Ts(u)+"px",o["font-style"]=u.fontStyle,o["font-variant"]=u.fontVariant,o["font-weight"]=u.fontWeight);for(let v in Vv){let E=u[v],k=Vv[v];(E!=="transparent"||k!=="fill"&&k!=="stroke")&&E!=null&&(Re(E)&&(E=Pe(E,m.gradient,"")),o[k]=E)}for(let v in Yv){let E=u[v];E!=null&&(g=g||[],g.push(`${Yv[v]}: ${E};`))}g&&(o.style=g.join(" "))})(r,t,e,a,this._defs),r},defs(e){let t=this._defs.gradient,n=this._defs.clipping;if(Object.keys(t).length+Object.keys(n).length!==0){e.open("defs");for(let a in t){let r=t[a],i=r.stops;r.gradient==="radial"?(e.open("pattern",{id:Ae+a,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),e.open("rect",{width:"1",height:"1",fill:"url(#"+a+")"}).close(),e.close(),e.open("radialGradient",{id:a,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):e.open("linearGradient",{id:a,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let o=0;o<i.length;++o)e.open("stop",{offset:i[o].offset,"stop-color":i[o].color}).close();e.close()}for(let a in n){let r=n[a];e.open("clipPath",{id:a}),r.path?e.open("path",{d:r.path}).close():e.open("rect",{x:0,y:0,width:r.width,height:r.height}).close(),e.close()}e.close()}}});let KT="canvas",XT="none",Fu={Canvas:KT,PNG:"png",SVG:"svg",None:XT},Fp={};function Xv(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(Fp[e]=t,this):Fp[e]}function ZT(e,t,n){let a=[],r=new In().union(t),i=e.marktype;return i?JT(e,r,n,a):i==="group"?QT(e,r,n,a):F("Intersect scene must be mark node or group item.")}function JT(e,t,n,a){if((function(r,i,o){return r.bounds&&i.intersects(r.bounds)&&(r.marktype==="group"||r.interactive!==!1&&(!o||o(r)))})(e,t,n)){let r=e.items,i=e.marktype,o=r.length,u=0;if(i==="group")for(;u<o;++u)QT(r[u],t,n,a);else for(let c=yi[i].isect;u<o;++u){let f=r[u];eC(f,t,c)&&a.push(f)}}return a}function QT(e,t,n,a){n&&n(e.mark)&&eC(e,t,yi.group.isect)&&a.push(e);let r=e.items,i=r&&r.length;if(i){let o=e.x||0,u=e.y||0;t.translate(-o,-u);for(let c=0;c<i;++c)JT(r[c],t,n,a);t.translate(o,u)}return a}function eC(e,t,n){let a=e.bounds;return t.encloses(a)||t.intersects(a)&&n(e,t)}Fp[KT]=Fp.png={renderer:Wv,headless:Wv,handler:sb},Fp.svg={renderer:ik,headless:sk,handler:J1},Fp[XT]={};let lk=new In;function tC(e){let t=e.clip;if(tt(t))t(Jg(lk.clear()));else{if(!t)return;lk.set(0,0,e.group.width,e.group.height)}e.bounds.intersect(lk)}let wL=1e-9;function uk(e,t,n){return e===t||(n==="path"?nC(e,t):e instanceof Date&&t instanceof Date?+e==+t:Ba(e)&&Ba(t)?Math.abs(e-t)<=wL:e&&t&&(ye(e)||ye(t))?(function(a,r){var i,o,u=Object.keys(a),c=Object.keys(r);if(u.length!==c.length)return!1;for(u.sort(),c.sort(),o=u.length-1;o>=0;o--)if(u[o]!=c[o])return!1;for(o=u.length-1;o>=0;o--)if(!uk(a[i=u[o]],r[i],i))return!1;return typeof a==typeof r})(e,t):e==t)}function nC(e,t){return uk(Ut(e),Ut(t))}let Pp="top",Uo="left",zo="right",Pu="bottom",_L="top-left",kL="top-right",SL="bottom-left",xL="bottom-right",ck="start",dk="middle",br="end",AL="x",TL="y",Zv="group",fk="axis",pk="title",CL="frame",RL="scope",hk="legend",aC="row-header",rC="row-footer",iC="row-title",oC="column-header",sC="column-footer",lC="column-title",NL="padding",IL="symbol",uC="fit",cC="fit-x",dC="fit-y",OL="pad",mk="none",Jv="all",gk="each",bk="flush",$u="column",Bu="row";function fC(e){Se.call(this,null,e)}function Qv(e,t,n){return t(e.bounds.clear(),e,n)}Fe(fC,Se,{transform(e,t){let n=t.dataflow,a=e.mark,r=a.marktype,i=yi[r],o=i.bound,u,c=a.bounds;if(i.nested)a.items.length&&n.dirty(a.items[0]),c=Qv(a,o),a.items.forEach((f=>{f.bounds.clear().union(c)}));else if(r===Zv||e.modified())switch(t.visit(t.MOD,(f=>n.dirty(f))),c.clear(),a.items.forEach((f=>c.union(Qv(f,o)))),a.role){case fk:case hk:case pk:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,(f=>{c.union(Qv(f,o))})),t.visit(t.MOD,(f=>{u=u||c.alignsWith(f.bounds),n.dirty(f),c.union(Qv(f,o))})),u&&(c.clear(),a.items.forEach((f=>c.union(f.bounds))));return tC(a),t.modifies("bounds")}});let pC=":vega_identifier:";function yk(e){Se.call(this,0,e)}function hC(e){Se.call(this,null,e)}function mC(e){Se.call(this,null,e)}yk.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},Fe(yk,Se,{transform(e,t){let n=(r=t.dataflow)._signals[pC]||(r._signals[pC]=r.add(0)),a=e.as;var r;let i=n.value;return t.visit(t.ADD,(o=>o[a]=o[a]||++i)),n.set(this.value=i),t}}),Fe(hC,Se,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,(function(r){let i=r.groups,o=r.parent;return i&&i.size===1?i.get(Object.keys(i.object)[0]):i&&o?i.lookup(o):null})(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);let a=n.marktype===Zv?vl:Lo;return t.visit(t.ADD,(r=>a.call(r,n))),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});let gC={parity:e=>e.filter(((t,n)=>n%2?t.opacity=0:1)),greedy:(e,t)=>{let n;return e.filter(((a,r)=>r&&bC(n.bounds,a.bounds,t)?a.opacity=0:(n=a,1)))}},bC=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),yC=(e,t)=>{for(var n,a=1,r=e.length,i=e[0].bounds;a<r;i=n,++a)if(bC(i,n=e[a].bounds,t))return!0},DL=e=>{let t=e.bounds;return t.width()>1&&t.height()>1},vC=e=>(e.forEach((t=>t.opacity=1)),e),EC=(e,t)=>e.reflow(t.modified()).modifies("opacity");function wC(e){Se.call(this,null,e)}Fe(mC,Se,{transform(e,t){let n=gC[e.method]||gC.parity,a=e.separation||0,r,i,o=t.materialize(t.SOURCE).source;if(!o||!o.length)return;if(!e.method)return e.modified("method")&&(vC(o),t=EC(t,e)),t;if(o=o.filter(DL),!o.length)return;if(e.sort&&(o=o.slice().sort(e.sort)),r=vC(o),t=EC(t,e),r.length>=3&&yC(r,a)){do r=n(r,a);while(r.length>=3&&yC(r,a));r.length<3&&!$e(o).opacity&&(r.length>1&&($e(r).opacity=0),$e(o).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(i=((c,f,m)=>{var g=c.range(),v=new In;return f===Pp||f===Pu?v.set(g[0],-1/0,g[1],1/0):v.set(-1/0,g[0],1/0,g[1]),v.expand(m||1),E=>v.encloses(E.bounds)})(e.boundScale,e.boundOrient,+e.boundTolerance),o.forEach((c=>{i(c)||(c.opacity=0)})));let u=r[0].mark.bounds.clear();return o.forEach((c=>{c.opacity&&u.union(c.bounds)})),t}}),Fe(wC,Se,{transform(e,t){let n=t.dataflow;if(t.visit(t.ALL,(a=>n.dirty(a))),t.fields&&t.fields.zindex){let a=t.source&&t.source[0];a&&(a.mark.zdirty=!0)}}});let Ja=new In;function $p(e,t,n){return e[t]===n?0:(e[t]=n,1)}function ML(e){var t=e.items[0].orient;return t===Uo||t===zo}function LL(e,t,n,a){var r,i,o=t.items[0],u=o.datum,c=o.translate!=null?o.translate:.5,f=o.orient,m=(function(z){let q=+z.grid;return[z.ticks?q++:-1,z.labels?q++:-1,q+ +z.domain]})(u),g=o.range,v=o.offset,E=o.position,k=o.minExtent,_=o.maxExtent,N=u.title&&o.items[m[2]].items[0],O=o.titlePadding,I=o.bounds,B=N&&j1(N),M=0,U=0;switch(Ja.clear().union(I),I.clear(),(r=m[0])>-1&&I.union(o.items[r].bounds),(r=m[1])>-1&&I.union(o.items[r].bounds),f){case Pp:M=E||0,U=-v,i=Math.max(k,Math.min(_,-I.y1)),I.add(0,-i).add(g,0),N&&eE(e,N,i,O,B,0,-1,I);break;case Uo:M=-v,U=E||0,i=Math.max(k,Math.min(_,-I.x1)),I.add(-i,0).add(0,g),N&&eE(e,N,i,O,B,1,-1,I);break;case zo:M=n+v,U=E||0,i=Math.max(k,Math.min(_,I.x2)),I.add(0,0).add(i,g),N&&eE(e,N,i,O,B,1,1,I);break;case Pu:M=E||0,U=a+v,i=Math.max(k,Math.min(_,I.y2)),I.add(0,0).add(g,i),N&&eE(e,N,i,O,0,0,1,I);break;default:M=o.x,U=o.y}return _l(I.translate(M,U),o),$p(o,"x",M+c)|$p(o,"y",U+c)&&(o.bounds=Ja,e.dirty(o),o.bounds=I,e.dirty(o)),o.mark.bounds.clear().union(I)}function eE(e,t,n,a,r,i,o,u){let c=t.bounds;if(t.auto){let f=o*(n+r+a),m=0,g=0;e.dirty(t),i?m=(t.x||0)-(t.x=f):g=(t.y||0)-(t.y=f),t.mark.bounds.clear().union(c.translate(-m,-g)),e.dirty(t)}u.union(c)}let _C=(e,t)=>Math.floor(Math.min(e,t)),kC=(e,t)=>Math.ceil(Math.max(e,t));function FL(e){return new In().set(0,0,e.width||0,e.height||0)}function PL(e){let t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function kn(e,t,n){let a=ye(e)?e[t]:e;return a??(n!==void 0?n:0)}function SC(e){return e<0?Math.ceil(-e):0}function xC(e,t,n){var a,r,i,o,u,c,f,m,g,v,E,k=!n.nodirty,_=n.bounds===bk?FL:PL,N=Ja.set(0,0,0,0),O=kn(n.align,$u),I=kn(n.align,Bu),B=kn(n.padding,$u),M=kn(n.padding,Bu),U=n.columns||t.length,z=U<=0?1:Math.ceil(t.length/U),q=t.length,Y=Array(q),K=Array(U),re=0,Q=Array(q),ie=Array(z),se=0,ue=Array(q),fe=Array(q),ve=Array(q);for(r=0;r<U;++r)K[r]=0;for(r=0;r<z;++r)ie[r]=0;for(r=0;r<q;++r)c=t[r],u=ve[r]=_(c),c.x=c.x||0,ue[r]=0,c.y=c.y||0,fe[r]=0,i=r%U,o=~~(r/U),re=Math.max(re,f=Math.ceil(u.x2)),se=Math.max(se,m=Math.ceil(u.y2)),K[i]=Math.max(K[i],f),ie[o]=Math.max(ie[o],m),Y[r]=B+SC(u.x1),Q[r]=M+SC(u.y1),k&&e.dirty(t[r]);for(r=0;r<q;++r)r%U==0&&(Y[r]=0),r<U&&(Q[r]=0);if(O===gk)for(i=1;i<U;++i){for(E=0,r=i;r<q;r+=U)E<Y[r]&&(E=Y[r]);for(r=i;r<q;r+=U)Y[r]=E+K[i-1]}else if(O===Jv){for(E=0,r=0;r<q;++r)r%U&&E<Y[r]&&(E=Y[r]);for(r=0;r<q;++r)r%U&&(Y[r]=E+re)}else for(O=!1,i=1;i<U;++i)for(r=i;r<q;r+=U)Y[r]+=K[i-1];if(I===gk)for(o=1;o<z;++o){for(E=0,a=(r=o*U)+U;r<a;++r)E<Q[r]&&(E=Q[r]);for(r=o*U;r<a;++r)Q[r]=E+ie[o-1]}else if(I===Jv){for(E=0,r=U;r<q;++r)E<Q[r]&&(E=Q[r]);for(r=U;r<q;++r)Q[r]=E+se}else for(I=!1,o=1;o<z;++o)for(a=(r=o*U)+U;r<a;++r)Q[r]+=ie[o-1];for(g=0,r=0;r<q;++r)g=Y[r]+(r%U?g:0),ue[r]+=g-t[r].x;for(i=0;i<U;++i)for(v=0,r=i;r<q;r+=U)v+=Q[r],fe[r]+=v-t[r].y;if(O&&kn(n.center,$u)&&z>1)for(r=0;r<q;++r)(g=(u=O===Jv?re:K[r%U])-ve[r].x2-t[r].x-ue[r])>0&&(ue[r]+=g/2);if(I&&kn(n.center,Bu)&&U!==1)for(r=0;r<q;++r)(v=(u=I===Jv?se:ie[~~(r/U)])-ve[r].y2-t[r].y-fe[r])>0&&(fe[r]+=v/2);for(r=0;r<q;++r)N.union(ve[r].translate(ue[r],fe[r]));switch(g=kn(n.anchor,AL),v=kn(n.anchor,TL),kn(n.anchor,$u)){case br:g-=N.width();break;case dk:g-=N.width()/2}switch(kn(n.anchor,Bu)){case br:v-=N.height();break;case dk:v-=N.height()/2}for(g=Math.round(g),v=Math.round(v),N.clear(),r=0;r<q;++r)t[r].mark.bounds.clear();for(r=0;r<q;++r)(c=t[r]).x+=ue[r]+=g,c.y+=fe[r]+=v,N.union(c.mark.bounds.union(c.bounds.translate(ue[r],fe[r]))),k&&e.dirty(c);return N}function $L(e,t,n){var a,r,i,o,u,c,f,m=(function(I){var B,M,U=I.items,z=U.length,q=0;let Y={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;q<z;++q)if(M=(B=U[q]).items,B.marktype===Zv)switch(B.role){case fk:case hk:case pk:break;case aC:Y.rowheaders.push(...M);break;case rC:Y.rowfooters.push(...M);break;case oC:Y.colheaders.push(...M);break;case sC:Y.colfooters.push(...M);break;case iC:Y.rowtitle=M[0];break;case lC:Y.coltitle=M[0];break;default:Y.marks.push(...M)}return Y})(t),g=m.marks,v=n.bounds===bk?BL:UL,E=n.offset,k=n.columns||g.length,_=k<=0?1:Math.ceil(g.length/k),N=_*k;let O=xC(e,g,n);O.empty()&&O.set(0,0,0,0),m.rowheaders&&(c=kn(n.headerBand,Bu,null),a=tE(e,m.rowheaders,g,k,_,-kn(E,"rowHeader"),_C,0,v,"x1",0,k,1,c)),m.colheaders&&(c=kn(n.headerBand,$u,null),r=tE(e,m.colheaders,g,k,k,-kn(E,"columnHeader"),_C,1,v,"y1",0,1,k,c)),m.rowfooters&&(c=kn(n.footerBand,Bu,null),i=tE(e,m.rowfooters,g,k,_,kn(E,"rowFooter"),kC,0,v,"x2",k-1,k,1,c)),m.colfooters&&(c=kn(n.footerBand,$u,null),o=tE(e,m.colfooters,g,k,k,kn(E,"columnFooter"),kC,1,v,"y2",N-k,1,k,c)),m.rowtitle&&(u=kn(n.titleAnchor,Bu),f=kn(E,"rowTitle"),f=u===br?i+f:a-f,c=kn(n.titleBand,Bu,.5),AC(e,m.rowtitle,f,0,O,c)),m.coltitle&&(u=kn(n.titleAnchor,$u),f=kn(E,"columnTitle"),f=u===br?o+f:r-f,c=kn(n.titleBand,$u,.5),AC(e,m.coltitle,f,1,O,c))}function BL(e,t){return t==="x1"?e.x||0:t==="y1"?e.y||0:t==="x2"?(e.x||0)+(e.width||0):t==="y2"?(e.y||0)+(e.height||0):void 0}function UL(e,t){return e.bounds[t]}function tE(e,t,n,a,r,i,o,u,c,f,m,g,v,E){var k,_,N,O,I,B,M,U,z,q=n.length,Y=0,K=0;if(!q)return Y;for(k=m;k<q;k+=g)n[k]&&(Y=o(Y,c(n[k],f)));if(!t.length)return Y;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),Y+=i,_=0,O=t.length;_<O;++_)e.dirty(t[_]),t[_].mark.bounds.clear();for(k=m,_=0,O=t.length;_<O;++_,k+=g){for(I=(B=t[_]).mark.bounds,N=k;N>=0&&(M=n[N])==null;N-=v);u?(U=E==null?M.x:Math.round(M.bounds.x1+E*M.bounds.width()),z=Y):(U=Y,z=E==null?M.y:Math.round(M.bounds.y1+E*M.bounds.height())),I.union(B.bounds.translate(U-(B.x||0),z-(B.y||0))),B.x=U,B.y=z,e.dirty(B),K=o(K,I[f])}return K}function AC(e,t,n,a,r,i){if(t){e.dirty(t);var o=n,u=n;a?o=Math.round(r.x1+i*r.width()):u=Math.round(r.y1+i*r.height()),t.bounds.translate(o-(t.x||0),u-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=o,t.y=u,e.dirty(t)}}function zL(e,t,n,a,r,i,o){let u=(function(v,E){let k=v[E]||{};return(_,N)=>k[_]!=null?k[_]:v[_]!=null?v[_]:N})(n,t),c=(function(v,E){let k=-1/0;return v.forEach((_=>{_.offset!=null&&(k=Math.max(k,_.offset))})),k>-1/0?k:E})(e,u("offset",0)),f=u("anchor",ck),m=f===br?1:f===dk?.5:0,g={align:gk,bounds:u("bounds",bk),columns:u("direction")==="vertical"?1:e.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(t){case Uo:g.anchor={x:Math.floor(a.x1)-c,column:br,y:m*(o||a.height()+2*a.y1),row:f};break;case zo:g.anchor={x:Math.ceil(a.x2)+c,y:m*(o||a.height()+2*a.y1),row:f};break;case Pp:g.anchor={y:Math.floor(r.y1)-c,row:br,x:m*(i||r.width()+2*r.x1),column:f};break;case Pu:g.anchor={y:Math.ceil(r.y2)+c,x:m*(i||r.width()+2*r.x1),column:f};break;case _L:g.anchor={x:c,y:c};break;case kL:g.anchor={x:i-c,y:c,column:br};break;case SL:g.anchor={x:c,y:o-c,row:br};break;case xL:g.anchor={x:i-c,y:o-c,column:br,row:br}}return g}function GL(e,t){var n,a,r=t.items[0],i=r.datum,o=r.orient,u=r.bounds,c=r.x,f=r.y;return r._bounds?r._bounds.clear().union(u):r._bounds=u.clone(),u.clear(),(function(m,g,v){var E=g.padding,k=E-v.x,_=E-v.y;if(g.datum.title){var N=g.items[1].items[0],O=N.anchor,I=g.titlePadding||0,B=E-N.x,M=E-N.y;switch(N.orient){case Uo:k+=Math.ceil(N.bounds.width())+I;break;case zo:case Pu:break;default:_+=N.bounds.height()+I}switch((k||_)&&ub(m,v,k,_),N.orient){case Uo:M+=Bp(g,v,N,O,1,1);break;case zo:B+=Bp(g,v,N,br,0,0)+I,M+=Bp(g,v,N,O,1,1);break;case Pu:B+=Bp(g,v,N,O,0,0),M+=Bp(g,v,N,br,-1,0,1)+I;break;default:B+=Bp(g,v,N,O,0,0)}(B||M)&&ub(m,N,B,M),(B=Math.round(N.bounds.x1-E))<0&&(ub(m,v,-B,0),ub(m,N,-B,0))}else(k||_)&&ub(m,v,k,_)})(e,r,r.items[0].items[0]),u=(function(m,g){return m.items.forEach((v=>g.union(v.bounds))),g.x1=m.padding,g.y1=m.padding,g})(r,u),n=2*r.padding,a=2*r.padding,u.empty()||(n=Math.ceil(u.width()+n),a=Math.ceil(u.height()+a)),i.type===IL&&(function(m){let g=m.reduce(((v,E)=>(v[E.column]=Math.max(E.bounds.x2-E.x,v[E.column]||0),v)),{});m.forEach((v=>{v.width=g[v.column],v.height=v.bounds.y2-v.y}))})(r.items[0].items[0].items[0].items),o!==mk&&(r.x=c=0,r.y=f=0),r.width=n,r.height=a,_l(u.set(c,f,c+n,f+a),r),r.mark.bounds.clear().union(u),r}function Bp(e,t,n,a,r,i,o){let u=e.datum.type!=="symbol",c=n.datum.vgrad,f=(!u||!i&&c||o?t:t.items[0]).bounds[r?"y2":"x2"]-e.padding,m=c&&i?f:0,g=c&&i?0:f,v=r<=0?0:j1(n);return Math.round(a===ck?m:a===br?g-v:.5*(f-v))}function ub(e,t,n,a){t.x+=n,t.y+=a,t.bounds.translate(n,a),t.mark.bounds.translate(n,a),e.dirty(t)}function TC(e){Se.call(this,null,e)}Fe(TC,Se,{transform(e,t){let n=t.dataflow;return e.mark.items.forEach((a=>{e.layout&&$L(n,a,e.layout),(function(r,i,o){var u,c,f,m,g,v=i.items,E=Math.max(0,i.width||0),k=Math.max(0,i.height||0),_=new In().set(0,0,E,k),N=_.clone(),O=_.clone(),I=[];for(m=0,g=v.length;m<g;++m)switch((c=v[m]).role){case fk:(ML(c)?N:O).union(LL(r,c,E,k));break;case pk:u=c;break;case hk:I.push(GL(r,c));break;case CL:case RL:case aC:case rC:case iC:case oC:case sC:case lC:N.union(c.bounds),O.union(c.bounds);break;default:_.union(c.bounds)}if(I.length){let B={};I.forEach((M=>{(f=M.orient||zo)!==mk&&(B[f]||(B[f]=[])).push(M)}));for(let M in B){let U=B[M];xC(r,U,zL(U,M,o.legends,N,O,E,k))}I.forEach((M=>{let U=M.bounds;if(U.equals(M._bounds)||(M.bounds=M._bounds,r.dirty(M),M.bounds=U,r.dirty(M)),!o.autosize||o.autosize.type!==uC&&o.autosize.type!==cC&&o.autosize.type!==dC)_.union(U);else switch(M.orient){case Uo:case zo:_.add(U.x1,0).add(U.x2,0);break;case Pp:case Pu:_.add(0,U.y1).add(0,U.y2)}}))}_.union(N).union(O),u&&_.union((function(B,M,U,z,q){var Y,K=M.items[0],re=K.frame,Q=K.orient,ie=K.anchor,se=K.offset,ue=K.padding,fe=K.items[0].items[0],ve=K.items[1]&&K.items[1].items[0],we=Q===Uo||Q===zo?z:U,Oe=0,Ue=0,He=0,De=0,ut=0;if(re!==Zv?Q===Uo?(Oe=q.y2,we=q.y1):Q===zo?(Oe=q.y1,we=q.y2):(Oe=q.x1,we=q.x2):Q===Uo&&(Oe=z,we=0),Y=ie===ck?Oe:ie===br?we:(Oe+we)/2,ve&&ve.text){switch(Q){case Pp:case Pu:ut=fe.bounds.height()+ue;break;case Uo:De=fe.bounds.width()+ue;break;case zo:De=-fe.bounds.width()-ue}Ja.clear().union(ve.bounds),Ja.translate(De-(ve.x||0),ut-(ve.y||0)),$p(ve,"x",De)|$p(ve,"y",ut)&&(B.dirty(ve),ve.bounds.clear().union(Ja),ve.mark.bounds.clear().union(Ja),B.dirty(ve)),Ja.clear().union(ve.bounds)}else Ja.clear();switch(Ja.union(fe.bounds),Q){case Pp:Ue=Y,He=q.y1-Ja.height()-se;break;case Uo:Ue=q.x1-Ja.width()-se,He=Y;break;case zo:Ue=q.x2+Ja.width()+se,He=Y;break;case Pu:Ue=Y,He=q.y2+se;break;default:Ue=K.x,He=K.y}return $p(K,"x",Ue)|$p(K,"y",He)&&(Ja.translate(Ue,He),B.dirty(K),K.bounds.clear().union(Ja),M.bounds.clear().union(Ja),B.dirty(K)),K.bounds})(r,u,E,k,_)),i.clip&&_.set(0,0,i.width||0,i.height||0),(function(B,M,U,z){let q=z.autosize||{},Y=q.type;if(B._autosize<1||!Y)return;let K=B._width,re=B._height,Q=Math.max(0,M.width||0),ie=Math.max(0,Math.ceil(-U.x1)),se=Math.max(0,M.height||0),ue=Math.max(0,Math.ceil(-U.y1)),fe=Math.max(0,Math.ceil(U.x2-Q)),ve=Math.max(0,Math.ceil(U.y2-se));if(q.contains===NL){let we=B.padding();K-=we.left+we.right,re-=we.top+we.bottom}Y===mk?(ie=0,ue=0,Q=K,se=re):Y===uC?(Q=Math.max(0,K-ie-fe),se=Math.max(0,re-ue-ve)):Y===cC?(Q=Math.max(0,K-ie-fe),re=se+ue+ve):Y===dC?(K=Q+ie+fe,se=Math.max(0,re-ue-ve)):Y===OL&&(K=Q+ie+fe,re=se+ue+ve),B._resizeView(K,re,Q,se,[ie,ue],q.resize)})(r,i,_,o)})(n,a,e)})),(function(a){return a&&a.mark.role!=="legend-entry"})(e.mark.group)?t.reflow():t}});var jL=Object.freeze({__proto__:null,bound:fC,identifier:yk,mark:hC,overlap:mC,render:wC,viewlayout:TC});function CC(e){Se.call(this,null,e)}function RC(e){Se.call(this,null,e)}function HL(){return It({})}function NC(e){Se.call(this,null,e)}function IC(e){Se.call(this,[],e)}Fe(CC,Se,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),a=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,i=e.scale,o=d(i,e.count==null?e.values?e.values.length:10:e.count,e.minstep),u=e.format||w(n,i,o,e.formatSpecifier,e.formatType,!!e.values),c=e.values?h(i,e.values,o):y(i,o);return r&&(a.rem=r),r=c.map(((f,m)=>It({index:m/(c.length-1||1),value:f,label:u(f)}))),e.extra&&r.length&&r.push(It({index:-1,extra:{value:r[0].value},label:""})),a.source=r,a.add=r,this.value=r,a}}),Fe(RC,Se,{transform(e,t){var n=t.dataflow,a=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||HL,i=e.key||rt,o=this.value;return Ee(a.encode)&&(a.encode=null),o&&(e.modified("key")||t.modified(i))&&F("DataJoin does not support modified key function or fields."),o||(t=t.addAll(),this.value=o=(function(u){let c=da().test((f=>f.exit));return c.lookup=f=>c.get(u(f)),c})(i)),t.visit(t.ADD,(u=>{let c=i(u),f=o.get(c);f?f.exit?(o.empty--,a.add.push(f)):a.mod.push(f):(f=r(u),o.set(c,f),a.add.push(f)),f.datum=u,f.exit=!1})),t.visit(t.MOD,(u=>{let c=i(u),f=o.get(c);f&&(f.datum=u,a.mod.push(f))})),t.visit(t.REM,(u=>{let c=i(u),f=o.get(c);u!==f.datum||f.exit||(a.rem.push(f),f.exit=!0,++o.empty)})),t.changed(t.ADD_MOD)&&a.modifies("datum"),(t.clean()||e.clean&&o.empty>n.cleanThreshold)&&n.runAfter(o.clean),a}}),Fe(NC,Se,{transform(e,t){var n=t.fork(t.ADD_REM),a=e.mod||!1,r=e.encoders,i=t.encode;if(Ee(i)){if(!n.changed()&&!i.every((g=>r[g])))return t.StopPropagation;i=i[0],n.encode=null}var o=i==="enter",u=r.update||ae,c=r.enter||ae,f=r.exit||ae,m=(i&&!o?r[i]:u)||ae;if(t.changed(t.ADD)&&(t.visit(t.ADD,(g=>{c(g,e),u(g,e)})),n.modifies(c.output),n.modifies(u.output),m!==ae&&m!==u&&(t.visit(t.ADD,(g=>{m(g,e)})),n.modifies(m.output))),t.changed(t.REM)&&f!==ae&&(t.visit(t.REM,(g=>{f(g,e)})),n.modifies(f.output)),o||m!==ae){let g=t.MOD|(e.modified()?t.REFLOW:0);o?(t.visit(g,(v=>{let E=c(v,e)||a;(m(v,e)||E)&&n.mod.push(v)})),n.mod.length&&n.modifies(c.output)):t.visit(g,(v=>{(m(v,e)||a)&&n.mod.push(v)})),n.mod.length&&n.modifies(m.output)}return n.changed()?n:t.StopPropagation}}),Fe(IC,Se,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n,a,r,i,o,u=t.dataflow.locale(),c=t.fork(t.NO_SOURCE|t.NO_FIELDS),f=this.value,m=e.type||Au,g=e.scale,v=+e.limit,E=d(g,e.count==null?5:e.count,e.minstep),k=!!e.values||m===Au,_=e.format||H(u,g,E,m,e.formatSpecifier,e.formatType,k),N=e.values||L(g,E);return f&&(c.rem=f),m===Au?(v&&N.length>v?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),f=N.slice(0,v-1),o=!0):f=N,tt(r=e.size)?(e.values||g(f[0])!==0||(f=f.slice(1)),i=f.reduce(((O,I)=>Math.max(O,r(I,e))),0)):r=mn(i=r||8),f=f.map(((O,I)=>It({index:I,label:_(O,I,f),value:O,offset:i,size:r(O,e)}))),o&&(o=N[f.length],f.push(It({index:f.length,label:`\u2026${N.length-f.length} entries`,value:o,offset:i,size:r(o,e)})))):m==="gradient"?(n=g.domain(),a=od(g,n[0],$e(n)),N.length<3&&!e.values&&n[0]!==$e(n)&&(N=[n[0],$e(n)]),f=N.map(((O,I)=>It({index:I,label:_(O,I,N),value:O,perc:a(O)})))):(r=N.length-1,a=(function(O){let I=O.domain(),B=I.length-1,M=+I[0],U=+$e(I),z=U-M;if(O.type===ml){let q=B?z/B:.1;M-=q,U+=q,z=U-M}return q=>(q-M)/z})(g),f=N.map(((O,I)=>It({index:I,label:_(O,I,N),value:O,perc:I?a(O):0,perc2:I===r?1:a(N[I+1])})))),c.source=f,c.add=f,this.value=f,c}});let qL=e=>e.source.x,WL=e=>e.source.y,VL=e=>e.target.x,YL=e=>e.target.y;function vk(e){Se.call(this,{},e)}vk.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"}]},Fe(vk,Se,{transform(e,t){var n=e.sourceX||qL,a=e.sourceY||WL,r=e.targetX||VL,i=e.targetY||YL,o=e.as||"path",u=e.orient||"vertical",c=e.shape||"line",f=LC.get(c+"-"+u)||LC.get(c);return f||F("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(m=>{m[o]=f(n(m),a(m),r(m),i(m))})),t.reflow(e.modified()).modifies(o)}});let OC=(e,t,n,a)=>"M"+e+","+t+"L"+n+","+a,DC=(e,t,n,a)=>{var r=n-e,i=a-t,o=Math.hypot(r,i)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(i,r)/Math.PI+" 0 1 "+n+","+a},MC=(e,t,n,a)=>{let r=n-e,i=a-t,o=.2*(r+i),u=.2*(i-r);return"M"+e+","+t+"C"+(e+o)+","+(t+u)+" "+(n+u)+","+(a-o)+" "+n+","+a},LC=da({line:OC,"line-radial":(e,t,n,a)=>OC(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),arc:DC,"arc-radial":(e,t,n,a)=>DC(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),curve:MC,"curve-radial":(e,t,n,a)=>MC(t*Math.cos(e),t*Math.sin(e),a*Math.cos(n),a*Math.sin(n)),"orthogonal-horizontal":(e,t,n,a)=>"M"+e+","+t+"V"+a+"H"+n,"orthogonal-vertical":(e,t,n,a)=>"M"+e+","+t+"H"+n+"V"+a,"orthogonal-radial":(e,t,n,a)=>{let r=Math.cos(e),i=Math.sin(e),o=Math.cos(n),u=Math.sin(n);return"M"+t*r+","+t*i+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*u+"L"+a*o+","+a*u},"diagonal-horizontal":(e,t,n,a)=>{let r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+a+" "+n+","+a},"diagonal-vertical":(e,t,n,a)=>{let r=(t+a)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+a},"diagonal-radial":(e,t,n,a)=>{let r=Math.cos(e),i=Math.sin(e),o=Math.cos(n),u=Math.sin(n),c=(t+a)/2;return"M"+t*r+","+t*i+"C"+c*r+","+c*i+" "+c*o+","+c*u+" "+a*o+","+a*u}});function Ek(e){Se.call(this,null,e)}Ek.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"]}]},Fe(Ek,Se,{transform(e,t){var n,a,r,i=e.as||["startAngle","endAngle"],o=i[0],u=i[1],c=e.field||he,f=e.startAngle||0,m=e.endAngle!=null?e.endAngle:2*Math.PI,g=t.source,v=g.map(c),E=v.length,k=f,_=(m-f)/x_(v),N=Qn(E);for(e.sort&&N.sort(((O,I)=>v[O]-v[I])),n=0;n<E;++n)r=v[N[n]],(a=g[N[n]])[o]=k,a[u]=k+=r*_;return this.value=v,t.reflow(e.modified()).modifies(i)}});let KL=5;function FC(e){return Gg(e)&&e!==Ka}let XL=ir(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function PC(e){Se.call(this,null,e),this.modified(!0)}function $C(e,t,n){return Tp(e)&&Math.abs(t.reduce(((a,r)=>a+(r<0?-1:r>0?1:0)),0))!==t.length&&n.warn("Log scale domain includes zero: "+st(t)),t}function BC(e,t,n){return tt(e)&&(t||n)?vv(e,wk(t||[0,1],n)):e}function wk(e,t){return t?e.slice().reverse():e}function UC(e){Se.call(this,null,e)}Fe(PC,Se,{transform(e,t){var n=t.dataflow,a=this.value,r=(function(i){var o,u=i.type,c="";return u===Ka?Ka+"-"+Qi:((function(f){let m=f.type;return Gg(m)&&m!==hr&&m!==to&&(f.scheme||f.range&&f.range.length&&f.range.every(Ft))})(i)&&(c=(o=i.rawDomain?i.rawDomain.length:i.domain?i.domain.length+ +(i.domainMid!=null):0)===2?Ka+"-":o===3?Io+"-":""),(c+u||Qi).toLowerCase())})(e);for(r in a&&r===a.type||(this.value=a=Bt(r)()),e)if(!XL[r]){if(r==="padding"&&FC(a.type))continue;tt(a[r])?a[r](e[r]):n.warn("Unsupported scale property: "+r)}return(function(i,o,u){var c=i.type,f=o.round||!1,m=o.range;if(o.rangeStep!=null)m=(function(g,v,E){g!==mv&&g!==Bg&&F("Only band and point scales support rangeStep.");var k=(v.paddingOuter!=null?v.paddingOuter:v.padding)||0,_=g===Bg?1:(v.paddingInner!=null?v.paddingInner:v.padding)||0;return[0,v.rangeStep*Su(E,_,k)]})(c,o,u);else if(o.scheme&&(m=(function(g,v,E){var k,_=v.schemeExtent;return Ee(v.scheme)?k=Cp(v.scheme,v.interpolate,v.interpolateGamma):(k=Np(v.scheme.toLowerCase()))||F(`Unrecognized scheme name: ${v.scheme}`),E=g===ml?E+1:g===kp?E-1:g===Oo||g===hl?+v.schemeCount||KL:E,bv(g)?BC(k,_,v.reverse):tt(k)?Ev(BC(k,_),E):g===_p?k:k.slice(0,E)})(c,o,u),tt(m))){if(i.interpolator)return i.interpolator(m);F(`Scale type ${c} does not support interpolating color schemes.`)}if(m&&bv(c))return i.interpolator(Cp(wk(m,o.reverse),o.interpolate,o.interpolateGamma));m&&o.interpolate&&i.interpolate?i.interpolate(Hg(o.interpolate,o.interpolateGamma)):tt(i.round)?i.round(f):tt(i.rangeRound)&&i.interpolate(f?Jc:ys),m&&i.range(wk(m,o.reverse))})(a,e,(function(i,o,u){let c=o.bins;if(c&&!Ee(c)){let f=i.domain(),m=f[0],g=$e(f),v=c.step,E=c.start==null?m:c.start,k=c.stop==null?g:c.stop;v||F("Scale bins parameter missing step property."),E<m&&(E=v*Math.ceil(m/v)),k>g&&(k=v*Math.floor(g/v)),c=Qn(E,k+v/2,v)}return c?i.bins=c:i.bins&&delete i.bins,i.type===kp&&(c?o.domain||o.domainRaw||(i.domain(c),u=c.length):i.bins=i.domain()),u})(a,e,(function(i,o,u){let c=(function(k,_,N){return _?(k.domain($C(k.type,_,N)),_.length):-1})(i,o.domainRaw,u);if(c>-1)return c;var f,m,g=o.domain,v=i.type,E=o.zero||o.zero===void 0&&(function(k){let _=k.type;return!k.bins&&(_===Qi||_===_s||_===eo)})(i);if(!g)return 0;if(FC(v)&&o.padding&&g[0]!==$e(g)&&(g=(function(k,_,N,O,I,B){var M=Math.abs($e(N)-N[0]),U=M/(M-2*O),z=k===Pr?wt(_,null,U):k===eo?Jt(_,null,U,.5):k===_s?Jt(_,null,U,I||1):k===ks?Lt(_,null,U,B||1):Zt(_,null,U);return _=_.slice(),_[0]=z[0],_[_.length-1]=z[1],_})(v,g,o.range,o.padding,o.exponent,o.constant)),(E||o.domainMin!=null||o.domainMax!=null||o.domainMid!=null)&&(f=(g=g.slice()).length-1||1,E&&(g[0]>0&&(g[0]=0),g[f]<0&&(g[f]=0)),o.domainMin!=null&&(g[0]=o.domainMin),o.domainMax!=null&&(g[f]=o.domainMax),o.domainMid!=null)){let k=(m=o.domainMid)>g[f]?f+1:m<g[0]?0:f;k!==f&&u.warn("Scale domainMid exceeds domain min or max.",m),g.splice(k,0,m)}return i.domain($C(v,g,u)),v===_p&&i.unknown(o.domainImplicit?ap:void 0),o.nice&&i.nice&&i.nice(o.nice!==!0&&d(i,o.nice)||null),g.length})(a,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),Fe(UC,Se,{transform(e,t){let n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(ls(e.sort)),this.modified(n),t}});let zC="zero",GC="center",jC="normalize",HC=["y0","y1"];function _k(e){Se.call(this,null,e)}function ZL(e,t,n,a,r){for(var i,o=(t-e.sum)/2,u=e.length,c=0;c<u;++c)(i=e[c])[a]=o,i[r]=o+=Math.abs(n(i))}function JL(e,t,n,a,r){for(var i,o=1/e.sum,u=0,c=e.length,f=0,m=0;f<c;++f)(i=e[f])[a]=u,i[r]=u=o*(m+=Math.abs(n(i)))}function QL(e,t,n,a,r){for(var i,o,u=0,c=0,f=e.length,m=0;m<f;++m)(i=+n(o=e[m]))<0?(o[a]=c,o[r]=c+=i):(o[a]=u,o[r]=u+=i)}_k.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:zC,values:[zC,GC,jC]},{name:"as",type:"string",array:!0,length:2,default:HC}]},Fe(_k,Se,{transform(e,t){var n,a,r,i,o=e.as||HC,u=o[0],c=o[1],f=ls(e.sort),m=e.field||he,g=e.offset===GC?ZL:e.offset===jC?JL:QL;for(n=(function(v,E,k,_){var N,O,I,B,M,U,z,q,Y,K=[],re=Q=>Q(M);if(E==null)K.push(v.slice());else for(N={},O=0,I=v.length;O<I;++O)M=v[O],(z=N[U=E.map(re)])||(N[U]=z=[],K.push(z)),z.push(M);for(U=0,Y=0,B=K.length;U<B;++U){for(O=0,q=0,I=(z=K[U]).length;O<I;++O)q+=Math.abs(_(z[O]));z.sum=q,q>Y&&(Y=q),k&&z.sort(k)}return K.max=Y,K})(t.source,e.groupby,f,m),a=0,r=n.length,i=n.max;a<r;++a)g(n[a],i,m,u,c);return t.reflow(e.modified()).modifies(o)}});var eF=Object.freeze({__proto__:null,axisticks:CC,datajoin:RC,encode:NC,legendentries:IC,linkpath:vk,pie:Ek,scale:PC,sortitems:UC,stack:_k}),gt=1e-6,nE=1e-12,Ot=Math.PI,On=Ot/2,aE=Ot/4,yr=2*Ot,Pn=180/Ot,Rt=Ot/180,Mt=Math.abs,Up=Math.atan,ao=Math.atan2,vt=Math.cos,rE=Math.ceil,qC=Math.exp,kk=Math.hypot,iE=Math.log,Sk=Math.pow,ft=Math.sin,ro=Math.sign||function(e){return e>0?1:e<0?-1:0},vr=Math.sqrt,xk=Math.tan;function WC(e){return e>1?0:e<-1?Ot:Math.acos(e)}function zr(e){return e>1?On:e<-1?-On:Math.asin(e)}function Ma(){}function oE(e,t){e&&YC.hasOwnProperty(e.type)&&YC[e.type](e,t)}var VC={Feature:function(e,t){oE(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,a=-1,r=n.length;++a<r;)oE(n[a].geometry,t)}},YC={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,a=-1,r=n.length;++a<r;)e=n[a],t.point(e[0],e[1],e[2])},LineString:function(e,t){Ak(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,a=-1,r=n.length;++a<r;)Ak(n[a],t,0)},Polygon:function(e,t){KC(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,a=-1,r=n.length;++a<r;)KC(n[a],t)},GeometryCollection:function(e,t){for(var n=e.geometries,a=-1,r=n.length;++a<r;)oE(n[a],t)}};function Ak(e,t,n){var a,r=-1,i=e.length-n;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function KC(e,t){var n=-1,a=e.length;for(t.polygonStart();++n<a;)Ak(e[n],t,1);t.polygonEnd()}function Sl(e,t){e&&VC.hasOwnProperty(e.type)?VC[e.type](e,t):oE(e,t)}var XC,ZC,Tk,Ck,Rk,An,Gr,Dn,vi,pd,JC,QC,zp,cb,Uu,xl,sE=new za,lE=new za,Rs={point:Ma,lineStart:Ma,lineEnd:Ma,polygonStart:function(){sE=new za,Rs.lineStart=tF,Rs.lineEnd=nF},polygonEnd:function(){var e=+sE;lE.add(e<0?yr+e:e),this.lineStart=this.lineEnd=this.point=Ma},sphere:function(){lE.add(yr)}};function tF(){Rs.point=aF}function nF(){eR(XC,ZC)}function aF(e,t){Rs.point=eR,XC=e,ZC=t,Tk=e*=Rt,Ck=vt(t=(t*=Rt)/2+aE),Rk=ft(t)}function eR(e,t){var n=(e*=Rt)-Tk,a=n>=0?1:-1,r=a*n,i=vt(t=(t*=Rt)/2+aE),o=ft(t),u=Rk*o,c=Ck*i+u*vt(r),f=u*a*ft(r);sE.add(ao(f,c)),Tk=e,Ck=i,Rk=o}function uE(e){return[ao(e[1],e[0]),zr(e[2])]}function hd(e){var t=e[0],n=e[1],a=vt(n);return[a*vt(t),a*ft(t),ft(n)]}function cE(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Gp(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Nk(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function dE(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function fE(e){var t=vr(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var db,pE,hE,mE,gE,bE,yE,vE,Ik,Ok,Dk,tR,nR,Er,wr,_r,Al={point:Mk,lineStart:rR,lineEnd:iR,polygonStart:function(){Al.point=oR,Al.lineStart=rF,Al.lineEnd=iF,cb=new za,Rs.polygonStart()},polygonEnd:function(){Rs.polygonEnd(),Al.point=Mk,Al.lineStart=rR,Al.lineEnd=iR,sE<0?(An=-(Dn=180),Gr=-(vi=90)):cb>gt?vi=90:cb<-gt&&(Gr=-90),xl[0]=An,xl[1]=Dn},sphere:function(){An=-(Dn=180),Gr=-(vi=90)}};function Mk(e,t){Uu.push(xl=[An=e,Dn=e]),t<Gr&&(Gr=t),t>vi&&(vi=t)}function aR(e,t){var n=hd([e*Rt,t*Rt]);if(zp){var a=Gp(zp,n),r=Gp([a[1],-a[0],0],a);fE(r),r=uE(r);var i,o=e-pd,u=o>0?1:-1,c=r[0]*Pn*u,f=Mt(o)>180;f^(u*pd<c&&c<u*e)?(i=r[1]*Pn)>vi&&(vi=i):f^(u*pd<(c=(c+360)%360-180)&&c<u*e)?(i=-r[1]*Pn)<Gr&&(Gr=i):(t<Gr&&(Gr=t),t>vi&&(vi=t)),f?e<pd?Ei(An,e)>Ei(An,Dn)&&(Dn=e):Ei(e,Dn)>Ei(An,Dn)&&(An=e):Dn>=An?(e<An&&(An=e),e>Dn&&(Dn=e)):e>pd?Ei(An,e)>Ei(An,Dn)&&(Dn=e):Ei(e,Dn)>Ei(An,Dn)&&(An=e)}else Uu.push(xl=[An=e,Dn=e]);t<Gr&&(Gr=t),t>vi&&(vi=t),zp=n,pd=e}function rR(){Al.point=aR}function iR(){xl[0]=An,xl[1]=Dn,Al.point=Mk,zp=null}function oR(e,t){if(zp){var n=e-pd;cb.add(Mt(n)>180?n+(n>0?360:-360):n)}else JC=e,QC=t;Rs.point(e,t),aR(e,t)}function rF(){Rs.lineStart()}function iF(){oR(JC,QC),Rs.lineEnd(),Mt(cb)>gt&&(An=-(Dn=180)),xl[0]=An,xl[1]=Dn,zp=null}function Ei(e,t){return(t-=e)<0?t+360:t}function oF(e,t){return e[0]-t[0]}function sR(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var Go={sphere:Ma,point:Lk,lineStart:lR,lineEnd:uR,polygonStart:function(){Go.lineStart=uF,Go.lineEnd=cF},polygonEnd:function(){Go.lineStart=lR,Go.lineEnd=uR}};function Lk(e,t){e*=Rt;var n=vt(t*=Rt);fb(n*vt(e),n*ft(e),ft(t))}function fb(e,t,n){++db,hE+=(e-hE)/db,mE+=(t-mE)/db,gE+=(n-gE)/db}function lR(){Go.point=sF}function sF(e,t){e*=Rt;var n=vt(t*=Rt);Er=n*vt(e),wr=n*ft(e),_r=ft(t),Go.point=lF,fb(Er,wr,_r)}function lF(e,t){e*=Rt;var n=vt(t*=Rt),a=n*vt(e),r=n*ft(e),i=ft(t),o=ao(vr((o=wr*i-_r*r)*o+(o=_r*a-Er*i)*o+(o=Er*r-wr*a)*o),Er*a+wr*r+_r*i);pE+=o,bE+=o*(Er+(Er=a)),yE+=o*(wr+(wr=r)),vE+=o*(_r+(_r=i)),fb(Er,wr,_r)}function uR(){Go.point=Lk}function uF(){Go.point=dF}function cF(){cR(tR,nR),Go.point=Lk}function dF(e,t){tR=e,nR=t,e*=Rt,t*=Rt,Go.point=cR;var n=vt(t);Er=n*vt(e),wr=n*ft(e),_r=ft(t),fb(Er,wr,_r)}function cR(e,t){e*=Rt;var n=vt(t*=Rt),a=n*vt(e),r=n*ft(e),i=ft(t),o=wr*i-_r*r,u=_r*a-Er*i,c=Er*r-wr*a,f=kk(o,u,c),m=zr(f),g=f&&-m/f;Ik.add(g*o),Ok.add(g*u),Dk.add(g*c),pE+=m,bE+=m*(Er+(Er=a)),yE+=m*(wr+(wr=r)),vE+=m*(_r+(_r=i)),fb(Er,wr,_r)}function Fk(e,t){function n(a,r){return a=e(a,r),t(a[0],a[1])}return e.invert&&t.invert&&(n.invert=function(a,r){return(a=t.invert(a,r))&&e.invert(a[0],a[1])}),n}function Pk(e,t){return Mt(e)>Ot&&(e-=Math.round(e/yr)*yr),[e,t]}function dR(e,t,n){return(e%=yr)?t||n?Fk(pR(e),hR(t,n)):pR(e):t||n?hR(t,n):Pk}function fR(e){return function(t,n){return Mt(t+=e)>Ot&&(t-=Math.round(t/yr)*yr),[t,n]}}function pR(e){var t=fR(e);return t.invert=fR(-e),t}function hR(e,t){var n=vt(e),a=ft(e),r=vt(t),i=ft(t);function o(u,c){var f=vt(c),m=vt(u)*f,g=ft(u)*f,v=ft(c),E=v*n+m*a;return[ao(g*r-E*i,m*n-v*a),zr(E*r+g*i)]}return o.invert=function(u,c){var f=vt(c),m=vt(u)*f,g=ft(u)*f,v=ft(c),E=v*r-g*i;return[ao(g*r+v*i,m*n+E*a),zr(E*n-m*a)]},o}function mR(e,t){(t=hd(t))[0]-=e,fE(t);var n=WC(-t[1]);return((-t[2]<0?-n:n)+yr-gt)%yr}function gR(){var e,t=[];return{point:function(n,a,r){e.push([n,a,r])},lineStart:function(){t.push(e=[])},lineEnd:Ma,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function EE(e,t){return Mt(e[0]-t[0])<gt&&Mt(e[1]-t[1])<gt}function wE(e,t,n,a){this.x=e,this.z=t,this.o=n,this.e=a,this.v=!1,this.n=this.p=null}function bR(e,t,n,a,r){var i,o,u=[],c=[];if(e.forEach((function(k){if(!((_=k.length-1)<=0)){var _,N,O=k[0],I=k[_];if(EE(O,I)){if(!O[2]&&!I[2]){for(r.lineStart(),i=0;i<_;++i)r.point((O=k[i])[0],O[1]);return void r.lineEnd()}I[0]+=2*gt}u.push(N=new wE(O,k,null,!0)),c.push(N.o=new wE(O,null,N,!1)),u.push(N=new wE(I,k,null,!1)),c.push(N.o=new wE(I,null,N,!0))}})),u.length){for(c.sort(t),yR(u),yR(c),i=0,o=c.length;i<o;++i)c[i].e=n=!n;for(var f,m,g=u[0];;){for(var v=g,E=!0;v.v;)if((v=v.n)===g)return;f=v.z,r.lineStart();do{if(v.v=v.o.v=!0,v.e){if(E)for(i=0,o=f.length;i<o;++i)r.point((m=f[i])[0],m[1]);else a(v.x,v.n.x,1,r);v=v.n}else{if(E)for(f=v.p.z,i=f.length-1;i>=0;--i)r.point((m=f[i])[0],m[1]);else a(v.x,v.p.x,-1,r);v=v.p}f=(v=v.o).z,E=!E}while(!v.v);r.lineEnd()}}}function yR(e){if(t=e.length){for(var t,n,a=0,r=e[0];++a<t;)r.n=n=e[a],n.p=r,r=n;r.n=n=e[0],n.p=r}}function $k(e){return Mt(e[0])<=Ot?e[0]:ro(e[0])*((Mt(e[0])+Ot)%yr-Ot)}function vR(e,t,n,a){return function(r){var i,o,u,c=t(r),f=gR(),m=t(f),g=!1,v={point:E,lineStart:_,lineEnd:N,polygonStart:function(){v.point=O,v.lineStart=I,v.lineEnd=B,o=[],i=[]},polygonEnd:function(){v.point=E,v.lineStart=_,v.lineEnd=N,o=Eh(o);var M=(function(U,z){var q=$k(z),Y=z[1],K=ft(Y),re=[ft(q),-vt(q),0],Q=0,ie=0,se=new za;K===1?Y=On+gt:K===-1&&(Y=-On-gt);for(var ue=0,fe=U.length;ue<fe;++ue)if(we=(ve=U[ue]).length)for(var ve,we,Oe=ve[we-1],Ue=$k(Oe),He=Oe[1]/2+aE,De=ft(He),ut=vt(He),ct=0;ct<we;++ct,Ue=Nt,De=Kt,ut=wa,Oe=bt){var bt=ve[ct],Nt=$k(bt),bn=bt[1]/2+aE,Kt=ft(bn),wa=vt(bn),Tn=Nt-Ue,ca=Tn>=0?1:-1,_a=ca*Tn,$n=_a>Ot,nr=De*Kt;if(se.add(ao(nr*ca*ft(_a),ut*wa+nr*vt(_a))),Q+=$n?Tn+ca*yr:Tn,$n^Ue>=q^Nt>=q){var ka=Gp(hd(Oe),hd(bt));fE(ka);var lo=Gp(re,ka);fE(lo);var Vr=($n^Tn>=0?-1:1)*zr(lo[2]);(Y>Vr||Y===Vr&&(ka[0]||ka[1]))&&(ie+=$n^Tn>=0?1:-1)}}return(Q<-gt||Q<gt&&se<-nE)^1&ie})(i,a);o.length?(g||(r.polygonStart(),g=!0),bR(o,pF,M,n,r)):M&&(g||(r.polygonStart(),g=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),g&&(r.polygonEnd(),g=!1),o=i=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function E(M,U){e(M,U)&&r.point(M,U)}function k(M,U){c.point(M,U)}function _(){v.point=k,c.lineStart()}function N(){v.point=E,c.lineEnd()}function O(M,U){u.push([M,U]),m.point(M,U)}function I(){m.lineStart(),u=[]}function B(){O(u[0][0],u[0][1]),m.lineEnd();var M,U,z,q,Y=m.clean(),K=f.result(),re=K.length;if(u.pop(),i.push(u),u=null,re)if(1&Y){if((U=(z=K[0]).length-1)>0){for(g||(r.polygonStart(),g=!0),r.lineStart(),M=0;M<U;++M)r.point((q=z[M])[0],q[1]);r.lineEnd()}}else re>1&&2&Y&&K.push(K.pop().concat(K.shift())),o.push(K.filter(fF))}return v}}function fF(e){return e.length>1}function pF(e,t){return((e=e.x)[0]<0?e[1]-On-gt:On-e[1])-((t=t.x)[0]<0?t[1]-On-gt:On-t[1])}Pk.invert=Pk;var ER=vR((function(){return!0}),(function(e){var t,n=NaN,a=NaN,r=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,o){var u=i>0?Ot:-Ot,c=Mt(i-n);Mt(c-Ot)<gt?(e.point(n,a=(a+o)/2>0?On:-On),e.point(r,a),e.lineEnd(),e.lineStart(),e.point(u,a),e.point(i,a),t=0):r!==u&&c>=Ot&&(Mt(n-r)<gt&&(n-=r*gt),Mt(i-u)<gt&&(i-=u*gt),a=(function(f,m,g,v){var E,k,_=ft(f-g);return Mt(_)>gt?Up((ft(m)*(k=vt(v))*ft(g)-ft(v)*(E=vt(m))*ft(f))/(E*k*_)):(m+v)/2})(n,a,i,o),e.point(r,a),e.lineEnd(),e.lineStart(),e.point(u,a),t=0),e.point(n=i,a=o),r=u},lineEnd:function(){e.lineEnd(),n=a=NaN},clean:function(){return 2-t}}}),(function(e,t,n,a){var r;if(e==null)r=n*On,a.point(-Ot,r),a.point(0,r),a.point(Ot,r),a.point(Ot,0),a.point(Ot,-r),a.point(0,-r),a.point(-Ot,-r),a.point(-Ot,0),a.point(-Ot,r);else if(Mt(e[0]-t[0])>gt){var i=e[0]<t[0]?Ot:-Ot;r=n*i/2,a.point(-i,r),a.point(0,r),a.point(i,r)}else a.point(t[0],t[1])}),[-Ot,-On]);function hF(e){var t=vt(e),n=6*Rt,a=t>0,r=Mt(t)>gt;function i(c,f){return vt(c)*vt(f)>t}function o(c,f,m){var g=[1,0,0],v=Gp(hd(c),hd(f)),E=cE(v,v),k=v[0],_=E-k*k;if(!_)return!m&&c;var N=t*E/_,O=-t*k/_,I=Gp(g,v),B=dE(g,N);Nk(B,dE(v,O));var M=I,U=cE(B,M),z=cE(M,M),q=U*U-z*(cE(B,B)-1);if(!(q<0)){var Y=vr(q),K=dE(M,(-U-Y)/z);if(Nk(K,B),K=uE(K),!m)return K;var re,Q=c[0],ie=f[0],se=c[1],ue=f[1];ie<Q&&(re=Q,Q=ie,ie=re);var fe=ie-Q,ve=Mt(fe-Ot)<gt;if(!ve&&ue<se&&(re=se,se=ue,ue=re),ve||fe<gt?ve?se+ue>0^K[1]<(Mt(K[0]-Q)<gt?se:ue):se<=K[1]&&K[1]<=ue:fe>Ot^(Q<=K[0]&&K[0]<=ie)){var we=dE(M,(-U+Y)/z);return Nk(we,B),[K,uE(we)]}}}function u(c,f){var m=a?e:Ot-e,g=0;return c<-m?g|=1:c>m&&(g|=2),f<-m?g|=4:f>m&&(g|=8),g}return vR(i,(function(c){var f,m,g,v,E;return{lineStart:function(){v=g=!1,E=1},point:function(k,_){var N,O=[k,_],I=i(k,_),B=a?I?0:u(k,_):I?u(k+(k<0?Ot:-Ot),_):0;if(!f&&(v=g=I)&&c.lineStart(),I!==g&&(!(N=o(f,O))||EE(f,N)||EE(O,N))&&(O[2]=1),I!==g)E=0,I?(c.lineStart(),N=o(O,f),c.point(N[0],N[1])):(N=o(f,O),c.point(N[0],N[1],2),c.lineEnd()),f=N;else if(r&&f&&a^I){var M;B&m||!(M=o(O,f,!0))||(E=0,a?(c.lineStart(),c.point(M[0][0],M[0][1]),c.point(M[1][0],M[1][1]),c.lineEnd()):(c.point(M[1][0],M[1][1]),c.lineEnd(),c.lineStart(),c.point(M[0][0],M[0][1],3)))}!I||f&&EE(f,O)||c.point(O[0],O[1]),f=O,g=I,m=B},lineEnd:function(){g&&c.lineEnd(),f=null},clean:function(){return E|(v&&g)<<1}}}),(function(c,f,m,g){(function(v,E,k,_,N,O){if(k){var I=vt(E),B=ft(E),M=_*k;N==null?(N=E+_*yr,O=E-M/2):(N=mR(I,N),O=mR(I,O),(_>0?N<O:N>O)&&(N+=_*yr));for(var U,z=N;_>0?z>O:z<O;z-=M)U=uE([I,-B*vt(z),-B*ft(z)]),v.point(U[0],U[1])}})(g,e,n,m,c,f)}),a?[0,-e]:[-Ot,e-Ot])}var pb=1e9,_E=-pb;function wR(e,t,n,a){function r(f,m){return e<=f&&f<=n&&t<=m&&m<=a}function i(f,m,g,v){var E=0,k=0;if(f==null||(E=o(f,g))!==(k=o(m,g))||c(f,m)<0^g>0)do v.point(E===0||E===3?e:n,E>1?a:t);while((E=(E+g+4)%4)!==k);else v.point(m[0],m[1])}function o(f,m){return Mt(f[0]-e)<gt?m>0?0:3:Mt(f[0]-n)<gt?m>0?2:1:Mt(f[1]-t)<gt?m>0?1:0:m>0?3:2}function u(f,m){return c(f.x,m.x)}function c(f,m){var g=o(f,1),v=o(m,1);return g!==v?g-v:g===0?m[1]-f[1]:g===1?f[0]-m[0]:g===2?f[1]-m[1]:m[0]-f[0]}return function(f){var m,g,v,E,k,_,N,O,I,B,M,U=f,z=gR(),q={point:Y,lineStart:function(){q.point=K,g&&g.push(v=[]),B=!0,I=!1,N=O=NaN},lineEnd:function(){m&&(K(E,k),_&&I&&z.rejoin(),m.push(z.result())),q.point=Y,I&&U.lineEnd()},polygonStart:function(){U=z,m=[],g=[],M=!0},polygonEnd:function(){var re=(function(){for(var se=0,ue=0,fe=g.length;ue<fe;++ue)for(var ve,we,Oe=g[ue],Ue=1,He=Oe.length,De=Oe[0],ut=De[0],ct=De[1];Ue<He;++Ue)ve=ut,we=ct,ut=(De=Oe[Ue])[0],ct=De[1],we<=a?ct>a&&(ut-ve)*(a-we)>(ct-we)*(e-ve)&&++se:ct<=a&&(ut-ve)*(a-we)<(ct-we)*(e-ve)&&--se;return se})(),Q=M&&re,ie=(m=Eh(m)).length;(Q||ie)&&(f.polygonStart(),Q&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),ie&&bR(m,u,re,i,f),f.polygonEnd()),U=f,m=g=v=null}};function Y(re,Q){r(re,Q)&&U.point(re,Q)}function K(re,Q){var ie=r(re,Q);if(g&&v.push([re,Q]),B)E=re,k=Q,_=ie,B=!1,ie&&(U.lineStart(),U.point(re,Q));else if(ie&&I)U.point(re,Q);else{var se=[N=Math.max(_E,Math.min(pb,N)),O=Math.max(_E,Math.min(pb,O))],ue=[re=Math.max(_E,Math.min(pb,re)),Q=Math.max(_E,Math.min(pb,Q))];(function(fe,ve,we,Oe,Ue,He){var De,ut=fe[0],ct=fe[1],bt=0,Nt=1,bn=ve[0]-ut,Kt=ve[1]-ct;if(De=we-ut,bn||!(De>0)){if(De/=bn,bn<0){if(De<bt)return;De<Nt&&(Nt=De)}else if(bn>0){if(De>Nt)return;De>bt&&(bt=De)}if(De=Ue-ut,bn||!(De<0)){if(De/=bn,bn<0){if(De>Nt)return;De>bt&&(bt=De)}else if(bn>0){if(De<bt)return;De<Nt&&(Nt=De)}if(De=Oe-ct,Kt||!(De>0)){if(De/=Kt,Kt<0){if(De<bt)return;De<Nt&&(Nt=De)}else if(Kt>0){if(De>Nt)return;De>bt&&(bt=De)}if(De=He-ct,Kt||!(De<0)){if(De/=Kt,Kt<0){if(De>Nt)return;De>bt&&(bt=De)}else if(Kt>0){if(De<bt)return;De<Nt&&(Nt=De)}return bt>0&&(fe[0]=ut+bt*bn,fe[1]=ct+bt*Kt),Nt<1&&(ve[0]=ut+Nt*bn,ve[1]=ct+Nt*Kt),!0}}}}})(se,ue,e,t,n,a)?(I||(U.lineStart(),U.point(se[0],se[1])),U.point(ue[0],ue[1]),ie||U.lineEnd(),M=!1):ie&&(U.lineStart(),U.point(re,Q),M=!1)}N=re,O=Q,I=ie}return q}}function _R(e,t,n){var a=Qn(e,t-gt,n).concat(t);return function(r){return a.map((function(i){return[r,i]}))}}function kR(e,t,n){var a=Qn(e,t-gt,n).concat(t);return function(r){return a.map((function(i){return[i,r]}))}}var SR,xR,Bk,Uk,hb=e=>e,zk=new za,Gk=new za,zu={point:Ma,lineStart:Ma,lineEnd:Ma,polygonStart:function(){zu.lineStart=mF,zu.lineEnd=bF},polygonEnd:function(){zu.lineStart=zu.lineEnd=zu.point=Ma,zk.add(Mt(Gk)),Gk=new za},result:function(){var e=zk/2;return zk=new za,e}};function mF(){zu.point=gF}function gF(e,t){zu.point=AR,SR=Bk=e,xR=Uk=t}function AR(e,t){Gk.add(Uk*e-Bk*t),Bk=e,Uk=t}function bF(){AR(SR,xR)}var TR=zu,jp=1/0,kE=jp,mb=-jp,SE=mb,yF={point:function(e,t){e<jp&&(jp=e),e>mb&&(mb=e),t<kE&&(kE=t),t>SE&&(SE=t)},lineStart:Ma,lineEnd:Ma,polygonStart:Ma,polygonEnd:Ma,result:function(){var e=[[jp,kE],[mb,SE]];return mb=SE=-(kE=jp=1/0),e}},CR,RR,Ns,Is,xE=yF,jk=0,Hk=0,gb=0,AE=0,TE=0,Hp=0,qk=0,Wk=0,bb=0,jo={point:md,lineStart:NR,lineEnd:IR,polygonStart:function(){jo.lineStart=wF,jo.lineEnd=_F},polygonEnd:function(){jo.point=md,jo.lineStart=NR,jo.lineEnd=IR},result:function(){var e=bb?[qk/bb,Wk/bb]:Hp?[AE/Hp,TE/Hp]:gb?[jk/gb,Hk/gb]:[NaN,NaN];return jk=Hk=gb=AE=TE=Hp=qk=Wk=bb=0,e}};function md(e,t){jk+=e,Hk+=t,++gb}function NR(){jo.point=vF}function vF(e,t){jo.point=EF,md(Ns=e,Is=t)}function EF(e,t){var n=e-Ns,a=t-Is,r=vr(n*n+a*a);AE+=r*(Ns+e)/2,TE+=r*(Is+t)/2,Hp+=r,md(Ns=e,Is=t)}function IR(){jo.point=md}function wF(){jo.point=kF}function _F(){OR(CR,RR)}function kF(e,t){jo.point=OR,md(CR=Ns=e,RR=Is=t)}function OR(e,t){var n=e-Ns,a=t-Is,r=vr(n*n+a*a);AE+=r*(Ns+e)/2,TE+=r*(Is+t)/2,Hp+=r,qk+=(r=Is*e-Ns*t)*(Ns+e),Wk+=r*(Is+t),bb+=3*r,md(Ns=e,Is=t)}var DR=jo;function MR(e){this._context=e}MR.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,yr)}},result:Ma};var Vk,LR,FR,yb,vb,Yk=new za,CE={point:Ma,lineStart:function(){CE.point=SF},lineEnd:function(){Vk&&PR(LR,FR),CE.point=Ma},polygonStart:function(){Vk=!0},polygonEnd:function(){Vk=null},result:function(){var e=+Yk;return Yk=new za,e}};function SF(e,t){CE.point=PR,LR=yb=e,FR=vb=t}function PR(e,t){yb-=e,vb-=t,Yk.add(vr(yb*yb+vb*vb)),yb=e,vb=t}var $R=CE;let BR,RE,UR,zR;class GR{constructor(t){this._append=t==null?jR:(function(n){let a=Math.floor(n);if(!(a>=0))throw new RangeError(`invalid digits: ${n}`);if(a>15)return jR;if(a!==BR){let r=10**a;BR=a,RE=function(i){let o=1;this._+=i[0];for(let u=i.length;o<u;++o)this._+=Math.round(arguments[o]*r)/r+i[o]}}return RE})(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:if(this._append`M${t},${n}`,this._radius!==UR||this._append!==RE){let a=this._radius,r=this._;this._="",this._append`m0,${a}a${a},${a} 0 1,1 0,${-2*a}a${a},${a} 0 1,1 0,${2*a}z`,UR=a,RE=this._append,zR=this._,this._=r}this._+=zR}}result(){let t=this._;return this._="",t.length?t:null}}function jR(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function HR(e,t){let n,a,r=3,i=4.5;function o(u){return u&&(typeof i=="function"&&a.pointRadius(+i.apply(this,arguments)),Sl(u,n(a))),a.result()}return o.area=function(u){return Sl(u,n(TR)),TR.result()},o.measure=function(u){return Sl(u,n($R)),$R.result()},o.bounds=function(u){return Sl(u,n(xE)),xE.result()},o.centroid=function(u){return Sl(u,n(DR)),DR.result()},o.projection=function(u){return arguments.length?(n=u==null?(e=null,hb):(e=u).stream,o):e},o.context=function(u){return arguments.length?(a=u==null?(t=null,new GR(r)):new MR(t=u),typeof i!="function"&&a.pointRadius(i),o):t},o.pointRadius=function(u){return arguments.length?(i=typeof u=="function"?u:(a.pointRadius(+u),+u),o):i},o.digits=function(u){if(!arguments.length)return r;if(u==null)r=null;else{let c=Math.floor(u);if(!(c>=0))throw new RangeError(`invalid digits: ${u}`);r=c}return t===null&&(a=new GR(r)),o},o.projection(e).digits(r).context(t)}function NE(e){return function(t){var n=new Kk;for(var a in e)n[a]=e[a];return n.stream=t,n}}function Kk(){}function Xk(e,t,n){var a=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),a!=null&&e.clipExtent(null),Sl(n,e.stream(xE)),t(xE.result()),a!=null&&e.clipExtent(a),e}function IE(e,t,n){return Xk(e,(function(a){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(a[1][0]-a[0][0]),i/(a[1][1]-a[0][1])),u=+t[0][0]+(r-o*(a[1][0]+a[0][0]))/2,c=+t[0][1]+(i-o*(a[1][1]+a[0][1]))/2;e.scale(150*o).translate([u,c])}),n)}function Zk(e,t,n){return IE(e,[[0,0],t],n)}function Jk(e,t,n){return Xk(e,(function(a){var r=+t,i=r/(a[1][0]-a[0][0]),o=(r-i*(a[1][0]+a[0][0]))/2,u=-i*a[0][1];e.scale(150*i).translate([o,u])}),n)}function Qk(e,t,n){return Xk(e,(function(a){var r=+t,i=r/(a[1][1]-a[0][1]),o=-i*a[0][0],u=(r-i*(a[1][1]+a[0][1]))/2;e.scale(150*i).translate([o,u])}),n)}Kk.prototype={constructor:Kk,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var qR=16,xF=vt(30*Rt);function WR(e,t){return+t?(function(n,a){function r(i,o,u,c,f,m,g,v,E,k,_,N,O,I){var B=g-i,M=v-o,U=B*B+M*M;if(U>4*a&&O--){var z=c+k,q=f+_,Y=m+N,K=vr(z*z+q*q+Y*Y),re=zr(Y/=K),Q=Mt(Mt(Y)-1)<gt||Mt(u-E)<gt?(u+E)/2:ao(q,z),ie=n(Q,re),se=ie[0],ue=ie[1],fe=se-i,ve=ue-o,we=M*fe-B*ve;(we*we/U>a||Mt((B*fe+M*ve)/U-.5)>.3||c*k+f*_+m*N<xF)&&(r(i,o,u,c,f,m,se,ue,Q,z/=K,q/=K,Y,O,I),I.point(se,ue),r(se,ue,Q,z,q,Y,g,v,E,k,_,N,O,I))}}return function(i){var o,u,c,f,m,g,v,E,k,_,N,O,I={point:B,lineStart:M,lineEnd:z,polygonStart:function(){i.polygonStart(),I.lineStart=q},polygonEnd:function(){i.polygonEnd(),I.lineStart=M}};function B(re,Q){re=n(re,Q),i.point(re[0],re[1])}function M(){E=NaN,I.point=U,i.lineStart()}function U(re,Q){var ie=hd([re,Q]),se=n(re,Q);r(E,k,v,_,N,O,E=se[0],k=se[1],v=re,_=ie[0],N=ie[1],O=ie[2],qR,i),i.point(E,k)}function z(){I.point=B,i.lineEnd()}function q(){M(),I.point=Y,I.lineEnd=K}function Y(re,Q){U(o=re,Q),u=E,c=k,f=_,m=N,g=O,I.point=U}function K(){r(E,k,v,_,N,O,u,c,o,f,m,g,qR,i),I.lineEnd=z,z()}return I}})(e,t):(function(n){return NE({point:function(a,r){a=n(a,r),this.stream.point(a[0],a[1])}})})(e)}var AF=NE({point:function(e,t){this.stream.point(e*Rt,t*Rt)}});function VR(e,t,n,a,r,i){if(!i)return(function(_,N,O,I,B){function M(U,z){return[N+_*(U*=I),O-_*(z*=B)]}return M.invert=function(U,z){return[(U-N)/_*I,(O-z)/_*B]},M})(e,t,n,a,r);var o=vt(i),u=ft(i),c=o*e,f=u*e,m=o/e,g=u/e,v=(u*n-o*t)/e,E=(u*t+o*n)/e;function k(_,N){return[c*(_*=a)-f*(N*=r)+t,n-f*_-c*N]}return k.invert=function(_,N){return[a*(m*_-g*N+v),r*(E-g*_-m*N)]},k}function Os(e){return YR((function(){return e}))()}function YR(e){var t,n,a,r,i,o,u,c,f,m,g=150,v=480,E=250,k=0,_=0,N=0,O=0,I=0,B=0,M=1,U=1,z=null,q=ER,Y=null,K=hb,re=.5;function Q(fe){return c(fe[0]*Rt,fe[1]*Rt)}function ie(fe){return(fe=c.invert(fe[0],fe[1]))&&[fe[0]*Pn,fe[1]*Pn]}function se(){var fe=VR(g,0,0,M,U,B).apply(null,t(k,_)),ve=VR(g,v-fe[0],E-fe[1],M,U,B);return n=dR(N,O,I),u=Fk(t,ve),c=Fk(n,u),o=WR(u,re),ue()}function ue(){return f=m=null,Q}return Q.stream=function(fe){return f&&m===fe?f:f=AF((function(ve){return NE({point:function(we,Oe){var Ue=ve(we,Oe);return this.stream.point(Ue[0],Ue[1])}})})(n)(q(o(K(m=fe)))))},Q.preclip=function(fe){return arguments.length?(q=fe,z=void 0,ue()):q},Q.postclip=function(fe){return arguments.length?(K=fe,Y=a=r=i=null,ue()):K},Q.clipAngle=function(fe){return arguments.length?(q=+fe?hF(z=fe*Rt):(z=null,ER),ue()):z*Pn},Q.clipExtent=function(fe){return arguments.length?(K=fe==null?(Y=a=r=i=null,hb):wR(Y=+fe[0][0],a=+fe[0][1],r=+fe[1][0],i=+fe[1][1]),ue()):Y==null?null:[[Y,a],[r,i]]},Q.scale=function(fe){return arguments.length?(g=+fe,se()):g},Q.translate=function(fe){return arguments.length?(v=+fe[0],E=+fe[1],se()):[v,E]},Q.center=function(fe){return arguments.length?(k=fe[0]%360*Rt,_=fe[1]%360*Rt,se()):[k*Pn,_*Pn]},Q.rotate=function(fe){return arguments.length?(N=fe[0]%360*Rt,O=fe[1]%360*Rt,I=fe.length>2?fe[2]%360*Rt:0,se()):[N*Pn,O*Pn,I*Pn]},Q.angle=function(fe){return arguments.length?(B=fe%360*Rt,se()):B*Pn},Q.reflectX=function(fe){return arguments.length?(M=fe?-1:1,se()):M<0},Q.reflectY=function(fe){return arguments.length?(U=fe?-1:1,se()):U<0},Q.precision=function(fe){return arguments.length?(o=WR(u,re=fe*fe),ue()):vr(re)},Q.fitExtent=function(fe,ve){return IE(Q,fe,ve)},Q.fitSize=function(fe,ve){return Zk(Q,fe,ve)},Q.fitWidth=function(fe,ve){return Jk(Q,fe,ve)},Q.fitHeight=function(fe,ve){return Qk(Q,fe,ve)},function(){return t=e.apply(this,arguments),Q.invert=t.invert&&ie,se()}}function eS(e){var t=0,n=Ot/3,a=YR(e),r=a(t,n);return r.parallels=function(i){return arguments.length?a(t=i[0]*Rt,n=i[1]*Rt):[t*Pn,n*Pn]},r}function TF(e,t){var n=ft(e),a=(n+ft(t))/2;if(Mt(a)<gt)return(function(u){var c=vt(u);function f(m,g){return[m*c,ft(g)/c]}return f.invert=function(m,g){return[m/c,zr(g*c)]},f})(e);var r=1+n*(2*a-n),i=vr(r)/a;function o(u,c){var f=vr(r-2*a*ft(c))/a;return[f*ft(u*=a),i-f*vt(u)]}return o.invert=function(u,c){var f=i-c,m=ao(u,Mt(f))*ro(f);return f*a<0&&(m-=Ot*ro(u)*ro(f)),[m/a,zr((r-(u*u+f*f)*a*a)/(2*a))]},o}function OE(){return eS(TF).scale(155.424).center([0,33.6442])}function KR(){return OE().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function XR(e){return function(t,n){var a=vt(t),r=vt(n),i=e(a*r);return i===1/0?[2,0]:[i*r*ft(t),i*ft(n)]}}function Eb(e){return function(t,n){var a=vr(t*t+n*n),r=e(a),i=ft(r),o=vt(r);return[ao(t*i,a*o),zr(a&&n*i/a)]}}var ZR=XR((function(e){return vr(2/(1+e))}));ZR.invert=Eb((function(e){return 2*zr(e/2)}));var JR=XR((function(e){return(e=WC(e))&&e/ft(e)}));function DE(e,t){return[e,iE(xk((On+t)/2))]}function QR(e){var t,n,a,r=Os(e),i=r.center,o=r.scale,u=r.translate,c=r.clipExtent,f=null;function m(){var g=Ot*o(),v=r((function(E){function k(_){return(_=E(_[0]*Rt,_[1]*Rt))[0]*=Pn,_[1]*=Pn,_}return E=dR(E[0]*Rt,E[1]*Rt,E.length>2?E[2]*Rt:0),k.invert=function(_){return(_=E.invert(_[0]*Rt,_[1]*Rt))[0]*=Pn,_[1]*=Pn,_},k})(r.rotate()).invert([0,0]));return c(f==null?[[v[0]-g,v[1]-g],[v[0]+g,v[1]+g]]:e===DE?[[Math.max(v[0]-g,f),t],[Math.min(v[0]+g,n),a]]:[[f,Math.max(v[1]-g,t)],[n,Math.min(v[1]+g,a)]])}return r.scale=function(g){return arguments.length?(o(g),m()):o()},r.translate=function(g){return arguments.length?(u(g),m()):u()},r.center=function(g){return arguments.length?(i(g),m()):i()},r.clipExtent=function(g){return arguments.length?(g==null?f=t=n=a=null:(f=+g[0][0],t=+g[0][1],n=+g[1][0],a=+g[1][1]),m()):f==null?null:[[f,t],[n,a]]},m()}function ME(e){return xk((On+e)/2)}function CF(e,t){var n=vt(e),a=e===t?ft(e):iE(n/vt(t))/iE(ME(t)/ME(e)),r=n*Sk(ME(e),a)/a;if(!a)return DE;function i(o,u){r>0?u<-On+gt&&(u=-On+gt):u>On-gt&&(u=On-gt);var c=r/Sk(ME(u),a);return[c*ft(a*o),r-c*vt(a*o)]}return i.invert=function(o,u){var c=r-u,f=ro(a)*vr(o*o+c*c),m=ao(o,Mt(c))*ro(c);return c*a<0&&(m-=Ot*ro(o)*ro(c)),[m/a,2*Up(Sk(r/f,1/a))-On]},i}function LE(e,t){return[e,t]}function RF(e,t){var n=vt(e),a=e===t?ft(e):(n-vt(t))/(t-e),r=n/a+e;if(Mt(a)<gt)return LE;function i(o,u){var c=r-u,f=a*o;return[c*ft(f),r-c*vt(f)]}return i.invert=function(o,u){var c=r-u,f=ao(o,Mt(c))*ro(c);return c*a<0&&(f-=Ot*ro(o)*ro(c)),[f/a,r-ro(a)*vr(o*o+c*c)]},i}JR.invert=Eb((function(e){return e})),DE.invert=function(e,t){return[e,2*Up(qC(t))-On]},LE.invert=LE;var wb=1.340264,_b=-.081106,kb=893e-6,Sb=.003796,FE=vr(3)/2;function eN(e,t){var n=zr(FE*ft(t)),a=n*n,r=a*a*a;return[e*vt(n)/(FE*(wb+3*_b*a+r*(7*kb+9*Sb*a))),n*(wb+_b*a+r*(kb+Sb*a))]}function tN(e,t){var n=vt(t),a=vt(e)*n;return[n*ft(e)/a,ft(t)/a]}function nN(e,t){var n=t*t,a=n*n;return[e*(.8707-.131979*n+a*(a*(.003971*n-.001529*a)-.013791)),t*(1.007226+n*(.015085+a*(.028874*n-.044475-.005916*a)))]}function aN(e,t){return[vt(t)*ft(e),ft(t)]}function rN(e,t){var n=vt(t),a=1+vt(e)*n;return[n*ft(e)/a,ft(t)/a]}function iN(e,t){return[iE(xk((On+t)/2)),-e]}eN.invert=function(e,t){for(var n,a=t,r=a*a,i=r*r*r,o=0;o<12&&(i=(r=(a-=n=(a*(wb+_b*r+i*(kb+Sb*r))-t)/(wb+3*_b*r+i*(7*kb+9*Sb*r)))*a)*r*r,!(Mt(n)<nE));++o);return[FE*e*(wb+3*_b*r+i*(7*kb+9*Sb*r))/vt(a),zr(ft(a)/FE)]},tN.invert=Eb(Up),nN.invert=function(e,t){var n,a=t,r=25;do{var i=a*a,o=i*i;a-=n=(a*(1.007226+i*(.015085+o*(.028874*i-.044475-.005916*o)))-t)/(1.007226+i*(.045255+o*(.259866*i-.311325-.005916*11*o)))}while(Mt(n)>gt&&--r>0);return[e/(.8707+(i=a*a)*(i*(i*i*i*(.003971-.001529*i)-.013791)-.131979)),a]},aN.invert=Eb(zr),rN.invert=Eb((function(e){return 2*Up(e)})),iN.invert=function(e,t){return[-t,2*Up(qC(e))-On]};var NF=Math.abs,tS=Math.cos,PE=Math.sin,IF=1e-6,oN=Math.PI,nS=oN/2,sN=(function(e){return e>0?Math.sqrt(e):0})(2);function lN(e){return e>1?nS:e<-1?-nS:Math.asin(e)}function OF(e,t){var n,a=e*PE(t),r=30;do t-=n=(t+PE(t)-a)/(1+tS(t));while(NF(n)>IF&&--r>0);return t/2}var DF=(function(e,t,n){function a(r,i){return[e*r*tS(i=OF(n,i)),t*PE(i)]}return a.invert=function(r,i){return i=lN(i/t),[r/(e*tS(i)),lN((2*i+PE(2*i))/n)]},a})(sN/nS,sN,oN);let MF=HR(),aS=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rS(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?($E[e]=(function(n,a){return function r(){let i=a();return i.type=n,i.path=HR().projection(i),i.copy=i.copy||function(){let o=r();return aS.forEach((u=>{i[u]&&o[u](i[u]())})),o.path.pointRadius(i.path.pointRadius()),o},Ap(i)}})(e,t),this):$E[e]||null}function uN(e){return e&&e.path||MF}let $E={albers:KR,albersusa:function(){var e,t,n,a,r,i,o=KR(),u=OE().rotate([154,0]).center([-2,58.5]).parallels([55,65]),c=OE().rotate([157,0]).center([-3,19.9]).parallels([8,18]),f={point:function(v,E){i=[v,E]}};function m(v){var E=v[0],k=v[1];return i=null,n.point(E,k),i||(a.point(E,k),i)||(r.point(E,k),i)}function g(){return e=t=null,m}return m.invert=function(v){var E=o.scale(),k=o.translate(),_=(v[0]-k[0])/E,N=(v[1]-k[1])/E;return(N>=.12&&N<.234&&_>=-.425&&_<-.214?u:N>=.166&&N<.234&&_>=-.214&&_<-.115?c:o).invert(v)},m.stream=function(v){return e&&t===v?e:(E=[o.stream(t=v),u.stream(v),c.stream(v)],k=E.length,e={point:function(_,N){for(var O=-1;++O<k;)E[O].point(_,N)},sphere:function(){for(var _=-1;++_<k;)E[_].sphere()},lineStart:function(){for(var _=-1;++_<k;)E[_].lineStart()},lineEnd:function(){for(var _=-1;++_<k;)E[_].lineEnd()},polygonStart:function(){for(var _=-1;++_<k;)E[_].polygonStart()},polygonEnd:function(){for(var _=-1;++_<k;)E[_].polygonEnd()}});var E,k},m.precision=function(v){return arguments.length?(o.precision(v),u.precision(v),c.precision(v),g()):o.precision()},m.scale=function(v){return arguments.length?(o.scale(v),u.scale(.35*v),c.scale(v),m.translate(o.translate())):o.scale()},m.translate=function(v){if(!arguments.length)return o.translate();var E=o.scale(),k=+v[0],_=+v[1];return n=o.translate(v).clipExtent([[k-.455*E,_-.238*E],[k+.455*E,_+.238*E]]).stream(f),a=u.translate([k-.307*E,_+.201*E]).clipExtent([[k-.425*E+gt,_+.12*E+gt],[k-.214*E-gt,_+.234*E-gt]]).stream(f),r=c.translate([k-.205*E,_+.212*E]).clipExtent([[k-.214*E+gt,_+.166*E+gt],[k-.115*E-gt,_+.234*E-gt]]).stream(f),g()},m.fitExtent=function(v,E){return IE(m,v,E)},m.fitSize=function(v,E){return Zk(m,v,E)},m.fitWidth=function(v,E){return Jk(m,v,E)},m.fitHeight=function(v,E){return Qk(m,v,E)},m.scale(1070)},azimuthalequalarea:function(){return Os(ZR).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return Os(JR).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return eS(CF).scale(109.5).parallels([30,30])},conicequalarea:OE,conicequidistant:function(){return eS(RF).scale(131.154).center([0,13.9389])},equalEarth:function(){return Os(eN).scale(177.158)},equirectangular:function(){return Os(LE).scale(152.63)},gnomonic:function(){return Os(tN).scale(144.049).clipAngle(60)},identity:function(){var e,t,n,a,r,i,o,u=1,c=0,f=0,m=1,g=1,v=0,E=null,k=1,_=1,N=NE({point:function(M,U){var z=B([M,U]);this.stream.point(z[0],z[1])}}),O=hb;function I(){return k=u*m,_=u*g,i=o=null,B}function B(M){var U=M[0]*k,z=M[1]*_;if(v){var q=z*e-U*t;U=U*e+z*t,z=q}return[U+c,z+f]}return B.invert=function(M){var U=M[0]-c,z=M[1]-f;if(v){var q=z*e+U*t;U=U*e-z*t,z=q}return[U/k,z/_]},B.stream=function(M){return i&&o===M?i:i=N(O(o=M))},B.postclip=function(M){return arguments.length?(O=M,E=n=a=r=null,I()):O},B.clipExtent=function(M){return arguments.length?(O=M==null?(E=n=a=r=null,hb):wR(E=+M[0][0],n=+M[0][1],a=+M[1][0],r=+M[1][1]),I()):E==null?null:[[E,n],[a,r]]},B.scale=function(M){return arguments.length?(u=+M,I()):u},B.translate=function(M){return arguments.length?(c=+M[0],f=+M[1],I()):[c,f]},B.angle=function(M){return arguments.length?(t=ft(v=M%360*Rt),e=vt(v),I()):v*Pn},B.reflectX=function(M){return arguments.length?(m=M?-1:1,I()):m<0},B.reflectY=function(M){return arguments.length?(g=M?-1:1,I()):g<0},B.fitExtent=function(M,U){return IE(B,M,U)},B.fitSize=function(M,U){return Zk(B,M,U)},B.fitWidth=function(M,U){return Jk(B,M,U)},B.fitHeight=function(M,U){return Qk(B,M,U)},B},mercator:function(){return QR(DE).scale(961/yr)},mollweide:function(){return Os(DF).scale(169.529)},naturalEarth1:function(){return Os(nN).scale(175.295)},orthographic:function(){return Os(aN).scale(249.5).clipAngle(90+gt)},stereographic:function(){return Os(rN).scale(250).clipAngle(142)},transversemercator:function(){var e=QR(iN),t=e.center,n=e.rotate;return e.center=function(a){return arguments.length?t([-a[1],a[0]]):[(a=t())[1],-a[0]]},e.rotate=function(a){return arguments.length?n([a[0],a[1],a.length>2?a[2]+90:90]):[(a=n())[0],a[1],a[2]-90]},n([0,0,90]).scale(159.155)}};for(let e in $E)rS(e,$E[e]);function LF(){}let Tl=[[],[[[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 cN(){var e=1,t=1,n=o;function a(u,c){return c.map((f=>r(u,f)))}function r(u,c){var f=[],m=[];return(function(g,v,E){var k,_,N,O,I,B,M=new Array,U=new Array;for(k=_=-1,O=g[0]>=v,Tl[O<<1].forEach(z);++k<e-1;)N=O,O=g[k+1]>=v,Tl[N|O<<1].forEach(z);for(Tl[O<<0].forEach(z);++_<t-1;){for(k=-1,O=g[_*e+e]>=v,I=g[_*e]>=v,Tl[O<<1|I<<2].forEach(z);++k<e-1;)N=O,O=g[_*e+e+k+1]>=v,B=I,I=g[_*e+k+1]>=v,Tl[N|O<<1|I<<2|B<<3].forEach(z);Tl[O|I<<3].forEach(z)}for(k=-1,I=g[_*e]>=v,Tl[I<<2].forEach(z);++k<e-1;)B=I,I=g[_*e+k+1]>=v,Tl[I<<2|B<<3].forEach(z);function z(q){var Y,K,re=[q[0][0]+k,q[0][1]+_],Q=[q[1][0]+k,q[1][1]+_],ie=i(re),se=i(Q);(Y=U[ie])?(K=M[se])?(delete U[Y.end],delete M[K.start],Y===K?(Y.ring.push(Q),E(Y.ring)):M[Y.start]=U[K.end]={start:Y.start,end:K.end,ring:Y.ring.concat(K.ring)}):(delete U[Y.end],Y.ring.push(Q),U[Y.end=se]=Y):(Y=M[se])?(K=U[ie])?(delete M[Y.start],delete U[K.end],Y===K?(Y.ring.push(Q),E(Y.ring)):M[K.start]=U[Y.end]={start:K.start,end:Y.end,ring:K.ring.concat(Y.ring)}):(delete M[Y.start],Y.ring.unshift(re),M[Y.start=ie]=Y):M[ie]=U[se]={start:ie,end:se,ring:[re,Q]}}Tl[I<<3].forEach(z)})(u,c,(g=>{n(g,u,c),(function(v){for(var E=0,k=v.length,_=v[k-1][1]*v[0][0]-v[k-1][0]*v[0][1];++E<k;)_+=v[E-1][1]*v[E][0]-v[E-1][0]*v[E][1];return _})(g)>0?f.push([g]):m.push(g)})),m.forEach((g=>{for(var v,E=0,k=f.length;E<k;++E)if(FF((v=f[E])[0],g)!==-1)return void v.push(g)})),{type:"MultiPolygon",value:c,coordinates:f}}function i(u){return 2*u[0]+u[1]*(e+1)*4}function o(u,c,f){u.forEach((m=>{var g,v=m[0],E=m[1],k=0|v,_=0|E,N=c[_*e+k];v>0&&v<e&&k===v&&(g=c[_*e+k-1],m[0]=v+(f-g)/(N-g)-.5),E>0&&E<t&&_===E&&(g=c[(_-1)*e+k],m[1]=E+(f-g)/(N-g)-.5)}))}return a.contour=r,a.size=function(u){if(!arguments.length)return[e,t];var c=Math.floor(u[0]),f=Math.floor(u[1]);return c>=0&&f>=0||F("invalid size"),e=c,t=f,a},a.smooth=function(u){return arguments.length?(n=u?o:LF,a):n===o},a}function FF(e,t){for(var n,a=-1,r=t.length;++a<r;)if(n=PF(e,t[a]))return n;return 0}function PF(e,t){for(var n=t[0],a=t[1],r=-1,i=0,o=e.length,u=o-1;i<o;u=i++){var c=e[i],f=c[0],m=c[1],g=e[u],v=g[0],E=g[1];if($F(c,g,t))return 0;m>a!=E>a&&n<(v-f)*(a-m)/(E-m)+f&&(r=-r)}return r}function $F(e,t,n){var a,r,i,o;return(function(u,c,f){return(c[0]-u[0])*(f[1]-u[1])==(f[0]-u[0])*(c[1]-u[1])})(e,t,n)&&(r=e[a=+(e[0]===t[0])],i=n[a],o=t[a],r<=i&&i<=o||o<=i&&i<=r)}function dN(e,t,n){return function(a){var r=Un(a),i=n?Math.min(r[0],0):r[0],o=r[1],u=o-i,c=t?Ri(i,o,e):u/(e+1);return Qn(i+c,o,c)}}function iS(e){Se.call(this,null,e)}function fN(e,t,n,a,r){let i=e.x1||0,o=e.y1||0,u=t*n<0;function c(g){g.forEach(f)}function f(g){u&&g.reverse(),g.forEach(m)}function m(g){g[0]=(g[0]-i)*t+a,g[1]=(g[1]-o)*n+r}return function(g){return g.coordinates.forEach(c),g}}function pN(e,t,n){let a=e>=0?e:um(t,n);return Math.round((Math.sqrt(4*a*a+1)-1)/2)}function oS(e){return tt(e)?e:mn(+e)}function hN(){var e=c=>c[0],t=c=>c[1],n=he,a=[-1,-1],r=960,i=500,o=2;function u(c,f){let m=pN(a[0],c,e)>>o,g=pN(a[1],c,t)>>o,v=m?m+2:0,E=g?g+2:0,k=2*v+(r>>o),_=2*E+(i>>o),N=new Float32Array(k*_),O=new Float32Array(k*_),I=N;c.forEach((M=>{let U=v+(+e(M)>>o),z=E+(+t(M)>>o);U>=0&&U<k&&z>=0&&z<_&&(N[U+z*k]+=+n(M))})),m>0&&g>0?(qp(k,_,N,O,m),Wp(k,_,O,N,g),qp(k,_,N,O,m),Wp(k,_,O,N,g),qp(k,_,N,O,m),Wp(k,_,O,N,g)):m>0?(qp(k,_,N,O,m),qp(k,_,O,N,m),qp(k,_,N,O,m),I=O):g>0&&(Wp(k,_,N,O,g),Wp(k,_,O,N,g),Wp(k,_,N,O,g),I=O);let B=f?Math.pow(2,-2*o):1/x_(I);for(let M=0,U=k*_;M<U;++M)I[M]*=B;return{values:I,scale:1<<o,width:k,height:_,x1:v,y1:E,x2:v+(r>>o),y2:E+(i>>o)}}return u.x=function(c){return arguments.length?(e=oS(c),u):e},u.y=function(c){return arguments.length?(t=oS(c),u):t},u.weight=function(c){return arguments.length?(n=oS(c),u):n},u.size=function(c){if(!arguments.length)return[r,i];var f=+c[0],m=+c[1];return f>=0&&m>=0||F("invalid size"),r=f,i=m,u},u.cellSize=function(c){return arguments.length?((c=+c)>=1||F("invalid cell size"),o=Math.floor(Math.log(c)/Math.LN2),u):1<<o},u.bandwidth=function(c){return arguments.length?((c=Ie(c)).length===1&&(c=[+c[0],+c[0]]),c.length!==2&&F("invalid bandwidth"),a=c,u):a},u}function qp(e,t,n,a,r){let i=1+(r<<1);for(let o=0;o<t;++o)for(let u=0,c=0;u<e+r;++u)u<e&&(c+=n[u+o*e]),u>=r&&(u>=i&&(c-=n[u-i+o*e]),a[u-r+o*e]=c/Math.min(u+1,e-1+i-u,i))}function Wp(e,t,n,a,r){let i=1+(r<<1);for(let o=0;o<e;++o)for(let u=0,c=0;u<t+r;++u)u<t&&(c+=n[o+u*e]),u>=r&&(u>=i&&(c-=n[o+(u-i)*e]),a[o+(u-r)*e]=c/Math.min(u+1,t-1+i-u,i))}function sS(e){Se.call(this,null,e)}iS.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"}]},Fe(iS,Se,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),a=t.materialize(t.SOURCE).source,r=e.field||ee,i=cN().smooth(e.smooth!==!1),o=e.thresholds||(function(f,m,g){let v=dN(g.levels||10,g.nice,g.zero!==!1);return g.resolve!=="shared"?v:v(f.map((E=>zs(m(E).values))))})(a,r,e),u=e.as===null?null:e.as||"contour",c=[];return a.forEach((f=>{let m=r(f),g=i.size([m.width,m.height])(m.values,Ee(o)?o:o(m.values));(function(v,E,k,_){let N=_.scale||E.scale,O=_.translate||E.translate;if(tt(N)&&(N=N(k,_)),tt(O)&&(O=O(k,_)),(N===1||N==null)&&!O)return;let I=(Ba(N)?N:N[0])||1,B=(Ba(N)?N:N[1])||1,M=O&&O[0]||0,U=O&&O[1]||0;v.forEach(fN(E,I,B,M,U))})(g,m,f,e),g.forEach((v=>{c.push(mc(f,It(u!=null?{[u]:v}:v)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=c,n}}),sS.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"}]};let BF=["x","y","weight","size","cellSize","bandwidth"];function mN(e,t){return BF.forEach((n=>t[n]!=null?e[n](t[n]):0)),e}function lS(e){Se.call(this,null,e)}Fe(sS,Se,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,a=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=(function(c,f){var m,g,v,E,k,_,N=[],O=I=>I(E);if(f==null)N.push(c);else for(m={},g=0,v=c.length;g<v;++g)E=c[g],(_=m[k=f.map(O)])||(m[k]=_=[],_.dims=k,N.push(_)),_.push(E);return N})(t.materialize(t.SOURCE).source,e.groupby),i=(e.groupby||[]).map(S),o=mN(hN(),e),u=e.as||"grid";return n=r.map((c=>It((function(f,m){for(let g=0;g<i.length;++g)f[i[g]]=m[g];return f})({[u]:o(c,e.counts)},c.dims)))),this.value&&(a.rem=this.value),this.value=a.source=a.add=n,a}}),lS.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}]},Fe(lS,Se,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n,a,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=cN().smooth(e.smooth!==!1),o=e.values,u=e.thresholds||dN(e.count||10,e.nice,!!o),c=e.size;return o||(o=t.materialize(t.SOURCE).source,a=fN(n=mN(hN(),e)(o,!0),n.scale||1,n.scale||1,0,0),c=[n.width,n.height],o=n.values),u=Ee(u)?u:u(o),o=i.size(c)(o,u),a&&o.forEach(a),this.value&&(r.rem=this.value),this.value=r.source=r.add=(o||[]).map(It),r}});let uS="Feature",cS="FeatureCollection";function dS(e){Se.call(this,null,e)}function fS(e){Se.call(this,null,e)}function pS(e){Se.call(this,null,e)}function hS(e){Se.call(this,null,e)}function mS(e){Se.call(this,[],e),this.generator=(function(){var t,n,a,r,i,o,u,c,f,m,g,v,E=10,k=E,_=90,N=360,O=2.5;function I(){return{type:"MultiLineString",coordinates:B()}}function B(){return Qn(rE(r/_)*_,a,_).map(g).concat(Qn(rE(c/N)*N,u,N).map(v)).concat(Qn(rE(n/E)*E,t,E).filter((function(M){return Mt(M%_)>gt})).map(f)).concat(Qn(rE(o/k)*k,i,k).filter((function(M){return Mt(M%N)>gt})).map(m))}return I.lines=function(){return B().map((function(M){return{type:"LineString",coordinates:M}}))},I.outline=function(){return{type:"Polygon",coordinates:[g(r).concat(v(u).slice(1),g(a).reverse().slice(1),v(c).reverse().slice(1))]}},I.extent=function(M){return arguments.length?I.extentMajor(M).extentMinor(M):I.extentMinor()},I.extentMajor=function(M){return arguments.length?(r=+M[0][0],a=+M[1][0],c=+M[0][1],u=+M[1][1],r>a&&(M=r,r=a,a=M),c>u&&(M=c,c=u,u=M),I.precision(O)):[[r,c],[a,u]]},I.extentMinor=function(M){return arguments.length?(n=+M[0][0],t=+M[1][0],o=+M[0][1],i=+M[1][1],n>t&&(M=n,n=t,t=M),o>i&&(M=o,o=i,i=M),I.precision(O)):[[n,o],[t,i]]},I.step=function(M){return arguments.length?I.stepMajor(M).stepMinor(M):I.stepMinor()},I.stepMajor=function(M){return arguments.length?(_=+M[0],N=+M[1],I):[_,N]},I.stepMinor=function(M){return arguments.length?(E=+M[0],k=+M[1],I):[E,k]},I.precision=function(M){return arguments.length?(O=+M,f=_R(o,i,90),m=kR(n,t,O),g=_R(c,u,90),v=kR(r,a,O),I):O},I.extentMajor([[-180,-90+gt],[180,90-gt]]).extentMinor([[-180,-80-gt],[180,80+gt]])})()}function gS(e){Se.call(this,null,e)}function gN(e){if(!tt(e))return!1;let t=ir(T(e));return t.$x||t.$y||t.$value||t.$max}function bN(e){Se.call(this,null,e),this.modified(!0)}function yN(e,t,n){tt(e[t])&&e[t](n)}dS.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},Fe(dS,Se,{transform(e,t){var n,a=this._features,r=this._points,i=e.fields,o=i&&i[0],u=i&&i[1],c=e.geojson||!i&&ee,f=t.ADD;n=e.modified()||t.changed(t.REM)||t.modified(T(c))||o&&t.modified(T(o))||u&&t.modified(T(u)),this.value&&!n||(f=t.SOURCE,this._features=a=[],this._points=r=[]),c&&t.visit(f,(m=>a.push(c(m)))),o&&u&&(t.visit(f,(m=>{var g=o(m),v=u(m);g!=null&&v!=null&&(g=+g)===g&&(v=+v)===v&&r.push([g,v])})),a=a.concat({type:uS,geometry:{type:"MultiPoint",coordinates:r}})),this.value={type:cS,features:a}}}),fS.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"}]},Fe(fS,Se,{transform(e,t){var n=t.fork(t.ALL),a=this.value,r=e.field||ee,i=e.as||"path",o=n.SOURCE;!a||e.modified()?(this.value=a=uN(e.projection),n.materialize().reflow()):o=r===ee||t.modified(r.fields)?n.ADD_MOD:n.ADD;let u=(function(c,f){let m=c.pointRadius();return c.context(null),f!=null&&c.pointRadius(f),m})(a,e.pointRadius);return n.visit(o,(c=>c[i]=a(r(c)))),a.pointRadius(u),n.modifies(i)}}),pS.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"]}]},Fe(pS,Se,{transform(e,t){var n,a=e.projection,r=e.fields[0],i=e.fields[1],o=e.as||["x","y"],u=o[0],c=o[1];function f(m){let g=a([r(m),i(m)]);g?(m[u]=g[0],m[c]=g[1]):(m[u]=void 0,m[c]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,f):(n=t.modified(r.fields)||t.modified(i.fields),t.visit(n?t.ADD_MOD:t.ADD,f)),t.modifies(o)}}),hS.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"}]},Fe(hS,Se,{transform(e,t){var n=t.fork(t.ALL),a=this.value,r=e.as||"shape",i=n.ADD;return a&&!e.modified()||(this.value=a=(function(o,u,c){let f=c==null?m=>o(u(m)):m=>{var g=o.pointRadius(),v=o.pointRadius(c)(u(m));return o.pointRadius(g),v};return f.context=m=>(o.context(m),f),f})(uN(e.projection),e.field||W("datum"),e.pointRadius),n.materialize().reflow(),i=n.SOURCE),n.visit(i,(o=>o[r]=a)),n.modifies(r)}}),mS.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}]},Fe(mS,Se,{transform(e,t){var n,a=this.value,r=this.generator;if(!a.length||e.modified())for(let i in e)tt(r[i])&&r[i](e[i]);return n=r(),a.length?t.mod.push(ou(a[0],n)):t.add.push(It(n)),a[0]=n,t}}),gS.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"}]},Fe(gS,Se,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,a=e.resolve==="shared",r=e.field||ee,i=(function(f,m){let g;return tt(f)?(g=v=>f(v,m),g.dep=gN(f)):f?g=mn(f):(g=v=>v.$value/v.$max||0,g.dep=!0),g})(e.opacity,e),o=(function(f,m){let g;return tt(f)?(g=v=>bs(f(v,m)),g.dep=gN(f)):g=mn(bs(f||"#888")),g})(e.color,e),u=e.as||"image",c={$x:0,$y:0,$value:0,$max:a?zs(n.map((f=>zs(r(f).values)))):0};return n.forEach((f=>{let m=r(f),g=mt({},f,c);a||(g.$max=zs(m.values||[])),f[u]=(function(v,E,k,_){let N=v.width,O=v.height,I=v.x1||0,B=v.y1||0,M=v.x2||N,U=v.y2||O,z=v.values,q=z?ie=>z[ie]:ne,Y=Wa(M-I,U-B),K=Y.getContext("2d"),re=K.getImageData(0,0,M-I,U-B),Q=re.data;for(let ie=B,se=0;ie<U;++ie){E.$y=ie-B;for(let ue=I,fe=ie*N;ue<M;++ue,se+=4){E.$x=ue-I,E.$value=q(ue+fe);let ve=k(E);Q[se+0]=ve.r,Q[se+1]=ve.g,Q[se+2]=ve.b,Q[se+3]=~~(255*_(E))}}return K.putImageData(re,0,0),Y})(m,g,o.dep?o:mn(o(g)),i.dep?i:mn(i(g)))})),t.reflow(!0).modifies(u)}}),Fe(bN,Se,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=(function(a){let r=rS((a||"mercator").toLowerCase());return r||F("Unrecognized projection type: "+a),r()})(e.type),aS.forEach((a=>{e[a]!=null&&yN(n,a,e[a])}))):aS.forEach((a=>{e.modified(a)&&yN(n,a,e[a])})),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&(function(a,r){let i=(function(o){return o=Ie(o),o.length===1?o[0]:{type:cS,features:o.reduce(((u,c)=>u.concat((function(f){return f.type===cS?f.features:Ie(f).filter((m=>m!=null)).map((m=>m.type===uS?m:{type:uS,geometry:m}))})(c))),[])}})(r.fit);r.extent?a.fitExtent(r.extent,i):r.size&&a.fitSize(r.size,i)})(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});var UF=Object.freeze({__proto__:null,contour:lS,geojson:dS,geopath:fS,geopoint:pS,geoshape:hS,graticule:mS,heatmap:gS,isocontour:iS,kde2d:sS,projection:bN});function vN(e,t,n,a){if(isNaN(t)||isNaN(n))return e;var r,i,o,u,c,f,m,g,v,E=e._root,k={data:a},_=e._x0,N=e._y0,O=e._x1,I=e._y1;if(!E)return e._root=k,e;for(;E.length;)if((f=t>=(i=(_+O)/2))?_=i:O=i,(m=n>=(o=(N+I)/2))?N=o:I=o,r=E,!(E=E[g=m<<1|f]))return r[g]=k,e;if(u=+e._x.call(null,E.data),c=+e._y.call(null,E.data),t===u&&n===c)return k.next=E,r?r[g]=k:e._root=k,e;do r=r?r[g]=new Array(4):e._root=new Array(4),(f=t>=(i=(_+O)/2))?_=i:O=i,(m=n>=(o=(N+I)/2))?N=o:I=o;while((g=m<<1|f)==(v=(c>=o)<<1|u>=i));return r[v]=E,r[g]=k,e}function kr(e,t,n,a,r){this.node=e,this.x0=t,this.y0=n,this.x1=a,this.y1=r}function zF(e){return e[0]}function GF(e){return e[1]}function bS(e,t,n){var a=new yS(t??zF,n??GF,NaN,NaN,NaN,NaN);return e==null?a:a.addAll(e)}function yS(e,t,n,a,r,i){this._x=e,this._y=t,this._x0=n,this._y0=a,this._x1=r,this._y1=i,this._root=void 0}function EN(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Sr=bS.prototype=yS.prototype;function xr(e){return function(){return e}}function Gu(e){return 1e-6*(e()-.5)}function jF(e){return e.x+e.vx}function HF(e){return e.y+e.vy}function qF(e){return e.index}function wN(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}Sr.copy=function(){var e,t,n=new yS(this._x,this._y,this._x0,this._y0,this._x1,this._y1),a=this._root;if(!a)return n;if(!a.length)return n._root=EN(a),n;for(e=[{source:a,target:n._root=new Array(4)}];a=e.pop();)for(var r=0;r<4;++r)(t=a.source[r])&&(t.length?e.push({source:t,target:a.target[r]=new Array(4)}):a.target[r]=EN(t));return n},Sr.add=function(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return vN(this.cover(t,n),t,n,e)},Sr.addAll=function(e){var t,n,a,r,i=e.length,o=new Array(i),u=new Array(i),c=1/0,f=1/0,m=-1/0,g=-1/0;for(n=0;n<i;++n)isNaN(a=+this._x.call(null,t=e[n]))||isNaN(r=+this._y.call(null,t))||(o[n]=a,u[n]=r,a<c&&(c=a),a>m&&(m=a),r<f&&(f=r),r>g&&(g=r));if(c>m||f>g)return this;for(this.cover(c,f).cover(m,g),n=0;n<i;++n)vN(this,o[n],u[n],e[n]);return this},Sr.cover=function(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,a=this._y0,r=this._x1,i=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,i=(a=Math.floor(t))+1;else{for(var o,u,c=r-n||1,f=this._root;n>e||e>=r||a>t||t>=i;)switch(u=(t<a)<<1|e<n,(o=new Array(4))[u]=f,f=o,c*=2,u){case 0:r=n+c,i=a+c;break;case 1:n=r-c,i=a+c;break;case 2:r=n+c,a=i-c;break;case 3:n=r-c,a=i-c}this._root&&this._root.length&&(this._root=f)}return this._x0=n,this._y0=a,this._x1=r,this._y1=i,this},Sr.data=function(){var e=[];return this.visit((function(t){if(!t.length)do e.push(t.data);while(t=t.next)})),e},Sr.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Sr.find=function(e,t,n){var a,r,i,o,u,c,f,m=this._x0,g=this._y0,v=this._x1,E=this._y1,k=[],_=this._root;for(_&&k.push(new kr(_,m,g,v,E)),n==null?n=1/0:(m=e-n,g=t-n,v=e+n,E=t+n,n*=n);c=k.pop();)if(!(!(_=c.node)||(r=c.x0)>v||(i=c.y0)>E||(o=c.x1)<m||(u=c.y1)<g))if(_.length){var N=(r+o)/2,O=(i+u)/2;k.push(new kr(_[3],N,O,o,u),new kr(_[2],r,O,N,u),new kr(_[1],N,i,o,O),new kr(_[0],r,i,N,O)),(f=(t>=O)<<1|e>=N)&&(c=k[k.length-1],k[k.length-1]=k[k.length-1-f],k[k.length-1-f]=c)}else{var I=e-+this._x.call(null,_.data),B=t-+this._y.call(null,_.data),M=I*I+B*B;if(M<n){var U=Math.sqrt(n=M);m=e-U,g=t-U,v=e+U,E=t+U,a=_.data}}return a},Sr.remove=function(e){if(isNaN(i=+this._x.call(null,e))||isNaN(o=+this._y.call(null,e)))return this;var t,n,a,r,i,o,u,c,f,m,g,v,E=this._root,k=this._x0,_=this._y0,N=this._x1,O=this._y1;if(!E)return this;if(E.length)for(;;){if((f=i>=(u=(k+N)/2))?k=u:N=u,(m=o>=(c=(_+O)/2))?_=c:O=c,t=E,!(E=E[g=m<<1|f]))return this;if(!E.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(n=t,v=g)}for(;E.data!==e;)if(a=E,!(E=E.next))return this;return(r=E.next)&&delete E.next,a?(r?a.next=r:delete a.next,this):t?(r?t[g]=r:delete t[g],(E=t[0]||t[1]||t[2]||t[3])&&E===(t[3]||t[2]||t[1]||t[0])&&!E.length&&(n?n[v]=E:this._root=E),this):(this._root=r,this)},Sr.removeAll=function(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this},Sr.root=function(){return this._root},Sr.size=function(){var e=0;return this.visit((function(t){if(!t.length)do++e;while(t=t.next)})),e},Sr.visit=function(e){var t,n,a,r,i,o,u=[],c=this._root;for(c&&u.push(new kr(c,this._x0,this._y0,this._x1,this._y1));t=u.pop();)if(!e(c=t.node,a=t.x0,r=t.y0,i=t.x1,o=t.y1)&&c.length){var f=(a+i)/2,m=(r+o)/2;(n=c[3])&&u.push(new kr(n,f,m,i,o)),(n=c[2])&&u.push(new kr(n,a,m,f,o)),(n=c[1])&&u.push(new kr(n,f,r,i,m)),(n=c[0])&&u.push(new kr(n,a,r,f,m))}return this},Sr.visitAfter=function(e){var t,n=[],a=[];for(this._root&&n.push(new kr(this._root,this._x0,this._y0,this._x1,this._y1));t=n.pop();){var r=t.node;if(r.length){var i,o=t.x0,u=t.y0,c=t.x1,f=t.y1,m=(o+c)/2,g=(u+f)/2;(i=r[0])&&n.push(new kr(i,o,u,m,g)),(i=r[1])&&n.push(new kr(i,m,u,c,g)),(i=r[2])&&n.push(new kr(i,o,g,m,f)),(i=r[3])&&n.push(new kr(i,m,g,c,f))}a.push(t)}for(;t=a.pop();)e(t.node,t.x0,t.y0,t.x1,t.y1);return this},Sr.x=function(e){return arguments.length?(this._x=e,this):this._x},Sr.y=function(e){return arguments.length?(this._y=e,this):this._y};var WF={value:()=>{}};function _N(){for(var e,t=0,n=arguments.length,a={};t<n;++t){if(!(e=arguments[t]+"")||e in a||/[\s.]/.test(e))throw new Error("illegal type: "+e);a[e]=[]}return new BE(a)}function BE(e){this._=e}function VF(e,t){for(var n,a=0,r=e.length;a<r;++a)if((n=e[a]).name===t)return n.value}function kN(e,t,n){for(var a=0,r=e.length;a<r;++a)if(e[a].name===t){e[a]=WF,e=e.slice(0,a).concat(e.slice(a+1));break}return n!=null&&e.push({name:t,value:n}),e}BE.prototype=_N.prototype={constructor:BE,on:function(e,t){var n,a,r=this._,i=(a=r,(e+"").trim().split(/^|\s+/).map((function(c){var f="",m=c.indexOf(".");if(m>=0&&(f=c.slice(m+1),c=c.slice(0,m)),c&&!a.hasOwnProperty(c))throw new Error("unknown type: "+c);return{type:c,name:f}}))),o=-1,u=i.length;if(!(arguments.length<2)){if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<u;)if(n=(e=i[o]).type)r[n]=kN(r[n],e.name,t);else if(t==null)for(n in r)r[n]=kN(r[n],e.name,null);return this}for(;++o<u;)if((n=(e=i[o]).type)&&(n=VF(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new BE(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,a,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(a=this._[e]).length;i<n;++i)a[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)}};var UE,xb,Vp=0,Ab=0,Tb=0,SN=1e3,zE=0,gd=0,GE=0,Cb=typeof performance=="object"&&performance.now?performance:Date,xN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function vS(){return gd||(xN(YF),gd=Cb.now()+GE)}function YF(){gd=0}function jE(){this._call=this._time=this._next=null}function AN(e,t,n){var a=new jE;return a.restart(e,t,n),a}function TN(){gd=(zE=Cb.now())+GE,Vp=Ab=0;try{(function(){vS(),++Vp;for(var e,t=UE;t;)(e=gd-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Vp})()}finally{Vp=0,(function(){for(var e,t,n=UE,a=1/0;n;)n._call?(a>n._time&&(a=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:UE=t);xb=e,ES(a)})(),gd=0}}function KF(){var e=Cb.now(),t=e-zE;t>SN&&(GE-=t,zE=e)}function ES(e){Vp||(Ab&&(Ab=clearTimeout(Ab)),e-gd>24?(e<1/0&&(Ab=setTimeout(TN,e-Cb.now()-GE)),Tb&&(Tb=clearInterval(Tb))):(Tb||(zE=Cb.now(),Tb=setInterval(KF,SN)),Vp=1,xN(TN)))}jE.prototype=AN.prototype={constructor:jE,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?vS():+n)+(t==null?0:+t),this._next||xb===this||(xb?xb._next=this:UE=this,xb=this),this._call=e,this._time=n,ES()},stop:function(){this._call&&(this._call=null,this._time=1/0,ES())}};let XF=1664525,ZF=1013904223,CN=4294967296;function JF(e){return e.x}function QF(e){return e.y}var eP=10,tP=Math.PI*(3-Math.sqrt(5));function nP(e){var t,n=1,a=.001,r=1-Math.pow(a,1/300),i=0,o=.6,u=new Map,c=AN(g),f=_N("tick","end"),m=(function(){let _=1;return()=>(_=(XF*_+ZF)%CN)/CN})();function g(){v(),f.call("tick",t),n<a&&(c.stop(),f.call("end",t))}function v(_){var N,O,I=e.length;_===void 0&&(_=1);for(var B=0;B<_;++B)for(n+=(i-n)*r,u.forEach((function(M){M(n)})),N=0;N<I;++N)(O=e[N]).fx==null?O.x+=O.vx*=o:(O.x=O.fx,O.vx=0),O.fy==null?O.y+=O.vy*=o:(O.y=O.fy,O.vy=0);return t}function E(){for(var _,N=0,O=e.length;N<O;++N){if((_=e[N]).index=N,_.fx!=null&&(_.x=_.fx),_.fy!=null&&(_.y=_.fy),isNaN(_.x)||isNaN(_.y)){var I=eP*Math.sqrt(.5+N),B=N*tP;_.x=I*Math.cos(B),_.y=I*Math.sin(B)}(isNaN(_.vx)||isNaN(_.vy))&&(_.vx=_.vy=0)}}function k(_){return _.initialize&&_.initialize(e,m),_}return e==null&&(e=[]),E(),t={tick:v,restart:function(){return c.restart(g),t},stop:function(){return c.stop(),t},nodes:function(_){return arguments.length?(e=_,E(),u.forEach(k),t):e},alpha:function(_){return arguments.length?(n=+_,t):n},alphaMin:function(_){return arguments.length?(a=+_,t):a},alphaDecay:function(_){return arguments.length?(r=+_,t):+r},alphaTarget:function(_){return arguments.length?(i=+_,t):i},velocityDecay:function(_){return arguments.length?(o=1-_,t):1-o},randomSource:function(_){return arguments.length?(m=_,u.forEach(k),t):m},force:function(_,N){return arguments.length>1?(N==null?u.delete(_):u.set(_,k(N)),t):u.get(_)},find:function(_,N,O){var I,B,M,U,z,q=0,Y=e.length;for(O==null?O=1/0:O*=O,q=0;q<Y;++q)(M=(I=_-(U=e[q]).x)*I+(B=N-U.y)*B)<O&&(z=U,O=M);return z},on:function(_,N){return arguments.length>1?(f.on(_,N),t):f.on(_)}}}let RN={center:function(e,t){var n,a=1;function r(){var i,o,u=n.length,c=0,f=0;for(i=0;i<u;++i)c+=(o=n[i]).x,f+=o.y;for(c=(c/u-e)*a,f=(f/u-t)*a,i=0;i<u;++i)(o=n[i]).x-=c,o.y-=f}return e==null&&(e=0),t==null&&(t=0),r.initialize=function(i){n=i},r.x=function(i){return arguments.length?(e=+i,r):e},r.y=function(i){return arguments.length?(t=+i,r):t},r.strength=function(i){return arguments.length?(a=+i,r):a},r},collide:function(e){var t,n,a,r=1,i=1;function o(){for(var f,m,g,v,E,k,_,N=t.length,O=0;O<i;++O)for(m=bS(t,jF,HF).visitAfter(u),f=0;f<N;++f)g=t[f],k=n[g.index],_=k*k,v=g.x+g.vx,E=g.y+g.vy,m.visit(I);function I(B,M,U,z,q){var Y=B.data,K=B.r,re=k+K;if(!Y)return M>v+re||z<v-re||U>E+re||q<E-re;if(Y.index>g.index){var Q=v-Y.x-Y.vx,ie=E-Y.y-Y.vy,se=Q*Q+ie*ie;se<re*re&&(Q===0&&(se+=(Q=Gu(a))*Q),ie===0&&(se+=(ie=Gu(a))*ie),se=(re-(se=Math.sqrt(se)))/se*r,g.vx+=(Q*=se)*(re=(K*=K)/(_+K)),g.vy+=(ie*=se)*re,Y.vx-=Q*(re=1-re),Y.vy-=ie*re)}}}function u(f){if(f.data)return f.r=n[f.data.index];for(var m=f.r=0;m<4;++m)f[m]&&f[m].r>f.r&&(f.r=f[m].r)}function c(){if(t){var f,m,g=t.length;for(n=new Array(g),f=0;f<g;++f)m=t[f],n[m.index]=+e(m,f,t)}}return typeof e!="function"&&(e=xr(e==null?1:+e)),o.initialize=function(f,m){t=f,a=m,c()},o.iterations=function(f){return arguments.length?(i=+f,o):i},o.strength=function(f){return arguments.length?(r=+f,o):r},o.radius=function(f){return arguments.length?(e=typeof f=="function"?f:xr(+f),c(),o):e},o},nbody:function(){var e,t,n,a,r,i=xr(-30),o=1,u=1/0,c=.81;function f(E){var k,_=e.length,N=bS(e,JF,QF).visitAfter(g);for(a=E,k=0;k<_;++k)t=e[k],N.visit(v)}function m(){if(e){var E,k,_=e.length;for(r=new Array(_),E=0;E<_;++E)k=e[E],r[k.index]=+i(k,E,e)}}function g(E){var k,_,N,O,I,B=0,M=0;if(E.length){for(N=O=I=0;I<4;++I)(k=E[I])&&(_=Math.abs(k.value))&&(B+=k.value,M+=_,N+=_*k.x,O+=_*k.y);E.x=N/M,E.y=O/M}else{(k=E).x=k.data.x,k.y=k.data.y;do B+=r[k.data.index];while(k=k.next)}E.value=B}function v(E,k,_,N){if(!E.value)return!0;var O=E.x-t.x,I=E.y-t.y,B=N-k,M=O*O+I*I;if(B*B/c<M)return M<u&&(O===0&&(M+=(O=Gu(n))*O),I===0&&(M+=(I=Gu(n))*I),M<o&&(M=Math.sqrt(o*M)),t.vx+=O*E.value*a/M,t.vy+=I*E.value*a/M),!0;if(!(E.length||M>=u)){(E.data!==t||E.next)&&(O===0&&(M+=(O=Gu(n))*O),I===0&&(M+=(I=Gu(n))*I),M<o&&(M=Math.sqrt(o*M)));do E.data!==t&&(B=r[E.data.index]*a/M,t.vx+=O*B,t.vy+=I*B);while(E=E.next)}}return f.initialize=function(E,k){e=E,n=k,m()},f.strength=function(E){return arguments.length?(i=typeof E=="function"?E:xr(+E),m(),f):i},f.distanceMin=function(E){return arguments.length?(o=E*E,f):Math.sqrt(o)},f.distanceMax=function(E){return arguments.length?(u=E*E,f):Math.sqrt(u)},f.theta=function(E){return arguments.length?(c=E*E,f):Math.sqrt(c)},f},link:function(e){var t,n,a,r,i,o,u=qF,c=function(_){return 1/Math.min(r[_.source.index],r[_.target.index])},f=xr(30),m=1;function g(_){for(var N=0,O=e.length;N<m;++N)for(var I,B,M,U,z,q,Y,K=0;K<O;++K)B=(I=e[K]).source,U=(M=I.target).x+M.vx-B.x-B.vx||Gu(o),z=M.y+M.vy-B.y-B.vy||Gu(o),U*=q=((q=Math.sqrt(U*U+z*z))-n[K])/q*_*t[K],z*=q,M.vx-=U*(Y=i[K]),M.vy-=z*Y,B.vx+=U*(Y=1-Y),B.vy+=z*Y}function v(){if(a){var _,N,O=a.length,I=e.length,B=new Map(a.map(((M,U)=>[u(M,U,a),M])));for(_=0,r=new Array(O);_<I;++_)(N=e[_]).index=_,typeof N.source!="object"&&(N.source=wN(B,N.source)),typeof N.target!="object"&&(N.target=wN(B,N.target)),r[N.source.index]=(r[N.source.index]||0)+1,r[N.target.index]=(r[N.target.index]||0)+1;for(_=0,i=new Array(I);_<I;++_)N=e[_],i[_]=r[N.source.index]/(r[N.source.index]+r[N.target.index]);t=new Array(I),E(),n=new Array(I),k()}}function E(){if(a)for(var _=0,N=e.length;_<N;++_)t[_]=+c(e[_],_,e)}function k(){if(a)for(var _=0,N=e.length;_<N;++_)n[_]=+f(e[_],_,e)}return e==null&&(e=[]),g.initialize=function(_,N){a=_,o=N,v()},g.links=function(_){return arguments.length?(e=_,v(),g):e},g.id=function(_){return arguments.length?(u=_,g):u},g.iterations=function(_){return arguments.length?(m=+_,g):m},g.strength=function(_){return arguments.length?(c=typeof _=="function"?_:xr(+_),E(),g):c},g.distance=function(_){return arguments.length?(f=typeof _=="function"?_:xr(+_),k(),g):f},g},x:function(e){var t,n,a,r=xr(.1);function i(u){for(var c,f=0,m=t.length;f<m;++f)(c=t[f]).vx+=(a[f]-c.x)*n[f]*u}function o(){if(t){var u,c=t.length;for(n=new Array(c),a=new Array(c),u=0;u<c;++u)n[u]=isNaN(a[u]=+e(t[u],u,t))?0:+r(t[u],u,t)}}return typeof e!="function"&&(e=xr(e==null?0:+e)),i.initialize=function(u){t=u,o()},i.strength=function(u){return arguments.length?(r=typeof u=="function"?u:xr(+u),o(),i):r},i.x=function(u){return arguments.length?(e=typeof u=="function"?u:xr(+u),o(),i):e},i},y:function(e){var t,n,a,r=xr(.1);function i(u){for(var c,f=0,m=t.length;f<m;++f)(c=t[f]).vy+=(a[f]-c.y)*n[f]*u}function o(){if(t){var u,c=t.length;for(n=new Array(c),a=new Array(c),u=0;u<c;++u)n[u]=isNaN(a[u]=+e(t[u],u,t))?0:+r(t[u],u,t)}}return typeof e!="function"&&(e=xr(e==null?0:+e)),i.initialize=function(u){t=u,o()},i.strength=function(u){return arguments.length?(r=typeof u=="function"?u:xr(+u),o(),i):r},i.y=function(u){return arguments.length?(e=typeof u=="function"?u:xr(+u),o(),i):e},i}},Rb="forces",wS=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],aP=["static","iterations"],NN=["x","y","vx","vy"];function _S(e){Se.call(this,null,e)}function IN(e,t,n,a){var r,i,o,u,c=Ie(t.forces);for(r=0,i=wS.length;r<i;++r)(o=wS[r])!==Rb&&t.modified(o)&&e[o](t[o]);for(r=0,i=c.length;r<i;++r)u=Rb+r,(o=n||t.modified(Rb,r)?iP(c[r]):a&&rP(c[r],a)?e.force(u):null)&&e.force(u,o);for(i=e.numForces||0;r<i;++r)e.force(Rb+r,null);return e.numForces=c.length,e}function rP(e,t){var n,a;for(n in e)if(tt(a=e[n])&&t.modified(T(a)))return 1;return 0}function iP(e){var t,n;for(n in nt(RN,e.force)||F("Unrecognized force: "+e.force),t=RN[e.force](),e)tt(t[n])&&oP(t[n],e[n],e);return t}function oP(e,t,n){e(tt(t)?a=>t(a,n):t)}_S.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:NN}]},Fe(_S,Se,{transform(e,t){var n,a,r=this.value,i=t.changed(t.ADD_REM),o=e.modified(wS),u=e.iterations||300;if(r?(i&&(t.modifies("index"),r.nodes(t.source)),(o||t.changed(t.MOD))&&IN(r,e,0,t)):(this.value=r=(function(c,f){let m=nP(c),g=m.stop,v=m.restart,E=!1;return m.stopped=()=>E,m.restart=()=>(E=!1,v()),m.stop=()=>(E=!0,g()),IN(m,f,!0).on("end",(()=>E=!0))})(t.source,e),r.on("tick",(n=t.dataflow,a=this,()=>n.touch(a).run())),e.static||(i=!0,r.tick()),t.modifies("index")),o||i||e.modified(aP)||t.changed()&&e.restart){if(r.alpha(Math.max(r.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(r.alphaMin(),1/u)),e.static)for(r.stop();--u>=0;)r.tick();else if(r.stopped()&&r.restart(),!i)return t.StopPropagation}return this.finish(e,t)},finish(e,t){let n=t.dataflow;for(let u,c=this._argops,f=0,m=c.length;f<m;++f)if(u=c[f],u.name===Rb&&u.op._argval.force==="link"){for(var a,r=u.op._argops,i=0,o=r.length;i<o;++i)if(r[i].name==="links"&&(a=r[i].op.source)){n.pulse(a,n.changeset().reflow());break}}return t.reflow(e.modified()).modifies(NN)}});var sP=Object.freeze({__proto__:null,force:_S});function lP(e,t){return e.parent===t.parent?1:2}function uP(e,t){return e+t.x}function cP(e,t){return Math.max(e,t.y)}function dP(e){var t=0,n=e.children,a=n&&n.length;if(a)for(;--a>=0;)t+=n[a].value;else t=1;e.value=t}function kS(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=pP)):t===void 0&&(t=fP);for(var n,a,r,i,o,u=new Yp(e),c=[u];n=c.pop();)if((r=t(n.data))&&(o=(r=Array.from(r)).length))for(n.children=r,i=o-1;i>=0;--i)c.push(a=r[i]=new Yp(r[i])),a.parent=n,a.depth=n.depth+1;return u.eachBefore(ON)}function fP(e){return e.children}function pP(e){return Array.isArray(e)?e[1]:null}function hP(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function ON(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Yp(e){this.data=e,this.depth=this.height=0,this.parent=null}function HE(e){return e==null?null:DN(e)}function DN(e){if(typeof e!="function")throw new Error;return e}function bd(){return 0}function Kp(e){return function(){return e}}Yp.prototype=kS.prototype={constructor:Yp,count:function(){return this.eachAfter(dP)},each:function(e,t){let n=-1;for(let a of this)e.call(t,a,++n,this);return this},eachAfter:function(e,t){for(var n,a,r,i=this,o=[i],u=[],c=-1;i=o.pop();)if(u.push(i),n=i.children)for(a=0,r=n.length;a<r;++a)o.push(n[a]);for(;i=u.pop();)e.call(t,i,++c,this);return this},eachBefore:function(e,t){for(var n,a,r=this,i=[r],o=-1;r=i.pop();)if(e.call(t,r,++o,this),n=r.children)for(a=n.length-1;a>=0;--a)i.push(n[a]);return this},find:function(e,t){let n=-1;for(let a of this)if(e.call(t,a,++n,this))return a},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,a=t.children,r=a&&a.length;--r>=0;)n+=a[r].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=(function(i,o){if(i===o)return i;var u=i.ancestors(),c=o.ancestors(),f=null;for(i=u.pop(),o=c.pop();i===o;)f=i,i=u.pop(),o=c.pop();return f})(t,e),a=[t];t!==n;)t=t.parent,a.push(t);for(var r=a.length;e!==n;)a.splice(r,0,e),e=e.parent;return a},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){return Array.from(this)},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return kS(this).eachBefore(hP)},[Symbol.iterator]:function*(){var e,t,n,a,r=this,i=[r];do for(e=i.reverse(),i=[];r=e.pop();)if(yield r,t=r.children)for(n=0,a=t.length;n<a;++n)i.push(t[n]);while(i.length)}};let mP=1664525,gP=1013904223,MN=4294967296;function bP(e,t){var n,a;if(SS(t,e))return[t];for(n=0;n<e.length;++n)if(qE(t,e[n])&&SS(Nb(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(a=n+1;a<e.length;++a)if(qE(Nb(e[n],e[a]),t)&&qE(Nb(e[n],t),e[a])&&qE(Nb(e[a],t),e[n])&&SS(FN(e[n],e[a],t),e))return[e[n],e[a],t];throw new Error}function qE(e,t){var n=e.r-t.r,a=t.x-e.x,r=t.y-e.y;return n<0||n*n<a*a+r*r}function LN(e,t){var n=e.r-t.r+1e-9*Math.max(e.r,t.r,1),a=t.x-e.x,r=t.y-e.y;return n>0&&n*n>a*a+r*r}function SS(e,t){for(var n=0;n<t.length;++n)if(!LN(e,t[n]))return!1;return!0}function yP(e){switch(e.length){case 1:return(function(t){return{x:t.x,y:t.y,r:t.r}})(e[0]);case 2:return Nb(e[0],e[1]);case 3:return FN(e[0],e[1],e[2])}}function Nb(e,t){var n=e.x,a=e.y,r=e.r,i=t.x,o=t.y,u=t.r,c=i-n,f=o-a,m=u-r,g=Math.sqrt(c*c+f*f);return{x:(n+i+c/g*m)/2,y:(a+o+f/g*m)/2,r:(g+r+u)/2}}function FN(e,t,n){var a=e.x,r=e.y,i=e.r,o=t.x,u=t.y,c=t.r,f=n.x,m=n.y,g=n.r,v=a-o,E=a-f,k=r-u,_=r-m,N=c-i,O=g-i,I=a*a+r*r-i*i,B=I-o*o-u*u+c*c,M=I-f*f-m*m+g*g,U=E*k-v*_,z=(k*M-_*B)/(2*U)-a,q=(_*N-k*O)/U,Y=(E*B-v*M)/(2*U)-r,K=(v*O-E*N)/U,re=q*q+K*K-1,Q=2*(i+z*q+Y*K),ie=z*z+Y*Y-i*i,se=-(Math.abs(re)>1e-6?(Q+Math.sqrt(Q*Q-4*re*ie))/(2*re):ie/Q);return{x:a+z+q*se,y:r+Y+K*se,r:se}}function PN(e,t,n){var a,r,i,o,u=e.x-t.x,c=e.y-t.y,f=u*u+c*c;f?(r=t.r+n.r,r*=r,o=e.r+n.r,r>(o*=o)?(a=(f+o-r)/(2*f),i=Math.sqrt(Math.max(0,o/f-a*a)),n.x=e.x-a*u-i*c,n.y=e.y-a*c+i*u):(a=(f+r-o)/(2*f),i=Math.sqrt(Math.max(0,r/f-a*a)),n.x=t.x+a*u-i*c,n.y=t.y+a*c+i*u)):(n.x=t.x+n.r,n.y=t.y)}function $N(e,t){var n=e.r+t.r-1e-6,a=t.x-e.x,r=t.y-e.y;return n>0&&n*n>a*a+r*r}function BN(e){var t=e._,n=e.next._,a=t.r+n.r,r=(t.x*n.r+n.x*t.r)/a,i=(t.y*n.r+n.y*t.r)/a;return r*r+i*i}function WE(e){this._=e,this.next=null,this.previous=null}function vP(e,t){if(!(i=(e=(function(E){return typeof E=="object"&&"length"in E?E:Array.from(E)})(e)).length))return 0;var n,a,r,i,o,u,c,f,m,g,v;if((n=e[0]).x=0,n.y=0,!(i>1))return n.r;if(a=e[1],n.x=-a.r,a.x=n.r,a.y=0,!(i>2))return n.r+a.r;PN(a,n,r=e[2]),n=new WE(n),a=new WE(a),r=new WE(r),n.next=r.previous=a,a.next=n.previous=r,r.next=a.previous=n;e:for(c=3;c<i;++c){PN(n._,a._,r=e[c]),r=new WE(r),f=a.next,m=n.previous,g=a._.r,v=n._.r;do if(g<=v){if($N(f._,r._)){a=f,n.next=a,a.previous=n,--c;continue e}g+=f._.r,f=f.next}else{if($N(m._,r._)){(n=m).next=a,a.previous=n,--c;continue e}v+=m._.r,m=m.previous}while(f!==m.next);for(r.previous=n,r.next=a,n.next=a.previous=a=r,o=BN(n);(r=r.next)!==a;)(u=BN(r))<o&&(n=r,o=u);a=n.next}for(n=[a._],r=a;(r=r.next)!==a;)n.push(r._);for(r=(function(E,k){for(var _,N,O=0,I=(E=(function(M,U){let z,q,Y=M.length;for(;Y;)q=U()*Y--|0,z=M[Y],M[Y]=M[q],M[q]=z;return M})(Array.from(E),k)).length,B=[];O<I;)_=E[O],N&&LN(N,_)?++O:(N=yP(B=bP(B,_)),O=0);return N})(n,t),c=0;c<i;++c)(n=e[c]).x-=r.x,n.y-=r.y;return r.r}function EP(e){return Math.sqrt(e.value)}function UN(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function xS(e,t,n){return function(a){if(r=a.children){var r,i,o,u=r.length,c=e(a)*t||0;if(c)for(i=0;i<u;++i)r[i].r+=c;if(o=vP(r,n),c)for(i=0;i<u;++i)r[i].r-=c;a.r=o+c}}}function zN(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function GN(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ib(e,t,n,a,r){for(var i,o=e.children,u=-1,c=o.length,f=e.value&&(a-t)/e.value;++u<c;)(i=o[u]).y0=n,i.y1=r,i.x0=t,i.x1=t+=i.value*f}var wP={depth:-1},jN={},AS={};function _P(e){return e.id}function kP(e){return e.parentId}function HN(){var e,t=_P,n=kP;function a(r){var i,o,u,c,f,m,g,v,E=Array.from(r),k=t,_=n,N=new Map;if(e!=null){let O=E.map(((M,U)=>(function(z){z=`${z}`;let q=z.length;return TS(z,q-1)&&!TS(z,q-2)&&(z=z.slice(0,-1)),z[0]==="/"?z:`/${z}`})(e(M,U,r)))),I=O.map(qN),B=new Set(O).add("");for(let M of I)B.has(M)||(B.add(M),O.push(M),I.push(qN(M)),E.push(AS));k=(M,U)=>O[U],_=(M,U)=>I[U]}for(u=0,i=E.length;u<i;++u)o=E[u],m=E[u]=new Yp(o),(g=k(o,u,r))!=null&&(g+="")&&(v=m.id=g,N.set(v,N.has(v)?jN:m)),(g=_(o,u,r))!=null&&(g+="")&&(m.parent=g);for(u=0;u<i;++u)if(g=(m=E[u]).parent){if(!(f=N.get(g)))throw new Error("missing: "+g);if(f===jN)throw new Error("ambiguous: "+g);f.children?f.children.push(m):f.children=[m],m.parent=f}else{if(c)throw new Error("multiple roots");c=m}if(!c)throw new Error("no root");if(e!=null){for(;c.data===AS&&c.children.length===1;)c=c.children[0],--i;for(let O=E.length-1;O>=0&&(m=E[O]).data===AS;--O)m.data=null}if(c.parent=wP,c.eachBefore((function(O){O.depth=O.parent.depth+1,--i})).eachBefore(ON),c.parent=null,i>0)throw new Error("cycle");return c}return a.id=function(r){return arguments.length?(t=HE(r),a):t},a.parentId=function(r){return arguments.length?(n=HE(r),a):n},a.path=function(r){return arguments.length?(e=HE(r),a):e},a}function qN(e){let t=e.length;if(t<2)return"";for(;--t>1&&!TS(e,t););return e.slice(0,t)}function TS(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if((1&n)==0)return!0}return!1}function SP(e,t){return e.parent===t.parent?1:2}function CS(e){var t=e.children;return t?t[0]:e.t}function RS(e){var t=e.children;return t?t[t.length-1]:e.t}function xP(e,t,n){var a=n/(t.i-e.i);t.c-=a,t.s+=n,e.c+=a,t.z+=n,t.m+=n}function AP(e,t,n){return e.a.parent===t.parent?e.a:n}function VE(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}function YE(e,t,n,a,r){for(var i,o=e.children,u=-1,c=o.length,f=e.value&&(r-n)/e.value;++u<c;)(i=o[u]).x0=t,i.x1=a,i.y0=n,i.y1=n+=i.value*f}VE.prototype=Object.create(Yp.prototype);var WN=(1+Math.sqrt(5))/2;function VN(e,t,n,a,r,i){for(var o,u,c,f,m,g,v,E,k,_,N,O=[],I=t.children,B=0,M=0,U=I.length,z=t.value;B<U;){c=r-n,f=i-a;do m=I[M++].value;while(!m&&M<U);for(g=v=m,N=m*m*(_=Math.max(f/c,c/f)/(z*e)),k=Math.max(v/N,N/g);M<U;++M){if(m+=u=I[M].value,u<g&&(g=u),u>v&&(v=u),N=m*m*_,(E=Math.max(v/N,N/g))>k){m-=u;break}k=E}O.push(o={value:m,dice:c<f,children:I.slice(B,M)}),o.dice?Ib(o,n,a,r,z?a+=f*m/z:i):YE(o,n,a,z?n+=c*m/z:r,i),z-=m,B=M}return O}var YN=(function e(t){function n(a,r,i,o,u){VN(t,a,r,i,o,u)}return n.ratio=function(a){return e((a=+a)>1?a:1)},n})(WN),TP=(function e(t){function n(a,r,i,o,u){if((c=a._squarify)&&c.ratio===t)for(var c,f,m,g,v,E=-1,k=c.length,_=a.value;++E<k;){for(m=(f=c[E]).children,g=f.value=0,v=m.length;g<v;++g)f.value+=m[g].value;f.dice?Ib(f,r,i,o,_?i+=(u-i)*f.value/_:u):YE(f,r,i,_?r+=(o-r)*f.value/_:o,u),_-=f.value}else a._squarify=c=VN(t,a,r,i,o,u),c.ratio=t}return n.ratio=function(a){return e((a=+a)>1?a:1)},n})(WN);function NS(e,t,n){let a={};return e.each((r=>{let i=r.data;n(i)&&(a[t(i)]=r)})),e.lookup=a,e}function IS(e){Se.call(this,null,e)}IS.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};let CP=e=>e.values;function RP(){let e=[],t={entries:r=>a(n(r,0),0),key:r=>(e.push(r),t)};function n(r,i){if(i>=e.length)return r;let o=r.length,u=e[i++],c={},f={},m,g,v,E=-1;for(;++E<o;)m=u(g=r[E])+"",(v=c[m])?v.push(g):c[m]=[g];for(m in c)f[m]=n(c[m],i);return f}function a(r,i){if(++i>e.length)return r;let o=[];for(let u in r)o.push({key:u,values:a(r[u],i)});return o}return t}function Cl(e){Se.call(this,null,e)}Fe(IS,Se,{transform(e,t){t.source||F("Nest transform requires an upstream data source.");var n=e.generate,a=e.modified(),r=t.clone(),i=this.value;return(!i||a||t.changed())&&(i&&i.each((o=>{o.children&&ru(o.data)&&r.rem.push(o.data)})),this.value=i=kS({values:Ie(e.keys).reduce(((o,u)=>(o.key(u),o)),RP()).entries(r.source)},CP),n&&i.each((o=>{o.children&&(o=It(o.data),r.add.push(o),r.source.push(o))})),NS(i,rt,rt)),r.source.root=i,r}});let NP=(e,t)=>e.parent===t.parent?1:2;Fe(Cl,Se,{transform(e,t){t.source&&t.source.root||F(this.constructor.name+" transform requires a backing tree data source.");let n=this.layout(e.method),a=this.fields,r=t.source.root,i=e.as||a;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(ls(e.sort,(o=>o.data))),(function(o,u,c){for(let f,m=0,g=u.length;m<g;++m)f=u[m],f in c&&o[f](c[f])})(n,this.params,e),n.separation&&n.separation(e.separation!==!1?NP:he);try{this.value=n(r)}catch(o){F(o)}return r.each((o=>(function(u,c,f){let m=u.data,g=c.length-1;for(let v=0;v<g;++v)m[f[v]]=u[c[v]];m[f[g]]=u.children?u.children.length:0})(o,a,i))),t.reflow(e.modified()).modifies(i).modifies("leaf")}});let OS=["x","y","r","depth","children"];function DS(e){Cl.call(this,e)}DS.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:OS.length,default:OS}]},Fe(DS,Cl,{layout:function(){var e=null,t=1,n=1,a=bd;function r(i){let o=(function(){let u=1;return()=>(u=(mP*u+gP)%MN)/MN})();return i.x=t/2,i.y=n/2,e?i.eachBefore(UN(e)).eachAfter(xS(a,.5,o)).eachBefore(zN(1)):i.eachBefore(UN(EP)).eachAfter(xS(bd,1,o)).eachAfter(xS(a,i.r/Math.min(t,n),o)).eachBefore(zN(Math.min(t,n)/(2*i.r))),i}return r.radius=function(i){return arguments.length?(e=HE(i),r):e},r.size=function(i){return arguments.length?(t=+i[0],n=+i[1],r):[t,n]},r.padding=function(i){return arguments.length?(a=typeof i=="function"?i:Kp(+i),r):a},r},params:["radius","size","padding"],fields:OS});let MS=["x0","y0","x1","y1","depth","children"];function LS(e){Cl.call(this,e)}function FS(e){Se.call(this,null,e)}LS.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:MS.length,default:MS}]},Fe(LS,Cl,{layout:function(){var e=1,t=1,n=0,a=!1;function r(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=e,i.y1=t/o,i.eachBefore((function(u,c){return function(f){f.children&&Ib(f,f.x0,u*(f.depth+1)/c,f.x1,u*(f.depth+2)/c);var m=f.x0,g=f.y0,v=f.x1-n,E=f.y1-n;v<m&&(m=v=(m+v)/2),E<g&&(g=E=(g+E)/2),f.x0=m,f.y0=g,f.x1=v,f.y1=E}})(t,o)),a&&i.eachBefore(GN),i}return r.round=function(i){return arguments.length?(a=!!i,r):a},r.size=function(i){return arguments.length?(e=+i[0],t=+i[1],r):[e,t]},r.padding=function(i){return arguments.length?(n=+i,r):n},r},params:["size","round","padding"],fields:MS}),FS.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},Fe(FS,Se,{transform(e,t){t.source||F("Stratify transform requires an upstream data source.");let n=this.value,a=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),i=!n||a||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),i&&(n=r.source.length?NS(HN().id(e.key).parentId(e.parentKey)(r.source),e.key,Z):NS(HN()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});let KN={tidy:function(){var e=SP,t=1,n=1,a=null;function r(c){var f=(function(O){for(var I,B,M,U,z,q=new VE(O,0),Y=[q];I=Y.pop();)if(M=I._.children)for(I.children=new Array(z=M.length),U=z-1;U>=0;--U)Y.push(B=I.children[U]=new VE(M[U],U)),B.parent=I;return(q.parent=new VE(null,0)).children=[q],q})(c);if(f.eachAfter(i),f.parent.m=-f.z,f.eachBefore(o),a)c.eachBefore(u);else{var m=c,g=c,v=c;c.eachBefore((function(O){O.x<m.x&&(m=O),O.x>g.x&&(g=O),O.depth>v.depth&&(v=O)}));var E=m===g?1:e(m,g)/2,k=E-m.x,_=t/(g.x+E+k),N=n/(v.depth||1);c.eachBefore((function(O){O.x=(O.x+k)*_,O.y=O.depth*N}))}return c}function i(c){var f=c.children,m=c.parent.children,g=c.i?m[c.i-1]:null;if(f){(function(E){for(var k,_=0,N=0,O=E.children,I=O.length;--I>=0;)(k=O[I]).z+=_,k.m+=_,_+=k.s+(N+=k.c)})(c);var v=(f[0].z+f[f.length-1].z)/2;g?(c.z=g.z+e(c._,g._),c.m=c.z-v):c.z=v}else g&&(c.z=g.z+e(c._,g._));c.parent.A=(function(E,k,_){if(k){for(var N,O=E,I=E,B=k,M=O.parent.children[0],U=O.m,z=I.m,q=B.m,Y=M.m;B=RS(B),O=CS(O),B&&O;)M=CS(M),(I=RS(I)).a=E,(N=B.z+q-O.z-U+e(B._,O._))>0&&(xP(AP(B,E,_),E,N),U+=N,z+=N),q+=B.m,U+=O.m,Y+=M.m,z+=I.m;B&&!RS(I)&&(I.t=B,I.m+=q-z),O&&!CS(M)&&(M.t=O,M.m+=U-Y,_=E)}return _})(c,g,c.parent.A||m[0])}function o(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function u(c){c.x*=t,c.y=c.depth*n}return r.separation=function(c){return arguments.length?(e=c,r):e},r.size=function(c){return arguments.length?(a=!1,t=+c[0],n=+c[1],r):a?null:[t,n]},r.nodeSize=function(c){return arguments.length?(a=!0,t=+c[0],n=+c[1],r):a?[t,n]:null},r},cluster:function(){var e=lP,t=1,n=1,a=!1;function r(i){var o,u=0;i.eachAfter((function(v){var E=v.children;E?(v.x=(function(k){return k.reduce(uP,0)/k.length})(E),v.y=(function(k){return 1+k.reduce(cP,0)})(E)):(v.x=o?u+=e(v,o):0,v.y=0,o=v)}));var c=(function(v){for(var E;E=v.children;)v=E[0];return v})(i),f=(function(v){for(var E;E=v.children;)v=E[E.length-1];return v})(i),m=c.x-e(c,f)/2,g=f.x+e(f,c)/2;return i.eachAfter(a?function(v){v.x=(v.x-i.x)*t,v.y=(i.y-v.y)*n}:function(v){v.x=(v.x-m)/(g-m)*t,v.y=(1-(i.y?v.y/i.y:1))*n})}return r.separation=function(i){return arguments.length?(e=i,r):e},r.size=function(i){return arguments.length?(a=!1,t=+i[0],n=+i[1],r):a?null:[t,n]},r.nodeSize=function(i){return arguments.length?(a=!0,t=+i[0],n=+i[1],r):a?[t,n]:null},r}},PS=["x","y","depth","children"];function $S(e){Cl.call(this,e)}function BS(e){Se.call(this,[],e)}$S.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:PS.length,default:PS}]},Fe($S,Cl,{layout(e){let t=e||"tidy";if(nt(KN,t))return KN[t]();F("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:PS}),BS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},Fe(BS,Se,{transform(e,t){let n=this.value,a=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),i={};return a||F("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,(o=>i[rt(o)]=1)),a.each((o=>{let u=o.data,c=o.parent&&o.parent.data;c&&i[rt(u)]&&i[rt(c)]&&r.add.push(It({source:c,target:u}))})),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,(o=>i[rt(o)]=1)),n.forEach((o=>{(i[rt(o.source)]||i[rt(o.target)])&&r.mod.push(o)}))),r}});let XN={binary:function(e,t,n,a,r){var i,o,u=e.children,c=u.length,f=new Array(c+1);for(f[0]=o=i=0;i<c;++i)f[i+1]=o+=u[i].value;(function m(g,v,E,k,_,N,O){if(g>=v-1){var I=u[g];return I.x0=k,I.y0=_,I.x1=N,void(I.y1=O)}for(var B=f[g],M=E/2+B,U=g+1,z=v-1;U<z;){var q=U+z>>>1;f[q]<M?U=q+1:z=q}M-f[U-1]<f[U]-M&&g+1<U&&--U;var Y=f[U]-B,K=E-Y;if(N-k>O-_){var re=E?(k*K+N*Y)/E:N;m(g,U,Y,k,_,re,O),m(U,v,K,re,_,N,O)}else{var Q=E?(_*K+O*Y)/E:O;m(g,U,Y,k,_,N,Q),m(U,v,K,k,Q,N,O)}})(0,c,e.value,t,n,a,r)},dice:Ib,slice:YE,slicedice:function(e,t,n,a,r){(1&e.depth?YE:Ib)(e,t,n,a,r)},squarify:YN,resquarify:TP},US=["x0","y0","x1","y1","depth","children"];function zS(e){Cl.call(this,e)}zS.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:US.length,default:US}]},Fe(zS,Cl,{layout(){let e=(function(){var t=YN,n=!1,a=1,r=1,i=[0],o=bd,u=bd,c=bd,f=bd,m=bd;function g(E){return E.x0=E.y0=0,E.x1=a,E.y1=r,E.eachBefore(v),i=[0],n&&E.eachBefore(GN),E}function v(E){var k=i[E.depth],_=E.x0+k,N=E.y0+k,O=E.x1-k,I=E.y1-k;O<_&&(_=O=(_+O)/2),I<N&&(N=I=(N+I)/2),E.x0=_,E.y0=N,E.x1=O,E.y1=I,E.children&&(k=i[E.depth+1]=o(E)/2,_+=m(E)-k,N+=u(E)-k,(O-=c(E)-k)<_&&(_=O=(_+O)/2),(I-=f(E)-k)<N&&(N=I=(N+I)/2),t(E,_,N,O,I))}return g.round=function(E){return arguments.length?(n=!!E,g):n},g.size=function(E){return arguments.length?(a=+E[0],r=+E[1],g):[a,r]},g.tile=function(E){return arguments.length?(t=DN(E),g):t},g.padding=function(E){return arguments.length?g.paddingInner(E).paddingOuter(E):g.paddingInner()},g.paddingInner=function(E){return arguments.length?(o=typeof E=="function"?E:Kp(+E),g):o},g.paddingOuter=function(E){return arguments.length?g.paddingTop(E).paddingRight(E).paddingBottom(E).paddingLeft(E):g.paddingTop()},g.paddingTop=function(E){return arguments.length?(u=typeof E=="function"?E:Kp(+E),g):u},g.paddingRight=function(E){return arguments.length?(c=typeof E=="function"?E:Kp(+E),g):c},g.paddingBottom=function(E){return arguments.length?(f=typeof E=="function"?E:Kp(+E),g):f},g.paddingLeft=function(E){return arguments.length?(m=typeof E=="function"?E:Kp(+E),g):m},g})();return e.ratio=t=>{let n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{nt(XN,t)?e.tile(XN[t]):F("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:US});var IP=Object.freeze({__proto__:null,nest:IS,pack:DS,partition:LS,stratify:FS,tree:$S,treelinks:BS,treemap:zS});let GS=4278190080;function jS(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function KE(e,t,n){if(!t.length)return;let a=t[0].mark.marktype;a==="group"?t.forEach((r=>{r.items.forEach((i=>KE(e,i.items,n)))})):yi[a].draw(e,{items:n?t.map(OP):t})}function OP(e){let t=mc(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}let Rl=5,Ar=31,Ob=32,ju=new Uint32Array(Ob+1),Ho=new Uint32Array(Ob+1);Ho[0]=0,ju[0]=~Ho[0];for(let e=1;e<=Ob;++e)Ho[e]=Ho[e-1]<<1|1,ju[e]=~Ho[e];function DP(e,t,n){let a=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+a)/a),i=~~((t+2*n+a)/a),o=u=>~~((u+n)/a);return o.invert=u=>u*a-n,o.bitmap=()=>(function(u,c){let f=new Uint32Array(~~((u*c+Ob)/Ob));function m(v,E){f[v]|=E}function g(v,E){f[v]&=E}return{array:f,get:(v,E)=>{let k=E*u+v;return f[k>>>Rl]&1<<(k&Ar)},set:(v,E)=>{let k=E*u+v;m(k>>>Rl,1<<(k&Ar))},clear:(v,E)=>{let k=E*u+v;g(k>>>Rl,~(1<<(k&Ar)))},getRange:(v,E,k,_)=>{let N,O,I,B,M=_;for(;M>=E;--M)if(N=M*u+v,O=M*u+k,I=N>>>Rl,B=O>>>Rl,I===B){if(f[I]&ju[N&Ar]&Ho[1+(O&Ar)])return!0}else{if(f[I]&ju[N&Ar]||f[B]&Ho[1+(O&Ar)])return!0;for(let U=I+1;U<B;++U)if(f[U])return!0}return!1},setRange:(v,E,k,_)=>{let N,O,I,B,M;for(;E<=_;++E)if(N=E*u+v,O=E*u+k,I=N>>>Rl,B=O>>>Rl,I===B)m(I,ju[N&Ar]&Ho[1+(O&Ar)]);else for(m(I,ju[N&Ar]),m(B,Ho[1+(O&Ar)]),M=I+1;M<B;++M)m(M,4294967295)},clearRange:(v,E,k,_)=>{let N,O,I,B,M;for(;E<=_;++E)if(N=E*u+v,O=E*u+k,I=N>>>Rl,B=O>>>Rl,I===B)g(I,Ho[N&Ar]|ju[1+(O&Ar)]);else for(g(I,Ho[N&Ar]),g(B,ju[1+(O&Ar)]),M=I+1;M<B;++M)g(M,0)},outOfBounds:(v,E,k,_)=>v<0||E<0||_>=c||k>=u}})(r,i),o.ratio=a,o.padding=n,o.width=e,o.height=t,o}function XE(e,t,n,a,r,i){let o=n/2;return e-o<0||e+o>r||t-(o=a/2)<0||t+o>i}function Hu(e,t,n,a,r,i,o,u){let c=r*i/(2*a),f=e(t-c),m=e(t+c),g=e(n-(i/=2)),v=e(n+i);return o.outOfBounds(f,g,m,v)||o.getRange(f,g,m,v)||u&&u.getRange(f,g,m,v)}let MP=[-1,-1,1,1],LP=[-1,1,-1,1],FP=["right","center","left"],PP=["bottom","middle","top"];function ZN(e,t,n,a,r,i,o,u,c,f,m,g){return!(r.outOfBounds(e,n,t,a)||(g&&i||r).getRange(e,n,t,a))}let $P={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},BP={naive:function(e,t,n,a){let r=e.width,i=e.height;return function(o){let u=o.datum.datum.items[a].items,c=u.length,f=o.datum.fontSize,m=$o.width(o.datum,o.datum.text),g,v,E,k,_,N,O,I=0;for(let B=0;B<c;++B)g=u[B].x,E=u[B].y,v=u[B].x2===void 0?g:u[B].x2,k=u[B].y2===void 0?E:u[B].y2,_=(g+v)/2,N=(E+k)/2,O=Math.abs(v-g+k-E),O>=I&&(I=O,o.x=_,o.y=N);return _=m/2,N=f/2,g=o.x-_,v=o.x+_,E=o.y-N,k=o.y+N,o.align="center",g<0&&v<=r?o.align="left":0<=g&&r<v&&(o.align="right"),o.baseline="middle",E<0&&k<=i?o.baseline="top":0<=E&&i<k&&(o.baseline="bottom"),!0}},"reduced-search":function(e,t,n,a){let r=e.width,i=e.height,o=t[0],u=t[1];function c(f,m,g,v,E){let k=e.invert(f),_=e.invert(m),N,O=g,I=i;if(!XE(k,_,v,E,r,i)&&!Hu(e,k,_,E,v,O,o,u)&&!Hu(e,k,_,E,v,E,o,null)){for(;I-O>=1;)N=(O+I)/2,Hu(e,k,_,E,v,N,o,u)?I=N:O=N;if(O>g)return[k,_,O,!0]}}return function(f){let m=f.datum.datum.items[a].items,g=m.length,v=f.datum.fontSize,E=$o.width(f.datum,f.datum.text),k,_,N,O,I,B,M,U,z,q,Y,K,re,Q,ie,se,ue,fe=n?v:0,ve=!1,we=!1,Oe=0;for(let Ue=0;Ue<g;++Ue){for(k=m[Ue].x,N=m[Ue].y,_=m[Ue].x2===void 0?k:m[Ue].x2,O=m[Ue].y2===void 0?N:m[Ue].y2,k>_&&(ue=k,k=_,_=ue),N>O&&(ue=N,N=O,O=ue),z=e(k),Y=e(_),q=~~((z+Y)/2),K=e(N),Q=e(O),re=~~((K+Q)/2),M=q;M>=z;--M)for(U=re;U>=K;--U)se=c(M,U,fe,E,v),se&&([f.x,f.y,fe,ve]=se);for(M=q;M<=Y;++M)for(U=re;U<=Q;++U)se=c(M,U,fe,E,v),se&&([f.x,f.y,fe,ve]=se);ve||n||(ie=Math.abs(_-k+O-N),I=(k+_)/2,B=(N+O)/2,ie>=Oe&&!XE(I,B,E,v,r,i)&&!Hu(e,I,B,v,E,v,o,null)&&(Oe=ie,f.x=I,f.y=B,we=!0))}return!(!ve&&!we)&&(I=E/2,B=v/2,o.setRange(e(f.x-I),e(f.y-B),e(f.x+I),e(f.y+B)),f.align="center",f.baseline="middle",!0)}},floodfill:function(e,t,n,a){let r=e.width,i=e.height,o=t[0],u=t[1],c=e.bitmap();return function(f){let m=f.datum.datum.items[a].items,g=m.length,v=f.datum.fontSize,E=$o.width(f.datum,f.datum.text),k=[],_,N,O,I,B,M,U,z,q,Y,K,re,Q=n?v:0,ie=!1,se=!1,ue=0;for(let fe=0;fe<g;++fe){for(_=m[fe].x,O=m[fe].y,N=m[fe].x2===void 0?_:m[fe].x2,I=m[fe].y2===void 0?O:m[fe].y2,k.push([e((_+N)/2),e((O+I)/2)]);k.length;)if([U,z]=k.pop(),!(o.get(U,z)||u.get(U,z)||c.get(U,z))){c.set(U,z);for(let ve=0;ve<4;++ve)B=U+MP[ve],M=z+LP[ve],c.outOfBounds(B,M,B,M)||k.push([B,M]);if(B=e.invert(U),M=e.invert(z),q=Q,Y=i,!XE(B,M,E,v,r,i)&&!Hu(e,B,M,v,E,q,o,u)&&!Hu(e,B,M,v,E,v,o,null)){for(;Y-q>=1;)K=(q+Y)/2,Hu(e,B,M,v,E,K,o,u)?Y=K:q=K;q>Q&&(f.x=B,f.y=M,Q=q,ie=!0)}}ie||n||(re=Math.abs(N-_+I-O),B=(_+N)/2,M=(O+I)/2,re>=ue&&!XE(B,M,E,v,r,i)&&!Hu(e,B,M,v,E,v,o,null)&&(ue=re,f.x=B,f.y=M,se=!0))}return!(!ie&&!se)&&(B=E/2,M=v/2,o.setRange(e(f.x-B),e(f.y-M),e(f.x+B),e(f.y+M)),f.align="center",f.baseline="middle",!0)}}};function UP(e,t,n,a,r,i,o,u,c,f,m){if(!e.length)return e;let g=Math.max(a.length,r.length),v=(function(Q,ie){let se=new Float64Array(ie),ue=Q.length;for(let fe=0;fe<ue;++fe)se[fe]=Q[fe]||0;for(let fe=ue;fe<ie;++fe)se[fe]=se[ue-1];return se})(a,g),E=(function(Q,ie){let se=new Int8Array(ie),ue=Q.length;for(let fe=0;fe<ue;++fe)se[fe]|=$P[Q[fe]];for(let fe=ue;fe<ie;++fe)se[fe]=se[ue-1];return se})(r,g),k=(M=e[0].datum)&&M.mark&&M.mark.marktype,_=k==="group"&&e[0].datum.items[c].marktype,N=_==="area",O=(function(Q,ie,se,ue){let fe=ve=>[ve.x,ve.x,ve.x,ve.y,ve.y,ve.y];return Q?Q==="line"||Q==="area"?ve=>fe(ve.datum):ie==="line"?ve=>{let we=ve.datum.items[ue].items;return fe(we.length?we[se==="start"?0:we.length-1]:{x:NaN,y:NaN})}:ve=>{let we=ve.datum.bounds;return[we.x1,(we.x1+we.x2)/2,we.x2,we.y1,(we.y1+we.y2)/2,we.y2]}:fe})(k,_,u,c),I=f===null||f===1/0,B=N&&m==="naive";var M;let U=-1,z=-1,q=e.map((Q=>{let ie=I?$o.width(Q,Q.text):void 0;return U=Math.max(U,ie),z=Math.max(z,Q.fontSize),{datum:Q,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:O(Q),textWidth:ie}}));f=f===null||f===1/0?Math.max(U,z)+Math.max(...a):f;let Y=DP(t[0],t[1],f),K;if(!B){n&&q.sort(((se,ue)=>n(se.datum,ue.datum)));let Q=!1;for(let se=0;se<E.length&&!Q;++se)Q=E[se]===5||v[se]<0;let ie=(k&&o||N)&&e.map((se=>se.datum));K=i.length||ie?(function(se,ue,fe,ve,we){let Oe=se.width,Ue=se.height,He=ve||we,De=Wa(Oe,Ue).getContext("2d"),ut=Wa(Oe,Ue).getContext("2d"),ct=He&&Wa(Oe,Ue).getContext("2d");fe.forEach((Dl=>KE(De,Dl,!1))),KE(ut,ue,!1),He&&KE(ct,ue,!0);let bt=jS(De,Oe,Ue),Nt=jS(ut,Oe,Ue),bn=He&&jS(ct,Oe,Ue),Kt=se.bitmap(),wa=He&&se.bitmap(),Tn,ca,_a,$n,nr,ka,lo,Vr;for(ca=0;ca<Ue;++ca)for(Tn=0;Tn<Oe;++Tn)nr=ca*Oe+Tn,ka=bt[nr]&GS,Vr=Nt[nr]&GS,lo=He&&bn[nr]&GS,(ka||lo||Vr)&&(_a=se(Tn),$n=se(ca),we||!ka&&!Vr||Kt.set(_a,$n),He&&(ka||lo)&&wa.set(_a,$n));return[Kt,wa]})(Y,ie||[],i,Q,N):(function(se,ue){let fe=se.bitmap();return(ue||[]).forEach((ve=>fe.set(se(ve.boundary[0]),se(ve.boundary[3])))),[fe,void 0]})(Y,o&&q)}let re=N?BP[m](Y,K,o,c):(function(Q,ie,se,ue){let fe=Q.width,ve=Q.height,we=ie[0],Oe=ie[1],Ue=ue.length;return function(He){let De=He.boundary,ut=He.datum.fontSize;if(De[2]<0||De[5]<0||De[0]>fe||De[3]>ve)return!1;let ct,bt,Nt,bn,Kt,wa,Tn,ca,_a,$n,nr,ka,lo,Vr,Dl,Cd=He.textWidth??0;for(let Ls=0;Ls<Ue;++Ls){if(ct=(3&se[Ls])-1,bt=(se[Ls]>>>2&3)-1,Nt=ct===0&&bt===0||ue[Ls]<0,bn=ct&&bt?Math.SQRT1_2:1,Kt=ue[Ls]<0?-1:1,wa=De[1+ct]+ue[Ls]*ct*bn,nr=De[4+bt]+Kt*ut*bt/2+ue[Ls]*bt*bn,ca=nr-ut/2,_a=nr+ut/2,ka=Q(wa),Vr=Q(ca),Dl=Q(_a),!Cd){if(!ZN(ka,ka,Vr,Dl,we,Oe,0,0,0,0,0,Nt))continue;Cd=$o.width(He.datum,He.datum.text)}if($n=wa+Kt*Cd*ct/2,wa=$n-Cd/2,Tn=$n+Cd/2,ka=Q(wa),lo=Q(Tn),ZN(ka,lo,Vr,Dl,we,Oe,0,0,0,0,0,Nt))return He.x=ct?ct*Kt<0?Tn:wa:$n,He.y=bt?bt*Kt<0?_a:ca:nr,He.align=FP[ct*Kt+1],He.baseline=PP[bt*Kt+1],we.setRange(ka,Vr,lo,Dl),!0}return!1}})(Y,K,E,v);return q.forEach((Q=>Q.opacity=+re(Q))),q}let HS=["x","y","opacity","align","baseline"],JN=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function qS(e){Se.call(this,null,e)}qS.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:JN},{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:HS.length,default:HS}]},Fe(qS,Se,{transform(e,t){let n=e.modified();if(!(n||t.changed(t.ADD_REM)||(function(r){let i=e[r];return tt(i)&&t.modified(i.fields)})("sort")))return;e.size&&e.size.length===2||F("Size parameter should be specified as a [width, height] array.");let a=e.as||HS;return UP(t.materialize(t.SOURCE).source||[],e.size,e.sort,Ie(e.offset==null?1:e.offset),Ie(e.anchor||JN),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach((r=>{let i=r.datum;i[a[0]]=r.x,i[a[1]]=r.y,i[a[2]]=r.opacity,i[a[3]]=r.align,i[a[4]]=r.baseline})),t.reflow(n).modifies(a)}});var zP=Object.freeze({__proto__:null,label:qS});function QN(e,t){var n,a,r,i,o,u,c=[],f=function(m){return m(i)};if(t==null)c.push(e);else for(n={},a=0,r=e.length;a<r;++a)i=e[a],(u=n[o=t.map(f)])||(n[o]=u=[],u.dims=o,c.push(u)),u.push(i);return c}function WS(e){Se.call(this,null,e)}WS.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}]},Fe(WS,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let a=QN(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(S),i=r.length,o=e.as||[S(e.x),S(e.y)],u=[];a.forEach((c=>{vm(c,e.x,e.y,e.bandwidth||.3).forEach((f=>{let m={};for(let g=0;g<i;++g)m[r[g]]=c.dims[g];m[o[0]]=f[0],m[o[1]]=f[1],u.push(It(m))}))})),this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});let VS={constant:Mf,linear:fu,log:Ac,exp:gm,pow:my,quad:si,poly:bm};function YS(e){Se.call(this,null,e)}YS.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(VS)},{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}]},Fe(YS,Se,{transform(e,t){let n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){let a=QN(t.materialize(t.SOURCE).source,e.groupby),r=(e.groupby||[]).map(S),i=e.method||"linear",o=e.order==null?3:e.order,u=((v,E)=>v==="poly"?E:v==="quad"?2:1)(i,o),c=e.as||[S(e.x),S(e.y)],f=VS[i],m=[],g=e.extent;nt(VS,i)||F("Invalid regression method: "+i),g!=null&&i==="log"&&g[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),g=null),a.forEach((v=>{if(v.length<=u)return void t.dataflow.warn("Skipping regression with more parameters than data points.");let E=f(v,e.x,e.y,o);if(e.params)return void m.push(It({keys:v.dims,coef:E.coef,rSquared:E.rSquared}));let k=g||Un(v,e.x),_=N=>{let O={};for(let I=0;I<r.length;++I)O[r[I]]=v.dims[I];O[c[0]]=N[0],O[c[1]]=N[1],m.push(It(O))};i==="linear"||i==="constant"?k.forEach((N=>_([N,E.predict(N)]))):Lf(E.predict,k,25,200).forEach(_)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=m}return n}});var GP=Object.freeze({__proto__:null,loess:WS,regression:YS});let Qa=134217729,jP=33306690738754706e-32;function KS(e,t,n,a,r){let i,o,u,c,f=t[0],m=a[0],g=0,v=0;m>f==m>-f?(i=f,f=t[++g]):(i=m,m=a[++v]);let E=0;if(g<e&&v<n)for(m>f==m>-f?(o=f+i,u=i-(o-f),f=t[++g]):(o=m+i,u=i-(o-m),m=a[++v]),i=o,u!==0&&(r[E++]=u);g<e&&v<n;)m>f==m>-f?(o=i+f,c=o-i,u=i-(o-c)+(f-c),f=t[++g]):(o=i+m,c=o-i,u=i-(o-c)+(m-c),m=a[++v]),i=o,u!==0&&(r[E++]=u);for(;g<e;)o=i+f,c=o-i,u=i-(o-c)+(f-c),f=t[++g],i=o,u!==0&&(r[E++]=u);for(;v<n;)o=i+m,c=o-i,u=i-(o-c)+(m-c),m=a[++v],i=o,u!==0&&(r[E++]=u);return i===0&&E!==0||(r[E++]=i),E}function Db(e){return new Float64Array(e)}let HP=33306690738754716e-32,qP=22204460492503146e-32,WP=11093356479670487e-47,Xp=Db(4),eI=Db(8),tI=Db(12),nI=Db(16),Tr=Db(4);function ZE(e,t,n,a,r,i){let o=(t-i)*(n-r),u=(e-r)*(a-i),c=o-u;if(o===0||u===0||o>0!=u>0)return c;let f=Math.abs(o+u);return Math.abs(c)>=HP*f?c:-(function(m,g,v,E,k,_,N){let O,I,B,M,U,z,q,Y,K,re,Q,ie,se,ue,fe,ve,we,Oe,Ue=m-k,He=v-k,De=g-_,ut=E-_;ue=Ue*ut,z=Qa*Ue,q=z-(z-Ue),Y=Ue-q,z=Qa*ut,K=z-(z-ut),re=ut-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=De*He,z=Qa*De,q=z-(z-De),Y=De-q,z=Qa*He,K=z-(z-He),re=He-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Xp[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Xp[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Xp[2]=ie-(Oe-U)+(Q-U),Xp[3]=Oe;let ct=(function(wa,Tn){let ca=Tn[0];for(let _a=1;_a<wa;_a++)ca+=Tn[_a];return ca})(4,Xp),bt=qP*N;if(ct>=bt||-ct>=bt||(U=m-Ue,O=m-(Ue+U)+(U-k),U=v-He,B=v-(He+U)+(U-k),U=g-De,I=g-(De+U)+(U-_),U=E-ut,M=E-(ut+U)+(U-_),O===0&&I===0&&B===0&&M===0)||(bt=WP*N+jP*Math.abs(ct),ct+=Ue*M+ut*O-(De*B+He*I),ct>=bt||-ct>=bt))return ct;ue=O*ut,z=Qa*O,q=z-(z-O),Y=O-q,z=Qa*ut,K=z-(z-ut),re=ut-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=I*He,z=Qa*I,q=z-(z-I),Y=I-q,z=Qa*He,K=z-(z-He),re=He-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Tr[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Tr[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Tr[2]=ie-(Oe-U)+(Q-U),Tr[3]=Oe;let Nt=KS(4,Xp,4,Tr,eI);ue=Ue*M,z=Qa*Ue,q=z-(z-Ue),Y=Ue-q,z=Qa*M,K=z-(z-M),re=M-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=De*B,z=Qa*De,q=z-(z-De),Y=De-q,z=Qa*B,K=z-(z-B),re=B-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Tr[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Tr[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Tr[2]=ie-(Oe-U)+(Q-U),Tr[3]=Oe;let bn=KS(Nt,eI,4,Tr,tI);ue=O*M,z=Qa*O,q=z-(z-O),Y=O-q,z=Qa*M,K=z-(z-M),re=M-K,fe=Y*re-(ue-q*K-Y*K-q*re),ve=I*B,z=Qa*I,q=z-(z-I),Y=I-q,z=Qa*B,K=z-(z-B),re=B-K,we=Y*re-(ve-q*K-Y*K-q*re),Q=fe-we,U=fe-Q,Tr[0]=fe-(Q+U)+(U-we),ie=ue+Q,U=ie-ue,se=ue-(ie-U)+(Q-U),Q=se-ve,U=se-Q,Tr[1]=se-(Q+U)+(U-ve),Oe=ie+Q,U=Oe-ie,Tr[2]=ie-(Oe-U)+(Q-U),Tr[3]=Oe;let Kt=KS(bn,tI,4,Tr,nI);return nI[Kt-1]})(e,t,n,a,r,i,f)}let aI=Math.pow(2,-52),JE=new Uint32Array(512);class QE{static from(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:KP,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:XP,r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){let u=t[o];i[2*o]=n(u),i[2*o+1]=a(u)}return new QE(i)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let a=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*a),this._halfedges=new Int32Array(3*a),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:a,_hullTri:r,_hullHash:i}=this,o=t.length>>1,u=1/0,c=1/0,f=-1/0,m=-1/0;for(let re=0;re<o;re++){let Q=t[2*re],ie=t[2*re+1];Q<u&&(u=Q),ie<c&&(c=ie),Q>f&&(f=Q),ie>m&&(m=ie),this._ids[re]=re}let g=(u+f)/2,v=(c+m)/2,E,k,_,N=1/0;for(let re=0;re<o;re++){let Q=XS(g,v,t[2*re],t[2*re+1]);Q<N&&(E=re,N=Q)}let O=t[2*E],I=t[2*E+1];N=1/0;for(let re=0;re<o;re++){if(re===E)continue;let Q=XS(O,I,t[2*re],t[2*re+1]);Q<N&&Q>0&&(k=re,N=Q)}let B=t[2*k],M=t[2*k+1],U=1/0;for(let re=0;re<o;re++){if(re===E||re===k)continue;let Q=YP(O,I,B,M,t[2*re],t[2*re+1]);Q<U&&(_=re,U=Q)}let z=t[2*_],q=t[2*_+1];if(U===1/0){for(let ie=0;ie<o;ie++)this._dists[ie]=t[2*ie]-t[0]||t[2*ie+1]-t[1];Zp(this._ids,this._dists,0,o-1);let re=new Uint32Array(o),Q=0;for(let ie=0,se=-1/0;ie<o;ie++){let ue=this._ids[ie];this._dists[ue]>se&&(re[Q++]=ue,se=this._dists[ue])}return this.hull=re.subarray(0,Q),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ZE(O,I,B,M,z,q)<0){let re=k,Q=B,ie=M;k=_,B=z,M=q,_=re,z=Q,q=ie}let Y=(function(re,Q,ie,se,ue,fe){let ve=ie-re,we=se-Q,Oe=ue-re,Ue=fe-Q,He=ve*ve+we*we,De=Oe*Oe+Ue*Ue,ut=.5/(ve*Ue-we*Oe),ct=re+(Ue*He-we*De)*ut,bt=Q+(ve*De-Oe*He)*ut;return{x:ct,y:bt}})(O,I,B,M,z,q);this._cx=Y.x,this._cy=Y.y;for(let re=0;re<o;re++)this._dists[re]=XS(t[2*re],t[2*re+1],Y.x,Y.y);Zp(this._ids,this._dists,0,o-1),this._hullStart=E;let K=3;a[E]=n[_]=k,a[k]=n[E]=_,a[_]=n[k]=E,r[E]=0,r[k]=1,r[_]=2,i.fill(-1),i[this._hashKey(O,I)]=E,i[this._hashKey(B,M)]=k,i[this._hashKey(z,q)]=_,this.trianglesLen=0,this._addTriangle(E,k,_,-1,-1,-1);for(let re,Q,ie=0;ie<this._ids.length;ie++){let se=this._ids[ie],ue=t[2*se],fe=t[2*se+1];if(ie>0&&Math.abs(ue-re)<=aI&&Math.abs(fe-Q)<=aI||(re=ue,Q=fe,se===E||se===k||se===_))continue;let ve=0;for(let De=0,ut=this._hashKey(ue,fe);De<this._hashSize&&(ve=i[(ut+De)%this._hashSize],ve===-1||ve===a[ve]);De++);ve=n[ve];let we,Oe=ve;for(;we=a[Oe],ZE(ue,fe,t[2*Oe],t[2*Oe+1],t[2*we],t[2*we+1])>=0;)if(Oe=we,Oe===ve){Oe=-1;break}if(Oe===-1)continue;let Ue=this._addTriangle(Oe,se,a[Oe],-1,-1,r[Oe]);r[se]=this._legalize(Ue+2),r[Oe]=Ue,K++;let He=a[Oe];for(;we=a[He],ZE(ue,fe,t[2*He],t[2*He+1],t[2*we],t[2*we+1])<0;)Ue=this._addTriangle(He,se,we,r[se],-1,r[He]),r[se]=this._legalize(Ue+2),a[He]=He,K--,He=we;if(Oe===ve)for(;we=n[Oe],ZE(ue,fe,t[2*we],t[2*we+1],t[2*Oe],t[2*Oe+1])<0;)Ue=this._addTriangle(we,se,Oe,-1,r[Oe],r[we]),this._legalize(Ue+2),r[we]=Ue,a[Oe]=Oe,K--,Oe=we;this._hullStart=n[se]=Oe,a[Oe]=n[He]=se,a[se]=He,i[this._hashKey(ue,fe)]=se,i[this._hashKey(t[2*Oe],t[2*Oe+1])]=Oe}this.hull=new Uint32Array(K);for(let re=0,Q=this._hullStart;re<K;re++)this.hull[re]=Q,Q=a[Q];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor((function(a,r){let i=a/(Math.abs(a)+Math.abs(r));return(r>0?3-i:1+i)/4})(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:a,coords:r}=this,i=0,o=0;for(;;){let u=a[t],c=t-t%3;if(o=c+(t+2)%3,u===-1){if(i===0)break;t=JE[--i];continue}let f=u-u%3,m=c+(t+1)%3,g=f+(u+2)%3,v=n[o],E=n[t],k=n[m],_=n[g];if(VP(r[2*v],r[2*v+1],r[2*E],r[2*E+1],r[2*k],r[2*k+1],r[2*_],r[2*_+1])){n[t]=_,n[u]=v;let N=a[g];if(N===-1){let I=this._hullStart;do{if(this._hullTri[I]===g){this._hullTri[I]=t;break}I=this._hullPrev[I]}while(I!==this._hullStart)}this._link(t,N),this._link(u,a[o]),this._link(o,g);let O=f+(u+1)%3;i<JE.length&&(JE[i++]=O)}else{if(i===0)break;t=JE[--i]}}return o}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,a,r,i,o){let u=this.trianglesLen;return this._triangles[u]=t,this._triangles[u+1]=n,this._triangles[u+2]=a,this._link(u,r),this._link(u+1,i),this._link(u+2,o),this.trianglesLen+=3,u}}function XS(e,t,n,a){let r=e-n,i=t-a;return r*r+i*i}function VP(e,t,n,a,r,i,o,u){let c=e-o,f=t-u,m=n-o,g=a-u,v=r-o,E=i-u,k=m*m+g*g,_=v*v+E*E;return c*(g*_-k*E)-f*(m*_-k*v)+(c*c+f*f)*(m*E-g*v)<0}function YP(e,t,n,a,r,i){let o=n-e,u=a-t,c=r-e,f=i-t,m=o*o+u*u,g=c*c+f*f,v=.5/(o*f-u*c),E=(f*m-u*g)*v,k=(o*g-c*m)*v;return E*E+k*k}function Zp(e,t,n,a){if(a-n<=20)for(let r=n+1;r<=a;r++){let i=e[r],o=t[i],u=r-1;for(;u>=n&&t[e[u]]>o;)e[u+1]=e[u--];e[u+1]=i}else{let r=n+1,i=a;Mb(e,n+a>>1,r),t[e[n]]>t[e[a]]&&Mb(e,n,a),t[e[r]]>t[e[a]]&&Mb(e,r,a),t[e[n]]>t[e[r]]&&Mb(e,n,r);let o=e[r],u=t[o];for(;;){do r++;while(t[e[r]]<u);do i--;while(t[e[i]]>u);if(i<r)break;Mb(e,r,i)}e[n+1]=e[i],e[i]=o,a-r+1>=i-n?(Zp(e,t,r,a),Zp(e,t,n,i-1)):(Zp(e,t,n,i-1),Zp(e,t,r,a))}}function Mb(e,t,n){let a=e[t];e[t]=e[n],e[n]=a}function KP(e){return e[0]}function XP(e){return e[1]}let rI=1e-6;class yd{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,a){let r=(t=+t)+(a=+a),i=n=+n;if(a<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>rI||Math.abs(this._y1-i)>rI)&&(this._+="L"+r+","+i),a&&(this._+=`A${a},${a},0,1,1,${t-a},${n}A${a},${a},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,a,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+a}v${+r}h${-a}Z`}value(){return this._||null}}class ZS{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let ZP=2*Math.PI,Jp=Math.pow;function JP(e){return e[0]}function QP(e){return e[1]}function e$(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class JS{static from(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:JP,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:QP,r=arguments.length>3?arguments[3]:void 0;return new JS("length"in t?(function(i,o,u,c){let f=i.length,m=new Float64Array(2*f);for(let g=0;g<f;++g){let v=i[g];m[2*g]=o.call(c,v,g,i),m[2*g+1]=u.call(c,v,g,i)}return m})(t,n,a,r):Float64Array.from((function*(i,o,u,c){let f=0;for(let m of i)yield o.call(c,m,f,i),yield u.call(c,m,f,i),++f})(t,n,a,r)))}constructor(t){this._delaunator=new QE(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(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&(function(c){let{triangles:f,coords:m}=c;for(let g=0;g<f.length;g+=3){let v=2*f[g],E=2*f[g+1],k=2*f[g+2];if((m[k]-m[v])*(m[E+1]-m[v+1])-(m[E]-m[v])*(m[k+1]-m[v+1])>1e-10)return!1}return!0})(t)){this.collinear=Int32Array.from({length:n.length/2},((v,E)=>E)).sort(((v,E)=>n[2*v]-n[2*E]||n[2*v+1]-n[2*E+1]));let c=this.collinear[0],f=this.collinear[this.collinear.length-1],m=[n[2*c],n[2*c+1],n[2*f],n[2*f+1]],g=1e-8*Math.hypot(m[3]-m[1],m[2]-m[0]);for(let v=0,E=n.length/2;v<E;++v){let k=e$(n[2*v],n[2*v+1],g);n[2*v]=k[0],n[2*v+1]=k[1]}this._delaunator=new QE(n)}else delete this.collinear;let a=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),u=this._hullIndex.fill(-1);for(let c=0,f=a.length;c<f;++c){let m=i[c%3==2?c-2:c+1];a[c]!==-1&&o[m]!==-1||(o[m]=c)}for(let c=0,f=r.length;c<f;++c)u[r[c]]=c;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],o[r[0]]=1,r.length===2&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new class{constructor(n){let[a,r,i,o]=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,960,500];if(!((i=+i)>=(a=+a)&&(o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=n,this._circumcenters=new Float64Array(2*n.points.length),this.vectors=new Float64Array(2*n.points.length),this.xmax=i,this.xmin=a,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:n,hull:a,triangles:r},vectors:i}=this,o,u,c=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let N,O,I=0,B=0,M=r.length;I<M;I+=3,B+=2){let U=2*r[I],z=2*r[I+1],q=2*r[I+2],Y=n[U],K=n[U+1],re=n[z],Q=n[z+1],ie=n[q],se=n[q+1],ue=re-Y,fe=Q-K,ve=ie-Y,we=se-K,Oe=2*(ue*we-fe*ve);if(Math.abs(Oe)<1e-9){if(o===void 0){o=u=0;for(let He of a)o+=n[2*He],u+=n[2*He+1];o/=a.length,u/=a.length}let Ue=1e9*Math.sign((o-Y)*we-(u-K)*ve);N=(Y+ie)/2-Ue*we,O=(K+se)/2+Ue*ve}else{let Ue=1/Oe,He=ue*ue+fe*fe,De=ve*ve+we*we;N=Y+(we*He-fe*De)*Ue,O=K+(ue*De-ve*He)*Ue}c[B]=N,c[B+1]=O}let f,m,g,v=a[a.length-1],E=4*v,k=n[2*v],_=n[2*v+1];i.fill(0);for(let N=0;N<a.length;++N)v=a[N],f=E,m=k,g=_,E=4*v,k=n[2*v],_=n[2*v+1],i[f+2]=i[E]=g-_,i[f+3]=i[E+1]=k-m}render(n){let a=n==null?n=new yd:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:u,vectors:c}=this;if(o.length<=1)return null;for(let g=0,v=r.length;g<v;++g){let E=r[g];if(E<g)continue;let k=2*Math.floor(g/3),_=2*Math.floor(E/3),N=u[k],O=u[k+1],I=u[_],B=u[_+1];this._renderSegment(N,O,I,B,n)}let f,m=o[o.length-1];for(let g=0;g<o.length;++g){f=m,m=o[g];let v=2*Math.floor(i[m]/3),E=u[v],k=u[v+1],_=4*f,N=this._project(E,k,c[_+2],c[_+3]);N&&this._renderSegment(E,k,N[0],N[1],n)}return a&&a.value()}renderBounds(n){let a=n==null?n=new yd:void 0;return n.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),a&&a.value()}renderCell(n,a){let r=a==null?a=new yd:void 0,i=this._clip(n);if(i===null||!i.length)return;a.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let u=2;u<o;u+=2)i[u]===i[u-2]&&i[u+1]===i[u-1]||a.lineTo(i[u],i[u+1]);return a.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:n}}=this;for(let a=0,r=n.length/2;a<r;++a){let i=this.cellPolygon(a);i&&(i.index=a,yield i)}}cellPolygon(n){let a=new ZS;return this.renderCell(n,a),a.value()}_renderSegment(n,a,r,i,o){let u,c=this._regioncode(n,a),f=this._regioncode(r,i);c===0&&f===0?(o.moveTo(n,a),o.lineTo(r,i)):(u=this._clipSegment(n,a,r,i,c,f))&&(o.moveTo(u[0],u[1]),o.lineTo(u[2],u[3]))}contains(n,a,r){return(a=+a)==a&&(r=+r)==r&&this.delaunay._step(n,a,r)===n}*neighbors(n){let a=this._clip(n);if(a)for(let r of this.delaunay.neighbors(n)){let i=this._clip(r);if(i){e:for(let o=0,u=a.length;o<u;o+=2)for(let c=0,f=i.length;c<f;c+=2)if(a[o]===i[c]&&a[o+1]===i[c+1]&&a[(o+2)%u]===i[(c+f-2)%f]&&a[(o+3)%u]===i[(c+f-1)%f]){yield r;break e}}}}_cell(n){let{circumcenters:a,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,u=r[n];if(u===-1)return null;let c=[],f=u;do{let m=Math.floor(f/3);if(c.push(a[2*m],a[2*m+1]),f=f%3==2?f-2:f+1,o[f]!==n)break;f=i[f]}while(f!==u&&f!==-1);return c}_clip(n){if(n===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let a=this._cell(n);if(a===null)return null;let{vectors:r}=this,i=4*n;return this._simplify(r[i]||r[i+1]?this._clipInfinite(n,a,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(n,a))}_clipFinite(n,a){let r=a.length,i,o,u,c,f=null,m=a[r-2],g=a[r-1],v=this._regioncode(m,g),E=0;for(let k=0;k<r;k+=2)if(i=m,o=g,m=a[k],g=a[k+1],u=v,v=this._regioncode(m,g),u===0&&v===0)c=E,E=0,f?f.push(m,g):f=[m,g];else{let _,N,O,I,B;if(u===0){if((_=this._clipSegment(i,o,m,g,u,v))===null)continue;[N,O,I,B]=_}else{if((_=this._clipSegment(m,g,i,o,v,u))===null)continue;[I,B,N,O]=_,c=E,E=this._edgecode(N,O),c&&E&&this._edge(n,c,E,f,f.length),f?f.push(N,O):f=[N,O]}c=E,E=this._edgecode(I,B),c&&E&&this._edge(n,c,E,f,f.length),f?f.push(I,B):f=[I,B]}if(f)c=E,E=this._edgecode(f[0],f[1]),c&&E&&this._edge(n,c,E,f,f.length);else if(this.contains(n,(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 f}_clipSegment(n,a,r,i,o,u){let c=o<u;for(c&&([n,a,r,i,o,u]=[r,i,n,a,u,o]);;){if(o===0&&u===0)return c?[r,i,n,a]:[n,a,r,i];if(o&u)return null;let f,m,g=o||u;8&g?(f=n+(r-n)*(this.ymax-a)/(i-a),m=this.ymax):4&g?(f=n+(r-n)*(this.ymin-a)/(i-a),m=this.ymin):2&g?(m=a+(i-a)*(this.xmax-n)/(r-n),f=this.xmax):(m=a+(i-a)*(this.xmin-n)/(r-n),f=this.xmin),o?(n=f,a=m,o=this._regioncode(n,a)):(r=f,i=m,u=this._regioncode(r,i))}}_clipInfinite(n,a,r,i,o,u){let c,f=Array.from(a);if((c=this._project(f[0],f[1],r,i))&&f.unshift(c[0],c[1]),(c=this._project(f[f.length-2],f[f.length-1],o,u))&&f.push(c[0],c[1]),f=this._clipFinite(n,f))for(let m,g=0,v=f.length,E=this._edgecode(f[v-2],f[v-1]);g<v;g+=2)m=E,E=this._edgecode(f[g],f[g+1]),m&&E&&(g=this._edge(n,m,E,f,g),v=f.length);else this.contains(n,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(f=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return f}_edge(n,a,r,i,o){for(;a!==r;){let u,c;switch(a){case 5:a=4;continue;case 4:a=6,u=this.xmax,c=this.ymin;break;case 6:a=2;continue;case 2:a=10,u=this.xmax,c=this.ymax;break;case 10:a=8;continue;case 8:a=9,u=this.xmin,c=this.ymax;break;case 9:a=1;continue;case 1:a=5,u=this.xmin,c=this.ymin}i[o]===u&&i[o+1]===c||!this.contains(n,u,c)||(i.splice(o,0,u,c),o+=2)}return o}_project(n,a,r,i){let o,u,c,f=1/0;if(i<0){if(a<=this.ymin)return null;(o=(this.ymin-a)/i)<f&&(c=this.ymin,u=n+(f=o)*r)}else if(i>0){if(a>=this.ymax)return null;(o=(this.ymax-a)/i)<f&&(c=this.ymax,u=n+(f=o)*r)}if(r>0){if(n>=this.xmax)return null;(o=(this.xmax-n)/r)<f&&(u=this.xmax,c=a+(f=o)*i)}else if(r<0){if(n<=this.xmin)return null;(o=(this.xmin-n)/r)<f&&(u=this.xmin,c=a+(f=o)*i)}return[u,c]}_edgecode(n,a){return(n===this.xmin?1:n===this.xmax?2:0)|(a===this.ymin?4:a===this.ymax?8:0)}_regioncode(n,a){return(n<this.xmin?1:n>this.xmax?2:0)|(a<this.ymin?4:a>this.ymax?8:0)}_simplify(n){if(n&&n.length>4){for(let a=0;a<n.length;a+=2){let r=(a+2)%n.length,i=(a+4)%n.length;(n[a]===n[r]&&n[r]===n[i]||n[a+1]===n[r+1]&&n[r+1]===n[i+1])&&(n.splice(r,2),a-=2)}n.length||(n=null)}return n}}(this,t)}*neighbors(t){let{inedges:n,hull:a,_hullIndex:r,halfedges:i,triangles:o,collinear:u}=this;if(u){let g=u.indexOf(t);return g>0&&(yield u[g-1]),void(g<u.length-1&&(yield u[g+1]))}let c=n[t];if(c===-1)return;let f=c,m=-1;do{if(yield m=o[f],f=f%3==2?f-2:f+1,o[f]!==t)return;if(f=i[f],f===-1){let g=a[(r[t]+1)%a.length];return void(g!==m&&(yield g))}}while(f!==c)}find(t,n){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;if((t=+t)!=t||(n=+n)!=n)return-1;let r=a,i;for(;(i=this._step(a,t,n))>=0&&i!==a&&i!==r;)a=i;return i}_step(t,n,a){let{inedges:r,hull:i,_hullIndex:o,halfedges:u,triangles:c,points:f}=this;if(r[t]===-1||!f.length)return(t+1)%(f.length>>1);let m=t,g=Jp(n-f[2*t],2)+Jp(a-f[2*t+1],2),v=r[t],E=v;do{let k=c[E],_=Jp(n-f[2*k],2)+Jp(a-f[2*k+1],2);if(_<g&&(g=_,m=k),E=E%3==2?E-2:E+1,c[E]!==t)break;if(E=u[E],E===-1){if(E=i[(o[t]+1)%i.length],E!==k&&Jp(n-f[2*E],2)+Jp(a-f[2*E+1],2)<g)return E;break}}while(E!==v);return m}render(t){let n=t==null?t=new yd:void 0,{points:a,halfedges:r,triangles:i}=this;for(let o=0,u=r.length;o<u;++o){let c=r[o];if(c<o)continue;let f=2*i[o],m=2*i[c];t.moveTo(a[f],a[f+1]),t.lineTo(a[m],a[m+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n!==void 0||t&&typeof t.moveTo=="function"||(n=t,t=null),n=n==null?2:+n;let a=t==null?t=new yd:void 0,{points:r}=this;for(let i=0,o=r.length;i<o;i+=2){let u=r[i],c=r[i+1];t.moveTo(u+n,c),t.arc(u,c,n,0,ZP)}return a&&a.value()}renderHull(t){let n=t==null?t=new yd:void 0,{hull:a,points:r}=this,i=2*a[0],o=a.length;t.moveTo(r[i],r[i+1]);for(let u=1;u<o;++u){let c=2*a[u];t.lineTo(r[c],r[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new ZS;return this.renderHull(t),t.value()}renderTriangle(t,n){let a=n==null?n=new yd:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],u=2*i[t+1],c=2*i[t+2];return n.moveTo(r[o],r[o+1]),n.lineTo(r[u],r[u+1]),n.lineTo(r[c],r[c+1]),n.closePath(),a&&a.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,a=t.length/3;n<a;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new ZS;return this.renderTriangle(t,n),n.value()}}function QS(e){Se.call(this,null,e)}QS.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"}]};let t$=[-1e5,-1e5,1e5,1e5];function n$(e){let t=e[0][0],n=e[0][1],a=e.length-1;for(;e[a][0]===t&&e[a][1]===n;--a);return"M"+e.slice(0,a+1).join("L")+"Z"}Fe(QS,Se,{transform(e,t){let n=e.as||"path",a=t.source;if(!a||!a.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:t$;let i=this.value=JS.from(a,e.x,e.y).voronoi(r);for(let o=0,u=a.length;o<u;++o){let c=i.cellPolygon(o);a[o][n]=c?n$(c):null}return t.reflow(e.modified()).modifies(n)}});var a$=Object.freeze({__proto__:null,voronoi:QS}),ex=Math.PI/180,Lb=64,ew=2048;function r$(){var e,t,n,a,r,i,o,u=[256,256],c=iI,f=[],m=Math.random,g={};function v(E,k,_){for(var N,O,I,B=k.x,M=k.y,U=Math.hypot(u[0],u[1]),z=c(u),q=m()<.5?1:-1,Y=-q;(N=z(Y+=q))&&(O=~~N[0],I=~~N[1],!(Math.min(Math.abs(O),Math.abs(I))>=U));)if(k.x=B+O,k.y=M+I,!(k.x+k.x0<0||k.y+k.y0<0||k.x+k.x1>u[0]||k.y+k.y1>u[1])&&(!_||!o$(k,E,u[0]))&&(!_||l$(k,_))){for(var K,re=k.sprite,Q=k.width>>5,ie=u[0]>>5,se=k.x-(Q<<4),ue=127&se,fe=32-ue,ve=k.y1-k.y0,we=(k.y+k.y0)*ie+(se>>5),Oe=0;Oe<ve;Oe++){K=0;for(var Ue=0;Ue<=Q;Ue++)E[we+Ue]|=K<<fe|(Ue<Q?(K=re[Oe*Q+Ue])>>>ue:0);we+=ie}return k.sprite=null,!0}return!1}return g.layout=function(){for(var E=(function(U){U.width=U.height=1;var z=Math.sqrt(U.getContext("2d").getImageData(0,0,1,1).data.length>>2);U.width=(Lb<<5)/z,U.height=ew/z;var q=U.getContext("2d");return q.fillStyle=q.strokeStyle="red",q.textAlign="center",{context:q,ratio:z}})(Wa()),k=(function(U){for(var z=[],q=-1;++q<U;)z[q]=0;return z})((u[0]>>5)*u[1]),_=null,N=f.length,O=-1,I=[],B=f.map((U=>({text:e(U),font:t(U),style:a(U),weight:r(U),rotate:i(U),size:~~(n(U)+1e-14),padding:o(U),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:U}))).sort(((U,z)=>z.size-U.size));++O<N;){var M=B[O];M.x=u[0]*(m()+.5)>>1,M.y=u[1]*(m()+.5)>>1,i$(E,M,B,O),M.hasText&&v(k,M,_)&&(I.push(M),_?s$(_,M):_=[{x:M.x+M.x0,y:M.y+M.y0},{x:M.x+M.x1,y:M.y+M.y1}],M.x-=u[0]>>1,M.y-=u[1]>>1)}return I},g.words=function(E){return arguments.length?(f=E,g):f},g.size=function(E){return arguments.length?(u=[+E[0],+E[1]],g):u},g.font=function(E){return arguments.length?(t=vd(E),g):t},g.fontStyle=function(E){return arguments.length?(a=vd(E),g):a},g.fontWeight=function(E){return arguments.length?(r=vd(E),g):r},g.rotate=function(E){return arguments.length?(i=vd(E),g):i},g.text=function(E){return arguments.length?(e=vd(E),g):e},g.spiral=function(E){return arguments.length?(c=u$[E]||E,g):c},g.fontSize=function(E){return arguments.length?(n=vd(E),g):n},g.padding=function(E){return arguments.length?(o=vd(E),g):o},g.random=function(E){return arguments.length?(m=E,g):m},g}function i$(e,t,n,a){if(!t.sprite){var r=e.context,i=e.ratio;r.clearRect(0,0,(Lb<<5)/i,ew/i);var o,u,c,f,m,g=0,v=0,E=0,k=n.length;for(--a;++a<k;){if(t=n[a],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/i)+"px "+t.font,o=r.measureText(t.text+"m").width*i,c=t.size<<1,t.rotate){var _=Math.sin(t.rotate*ex),N=Math.cos(t.rotate*ex),O=o*N,I=o*_,B=c*N,M=c*_;o=Math.max(Math.abs(O+M),Math.abs(O-M))+31>>5<<5,c=~~Math.max(Math.abs(I+B),Math.abs(I-B))}else o=o+31>>5<<5;if(c>E&&(E=c),g+o>=Lb<<5&&(g=0,v+=E,E=0),v+c>=ew)break;r.translate((g+(o>>1))/i,(v+(c>>1))/i),t.rotate&&r.rotate(t.rotate*ex),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=o,t.height=c,t.xoff=g,t.yoff=v,t.x1=o>>1,t.y1=c>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,g+=o}for(var U=r.getImageData(0,0,(Lb<<5)/i,ew/i).data,z=[];--a>=0;)if((t=n[a]).hasText){for(u=(o=t.width)>>5,c=t.y1-t.y0,f=0;f<c*u;f++)z[f]=0;if((g=t.xoff)==null)return;v=t.yoff;var q=0,Y=-1;for(m=0;m<c;m++){for(f=0;f<o;f++){var K=u*m+(f>>5),re=U[(v+m)*(Lb<<5)+(g+f)<<2]?1<<31-f%32:0;z[K]|=re,q|=re}q?Y=m:(t.y0++,c--,m--,v++)}t.y1=t.y0+Y,t.sprite=z.slice(0,(t.y1-t.y0)*u)}}}function o$(e,t,n){n>>=5;for(var a,r=e.sprite,i=e.width>>5,o=e.x-(i<<4),u=127&o,c=32-u,f=e.y1-e.y0,m=(e.y+e.y0)*n+(o>>5),g=0;g<f;g++){a=0;for(var v=0;v<=i;v++)if((a<<c|(v<i?(a=r[g*i+v])>>>u:0))&t[m+v])return!0;m+=n}return!1}function s$(e,t){var n=e[0],a=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>a.x&&(a.x=t.x+t.x1),t.y+t.y1>a.y&&(a.y=t.y+t.y1)}function l$(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function iI(e){var t=e[0]/e[1];return function(n){return[t*(n*=.1)*Math.cos(n),n*Math.sin(n)]}}function vd(e){return typeof e=="function"?e:function(){return e}}var u$={archimedean:iI,rectangular:function(e){var t=4*e[0]/e[1],n=0,a=0;return function(r){var i=r<0?-1:1;switch(Math.sqrt(1+4*i*r)-i&3){case 0:n+=t;break;case 1:a+=4;break;case 2:n-=t;break;default:a-=4}return[n,a]}}};let oI=["x","y","font","fontSize","fontStyle","fontWeight","angle"],c$=["text","font","rotate","fontSize","fontStyle","fontWeight"];function tx(e){Se.call(this,r$(),e)}tx.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:oI}]},Fe(tx,Se,{transform(e,t){!e.size||e.size[0]&&e.size[1]||F("Wordcloud size dimensions must be non-zero.");let n=e.modified();if(!(n||t.changed(t.ADD_REM)||c$.some((function(E){let k=e[E];return tt(k)&&t.modified(k.fields)}))))return;let a=t.materialize(t.SOURCE).source,r=this.value,i=e.as||oI,o,u=e.fontSize||14;if(tt(u)?o=e.fontSizeRange:u=mn(u),o){let E=u,k=Bt("sqrt")().domain(Un(a,E)).range(o);u=_=>k(E(_))}a.forEach((E=>{E[i[0]]=NaN,E[i[1]]=NaN,E[i[3]]=0}));let c=r.words(a).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(u).random(p.random).layout(),f=r.size(),m=f[0]>>1,g=f[1]>>1,v=c.length;for(let E,k,_=0;_<v;++_)E=c[_],k=E.datum,k[i[0]]=E.x+m,k[i[1]]=E.y+g,k[i[2]]=E.font,k[i[3]]=E.size,k[i[4]]=E.style,k[i[5]]=E.weight,k[i[6]]=E.rotate;return t.reflow(n).modifies(i)}});var d$=Object.freeze({__proto__:null,wordcloud:tx});let f$=e=>new Uint8Array(e),p$=e=>new Uint16Array(e),Fb=e=>new Uint32Array(e);function tw(e,t,n){let a=(t<257?f$:t<65537?p$:Fb)(e);return n&&a.set(n),a}function sI(e,t,n){let a=1<<t;return{one:a,zero:~a,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(r,i){let o=this,u=o.bisect(o.range,r.value),c=r.index,f=u[0],m=u[1],g=c.length,v;for(v=0;v<f;++v)i[c[v]]|=a;for(v=m;v<g;++v)i[c[v]]|=a;return o}}}function lI(){let e=Fb(0),t=[],n=0;return{insert:function(a,r,i){if(!r.length)return[];let o=n,u=r.length,c=Fb(u),f,m,g,v=Array(u);for(g=0;g<u;++g)v[g]=a(r[g]),c[g]=g;if(v=(function(E,k){return E.sort.call(k,((_,N)=>{let O=E[_],I=E[N];return O<I?-1:O>I?1:0})),(function(_,N){return Array.from(N,(O=>_[O]))})(E,k)})(v,c),o)f=t,m=e,t=Array(o+u),e=Fb(o+u),(function(E,k,_,N,O,I,B,M,U){let z,q=0,Y=0;for(z=0;q<N&&Y<B;++z)k[q]<O[Y]?(M[z]=k[q],U[z]=_[q++]):(M[z]=O[Y],U[z]=I[Y++]+E);for(;q<N;++q,++z)M[z]=k[q],U[z]=_[q];for(;Y<B;++Y,++z)M[z]=O[Y],U[z]=I[Y]+E})(i,f,m,o,v,c,u,t,e);else{if(i>0)for(g=0;g<u;++g)c[g]+=i;t=v,e=c}return n=o+u,{index:c,value:v}},remove:function(a,r){let i=n,o,u,c;for(u=0;!r[e[u]]&&u<i;++u);for(c=u;u<i;++u)r[o=e[u]]||(e[c]=o,t[c]=t[u],++c);n=i-a},bisect:function(a,r){let i;return r?i=r.length:(r=t,i=n),[v_(r,a[0],0,i),Ul(r,a[1],0,i)]},reindex:function(a){for(let r=0,i=n;r<i;++r)e[r]=a[e[r]]},index:()=>e,size:()=>n}}function nx(e){Se.call(this,(function(){let t=8,n=[],a=Fb(0),r=tw(0,t),i=tw(0,t);return{data:()=>n,seen:()=>a=(function(o,u,c){return o.length>=u?o:((c=c||new o.constructor(u)).set(o),c)})(a,n.length),add(o){for(let u,c=0,f=n.length,m=o.length;c<m;++c)u=o[c],u._index=f++,n.push(u)},remove(o,u){let c=n.length,f=Array(c-o),m=n,g,v,E;for(v=0;!u[v]&&v<c;++v)f[v]=n[v],m[v]=v;for(E=v;v<c;++v)g=n[v],u[v]?m[v]=-1:(m[v]=E,r[E]=r[v],i[E]=i[v],f[E]=g,g._index=E++),r[v]=0;return n=f,m},size:()=>n.length,curr:()=>r,prev:()=>i,reset:o=>i[o]=r[o],all:()=>t<257?255:t<65537?65535:4294967295,set(o,u){r[o]|=u},clear(o,u){r[o]&=~u},resize(o,u){(o>r.length||u>t)&&(t=Math.max(u,t),r=tw(o,t,r),i=tw(o,t))}}})(),e),this._indices=null,this._dims=null}function ax(e){Se.call(this,null,e)}nx.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}}]},Fe(nx,Se,{transform(e,t){return this._dims?e.modified("fields")||e.fields.some((n=>t.modified(n.fields)))?this.reinit(e,t):this.eval(e,t):this.init(e,t)},init(e,t){let n=e.fields,a=e.query,r=this._indices={},i=this._dims=[],o=a.length,u,c,f=0;for(;f<o;++f)u=n[f].fname,c=r[u]||(r[u]=lI()),i.push(sI(c,f,a[f]));return this.eval(e,t)},reinit(e,t){let n=t.materialize().fork(),a=e.fields,r=e.query,i=this._indices,o=this._dims,u=this.value,c=u.curr(),f=u.prev(),m=u.all(),g=n.rem=n.add,v=n.mod,E=r.length,k={},_,N,O,I,B,M,U,z,q;if(f.set(c),t.rem.length&&(B=this.remove(e,t,n)),t.add.length&&u.add(t.add),t.mod.length)for(M={},I=t.mod,U=0,z=I.length;U<z;++U)M[I[U]._index]=1;for(U=0;U<E;++U)q=a[U],(!o[U]||e.modified("fields",U)||t.modified(q.fields))&&(O=q.fname,(_=k[O])||(i[O]=N=lI(),k[O]=_=N.insert(q,t.source,0)),o[U]=sI(N,U,r[U]).onAdd(_,c));for(U=0,z=u.data().length;U<z;++U)B[U]||(f[U]!==c[U]?g.push(U):M[U]&&c[U]!==m&&v.push(U));return u.mask=(1<<E)-1,n},eval(e,t){let n=t.materialize().fork(),a=this._dims.length,r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<a)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<a)-1),t.mod.length&&(this.modify(t,n),r|=(1<<a)-1),this.value.mask=r,n},insert(e,t,n){let a=t.add,r=this.value,i=this._dims,o=this._indices,u=e.fields,c={},f=n.add,m=r.size()+a.length,g=i.length,v,E,k,_=r.size();r.resize(m,g),r.add(a);let N=r.curr(),O=r.prev(),I=r.all();for(v=0;v<g;++v)E=u[v].fname,k=c[E]||(c[E]=o[E].insert(u[v],a,_)),i[v].onAdd(k,N);for(;_<m;++_)O[_]=I,N[_]!==I&&f.push(_)},modify(e,t){let n=t.mod,a=this.value,r=a.curr(),i=a.all(),o=e.mod,u,c,f;for(u=0,c=o.length;u<c;++u)f=o[u]._index,r[f]!==i&&n.push(f)},remove(e,t,n){let a=this._indices,r=this.value,i=r.curr(),o=r.prev(),u=r.all(),c={},f=n.rem,m=t.rem,g,v,E,k;for(g=0,v=m.length;g<v;++g)E=m[g]._index,c[E]=1,o[E]=k=i[E],i[E]=u,k!==u&&f.push(E);for(E in a)a[E].remove(v,c);return this.reindex(t,v,c),c},reindex(e,t,n){let a=this._indices,r=this.value;e.runAfter((()=>{let i=r.remove(t,n);for(let o in a)a[o].reindex(i)}))},update(e,t,n){let a=this._dims,r=e.query,i=t.stamp,o=a.length,u,c,f=0;for(n.filters=0,c=0;c<o;++c)e.modified("query",c)&&(u=c,++f);if(f===1)f=a[u].one,this.incrementOne(a[u],r[u],n.add,n.rem);else for(c=0,f=0;c<o;++c)e.modified("query",c)&&(f|=a[c].one,this.incrementAll(a[c],r[c],i,n.add),n.rem=n.add);return f},incrementAll(e,t,n,a){let r=this.value,i=r.seen(),o=r.curr(),u=r.prev(),c=e.index(),f=e.bisect(e.range),m=e.bisect(t),g=m[0],v=m[1],E=f[0],k=f[1],_=e.one,N,O,I;if(g<E)for(N=g,O=Math.min(E,v);N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;else if(g>E)for(N=E,O=Math.min(g,k);N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;if(v>k)for(N=Math.max(g,k),O=v;N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;else if(v<k)for(N=Math.max(E,v),O=k;N<O;++N)I=c[N],i[I]!==n&&(u[I]=o[I],i[I]=n,a.push(I)),o[I]^=_;e.range=t.slice()},incrementOne(e,t,n,a){let r=this.value.curr(),i=e.index(),o=e.bisect(e.range),u=e.bisect(t),c=u[0],f=u[1],m=o[0],g=o[1],v=e.one,E,k,_;if(c<m)for(E=c,k=Math.min(m,f);E<k;++E)_=i[E],r[_]^=v,n.push(_);else if(c>m)for(E=m,k=Math.min(c,g);E<k;++E)_=i[E],r[_]^=v,a.push(_);if(f>g)for(E=Math.max(c,g),k=f;E<k;++E)_=i[E],r[_]^=v,n.push(_);else if(f<g)for(E=Math.max(m,f),k=g;E<k;++E)_=i[E],r[_]^=v,a.push(_);e.range=t.slice()}}),ax.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."}]},Fe(ax,Se,{transform(e,t){let n=~(e.ignore||0),a=e.filter,r=a.mask;if((r&n)==0)return t.StopPropagation;let i=t.fork(t.ALL),o=a.data(),u=a.curr(),c=a.prev(),f=m=>u[m]&n?null:o[m];return i.filter(i.MOD,f),r&r-1?(i.filter(i.ADD,(m=>{let g=u[m]&n;return!g&&g^c[m]&n?o[m]:null})),i.filter(i.REM,(m=>{let g=u[m]&n;return g&&!(g^g^c[m]&n)?o[m]:null}))):(i.filter(i.ADD,f),i.filter(i.REM,(m=>(u[m]&n)===r?o[m]:null))),i.filter(i.SOURCE,(m=>f(m._index)))}});var h$=Object.freeze({__proto__:null,crossfilter:nx,resolvefilter:ax});let Qp="Literal",m$="Property",g$="ArrayExpression",b$="BinaryExpression",uI="CallExpression",y$="ConditionalExpression",v$="LogicalExpression",E$="MemberExpression",w$="ObjectExpression",_$="UnaryExpression";function qo(e){this.type=e}var Nl,ot,Ne,er,en;qo.prototype.visit=function(e){let t,n,a;if(e(this))return 1;for(t=(function(r){switch(r.type){case g$:return r.elements;case b$:case v$:return[r.left,r.right];case uI:return[r.callee].concat(r.arguments);case y$:return[r.test,r.consequent,r.alternate];case E$:return[r.object,r.property];case w$:return r.properties;case m$:return[r.key,r.value];case _$:return[r.argument];default:return[]}})(this),n=0,a=t.length;n<a;++n)if(t[n].visit(e))return 1};var nw=1,Pb=2,Ed=3,qu=4,aw=5,wd=6,jr=7,$b=8;(Nl={})[nw]="Boolean",Nl[Pb]="<end>",Nl[Ed]="Identifier",Nl[qu]="Keyword",Nl[aw]="Null",Nl[wd]="Numeric",Nl[jr]="Punctuator",Nl[$b]="String",Nl[9]="RegularExpression";var k$="ArrayExpression",S$="BinaryExpression",x$="CallExpression",A$="ConditionalExpression",cI="Identifier",T$="Literal",C$="LogicalExpression",R$="MemberExpression",N$="ObjectExpression",I$="Property",O$="UnaryExpression",ya="Unexpected token %0",D$="Unexpected number",M$="Unexpected string",L$="Unexpected identifier",F$="Unexpected reserved word",P$="Unexpected end of input",rx="Invalid regular expression",ix="Invalid regular expression: missing /",dI="Octal literals are not allowed in strict mode.",$$="Duplicate data property in object literal not allowed in strict mode",La="ILLEGAL",Bb="Disabled.",B$=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]"),U$=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 rw(e,t){if(!e)throw new Error("ASSERT: "+t)}function Il(e){return e>=48&&e<=57}function ox(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function Ub(e){return"01234567".indexOf(e)>=0}function z$(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function zb(e){return e===10||e===13||e===8232||e===8233}function Gb(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&B$.test(String.fromCharCode(e))}function iw(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&U$.test(String.fromCharCode(e))}let G$={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 fI(){for(;Ne<er;){let e=ot.charCodeAt(Ne);if(!z$(e)&&!zb(e))break;++Ne}}function sx(e){var t,n,a,r=0;for(n=e==="u"?4:2,t=0;t<n;++t)Ne<er&&ox(ot[Ne])?(a=ot[Ne++],r=16*r+"0123456789abcdef".indexOf(a.toLowerCase())):Wt({},ya,La);return String.fromCharCode(r)}function j$(){var e,t,n,a;for(t=0,(e=ot[Ne])==="}"&&Wt({},ya,La);Ne<er&&ox(e=ot[Ne++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||e!=="}")&&Wt({},ya,La),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),a=56320+(t-65536&1023),String.fromCharCode(n,a))}function pI(){var e,t;for(e=ot.charCodeAt(Ne++),t=String.fromCharCode(e),e===92&&(ot.charCodeAt(Ne)!==117&&Wt({},ya,La),++Ne,(e=sx("u"))&&e!=="\\"&&Gb(e.charCodeAt(0))||Wt({},ya,La),t=e);Ne<er&&iw(e=ot.charCodeAt(Ne));)++Ne,t+=String.fromCharCode(e),e===92&&(t=t.substr(0,t.length-1),ot.charCodeAt(Ne)!==117&&Wt({},ya,La),++Ne,(e=sx("u"))&&e!=="\\"&&iw(e.charCodeAt(0))||Wt({},ya,La),t+=e);return t}function H$(){var e,t;return e=Ne,t=ot.charCodeAt(Ne)===92?pI():(function(){var n,a;for(n=Ne++;Ne<er;){if((a=ot.charCodeAt(Ne))===92)return Ne=n,pI();if(!iw(a))break;++Ne}return ot.slice(n,Ne)})(),{type:t.length===1?Ed:G$.hasOwnProperty(t)?qu:t==="null"?aw:t==="true"||t==="false"?nw:Ed,value:t,start:e,end:Ne}}function lx(){var e,t,n,a,r=Ne,i=ot.charCodeAt(Ne),o=ot[Ne];switch(i){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++Ne,{type:jr,value:String.fromCharCode(i),start:r,end:Ne};default:if((e=ot.charCodeAt(Ne+1))===61)switch(i){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Ne+=2,{type:jr,value:String.fromCharCode(i)+String.fromCharCode(e),start:r,end:Ne};case 33:case 61:return Ne+=2,ot.charCodeAt(Ne)===61&&++Ne,{type:jr,value:ot.slice(r,Ne),start:r,end:Ne}}}return(a=ot.substr(Ne,4))===">>>="?{type:jr,value:a,start:r,end:Ne+=4}:(n=a.substr(0,3))===">>>"||n==="<<="||n===">>="?{type:jr,value:n,start:r,end:Ne+=3}:o===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(o)>=0||t==="=>"?{type:jr,value:t,start:r,end:Ne+=2}:(t==="//"&&Wt({},ya,La),"<>=!+-*%&|^/".indexOf(o)>=0?(++Ne,{type:jr,value:o,start:r,end:Ne}):void Wt({},ya,La))}function hI(){var e,t,n;if(rw(Il((n=ot[Ne]).charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point"),t=Ne,e="",n!=="."){if(e=ot[Ne++],n=ot[Ne],e==="0"){if(n==="x"||n==="X")return++Ne,(function(a){let r="";for(;Ne<er&&ox(ot[Ne]);)r+=ot[Ne++];return r.length===0&&Wt({},ya,La),Gb(ot.charCodeAt(Ne))&&Wt({},ya,La),{type:wd,value:parseInt("0x"+r,16),start:a,end:Ne}})(t);if(Ub(n))return(function(a){let r="0"+ot[Ne++];for(;Ne<er&&Ub(ot[Ne]);)r+=ot[Ne++];return(Gb(ot.charCodeAt(Ne))||Il(ot.charCodeAt(Ne)))&&Wt({},ya,La),{type:wd,value:parseInt(r,8),octal:!0,start:a,end:Ne}})(t);n&&Il(n.charCodeAt(0))&&Wt({},ya,La)}for(;Il(ot.charCodeAt(Ne));)e+=ot[Ne++];n=ot[Ne]}if(n==="."){for(e+=ot[Ne++];Il(ot.charCodeAt(Ne));)e+=ot[Ne++];n=ot[Ne]}if(n==="e"||n==="E")if(e+=ot[Ne++],(n=ot[Ne])!=="+"&&n!=="-"||(e+=ot[Ne++]),Il(ot.charCodeAt(Ne)))for(;Il(ot.charCodeAt(Ne));)e+=ot[Ne++];else Wt({},ya,La);return Gb(ot.charCodeAt(Ne))&&Wt({},ya,La),{type:wd,value:parseFloat(e),start:t,end:Ne}}function q$(){var e,t,n,a;return en=null,fI(),e=Ne,t=(function(){var r,i,o,u;for(rw((r=ot[Ne])==="/","Regular expression literal must start with a slash"),i=ot[Ne++],o=!1,u=!1;Ne<er;)if(i+=r=ot[Ne++],r==="\\")zb((r=ot[Ne++]).charCodeAt(0))&&Wt({},ix),i+=r;else if(zb(r.charCodeAt(0)))Wt({},ix);else if(o)r==="]"&&(o=!1);else{if(r==="/"){u=!0;break}r==="["&&(o=!0)}return u||Wt({},ix),{value:i.substr(1,i.length-2),literal:i}})(),n=(function(){var r,i,o;for(i="",o="";Ne<er&&iw((r=ot[Ne]).charCodeAt(0));)++Ne,r==="\\"&&Ne<er?Wt({},ya,La):(o+=r,i+=r);return o.search(/[^gimuy]/g)>=0&&Wt({},rx,o),{value:o,literal:i}})(),a=(function(r,i){let o=r;i.indexOf("u")>=0&&(o=o.replace(/\\u\{([0-9a-fA-F]+)\}/g,((u,c)=>{if(parseInt(c,16)<=1114111)return"x";Wt({},rx)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(o)}catch{Wt({},rx)}try{return new RegExp(r,i)}catch{return null}})(t.value,n.value),{literal:t.literal+n.literal,value:a,regex:{pattern:t.value,flags:n.value},start:e,end:Ne}}function mI(){if(fI(),Ne>=er)return{type:Pb,start:Ne,end:Ne};let e=ot.charCodeAt(Ne);return Gb(e)?H$():e===40||e===41||e===59?lx():e===39||e===34?(function(){var t,n,a,r,i="",o=!1;for(rw((t=ot[Ne])==="'"||t==='"',"String literal must starts with a quote"),n=Ne,++Ne;Ne<er;){if((a=ot[Ne++])===t){t="";break}if(a==="\\")if((a=ot[Ne++])&&zb(a.charCodeAt(0)))a==="\r"&&ot[Ne]===`
8
8
  `&&++Ne;else switch(a){case"u":case"x":ot[Ne]==="{"?(++Ne,i+=j$()):i+=sx(a);break;case"n":i+=`
9
- `;break;case"r":i+="\r";break;case"t":i+=" ";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:Ub(a)?((r="01234567".indexOf(a))!==0&&(o=!0),Ne<er&&Ub(ot[Ne])&&(o=!0,r=8*r+"01234567".indexOf(ot[Ne++]),"0123".indexOf(a)>=0&&Ne<er&&Ub(ot[Ne])&&(r=8*r+"01234567".indexOf(ot[Ne++]))),i+=String.fromCharCode(r)):i+=a}else{if(zb(a.charCodeAt(0)))break;i+=a}}return t!==""&&Wt({},ya,La),{type:$b,value:i,octal:o,start:n,end:Ne}})():e===46?Il(ot.charCodeAt(Ne+1))?hI():lx():Il(e)?hI():lx()}function Hr(){let e=en;return Ne=e.end,en=mI(),Ne=e.end,e}function gI(){let e=Ne;en=mI(),Ne=e}function bI(e,t,n){let a=new qo(e==="||"||e==="&&"?C$:S$);return a.operator=e,a.left=t,a.right=n,a}function W$(e,t){let n=new qo(x$);return n.callee=e,n.arguments=t,n}function ux(e){let t=new qo(cI);return t.name=e,t}function jb(e){let t=new qo(T$);return t.value=e.value,t.raw=ot.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function yI(e,t,n){let a=new qo(R$);return a.computed=e==="[",a.object=t,a.property=n,a.computed||(n.member=!0),a}function vI(e,t,n){let a=new qo(I$);return a.key=t,a.value=n,a.kind=e,a}function Wt(e,t){var n,a=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((i,o)=>(rw(o<a.length,"Message reference must be in range"),a[o])));throw(n=new Error(r)).index=Ne,n.description=r,n}function ow(e){e.type===Pb&&Wt(e,P$),e.type===wd&&Wt(e,D$),e.type===$b&&Wt(e,M$),e.type===Ed&&Wt(e,L$),e.type===qu&&Wt(e,F$),Wt(e,ya,e.value)}function tr(e){let t=Hr();t.type===jr&&t.value===e||ow(t)}function gn(e){return en.type===jr&&en.value===e}function cx(e){return en.type===qu&&en.value===e}function V$(){let e=[];for(Ne=en.start,tr("[");!gn("]");)gn(",")?(Hr(),e.push(null)):(e.push(_d()),gn("]")||tr(","));return Hr(),(function(t){let n=new qo(k$);return n.elements=t,n})(e)}function EI(){Ne=en.start;let e=Hr();return e.type===$b||e.type===wd?(e.octal&&Wt(e,dI),jb(e)):ux(e.value)}function Y$(){var e,t,n;return Ne=en.start,(e=en).type===Ed?(n=EI(),tr(":"),vI("init",n,_d())):e.type!==Pb&&e.type!==jr?(t=EI(),tr(":"),vI("init",t,_d())):void ow(e)}function K$(){var e,t,n=[],a={},r=String;for(Ne=en.start,tr("{");!gn("}");)t="$"+((e=Y$()).key.type===cI?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(a,t)?Wt({},$$):a[t]=!0,n.push(e),gn("}")||tr(",");return tr("}"),(function(i){let o=new qo(N$);return o.properties=i,o})(n)}let X$={if:1};function Z$(){var e,t,n;if(gn("("))return(function(){tr("(");let a=dx();return tr(")"),a})();if(gn("["))return V$();if(gn("{"))return K$();if(e=en.type,Ne=en.start,e===Ed||X$[en.value])n=ux(Hr().value);else if(e===$b||e===wd)en.octal&&Wt(en,dI),n=jb(Hr());else{if(e===qu)throw new Error(Bb);e===nw?((t=Hr()).value=t.value==="true",n=jb(t)):e===aw?((t=Hr()).value=null,n=jb(t)):gn("/")||gn("/=")?(n=jb(q$()),gI()):ow(Hr())}return n}function J$(){let e=[];if(tr("("),!gn(")"))for(;Ne<er&&(e.push(_d()),!gn(")"));)tr(",");return tr(")"),e}function Q$(){Ne=en.start;let e=Hr();return(function(t){return t.type===Ed||t.type===qu||t.type===nw||t.type===aw})(e)||ow(e),ux(e.value)}function eB(){tr("[");let e=dx();return tr("]"),e}function wI(){let e=(function(){var t;for(t=Z$();;)if(gn("."))tr("."),t=yI(".",t,Q$());else if(gn("("))t=W$(t,J$());else{if(!gn("["))break;t=yI("[",t,eB())}return t})();if(en.type===jr&&(gn("++")||gn("--")))throw new Error(Bb);return e}function sw(){var e,t;if(en.type!==jr&&en.type!==qu)t=wI();else{if(gn("++")||gn("--"))throw new Error(Bb);if(gn("+")||gn("-")||gn("~")||gn("!"))e=Hr(),t=sw(),t=(function(n,a){let r=new qo(O$);return r.operator=n,r.argument=a,r.prefix=!0,r})(e.value,t);else{if(cx("delete")||cx("void")||cx("typeof"))throw new Error(Bb);t=wI()}}return t}function _I(e){let t=0;if(e.type!==jr&&e.type!==qu)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function _d(){var e,t;return e=(function(){var n,a,r,i,o,u,c,f,m,g;if(n=en,m=sw(),(o=_I(i=en))===0)return m;for(i.prec=o,Hr(),a=[n,en],u=[m,i,c=sw()];(o=_I(en))>0;){for(;u.length>2&&o<=u[u.length-2].prec;)c=u.pop(),f=u.pop().value,m=u.pop(),a.pop(),r=bI(f,m,c),u.push(r);(i=Hr()).prec=o,u.push(i),a.push(en),r=sw(),u.push(r)}for(r=u[g=u.length-1],a.pop();g>1;)a.pop(),r=bI(u[g-1].value,u[g-2],r),g-=2;return r})(),gn("?")&&(Hr(),t=_d(),tr(":"),e=(function(n,a,r){let i=new qo(A$);return i.test=n,i.consequent=a,i.alternate=r,i})(e,t,_d())),e}function dx(){let e=_d();if(gn(","))throw new Error(Bb);return e}function kI(e){Ne=0,er=(ot=e).length,en=null,gI();let t=dx();if(en.type!==Pb)throw new Error("Unexpect token after expression.");return t}var SI={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 xI(e){function t(i,o,u){return c=>(function(f,m,g,v){let E=e(m[0]);return g&&(E=g+"("+E+")",g.lastIndexOf("new ",0)===0&&(E="("+E+")")),E+"."+f+(v<0?"":v===0?"()":"("+m.slice(1).map(e).join(",")+")")})(i,c,o,u)}let n="new Date",a="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(i){i.length<3&&F("Missing arguments to clamp function."),i.length>3&&F("Too many arguments to clamp function.");let o=i.map(e);return"Math.max("+o[1]+", Math.min("+o[2]+","+o[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",a,0),lower:t("toLowerCase",a,0),substring:t("substring",a),split:t("split",a),trim:t("trim",a,0),regexp:r,test:t("test",r),if:function(i){i.length<3&&F("Missing arguments to if function."),i.length>3&&F("Too many arguments to if function.");let o=i.map(e);return"("+o[0]+"?"+o[1]+":"+o[2]+")"}}}function AI(e){let t=(e=e||{}).allowed?ir(e.allowed):{},n=e.forbidden?ir(e.forbidden):{},a=e.constants||SI,r=(e.functions||xI)(g),i=e.globalvar,o=e.fieldvar,u=tt(i)?i:k=>`${i}["${k}"]`,c={},f={},m=0;function g(k){if(Ft(k))return k;let _=v[k.type];return _==null&&F("Unsupported type: "+k.type),_(k)}let v={Literal:k=>k.raw,Identifier:k=>{let _=k.name;return m>0?_:nt(n,_)?F("Illegal identifier: "+_):nt(a,_)?a[_]:nt(t,_)?_:(c[_]=1,u(_))},MemberExpression:k=>{let _=!k.computed,N=g(k.object);_&&(m+=1);let O=g(k.property);return N===o&&(f[(function(I){let B=I&&I.length-1;return B&&(I[0]==='"'&&I[B]==='"'||I[0]==="'"&&I[B]==="'")?I.slice(1,-1):I})(O)]=1),_&&(m-=1),N+(_?"."+O:"["+O+"]")},CallExpression:k=>{k.callee.type!=="Identifier"&&F("Illegal callee type: "+k.callee.type);let _=k.callee.name,N=k.arguments,O=nt(r,_)&&r[_];return O||F("Unrecognized function: "+_),tt(O)?O(N):O+"("+N.map(g).join(",")+")"},ArrayExpression:k=>"["+k.elements.map(g).join(",")+"]",BinaryExpression:k=>"("+g(k.left)+" "+k.operator+" "+g(k.right)+")",UnaryExpression:k=>"("+k.operator+g(k.argument)+")",ConditionalExpression:k=>"("+g(k.test)+"?"+g(k.consequent)+":"+g(k.alternate)+")",LogicalExpression:k=>"("+g(k.left)+k.operator+g(k.right)+")",ObjectExpression:k=>"{"+k.properties.map(g).join(",")+"}",Property:k=>{m+=1;let _=g(k.key);return m-=1,_+":"+g(k.value)}};function E(k){let _={code:g(k),globals:Object.keys(c),fields:Object.keys(f)};return c={},f={},_}return E.functions=r,E.constants=a,E}let fx="intersect",TI="union",tB="vlMulti",nB="vlPoint",CI="or",aB="and",Ds="_vgsid_",Hb=W(Ds),rB="E",iB="R",oB="R-E",sB="R-LE",lB="R-RE",lw="index:unit";function RI(e,t){for(var n,a,r=t.fields,i=t.values,o=r.length,u=0;u<o;++u)if((a=r[u]).getter=W.getter||W(a.field),Sn(n=a.getter(e))&&(n=Le(n)),Sn(i[u])&&(i[u]=Le(i[u])),Sn(i[u][0])&&(i[u]=i[u].map(Le)),a.type===rB){if(Ee(i[u])?i[u].indexOf(n)<0:n!==i[u])return!1}else if(a.type===iB){if(!Sa(n,i[u]))return!1}else if(a.type===lB){if(!Sa(n,i[u],!0,!1))return!1}else if(a.type===oB){if(!Sa(n,i[u],!1,!1))return!1}else if(a.type===sB&&!Sa(n,i[u],!1,!0))return!1;return!0}let NI=sr(Hb),uB=NI.left,cB=NI.right;var px={[`${Ds}_union`]:function(){let e=new yh;for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];for(let r of n)for(let i of r)e.add(i);return e},[`${Ds}_intersect`]:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];e=new yh(e),n=n.map(HA);e:for(let r of e)for(let i of n)if(!i.has(r)){e.delete(r);continue e}return e},E_union:function(e,t){if(!e.length)return t;for(var n=0,a=t.length;n<a;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((n=>t.indexOf(n)>=0)):t},R_union:function(e,t){var n=Le(t[0]),a=Le(t[1]);return n>a&&(n=t[1],a=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<a&&(e[1]=a),e):[n,a]},R_intersect:function(e,t){var n=Le(t[0]),a=Le(t[1]);return n>a&&(n=t[1],a=t[0]),e.length?a<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>a&&(e[1]=a),e):[n,a]}};let dB=":",fB="@";function hx(e,t,n,a){t[0].type!==Qp&&F("First argument to selection functions must be a string literal.");let r=t[0].value,i=t.length>=2&&$e(t).value,o="unit",u=fB+o,c=dB+r;i!==fx||nt(a,u)||(a[u]=n.getData(r).indataRef(n,o)),nt(a,c)||(a[c]=n.getData(r).tuplesRef())}function II(e){let t=this.context.data[e];return t?t.values.value:[]}let qb=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},pB=qb("format"),OI=qb("timeFormat"),hB=qb("utcFormat"),mB=qb("timeParse"),gB=qb("utcParse"),uw=new Date(2e3,0,1);function cw(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(uw.setYear(2e3),uw.setMonth(e),uw.setDate(t),OI.call(this,uw,n)):""}let bB=":",yB="@",mx="%",DI="$";function gx(e,t,n,a){t[0].type!==Qp&&F("First argument to data functions must be a string literal.");let r=t[0].value,i=bB+r;if(!nt(i,a))try{a[i]=n.getData(r).tuplesRef()}catch{}}function qr(e,t,n,a){if(t[0].type===Qp)MI(n,a,t[0].value);else for(e in n.scales)MI(n,a,e)}function MI(e,t,n){let a=mx+n;if(!nt(t,a))try{t[a]=e.scaleRef(n)}catch{}}function Ol(e,t){if(tt(e))return e;if(Ft(e)){let n=t.scales[e];return n&&(function(a){return a&&a[zg]===!0})(n.value)?n.value:void 0}}function vB(e,t,n){t.__bandwidth=r=>r&&r.bandwidth?r.bandwidth():0,n._bandwidth=qr,n._range=qr,n._scale=qr;let a=r=>"_["+(r.type===Qp?st(mx+r.value):st(mx)+"+"+e(r))+"]";return{_bandwidth:r=>`this.__bandwidth(${a(r[0])})`,_range:r=>`${a(r[0])}.range()`,_scale:r=>`${a(r[0])}(${e(r[1])})`}}function bx(e,t){return function(n,a,r){if(n){let i=Ol(n,(r||this).context);return i&&i.path[e](a)}return t(a)}}let EB=bx("area",(function(e){return lE=new za,Sl(e,Rs),2*lE})),wB=bx("bounds",(function(e){var t,n,a,r,i,o,u;if(vi=Dn=-(An=Gr=1/0),Uu=[],Sl(e,Al),n=Uu.length){for(Uu.sort(oF),t=1,i=[a=Uu[0]];t<n;++t)sR(a,(r=Uu[t])[0])||sR(a,r[1])?(Ei(a[0],r[1])>Ei(a[0],a[1])&&(a[1]=r[1]),Ei(r[0],a[1])>Ei(a[0],a[1])&&(a[0]=r[0])):i.push(a=r);for(o=-1/0,t=0,a=i[n=i.length-1];t<=n;a=r,++t)r=i[t],(u=Ei(a[1],r[0]))>o&&(o=u,An=r[0],Dn=a[1])}return Uu=xl=null,An===1/0||Gr===1/0?[[NaN,NaN],[NaN,NaN]]:[[An,Gr],[Dn,vi]]})),_B=bx("centroid",(function(e){db=pE=hE=mE=gE=bE=yE=vE=0,Ik=new za,Ok=new za,Dk=new za,Sl(e,Go);var t=+Ik,n=+Ok,a=+Dk,r=kk(t,n,a);return r<nE&&(t=bE,n=yE,a=vE,pE<gt&&(t=hE,n=mE,a=gE),(r=kk(t,n,a))<nE)?[NaN,NaN]:[ao(n,t)*Pn,zr(a/r)*Pn]}));function yx(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(a){e.warn(a)}return n[n.length-1]}function vx(e){let t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ex(e){let t=bs(e);return .2126*vx(t.r)+.7152*vx(t.g)+.0722*vx(t.b)}function LI(e,t){return e===t||e!=e&&t!=t||(Ee(e)?!(!Ee(t)||e.length!==t.length)&&(function(n,a){for(let r=0,i=n.length;r<i;++r)if(!LI(n[r],a[r]))return!1;return!0})(e,t):!(!ye(e)||!ye(t))&&FI(e,t))}function FI(e,t){for(let n in e)if(!LI(e[n],t[n]))return!1;return!0}function PI(e){return t=>FI(e,t)}let $I={};function wx(e){return Ee(e)||ArrayBuffer.isView(e)?e:null}function _x(e){return wx(e)||(Ft(e)?e:null)}let BI=e=>e.data;function UI(e,t){let n=II.call(t,e);return n.root&&n.root.lookup||{}}let zI=()=>typeof window<"u"&&window||null;function GI(e,t,n){if(!e)return[];let[a,r]=e,i=new In().set(a[0],a[1],r[0],r[1]);return ZT(n||this.context.dataflow.scenegraph().root,i,(function(o){let u=null;if(o){let c=Ie(o.marktype),f=Ie(o.markname);u=m=>(!c.length||c.some((g=>m.marktype===g)))&&(!f.length||f.some((g=>m.name===g)))}return u})(t))}let Wb={random:()=>p.random(),cumulativeNormal:Ec,cumulativeLogNormal:fr,cumulativeUniform:kc,densityNormal:fm,densityLogNormal:Rf,densityUniform:Of,quantileNormal:wc,quantileLogNormal:mm,quantileUniform:du,sampleNormal:cu,sampleLogNormal:Cf,sampleUniform:_c,isArray:Ee,isBoolean:Zr,isDate:Sn,isDefined:e=>e!==void 0,isNumber:Ba,isObject:ye,isRegExp:xi,isString:Ft,isTuple:ru,isValid:e=>e!=null&&e==e,toBoolean:$l,toDate:e=>Ld(e),toNumber:Le,toString:Fd,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return _x(e).indexOf(...n)},join:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return wx(e).join(...n)},lastindexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return _x(e).lastIndexOf(...n)},replace:function(e,t,n){return tt(n)&&F("Function argument passed to replace."),String(e).replace(t,n)},reverse:function(e){return wx(e).slice().reverse()},slice:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return _x(e).slice(...n)},flush:rr,lerp:fo,merge:function(){let e=[].slice.call(arguments);return e.unshift({}),mt(...e)},pad:Ku,peek:$e,pluck:function(e,t){let n=$I[t]||($I[t]=W(t));return Ee(e)?e.map(n):n(e)},span:Jr,inrange:Sa,truncate:gh,rgb:bs,lab:qc,hcl:cp,hsl:Gc,luminance:Ex,contrast:function(e,t){let n=Ex(e),a=Ex(t);return(Math.max(n,a)+.05)/(Math.min(n,a)+.05)},sequence:Qn,format:pB,utcFormat:hB,utcParse:gB,utcOffset:G0,utcSequence:Fh,timeFormat:OI,timeParse:mB,timeOffset:Kd,timeSequence:Lh,timeUnitSpecifier:Hd,monthFormat:function(e){return cw.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return cw.call(this,e,1,"%b")},dayFormat:function(e){return cw.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return cw.call(this,0,2+e,"%a")},quarter:Ct,utcquarter:ht,week:qd,utcweek:Dh,dayofyear:M0,utcdayofyear:Oh,warn:function(){return yx(this.context.dataflow,"warn",arguments)},info:function(){return yx(this.context.dataflow,"info",arguments)},debug:function(){return yx(this.context.dataflow,"debug",arguments)},extent:e=>Un(e),inScope:function(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:GI,clampRange:Xe,pinchDistance:function(e){let t=e.touches,n=t[0].clientX-t[1].clientX,a=t[0].clientY-t[1].clientY;return Math.hypot(n,a)},pinchAngle:function(e){let t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){let e=zI();return e?e.screen:{}},containerSize:function(){let e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){let e=zI();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Su(e||0,t||0,n||0)},setdata:function(e,t){let n=this.context.dataflow,a=this.context.data[e].input;return n.pulse(a,n.changeset().remove(Z).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?wn(n,t=t||Ut(e)):e}},panLinear:St,panLog:Tt,panPow:Xt,panSymlog:Ke,zoomLinear:Zt,zoomLog:Et,zoomPow:Jt,zoomSymlog:Lt,encode:function(e,t,n){if(e){let a=this.context.dataflow,r=e.mark.source;a.pulse(r,a.changeset().encode(e,t))}return n!==void 0?n:e},modify:function(e,t,n,a,r,i){let o=this.context.dataflow,u=this.context.data[e],c=u.input,f=o.stamp(),m,g,v=u.changes;if(o._trigger===!1||!(c.value.length||t||a))return 0;if((!v||v.stamp<f)&&(u.changes=v=o.changeset(),v.stamp=f,o.runAfter((()=>{u.modified=!0,o.pulse(c,v).run()}),!0,1)),n&&(m=n===!0?Z:Ee(n)||ru(n)?n:PI(n),v.remove(m)),t&&v.insert(t),a&&(m=PI(a),c.value.some(m)?v.remove(m):v.insert(a)),r)for(g in i)v.modify(r,g,i[g]);return 1},lassoAppend:function(e,t,n){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5,r=(e=Ie(e))[e.length-1];return r===void 0||Math.hypot(r[0]-t,r[1]-n)>a?[...e,[t,n]]:e},lassoPath:function(e){return Ie(e).reduce(((t,n,a)=>{let[r,i]=n;return t+(a==0?`M ${r},${i} `:a===e.length-1?" Z":`L ${r},${i} `)}),"")},intersectLasso:function(e,t,n){let{x:a,y:r,mark:i}=n,o=new In().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(let[u,c]of t)u<o.x1&&(o.x1=u),u>o.x2&&(o.x2=u),c<o.y1&&(o.y1=c),c>o.y2&&(o.y2=c);return o.translate(a,r),GI([[o.x1,o.y1],[o.x2,o.y2]],e,i).filter((u=>(function(c,f,m){let g=0;for(let v=0,E=m.length-1;v<m.length;E=v++){let[k,_]=m[E],[N,O]=m[v];O>f!=_>f&&c<(k-N)*(f-O)/(_-O)+N&&g++}return 1&g})(u.x,u.y,t)))}},kB=["view","item","group","xy","x","y"],SB="event.vega.",jI="this.",kx={},HI={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${st(DI+e)}]`,functions:function(e){let t=xI(e);kB.forEach((n=>t[n]=SB+n));for(let n in Wb)t[n]=jI+n;return mt(t,vB(e,Wb,kx)),t},constants:SI,visitors:kx},Sx=AI(HI);function Zn(e,t,n){return arguments.length===1?Wb[e]:(Wb[e]=t,n&&(kx[e]=n),Sx&&(Sx.functions[e]=jI+e),this)}function Ms(e,t){let n={},a;try{a=kI(e=Ft(e)?e:st(e)+"")}catch{F("Expression parse error: "+e)}a.visit((i=>{if(i.type!==uI)return;let o=i.callee.name,u=HI.visitors[o];u&&u(o,i.arguments,t,n)}));let r=Sx(a);return r.globals.forEach((i=>{let o=DI+i;!nt(n,o)&&t.getSignal(i)&&(n[o]=t.signalRef(i))})),{$expr:mt({code:r.code},t.options.ast?{ast:a}:null),$fields:r.fields,$params:n}}Zn("bandwidth",(function(e,t){let n=Ol(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),qr),Zn("copy",(function(e,t){let n=Ol(e,(t||this).context);return n?n.copy():void 0}),qr),Zn("domain",(function(e,t){let n=Ol(e,(t||this).context);return n?n.domain():[]}),qr),Zn("range",(function(e,t){let n=Ol(e,(t||this).context);return n&&n.range?n.range():[]}),qr),Zn("invert",(function(e,t,n){let a=Ol(e,(n||this).context);return a?Ee(t)?(a.invertRange||a.invert)(t):(a.invert||a.invertExtent)(t):void 0}),qr),Zn("scale",(function(e,t,n){let a=Ol(e,(n||this).context);return a?a(t):void 0}),qr),Zn("gradient",(function(e,t,n,a,r){e=Ol(e,(r||this).context);let i=Je(t,n),o=e.domain(),u=o[0],c=$e(o),f=ee;return c-u?f=od(e,u,c):e=(e.interpolator?Bt("sequential")().interpolator(e.interpolator()):Bt("linear")().interpolate(e.interpolate()).range(e.range())).domain([u=0,c=1]),e.ticks&&(o=e.ticks(+a||15),u!==o[0]&&o.unshift(u),c!==$e(o)&&o.push(c)),o.forEach((m=>i.stop(f(m),e(m)))),i}),qr),Zn("geoArea",EB,qr),Zn("geoBounds",wB,qr),Zn("geoCentroid",_B,qr),Zn("geoShape",(function(e,t,n){let a=Ol(e,(n||this).context);return function(r){return a?a.path.context(r)(t):""}}),qr),Zn("indata",(function(e,t,n){let a=this.context.data[e]["index:"+t],r=a?a.value.get(n):void 0;return r&&r.count}),(function(e,t,n,a){t[0].type!==Qp&&F("First argument to indata must be a string literal."),t[1].type!==Qp&&F("Second argument to indata must be a string literal.");let r=t[0].value,i=t[1].value,o=yB+i;nt(o,a)||(a[o]=n.getData(r).indataRef(n,i))})),Zn("data",II,gx),Zn("treePath",(function(e,t,n){let a=UI(e,this),r=a[t],i=a[n];return r&&i?r.path(i).map(BI):void 0}),gx),Zn("treeAncestors",(function(e,t){let n=UI(e,this)[t];return n?n.ancestors().map(BI):void 0}),gx),Zn("vlSelectionTest",(function(e,t,n){for(var a,r,i,o,u,c=this.context.data[e],f=c?c.values.value:[],m=c?c[lw]&&c[lw].value:void 0,g=n===fx,v=f.length,E=0;E<v;++E)if(a=f[E],m&&g){if((i=(r=r||{})[o=a.unit]||0)===-1)continue;if(u=RI(t,a),r[o]=u?-1:++i,u&&m.size===1)return!0;if(!u&&i===m.get(o).count)return!1}else if(g^(u=RI(t,a)))return u;return v&&g}),hx),Zn("vlSelectionIdTest",(function(e,t,n){let a=this.context.data[e],r=a?a.values.value:[],i=a?a[lw]&&a[lw].value:void 0,o=n===fx,u=Hb(t),c=uB(r,u);if(c===r.length||Hb(r[c])!==u)return!1;if(i&&o){if(i.size===1)return!0;if(cB(r,u)-c<i.size)return!1}return!0}),hx),Zn("vlSelectionResolve",(function(e,t,n,a){for(var r,i,o,u,c,f,m,g,v,E,k,_,N=this.context.data[e],O=N?N.values.value:[],I={},B={},M={},U=O.length,z=0;z<U;++z)if(u=(r=O[z]).unit,i=r.fields,o=r.values,i&&o){for(k=0,_=i.length;k<_;++k)c=i[k],g=(m=I[c.field]||(I[c.field]={}))[u]||(m[u]=[]),M[c.field]=v=c.type.charAt(0),E=px[`${v}_union`],m[u]=E(g,Ie(o[k]));n&&(g=B[u]||(B[u]=[])).push(Ie(o).reduce(((q,Y,K)=>(q[i[K].field]=Y,q)),{}))}else c=Ds,f=Hb(r),(g=(m=I[c]||(I[c]={}))[u]||(m[u]=[])).push(f),n&&(g=B[u]||(B[u]=[])).push({[Ds]:f});return t=t||TI,I[Ds]?I[Ds]=px[`${Ds}_${t}`](...Object.values(I[Ds])):Object.keys(I).forEach((q=>{I[q]=Object.keys(I[q]).map((Y=>I[q][Y])).reduce(((Y,K)=>Y===void 0?K:px[`${M[q]}_${t}`](Y,K)))})),O=Object.keys(B),n&&O.length&&(I[a?nB:tB]=t===TI?{[CI]:O.reduce(((q,Y)=>(q.push(...B[Y]),q)),[])}:{[aB]:O.map((q=>({[CI]:B[q]})))}),I}),hx),Zn("vlSelectionTuples",(function(e,t){return e.map((n=>mt(t.fields?{values:t.fields.map((a=>(a.getter||(a.getter=W(a.field)))(n.datum)))}:{[Ds]:Hb(n.datum)},t)))}));let xB=ir(["rule"]),qI=ir(["group","image","rect"]);function xx(e){return(e+"").toLowerCase()}function Vb(e,t,n){n.endsWith(";")||(n="return("+n+");");let a=Function(...t.concat(n));return e&&e.functions?a.bind(e.functions):a}var AB={operator:(e,t)=>Vb(e,["_"],t.code),parameter:(e,t)=>Vb(e,["datum","_"],t.code),event:(e,t)=>Vb(e,["event"],t.code),handler:(e,t)=>Vb(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{let{marktype:n,channels:a}=t,r="var o=item,datum=o.datum,m=0,$;";for(let i in a){let o="o["+st(i)+"]";r+=`$=${a[i].code};if(${o}!==$)${o}=$,m=1;`}return r+=(function(i,o){let u="";return xB[o]||(i.x2&&(i.x?(qI[o]&&(u+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),u+="o.width=o.x2-o.x;"):u+="o.x=o.x2-(o.width||0);"),i.xc&&(u+="o.x=o.xc-(o.width||0)/2;"),i.y2&&(i.y?(qI[o]&&(u+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),u+="o.height=o.y2-o.y;"):u+="o.y=o.y2-(o.height||0);"),i.yc&&(u+="o.y=o.yc-(o.height||0)/2;")),u})(a,n),r+="return m;",Vb(e,["item","_"],r)},codegen:{get(e){let t=`[${e.map(st).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n,a=Function("a","b","var u, v; return "+e.map(((r,i)=>{let o=t[i],u,c;return r.path?(u=`a${r.path}`,c=`b${r.path}`):((n=n||{})["f"+i]=r,u=`this.f${i}(a)`,c=`this.f${i}(b)`),(function(f,m,g,v){return`((u = ${f}) < (v = ${m}) || u == null) && v != null ? ${g}
9
+ `;break;case"r":i+="\r";break;case"t":i+=" ";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:Ub(a)?((r="01234567".indexOf(a))!==0&&(o=!0),Ne<er&&Ub(ot[Ne])&&(o=!0,r=8*r+"01234567".indexOf(ot[Ne++]),"0123".indexOf(a)>=0&&Ne<er&&Ub(ot[Ne])&&(r=8*r+"01234567".indexOf(ot[Ne++]))),i+=String.fromCharCode(r)):i+=a}else{if(zb(a.charCodeAt(0)))break;i+=a}}return t!==""&&Wt({},ya,La),{type:$b,value:i,octal:o,start:n,end:Ne}})():e===46?Il(ot.charCodeAt(Ne+1))?hI():lx():Il(e)?hI():lx()}function Hr(){let e=en;return Ne=e.end,en=mI(),Ne=e.end,e}function gI(){let e=Ne;en=mI(),Ne=e}function bI(e,t,n){let a=new qo(e==="||"||e==="&&"?C$:S$);return a.operator=e,a.left=t,a.right=n,a}function W$(e,t){let n=new qo(x$);return n.callee=e,n.arguments=t,n}function ux(e){let t=new qo(cI);return t.name=e,t}function jb(e){let t=new qo(T$);return t.value=e.value,t.raw=ot.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function yI(e,t,n){let a=new qo(R$);return a.computed=e==="[",a.object=t,a.property=n,a.computed||(n.member=!0),a}function vI(e,t,n){let a=new qo(I$);return a.key=t,a.value=n,a.kind=e,a}function Wt(e,t){var n,a=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,((i,o)=>(rw(o<a.length,"Message reference must be in range"),a[o])));throw(n=new Error(r)).index=Ne,n.description=r,n}function ow(e){e.type===Pb&&Wt(e,P$),e.type===wd&&Wt(e,D$),e.type===$b&&Wt(e,M$),e.type===Ed&&Wt(e,L$),e.type===qu&&Wt(e,F$),Wt(e,ya,e.value)}function tr(e){let t=Hr();t.type===jr&&t.value===e||ow(t)}function gn(e){return en.type===jr&&en.value===e}function cx(e){return en.type===qu&&en.value===e}function V$(){let e=[];for(Ne=en.start,tr("[");!gn("]");)gn(",")?(Hr(),e.push(null)):(e.push(_d()),gn("]")||tr(","));return Hr(),(function(t){let n=new qo(k$);return n.elements=t,n})(e)}function EI(){Ne=en.start;let e=Hr();return e.type===$b||e.type===wd?(e.octal&&Wt(e,dI),jb(e)):ux(e.value)}function Y$(){var e,t,n;return Ne=en.start,(e=en).type===Ed?(n=EI(),tr(":"),vI("init",n,_d())):e.type!==Pb&&e.type!==jr?(t=EI(),tr(":"),vI("init",t,_d())):void ow(e)}function K$(){var e,t,n=[],a={},r=String;for(Ne=en.start,tr("{");!gn("}");)t="$"+((e=Y$()).key.type===cI?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(a,t)?Wt({},$$):a[t]=!0,n.push(e),gn("}")||tr(",");return tr("}"),(function(i){let o=new qo(N$);return o.properties=i,o})(n)}let X$={if:1};function Z$(){var e,t,n;if(gn("("))return(function(){tr("(");let a=dx();return tr(")"),a})();if(gn("["))return V$();if(gn("{"))return K$();if(e=en.type,Ne=en.start,e===Ed||X$[en.value])n=ux(Hr().value);else if(e===$b||e===wd)en.octal&&Wt(en,dI),n=jb(Hr());else{if(e===qu)throw new Error(Bb);e===nw?((t=Hr()).value=t.value==="true",n=jb(t)):e===aw?((t=Hr()).value=null,n=jb(t)):gn("/")||gn("/=")?(n=jb(q$()),gI()):ow(Hr())}return n}function J$(){let e=[];if(tr("("),!gn(")"))for(;Ne<er&&(e.push(_d()),!gn(")"));)tr(",");return tr(")"),e}function Q$(){Ne=en.start;let e=Hr();return(function(t){return t.type===Ed||t.type===qu||t.type===nw||t.type===aw})(e)||ow(e),ux(e.value)}function eB(){tr("[");let e=dx();return tr("]"),e}function wI(){let e=(function(){var t;for(t=Z$();;)if(gn("."))tr("."),t=yI(".",t,Q$());else if(gn("("))t=W$(t,J$());else{if(!gn("["))break;t=yI("[",t,eB())}return t})();if(en.type===jr&&(gn("++")||gn("--")))throw new Error(Bb);return e}function sw(){var e,t;if(en.type!==jr&&en.type!==qu)t=wI();else{if(gn("++")||gn("--"))throw new Error(Bb);if(gn("+")||gn("-")||gn("~")||gn("!"))e=Hr(),t=sw(),t=(function(n,a){let r=new qo(O$);return r.operator=n,r.argument=a,r.prefix=!0,r})(e.value,t);else{if(cx("delete")||cx("void")||cx("typeof"))throw new Error(Bb);t=wI()}}return t}function _I(e){let t=0;if(e.type!==jr&&e.type!==qu)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function _d(){var e,t;return e=(function(){var n,a,r,i,o,u,c,f,m,g;if(n=en,m=sw(),(o=_I(i=en))===0)return m;for(i.prec=o,Hr(),a=[n,en],u=[m,i,c=sw()];(o=_I(en))>0;){for(;u.length>2&&o<=u[u.length-2].prec;)c=u.pop(),f=u.pop().value,m=u.pop(),a.pop(),r=bI(f,m,c),u.push(r);(i=Hr()).prec=o,u.push(i),a.push(en),r=sw(),u.push(r)}for(r=u[g=u.length-1],a.pop();g>1;)a.pop(),r=bI(u[g-1].value,u[g-2],r),g-=2;return r})(),gn("?")&&(Hr(),t=_d(),tr(":"),e=(function(n,a,r){let i=new qo(A$);return i.test=n,i.consequent=a,i.alternate=r,i})(e,t,_d())),e}function dx(){let e=_d();if(gn(","))throw new Error(Bb);return e}function kI(e){Ne=0,er=(ot=e).length,en=null,gI();let t=dx();if(en.type!==Pb)throw new Error("Unexpect token after expression.");return t}var SI={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 xI(e){function t(i,o,u){return c=>(function(f,m,g,v){let E=e(m[0]);return g&&(E=g+"("+E+")",g.lastIndexOf("new ",0)===0&&(E="("+E+")")),E+"."+f+(v<0?"":v===0?"()":"("+m.slice(1).map(e).join(",")+")")})(i,c,o,u)}let n="new Date",a="String",r="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(i){i.length<3&&F("Missing arguments to clamp function."),i.length>3&&F("Too many arguments to clamp function.");let o=i.map(e);return"Math.max("+o[1]+", Math.min("+o[2]+","+o[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:t("getDate",n,0),day:t("getDay",n,0),year:t("getFullYear",n,0),month:t("getMonth",n,0),hours:t("getHours",n,0),minutes:t("getMinutes",n,0),seconds:t("getSeconds",n,0),milliseconds:t("getMilliseconds",n,0),time:t("getTime",n,0),timezoneoffset:t("getTimezoneOffset",n,0),utcdate:t("getUTCDate",n,0),utcday:t("getUTCDay",n,0),utcyear:t("getUTCFullYear",n,0),utcmonth:t("getUTCMonth",n,0),utchours:t("getUTCHours",n,0),utcminutes:t("getUTCMinutes",n,0),utcseconds:t("getUTCSeconds",n,0),utcmilliseconds:t("getUTCMilliseconds",n,0),length:t("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:t("toUpperCase",a,0),lower:t("toLowerCase",a,0),substring:t("substring",a),split:t("split",a),trim:t("trim",a,0),regexp:r,test:t("test",r),if:function(i){i.length<3&&F("Missing arguments to if function."),i.length>3&&F("Too many arguments to if function.");let o=i.map(e);return"("+o[0]+"?"+o[1]+":"+o[2]+")"}}}function AI(e){let t=(e=e||{}).allowed?ir(e.allowed):{},n=e.forbidden?ir(e.forbidden):{},a=e.constants||SI,r=(e.functions||xI)(g),i=e.globalvar,o=e.fieldvar,u=tt(i)?i:k=>`${i}["${k}"]`,c={},f={},m=0;function g(k){if(Ft(k))return k;let _=v[k.type];return _==null&&F("Unsupported type: "+k.type),_(k)}let v={Literal:k=>k.raw,Identifier:k=>{let _=k.name;return m>0?_:nt(n,_)?F("Illegal identifier: "+_):nt(a,_)?a[_]:nt(t,_)?_:(c[_]=1,u(_))},MemberExpression:k=>{let _=!k.computed,N=g(k.object);_&&(m+=1);let O=g(k.property);return N===o&&(f[(function(I){let B=I&&I.length-1;return B&&(I[0]==='"'&&I[B]==='"'||I[0]==="'"&&I[B]==="'")?I.slice(1,-1):I})(O)]=1),_&&(m-=1),N+(_?"."+O:"["+O+"]")},CallExpression:k=>{k.callee.type!=="Identifier"&&F("Illegal callee type: "+k.callee.type);let _=k.callee.name,N=k.arguments,O=nt(r,_)&&r[_];return O||F("Unrecognized function: "+_),tt(O)?O(N):O+"("+N.map(g).join(",")+")"},ArrayExpression:k=>"["+k.elements.map(g).join(",")+"]",BinaryExpression:k=>"("+g(k.left)+" "+k.operator+" "+g(k.right)+")",UnaryExpression:k=>"("+k.operator+g(k.argument)+")",ConditionalExpression:k=>"("+g(k.test)+"?"+g(k.consequent)+":"+g(k.alternate)+")",LogicalExpression:k=>"("+g(k.left)+k.operator+g(k.right)+")",ObjectExpression:k=>"{"+k.properties.map(g).join(",")+"}",Property:k=>{m+=1;let _=g(k.key);return m-=1,_+":"+g(k.value)}};function E(k){let _={code:g(k),globals:Object.keys(c),fields:Object.keys(f)};return c={},f={},_}return E.functions=r,E.constants=a,E}let fx="intersect",TI="union",tB="vlMulti",nB="vlPoint",CI="or",aB="and",Ds="_vgsid_",Hb=W(Ds),rB="E",iB="R",oB="R-E",sB="R-LE",lB="R-RE",lw="index:unit";function RI(e,t){for(var n,a,r=t.fields,i=t.values,o=r.length,u=0;u<o;++u)if((a=r[u]).getter=W.getter||W(a.field),Sn(n=a.getter(e))&&(n=Le(n)),Sn(i[u])&&(i[u]=Le(i[u])),Sn(i[u][0])&&(i[u]=i[u].map(Le)),a.type===rB){if(Ee(i[u])?i[u].indexOf(n)<0:n!==i[u])return!1}else if(a.type===iB){if(!Sa(n,i[u]))return!1}else if(a.type===lB){if(!Sa(n,i[u],!0,!1))return!1}else if(a.type===oB){if(!Sa(n,i[u],!1,!1))return!1}else if(a.type===sB&&!Sa(n,i[u],!1,!0))return!1;return!0}let NI=sr(Hb),uB=NI.left,cB=NI.right;var px={[`${Ds}_union`]:function(){let e=new yh;for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];for(let r of n)for(let i of r)e.add(i);return e},[`${Ds}_intersect`]:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];e=new yh(e),n=n.map(HA);e:for(let r of e)for(let i of n)if(!i.has(r)){e.delete(r);continue e}return e},E_union:function(e,t){if(!e.length)return t;for(var n=0,a=t.length;n<a;++n)e.indexOf(t[n])<0&&e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter((n=>t.indexOf(n)>=0)):t},R_union:function(e,t){var n=Le(t[0]),a=Le(t[1]);return n>a&&(n=t[1],a=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<a&&(e[1]=a),e):[n,a]},R_intersect:function(e,t){var n=Le(t[0]),a=Le(t[1]);return n>a&&(n=t[1],a=t[0]),e.length?a<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>a&&(e[1]=a),e):[n,a]}};let dB=":",fB="@";function hx(e,t,n,a){t[0].type!==Qp&&F("First argument to selection functions must be a string literal.");let r=t[0].value,i=t.length>=2&&$e(t).value,o="unit",u=fB+o,c=dB+r;i!==fx||nt(a,u)||(a[u]=n.getData(r).indataRef(n,o)),nt(a,c)||(a[c]=n.getData(r).tuplesRef())}function II(e){let t=this.context.data[e];return t?t.values.value:[]}let qb=e=>function(t,n){return this.context.dataflow.locale()[e](n)(t)},pB=qb("format"),OI=qb("timeFormat"),hB=qb("utcFormat"),mB=qb("timeParse"),gB=qb("utcParse"),uw=new Date(2e3,0,1);function cw(e,t,n){return Number.isInteger(e)&&Number.isInteger(t)?(uw.setYear(2e3),uw.setMonth(e),uw.setDate(t),OI.call(this,uw,n)):""}let bB=":",yB="@",mx="%",DI="$";function gx(e,t,n,a){t[0].type!==Qp&&F("First argument to data functions must be a string literal.");let r=t[0].value,i=bB+r;if(!nt(i,a))try{a[i]=n.getData(r).tuplesRef()}catch{}}function qr(e,t,n,a){if(t[0].type===Qp)MI(n,a,t[0].value);else for(e in n.scales)MI(n,a,e)}function MI(e,t,n){let a=mx+n;if(!nt(t,a))try{t[a]=e.scaleRef(n)}catch{}}function Ol(e,t){if(tt(e))return e;if(Ft(e)){let n=t.scales[e];return n&&(function(a){return a&&a[zg]===!0})(n.value)?n.value:void 0}}function vB(e,t,n){t.__bandwidth=r=>r&&r.bandwidth?r.bandwidth():0,n._bandwidth=qr,n._range=qr,n._scale=qr;let a=r=>"_["+(r.type===Qp?st(mx+r.value):st(mx)+"+"+e(r))+"]";return{_bandwidth:r=>`this.__bandwidth(${a(r[0])})`,_range:r=>`${a(r[0])}.range()`,_scale:r=>`${a(r[0])}(${e(r[1])})`}}function bx(e,t){return function(n,a,r){if(n){let i=Ol(n,(r||this).context);return i&&i.path[e](a)}return t(a)}}let EB=bx("area",(function(e){return lE=new za,Sl(e,Rs),2*lE})),wB=bx("bounds",(function(e){var t,n,a,r,i,o,u;if(vi=Dn=-(An=Gr=1/0),Uu=[],Sl(e,Al),n=Uu.length){for(Uu.sort(oF),t=1,i=[a=Uu[0]];t<n;++t)sR(a,(r=Uu[t])[0])||sR(a,r[1])?(Ei(a[0],r[1])>Ei(a[0],a[1])&&(a[1]=r[1]),Ei(r[0],a[1])>Ei(a[0],a[1])&&(a[0]=r[0])):i.push(a=r);for(o=-1/0,t=0,a=i[n=i.length-1];t<=n;a=r,++t)r=i[t],(u=Ei(a[1],r[0]))>o&&(o=u,An=r[0],Dn=a[1])}return Uu=xl=null,An===1/0||Gr===1/0?[[NaN,NaN],[NaN,NaN]]:[[An,Gr],[Dn,vi]]})),_B=bx("centroid",(function(e){db=pE=hE=mE=gE=bE=yE=vE=0,Ik=new za,Ok=new za,Dk=new za,Sl(e,Go);var t=+Ik,n=+Ok,a=+Dk,r=kk(t,n,a);return r<nE&&(t=bE,n=yE,a=vE,pE<gt&&(t=hE,n=mE,a=gE),(r=kk(t,n,a))<nE)?[NaN,NaN]:[ao(n,t)*Pn,zr(a/r)*Pn]}));function yx(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(a){e.warn(a)}return n[n.length-1]}function vx(e){let t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ex(e){let t=bs(e);return .2126*vx(t.r)+.7152*vx(t.g)+.0722*vx(t.b)}function LI(e,t){return e===t||e!=e&&t!=t||(Ee(e)?!(!Ee(t)||e.length!==t.length)&&(function(n,a){for(let r=0,i=n.length;r<i;++r)if(!LI(n[r],a[r]))return!1;return!0})(e,t):!(!ye(e)||!ye(t))&&FI(e,t))}function FI(e,t){for(let n in e)if(!LI(e[n],t[n]))return!1;return!0}function PI(e){return t=>FI(e,t)}let $I={};function wx(e){return Ee(e)||ArrayBuffer.isView(e)?e:null}function _x(e){return wx(e)||(Ft(e)?e:null)}let BI=e=>e.data;function UI(e,t){let n=II.call(t,e);return n.root&&n.root.lookup||{}}let zI=()=>typeof window<"u"&&window||null;function GI(e,t,n){if(!e)return[];let[a,r]=e,i=new In().set(a[0],a[1],r[0],r[1]);return ZT(n||this.context.dataflow.scenegraph().root,i,(function(o){let u=null;if(o){let c=Ie(o.marktype),f=Ie(o.markname);u=m=>(!c.length||c.some((g=>m.marktype===g)))&&(!f.length||f.some((g=>m.name===g)))}return u})(t))}let Wb={random:()=>p.random(),cumulativeNormal:Ec,cumulativeLogNormal:fr,cumulativeUniform:kc,densityNormal:fm,densityLogNormal:Rf,densityUniform:Of,quantileNormal:wc,quantileLogNormal:mm,quantileUniform:du,sampleNormal:cu,sampleLogNormal:Cf,sampleUniform:_c,isArray:Ee,isBoolean:Zr,isDate:Sn,isDefined:e=>e!==void 0,isNumber:Ba,isObject:ye,isRegExp:xi,isString:Ft,isTuple:ru,isValid:e=>e!=null&&e==e,toBoolean:$l,toDate:e=>Ld(e),toNumber:Le,toString:Fd,indexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return _x(e).indexOf(...n)},join:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return wx(e).join(...n)},lastindexof:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return _x(e).lastIndexOf(...n)},replace:function(e,t,n){return tt(n)&&F("Function argument passed to replace."),String(e).replace(t,n)},reverse:function(e){return wx(e).slice().reverse()},slice:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return _x(e).slice(...n)},flush:rr,lerp:fo,merge:function(){let e=[].slice.call(arguments);return e.unshift({}),mt(...e)},pad:Ku,peek:$e,pluck:function(e,t){let n=$I[t]||($I[t]=W(t));return Ee(e)?e.map(n):n(e)},span:Jr,inrange:Sa,truncate:gh,rgb:bs,lab:qc,hcl:cp,hsl:Gc,luminance:Ex,contrast:function(e,t){let n=Ex(e),a=Ex(t);return(Math.max(n,a)+.05)/(Math.min(n,a)+.05)},sequence:Qn,format:pB,utcFormat:hB,utcParse:gB,utcOffset:G0,utcSequence:Fh,timeFormat:OI,timeParse:mB,timeOffset:Kd,timeSequence:Lh,timeUnitSpecifier:Hd,monthFormat:function(e){return cw.call(this,e,1,"%B")},monthAbbrevFormat:function(e){return cw.call(this,e,1,"%b")},dayFormat:function(e){return cw.call(this,0,2+e,"%A")},dayAbbrevFormat:function(e){return cw.call(this,0,2+e,"%a")},quarter:Ct,utcquarter:ht,week:qd,utcweek:Dh,dayofyear:M0,utcdayofyear:Oh,warn:function(){return yx(this.context.dataflow,"warn",arguments)},info:function(){return yx(this.context.dataflow,"info",arguments)},debug:function(){return yx(this.context.dataflow,"debug",arguments)},extent:e=>Un(e),inScope:function(e){let t=this.context.group,n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n},intersect:GI,clampRange:Xe,pinchDistance:function(e){let t=e.touches,n=t[0].clientX-t[1].clientX,a=t[0].clientY-t[1].clientY;return Math.hypot(n,a)},pinchAngle:function(e){let t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)},screen:function(){let e=zI();return e?e.screen:{}},containerSize:function(){let e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]},windowSize:function(){let e=zI();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]},bandspace:function(e,t,n){return Su(e||0,t||0,n||0)},setdata:function(e,t){let n=this.context.dataflow,a=this.context.data[e].input;return n.pulse(a,n.changeset().remove(Z).insert(t)),1},pathShape:function(e){let t=null;return function(n){return n?wn(n,t=t||Ut(e)):e}},panLinear:St,panLog:Tt,panPow:Xt,panSymlog:Ke,zoomLinear:Zt,zoomLog:wt,zoomPow:Jt,zoomSymlog:Lt,encode:function(e,t,n){if(e){let a=this.context.dataflow,r=e.mark.source;a.pulse(r,a.changeset().encode(e,t))}return n!==void 0?n:e},modify:function(e,t,n,a,r,i){let o=this.context.dataflow,u=this.context.data[e],c=u.input,f=o.stamp(),m,g,v=u.changes;if(o._trigger===!1||!(c.value.length||t||a))return 0;if((!v||v.stamp<f)&&(u.changes=v=o.changeset(),v.stamp=f,o.runAfter((()=>{u.modified=!0,o.pulse(c,v).run()}),!0,1)),n&&(m=n===!0?Z:Ee(n)||ru(n)?n:PI(n),v.remove(m)),t&&v.insert(t),a&&(m=PI(a),c.value.some(m)?v.remove(m):v.insert(a)),r)for(g in i)v.modify(r,g,i[g]);return 1},lassoAppend:function(e,t,n){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5,r=(e=Ie(e))[e.length-1];return r===void 0||Math.hypot(r[0]-t,r[1]-n)>a?[...e,[t,n]]:e},lassoPath:function(e){return Ie(e).reduce(((t,n,a)=>{let[r,i]=n;return t+(a==0?`M ${r},${i} `:a===e.length-1?" Z":`L ${r},${i} `)}),"")},intersectLasso:function(e,t,n){let{x:a,y:r,mark:i}=n,o=new In().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(let[u,c]of t)u<o.x1&&(o.x1=u),u>o.x2&&(o.x2=u),c<o.y1&&(o.y1=c),c>o.y2&&(o.y2=c);return o.translate(a,r),GI([[o.x1,o.y1],[o.x2,o.y2]],e,i).filter((u=>(function(c,f,m){let g=0;for(let v=0,E=m.length-1;v<m.length;E=v++){let[k,_]=m[E],[N,O]=m[v];O>f!=_>f&&c<(k-N)*(f-O)/(_-O)+N&&g++}return 1&g})(u.x,u.y,t)))}},kB=["view","item","group","xy","x","y"],SB="event.vega.",jI="this.",kx={},HI={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${st(DI+e)}]`,functions:function(e){let t=xI(e);kB.forEach((n=>t[n]=SB+n));for(let n in Wb)t[n]=jI+n;return mt(t,vB(e,Wb,kx)),t},constants:SI,visitors:kx},Sx=AI(HI);function Zn(e,t,n){return arguments.length===1?Wb[e]:(Wb[e]=t,n&&(kx[e]=n),Sx&&(Sx.functions[e]=jI+e),this)}function Ms(e,t){let n={},a;try{a=kI(e=Ft(e)?e:st(e)+"")}catch{F("Expression parse error: "+e)}a.visit((i=>{if(i.type!==uI)return;let o=i.callee.name,u=HI.visitors[o];u&&u(o,i.arguments,t,n)}));let r=Sx(a);return r.globals.forEach((i=>{let o=DI+i;!nt(n,o)&&t.getSignal(i)&&(n[o]=t.signalRef(i))})),{$expr:mt({code:r.code},t.options.ast?{ast:a}:null),$fields:r.fields,$params:n}}Zn("bandwidth",(function(e,t){let n=Ol(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}),qr),Zn("copy",(function(e,t){let n=Ol(e,(t||this).context);return n?n.copy():void 0}),qr),Zn("domain",(function(e,t){let n=Ol(e,(t||this).context);return n?n.domain():[]}),qr),Zn("range",(function(e,t){let n=Ol(e,(t||this).context);return n&&n.range?n.range():[]}),qr),Zn("invert",(function(e,t,n){let a=Ol(e,(n||this).context);return a?Ee(t)?(a.invertRange||a.invert)(t):(a.invert||a.invertExtent)(t):void 0}),qr),Zn("scale",(function(e,t,n){let a=Ol(e,(n||this).context);return a?a(t):void 0}),qr),Zn("gradient",(function(e,t,n,a,r){e=Ol(e,(r||this).context);let i=Je(t,n),o=e.domain(),u=o[0],c=$e(o),f=ee;return c-u?f=od(e,u,c):e=(e.interpolator?Bt("sequential")().interpolator(e.interpolator()):Bt("linear")().interpolate(e.interpolate()).range(e.range())).domain([u=0,c=1]),e.ticks&&(o=e.ticks(+a||15),u!==o[0]&&o.unshift(u),c!==$e(o)&&o.push(c)),o.forEach((m=>i.stop(f(m),e(m)))),i}),qr),Zn("geoArea",EB,qr),Zn("geoBounds",wB,qr),Zn("geoCentroid",_B,qr),Zn("geoShape",(function(e,t,n){let a=Ol(e,(n||this).context);return function(r){return a?a.path.context(r)(t):""}}),qr),Zn("indata",(function(e,t,n){let a=this.context.data[e]["index:"+t],r=a?a.value.get(n):void 0;return r&&r.count}),(function(e,t,n,a){t[0].type!==Qp&&F("First argument to indata must be a string literal."),t[1].type!==Qp&&F("Second argument to indata must be a string literal.");let r=t[0].value,i=t[1].value,o=yB+i;nt(o,a)||(a[o]=n.getData(r).indataRef(n,i))})),Zn("data",II,gx),Zn("treePath",(function(e,t,n){let a=UI(e,this),r=a[t],i=a[n];return r&&i?r.path(i).map(BI):void 0}),gx),Zn("treeAncestors",(function(e,t){let n=UI(e,this)[t];return n?n.ancestors().map(BI):void 0}),gx),Zn("vlSelectionTest",(function(e,t,n){for(var a,r,i,o,u,c=this.context.data[e],f=c?c.values.value:[],m=c?c[lw]&&c[lw].value:void 0,g=n===fx,v=f.length,E=0;E<v;++E)if(a=f[E],m&&g){if((i=(r=r||{})[o=a.unit]||0)===-1)continue;if(u=RI(t,a),r[o]=u?-1:++i,u&&m.size===1)return!0;if(!u&&i===m.get(o).count)return!1}else if(g^(u=RI(t,a)))return u;return v&&g}),hx),Zn("vlSelectionIdTest",(function(e,t,n){let a=this.context.data[e],r=a?a.values.value:[],i=a?a[lw]&&a[lw].value:void 0,o=n===fx,u=Hb(t),c=uB(r,u);if(c===r.length||Hb(r[c])!==u)return!1;if(i&&o){if(i.size===1)return!0;if(cB(r,u)-c<i.size)return!1}return!0}),hx),Zn("vlSelectionResolve",(function(e,t,n,a){for(var r,i,o,u,c,f,m,g,v,E,k,_,N=this.context.data[e],O=N?N.values.value:[],I={},B={},M={},U=O.length,z=0;z<U;++z)if(u=(r=O[z]).unit,i=r.fields,o=r.values,i&&o){for(k=0,_=i.length;k<_;++k)c=i[k],g=(m=I[c.field]||(I[c.field]={}))[u]||(m[u]=[]),M[c.field]=v=c.type.charAt(0),E=px[`${v}_union`],m[u]=E(g,Ie(o[k]));n&&(g=B[u]||(B[u]=[])).push(Ie(o).reduce(((q,Y,K)=>(q[i[K].field]=Y,q)),{}))}else c=Ds,f=Hb(r),(g=(m=I[c]||(I[c]={}))[u]||(m[u]=[])).push(f),n&&(g=B[u]||(B[u]=[])).push({[Ds]:f});return t=t||TI,I[Ds]?I[Ds]=px[`${Ds}_${t}`](...Object.values(I[Ds])):Object.keys(I).forEach((q=>{I[q]=Object.keys(I[q]).map((Y=>I[q][Y])).reduce(((Y,K)=>Y===void 0?K:px[`${M[q]}_${t}`](Y,K)))})),O=Object.keys(B),n&&O.length&&(I[a?nB:tB]=t===TI?{[CI]:O.reduce(((q,Y)=>(q.push(...B[Y]),q)),[])}:{[aB]:O.map((q=>({[CI]:B[q]})))}),I}),hx),Zn("vlSelectionTuples",(function(e,t){return e.map((n=>mt(t.fields?{values:t.fields.map((a=>(a.getter||(a.getter=W(a.field)))(n.datum)))}:{[Ds]:Hb(n.datum)},t)))}));let xB=ir(["rule"]),qI=ir(["group","image","rect"]);function xx(e){return(e+"").toLowerCase()}function Vb(e,t,n){n.endsWith(";")||(n="return("+n+");");let a=Function(...t.concat(n));return e&&e.functions?a.bind(e.functions):a}var AB={operator:(e,t)=>Vb(e,["_"],t.code),parameter:(e,t)=>Vb(e,["datum","_"],t.code),event:(e,t)=>Vb(e,["event"],t.code),handler:(e,t)=>Vb(e,["_","event"],`var datum=event.item&&event.item.datum;return ${t.code};`),encode:(e,t)=>{let{marktype:n,channels:a}=t,r="var o=item,datum=o.datum,m=0,$;";for(let i in a){let o="o["+st(i)+"]";r+=`$=${a[i].code};if(${o}!==$)${o}=$,m=1;`}return r+=(function(i,o){let u="";return xB[o]||(i.x2&&(i.x?(qI[o]&&(u+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),u+="o.width=o.x2-o.x;"):u+="o.x=o.x2-(o.width||0);"),i.xc&&(u+="o.x=o.xc-(o.width||0)/2;"),i.y2&&(i.y?(qI[o]&&(u+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),u+="o.height=o.y2-o.y;"):u+="o.y=o.y2-(o.height||0);"),i.yc&&(u+="o.y=o.yc-(o.height||0)/2;")),u})(a,n),r+="return m;",Vb(e,["item","_"],r)},codegen:{get(e){let t=`[${e.map(st).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n,a=Function("a","b","var u, v; return "+e.map(((r,i)=>{let o=t[i],u,c;return r.path?(u=`a${r.path}`,c=`b${r.path}`):((n=n||{})["f"+i]=r,u=`this.f${i}(a)`,c=`this.f${i}(b)`),(function(f,m,g,v){return`((u = ${f}) < (v = ${m}) || u == null) && v != null ? ${g}
10
10
  : (u > v || v == null) && u != null ? ${v}
11
11
  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${g}
12
12
  : v !== v && u === u ? ${v} : `})(u,c,-o,o)})).join("")+"0;");return n?a.bind(n):a}}};function WI(e,t,n){if(!e||!ye(e))return e;for(let a,r=0,i=VI.length;r<i;++r)if(a=VI[r],nt(e,a.key))return a.parse(e,t,n);return e}var VI=[{key:"$ref",parse:function(e,t){return t.get(e.$ref)||F("Operator not defined: "+e.$ref)}},{key:"$key",parse:function(e,t){let n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=Ai(e.$key,e.$flat,t.expr.codegen))}},{key:"$expr",parse:function(e,t,n){e.$params&&t.parseParameters(e.$params,n);let a="e:"+e.$expr.code;return t.fn[a]||(t.fn[a]=b(t.parameterExpression(e.$expr),e.$fields))}},{key:"$field",parse:function(e,t){if(!e.$field)return null;let n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=W(e.$field,e.$name,t.expr.codegen))}},{key:"$encode",parse:function(e,t){let n=e.$encode,a={};for(let r in n){let i=n[r];a[r]=b(t.encodeExpression(i.$expr),i.$fields),a[r].output=i.$output}return a}},{key:"$compare",parse:function(e,t){let n="c:"+e.$compare+"_"+e.$order,a=Ie(e.$compare).map((r=>r&&r.$tupleid?rt:r));return t.fn[n]||(t.fn[n]=Fl(a,e.$order,t.expr.codegen))}},{key:"$context",parse:function(e,t){return t}},{key:"$subflow",parse:function(e,t){let n=e.$subflow;return function(a,r,i){let o=t.fork().parse(n),u=o.get(n.operators[0].id),c=o.signals.parent;return c&&c.set(i),u.detachSubflow=()=>t.detach(o),u}}},{key:"$tupleid",parse:function(){return rt}}];let TB={skip:!0};function YI(e,t,n,a){return new KI(e,t,n,a)}function KI(e,t,n,a){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=a||AB,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function XI(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}function ZI(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}KI.prototype=XI.prototype={fork(){let e=new XI(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter((n=>n!==e));let t=Object.keys(e.nodes);for(let n of t)e.nodes[n]._targets=null;for(let n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){let n=this,a=n.dataflow,r=e.value;if(n.set(e.id,t),(function(i){return xx(i)==="collect"})(e.type)&&r&&(r.$ingest?a.ingest(t,r.$ingest,r.$format):r.$request?a.preload(t,r.$request,r.$format):a.pulse(t,a.changeset().insert(r))),e.root&&(n.root=t),e.parent){let i=n.get(e.parent.$ref);i?(a.connect(i,[t]),t.targets().add(i)):(n.unresolved=n.unresolved||[]).push((()=>{i=n.get(e.parent.$ref),a.connect(i,[t]),t.targets().add(i)}))}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(let i in e.data){let o=n.data[i]||(n.data[i]={});e.data[i].forEach((u=>o[u]=t))}},resolve(){return(this.unresolved||[]).forEach((e=>e())),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[xx(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,a,r){this.dataflow.on(t,n,a,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:function(e){let t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach((a=>t.parseOperator(a))),n.forEach((a=>t.parseOperatorParameters(a))),(e.streams||[]).forEach((a=>t.parseStream(a))),(e.updates||[]).forEach((a=>t.parseUpdate(a))),t.resolve()},parseOperator:function(e){let t=this;!(function(n){return xx(n)==="operator"})(e.type)&&e.type?t.transform(e,e.type):t.operator(e,e.update?t.operatorExpression(e.update):null)},parseOperatorParameters:function(e){let t=this;if(e.params){let n=t.get(e.id);n||F("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}},parseParameters:function(e,t){t=t||{};let n=this;for(let a in e){let r=e[a];t[a]=Ee(r)?r.map((i=>WI(i,n,t))):WI(r,n,t)}return t},parseStream:function(e){var t,n=this,a=e.filter!=null?n.eventExpression(e.filter):void 0,r=e.stream!=null?n.get(e.stream):void 0;e.source?r=n.events(e.source,e.type,a):e.merge&&(r=(t=e.merge.map((i=>n.get(i))))[0].merge.apply(t[0],t.slice(1))),e.between&&(t=e.between.map((i=>n.get(i))),r=r.between(t[0],t[1])),e.filter&&(r=r.filter(a)),e.throttle!=null&&(r=r.throttle(+e.throttle)),e.debounce!=null&&(r=r.debounce(+e.debounce)),r==null&&F("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),n.stream(e,r)},parseUpdate:function(e){var t,n=this,a=ye(a=e.source)?a.$ref:a,r=n.get(a),i=e.update,o=void 0;r||F("Source not defined: "+e.source),t=e.target&&e.target.$expr?n.eventExpression(e.target.$expr):n.get(e.target),i&&i.$expr&&(i.$params&&(o=n.parseParameters(i.$params)),i=n.handlerExpression(i.$expr)),n.update(e,r,t,i,o)},getState:function(e){var t=this,n={};if(e.signals){var a=n.signals={};Object.keys(t.signals).forEach((i=>{let o=t.signals[i];e.signals(i,o)&&(a[i]=o.value)}))}if(e.data){var r=n.data={};Object.keys(t.data).forEach((i=>{let o=t.data[i];e.data(i,o)&&(r[i]=o.input.value)}))}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map((i=>i.getState(e)))),n},setState:function(e){var t=this,n=t.dataflow,a=e.data,r=e.signals;Object.keys(r||{}).forEach((i=>{n.update(t.signals[i],r[i],TB)})),Object.keys(a||{}).forEach((i=>{n.pulse(t.data[i].input,n.changeset().remove(Z).insert(a[i]))})),(e.subcontext||[]).forEach(((i,o)=>{let u=t.subcontext[o];u&&u.setState(i)}))}};let Ax="default";function Tx(e,t){let n=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(n)return t==null?n.style.removeProperty("cursor"):n.style.cursor=t}function dw(e,t){var n=e._runtime.data;return nt(n,t)||F("Unrecognized data set: "+t),n[t]}function fw(e,t){su(t)||F("Second argument to changes must be a changeset.");let n=dw(this,e);return n.modified=!0,this.pulse(n.input,t)}function JI(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function QI(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function pw(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function CB(e,t,n){var a,r,i=e._renderer,o=i&&i.canvas();return o&&(r=pw(e),(a=Bv(t.changedTouches?t.changedTouches[0]:t,o))[0]-=r[0],a[1]-=r[1]),t.dataflow=e,t.item=n,t.vega=(function(u,c,f){let m=c?c.mark.marktype==="group"?c:c.mark.group:null;function g(E){var k,_=m;if(E){for(k=c;k;k=k.mark.group)if(k.mark.name===E){_=k;break}}return _&&_.mark&&_.mark.interactive?_:{}}function v(E){if(!E)return f;Ft(E)&&(E=g(E));let k=f.slice();for(;E;)k[0]-=E.x||0,k[1]-=E.y||0,E=E.mark&&E.mark.group;return k}return{view:mn(u),item:mn(c||{}),group:g,xy:v,x:E=>v(E)[0],y:E=>v(E)[1]}})(e,n,a),t}let eO="view",RB="timer",NB="window",IB={trap:!1};function tO(e,t,n,a){e._eventListeners.push({type:n,sources:Ie(t),handler:a})}function hw(e,t,n){let a=e._eventConfig&&e._eventConfig[t];return!(a===!1||ye(a)&&!a[n])||(e.warn(`Blocked ${t} ${n} event listener.`),!1)}function nO(e){return e.item}function aO(e){return e.item.mark.source}function rO(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function wi(e,t,n){let a=document.createElement(e);for(let r in t)a.setAttribute(r,t[r]);return n!=null&&(a.textContent=n),a}let OB="vega-bind",DB="vega-bind-name",MB="vega-bind-radio";function LB(e,t,n,a){let r=n.event||"input",i=()=>e.update(t.value);a.signal(n.signal,t.value),t.addEventListener(r,i),tO(a,t,r,i),e.set=o=>{t.value=o,t.dispatchEvent((function(u){return typeof Event<"u"?new Event(u):{type:u}})(r))}}function FB(e,t,n,a){let r=a.signal(n.signal),i=wi("div",{class:OB}),o=n.input==="radio"?i:i.appendChild(wi("label"));o.appendChild(wi("span",{class:DB},n.name||n.signal)),t.appendChild(i);let u=PB;switch(n.input){case"checkbox":u=$B;break;case"select":u=BB;break;case"radio":u=UB;break;case"range":u=zB}u(e,o,n,r)}function PB(e,t,n,a){let r=wi("input");for(let i in n)i!=="signal"&&i!=="element"&&r.setAttribute(i==="input"?"type":i,n[i]);r.setAttribute("name",n.signal),r.value=a,t.appendChild(r),r.addEventListener("input",(()=>e.update(r.value))),e.elements=[r],e.set=i=>r.value=i}function $B(e,t,n,a){let r={type:"checkbox",name:n.signal};a&&(r.checked=!0);let i=wi("input",r);t.appendChild(i),i.addEventListener("change",(()=>e.update(i.checked))),e.elements=[i],e.set=o=>i.checked=!!o||null}function BB(e,t,n,a){let r=wi("select",{name:n.signal}),i=n.labels||[];n.options.forEach(((o,u)=>{let c={value:o};mw(o,a)&&(c.selected=!0),r.appendChild(wi("option",c,(i[u]||o)+""))})),t.appendChild(r),r.addEventListener("change",(()=>{e.update(n.options[r.selectedIndex])})),e.elements=[r],e.set=o=>{for(let u=0,c=n.options.length;u<c;++u)if(mw(n.options[u],o))return void(r.selectedIndex=u)}}function UB(e,t,n,a){let r=wi("span",{class:MB}),i=n.labels||[];t.appendChild(r),e.elements=n.options.map(((o,u)=>{let c={type:"radio",name:n.signal,value:o};mw(o,a)&&(c.checked=!0);let f=wi("input",c);f.addEventListener("change",(()=>e.update(o)));let m=wi("label",{},(i[u]||o)+"");return m.prepend(f),r.appendChild(m),f})),e.set=o=>{let u=e.elements,c=u.length;for(let f=0;f<c;++f)mw(u[f].value,o)&&(u[f].checked=!0)}}function zB(e,t,n,a){a=a!==void 0?a:(+n.max+ +n.min)/2;let r=n.max!=null?n.max:Math.max(100,+a)||100,i=n.min||Math.min(0,r,+a)||0,o=n.step||Ri(i,r,100),u=wi("input",{type:"range",name:n.signal,min:i,max:r,step:o});u.value=a;let c=wi("span",{},+a);t.appendChild(u),t.appendChild(c);let f=()=>{c.textContent=u.value,e.update(+u.value)};u.addEventListener("input",f),u.addEventListener("change",f),e.elements=[u],e.set=m=>{u.value=m,c.textContent=m}}function mw(e,t){return e===t||e+""==t+""}function iO(e,t,n,a,r,i){return(t=t||new a(e.loader())).initialize(n,JI(e),QI(e),pw(e),r,i).background(e.background())}function Cx(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function Rx(e,t,n){if(typeof t=="string"){if(typeof document>"u")return e.error("DOM document instance not found."),null;if(!(t=document.querySelector(t)))return e.error("Signal bind element not found: "+t),null}if(t&&n)try{t.textContent=""}catch(a){t=null,e.error(a)}return t}let Yb=e=>+e||0,GB=e=>({top:e,bottom:e,left:e,right:e});function oO(e){return ye(e)?{top:Yb(e.top),bottom:Yb(e.bottom),left:Yb(e.left),right:Yb(e.right)}:GB(Yb(e))}async function Nx(e,t,n,a){let r=Xv(t),i=r&&r.headless;return i||F("Unrecognized renderer type: "+t),await e.runAsync(),iO(e,null,null,i,n,a).renderAsync(e._scenegraph.root)}var sO="width",lO="height",Ix="padding",uO={skip:!0};function cO(e,t){var n=e.autosize(),a=e.padding();return t-(n&&n.contains===Ix?a.left+a.right:0)}function dO(e,t){var n=e.autosize(),a=e.padding();return t-(n&&n.contains===Ix?a.top+a.bottom:0)}function jB(e,t){return t.modified&&Ee(t.input.value)&&e.indexOf("_:vega:_")}function HB(e,t){return!(e==="parent"||t instanceof tl.proxy)}function qB(e,t,n,a){let r=e.element();r&&r.setAttribute("title",(function(i){return i==null?"":Ee(i)?fO(i):ye(i)&&!Sn(i)?(o=i,Object.keys(o).map((u=>{let c=o[u];return u+": "+(Ee(c)?fO(c):pO(c))})).join(`
13
- `)):i+"";var o})(a))}function fO(e){return"["+e.map(pO).join(", ")+"]"}function pO(e){return Ee(e)?"[\u2026]":ye(e)&&!Sn(e)?"{\u2026}":e}function hO(e,t){let n=this;if(t=t||{},el.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){let i=mt({},e.locale,t.locale);n.locale(Qh(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Fu.Canvas,n._scenegraph=new V1;let a=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||qB,n._redraw=!0,n._handler=new sb().scene(a),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=(function(i){let o=mt({defaults:{}},i),u=(c,f)=>{f.forEach((m=>{Ee(c[m])&&(c[m]=ir(c[m]))}))};return u(o.defaults,["prevent","allow"]),u(o,["view","window","selector"]),o})(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);let r=(function(i,o,u){return YI(i,tl,Wb,u).parse(o)})(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((i=>({state:null,param:mt({},i)}))),r.root&&r.root.set(a),a.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(a.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=cO(n,n._width),n._viewHeight=dO(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,(function(i){var o=i._signals,u=o[sO],c=o[lO],f=o[Ix];function m(){i._autosize=i._resize=1}i._resizeWidth=i.add(null,(v=>{i._width=v.size,i._viewWidth=cO(i,v.size),m()}),{size:u}),i._resizeHeight=i.add(null,(v=>{i._height=v.size,i._viewHeight=dO(i,v.size),m()}),{size:c});let g=i.add(null,m,{pad:f});i._resizeWidth.rank=u.rank+1,i._resizeHeight.rank=c.rank+1,g.rank=f.rank+1})(n),(function(i){i.add(null,(o=>(i._background=o.bg,i._resize=1,o.bg)),{bg:i._signals.background})})(n),(function(i){let o=i._signals.cursor||(i._signals.cursor=i.add({user:Ax,item:null}));i.on(i.events("view","mousemove"),o,((u,c)=>{let f=o.value,m=f?Ft(f)?f:f.user:Ax,g=c.item&&c.item.cursor||null;return f&&m===f.user&&g==f.item?f:{user:m,item:g}})),i.add(null,(function(u){let c=u.cursor,f=this.value;return Ft(c)||(f=c.item,c=c.user),Tx(i,c&&c!==Ax?c:f||c),f}),{cursor:o})})(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function gw(e,t){return nt(e._signals,t)?e._signals[t]:F("Unrecognized signal name: "+st(t))}function mO(e,t){let n=(e._targets||[]).filter((a=>a._update&&a._update.handler===t));return n.length?n[0]:null}function gO(e,t,n,a){let r=mO(n,a);return r||(r=Cx(e,(()=>a(t,n.value))),r.handler=a,e.on(n,null,r)),e}function bO(e,t,n){let a=mO(t,n);return a&&t._targets.remove(a),e}Fe(hO,el,{async evaluate(e,t,n){if(await el.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,(function(a){var r=pw(a),i=JI(a),o=QI(a);a._renderer.background(a.background()),a._renderer.resize(i,o,r),a._handler.origin(r),a._resizeListeners.forEach((u=>{try{u(i,o)}catch(c){a.error(c)}}))})(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(a){this.error(a)}return n&&vn(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){let t=e!=null?e+"":null;return t!==this._desc&&ZI(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){let a=gw(this,e);return arguments.length===1?a.value:this.update(a,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",oO(e)):oO(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(Xv(e)||F("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(el.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(gw(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,a,r,i){this.runAfter((o=>{let u=0;o._autosize=0,o.width()!==n&&(u=1,o.signal(sO,n,uO),o._resizeWidth.skip(!0)),o.height()!==a&&(u=1,o.signal(lO,a,uO),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),o._origin[0]===r[0]&&o._origin[1]===r[1]||(o._resize=1,o._origin=r),u&&o.run("enter"),i&&o.runAfter((c=>c.resize()))}),!1,1)},addEventListener(e,t,n){let a=t;return n&&n.trap===!1||(a=Cx(this,t),a.raw=t),this._handler.on(e,a),this},removeEventListener(e,t){for(var n,a,r=this._handler.handlers(e),i=r.length;--i>=0;)if(a=r[i].type,n=r[i].handler,e===a&&(t===n||t===n.raw)){this._handler.off(a,n);break}return this},addResizeListener(e){let t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return gO(this,e,gw(this,e),t)},removeSignalListener(e,t){return bO(this,gw(this,e),t)},addDataListener(e,t){return gO(this,e,dw(this,e).values,t)},removeDataListener(e,t){return bO(this,dw(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){let t=Tx(this,null);this._globalCursor=!!e,t&&Tx(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push((function(n,a,r){var i=new jE,o=a;return a==null?(i.restart(n,a,r),i):(i._restart=i.restart,i.restart=function(u,c,f){c=+c,f=f==null?vS():+f,i._restart((function m(g){g+=o,i._restart(m,o+=c,f),u(g)}),c,f)},i.restart(n,a,r),i)})((function(n){e({timestamp:Date.now(),elapsed:n})}),t))},events:function(e,t,n){var a,r=this,i=new Ui(n),o=function(f,m){r.runAsync(null,(()=>{e===eO&&(function(g,v){var E=g._eventConfig.defaults,k=E.prevent,_=E.allow;return k!==!1&&_!==!0&&(k===!0||_===!1||(k?k[v]:_?!_[v]:g.preventDefault()))})(r,t)&&f.preventDefault(),i.receive(CB(r,f,m))}))};if(e===RB)hw(r,"timer",t)&&r.timer(o,t);else if(e===eO)hw(r,"view",t)&&r.addEventListener(t,o,IB);else if(e===NB?hw(r,"window",t)&&typeof window<"u"&&(a=[window]):typeof document<"u"&&hw(r,"selector",t)&&(a=Array.from(document.querySelectorAll(e))),a){for(var u=0,c=a.length;u<c;++u)a[u].addEventListener(t,o);tO(r,a,t,o)}else r.warn("Can not resolve event source: "+e);return i},finalize:function(){var e,t,n,a=this._tooltip,r=this._timers,i=this._eventListeners;for(e=r.length;--e>=0;)r[e].stop();for(e=i.length;--e>=0;)for(t=(n=i[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return a&&a.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",nO),aO,rO(e)),this.on(this.events("view","mouseout",nO),aO,rO(t)),this},data:function(e,t){return arguments.length<2?dw(this,e).values.value:fw.call(this,e,us().remove(Z).insert(t))},change:fw,insert:function(e,t){return fw.call(this,e,us().insert(t))},remove:function(e,t){return fw.call(this,e,us().remove(t))},scale:function(e){var t=this._runtime.scales;return nt(t,e)||F("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){let n=this,a=n._renderType,r=n._eventConfig.bind,i=Xv(a);e=n._el=e?Rx(n,e,!0):null,(function(c){let f=c.container();f&&(f.setAttribute("role","graphics-document"),f.setAttribute("aria-roleDescription","visualization"),ZI(f,c.description()))})(n),i||n.error("Unrecognized renderer type: "+a);let o=i.handler||sb,u=e?i.renderer:i.headless;return n._renderer=u?iO(n,n._renderer,e,u):null,n._handler=(function(c,f,m,g){let v=new g(c.loader(),Cx(c,c.tooltip())).scene(c.scenegraph().root).initialize(m,pw(c),c);return f&&f.handlers().forEach((E=>{v.on(E.type,E.handler)})),v})(n,n._handler,e,o),n._redraw=!0,e&&r!=="none"&&(t=t?n._elBind=Rx(n,t,!0):e.appendChild(wi("form",{class:"vega-bindings"})),n._bind.forEach((c=>{c.param.element&&r!=="container"&&(c.element=Rx(n,c.param.element,!!c.param.input))})),n._bind.forEach((c=>{(function(f,m,g){if(!m)return;let v=g.param,E=g.state;E||(E=g.state={elements:null,active:!1,set:null,update:k=>{k!=f.signal(v.signal)&&f.runAsync(null,(()=>{E.source=!0,f.signal(v.signal,k)}))}},v.debounce&&(E.update=Zo(v.debounce,E.update))),(v.input==null&&v.element?LB:FB)(E,m,v,f),E.active||(f.on(f._signals[v.signal],null,(()=>{E.source?E.source=!1:E.set(f.signal(v.signal))})),E.active=!0)})(n,c.element||t,c)}))),n},toImageURL:async function(e,t){e!==Fu.Canvas&&e!==Fu.SVG&&e!==Fu.PNG&&F("Unrecognized image type: "+e);let n=await Nx(this,e,t);return e===Fu.SVG?(function(a,r){let i=new Blob([a],{type:r});return window.URL.createObjectURL(i)})(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await Nx(this,Fu.Canvas,e,t)).canvas()},toSVG:async function(e){return(await Nx(this,Fu.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:jB,signals:HB,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(t=>{t._trigger=!0})),this}});let WB="view",bw="[",yw="]",yO="{",vO="}",VB=":",EO=",",YB="@",KB=">",XB=/[[\]{}]/,ZB={"*":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},wO,_O;function kO(e,t,n){return wO=t||WB,_O=n||ZB,SO(e.trim()).map(Ox)}function Kb(e,t,n,a,r){let i=e.length,o,u=0;for(;t<i;++t){if(o=e[t],!u&&o===n)return t;r&&r.indexOf(o)>=0?--u:a&&a.indexOf(o)>=0&&++u}return t}function SO(e){let t=[],n=e.length,a=0,r=0;for(;r<n;)r=Kb(e,r,EO,bw+yO,yw+vO),t.push(e.substring(a,r).trim()),a=++r;if(t.length===0)throw"Empty event selector: "+e;return t}function Ox(e){return e[0]==="["?(function(t){let n=t.length,a,r=1;if(r=Kb(t,r,yw,bw,yw),r===n)throw"Empty between selector: "+t;if(a=SO(t.substring(1,r)),a.length!==2)throw"Between selector must have two elements: "+t;if(t=t.slice(r+1).trim(),t[0]!==KB)throw"Expected '>' after between selector: "+t;a=a.map(Ox);let i=Ox(t.slice(1).trim());return i.between?{between:a,stream:i}:(i.between=a,i)})(e):(function(t){let n={source:wO},a=[],r,i,o=[0,0],u=0,c=0,f=t.length,m=0;if(t[f-1]===vO){if(m=t.lastIndexOf(yO),!(m>=0))throw"Unmatched right brace: "+t;try{o=(function(g){let v=g.split(EO);if(!g.length||v.length>2)throw g;return v.map((E=>{let k=+E;if(k!=k)throw g;return k}))})(t.substring(m+1,f-1))}catch{throw"Invalid throttle specification: "+t}f=(t=t.slice(0,m).trim()).length,m=0}if(!f)throw t;if(t[0]===YB&&(u=++m),r=Kb(t,m,VB),r<f&&(a.push(t.substring(c,r).trim()),c=m=++r),m=Kb(t,m,bw),m===f)a.push(t.substring(c,f).trim());else if(a.push(t.substring(c,m).trim()),i=[],c=++m,c===f)throw"Unmatched left bracket: "+t;for(;m<f;){if(m=Kb(t,m,yw),m===f)throw"Unmatched left bracket: "+t;if(i.push(t.substring(c,m).trim()),m<f-1&&t[++m]!==bw)throw"Expected left bracket: "+t;c=++m}if(!(f=a.length)||XB.test(a[f-1]))throw"Invalid event selector: "+t;return f>1?(n.type=a[1],u?n.markname=a[0].slice(1):(function(g){return _O[g]})(a[0])?n.marktype=a[0]:n.source=a[0]):n.type=a[0],n.type.slice(-1)==="!"&&(n.consume=!0,n.type=n.type.slice(0,-1)),i!=null&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n})(e)}function JB(e){return ye(e)?e:{type:e||"pad"}}let Xb=e=>+e||0,QB=e=>({top:e,bottom:e,left:e,right:e});function eU(e){return ye(e)?e.signal?e:{top:Xb(e.top),bottom:Xb(e.bottom),left:Xb(e.left),right:Xb(e.right)}:QB(Xb(e))}let va=e=>ye(e)&&!Ee(e)?mt({},e):{value:e};function xO(e,t,n,a){return n!=null?(ye(n)&&!Ee(n)||Ee(n)&&n.length&&ye(n[0])?e.update[t]=n:e[a||"enter"][t]={value:n},1):0}function Fa(e,t,n){for(let a in t)xO(e,a,t[a]);for(let a in n)xO(e,a,n[a],"update")}function eh(e,t,n){for(let a in t)n&&nt(n,a)||(e[a]=mt(e[a]||{},t[a]));return e}function th(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}let Dx="mark",Mx="frame",Lx="scope",tU="axis",nU="axis-domain",aU="axis-grid",rU="axis-label",iU="axis-tick",oU="axis-title",sU="legend",lU="legend-band",uU="legend-entry",cU="legend-gradient",AO="legend-label",dU="legend-symbol",fU="legend-title",pU="title",hU="title-text",mU="title-subtitle";function Fx(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}let TO=e=>Ft(e)?st(e):e.signal?`(${e.signal})`:CO(e);function vw(e){if(e.gradient!=null)return(function(n){let a=[n.start,n.stop,n.count].map((r=>r==null?null:st(r)));for(;a.length&&$e(a)==null;)a.pop();return a.unshift(TO(n.gradient)),`gradient(${a.join(",")})`})(e);let t=e.signal?`(${e.signal})`:e.color?(function(n){return n.c?Ew("hcl",n.h,n.c,n.l):n.h||n.s?Ew("hsl",n.h,n.s,n.l):n.l||n.a?Ew("lab",n.l,n.a,n.b):n.r||n.g||n.b?Ew("rgb",n.r,n.g,n.b):null})(e.color):e.field!=null?CO(e.field):e.value!==void 0?st(e.value):void 0;return e.scale!=null&&(t=(function(n,a){let r=TO(n.scale);return n.range!=null?a=`lerp(_range(${r}), ${+n.range})`:(a!==void 0&&(a=`_scale(${r}, ${a})`),n.band&&(a=(a?a+"+":"")+`_bandwidth(${r})`+(+n.band==1?"":"*"+ww(n.band)),n.extra&&(a=`(datum.extra ? _scale(${r}, datum.extra.value) : ${a})`)),a==null&&(a="0")),a})(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${ww(e.exponent)})`),e.mult!=null&&(t+=`*${ww(e.mult)}`),e.offset!=null&&(t+=`+${ww(e.offset)}`),e.round&&(t=`round(${t})`),t}let Ew=(e,t,n,a)=>`(${e}(${[t,n,a].map(vw).join(",")})+'')`;function ww(e){return ye(e)?"("+vw(e)+")":e}function CO(e){return RO(ye(e)?e:{datum:e})}function RO(e){let t,n,a;if(e.signal)t="datum",a=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(a=e.parent,t+=".datum"):a=e.group}else e.datum?(t="datum",a=e.datum):F("Invalid field reference: "+st(e));return e.signal||(a=Ft(a)?j(a).map(st).join("]["):RO(a)),t+"["+a+"]"}function NO(e,t,n,a,r,i){let o={};(i=i||{}).encoders={$encode:o},e=(function(u,c,f,m,g){let v={},E={},k,_,N,O;for(_ in _="lineBreak",c!=="text"||g[_]==null||th(_,u)||Fx(v,_,g[_]),(f=="legend"||String(f).startsWith("axis"))&&(f=null),O=f===Mx?g.group:f===Dx?mt({},g.mark,g[c]):null,O)N=th(_,u)||(_==="fill"||_==="stroke")&&(th("fill",u)||th("stroke",u)),N||Fx(v,_,O[_]);for(_ in Ie(m).forEach((I=>{let B=g.style&&g.style[I];for(let M in B)th(M,u)||Fx(v,M,B[M])})),u=mt({},u),v)O=v[_],O.signal?(k=k||{})[_]=O:E[_]=O;return u.enter=mt(E,u.enter),k&&(u.update=mt(k,u.update)),u})(e,t,n,a,r.config);for(let u in e)o[u]=gU(e[u],t,i,r);return i}function gU(e,t,n,a){let r={},i={};for(let u in e)e[u]!=null&&(r[u]=bU((o=e[u],Ee(o)?(function(c){let f="";return c.forEach((m=>{let g=vw(m);f+=m.test?`(${m.test})?${g}:`:g})),$e(f)===":"&&(f+="null"),f})(o):vw(o)),a,n,i));var o;return{$expr:{marktype:t,channels:r},$fields:Object.keys(i),$output:Object.keys(e)}}function bU(e,t,n,a){let r=Ms(e,t);return r.$fields.forEach((i=>a[i]=1)),mt(n,r.$params),r.$expr}let yU="outer",vU=["value","update","init","react","bind"];function IO(e,t){F(e+' for "outer" push: '+st(t))}function OO(e,t){let n=e.name;if(e.push===yU)t.signals[n]||IO("No prior signal definition",n),vU.forEach((a=>{e[a]!==void 0&&IO("Invalid property ",a)}));else{let a=t.addSignal(n,e.value);e.react===!1&&(a.react=!1),e.bind&&t.addBinding(n,e.bind)}}function Px(e,t,n,a){this.id=-1,this.type=e,this.value=t,this.params=n,a&&(this.parent=a)}function _w(e,t,n,a){return new Px(e,t,n,a)}function kw(e,t){return _w("operator",e,t)}function pt(e){let t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Zb(e,t){return t?{$field:e,$name:t}:{$field:e}}let $x=Zb("key");function DO(e,t){return{$compare:e,$order:t}}let EU="descending";function Sw(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}let Bx="scope",Ux="view";function ua(e){return e&&e.signal}function xw(e){if(ua(e))return!0;if(ye(e)){for(let t in e)if(xw(e[t]))return!0}return!1}function Wo(e,t){return e??t}function kd(e){return e&&e.signal||e}let MO="timer";function Jb(e,t){return(e.merge?wU:e.stream?_U:e.type?kU:F("Invalid stream specification: "+st(e)))(e,t)}function wU(e,t){let n=zx({merge:e.merge.map((a=>Jb(a,t)))},e,t);return t.addStream(n).id}function _U(e,t){let n=zx({stream:Jb(e.stream,t)},e,t);return t.addStream(n).id}function kU(e,t){let n;e.type===MO?(n=t.event(MO,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((function(r){return r===Bx?Ux:r||Ux})(e.source),e.type);let a=zx({stream:n},e,t);return Object.keys(a).length===1?n:t.addStream(a).id}function zx(e,t,n){let a=t.between;return a&&(a.length!==2&&F('Stream "between" parameter must have 2 entries: '+st(t)),e.between=[Jb(a[0],n),Jb(a[1],n)]),a=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&a.push((function(r,i,o){let u="event.item";return u+(r&&r!=="*"?"&&"+u+".mark.marktype==='"+r+"'":"")+(o?"&&"+u+".mark.role==='"+o+"'":"")+(i?"&&"+u+".mark.name==='"+i+"'":"")})(t.marktype,t.markname,t.markrole)),t.source===Bx&&a.push("inScope(event.item)"),a.length&&(e.filter=Ms("("+a.join(")&&(")+")",n).$expr),(a=t.throttle)!=null&&(e.throttle=+a),(a=t.debounce)!=null&&(e.debounce=+a),t.consume&&(e.consume=!0),e}let SU={code:"_.$value",ast:{type:"Identifier",value:"value"}};function xU(e,t,n){let a=e.encode,r={target:n},i=e.events,o=e.update,u=[];i||F("Signal update missing events specification."),Ft(i)&&(i=kO(i,t.isSubscope()?Bx:Ux)),i=Ie(i).filter((c=>c.signal||c.scale?(u.push(c),0):1)),u.length>1&&(u=[AU(u)]),i.length&&u.push(i.length>1?{merge:i}:i[0]),a!=null&&(o&&F("Signal encode and update are mutually exclusive."),o="encode(item(),"+st(a)+")"),r.update=Ft(o)?Ms(o,t):o.expr!=null?Ms(o.expr,t):o.value!=null?o.value:o.signal!=null?{$expr:SU,$params:{$value:t.signalRef(o.signal)}}:F("Invalid signal update specification."),e.force&&(r.options={force:!0}),u.forEach((c=>t.addUpdate(mt((function(f,m){return{source:f.signal?m.signalRef(f.signal):f.scale?m.scaleRef(f.scale):Jb(f,m)}})(c,t),r))))}function AU(e){return{signal:"["+e.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}let an=e=>(t,n,a)=>_w(e,n,t||void 0,a),LO=an("aggregate"),TU=an("axisticks"),FO=an("bound"),Vo=an("collect"),PO=an("compare"),CU=an("datajoin"),$O=an("encode"),RU=an("expression"),NU=an("facet"),IU=an("field"),OU=an("key"),DU=an("legendentries"),MU=an("load"),LU=an("mark"),FU=an("multiextent"),PU=an("multivalues"),$U=an("overlap"),BU=an("params"),BO=an("prefacet"),UU=an("projection"),zU=an("proxy"),GU=an("relay"),UO=an("render"),jU=an("scale"),Sd=an("sieve"),HU=an("sortitems"),zO=an("viewlayout"),qU=an("values"),WU=0,GO={min:"min",max:"max",count:"sum"};function VU(e,t){let n=t.getScale(e.name).params,a;for(a in n.domain=jO(e.domain,e,t),e.range!=null&&(n.range=qO(e,t,n)),e.interpolate!=null&&(function(r,i){i.interpolate=io(r.type||r),r.gamma!=null&&(i.interpolateGamma=io(r.gamma))})(e.interpolate,n),e.nice!=null&&(n.nice=(function(r){return ye(r)?{interval:io(r.interval),step:io(r.step)}:io(r)})(e.nice)),e.bins!=null&&(n.bins=(function(r,i){return r.signal||Ee(r)?Aw(r,i):i.objectProperty(r)})(e.bins,t)),e)nt(n,a)||a==="name"||(n[a]=io(e[a],t))}function io(e,t){return ye(e)?e.signal?t.signalRef(e.signal):F("Unsupported object: "+st(e)):e}function Aw(e,t){return e.signal?t.signalRef(e.signal):e.map((n=>io(n,t)))}function Tw(e){F("Can not find data set: "+st(e))}function jO(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Ee(e)?YU:e.fields?XU:KU)(e,t,n);t.domainMin==null&&t.domainMax==null||F("No scale domain defined for domainMin/domainMax to override.")}function YU(e,t,n){return e.map((a=>io(a,n)))}function KU(e,t,n){let a=n.getData(e.data);return a||Tw(e.data),xu(t.type)?a.valuesRef(n,e.field,HO(e.sort,!1)):yv(t.type)?a.domainRef(n,e.field):a.extentRef(n,e.field)}function XU(e,t,n){let a=e.data,r=e.fields.reduce(((i,o)=>(o=Ft(o)?{data:a,field:o}:Ee(o)||o.signal?(function(u,c){let f="_:vega:_"+WU++,m=Vo({});if(Ee(u))m.value={$ingest:u};else if(u.signal){let g="setdata("+st(f)+","+u.signal+")";m.params.input=c.signalRef(g)}return c.addDataPipeline(f,[m,Sd({})]),{data:f,field:"data"}})(o,n):o,i.push(o),i)),[]);return(xu(t.type)?ZU:yv(t.type)?JU:QU)(e,n,r)}function ZU(e,t,n){let a=HO(e.sort,!0),r,i,o=n.map((f=>{let m=t.getData(f.data);return m||Tw(f.data),m.countsRef(t,f.field,a)})),u={groupby:$x,pulse:o};a&&(r=a.op||"count",i=a.field?Sw(r,a.field):"count",u.ops=[GO[r]],u.fields=[t.fieldRef(i)],u.as=[i]),r=t.add(LO(u));let c=t.add(Vo({pulse:pt(r)}));return i=t.add(qU({field:$x,sort:t.sortRef(a),pulse:pt(c)})),pt(i)}function HO(e,t){return e&&(e.field||e.op?e.field||e.op==="count"?t&&e.field&&e.op&&!GO[e.op]&&F("Multiple domain scales can not be sorted using "+e.op):F("No field provided for sort aggregate op: "+e.op):ye(e)?e.field="key":e={field:"key"}),e}function JU(e,t,n){let a=n.map((r=>{let i=t.getData(r.data);return i||Tw(r.data),i.domainRef(t,r.field)}));return pt(t.add(PU({values:a})))}function QU(e,t,n){let a=n.map((r=>{let i=t.getData(r.data);return i||Tw(r.data),i.extentRef(t,r.field)}));return pt(t.add(FU({extents:a})))}function qO(e,t,n){let a=t.config.range,r=e.range;if(r.signal)return t.signalRef(r.signal);if(Ft(r)){if(a&&nt(a,r))return qO(e=mt({},e,{range:a[r]}),t,n);r==="width"?r=[0,{signal:"width"}]:r==="height"?r=xu(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:F("Unrecognized scale range value: "+st(r))}else{if(r.scheme)return n.scheme=Ee(r.scheme)?Aw(r.scheme,t):io(r.scheme,t),r.extent&&(n.schemeExtent=Aw(r.extent,t)),void(r.count&&(n.schemeCount=io(r.count,t)));if(r.step)return void(n.rangeStep=io(r.step,t));if(xu(e.type)&&!Ee(r))return jO(r,e,t);Ee(r)||F("Unsupported range type: "+st(r))}return r.map((i=>(Ee(i)?Aw:io)(i,t)))}function Gx(e,t,n){return Ee(e)?e.map((a=>Gx(a,t,n))):ye(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:F("Unsupported parameter object: "+st(e)):e}let Yo="top",nh="left",ah="right",Wu="bottom",WO="center",e3="vertical",t3="start",n3="end",jx="index",Hx="label",a3="offset",rh="perc",r3="perc2",oo="value",Qb="guide-label",qx="guide-title",i3="group-title",o3="group-subtitle",VO="symbol",Cw="gradient",Wx="discrete",Vx="size",Yx=[Vx,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],e0={name:1,style:1,interactive:1},zt={value:0},so={value:1},Rw="group",YO="rect",Kx="rule",s3="symbol",xd="text";function t0(e){return e.type=Rw,e.interactive=e.interactive||!1,e}function Wr(e,t){let n=(a,r)=>Wo(e[a],Wo(t[a],r));return n.isVertical=a=>e3===Wo(e.direction,t.direction||(a?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>Wo(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>Wo(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>Wo(e.columns,Wo(t.columns,+n.isVertical(!0))),n}function KO(e,t){let n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Nw(e,t,n){return`item.anchor === '${t3}' ? ${e} : item.anchor === '${n3}' ? ${t} : ${n}`}let Xx=Nw(st(nh),st(ah),st(WO));function XO(e,t){return t?e?ye(e)?Object.assign({},e,{offset:XO(e.offset,t)}):{value:e,offset:t}:t:e}function _i(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=eh(e.encode,t,e0)):e.interactive=!1,e}function l3(e,t,n,a){let r=Wr(e,n),i=r.isVertical(),o=r.gradientThickness(),u=r.gradientLength(),c,f,m,g,v;i?(f=[0,1],m=[0,0],g=o,v=u):(f=[0,0],m=[1,0],g=u,v=o);let E={enter:c={opacity:zt,x:zt,y:zt,width:va(g),height:va(v)},update:mt({},c,{opacity:so,fill:{gradient:t,start:f,stop:m}}),exit:{opacity:zt}};return Fa(E,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),_i({type:YO,role:cU,encode:E},a)}function u3(e,t,n,a,r){let i=Wr(e,n),o=i.isVertical(),u=i.gradientThickness(),c=i.gradientLength(),f,m,g,v,E="";o?(f="y",g="y2",m="x",v="width",E="1-"):(f="x",g="x2",m="y",v="height");let k={opacity:zt,fill:{scale:t,field:oo}};k[f]={signal:E+"datum."+rh,mult:c},k[m]=zt,k[g]={signal:E+"datum."+r3,mult:c},k[v]=va(u);let _={enter:k,update:mt({},k,{opacity:so}),exit:{opacity:zt}};return Fa(_,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),_i({type:YO,role:lU,key:oo,from:r,encode:_},a)}let c3=`datum.${rh}<=0?"${nh}":datum.${rh}>=1?"${ah}":"${WO}"`,d3=`datum.${rh}<=0?"${Wu}":datum.${rh}>=1?"${Yo}":"middle"`;function ZO(e,t,n,a){let r=Wr(e,t),i=r.isVertical(),o=va(r.gradientThickness()),u=r.gradientLength(),c,f,m,g,v=r("labelOverlap"),E="",k={enter:c={opacity:zt},update:f={opacity:so,text:{field:Hx}},exit:{opacity:zt}};return Fa(k,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:Wo(e.labelLimit,t.gradientLabelLimit)}),i?(c.align={value:"left"},c.baseline=f.baseline={signal:d3},m="y",g="x",E="1-"):(c.align=f.align={signal:c3},c.baseline={value:"top"},m="x",g="y"),c[m]=f[m]={signal:E+"datum."+rh,mult:u},c[g]=f[g]=o,o.offset=Wo(e.labelOffset,t.gradientLabelOffset)||0,v=v?{separation:r("labelSeparation"),method:v,order:"datum."+jx}:void 0,_i({type:xd,role:AO,style:Qb,key:oo,from:a,encode:k,overlap:v},n)}function f3(e,t,n,a,r){let i=Wr(e,t),o=n.entries,u=!(!o||!o.interactive),c=o?o.name:void 0,f=i("clipHeight"),m=i("symbolOffset"),g={data:"value"},v=`(${r}) ? datum.${a3} : datum.${Vx}`,E=f?va(f):{field:Vx},k=`datum.${jx}`,_=`max(1, ${r})`,N,O,I,B,M;E.mult=.5,N={enter:O={opacity:zt,x:{signal:v,mult:.5,offset:m},y:E},update:I={opacity:so,x:O.x,y:O.y},exit:{opacity:zt}};let U=null,z=null;e.fill||(U=t.symbolBaseFillColor,z=t.symbolBaseStrokeColor),Fa(N,{fill:i("symbolFillColor",U),shape:i("symbolType"),size:i("symbolSize"),stroke:i("symbolStrokeColor",z),strokeDash:i("symbolDash"),strokeDashOffset:i("symbolDashOffset"),strokeWidth:i("symbolStrokeWidth")},{opacity:i("symbolOpacity")}),Yx.forEach((re=>{e[re]&&(I[re]=O[re]={scale:e[re],field:oo})}));let q=_i({type:s3,role:dU,key:oo,from:g,clip:!!f||void 0,encode:N},n.symbols),Y=va(m);Y.offset=i("labelOffset"),N={enter:O={opacity:zt,x:{signal:v,offset:Y},y:E},update:I={opacity:so,text:{field:Hx},x:O.x,y:O.y},exit:{opacity:zt}},Fa(N,{align:i("labelAlign"),baseline:i("labelBaseline"),fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:i("labelLimit")});let K=_i({type:xd,role:AO,style:Qb,key:oo,from:g,encode:N},n.labels);return N={enter:{noBound:{value:!f},width:zt,height:f?va(f):zt,opacity:zt},exit:{opacity:zt},update:I={opacity:so,row:{signal:null},column:{signal:null}}},i.isVertical(!0)?(B=`ceil(item.mark.items.length / ${_})`,I.row.signal=`${k}%${B}`,I.column.signal=`floor(${k} / ${B})`,M={field:["row",k]}):(I.row.signal=`floor(${k} / ${_})`,I.column.signal=`${k} % ${_}`,M={field:k}),I.column.signal=`(${r})?${I.column.signal}:${k}`,t0({role:Lx,from:a={facet:{data:a,name:"value",groupby:jx}},encode:eh(N,o,e0),marks:[q,K],name:c,interactive:u,sort:M})}let Zx='item.orient === "left"',Jx='item.orient === "right"',Iw=`(${Zx} || ${Jx})`,p3=`datum.vgrad && ${Iw}`,h3=Nw('"top"','"bottom"','"middle"'),m3=`datum.vgrad && ${Jx} ? (${Nw('"right"','"left"','"center"')}) : (${Iw} && !(datum.vgrad && ${Zx})) ? "left" : ${Xx}`,g3=`item._anchor || (${Iw} ? "middle" : "start")`,b3=`${p3} ? (${Zx} ? -90 : 90) : 0`,y3=`${Iw} ? (datum.vgrad ? (${Jx} ? "bottom" : "top") : ${h3}) : "top"`;function v3(e,t){let n;return ye(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+JO(e.path)+")":e.sphere&&(n="geoShape("+JO(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function JO(e){return ye(e)&&e.signal?e.signal:st(e)}function QO(e){let t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===Rw?Lx:t||Dx:t}function E3(e){return{marktype:e.type,name:e.name||void 0,role:e.role||QO(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function w3(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function Qx(e,t){let n=om(e.type);n||F("Unrecognized transform type: "+st(e.type));let a=_w(n.type.toLowerCase(),null,eD(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(a)),a.metadata=n.metadata||{},a}function eD(e,t,n){let a={},r=e.params.length;for(let i=0;i<r;++i){let o=e.params[i];a[o.name]=_3(o,t,n)}return a}function _3(e,t,n){let a=e.type,r=t[e.name];return a==="index"?(function(i,o,u){return Ft(o.from)||F('Lookup "from" parameter must be a string literal.'),u.getData(o.from).lookupRef(u,o.key)})(0,t,n):r!==void 0?a==="param"?(function(i,o,u){let c=o[i.name];return i.array?(Ee(c)||F("Expected an array of sub-parameters. Instead: "+st(c)),c.map((f=>nD(i,f,u)))):nD(i,c,u)})(e,t,n):a==="projection"?n.projectionRef(t[e.name]):e.array&&!ua(r)?r.map((i=>tD(e,i,n))):tD(e,r,n):void(e.required&&F("Missing required "+st(t.type)+" parameter: "+st(e.name)))}function tD(e,t,n){let a=e.type;if(ua(t))return aD(a)?F("Expression references can not be signals."):eA(a)?n.fieldRef(t):rD(a)?n.compareRef(t):n.signalRef(t.signal);{let r=e.expr||eA(a);return r&&k3(t)?n.exprRef(t.expr,t.as):r&&S3(t)?Zb(t.field,t.as):aD(a)?Ms(t,n):x3(a)?pt(n.getData(t).values):eA(a)?Zb(t):rD(a)?n.compareRef(t):t}}function nD(e,t,n){let a=e.params.length,r;for(let o=0;o<a;++o){r=e.params[o];for(let u in r.key)if(r.key[u]!==t[u]){r=null;break}if(r)break}r||F("Unsupported parameter: "+st(t));let i=mt(eD(r,t,n),r.key);return pt(n.add(BU(i)))}let k3=e=>e&&e.expr,S3=e=>e&&e.field,x3=e=>e==="data",aD=e=>e==="expr",eA=e=>e==="field",rD=e=>e==="compare";function Ow(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:pt(t.getData(e.data).output)}function Ad(e,t,n,a,r){this.scope=e,this.input=t,this.output=n,this.values=a,this.aggregate=r,this.index={}}function iD(e){return Ft(e)?e:null}function oD(e,t,n){let a=Sw(n.op,n.field),r;if(t.ops){for(let i=0,o=t.as.length;i<o;++i)if(t.as[i]===a)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(a))}function n0(e,t,n,a,r,i,o){let u=t[n]||(t[n]={}),c=(function(v){return ye(v)?(v.order===EU?"-":"+")+Sw(v.op,v.field):""})(i),f,m,g=iD(r);if(g!=null&&(e=t.scope,g+=c?"|"+c:"",f=u[g]),!f){let v=i?{field:$x,pulse:t.countsRef(e,r,i)}:{field:e.fieldRef(r),pulse:pt(t.output)};c&&(v.sort=e.sortRef(i)),m=e.add(_w(a,void 0,v)),o&&(t.index[r]=m),f=pt(m),g!=null&&(u[g]=f)}return f}function sD(e,t,n){let a=e.remove,r=e.insert,i=e.toggle,o=e.modify,u=e.values,c=t.add(kw()),f=Ms("if("+e.trigger+',modify("'+n+'",'+[r,a,i,o,u].map((m=>m??"null")).join(",")+"),0)",t);c.update=f.$expr,c.params=f.$params}function Dw(e,t){let n=QO(e),a=e.type===Rw,r=e.from&&e.from.facet,i=e.overlap,o,u,c,f,m,g,v,E=e.layout||n===Lx||n===Mx,k=n===Dx||E||r,_=(function(z,q,Y){let K,re,Q,ie,se;return z?(K=z.facet)&&(q||F("Only group marks can be faceted."),K.field!=null?ie=se=Ow(K,Y):(z.data?se=pt(Y.getData(z.data).aggregate):(Q=Qx(mt({type:"aggregate",groupby:Ie(K.groupby)},K.aggregate),Y),Q.params.key=Y.keyRef(K.groupby),Q.params.pulse=Ow(K,Y),ie=se=pt(Y.add(Q))),re=Y.keyRef(K.groupby,!0))):ie=pt(Y.add(Vo(null,[{}]))),ie||(ie=Ow(z,Y)),{key:re,pulse:ie,parent:se}})(e.from,a,t);u=t.add(CU({key:_.key||(e.key?Zb(e.key):void 0),pulse:_.pulse,clean:!a}));let N=pt(u);u=c=t.add(Vo({pulse:N})),u=t.add(LU({markdef:E3(e),interactive:w3(e.interactive,t),clip:v3(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:pt(u)}));let O=pt(u);u=f=t.add($O(NO(e.encode,e.type,n,e.style,t,{mod:!1,pulse:O}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach((z=>{let q=Qx(z,t),Y=q.metadata;(Y.generates||Y.changes)&&F("Mark transforms should not generate new data."),Y.nomod||(f.params.mod=!0),q.params.pulse=pt(u),t.add(u=q)})),e.sort&&(u=t.add(HU({sort:t.compareRef(e.sort),pulse:pt(u)})));let I=pt(u);(r||E)&&(E=t.add(zO({layout:t.objectProperty(e.layout),legends:t.legends,mark:O,pulse:I})),g=pt(E));let B=t.add(FO({mark:O,pulse:g||I}));v=pt(B),a&&(k&&(o=t.operators,o.pop(),E&&o.pop()),t.pushState(I,g||v,N),r?(function(z,q,Y){let K=z.from.facet,re=K.name,Q=Ow(K,q),ie;K.name||F("Facet must have a name: "+st(K)),K.data||F("Facet must reference a data set: "+st(K)),K.field?ie=q.add(BO({field:q.fieldRef(K.field),pulse:Q})):K.groupby?ie=q.add(NU({key:q.keyRef(K.groupby),group:pt(q.proxy(Y.parent)),pulse:Q})):F("Facet must specify groupby or field: "+st(K));let se=q.fork(),ue=se.add(Vo()),fe=se.add(Sd({pulse:pt(ue)}));se.addData(re,new Ad(se,ue,ue,fe)),se.addSignal("parent",null),ie.params.subflow={$subflow:se.parse(z).toRuntime()}})(e,t,_):k?(function(z,q,Y){let K=q.add(BO({pulse:Y.pulse})),re=q.fork();re.add(Sd()),re.addSignal("parent",null),K.params.subflow={$subflow:re.parse(z).toRuntime()}})(e,t,_):t.parse(e),t.popState(),k&&(E&&o.push(E),o.push(B))),i&&(v=(function(z,q,Y){let K=z.method,re=z.bound,Q=z.separation,ie={separation:ua(Q)?Y.signalRef(Q.signal):Q,method:ua(K)?Y.signalRef(K.signal):K,pulse:q};if(z.order&&(ie.sort=Y.compareRef({field:z.order})),re){let se=re.tolerance;ie.boundTolerance=ua(se)?Y.signalRef(se.signal):+se,ie.boundScale=Y.scaleRef(re.scale),ie.boundOrient=re.orient}return pt(Y.add($U(ie)))})(i,v,t));let M=t.add(UO({pulse:v})),U=t.add(Sd({pulse:pt(M)},void 0,t.parent()));e.name!=null&&(m=e.name,t.addData(m,new Ad(t,c,M,U)),e.on&&e.on.forEach((z=>{(z.insert||z.remove||z.toggle)&&F("Marks only support modify triggers."),sD(z,t,m)})))}function A3(e,t){let n=t.config.legend,a=e.encode||{},r=Wr(e,n),i=a.legend||{},o=i.name||void 0,u=i.interactive,c=i.style,f={},m,g,v,E=0;Yx.forEach((I=>e[I]?(f[I]=e[I],E=E||e[I]):0)),E||F("Missing valid scale for legend.");let k=(function(I,B){let M=I.type||VO;return I.type||(function(U){return Yx.reduce(((z,q)=>z+(U[q]?1:0)),0)})(I)!==1||!I.fill&&!I.stroke||(M=Gg(B)?Cw:jg(B)?Wx:VO),M!==Cw?M:jg(B)?Wx:Cw})(e,t.scaleType(E)),_={title:e.title!=null,scales:f,type:k,vgrad:k!=="symbol"&&r.isVertical()},N=pt(t.add(Vo(null,[_]))),O=pt(t.add(DU(g={type:k,scale:t.scaleRef(E),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return k===Cw?(v=[l3(e,E,n,a.gradient),ZO(e,n,a.labels,O)],g.count=g.count||t.signalRef(`max(2,2*floor((${kd(r.gradientLength())})/100))`)):k===Wx?v=[u3(e,E,n,a.gradient,O),ZO(e,n,a.labels,O)]:(m=(function(I,B){let M=Wr(I,B);return{align:M("gridAlign"),columns:M.entryColumns(),center:{row:!0,column:!1},padding:{row:M("rowPadding"),column:M("columnPadding")}}})(e,n),v=[f3(e,n,a,O,kd(m.columns))],g.size=(function(I,B,M){let U=kd(lD("size",I,M)),z=kd(lD("strokeWidth",I,M)),q=kd((function(Y,K,re){return KO("fontSize",Y)||(function(Q,ie,se){let ue=ie.config.style[se];return ue&&ue[Q]})("fontSize",K,re)})(M[1].encode,B,Qb));return Ms(`max(ceil(sqrt(${U})+${z}),${q})`,B)})(e,t,v[0].marks)),v=[t0({role:uU,from:N,encode:{enter:{x:{value:0},y:{value:0}}},marks:v,layout:m,interactive:u})],_.title&&v.push((function(I,B,M,U){let z=Wr(I,B),q={enter:{opacity:zt},update:{opacity:so,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:zt}};return Fa(q,{orient:z("titleOrient"),_anchor:z("titleAnchor"),anchor:{signal:g3},angle:{signal:b3},align:{signal:m3},baseline:{signal:y3},text:I.title,fill:z("titleColor"),fillOpacity:z("titleOpacity"),font:z("titleFont"),fontSize:z("titleFontSize"),fontStyle:z("titleFontStyle"),fontWeight:z("titleFontWeight"),limit:z("titleLimit"),lineHeight:z("titleLineHeight")},{align:z("titleAlign"),baseline:z("titleBaseline")}),_i({type:xd,role:fU,style:qx,from:U,encode:q},M)})(e,n,a.title,N)),Dw(t0({role:sU,from:N,encode:eh(T3(r,e,n),i,e0),marks:v,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:o,interactive:u,style:c}),t)}function T3(e,t,n){let a={enter:{},update:{}};return Fa(a,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),a}function lD(e,t,n){return t[e]?`scale("${t[e]}",datum)`:KO(e,n[0].encode)}Ad.fromEntries=function(e,t){let n=t.length,a=t[n-1],r=t[n-2],i=t[0],o=null,u=1;for(i&&i.type==="load"&&(i=t[1]),e.add(t[0]);u<n;++u)t[u].params.pulse=pt(t[u-1]),e.add(t[u]),t[u].type==="aggregate"&&(o=t[u]);return new Ad(e,i,r,a,o)},Ad.prototype={countsRef(e,t,n){let a=this,r=a.counts||(a.counts={}),i=iD(t),o,u,c;return i!=null&&(e=a.scope,o=r[i]),o?n&&n.field&&oD(e,o.agg.params,n):(c={groupby:e.fieldRef(t,"key"),pulse:pt(a.output)},n&&n.field&&oD(e,c,n),u=e.add(LO(c)),o=e.add(Vo({pulse:pt(u)})),o={agg:u,ref:pt(o)},i!=null&&(r[i]=o)),o.ref},tuplesRef(){return pt(this.values)},extentRef(e,t){return n0(e,this,"extent","extent",t,!1)},domainRef(e,t){return n0(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return n0(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return n0(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return n0(e,this,"indata","tupleindex",t,!0,!0)}};let C3=`item.orient==="${nh}"?-90:item.orient==="${ah}"?90:0`;function R3(e,t){let n=Wr(e=Ft(e)?{text:e}:e,t.config.title),a=e.encode||{},r=a.group||{},i=r.name||void 0,o=r.interactive,u=r.style,c=[],f=pt(t.add(Vo(null,[{}])));return c.push((function(m,g,v,E){let k={value:0},_=m.text,N={enter:{opacity:k},update:{opacity:{value:1}},exit:{opacity:k}};return Fa(N,{text:_,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:g("dx"),dy:g("dy"),fill:g("color"),font:g("font"),fontSize:g("fontSize"),fontStyle:g("fontStyle"),fontWeight:g("fontWeight"),lineHeight:g("lineHeight")},{align:g("align"),angle:g("angle"),baseline:g("baseline")}),_i({type:xd,role:hU,style:i3,from:E,encode:N},v)})(e,n,(function(m){let g=m.encode;return g&&g.title||mt({name:m.name,interactive:m.interactive,style:m.style},g)})(e),f)),e.subtitle&&c.push((function(m,g,v,E){let k={value:0},_=m.subtitle,N={enter:{opacity:k},update:{opacity:{value:1}},exit:{opacity:k}};return Fa(N,{text:_,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:g("dx"),dy:g("dy"),fill:g("subtitleColor"),font:g("subtitleFont"),fontSize:g("subtitleFontSize"),fontStyle:g("subtitleFontStyle"),fontWeight:g("subtitleFontWeight"),lineHeight:g("subtitleLineHeight")},{align:g("align"),angle:g("angle"),baseline:g("baseline")}),_i({type:xd,role:mU,style:o3,from:E,encode:N},v)})(e,n,a.subtitle,f)),Dw(t0({role:pU,from:f,encode:N3(n,r),marks:c,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:i,interactive:o,style:u}),t)}function N3(e,t){let n={enter:{},update:{}};return Fa(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:Xx},angle:{signal:C3},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),eh(n,t,e0)}function I3(e,t){let n=[];e.transform&&e.transform.forEach((a=>{n.push(Qx(a,t))})),e.on&&e.on.forEach((a=>{sD(a,t,e.name)})),t.addDataPipeline(e.name,(function(a,r,i){let o=[],u,c,f,m,g,v=null,E=!1,k=!1;for(a.values?ua(a.values)||xw(a.format)?(o.push(uD(r,a)),o.push(v=Td())):o.push(v=Td({$ingest:a.values,$format:a.format})):a.url?xw(a.url)||xw(a.format)?(o.push(uD(r,a)),o.push(v=Td())):o.push(v=Td({$request:a.url,$format:a.format})):a.source&&(v=u=Ie(a.source).map((_=>pt(r.getData(_).output))),o.push(null)),c=0,f=i.length;c<f;++c)m=i[c],g=m.metadata,v||g.source||o.push(v=Td()),o.push(m),g.generates&&(k=!0),g.modifies&&!k&&(E=!0),g.source?v=m:g.changes&&(v=null);return u&&(f=u.length-1,o[0]=GU({derive:E,pulse:f?u:u[0]}),(E||f)&&o.splice(1,0,Td())),v||o.push(Td()),o.push(Sd({})),o})(e,t,n))}function Td(e){let t=Vo({},e);return t.metadata={source:!0},t}function uD(e,t){return MU({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}let cD=e=>e===Wu||e===Yo,Mw=(e,t,n)=>ua(e)?L3(e.signal,t,n):e===nh||e===Yo?t:n,Ea=(e,t,n)=>ua(e)?D3(e.signal,t,n):cD(e)?t:n,Ko=(e,t,n)=>ua(e)?M3(e.signal,t,n):cD(e)?n:t,dD=(e,t,n)=>ua(e)?F3(e.signal,t,n):e===Yo?{value:t}:{value:n},O3=(e,t,n)=>ua(e)?P3(e.signal,t,n):e===ah?{value:t}:{value:n},D3=(e,t,n)=>fD(`${e} === '${Yo}' || ${e} === '${Wu}'`,t,n),M3=(e,t,n)=>fD(`${e} !== '${Yo}' && ${e} !== '${Wu}'`,t,n),L3=(e,t,n)=>tA(`${e} === '${nh}' || ${e} === '${Yo}'`,t,n),F3=(e,t,n)=>tA(`${e} === '${Yo}'`,t,n),P3=(e,t,n)=>tA(`${e} === '${ah}'`,t,n),fD=(e,t,n)=>(t=t!=null?va(t):t,n=n!=null?va(n):n,pD(t)&&pD(n)?{signal:`${e} ? (${t=t?t.signal||st(t.value):null}) : (${n=n?n.signal||st(n.value):null})`}:[mt({test:e},t)].concat(n||[])),pD=e=>e==null||Object.keys(e).length===1,tA=(e,t,n)=>({signal:`${e} ? (${ih(t)}) : (${ih(n)})`}),$3=(e,t,n,a,r)=>({signal:(a!=null?`${e} === '${nh}' ? (${ih(a)}) : `:"")+(n!=null?`${e} === '${Wu}' ? (${ih(n)}) : `:"")+(r!=null?`${e} === '${ah}' ? (${ih(r)}) : `:"")+(t!=null?`${e} === '${Yo}' ? (${ih(t)}) : `:"")+"(null)"}),ih=e=>ua(e)?e.signal:e==null?null:st(e),B3=(e,t)=>t===0?0:ua(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},oh=(e,t)=>{let n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function sh(e,t,n,a){let r;if(t&&nt(t,e))return t[e];if(nt(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return a[qx][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return a[Qb][r]}return null}function hD(e){let t={};for(let n of e)if(n)for(let a in n)t[a]=1;return Object.keys(t)}function mD(e,t){return{scale:e.scale,range:t}}function U3(e,t,n,a,r){let i=Wr(e,t),o=e.orient,u=e.gridScale,c=Mw(o,1,-1),f=(function(I,B){if(B!==1)if(ye(I)){let M=I=mt({},I);for(;M.mult!=null;){if(!ye(M.mult))return M.mult=ua(B)?{signal:`(${M.mult}) * (${B.signal})`}:M.mult*B,I;M=M.mult=mt({},M.mult)}M.mult=B}else I=ua(B)?{signal:`(${B.signal}) * (${I||0})`}:B*(I||0);return I})(e.offset,c),m,g,v,E={enter:m={opacity:zt},update:v={opacity:so},exit:g={opacity:zt}};Fa(E,{stroke:i("gridColor"),strokeCap:i("gridCap"),strokeDash:i("gridDash"),strokeDashOffset:i("gridDashOffset"),strokeOpacity:i("gridOpacity"),strokeWidth:i("gridWidth")});let k={scale:e.scale,field:oo,band:r.band,extra:r.extra,offset:r.offset,round:i("tickRound")},_=Ea(o,{signal:"height"},{signal:"width"}),N=u?{scale:u,range:0,mult:c,offset:f}:{value:0,offset:f},O=u?{scale:u,range:1,mult:c,offset:f}:mt(_,{mult:c,offset:f});return m.x=v.x=Ea(o,k,N),m.y=v.y=Ko(o,k,N),m.x2=v.x2=Ko(o,O),m.y2=v.y2=Ea(o,O),g.x=Ea(o,k),g.y=Ko(o,k),_i({type:Kx,role:aU,key:oo,from:a,encode:E},n)}function nA(e,t,n,a,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+a+","+r+")"}}function z3(e,t,n,a){let r=Wr(e,t),i=e.orient,o=Mw(i,-1,1),u,c,f={enter:u={opacity:zt,anchor:va(r("titleAnchor",null)),align:{signal:Xx}},update:c=mt({},u,{opacity:so,text:va(e.title)}),exit:{opacity:zt}},m={signal:`lerp(range("${e.scale}"), ${Nw(0,1,.5)})`};return c.x=Ea(i,m),c.y=Ko(i,m),u.angle=Ea(i,zt,B3(o,90)),u.baseline=Ea(i,dD(i,Wu,Yo),{value:Wu}),c.angle=u.angle,c.baseline=u.baseline,Fa(f,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),(function(g,v,E,k){let _=(I,B)=>I!=null?(E.update[B]=oh(va(I),E.update[B]),!1):!th(B,k),N=_(g("titleX"),"x"),O=_(g("titleY"),"y");E.enter.auto=O===N?va(O):Ea(v,va(O),va(N))})(r,i,f,n),f.update.align=oh(f.update.align,u.align),f.update.angle=oh(f.update.angle,u.angle),f.update.baseline=oh(f.update.baseline,u.baseline),_i({type:xd,role:oU,style:qx,from:a,encode:f},n)}function G3(e,t){let n=(function(_,N){var O,I,B,M=N.config,U=M.style,z=M.axis,q=N.scaleType(_.scale)==="band"&&M.axisBand,Y=_.orient;if(ua(Y)){let K=hD([M.axisX,M.axisY]),re=hD([M.axisTop,M.axisBottom,M.axisLeft,M.axisRight]);for(B of(O={},K))O[B]=Ea(Y,sh(B,M.axisX,z,U),sh(B,M.axisY,z,U));for(B of(I={},re))I[B]=$3(Y.signal,sh(B,M.axisTop,z,U),sh(B,M.axisBottom,z,U),sh(B,M.axisLeft,z,U),sh(B,M.axisRight,z,U))}else O=Y===Yo||Y===Wu?M.axisX:M.axisY,I=M["axis"+Y[0].toUpperCase()+Y.slice(1)];return O||I||q?mt({},z,O,I,q):z})(e,t),a=e.encode||{},r=a.axis||{},i=r.name||void 0,o=r.interactive,u=r.style,c=Wr(e,n),f=(function(_){let N=_("tickBand"),O,I,B=_("tickOffset");return N?N.signal?(O={signal:`(${N.signal}) === 'extent' ? 1 : 0.5`},I={signal:`(${N.signal}) === 'extent'`},ye(B)||(B={signal:`(${N.signal}) === 'extent' ? 0 : ${B}`})):N==="extent"?(O=1,I=!0,B=0):(O=.5,I=!1):(O=_("bandPosition"),I=_("tickExtra")),{extra:I,band:O,offset:B}})(c),m={scale:e.scale,ticks:!!c("ticks"),labels:!!c("labels"),grid:!!c("grid"),domain:!!c("domain"),title:e.title!=null},g=pt(t.add(Vo({},[m]))),v=pt(t.add(TU({scale:t.scaleRef(e.scale),extra:t.property(f.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),E=[],k;return m.grid&&E.push(U3(e,n,a.grid,v,f)),m.ticks&&(k=c("tickSize"),E.push((function(_,N,O,I,B,M){let U=Wr(_,N),z=_.orient,q=Mw(z,-1,1),Y,K,re,Q={enter:Y={opacity:zt},update:re={opacity:so},exit:K={opacity:zt}};Fa(Q,{stroke:U("tickColor"),strokeCap:U("tickCap"),strokeDash:U("tickDash"),strokeDashOffset:U("tickDashOffset"),strokeOpacity:U("tickOpacity"),strokeWidth:U("tickWidth")});let ie=va(B);ie.mult=q;let se={scale:_.scale,field:oo,band:M.band,extra:M.extra,offset:M.offset,round:U("tickRound")};return re.y=Y.y=Ea(z,zt,se),re.y2=Y.y2=Ea(z,ie),K.x=Ea(z,se),re.x=Y.x=Ko(z,zt,se),re.x2=Y.x2=Ko(z,ie),K.y=Ko(z,se),_i({type:Kx,role:iU,key:oo,from:I,encode:Q},O)})(e,n,a.ticks,v,k,f))),m.labels&&(k=m.ticks?k:0,E.push((function(_,N,O,I,B,M){let U=Wr(_,N),z=_.orient,q=_.scale,Y=Mw(z,-1,1),K=kd(U("labelFlush")),re=kd(U("labelFlushOffset")),Q=U("labelAlign"),ie=U("labelBaseline"),se,ue=K===0||!!K,fe=va(B);fe.mult=Y,fe.offset=va(U("labelPadding")||0),fe.offset.mult=Y;let ve={scale:q,field:oo,band:.5,offset:XO(M.offset,U("labelOffset"))},we=Ea(z,ue?nA(q,K,'"left"','"right"','"center"'):{value:"center"},O3(z,"left","right")),Oe=Ea(z,dD(z,"bottom","top"),ue?nA(q,K,'"top"','"bottom"','"middle"'):{value:"middle"}),Ue=nA(q,K,`-(${re})`,re,0);ue=ue&&re;let He={opacity:zt,x:Ea(z,ve,fe),y:Ko(z,ve,fe)},De={enter:He,update:se={opacity:so,text:{field:Hx},x:He.x,y:He.y,align:we,baseline:Oe},exit:{opacity:zt,x:He.x,y:He.y}};Fa(De,{dx:!Q&&ue?Ea(z,Ue):null,dy:!ie&&ue?Ko(z,Ue):null}),Fa(De,{angle:U("labelAngle"),fill:U("labelColor"),fillOpacity:U("labelOpacity"),font:U("labelFont"),fontSize:U("labelFontSize"),fontWeight:U("labelFontWeight"),fontStyle:U("labelFontStyle"),limit:U("labelLimit"),lineHeight:U("labelLineHeight")},{align:Q,baseline:ie});let ut=U("labelBound"),ct=U("labelOverlap");return ct=ct||ut?{separation:U("labelSeparation"),method:ct,order:"datum.index",bound:ut?{scale:q,orient:z,tolerance:ut}:null}:void 0,se.align!==we&&(se.align=oh(se.align,we)),se.baseline!==Oe&&(se.baseline=oh(se.baseline,Oe)),_i({type:xd,role:rU,style:Qb,key:oo,from:I,encode:De,overlap:ct},O)})(e,n,a.labels,v,k,f))),m.domain&&E.push((function(_,N,O,I){let B=Wr(_,N),M=_.orient,U,z,q={enter:U={opacity:zt},update:z={opacity:so},exit:{opacity:zt}};Fa(q,{stroke:B("domainColor"),strokeCap:B("domainCap"),strokeDash:B("domainDash"),strokeDashOffset:B("domainDashOffset"),strokeWidth:B("domainWidth"),strokeOpacity:B("domainOpacity")});let Y=mD(_,0),K=mD(_,1);return U.x=z.x=Ea(M,Y,zt),U.x2=z.x2=Ea(M,K),U.y=z.y=Ko(M,Y,zt),U.y2=z.y2=Ko(M,K),_i({type:Kx,role:nU,from:I,encode:q},O)})(e,n,a.domain,g)),m.title&&E.push(z3(e,n,a.title,g)),Dw(t0({role:tU,from:g,encode:eh(j3(c,e),r,e0),marks:E,aria:c("aria"),description:c("description"),zindex:c("zindex"),name:i,interactive:o,style:u}),t)}function j3(e,t){let n={enter:{},update:{}};return Fa(n,{orient:e("orient"),offset:e("offset")||0,position:Wo(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function gD(e,t,n){let a=Ie(e.signals),r=Ie(e.scales);return n||a.forEach((i=>OO(i,t))),Ie(e.projections).forEach((i=>(function(o,u){let c=u.config.projection||{},f={};for(let m in o)m!=="name"&&(f[m]=Gx(o[m],m,u));for(let m in c)f[m]==null&&(f[m]=Gx(c[m],m,u));u.addProjection(o.name,f)})(i,t))),r.forEach((i=>(function(o,u){let c=o.type||"linear";gv(c)||F("Unrecognized scale type: "+st(c)),u.addScale(o.name,{type:c,domain:void 0})})(i,t))),Ie(e.data).forEach((i=>I3(i,t))),r.forEach((i=>VU(i,t))),(n||a).forEach((i=>(function(o,u){let c=u.getSignal(o.name),f=o.update;o.init&&(f?F("Signals can not include both init and update expressions."):(f=o.init,c.initonly=!0)),f&&(f=Ms(f,u),c.update=f.$expr,c.params=f.$params),o.on&&o.on.forEach((m=>xU(m,u,c.id)))})(i,t))),Ie(e.axes).forEach((i=>G3(i,t))),Ie(e.marks).forEach((i=>Dw(i,t))),Ie(e.legends).forEach((i=>A3(i,t))),e.title&&R3(e.title,t),t.parseLambdas(),t}let H3=e=>eh({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function q3(e,t){let n=t.config,a=pt(t.root=t.add(kw())),r=(function(f,m){let g=_=>Wo(f[_],m[_]),v=[a0("background",g("background")),a0("autosize",JB(g("autosize"))),a0("padding",eU(g("padding"))),a0("width",g("width")||0),a0("height",g("height")||0)],E=v.reduce(((_,N)=>(_[N.name]=N,_)),{}),k={};return Ie(f.signals).forEach((_=>{nt(E,_.name)?_=mt(E[_.name],_):v.push(_),k[_.name]=_})),Ie(m.signals).forEach((_=>{nt(k,_.name)||nt(E,_.name)||v.push(_)})),v})(e,n);r.forEach((f=>OO(f,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;let i=t.add(Vo()),o=t.add($O(NO(H3(e.encode),Rw,Mx,e.style,t,{pulse:pt(i)}))),u=t.add(zO({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:a,pulse:pt(o)}));t.operators.pop(),t.pushState(pt(o),pt(u),null),gD(e,t,r),t.operators.push(u);let c=t.add(FO({mark:a,pulse:pt(u)}));return c=t.add(UO({pulse:pt(c)})),c=t.add(Sd({pulse:pt(c)})),t.addData("root",new Ad(t,i,i,c)),t}function a0(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function bD(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function yD(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function aA(e){return(Ee(e)?W3:V3)(e)}function W3(e){let t=e.length,n="[";for(let a=0;a<t;++a){let r=e[a];n+=(a>0?",":"")+(ye(r)?r.signal||aA(r):st(r))}return n+"]"}function V3(e){let t,n,a="{",r=0;for(t in e)n=e[t],a+=(++r>1?",":"")+st(t)+":"+(ye(n)?n.signal||aA(n):st(n));return a+"}"}bD.prototype=yD.prototype={parse(e){return gD(e,this)},fork(){return new yD(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){let t=e instanceof Px?pt(e):e;return this.add(zU({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(a,r,i){let o,u;a&&(o=a.data||(a.data={}),u=o[r]||(o[r]=[]),u.push(i))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(let a in t.index)n(t.index[a],e,"index:"+a)}return this},pushState(e,t,n){this._encode.push(pt(this.add(Sd({pulse:e})))),this._parent.push(t),this._lookup.push(n?pt(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return $e(this._parent)},encode(){return $e(this._encode)},lookup(){return $e(this._lookup)},markpath(){let e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(Ft(e))return Zb(e,t);e.signal||F("Unsupported field reference: "+st(e));let n=e.signal,a=this.field[n];if(!a){let r={name:this.signalRef(n)};t&&(r.as=t),this.field[n]=a=pt(this.add(IU(r)))}return a},compareRef(e){let t=!1,n=i=>ua(i)?(t=!0,this.signalRef(i.signal)):(function(o){return o&&o.expr})(i)?(t=!0,this.exprRef(i.expr)):i,a=Ie(e.field).map(n),r=Ie(e.order).map(n);return t?pt(this.add(PO({fields:a,orders:r}))):DO(a,r)},keyRef(e,t){let n=!1,a=this.signals;return e=Ie(e).map((r=>ua(r)?(n=!0,pt(a[r.signal])):r)),n?pt(this.add(OU({fields:e,flat:t}))):(function(r,i){let o={$key:r};return i&&(o.$flat=!0),o})(e,t)},sortRef(e){if(!e)return e;let t=Sw(e.op,e.field),n=e.order||"ascending";return n.signal?pt(this.add(PO({fields:t,orders:this.signalRef(n.signal)}))):DO(t,n)},event(e,t){let n=e+":"+t;if(!this.events[n]){let a=this.id();this.streams.push({id:a,source:e,type:t}),this.events[n]=a}return this.events[n]},hasOwnSignal(e){return nt(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&F("Duplicate signal name: "+st(e));let n=t instanceof Px?t:this.add(kw(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||F("Unrecognized signal name: "+st(e)),this.signals[e]},signalRef(e){return this.signals[e]?pt(this.signals[e]):(nt(this.lambdas,e)||(this.lambdas[e]=this.add(kw(null))),pt(this.lambdas[e]))},parseLambdas(){let e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){let a=e[t],r=Ms(a,this),i=this.lambdas[a];i.params=r.$params,i.update=r.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&ye(e)?this.signalRef(e.signal||aA(e)):e},exprRef(e,t){let n={expr:Ms(e,this)};return t&&(n.expr.$name=t),pt(this.add(RU(n)))},addBinding(e,t){this.bindings||F("Nested signals do not support binding: "+st(e)),this.bindings.push(mt({signal:e},t))},addScaleProj(e,t){nt(this.scales,e)&&F("Duplicate scale or projection name: "+st(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,jU(t))},addProjection(e,t){this.addScaleProj(e,UU(t))},getScale(e){return this.scales[e]||F("Unrecognized scale name: "+st(e)),this.scales[e]},scaleRef(e){return pt(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return nt(this.data,e)&&F("Duplicate data set name: "+st(e)),this.data[e]=t},getData(e){return this.data[e]||F("Undefined data set name: "+st(e)),this.data[e]},addDataPipeline(e,t){return nt(this.data,e)&&F("Duplicate data set name: "+st(e)),this.addData(e,Ad.fromEntries(this,t))}},mt(tl,Xf,jL,eF,UF,sP,zP,IP,GP,a$,d$,h$),p.Bounds=In,p.CanvasHandler=sb,p.CanvasRenderer=Wv,p.DATE=ha,p.DAY=aa,p.DAYOFYEAR=Di,p.Dataflow=el,p.Debug=Me,p.Error=de,p.EventStream=Ui,p.Gradient=Je,p.GroupItem=vl,p.HOURS=ja,p.Handler=Mu,p.Info=Ce,p.Item=Lo,p.MILLISECONDS=Dr,p.MINUTES=lr,p.MONTH=na,p.Marks=yi,p.MultiPulse=yc,p.None=ce,p.Operator=Yt,p.Parameters=gc,p.Pulse=oi,p.QUARTER=Ta,p.RenderType=Fu,p.Renderer=Cs,p.ResourceLoader=El,p.SECONDS=ur,p.SVGHandler=J1,p.SVGRenderer=ik,p.SVGStringRenderer=sk,p.Scenegraph=V1,p.TIME_UNITS=Gd,p.Transform=Se,p.View=hO,p.WEEK=Cn,p.Warn=_e,p.YEAR=ta,p.accessor=b,p.accessorFields=T,p.accessorName=S,p.array=Ie,p.ascending=Qt,p.bandwidthNRD=um,p.bin=cm,p.bootstrapCI=dm,p.boundClip=tC,p.boundContext=Jg,p.boundItem=W1,p.boundMark=yT,p.boundStroke=_l,p.changeset=us,p.clampRange=Xe,p.codegenExpression=AI,p.compare=Fl,p.constant=mn,p.cumulativeLogNormal=fr,p.cumulativeNormal=Ec,p.cumulativeUniform=kc,p.dayofyear=M0,p.debounce=Zo,p.defaultLocale=pf,p.definition=om,p.densityLogNormal=Rf,p.densityNormal=fm,p.densityUniform=Of,p.domChild=Ur,p.domClear=Bo,p.domCreate=Du,p.domFind=Y1,p.dotbin=Tf,p.error=F,p.expressionFunction=Zn,p.extend=mt,p.extent=Un,p.extentIndex=ar,p.falsy=ae,p.fastmap=da,p.field=W,p.flush=rr,p.font=Pv,p.fontFamily=ab,p.fontSize=Ts,p.format=hc,p.formatLocale=fc,p.formats=ss,p.hasOwnProperty=nt,p.id=V,p.identity=ee,p.inferType=em,p.inferTypes=tm,p.ingest=It,p.inherits=Fe,p.inrange=Sa,p.interpolate=Hg,p.interpolateColors=Cp,p.interpolateRange=vv,p.intersect=ZT,p.intersectBoxLine=Dp,p.intersectPath=N1,p.intersectPoint=I1,p.intersectRule=aT,p.isArray=Ee,p.isBoolean=Zr,p.isDate=Sn,p.isFunction=tt,p.isIterable=Si,p.isNumber=Ba,p.isObject=ye,p.isRegExp=xi,p.isString=Ft,p.isTuple=ru,p.key=Ai,p.lerp=fo,p.lineHeight=Iu,p.loader=Js,p.locale=Qh,p.logger=Ge,p.lruCache=Pl,p.markup=rk,p.merge=Bs,p.mergeConfig=Te,p.multiLineOffset=j1,p.one=he,p.pad=Ku,p.panLinear=St,p.panLog=Tt,p.panPow=Xt,p.panSymlog=Ke,p.parse=function(e,t,n){return ye(e)||F("Input Vega specification must be an object."),q3(e,new bD(t=Te((function(){let a="sans-serif",r="#4c78a8",i="#000",o="#888",u="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:r},area:{fill:r},image:null,line:{stroke:r,strokeWidth:2},path:{stroke:r},rect:{fill:r},rule:{stroke:i},shape:{stroke:r},symbol:{fill:r,size:64},text:{fill:i,font:a,fontSize:11},trail:{fill:r,size:2},style:{"guide-label":{fill:i,font:a,fontSize:10},"guide-title":{fill:i,font:a,fontSize:11,fontWeight:"bold"},"group-title":{fill:i,font:a,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:i,font:a,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:u},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:o,grid:!1,gridWidth:1,gridColor:u,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:o,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:u,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:o,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}})(),t,e.config),n)).toRuntime()},p.parseExpression=kI,p.parseSelector=kO,p.path=Oc,p.pathCurves=Qe,p.pathEqual=nC,p.pathParse=Ut,p.pathRectangle=Kg,p.pathRender=wn,p.pathSymbols=Xa,p.pathTrail=Xg,p.peek=$e,p.point=Bv,p.projection=rS,p.quantileLogNormal=mm,p.quantileNormal=wc,p.quantileUniform=du,p.quantiles=lm,p.quantizeInterpolator=Ev,p.quarter=Ct,p.quartiles=Af,p.randomInteger=function(e,t){let n,a,r;t==null&&(t=e,e=0);let i={min(o){return arguments.length?(n=o||0,r=a-n,i):n},max(o){return arguments.length?(a=o||0,r=a-n,i):a},sample:()=>n+Math.floor(r*p.random()),pdf:o=>o===Math.floor(o)&&o>=n&&o<a?1/r:0,cdf(o){let u=Math.floor(o);return u<n?0:u>=a?1:(u-n+1)/r},icdf:o=>o>=0&&o<=1?n-1+Math.floor(o*r):NaN};return i.min(e).max(t)},p.randomKDE=hm,p.randomLCG=function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},p.randomLogNormal=Nf,p.randomMixture=If,p.randomNormal=pm,p.randomUniform=Df,p.read=yf,p.regressionConstant=Mf,p.regressionExp=gm,p.regressionLinear=fu,p.regressionLoess=vm,p.regressionLog=Ac,p.regressionPoly=bm,p.regressionPow=my,p.regressionQuad=si,p.renderModule=Xv,p.repeat=po,p.resetDefaultLocale=function(){return Zh(),pc(),pf()},p.resetSVGClipId=xv,p.resetSVGDefIds=function(){xv(),me=0},p.responseType=bf,p.runtimeContext=YI,p.sampleCurve=Lf,p.sampleLogNormal=Cf,p.sampleNormal=cu,p.sampleUniform=_c,p.scale=Bt,p.sceneEqual=uk,p.sceneFromJSON=ET,p.scenePickVisit=Ov,p.sceneToJSON=vT,p.sceneVisit=Po,p.sceneZOrder=O1,p.scheme=Np,p.serializeXML=GT,p.setRandom=function(e){p.random=e},p.span=Jr,p.splitAccessPath=j,p.stringValue=st,p.textMetrics=$o,p.timeBin=ai,p.timeFloor=B0,p.timeFormatLocale=Zs,p.timeInterval=as,p.timeOffset=Kd,p.timeSequence=Lh,p.timeUnitSpecifier=Hd,p.timeUnits=jd,p.toBoolean=$l,p.toDate=Ld,p.toNumber=Le,p.toSet=ir,p.toString=Fd,p.transform=sm,p.transforms=tl,p.truncate=gh,p.truthy=Z,p.tupleid=rt,p.typeParsers=cr,p.utcFloor=Yd,p.utcInterval=Mr,p.utcOffset=G0,p.utcSequence=Fh,p.utcdayofyear=Oh,p.utcquarter=ht,p.utcweek=Dh,p.version="5.25.0",p.visitArray=Qo,p.week=qd,p.writeConfig=ke,p.zero=ne,p.zoomLinear=Zt,p.zoomLog=Et,p.zoomPow=Jt,p.zoomSymlog=Lt}))});var wM=rA((Vw,EM)=>{(function(p,b){typeof Vw=="object"&&typeof EM<"u"?b(Vw,wA()):typeof define=="function"&&define.amd?define(["exports","vega"],b):b((p=typeof globalThis<"u"?globalThis:p||self).vegaLite={},p.vega)})(Vw,(function(p,b){"use strict";var S="5.16.1";function T(s){return!!s.or}function R(s){return!!s.and}function $(s){return!!s.not}function P(s,l){if($(s))P(s.not,l);else if(R(s))for(let d of s.and)P(d,l);else if(T(s))for(let d of s.or)P(d,l);else l(s)}function F(s,l){return $(s)?{not:F(s.not,l)}:R(s)?{and:s.and.map((d=>F(d,l)))}:T(s)?{or:s.or.map((d=>F(d,l)))}:l(s)}let j=globalThis.structuredClone;function W(s){throw new Error(s)}function V(s,l){let d={};for(let h of l)b.hasOwnProperty(s,h)&&(d[h]=s[h]);return d}function ee(s,l){let d={...s};for(let h of l)delete d[h];return d}function ne(s){if(b.isNumber(s))return s;let l=b.isString(s)?s:Xe(s);if(l.length<250)return l;let d=0;for(let h=0;h<l.length;h++)d=(d<<5)-d+l.charCodeAt(h),d&=d;return d}function he(s){return s===!1||s===null}function Z(s,l){return s.includes(l)}function ae(s,l){let d=0;for(let[h,y]of s.entries())if(l(y,h,d++))return!0;return!1}function oe(s,l){let d=0;for(let[h,y]of s.entries())if(!l(y,h,d++))return!1;return!0}function ce(s){for(var l=arguments.length,d=new Array(l>1?l-1:0),h=1;h<l;h++)d[h-1]=arguments[h];for(let y of d)de(s,y??{});return s}function de(s,l){for(let d of be(l))b.writeConfig(s,d,l[d],!0)}function _e(s,l){let d=[],h={},y;for(let w of s)y=l(w),y in h||(h[y]=1,d.push(w));return d}function Ce(s,l){if(s.size!==l.size)return!1;for(let d of s)if(!l.has(d))return!1;return!0}function Me(s,l){for(let d of s)if(l.has(d))return!0;return!1}function Ge(s){let l=new Set;for(let d of s){let h=b.splitAccessPath(d).map(((w,x)=>x===0?w:`[${w}]`)),y=h.map(((w,x)=>h.slice(0,x+1).join("")));for(let w of y)l.add(w)}return l}function Ee(s,l){return s===void 0||l===void 0||Me(Ge(s),Ge(l))}function ye(s){return be(s).length===0}Set.prototype.toJSON=function(){return`Set(${[...this].map((s=>Xe(s))).join(",")})`};let be=Object.keys,Te=Object.values,ke=Object.entries;function Ye(s){return s===!0||s===!1}function $e(s){let l=s.replace(/\W/g,"_");return(s.match(/^\d+/)?"_":"")+l}function Le(s,l){return $(s)?`!(${Le(s.not,l)})`:R(s)?`(${s.and.map((d=>Le(d,l))).join(") && (")})`:T(s)?`(${s.or.map((d=>Le(d,l))).join(") || (")})`:l(s)}function dt(s,l){if(l.length===0)return!0;let d=l.shift();return d in s&&dt(s[d],l)&&delete s[d],ye(s)}function yt(s){return s.charAt(0).toUpperCase()+s.substr(1)}function xt(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"datum",d=b.splitAccessPath(s),h=[];for(let y=1;y<=d.length;y++){let w=`[${d.slice(0,y).map(b.stringValue).join("][")}]`;h.push(`${l}${w}`)}return h.join(" && ")}function rn(s){return`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:"datum"}[${b.stringValue(b.splitAccessPath(s).join("."))}]`}function hn(s){return s.replace(/(\[|\]|\.|'|")/g,"\\$1")}function jt(s){return`${b.splitAccessPath(s).map(hn).join("\\.")}`}function St(s,l,d){return s.replace(new RegExp(l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),d)}function Tt(s){return`${b.splitAccessPath(s).join(".")}`}function Xt(s){return s?b.splitAccessPath(s).length:0}function Ke(){for(var s=arguments.length,l=new Array(s),d=0;d<s;d++)l[d]=arguments[d];for(let h of l)if(h!==void 0)return h}let et=42;function Zt(s){let l=++et;return s?String(s)+l:l}function Et(s){return Jt(s)?s:`__${s}`}function Jt(s){return s.startsWith("__")}function Lt(s){if(s!==void 0)return(s%360+360)%360}function Ct(s){return!!b.isNumber(s)||!isNaN(s)&&!isNaN(parseFloat(s))}let ht=Object.getPrototypeOf(globalThis.structuredClone({}));function Ie(s,l){if(s===l)return!0;if(s&&l&&typeof s=="object"&&typeof l=="object"){if(s.constructor.name!==l.constructor.name)return!1;let d,h;if(Array.isArray(s)){if(d=s.length,d!=l.length)return!1;for(h=d;h--!=0;)if(!Ie(s[h],l[h]))return!1;return!0}if(s instanceof Map&&l instanceof Map){if(s.size!==l.size)return!1;for(h of s.entries())if(!l.has(h[0]))return!1;for(h of s.entries())if(!Ie(h[1],l.get(h[0])))return!1;return!0}if(s instanceof Set&&l instanceof Set){if(s.size!==l.size)return!1;for(h of s.entries())if(!l.has(h[0]))return!1;return!0}if(ArrayBuffer.isView(s)&&ArrayBuffer.isView(l)){if(d=s.length,d!=l.length)return!1;for(h=d;h--!=0;)if(s[h]!==l[h])return!1;return!0}if(s.constructor===RegExp)return s.source===l.source&&s.flags===l.flags;if(s.valueOf!==Object.prototype.valueOf&&s.valueOf!==ht.valueOf)return s.valueOf()===l.valueOf();if(s.toString!==Object.prototype.toString&&s.toString!==ht.toString)return s.toString()===l.toString();let y=Object.keys(s);if(d=y.length,d!==Object.keys(l).length)return!1;for(h=d;h--!=0;)if(!Object.prototype.hasOwnProperty.call(l,y[h]))return!1;for(h=d;h--!=0;){let w=y[h];if(!Ie(s[w],l[w]))return!1}return!0}return s!=s&&l!=l}function Xe(s){let l=[];return(function d(h){if(h&&h.toJSON&&typeof h.toJSON=="function"&&(h=h.toJSON()),h===void 0)return;if(typeof h=="number")return isFinite(h)?""+h:"null";if(typeof h!="object")return JSON.stringify(h);let y,w;if(Array.isArray(h)){for(w="[",y=0;y<h.length;y++)y&&(w+=","),w+=d(h[y])||"null";return w+"]"}if(h===null)return"null";if(l.includes(h))throw new TypeError("Converting circular structure to JSON");let x=l.push(h)-1,A=Object.keys(h).sort();for(w="",y=0;y<A.length;y++){let C=A[y],L=d(h[C]);L&&(w&&(w+=","),w+=JSON.stringify(C)+":"+L)}return l.splice(x,1),`{${w}}`})(s)}let tt="row",Kr="column",Fl="facet",Qt="x",Bn="y",Xr="x2",ki="y2",mn="xOffset",Zo="yOffset",mt="radius",Un="radius2",ar="theta",co="theta2",nt="latitude",$a="longitude",da="latitude2",rr="longitude2",Fe="color",Sa="fill",Zr="stroke",Sn="shape",Si="size",Ba="angle",xi="opacity",Ft="fillOpacity",Ai="strokeOpacity",fo="strokeWidth",Jo="strokeDash",Pl="text",Bs="order",po="detail",Ku="key",Jr="tooltip",st="href",$l="url",Md="description",Ld={theta:1,theta2:1,radius:1,radius2:1};function Fd(s){return s in Ld}let ir={longitude:1,longitude2:1,latitude:1,latitude2:1};function gh(s){switch(s){case nt:return"y";case da:return"y2";case $a:return"x";case rr:return"x2"}}function Qo(s){return s in ir}let m0=be(ir),Xu={x:1,y:1,x2:1,y2:1,...Ld,...ir,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 es(s){return s===Fe||s===Sa||s===Zr}let Bl={row:1,column:1,facet:1},Ua=be(Bl),Pd={...Xu,...Bl},g0=be(Pd),{order:or,detail:$A,tooltip:BA,...h_}=Pd,{row:UA,column:m_,facet:g_,...b_}=h_;function b0(s){return!!Pd[s]}let y_=[Xr,ki,da,rr,co,Un];function Ti(s){return Us(s)!==s}function Us(s){switch(s){case Xr:return Qt;case ki:return Bn;case da:return nt;case rr:return $a;case co:return ar;case Un:return mt}return s}function sr(s){if(Fd(s))switch(s){case ar:return"startAngle";case co:return"endAngle";case mt:return"outerRadius";case Un:return"innerRadius"}return s}function Ci(s){switch(s){case Qt:return Xr;case Bn:return ki;case nt:return da;case $a:return rr;case ar:return co;case mt:return Un}}function xa(s){switch(s){case Qt:case Xr:return"width";case Bn:case ki:return"height"}}function bh(s){switch(s){case Qt:return"xOffset";case Bn:return"yOffset";case Xr:return"x2Offset";case ki:return"y2Offset";case ar:return"thetaOffset";case mt:return"radiusOffset";case co:return"theta2Offset";case Un:return"radius2Offset"}}function Ul(s){switch(s){case Qt:return"xOffset";case Bn:return"yOffset"}}function v_(s){switch(s){case"xOffset":return"x";case"yOffset":return"y"}}let Zu=be(Xu),{x:za,y:E_,x2:yh,y2:y0,xOffset:w_,yOffset:__,latitude:k_,longitude:S_,latitude2:zA,longitude2:GA,theta:jA,theta2:vh,radius:v0,radius2:E0,...Ri}=Xu,zs=be(Ri),Ju={x:1,y:1},Qr=be(Ju);function un(s){return s in Ju}let Qu={theta:1,radius:1},w0=be(Qu);function ec(s){return s==="width"?Qt:Bn}let Eh={xOffset:1,yOffset:1};function Qn(s){return s in Eh}let{text:x_,tooltip:HA,href:wh,url:tc,description:A_,detail:qA,key:zl,order:_0,..._h}=Ri,k0=be(_h),kh={...Ju,...Qu,...Eh,..._h},Gl=be(kh);function Nr(s){return!!kh[s]}function Sh(s,l){return(function(d){switch(d){case Fe:case Sa:case Zr:case Md:case po:case Ku:case Jr:case st:case Bs:case xi:case Ft:case Ai:case fo:case Fl:case tt:case Kr:return xh;case Qt:case Bn:case mn:case Zo:case nt:case $a:return S0;case Xr:case ki:case da:case rr:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Si:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Jo:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case Sn:return{point:"always",geoshape:"always"};case Pl:return{text:"always"};case Ba:return{point:"always",square:"always",text:"always"};case $l:return{image:"always"};case ar:case mt:return{text:"always",arc:"always"};case co:case Un:return{arc:"always"}}})(s)[l]}let xh={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:T_,...S0}=xh;function $d(s){switch(s){case Qt:case Bn:case ar:case mt:case mn:case Zo:case Si:case Ba:case fo:case xi:case Ft:case Ai:case Xr:case ki:case co:case Un:return;case Fl:case tt:case Kr:case Sn:case Jo:case Pl:case Jr:case st:case $l:case Md:return"discrete";case Fe:case Sa:case Zr:return"flexible";case nt:case $a:case da:case rr:case po:case Ku:case Bs:return}}let x0={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},A0={count:1,min:1,max:1};function ei(s){return!!s&&!!s.argmin}function Ni(s){return!!s&&!!s.argmax}function xn(s){return b.isString(s)&&!!x0[s]}let jl=new Set(["count","valid","missing","distinct"]);function Ii(s){return b.isString(s)&&jl.has(s)}let Ir=new Set(["count","sum","distinct","valid","missing"]),ho=new Set(["mean","average","median","q1","q3","min","max"]);function Oi(s){return b.isBoolean(s)&&(s=rt(s,void 0)),"bin"+be(s).map((l=>Or(s[l])?$e(`_${l}_${ke(s[l])}`):$e(`_${l}_${s[l]}`))).join("")}function Vt(s){return s===!0||mo(s)&&!s.binned}function zn(s){return s==="binned"||mo(s)&&s.binned===!0}function mo(s){return b.isObject(s)}function Or(s){return s==null?void 0:s.param}function nc(s){switch(s){case tt:case Kr:case Si:case Fe:case Sa:case Zr:case fo:case xi:case Ft:case Ai:case Sn:return 6;case Jo:return 4;default:return 10}}function ts(s){return!!(s!=null&&s.expr)}function ea(s){let l=be(s||{}),d={};for(let h of l)d[h]=Gn(s[h]);return d}function ac(s){let{anchor:l,frame:d,offset:h,orient:y,angle:w,limit:x,color:A,subtitleColor:C,subtitleFont:L,subtitleFontSize:G,subtitleFontStyle:H,subtitleFontWeight:X,subtitleLineHeight:J,subtitlePadding:le,...te}=s,pe={...l?{anchor:l}:{},...d?{frame:d}:{},...h?{offset:h}:{},...y?{orient:y}:{},...w!==void 0?{angle:w}:{},...x!==void 0?{limit:x}:{}},ge={...C?{subtitleColor:C}:{},...L?{subtitleFont:L}:{},...G?{subtitleFontSize:G}:{},...H?{subtitleFontStyle:H}:{},...X?{subtitleFontWeight:X}:{},...J?{subtitleLineHeight:J}:{},...le?{subtitlePadding:le}:{}};return{titleMarkConfig:{...te,...A?{fill:A}:{}},subtitleMarkConfig:V(s,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:pe,subtitle:ge}}function fa(s){return b.isString(s)||b.isArray(s)&&b.isString(s[0])}function Ze(s){return!!(s!=null&&s.signal)}function go(s){return!!s.step}function Aa(s){return!b.isArray(s)&&"field"in s&&"data"in s}let Hl=be({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}),Bd={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},Ah=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function T0(s){let l=b.isArray(s.condition)?s.condition.map(C0):C0(s.condition);return{...Gn(s),condition:l}}function Gn(s){if(ts(s)){let{expr:l,...d}=s;return{signal:l,...d}}return s}function C0(s){if(ts(s)){let{expr:l,...d}=s;return{signal:l,...d}}return s}function on(s){if(ts(s)){let{expr:l,...d}=s;return{signal:l,...d}}return Ze(s)?s:s!==void 0?{value:s}:void 0}function ns(s){return Ze(s)?s.signal:b.stringValue(s.value)}function pa(s){return Ze(s)?s.signal:s==null?null:b.stringValue(s)}function Ud(s,l,d){for(let h of d){let y=Ga(h,l.markDef,l.config);y!==void 0&&(s[h]=on(y))}return s}function R0(s){return[].concat(s.type,s.style??[])}function Ht(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},{vgChannel:y,ignoreVgConfig:w}=h;return y&&l[y]!==void 0?l[y]:l[s]!==void 0?l[s]:!w||y&&y!==s?Ga(s,l,d,h):void 0}function Ga(s,l,d){let{vgChannel:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Ke(h?zd(s,l,d.style):void 0,zd(s,l,d.style),h?d[l.type][h]:void 0,d[l.type][s],h?d.mark[h]:d.mark[s])}function zd(s,l,d){return N0(s,R0(l),d)}function N0(s,l,d){let h;l=b.array(l);for(let y of l){let w=d[y];w&&w[s]!==void 0&&(h=w[s])}return h}function ql(s,l){return b.array(s).reduce(((d,h)=>(d.field.push(je(h,l)),d.order.push(h.sort??"ascending"),d)),{field:[],order:[]})}function Wl(s,l){let d=[...s];return l.forEach((h=>{for(let y of d)if(Ie(y,h))return;d.push(h)})),d}function ti(s,l){return Ie(s,l)||!l?s:s?[...b.array(s),...b.array(l)].join(", "):l}function ni(s,l){let d=s.value,h=l.value;if(d==null||h===null)return{explicit:s.explicit,value:null};if((fa(d)||Ze(d))&&(fa(h)||Ze(h)))return{explicit:s.explicit,value:ti(d,h)};if(fa(d)||Ze(d))return{explicit:s.explicit,value:d};if(fa(h)||Ze(h))return{explicit:s.explicit,value:h};if(!(fa(d)||Ze(d)||fa(h)||Ze(h)))return{explicit:s.explicit,value:Wl(d,h)};throw new Error("It should never reach here")}function at(s,l,d){return(l=(function(h){var y=(function(w,x){if(typeof w!="object"||w===null)return w;var A=w[Symbol.toPrimitive];if(A!==void 0){var C=A.call(w,x||"default");if(typeof C!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(w)})(h,"string");return typeof y=="symbol"?y:String(y)})(l))in s?Object.defineProperty(s,l,{value:d,enumerable:!0,configurable:!0,writable:!0}):s[l]=d,s}function I0(s,l,d){return(function(h,y,w){if(y.set)y.set.call(h,w);else{if(!y.writable)throw new TypeError("attempted to set read only private field");y.value=w}})(s,O0(s,l,"set"),d),d}function O0(s,l,d){if(!l.has(s))throw new TypeError("attempted to "+d+" private field on non-instance");return l.get(s)}function C_(s,l,d){(function(h,y){if(y.has(h))throw new TypeError("Cannot initialize the same private elements twice on an object")})(s,l),l.set(s,d)}function Th(s){return`Invalid specification ${Xe(s)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}let ta='Autosize "fit" only works for single views and layered views.';function Ta(s){return`${s=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function na(s){return`${s=="width"?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${s=="width"?"x":"y"}".`}function Cn(s){return s?`Dropping "fit-${s}" because spec has discrete ${xa(s)}.`:'Dropping "fit" because spec has discrete size.'}function ha(s){return`Unknown field for ${s}. Cannot calculate view size.`}function aa(s){return`Cannot project a selection on encoding channel "${s}", which has no field.`}function Di(s,l){return`Cannot project a selection on encoding channel "${s}" as it uses an aggregate function ("${l}").`}function ja(s){return`Selection not supported for ${s} yet.`}let lr="The same selection must be used to override scale domains in a layered view.";function ur(s){return`The "columns" property cannot be used when "${s}" has nested row/column.`}function Dr(s,l,d){return`An ancestor parsed field "${s}" as ${d} but a child wants to parse the field as ${l}.`}function Gd(s){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${s} are dropped.`}function Ch(s){return`${s}Offset dropped because ${s} is continuous`}function jd(s){return`Invalid field type "${s}".`}function D0(s,l){let{fill:d,stroke:h}=l;return`Dropping color ${s} as the plot also has ${d&&h?"fill and stroke":d?"fill":"stroke"}.`}function Hd(s,l){return`Dropping ${Xe(s)} from channel "${l}" since it does not contain any data field, datum, value, or signal.`}function Mi(s,l,d){return`${s} dropped as it is incompatible with "${l}"${d?` when ${d}`:""}.`}function Rh(s){return`${s} encoding should be discrete (ordinal / nominal / binned).`}function M0(s){return`${s} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function qd(s,l){return`Using discrete channel "${s}" to encode "${l}" field can be misleading as it does not encode ${l==="ordinal"?"order":"magnitude"}.`}function L0(s){return`Using unaggregated domain with raw field has no effect (${Xe(s)}).`}function Nh(s){return`Unaggregated domain not applicable for "${s}" since it produces values outside the origin domain of the source data.`}function Ih(s){return`Unaggregated domain is currently unsupported for log scale (${Xe(s)}).`}function F0(s,l,d){return`${d}-scale's "${l}" is dropped as it does not work with ${s} scale.`}function Oh(s){return`The step for "${s}" is dropped because the ${s==="width"?"x":"y"} is continuous.`}let Dh="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function rc(s,l){return`Invalid ${s}: ${Xe(l)}.`}function Wd(s){return`1D error band does not support ${s}.`}function Vd(s){return`Channel ${s} is required for "binned" bin.`}let P0=b.logger(b.Warn),ic=P0;function Be(){ic.warn(...arguments)}function Gs(s){if(s&&b.isObject(s)){for(let l of as)if(l in s)return!0}return!1}let $0=["january","february","march","april","may","june","july","august","september","october","november","december"],B0=$0.map((s=>s.substr(0,3))),U0=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],R_=U0.map((s=>s.substr(0,3)));function Yd(s,l){let d=[];if(l&&s.day!==void 0&&be(s).length>1&&(Be((function(h){return`Dropping day from datetime ${Xe(h)} as day cannot be combined with other units.`})(s)),delete(s=j(s)).day),s.year!==void 0?d.push(s.year):d.push(2012),s.month!==void 0){let h=l?(function(y){if(Ct(y)&&(y=+y),b.isNumber(y))return y-1;{let w=y.toLowerCase(),x=$0.indexOf(w);if(x!==-1)return x;let A=w.substr(0,3),C=B0.indexOf(A);if(C!==-1)return C;throw new Error(rc("month",y))}})(s.month):s.month;d.push(h)}else if(s.quarter!==void 0){let h=l?(function(y){if(Ct(y)&&(y=+y),b.isNumber(y))return y>4&&Be(rc("quarter",y)),y-1;throw new Error(rc("quarter",y))})(s.quarter):s.quarter;d.push(b.isNumber(h)?3*h:`${h}*3`)}else d.push(0);if(s.date!==void 0)d.push(s.date);else if(s.day!==void 0){let h=l?(function(y){if(Ct(y)&&(y=+y),b.isNumber(y))return y%7;{let w=y.toLowerCase(),x=U0.indexOf(w);if(x!==-1)return x;let A=w.substr(0,3),C=R_.indexOf(A);if(C!==-1)return C;throw new Error(rc("day",y))}})(s.day):s.day;d.push(b.isNumber(h)?h+1:`${h}+1`)}else d.push(1);for(let h of["hours","minutes","seconds","milliseconds"]){let y=s[h];d.push(y===void 0?0:y)}return d}function js(s){let l=Yd(s,!0).join(", ");return s.utc?`utc(${l})`:`datetime(${l})`}let z0={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},as=be(z0);function Mr(s){return b.isObject(s)?s.binned:Mh(s)}function Mh(s){return s&&s.startsWith("binned")}function Kd(s){return s.startsWith("utc")}let G0={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function oc(s){return as.filter((l=>Fh(s,l)))}function Lh(s){let l=oc(s);return l[l.length-1]}function Fh(s,l){let d=s.indexOf(l);return!(d<0)&&!(d>0&&l==="seconds"&&s.charAt(d-1)==="i")&&!(s.length>d+3&&l==="day"&&s.charAt(d+3)==="o")&&!(d>0&&l==="year"&&s.charAt(d-1)==="f")}function N_(s,l){let{end:d}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{end:!1},h=xt(l),y=Kd(s)?"utc":"",w,x={};for(let C of as)Fh(s,C)&&(x[C]=(A=C)==="quarter"?`(${y}quarter(${h})-1)`:`${y}${A}(${h})`,w=C);var A;return d&&(x[w]+="+1"),(function(C){let L=Yd(C,!1).join(", ");return C.utc?`utc(${L})`:`datetime(${L})`})(x)}function j0(s){if(s)return`timeUnitSpecifier(${Xe(oc(s))}, ${Xe(G0)})`}function jn(s){if(!s)return;let l;return b.isString(s)?l=Mh(s)?{unit:s.substring(6),binned:!0}:{unit:s}:b.isObject(s)&&(l={...s,...s.unit?{unit:s.unit}:{}}),Kd(l.unit)&&(l.utc=!0,l.unit=l.unit.substring(3)),l}function H0(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y=>y,d=jn(s),h=Lh(d.unit);if(h&&h!=="day"){let y={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:w,part:x}=Xd(h,d.step);return`${l(js({...y,[x]:+y[x]+w}))} - ${l(js(y))}`}}let I_={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function Xd(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if((function(d){return!!I_[d]})(s))return{part:s,step:l};switch(s){case"day":case"dayofyear":return{part:"date",step:l};case"quarter":return{part:"month",step:3*l};case"week":return{part:"date",step:7*l}}}function Zd(s){return!!(s!=null&&s.field)&&s.equal!==void 0}function Hs(s){return!!(s!=null&&s.field)&&s.lt!==void 0}function qs(s){return!!(s!=null&&s.field)&&s.lte!==void 0}function Ws(s){return!!(s!=null&&s.field)&&s.gt!==void 0}function Ph(s){return!!(s!=null&&s.field)&&s.gte!==void 0}function Jd(s){return!!(s!=null&&s.field&&(b.isArray(s.range)&&s.range.length===2||Ze(s.range)))}function Qd(s){return!!(s!=null&&s.field)&&(b.isArray(s.oneOf)||b.isArray(s.in))}function Vl(s){return Qd(s)||Zd(s)||Jd(s)||Hs(s)||Ws(s)||qs(s)||Ph(s)}function ai(s,l){return iu(s,{timeUnit:l,wrapTime:!0})}function ef(s){let l=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],{field:d}=s,h=jn(s.timeUnit),{unit:y,binned:w}=h||{},x=je(s,{expr:"datum"}),A=y?`time(${w?x:N_(y,d)})`:x;if(Zd(s))return`${A}===${ai(s.equal,y)}`;if(Hs(s))return`${A}<${ai(s.lt,y)}`;if(Ws(s))return`${A}>${ai(s.gt,y)}`;if(qs(s))return`${A}<=${ai(s.lte,y)}`;if(Ph(s))return`${A}>=${ai(s.gte,y)}`;if(Qd(s))return`indexof([${(function(C,L){return C.map((G=>ai(G,L)))})(s.oneOf,y).join(",")}], ${A}) !== -1`;if((function(C){return!!(C!=null&&C.field)&&C.valid!==void 0})(s))return sc(A,s.valid);if(Jd(s)){let{range:C}=s,L=Ze(C)?{signal:`${C.signal}[0]`}:C[0],G=Ze(C)?{signal:`${C.signal}[1]`}:C[1];if(L!==null&&G!==null&&l)return"inrange("+A+", ["+ai(L,y)+", "+ai(G,y)+"])";let H=[];return L!==null&&H.push(`${A} >= ${ai(L,y)}`),G!==null&&H.push(`${A} <= ${ai(G,y)}`),H.length>0?H.join(" && "):"true"}throw new Error(`Invalid field predicate: ${Xe(s)}`)}function sc(s){return!(arguments.length>1&&arguments[1]!==void 0)||arguments[1]?`isValid(${s}) && isFinite(+${s})`:`!isValid(${s}) || !isFinite(+${s})`}function lc(s){return Vl(s)&&s.timeUnit?{...s,timeUnit:jn(s.timeUnit)}:s}function q0(s){return s==="quantitative"||s==="temporal"}function Yl(s){return s==="ordinal"||s==="nominal"}let bo="quantitative",tf="ordinal",rs="temporal",nf="nominal",Vs="geojson",Gt={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},$h={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 O_(s,l){let d=$h[s],h=$h[l];return d===h||d==="ordinal-position"&&h==="time"||h==="ordinal-position"&&d==="time"}let Pt={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 W0(s){return Pt[s]}let Kl=new Set(["linear","log","pow","sqrt","symlog"]),Xl=new Set([...Kl,"time","utc"]);function V0(s){return Kl.has(s)}let Y0=new Set(["quantile","quantize","threshold"]),D_=new Set([...Xl,...Y0,"sequential","identity"]),M_=new Set(["ordinal","bin-ordinal","point","band"]);function Hn(s){return M_.has(s)}function Ha(s){return D_.has(s)}function Lr(s){return Xl.has(s)}function Zl(s){return Y0.has(s)}function K0(s){return s==null?void 0:s.param}let{type:WA,domain:L_,range:VA,rangeMax:F_,rangeMin:YA,scheme:KA,...P_}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},$_=be(P_);function Bh(s,l){switch(l){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(s);case"bins":return!["point","band","identity","ordinal"].includes(s);case"round":return Lr(s)||s==="band"||s==="point";case"padding":case"rangeMin":case"rangeMax":return Lr(s)||["point","band"].includes(s);case"paddingOuter":case"align":return["point","band"].includes(s);case"paddingInner":return s==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Lr(s);case"nice":return Lr(s)||s==="quantize"||s==="threshold";case"exponent":return s==="pow";case"base":return s==="log";case"constant":return s==="symlog";case"zero":return Ha(s)&&!Z(["log","time","utc","threshold","quantile"],s)}}function X0(s,l){switch(l){case"interpolate":case"scheme":case"domainMid":return es(s)?void 0:`Cannot use the scale property "${l}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}let Ca={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"},Uh=Ca.arc,af=Ca.area,rf=Ca.bar,B_=Ca.image,uc=Ca.line,of=Ca.point,U_=Ca.rect,sf=Ca.rule,Z0=Ca.text,zh=Ca.tick,z_=Ca.trail,lf=Ca.circle,Gh=Ca.square,J0=Ca.geoshape;function is(s){return["line","area","trail"].includes(s)}function cc(s){return["rect","bar","image","arc"].includes(s)}let G_=new Set(be(Ca));function Li(s){return s.type}let j_=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Q0=be({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),jh=be({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 Ys(s){return s&&s.band!=null}let H_={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},q_={binSpacing:1,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},ey={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5};function Hh(s){let{channel:l,channelDef:d,markDef:h,scale:y,config:w}=s,x=Wh(s);return ze(d)&&!Ii(d.aggregate)&&y&&Lr(y.get("type"))?(function(A){let{fieldDef:C,channel:L,markDef:G,ref:H,config:X}=A;return is(G.type)?H:Ht("invalid",G,X)===null?[W_(C,L),H]:H})({fieldDef:d,channel:l,markDef:h,ref:x,config:w}):x}function W_(s,l){return{test:qh(s,!0),...Us(l)==="y"?{field:{group:"height"}}:{value:0}}}function qh(s){let l=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return sc(b.isString(s)?s:je(s,{expr:"datum"}),!l)}function Ks(s,l,d,h){let y={};if(l&&(y.scale=l),Pi(s)){let{datum:w}=s;Gs(w)?y.signal=js(w):Ze(w)?y.signal=w.signal:ts(w)?y.signal=w.expr:y.value=w}else y.field=je(s,d);if(h){let{offset:w,band:x}=h;w&&(y.offset=w),x&&(y.band=x)}return y}function uf(s){let{scaleName:l,fieldOrDatumDef:d,fieldOrDatumDef2:h,offset:y,startSuffix:w,endSuffix:x="end",bandPosition:A=.5}=s,C=!Ze(A)&&0<A&&A<1?"datum":void 0,L=je(d,{expr:C,suffix:w}),G=h!==void 0?je(h,{expr:C}):je(d,{suffix:x,expr:C}),H={};if(A===0||A===1){H.scale=l;let X=A===0?L:G;H.field=X}else{let X=Ze(A)?`(1-${A.signal}) * ${L} + ${A.signal} * ${G}`:`${1-A} * ${L} + ${A} * ${G}`;H.signal=`scale("${l}", ${X})`}return y&&(H.offset=y),H}function Wh(s){let{channel:l,channelDef:d,channel2Def:h,markDef:y,config:w,scaleName:x,scale:A,stack:C,offset:L,defaultRef:G,bandPosition:H}=s;if(d){if(_t(d)){let X=A==null?void 0:A.get("type");if(ma(d)){H??=Fi({fieldDef:d,fieldDef2:h,markDef:y,config:w});let{bin:J,timeUnit:le,type:te}=d;if(Vt(J)||H&&le&&te===rs)return C!=null&&C.impute?Ks(d,x,{binSuffix:"mid"},{offset:L}):H&&!Hn(X)?uf({scaleName:x,fieldOrDatumDef:d,bandPosition:H,offset:L}):Ks(d,x,ou(d,l)?{binSuffix:"range"}:{},{offset:L});if(zn(J)){if(ze(h))return uf({scaleName:x,fieldOrDatumDef:d,fieldOrDatumDef2:h,bandPosition:H,offset:L});Be(Vd(l===Qt?Xr:ki))}}return Ks(d,x,Hn(X)?{binSuffix:"range"}:{},{offset:L,band:X==="band"?H??d.bandPosition??.5:void 0})}if(cr(d)){let X=L?{offset:L}:{};return{...Jl(l,d.value),...X}}}return b.isFunction(G)&&(G=G()),G&&{...G,...L?{offset:L}:{}}}function Jl(s,l){return Z(["x","x2"],s)&&l==="width"?{field:{group:"width"}}:Z(["y","y2"],s)&&l==="height"?{field:{group:"height"}}:on(l)}function Xs(s){return s&&s!=="number"&&s!=="time"}function ty(s,l,d){return`${s}(${l}${d?`, ${Xe(d)}`:""})`}let V_=" \u2013 ";function Vh(s){var L,G;let{fieldOrDatumDef:l,format:d,formatType:h,expr:y,normalizeStack:w,config:x}=s;if(Xs(h))return ri({fieldOrDatumDef:l,format:d,formatType:h,expr:y,config:x});let A=ny(l,y,w),C=tu(l);if(d===void 0&&h===void 0&&x.customFormatTypes){if(C==="quantitative"){if(w&&x.normalizedNumberFormatType)return ri({fieldOrDatumDef:l,format:x.normalizedNumberFormat,formatType:x.normalizedNumberFormatType,expr:y,config:x});if(x.numberFormatType)return ri({fieldOrDatumDef:l,format:x.numberFormat,formatType:x.numberFormatType,expr:y,config:x})}if(C==="temporal"&&x.timeFormatType&&ze(l)&&l.timeUnit===void 0)return ri({fieldOrDatumDef:l,format:x.timeFormat,formatType:x.timeFormatType,expr:y,config:x})}if(It(l)){let H=(function(X){let{field:J,timeUnit:le,format:te,formatType:pe,rawTimeFormat:ge,isUTCScale:xe}=X;return!le||te?!le&&pe?`${pe}(${J}, '${te}')`:(te=b.isString(te)?te:ge,`${xe?"utc":"time"}Format(${J}, '${te}')`):(function(me,Ae,Re){if(!me)return;let Pe=j0(me);return`${Re||Kd(me)?"utc":"time"}Format(${Ae}, ${Pe})`})(le,J,xe)})({field:A,timeUnit:ze(l)?(L=jn(l.timeUnit))==null?void 0:L.unit:void 0,format:d,formatType:x.timeFormatType,rawTimeFormat:x.timeFormat,isUTCScale:$i(l)&&((G=l.scale)==null?void 0:G.type)===Gt.UTC});return H?{signal:H}:void 0}return d=cf({type:C,specifiedFormat:d,config:x,normalizeStack:w}),ze(l)&&Vt(l.bin)?{signal:yo(A,je(l,{expr:y,binSuffix:"end"}),d,h,x)}:d||tu(l)==="quantitative"?{signal:`${Yh(A,d)}`}:{signal:`isValid(${A}) ? ${A} : ""+${A}`}}function ny(s,l,d){return ze(s)?d?`${je(s,{expr:l,suffix:"end"})}-${je(s,{expr:l,suffix:"start"})}`:je(s,{expr:l}):(function(h){let{datum:y}=h;return Gs(y)?js(y):`${Xe(y)}`})(s)}function ri(s){let{fieldOrDatumDef:l,format:d,formatType:h,expr:y,normalizeStack:w,config:x,field:A}=s;return A??=ny(l,y,w),A!=="datum.value"&&ze(l)&&Vt(l.bin)?{signal:yo(A,je(l,{expr:y,binSuffix:"end"}),d,h,x)}:{signal:ty(h,A,d)}}function ay(s,l,d,h,y,w){var x;if(!b.isString(h)||!Xs(h)){if(d===void 0&&h===void 0&&y.customFormatTypes&&tu(s)==="quantitative"&&(y.normalizedNumberFormatType&&nu(s)&&s.stack==="normalize"||y.numberFormatType))return;if(nu(s)&&s.stack==="normalize"&&y.normalizedNumberFormat)return cf({type:"quantitative",config:y,normalizeStack:!0});if(It(s)){let A=ze(s)?(x=jn(s.timeUnit))==null?void 0:x.unit:void 0;return A===void 0&&y.customFormatTypes&&y.timeFormatType?void 0:(function(C){let{specifiedFormat:L,timeUnit:G,config:H,omitTimeFormatConfig:X}=C;return L||(G?{signal:j0(G)}:X?void 0:H.timeFormat)})({specifiedFormat:d,timeUnit:A,config:y,omitTimeFormatConfig:w})}return cf({type:l,specifiedFormat:d,config:y})}}function ry(s,l,d){var h;return s&&(Ze(s)||s==="number"||s==="time")?s:It(l)&&d!=="time"&&d!=="utc"?ze(l)&&((h=jn(l==null?void 0:l.timeUnit))!=null&&h.utc)?"utc":"time":void 0}function cf(s){let{type:l,specifiedFormat:d,config:h,normalizeStack:y}=s;return b.isString(d)?d:l===bo?y?h.normalizedNumberFormat:h.numberFormat:void 0}function Yh(s,l){return`format(${s}, "${l||""}")`}function Kh(s,l,d,h){return Xs(d)?ty(d,s,l):Yh(s,(b.isString(l)?l:void 0)??h.numberFormat)}function yo(s,l,d,h,y){if(d===void 0&&h===void 0&&y.customFormatTypes&&y.numberFormatType)return yo(s,l,y.numberFormat,y.numberFormatType,y);let w=Kh(s,d,h,y),x=Kh(l,d,h,y);return`${sc(s,!1)} ? "null" : ${w} + "${V_}" + ${x}`}let dc="min",Xh={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 df(s){return s in Xh}function Zh(s){return!!(s!=null&&s.encoding)}function ii(s){return s&&(s.op==="count"||!!s.field)}function fc(s){return s&&b.isArray(s)}function Ql(s){return"row"in s||"column"in s}function ff(s){return!!s&&"header"in s}function pc(s){return"facet"in s}function Jh(s){let{field:l,timeUnit:d,bin:h,aggregate:y}=s;return{...d?{timeUnit:d}:{},...h?{bin:h}:{},...y?{aggregate:y}:{},field:l}}function Zs(s){return"sort"in s}function Fi(s){let{fieldDef:l,fieldDef2:d,markDef:h,config:y}=s;if(_t(l)&&l.bandPosition!==void 0)return l.bandPosition;if(ze(l)){let{timeUnit:w,bin:x}=l;if(w&&!d)return Ga("timeUnitBandPosition",h,y);if(Vt(x))return .5}}function Qh(s){var G,H,X;let{channel:l,fieldDef:d,fieldDef2:h,markDef:y,config:w,scaleType:x,useVlSizeChannel:A}=s,C=xa(l),L=Ht(A?"size":C,y,w,{vgChannel:C});if(L!==void 0)return L;if(ze(d)){let{timeUnit:J,bin:le}=d;if(J&&!h)return{band:Ga("timeUnitBandSize",y,w)};if(Vt(le)&&!Hn(x))return{band:1}}return cc(y.type)?x?Hn(x)?((G=w[y.type])==null?void 0:G.discreteBandSize)||{band:1}:(H=w[y.type])==null?void 0:H.continuousBandSize:(X=w[y.type])==null?void 0:X.discreteBandSize:void 0}function pf(s,l,d,h){return!!(Vt(s.bin)||s.timeUnit&&ma(s)&&s.type==="temporal")&&Fi({fieldDef:s,fieldDef2:l,markDef:d,config:h})!==void 0}function iy(s){return s&&!!s.sort&&!s.field}function hf(s){return s&&"condition"in s}function mf(s){let l=s==null?void 0:s.condition;return!!l&&!b.isArray(l)&&ze(l)}function eu(s){let l=s==null?void 0:s.condition;return!!l&&!b.isArray(l)&&_t(l)}function ze(s){return s&&(!!s.field||s.aggregate==="count")}function tu(s){return s==null?void 0:s.type}function Pi(s){return s&&"datum"in s}function os(s){return ma(s)&&!au(s)||gf(s)}function oy(s){return ma(s)&&s.type==="quantitative"&&!s.bin||gf(s)}function gf(s){return Pi(s)&&b.isNumber(s.datum)}function _t(s){return ze(s)||Pi(s)}function ma(s){return s&&("field"in s||s.aggregate==="count")&&"type"in s}function cr(s){return s&&"value"in s&&"value"in s}function $i(s){return s&&("scale"in s||"sort"in s)}function nu(s){return s&&("axis"in s||"stack"in s||"impute"in s)}function em(s){return s&&"legend"in s}function tm(s){return s&&("format"in s||"formatType"in s)}function sy(s){return ee(s,["legend","axis","header","scale"])}function je(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=s.field,h=l.prefix,y=l.suffix,w="";if((function(x){return x.aggregate==="count"})(s))d=Et("count");else{let x;if(!l.nofn)if((function(A){return"op"in A})(s))x=s.op;else{let{bin:A,aggregate:C,timeUnit:L}=s;Vt(A)?(x=Oi(A),y=(l.binSuffix??"")+(l.suffix??"")):C?Ni(C)?(w=`["${d}"]`,d=`argmax_${C.argmax}`):ei(C)?(w=`["${d}"]`,d=`argmin_${C.argmin}`):x=String(C):L&&!Mr(L)&&(x=(function(G){let{utc:H,...X}=jn(G);return X.unit?(H?"utc":"")+be(X).map((J=>$e(`${J==="unit"?"":`_${J}_`}${X[J]}`))).join(""):(H?"utc":"")+"timeunit"+be(X).map((J=>$e(`_${J}_${X[J]}`))).join("")})(L),y=(!["range","mid"].includes(l.binSuffix)&&l.binSuffix||"")+(l.suffix??""))}x&&(d=d?`${x}_${d}`:x)}return y&&(d=`${d}_${y}`),h&&(d=`${h}_${d}`),l.forAs?Tt(d):l.expr?rn(d,l.expr)+w:jt(d)+w}function au(s){switch(s.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return ze(s)&&!!s.bin;case"temporal":return!1}throw new Error(jd(s.type))}let ly=(s,l)=>{switch(l.fieldTitle){case"plain":return s.field;case"functional":return(function(d){let{aggregate:h,bin:y,timeUnit:w,field:x}=d;if(Ni(h))return`${x} for argmax(${h.argmax})`;if(ei(h))return`${x} for argmin(${h.argmin})`;let A=w&&!Mr(w)?jn(w):void 0,C=h||(A==null?void 0:A.unit)||(A==null?void 0:A.maxbins)&&"timeunit"||Vt(y)&&"bin";return C?`${C.toUpperCase()}(${x})`:x})(s);default:return(function(d,h){var C;let{field:y,bin:w,timeUnit:x,aggregate:A}=d;if(A==="count")return h.countTitle;if(Vt(w))return`${y} (binned)`;if(x&&!Mr(x)){let L=(C=jn(x))==null?void 0:C.unit;if(L)return`${y} (${oc(L).join("-")})`}else if(A)return Ni(A)?`${y} for max ${A.argmax}`:ei(A)?`${y} for min ${A.argmin}`:`${yt(A)} of ${y}`;return y})(s,l)}},nm=ly;function hc(s){nm=s}function ss(s,l,d){var C;let{allowDisabling:h,includeDefault:y=!0}=d,w=(C=bf(s))==null?void 0:C.title;if(!ze(s))return w??s.title;let x=s,A=y?yf(x,l):void 0;return h?Ke(w,x.title,A):w??x.title??A}function bf(s){return nu(s)&&s.axis?s.axis:em(s)&&s.legend?s.legend:ff(s)&&s.header?s.header:void 0}function yf(s,l){return nm(s,l)}function Js(s){if(tm(s)){let{format:l,formatType:d}=s;return{format:l,formatType:d}}{let l=bf(s)??{},{format:d,formatType:h}=l;return{format:d,formatType:h}}}function dr(s){return ze(s)?s:mf(s)?s.condition:void 0}function vn(s){return _t(s)?s:eu(s)?s.condition:void 0}function am(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return b.isString(s)||b.isNumber(s)||b.isBoolean(s)?(Be((function(y,w,x){return`Channel ${y} is a ${w}. Converted to {value: ${Xe(x)}}.`})(l,b.isString(s)?"string":b.isNumber(s)?"number":"boolean",s)),{value:s}):_t(s)?vf(s,l,d,h):eu(s)?{...s,condition:vf(s.condition,l,d,h)}:s}function vf(s,l,d,h){if(tm(s)){let{format:y,formatType:w,...x}=s;if(Xs(w)&&!d.customFormatTypes)return Be(Gd(l)),vf(x,l,d,h)}else{let y=nu(s)?"axis":em(s)?"legend":ff(s)?"header":null;if(y&&s[y]){let{format:w,formatType:x,...A}=s[y];if(Xs(x)&&!d.customFormatTypes)return Be(Gd(l)),vf({...s,[y]:A},l,d,h)}}return ze(s)?ru(s,l,h):(function(y){let w=y.type;if(w)return y;let{datum:x}=y;return w=b.isNumber(x)?"quantitative":b.isString(x)?"nominal":Gs(x)?"temporal":void 0,{...y,type:w}})(s)}function ru(s,l){let{compositeMark:d=!1}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{aggregate:h,timeUnit:y,bin:w,field:x}=s,A={...s};if(d||!h||xn(h)||Ni(h)||ei(h)||(Be((function(C){return`Invalid aggregation operator "${C}".`})(h)),delete A.aggregate),y&&(A.timeUnit=jn(y)),x&&(A.field=`${x}`),Vt(w)&&(A.bin=rt(w,l)),zn(w)&&!un(l)&&Be((function(C){return`Channel ${C} should not be used with "binned" bin.`})(l)),ma(A)){let{type:C}=A,L=(function(G){if(G)switch(G=G.toLowerCase()){case"q":case bo:return"quantitative";case"t":case rs:return"temporal";case"o":case tf:return"ordinal";case"n":case nf:return"nominal";case Vs:return"geojson"}})(C);C!==L&&(A.type=L),C!=="quantitative"&&Ii(h)&&(Be((function(G,H){return`Invalid field type "${G}" for aggregate: "${H}", using "quantitative" instead.`})(C,h)),A.type="quantitative")}else if(!Ti(l)){let C=(function(L,G){var le;switch(G){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(Zs(L)&&b.isArray(L.sort))return"ordinal";let{aggregate:H,bin:X,timeUnit:J}=L;if(J)return"temporal";if(X||H&&!Ni(H)&&!ei(H))return"quantitative";if($i(L)&&((le=L.scale)!=null&&le.type))switch($h[L.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"})(A,l);A.type=C}if(ma(A)){let{compatible:C,warning:L}=(function(G,H){var le;let X=G.type;if(X==="geojson"&&H!=="shape")return{compatible:!1,warning:`Channel ${H} should not be used with a geojson data.`};switch(H){case tt:case Kr:case Fl:return au(G)?Qs:{compatible:!1,warning:Rh(H)};case Qt:case Bn:case mn:case Zo:case Fe:case Sa:case Zr:case Pl:case po:case Ku:case Jr:case st:case $l:case Ba:case ar:case mt:case Md:return Qs;case $a:case rr:case nt:case da:return X!==bo?{compatible:!1,warning:`Channel ${H} should be used with a quantitative field only, not ${G.type} field.`}:Qs;case xi:case Ft:case Ai:case fo:case Si:case co:case Un:case Xr:case ki:return X!=="nominal"||G.sort?Qs:{compatible:!1,warning:`Channel ${H} should not be used with an unsorted discrete field.`};case Sn:case Jo:return au(G)||$i(J=G)&&Zl((le=J.scale)==null?void 0:le.type)?Qs:{compatible:!1,warning:M0(H)};case Bs:return G.type!=="nominal"||"sort"in G?Qs:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var J})(A,l)||{};C===!1&&Be(L)}if(Zs(A)&&b.isString(A.sort)){let{sort:C}=A;if(df(C))return{...A,sort:{encoding:C}};let L=C.substr(1);if(C.charAt(0)==="-"&&df(L))return{...A,sort:{encoding:L,order:"descending"}}}if(ff(A)){let{header:C}=A;if(C){let{orient:L,...G}=C;if(L)return{...A,header:{...G,labelOrient:C.labelOrient||L,titleOrient:C.titleOrient||L}}}}return A}function rt(s,l){return b.isBoolean(s)?{maxbins:nc(l)}:s==="binned"?{binned:!0}:s.maxbins||s.step?s:{...s,maxbins:nc(l)}}let Qs={compatible:!0};function It(s){let{formatType:l}=Js(s);return l==="time"||!l&&(d=s)&&(d.type==="temporal"||ze(d)&&!!d.timeUnit);var d}function iu(s,l){var L;let{timeUnit:d,type:h,wrapTime:y,undefinedIfExprNotRequired:w}=l,x=d&&((L=jn(d))==null?void 0:L.unit),A,C=x||h==="temporal";return ts(s)?A=s.expr:Ze(s)?A=s.signal:Gs(s)?(C=!0,A=js(s)):(b.isString(s)||b.isNumber(s))&&C&&(A=`datetime(${Xe(s)})`,(function(G){return!!z0[G]})(x)&&(b.isNumber(s)&&s<1e4||b.isString(s)&&isNaN(Date.parse(s)))&&(A=js({[x]:s}))),A?y&&C?`time(${A})`:A:w?void 0:Xe(s)}function mc(s,l){let{type:d}=s;return l.map((h=>{let y=iu(h,{timeUnit:ze(s)&&!Mr(s.timeUnit)?s.timeUnit:void 0,type:d,undefinedIfExprNotRequired:!0});return y!==void 0?{signal:y}:h}))}function ou(s,l){return Vt(s.bin)?Nr(l)&&["ordinal","nominal"].includes(s.type):(console.warn("Only call this method for binned field defs."),!1)}let ls={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 su(s){return s==null?void 0:s.condition}let us=["domain","grid","labels","ticks","title"],Ef={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"},gc={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},Y_={...gc,style:1,labelExpr:1,encoding:1};function uy(s){return!!Y_[s]}let Yt=be({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 Bi(s){return"mark"in s}class wf{constructor(l,d){this.name=l,this.run=d}hasMatchingType(l){return!!Bi(l)&&(Li(d=l.mark)?d.type:d)===this.name;var d}}function Ui(s,l){let d=s&&s[l];return!!d&&(b.isArray(d)?ae(d,(h=>!!h.field)):ze(d)||mf(d))}function vo(s,l){let d=s&&s[l];return!!d&&(b.isArray(d)?ae(d,(h=>!!h.field)):ze(d)||Pi(d)||eu(d))}function cy(s,l){if(un(l)){let d=s[l];if((ze(d)||Pi(d))&&(Yl(d.type)||ze(d)&&d.timeUnit))return vo(s,Ul(l))}return!1}function rm(s){return ae(g0,(l=>{if(Ui(s,l)){let d=s[l];if(b.isArray(d))return ae(d,(h=>!!h.aggregate));{let h=dr(d);return h&&!!h.aggregate}}return!1}))}function dy(s,l){let d=[],h=[],y=[],w=[],x={};return bc(s,((A,C)=>{if(ze(A)){let{field:L,aggregate:G,bin:H,timeUnit:X,...J}=A;if(G||X||H){let le=bf(A),te=le==null?void 0:le.title,pe=je(A,{forAs:!0}),ge={...te?[]:{title:ss(A,l,{allowDisabling:!0})},...J,field:pe};if(G){let xe;if(Ni(G)?(xe="argmax",pe=je({op:"argmax",field:G.argmax},{forAs:!0}),ge.field=`${pe}.${L}`):ei(G)?(xe="argmin",pe=je({op:"argmin",field:G.argmin},{forAs:!0}),ge.field=`${pe}.${L}`):G!=="boxplot"&&G!=="errorbar"&&G!=="errorband"&&(xe=G),xe){let me={op:xe,as:pe};L&&(me.field=L),w.push(me)}}else if(d.push(pe),ma(A)&&Vt(H)){if(h.push({bin:H,field:L,as:pe}),d.push(je(A,{binSuffix:"end"})),ou(A,C)&&d.push(je(A,{binSuffix:"range"})),un(C)){let xe={field:`${pe}_end`};x[`${C}2`]=xe}ge.bin="binned",Ti(C)||(ge.type=bo)}else if(X&&!Mr(X)){y.push({timeUnit:X,field:L,as:pe});let xe=ma(A)&&A.type!==rs&&"time";xe&&(C===Pl||C===Jr?ge.formatType=xe:(function(me){return!!Ri[me]})(C)?ge.legend={formatType:xe,...ge.legend}:un(C)&&(ge.axis={formatType:xe,...ge.axis}))}x[C]=ge}else d.push(L),x[C]=s[C]}else x[C]=s[C]})),{bins:h,timeUnits:y,aggregate:w,groupby:d,encoding:x}}function _f(s,l,d){let h=Sh(l,d);if(!h)return!1;if(h==="binned"){let y=s[l===Xr?Qt:Bn];return!!(ze(y)&&ze(s[l])&&zn(y.bin))}return!0}function oi(s,l){let d={};for(let h of be(s)){let y=am(s[h],h,l,{compositeMark:!0});d[h]=y}return d}function bc(s,l,d){if(s)for(let h of be(s)){let y=s[h];if(b.isArray(y))for(let w of y)l.call(d,w,h);else l.call(d,y,h)}}function im(s,l){return be(l).reduce(((d,h)=>{switch(h){case Qt:case Bn:case st:case Md:case $l:case Xr:case ki:case mn:case Zo:case ar:case co:case mt:case Un:case nt:case $a:case da:case rr:case Pl:case Sn:case Ba:case Jr:return d;case Bs:if(s==="line"||s==="trail")return d;case po:case Ku:{let y=l[h];if(b.isArray(y)||ze(y))for(let w of b.array(y))w.aggregate||d.push(je(w,{}));return d}case Si:if(s==="trail")return d;case Fe:case Sa:case Zr:case xi:case Ft:case Ai:case Jo:case fo:{let y=dr(l[h]);return y&&!y.aggregate&&d.push(je(y,{})),d}}}),[])}function lu(s,l,d){let h=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3];return"tooltip"in d?{tooltip:d.tooltip}:{tooltip:[...s.map((y=>{let{fieldPrefix:w,titlePrefix:x}=y,A=h?` of ${yc(l)}`:"";return{field:w+l.field,type:l.type,title:Ze(x)?{signal:`${x}"${escape(A)}"`}:x+A}})),..._e((function(y){let w=[];for(let x of be(y))if(Ui(y,x)){let A=y[x],C=b.array(A);for(let L of C)ze(L)?w.push(L):mf(L)&&w.push(L.condition)}return w})(d).map(sy),ne)]}}function yc(s){let{title:l,field:d}=s;return Ke(l,d)}function kf(s,l,d,h,y){let{scale:w,axis:x}=d;return A=>{let{partName:C,mark:L,positionPrefix:G,endPositionPrefix:H,extraEncoding:X={}}=A,J=yc(d);return Sf(s,C,y,{mark:L,encoding:{[l]:{field:`${G}_${d.field}`,type:d.type,...J!==void 0?{title:J}:{},...w!==void 0?{scale:w}:{},...x!==void 0?{axis:x}:{}},...b.isString(H)?{[`${l}2`]:{field:`${H}_${d.field}`}}:{},...h,...X}})}}function Sf(s,l,d,h){let{clip:y,color:w,opacity:x}=s,A=s.type;return s[l]||s[l]===void 0&&d[l]?[{...h,mark:{...d[l],...y?{clip:y}:{},...w?{color:w}:{},...x?{opacity:x}:{},...Li(h.mark)?h.mark:{type:h.mark},style:`${A}-${String(l)}`,...b.isBoolean(s[l])?{}:s[l]}}]:[]}function fy(s,l,d){let{encoding:h}=s,y=l==="vertical"?"y":"x",w=h[y],x=h[`${y}2`],A=h[`${y}Error`],C=h[`${y}Error2`];return{continuousAxisChannelDef:vc(w,d),continuousAxisChannelDef2:vc(x,d),continuousAxisChannelDefError:vc(A,d),continuousAxisChannelDefError2:vc(C,d),continuousAxis:y}}function vc(s,l){if(s!=null&&s.aggregate){let{aggregate:d,...h}=s;return d!==l&&Be((function(y,w){return`Continuous axis should not have customized aggregation function ${y}; ${w} already agregates the axis.`})(d,l)),h}return s}function el(s,l){let{mark:d,encoding:h}=s,{x:y,y:w}=h;if(Li(d)&&d.orient)return d.orient;if(os(y)){if(os(w)){let x=ze(y)&&y.aggregate,A=ze(w)&&w.aggregate;if(x||A!==l){if(A||x!==l){if(x===l&&A===l)throw new Error("Both x and y cannot have aggregate");return It(w)&&!It(y)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(os(w))return"vertical";throw new Error(`Need a valid continuous axis for ${l}s`)}let cs="boxplot",Se=new wf(cs,om);function tl(s){return b.isNumber(s)?"tukey":s}function om(s,l){let{config:d}=l;s={...s,encoding:oi(s.encoding,d)};let{mark:h,encoding:y,params:w,projection:x,...A}=s,C=Li(h)?h:{type:h};w&&Be(ja("boxplot"));let L=C.extent??d.boxplot.extent,G=Ht("size",C,d),H=C.invalid,X=tl(L),{bins:J,timeUnits:le,transform:te,continuousAxisChannelDef:pe,continuousAxis:ge,groupby:xe,aggregate:me,encodingWithoutContinuousAxis:Ae,ticksOrient:Re,boxOrient:Pe,customTooltipWithoutAggregatedField:We}=(function(sd,Yg,Mo){let Tu=el(sd,cs),{continuousAxisChannelDef:Kg,continuousAxis:Xg}=fy(sd,Tu,cs),_n=Kg.field,As=tl(Yg),ld=[...sm(_n),{op:"median",field:_n,as:`mid_box_${_n}`},{op:"min",field:_n,as:(As==="min-max"?"lower_whisker_":"min_")+_n},{op:"max",field:_n,as:(As==="min-max"?"upper_whisker_":"max_")+_n}],Ip=As==="min-max"||As==="tukey"?[]:[{calculate:`datum["upper_box_${_n}"] - datum["lower_box_${_n}"]`,as:`iqr_${_n}`},{calculate:`min(datum["upper_box_${_n}"] + datum["iqr_${_n}"] * ${Yg}, datum["max_${_n}"])`,as:`upper_whisker_${_n}`},{calculate:`max(datum["lower_box_${_n}"] - datum["iqr_${_n}"] * ${Yg}, datum["min_${_n}"])`,as:`lower_whisker_${_n}`}],{[Xg]:XA,...w1}=sd.encoding,{customTooltipWithoutAggregatedField:_1,filteredEncoding:k1}=(function(In){let{tooltip:Lo,...vl}=In;if(!Lo)return{filteredEncoding:vl};let El,no;if(b.isArray(Lo)){for(let wl of Lo)wl.aggregate?(El||(El=[]),El.push(wl)):(no||(no=[]),no.push(wl));El&&(vl.tooltip=El)}else Lo.aggregate?vl.tooltip=Lo:no=Lo;return b.isArray(no)&&no.length===1&&(no=no[0]),{customTooltipWithoutAggregatedField:no,filteredEncoding:vl}})(w1),{bins:wv,timeUnits:_v,aggregate:kv,groupby:Op,encoding:Cu}=dy(k1,Mo),Sv=Tu==="vertical"?"horizontal":"vertical",xv=Tu,Zg=[...wv,..._v,{aggregate:[...kv,...ld],groupby:Op},...Ip];return{bins:wv,timeUnits:_v,transform:Zg,groupby:Op,aggregate:kv,continuousAxisChannelDef:Kg,continuousAxis:Xg,encodingWithoutContinuousAxis:Cu,ticksOrient:Sv,boxOrient:xv,customTooltipWithoutAggregatedField:_1}})(s,L,d),{color:Je,size:it,...Qe}=Ae,lt=sd=>kf(C,ge,pe,sd,d.boxplot),kt=lt(Qe),Fn=lt(Ae),dn=lt({...Qe,...it?{size:it}:{}}),sn=lu([{fieldPrefix:X==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:X==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],pe,Ae),Ut={type:"tick",color:"black",opacity:1,orient:Re,invalid:H,aria:!1},Dt=X==="min-max"?sn:lu([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],pe,Ae),En=[...kt({partName:"rule",mark:{type:"rule",invalid:H,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:Dt}),...kt({partName:"rule",mark:{type:"rule",invalid:H,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:Dt}),...kt({partName:"ticks",mark:Ut,positionPrefix:"lower_whisker",extraEncoding:Dt}),...kt({partName:"ticks",mark:Ut,positionPrefix:"upper_whisker",extraEncoding:Dt})],Nn=[...X!=="tukey"?En:[],...Fn({partName:"box",mark:{type:"bar",...G?{size:G}:{},orient:Pe,invalid:H,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:sn}),...dn({partName:"median",mark:{type:"tick",invalid:H,...b.isObject(d.boxplot.median)&&d.boxplot.median.color?{color:d.boxplot.median.color}:{},...G?{size:G}:{},orient:Re,aria:!1},positionPrefix:"mid_box",extraEncoding:sn})];if(X==="min-max")return{...A,transform:(A.transform??[]).concat(te),layer:Nn};let fn=`datum["lower_box_${pe.field}"]`,Oa=`datum["upper_box_${pe.field}"]`,Da=`(${Oa} - ${fn})`,Br=`${fn} - ${L} * ${Da}`,Xn=`${Oa} + ${L} * ${Da}`,ga=`datum["${pe.field}"]`,ln={joinaggregate:sm(pe.field),groupby:xe},At={transform:[{filter:`(${Br} <= ${ga}) && (${ga} <= ${Xn})`},{aggregate:[{op:"min",field:pe.field,as:`lower_whisker_${pe.field}`},{op:"max",field:pe.field,as:`upper_whisker_${pe.field}`},{op:"min",field:`lower_box_${pe.field}`,as:`lower_box_${pe.field}`},{op:"max",field:`upper_box_${pe.field}`,as:`upper_box_${pe.field}`},...me],groupby:xe}],layer:En},{tooltip:wn,...mi}=Qe,{scale:gi,axis:xs}=pe,Xa=yc(pe),mr=ee(xs,["title"]),ba=Sf(C,"outliers",d.boxplot,{transform:[{filter:`(${ga} < ${Br}) || (${ga} > ${Xn})`}],mark:"point",encoding:{[ge]:{field:pe.field,type:pe.type,...Xa!==void 0?{title:Xa}:{},...gi!==void 0?{scale:gi}:{},...ye(mr)?{}:{axis:mr}},...mi,...Je?{color:Je}:{},...We?{tooltip:We}:{}}})[0],bi,Do=[...J,...le,ln];return ba?bi={transform:Do,layer:[ba,At]}:(bi=At,bi.transform.unshift(...Do)),{...A,layer:[bi,{transform:te,layer:Nn}]}}function sm(s){return[{op:"q1",field:s,as:`lower_box_${s}`},{op:"q3",field:s,as:`upper_box_${s}`}]}let xf="errorbar",lm=new wf(xf,Af);function Af(s,l){let{config:d}=l;s={...s,encoding:oi(s.encoding,d)};let{transform:h,continuousAxisChannelDef:y,continuousAxis:w,encodingWithoutContinuousAxis:x,ticksOrient:A,markDef:C,outerSpec:L,tooltipEncoding:G}=cm(s,xf,d);delete x.size;let H=kf(C,w,y,x,d.errorbar),X=C.thickness,J=C.size,le={type:"tick",orient:A,aria:!1,...X!==void 0?{thickness:X}:{},...J!==void 0?{size:J}:{}},te=[...H({partName:"ticks",mark:le,positionPrefix:"lower",extraEncoding:G}),...H({partName:"ticks",mark:le,positionPrefix:"upper",extraEncoding:G}),...H({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...X!==void 0?{size:X}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:G})];return{...L,transform:h,...te.length>1?{layer:te}:{...te[0]}}}function um(s,l){let{encoding:d}=s;if((function(A){return(_t(A.x)||_t(A.y))&&!_t(A.x2)&&!_t(A.y2)&&!_t(A.xError)&&!_t(A.xError2)&&!_t(A.yError)&&!_t(A.yError2)})(d))return{orient:el(s,l),inputType:"raw"};let h=(function(A){return _t(A.x2)||_t(A.y2)})(d),y=(function(A){return _t(A.xError)||_t(A.xError2)||_t(A.yError)||_t(A.yError2)})(d),w=d.x,x=d.y;if(h){if(y)throw new Error(`${l} cannot be both type aggregated-upper-lower and aggregated-error`);let A=d.x2,C=d.y2;if(_t(A)&&_t(C))throw new Error(`${l} cannot have both x2 and y2`);if(_t(A)){if(os(w))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${l}`)}if(_t(C)){if(os(x))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${l}`)}throw new Error("No ranged axis")}{let A=d.xError,C=d.xError2,L=d.yError,G=d.yError2;if(_t(C)&&!_t(A))throw new Error(`${l} cannot have xError2 without xError`);if(_t(G)&&!_t(L))throw new Error(`${l} cannot have yError2 without yError`);if(_t(A)&&_t(L))throw new Error(`${l} cannot have both xError and yError with both are quantiative`);if(_t(A)){if(os(w))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(_t(L)){if(os(x))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 cm(s,l,d){let{mark:h,encoding:y,params:w,projection:x,...A}=s,C=Li(h)?h:{type:h};w&&Be(ja(l));let{orient:L,inputType:G}=um(s,l),{continuousAxisChannelDef:H,continuousAxisChannelDef2:X,continuousAxisChannelDefError:J,continuousAxisChannelDefError2:le,continuousAxis:te}=fy(s,L,l),{errorBarSpecificAggregate:pe,postAggregateCalculates:ge,tooltipSummary:xe,tooltipTitleWithFieldName:me}=(function(Dt,En,Nn,fn,Oa,Da,Br,Xn){let ga=[],ln=[],At=En.field,wn,mi=!1;if(Da==="raw"){let Xa=Dt.center?Dt.center:Dt.extent?Dt.extent==="iqr"?"median":"mean":Xn.errorbar.center,mr=Dt.extent?Dt.extent:Xa==="mean"?"stderr":"iqr";if(Xa==="median"!=(mr==="iqr")&&Be((function(ba,bi,Do){return`${ba} is not usually used with ${bi} for ${Do}.`})(Xa,mr,Br)),mr==="stderr"||mr==="stdev")ga=[{op:mr,field:At,as:`extent_${At}`},{op:Xa,field:At,as:`center_${At}`}],ln=[{calculate:`datum["center_${At}"] + datum["extent_${At}"]`,as:`upper_${At}`},{calculate:`datum["center_${At}"] - datum["extent_${At}"]`,as:`lower_${At}`}],wn=[{fieldPrefix:"center_",titlePrefix:yt(Xa)},{fieldPrefix:"upper_",titlePrefix:dm(Xa,mr,"+")},{fieldPrefix:"lower_",titlePrefix:dm(Xa,mr,"-")}],mi=!0;else{let ba,bi,Do;mr==="ci"?(ba="mean",bi="ci0",Do="ci1"):(ba="median",bi="q1",Do="q3"),ga=[{op:bi,field:At,as:`lower_${At}`},{op:Do,field:At,as:`upper_${At}`},{op:ba,field:At,as:`center_${At}`}],wn=[{fieldPrefix:"upper_",titlePrefix:ss({field:At,aggregate:Do,type:"quantitative"},Xn,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:ss({field:At,aggregate:bi,type:"quantitative"},Xn,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:ss({field:At,aggregate:ba,type:"quantitative"},Xn,{allowDisabling:!1})}]}}else{(Dt.center||Dt.extent)&&Be((gi=Dt.center,`${(xs=Dt.extent)?"extent ":""}${xs&&gi?"and ":""}${gi?"center ":""}${xs&&gi?"are ":"is "}not needed when data are aggregated.`)),Da==="aggregated-upper-lower"?(wn=[],ln=[{calculate:`datum["${Nn.field}"]`,as:`upper_${At}`},{calculate:`datum["${At}"]`,as:`lower_${At}`}]):Da==="aggregated-error"&&(wn=[{fieldPrefix:"",titlePrefix:At}],ln=[{calculate:`datum["${At}"] + datum["${fn.field}"]`,as:`upper_${At}`}],Oa?ln.push({calculate:`datum["${At}"] + datum["${Oa.field}"]`,as:`lower_${At}`}):ln.push({calculate:`datum["${At}"] - datum["${fn.field}"]`,as:`lower_${At}`}));for(let Xa of ln)wn.push({fieldPrefix:Xa.as.substring(0,6),titlePrefix:St(St(Xa.calculate,'datum["',""),'"]',"")})}var gi,xs;return{postAggregateCalculates:ln,errorBarSpecificAggregate:ga,tooltipSummary:wn,tooltipTitleWithFieldName:mi}})(C,H,X,J,le,G,l,d),{[te]:Ae,[te==="x"?"x2":"y2"]:Re,[te==="x"?"xError":"yError"]:Pe,[te==="x"?"xError2":"yError2"]:We,...Je}=y,{bins:it,timeUnits:Qe,aggregate:lt,groupby:kt,encoding:Fn}=dy(Je,d),dn=[...lt,...pe],sn=G!=="raw"?[]:kt,Ut=lu(xe,H,Fn,me);return{transform:[...A.transform??[],...it,...Qe,...dn.length===0?[]:[{aggregate:dn,groupby:sn}],...ge],groupby:sn,continuousAxisChannelDef:H,continuousAxis:te,encodingWithoutContinuousAxis:Fn,ticksOrient:L==="vertical"?"horizontal":"vertical",markDef:C,outerSpec:A,tooltipEncoding:Ut}}function dm(s,l,d){return`${yt(s)} ${d} ${l}`}let Tf="errorband",py=new wf(Tf,hy);function hy(s,l){let{config:d}=l;s={...s,encoding:oi(s.encoding,d)};let{transform:h,continuousAxisChannelDef:y,continuousAxis:w,encodingWithoutContinuousAxis:x,markDef:A,outerSpec:C,tooltipEncoding:L}=cm(s,Tf,d),G=A,H=kf(G,w,y,x,d.errorband),X=s.encoding.x!==void 0&&s.encoding.y!==void 0,J={type:X?"area":"rect"},le={type:X?"line":"rule"},te={...G.interpolate?{interpolate:G.interpolate}:{},...G.tension&&G.interpolate?{tension:G.tension}:{}};return X?(J={...J,...te,ariaRoleDescription:"errorband"},le={...le,...te,aria:!1}):G.interpolate?Be(Wd("interpolate")):G.tension&&Be(Wd("tension")),{...C,transform:h,layer:[...H({partName:"band",mark:J,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:L}),...H({partName:"borders",mark:le,positionPrefix:"lower",extraEncoding:L}),...H({partName:"borders",mark:le,positionPrefix:"upper",extraEncoding:L})]}}let uu={};function cu(s,l,d){let h=new wf(s,l);uu[s]={normalizer:h,parts:d}}cu(cs,om,["box","median","outliers","rule","ticks"]),cu(xf,Af,["ticks","rule"]),cu(Tf,hy,["band","borders"]);let fm=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],Ec={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"},wc={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"},pm=be(Ec),hm=be(wc),Cf=be({header:1,headerRow:1,headerColumn:1,headerFacet:1}),Rf=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],fr="_vgsid_",mm={point:{on:"click",fields:[fr],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Nf(s){return s==="legend"||!!(s!=null&&s.legend)}function If(s){return Nf(s)&&b.isObject(s)}function _c(s){return!!(s!=null&&s.select)}function Of(s){let l=[];for(let d of s||[]){if(_c(d))continue;let{expr:h,bind:y,...w}=d;if(y&&h){let x={...w,bind:y,init:h};l.push(x)}else{let x={...w,...h?{update:h}:{},...y?{bind:y}:{}};l.push(x)}}return l}function kc(s){return"concat"in s}function du(s){return"vconcat"in s}function Df(s){return"hconcat"in s}function Mf(s){let{step:l,offsetIsDiscrete:d}=s;return d?l.for??"offset":"position"}function qa(s){return b.isObject(s)&&s.step!==void 0}function Sc(s){return s.view||s.width||s.height}let xc=be({align:1,bounds:1,center:1,columns:1,spacing:1});function ds(s,l){return s[l]??s[l==="width"?"continuousWidth":"continuousHeight"]}function fu(s,l){let d=Ac(s,l);return qa(d)?d.step:gm}function Ac(s,l){return Ke(s[l]??s[l==="width"?"discreteWidth":"discreteHeight"],{step:s.step})}let gm=20,my={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:gm},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:q_,circle:{},geoshape:{},image:{},line:{},point:{},rect:ey,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,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:mm,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},si=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],bm={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},gy={blue:si[0],orange:si[1],red:si[2],teal:si[3],green:si[4],yellow:si[5],purple:si[6],pink:si[7],brown:si[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 ym(s){let l=be(s||{}),d={};for(let h of l){let y=s[h];d[h]=su(y)?T0(y):Gn(y)}return d}let by=[...jh,...Yt,...Cf,"background","padding","legend","lineBreak","scale","style","title","view"];function vm(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{color:l,font:d,fontSize:h,selection:y,...w}=s,x=b.mergeConfig({},j(my),d?(function(C){return{text:{font:C},style:{"guide-label":{font:C},"guide-title":{font:C},"group-title":{font:C},"group-subtitle":{font:C}}}})(d):{},l?(function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{signals:[{name:"color",value:b.isObject(C)?{...gy,...C}:gy}],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"}]}}})(l):{},h?(function(C){return{signals:[{name:"fontSize",value:b.isObject(C)?{...bm,...C}:bm}],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"}}}}})(h):{},w||{});y&&b.writeConfig(x,"selection",y,!0);let A=ee(x,by);for(let C of["background","lineBreak","padding"])x[C]&&(A[C]=Gn(x[C]));for(let C of jh)x[C]&&(A[C]=ea(x[C]));for(let C of Yt)x[C]&&(A[C]=ym(x[C]));for(let C of Cf)x[C]&&(A[C]=ea(x[C]));return x.legend&&(A.legend=ea(x.legend)),x.scale&&(A.scale=ea(x.scale)),x.style&&(A.style=(function(C){let L=be(C),G={};for(let H of L)G[H]=ym(C[H]);return G})(x.style)),x.title&&(A.title=ea(x.title)),x.view&&(A.view=ea(x.view)),A}let K_=new Set(["view",...G_]),X_=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Z_={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],line:["point"],tick:["bandSize","thickness"]};function Lf(s){s=j(s);for(let l of X_)delete s[l];if(s.axis)for(let l in s.axis)su(s.axis[l])&&delete s.axis[l];if(s.legend)for(let l of fm)delete s.legend[l];if(s.mark){for(let l of Q0)delete s.mark[l];s.mark.tooltip&&b.isObject(s.mark.tooltip)&&delete s.mark.tooltip}s.params&&(s.signals=(s.signals||[]).concat(Of(s.params)),delete s.params);for(let l of K_){for(let h of Q0)delete s[l][h];let d=Z_[l];if(d)for(let h of d)delete s[l][h];J_(s,l)}for(let l of be(uu))delete s[l];(function(l){let{titleMarkConfig:d,subtitleMarkConfig:h,subtitle:y}=ac(l.title);ye(d)||(l.style["group-title"]={...l.style["group-title"],...d}),ye(h)||(l.style["group-subtitle"]={...l.style["group-subtitle"],...h}),ye(y)?delete l.title:l.title=y})(s);for(let l in s)b.isObject(s[l])&&ye(s[l])&&delete s[l];return ye(s)?void 0:s}function J_(s,l,d,h){l==="view"&&(d="cell");let y={...h?s[l][h]:s[l],...s.style[d??l]};ye(y)||(s.style[d??l]=y),h||delete s[l]}function pu(s){return"layer"in s}class Ff{map(l,d){return pc(l)?this.mapFacet(l,d):(function(h){return"repeat"in h})(l)?this.mapRepeat(l,d):Df(l)?this.mapHConcat(l,d):du(l)?this.mapVConcat(l,d):kc(l)?this.mapConcat(l,d):this.mapLayerOrUnit(l,d)}mapLayerOrUnit(l,d){if(pu(l))return this.mapLayer(l,d);if(Bi(l))return this.mapUnit(l,d);throw new Error(Th(l))}mapLayer(l,d){return{...l,layer:l.layer.map((h=>this.mapLayerOrUnit(h,d)))}}mapHConcat(l,d){return{...l,hconcat:l.hconcat.map((h=>this.map(h,d)))}}mapVConcat(l,d){return{...l,vconcat:l.vconcat.map((h=>this.map(h,d)))}}mapConcat(l,d){let{concat:h,...y}=l;return{...y,concat:h.map((w=>this.map(w,d)))}}mapFacet(l,d){return{...l,spec:this.map(l.spec,d)}}mapRepeat(l,d){return{...l,spec:this.map(l.spec,d)}}}let Em={zero:1,center:1,normalize:1},Q_=new Set([Uh,rf,af,sf,of,lf,Gh,uc,Z0,zh]),Tc=new Set([rf,af,Uh]);function zi(s){return ze(s)&&tu(s)==="quantitative"&&!s.bin}function wm(s,l,d){let{orient:h,type:y}=d,w=l==="x"?"y":"radius",x=l==="x",A=s[l],C=s[w];if(ze(A)&&ze(C))if(zi(A)&&zi(C)){if(A.stack)return l;if(C.stack)return w;let L=ze(A)&&!!A.aggregate;if(L!==(ze(C)&&!!C.aggregate))return L?l:w;if(x&&["bar","area"].includes(y)){if(h==="vertical")return w;if(h==="horizontal")return l}}else{if(zi(A))return l;if(zi(C))return w}else{if(zi(A))return l;if(zi(C))return w}}function _m(s,l){var pe,ge;let d=Li(s)?s:{type:s},h=d.type;if(!Q_.has(h))return null;let y=wm(l,"x",d)||wm(l,"theta",d);if(!y)return null;let w=l[y],x=ze(w)?je(w,{}):void 0,A=(function(xe){switch(xe){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}})(y),C=[],L=new Set;if(l[A]){let xe=l[A],me=ze(xe)?je(xe,{}):void 0;me&&me!==x&&(C.push(A),L.add(me))}let G=A==="x"?"xOffset":"yOffset",H=l[G],X=ze(H)?je(H,{}):void 0;X&&X!==x&&(C.push(G),L.add(X));let J=zs.reduce(((xe,me)=>{if(me!=="tooltip"&&Ui(l,me)){let Ae=l[me];for(let Re of b.array(Ae)){let Pe=dr(Re);if(Pe.aggregate)continue;let We=je(Pe,{});We&&L.has(We)||xe.push({channel:me,fieldDef:Pe})}}return xe}),[]),le;return w.stack!==void 0?le=b.isBoolean(w.stack)?w.stack?"zero":null:w.stack:Tc.has(h)&&(le="zero"),le&&le in Em?rm(l)&&J.length===0?null:(pe=w==null?void 0:w.scale)!=null&&pe.type&&((ge=w==null?void 0:w.scale)==null?void 0:ge.type)!==Gt.LINEAR?(w!=null&&w.stack&&Be((function(xe){return`Cannot stack non-linear scale (${xe}).`})(w.scale.type)),null):_t(l[Ci(y)])?(w.stack!==void 0&&Be(`Cannot stack "${te=y}" if there is already "${te}2".`),null):(ze(w)&&w.aggregate&&!Ir.has(w.aggregate)&&Be(`Stacking is applied even though the aggregate function is non-summative ("${w.aggregate}").`),{groupbyChannels:C,groupbyFields:L,fieldChannel:y,impute:w.impute!==null&&is(h),stackBy:J,offset:le}):null;var te}function yy(s,l,d){let h=ea(s),y=Ht("orient",h,d);if(h.orient=(function(w,x,A){switch(w){case of:case lf:case Gh:case Z0:case U_:case B_:return}let{x:C,y:L,x2:G,y2:H}=x;switch(w){case rf:if(ze(C)&&(zn(C.bin)||ze(L)&&L.aggregate&&!C.aggregate))return"vertical";if(ze(L)&&(zn(L.bin)||ze(C)&&C.aggregate&&!L.aggregate))return"horizontal";if(H||G){if(A)return A;if(!G)return(ze(C)&&C.type===bo&&!Vt(C.bin)||gf(C))&&ze(L)&&zn(L.bin)?"horizontal":"vertical";if(!H)return(ze(L)&&L.type===bo&&!Vt(L.bin)||gf(L))&&ze(C)&&zn(C.bin)?"vertical":"horizontal"}case sf:if(G&&(!ze(C)||!zn(C.bin))&&H&&(!ze(L)||!zn(L.bin)))return;case af:if(H)return ze(L)&&zn(L.bin)?"horizontal":"vertical";if(G)return ze(C)&&zn(C.bin)?"vertical":"horizontal";if(w===sf){if(C&&!L)return"vertical";if(L&&!C)return"horizontal"}case uc:case zh:{let X=oy(C),J=oy(L);if(A)return A;if(X&&!J)return w!=="tick"?"horizontal":"vertical";if(!X&&J)return w!=="tick"?"vertical":"horizontal";if(X&&J)return"vertical";{let le=ma(C)&&C.type===rs,te=ma(L)&&L.type===rs;if(le&&!te)return"vertical";if(!le&&te)return"horizontal"}return}}return"vertical"})(h.type,l,y),y!==void 0&&y!==h.orient&&Be(`Specified orient "${h.orient}" overridden with "${y}".`),h.type==="bar"&&h.orient){let w=Ht("cornerRadiusEnd",h,d);if(w!==void 0){let x=h.orient==="horizontal"&&l.x2||h.orient==="vertical"&&l.y2?["cornerRadius"]:H_[h.orient];for(let A of x)h[A]=w;h.cornerRadiusEnd!==void 0&&delete h.cornerRadiusEnd}}return Ht("opacity",h,d)===void 0&&(h.opacity=(function(w,x){if(Z([of,zh,lf,Gh],w)&&!rm(x))return .7})(h.type,l)),Ht("cursor",h,d)===void 0&&(h.cursor=(function(w,x,A){return x.href||w.href||Ht("href",w,A)?"pointer":w.cursor})(h,l,d)),h}function e1(s){let{point:l,line:d,...h}=s;return be(h).length>1?h:h.type}function t1(s){for(let l of["line","area","rule","trail"])s[l]&&(s={...s,[l]:ee(s[l],["point","line"])});return s}function km(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=arguments.length>2?arguments[2]:void 0;return s.point==="transparent"?{opacity:0}:s.point?b.isObject(s.point)?s.point:{}:s.point!==void 0?null:l.point||d.shape?b.isObject(l.point)?l.point:{}:void 0}function Sm(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s.line?s.line===!0?{}:s.line:s.line!==void 0?null:l.line?l.line===!0?{}:l.line:void 0}class xm{constructor(){at(this,"name","path-overlay")}hasMatchingType(l,d){if(Bi(l)){let{mark:h,encoding:y}=l,w=Li(h)?h:{type:h};switch(w.type){case"line":case"rule":case"trail":return!!km(w,d[w.type],y);case"area":return!!km(w,d[w.type],y)||!!Sm(w,d[w.type])}}return!1}run(l,d,h){let{config:y}=d,{params:w,projection:x,mark:A,name:C,encoding:L,...G}=l,H=oi(L,y),X=Li(A)?A:{type:A},J=km(X,y[X.type],H),le=X.type==="area"&&Sm(X,y[X.type]),te=[{name:C,...w?{params:w}:{},mark:e1({...X.type==="area"&&X.opacity===void 0&&X.fillOpacity===void 0?{opacity:.7}:{},...X}),encoding:ee(H,["shape"])}],pe=_m(yy(X,H,y),H),ge=H;if(pe){let{fieldChannel:xe,offset:me}=pe;ge={...H,[xe]:{...H[xe],...me?{stack:me}:{}}}}return ge=ee(ge,["y2","x2"]),le&&te.push({...x?{projection:x}:{},mark:{type:"line",...V(X,["clip","interpolate","tension","tooltip"]),...le},encoding:ge}),J&&te.push({...x?{projection:x}:{},mark:{type:"point",opacity:1,filled:!0,...V(X,["clip","tooltip"]),...J},encoding:ge}),h({...G,layer:te},{...d,config:t1(y)})}}function ra(s,l){return l?Ql(s)?vy(s,l):Am(s,l):s}function Gi(s,l){return l?vy(s,l):s}function Cc(s,l,d){let h=l[s];return(y=h)&&!b.isString(y)&&"repeat"in y?h.repeat in d?{...l,[s]:d[h.repeat]}:void Be((function(w){return`Unknown repeated value "${w}".`})(h.repeat)):l;var y}function Am(s,l){if((s=Cc("field",s,l))!==void 0){if(s===null)return null;if(Zs(s)&&ii(s.sort)){let d=Cc("field",s.sort,l);s={...s,...d?{sort:d}:{}}}return s}}function Pf(s,l){if(ze(s))return Am(s,l);{let d=Cc("datum",s,l);return d===s||d.type||(d.type="nominal"),d}}function Tm(s,l){if(!_t(s)){if(eu(s)){let d=Pf(s.condition,l);if(d)return{...s,condition:d};{let{condition:h,...y}=s;return y}}return s}{let d=Pf(s,l);if(d)return d;if(hf(s))return{condition:s.condition}}}function vy(s,l){let d={};for(let h in s)if(b.hasOwnProperty(s,h)){let y=s[h];if(b.isArray(y))d[h]=y.map((w=>Tm(w,l))).filter((w=>w));else{let w=Tm(y,l);w!==void 0&&(d[h]=w)}}return d}class Cm{constructor(){at(this,"name","RuleForRangedLine")}hasMatchingType(l){if(Bi(l)){let{encoding:d,mark:h}=l;if(h==="line"||Li(h)&&h.type==="line")for(let y of y_){let w=d[Us(y)];if(d[y]&&(ze(w)&&!zn(w.bin)||Pi(w)))return!0}}return!1}run(l,d,h){let{encoding:y,mark:w}=l;var x,A;return Be((x=!!y.x2,A=!!y.y2,`Line mark is for continuous lines and thus cannot be used with ${x&&A?"x2 and y2":x?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),h({...l,mark:b.isObject(w)?{...w,type:"rule"}:"rule"},d)}}function $f(s){let{parentEncoding:l,encoding:d={},layer:h}=s,y={};if(l){let w=new Set([...be(l),...be(d)]);for(let x of w){let A=d[x],C=l[x];if(_t(A)){let L={...C,...A};y[x]=L}else eu(A)?y[x]={...A,condition:{...C,...A.condition}}:A||A===null?y[x]=A:(h||cr(C)||Ze(C)||_t(C)||b.isArray(C))&&(y[x]=C)}}else y=d;return!y||ye(y)?void 0:y}function Rm(s){let{parentProjection:l,projection:d}=s;return l&&d&&Be((function(h){let{parentProjection:y,projection:w}=h;return`Layer's shared projection ${Xe(y)} is overridden by a child projection ${Xe(w)}.`})({parentProjection:l,projection:d})),d??l}function Nm(s){return"filter"in s}function Im(s){return"lookup"in s}function n1(s){return"pivot"in s}function Ey(s){return"density"in s}function Om(s){return"quantile"in s}function wy(s){return"regression"in s}function a1(s){return"loess"in s}function _y(s){return"sample"in s}function Dm(s){return"window"in s}function Mm(s){return"joinaggregate"in s}function ky(s){return"flatten"in s}function r1(s){return"calculate"in s}function Bf(s){return"bin"in s}function Lm(s){return"impute"in s}function Uf(s){return"timeUnit"in s}function Sy(s){return"aggregate"in s}function i1(s){return"stack"in s}function Fm(s){return"fold"in s}function Pm(s){return"extent"in s&&!("density"in s)}function zf(s,l){let{transform:d,...h}=s;return d?{...h,transform:d.map((y=>{if(Nm(y))return{filter:hu(y,l)};if(Bf(y)&&mo(y.bin))return{...y,bin:$m(y.bin)};if(Im(y)){let{selection:w,...x}=y.from;return w?{...y,from:{param:w,...x}}:y}return y}))}:s}function Gf(s,l){var h,y;let d=j(s);if(ze(d)&&mo(d.bin)&&(d.bin=$m(d.bin)),$i(d)&&((y=(h=d.scale)==null?void 0:h.domain)==null?void 0:y.selection)){let{selection:w,...x}=d.scale.domain;d.scale.domain={...x,...w?{param:w}:{}}}if(hf(d))if(b.isArray(d.condition))d.condition=d.condition.map((w=>{let{selection:x,param:A,test:C,...L}=w;return A?w:{...L,test:hu(w,l)}}));else{let{selection:w,param:x,test:A,...C}=Gf(d.condition,l);d.condition=x?d.condition:{...C,test:hu(d.condition,l)}}return d}function $m(s){let l=s.extent;if(l!=null&&l.selection){let{selection:d,...h}=l;return{...s,extent:{...h,param:d}}}return s}function hu(s,l){let d=h=>F(h,(y=>{let w={param:y,empty:l.emptySelections[y]??!0};return l.selectionPredicates[y]??=[],l.selectionPredicates[y].push(w),w}));return s.selection?d(s.selection):F(s.test||s.filter,(h=>h.selection?d(h.selection):h))}class Bm extends Ff{map(l,d){let h=d.selections??[];if(l.params&&!Bi(l)){let y=[];for(let w of l.params)_c(w)?h.push(w):y.push(w);l.params=y}return d.selections=h,super.map(l,d)}mapUnit(l,d){let h=d.selections;if(!h||!h.length)return l;let y=(d.path??[]).concat(l.name),w=[];for(let x of h)if(x.views&&x.views.length)for(let A of x.views)(b.isString(A)&&(A===l.name||y.includes(A))||b.isArray(A)&&A.map((C=>y.indexOf(C))).every(((C,L,G)=>C!==-1&&(L===0||C>G[L-1]))))&&w.push(x);else w.push(x);return w.length&&(l.params=w),l}}for(let s of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){let l=Bm.prototype[s];Bm.prototype[s]=function(d,h){return l.call(this,d,Um(d,h))}}function Um(s,l){return s.name?{...l,path:(l.path??[]).concat(s.name)}:l}function jf(s,l){l===void 0&&(l=vm(s.config));let d=(function(x){let C={config:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}};return o1.map(zm.map(xy.map(x,C),C),C)})(s,l),{width:h,height:y}=s,w=(function(x,A,C){let{width:L,height:G}=A,H=Bi(x)||pu(x),X={};H?L=="container"&&G=="container"?(X.type="fit",X.contains="padding"):L=="container"?(X.type="fit-x",X.contains="padding"):G=="container"&&(X.type="fit-y",X.contains="padding"):(L=="container"&&(Be(Ta("width")),L=void 0),G=="container"&&(Be(Ta("height")),G=void 0));let J={type:"pad",...X,...C?Gm(C.autosize):{},...Gm(x.autosize)};if(J.type!=="fit"||H||(Be(ta),J.type="pad"),L=="container"&&J.type!="fit"&&J.type!="fit-x"&&Be(na("width")),G=="container"&&J.type!="fit"&&J.type!="fit-y"&&Be(na("height")),!Ie(J,{type:"pad"}))return J})(d,{width:h,height:y,autosize:s.autosize},l);return{...d,...w?{autosize:w}:{}}}let zm=new class extends Ff{constructor(){super(...arguments),at(this,"nonFacetUnitNormalizers",[Se,lm,py,new xm,new Cm])}map(s,l){if(Bi(s)){let d=Ui(s.encoding,tt),h=Ui(s.encoding,Kr),y=Ui(s.encoding,Fl);if(d||h||y)return this.mapFacetedUnit(s,l)}return super.map(s,l)}mapUnit(s,l){let{parentEncoding:d,parentProjection:h}=l,y=Gi(s.encoding,l.repeater),w={...s,...s.name?{name:[l.repeaterPrefix,s.name].filter((A=>A)).join("_")}:{},...y?{encoding:y}:{}};if(d||h)return this.mapUnitWithParentEncodingOrProjection(w,l);let x=this.mapLayerOrUnit.bind(this);for(let A of this.nonFacetUnitNormalizers)if(A.hasMatchingType(w,l.config))return A.run(w,l,x);return w}mapRepeat(s,l){return(function(d){return!b.isArray(d.repeat)&&d.repeat.layer})(s)?this.mapLayerRepeat(s,l):this.mapNonLayerRepeat(s,l)}mapLayerRepeat(s,l){let{repeat:d,spec:h,...y}=s,{row:w,column:x,layer:A}=d,{repeater:C={},repeaterPrefix:L=""}=l;return w||x?this.mapRepeat({...s,repeat:{...w?{row:w}:{},...x?{column:x}:{}},spec:{repeat:{layer:A},spec:h}},l):{...y,layer:A.map((G=>{let H={...C,layer:G},X=`${(h.name?`${h.name}_`:"")+L}child__layer_${$e(G)}`,J=this.mapLayerOrUnit(h,{...l,repeater:H,repeaterPrefix:X});return J.name=X,J}))}}mapNonLayerRepeat(s,l){let{repeat:d,spec:h,data:y,...w}=s;!b.isArray(d)&&s.columns&&(s=ee(s,["columns"]),Be(ur("repeat")));let x=[],{repeater:A={},repeaterPrefix:C=""}=l,L=!b.isArray(d)&&d.row||[A?A.row:null],G=!b.isArray(d)&&d.column||[A?A.column:null],H=b.isArray(d)&&d||[A?A.repeat:null];for(let J of H)for(let le of L)for(let te of G){let pe={repeat:J,row:le,column:te,layer:A.layer},ge=(h.name?`${h.name}_`:"")+C+"child__"+(b.isArray(d)?`${$e(J)}`:(d.row?`row_${$e(le)}`:"")+(d.column?`column_${$e(te)}`:"")),xe=this.map(h,{...l,repeater:pe,repeaterPrefix:ge});xe.name=ge,x.push(ee(xe,["data"]))}let X=b.isArray(d)?s.columns:d.column?d.column.length:1;return{data:h.data??y,align:"all",...w,columns:X,concat:x}}mapFacet(s,l){let{facet:d}=s;return Ql(d)&&s.columns&&(s=ee(s,["columns"]),Be(ur("facet"))),super.mapFacet(s,l)}mapUnitWithParentEncodingOrProjection(s,l){let{encoding:d,projection:h}=s,{parentEncoding:y,parentProjection:w,config:x}=l,A=Rm({parentProjection:w,projection:h}),C=$f({parentEncoding:y,encoding:Gi(d,l.repeater)});return this.mapUnit({...s,...A?{projection:A}:{},...C?{encoding:C}:{}},{config:x})}mapFacetedUnit(s,l){let{row:d,column:h,facet:y,...w}=s.encoding,{mark:x,width:A,projection:C,height:L,view:G,params:H,encoding:X,...J}=s,{facetMapping:le,layout:te}=this.getFacetMappingAndLayout({row:d,column:h,facet:y},l),pe=Gi(w,l.repeater);return this.mapFacet({...J,...te,facet:le,spec:{...A?{width:A}:{},...L?{height:L}:{},...G?{view:G}:{},...C?{projection:C}:{},mark:x,encoding:pe,...H?{params:H}:{}}},l)}getFacetMappingAndLayout(s,l){let{row:d,column:h,facet:y}=s;if(d||h){y&&Be(`Facet encoding dropped as ${(w=[...d?[tt]:[],...h?[Kr]:[]]).join(" and ")} ${w.length>1?"are":"is"} also specified.`);let x={},A={};for(let C of[tt,Kr]){let L=s[C];if(L){let{align:G,center:H,spacing:X,columns:J,...le}=L;x[C]=le;for(let te of["align","center","spacing"])L[te]!==void 0&&(A[te]??={},A[te][C]=L[te])}}return{facetMapping:x,layout:A}}{let{align:x,center:A,spacing:C,columns:L,...G}=y;return{facetMapping:ra(G,l.repeater),layout:{...x?{align:x}:{},...A?{center:A}:{},...C?{spacing:C}:{},...L?{columns:L}:{}}}}var w}mapLayer(s,l){let{parentEncoding:d,parentProjection:h,...y}=l,{encoding:w,projection:x,...A}=s,C={...y,parentEncoding:$f({parentEncoding:d,encoding:w,layer:!0}),parentProjection:Rm({parentProjection:h,projection:x})};return super.mapLayer({...A,...s.name?{name:[C.repeaterPrefix,s.name].filter((L=>L)).join("_")}:{}},C)}},xy=new class extends Ff{map(s,l){return l.emptySelections??={},l.selectionPredicates??={},s=zf(s,l),super.map(s,l)}mapLayerOrUnit(s,l){if((s=zf(s,l)).encoding){let d={};for(let[h,y]of ke(s.encoding))d[h]=Gf(y,l);s={...s,encoding:d}}return super.mapLayerOrUnit(s,l)}mapUnit(s,l){let{selection:d,...h}=s;return d?{...h,params:ke(d).map((y=>{let[w,x]=y,{init:A,bind:C,empty:L,...G}=x;G.type==="single"?(G.type="point",G.toggle=!1):G.type==="multi"&&(G.type="point"),l.emptySelections[w]=L!=="none";for(let H of Te(l.selectionPredicates[w]??{}))H.empty=L!=="none";return{name:w,value:A,select:G,bind:C}}))}:s}},o1=new Bm;function Gm(s){return b.isString(s)?{type:s}:s??{}}let jm=["background","padding"];function Hf(s,l){let d={};for(let h of jm)s&&s[h]!==void 0&&(d[h]=Gn(s[h]));return l&&(d.params=s.params),d}class ji{constructor(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.explicit=l,this.implicit=d}clone(){return new ji(j(this.explicit),j(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(l){return Ke(this.explicit[l],this.implicit[l])}getWithExplicit(l){return this.explicit[l]!==void 0?{explicit:!0,value:this.explicit[l]}:this.implicit[l]!==void 0?{explicit:!1,value:this.implicit[l]}:{explicit:!1,value:void 0}}setWithExplicit(l,d){let{value:h,explicit:y}=d;h!==void 0&&this.set(l,h,y)}set(l,d,h){return delete this[h?"implicit":"explicit"][l],this[h?"explicit":"implicit"][l]=d,this}copyKeyFromSplit(l,d){let{explicit:h,implicit:y}=d;h[l]!==void 0?this.set(l,h[l],!0):y[l]!==void 0&&this.set(l,y[l],!1)}copyKeyFromObject(l,d){d[l]!==void 0&&this.set(l,d[l],!0)}copyAll(l){for(let d of be(l.combine())){let h=l.getWithExplicit(d);this.setWithExplicit(d,h)}}}function Hi(s){return{explicit:!0,value:s}}function Fr(s){return{explicit:!1,value:s}}function Ay(s){return(l,d,h,y)=>{let w=s(l.value,d.value);return w>0?l:w<0?d:Rc(l,d,h,y)}}function Rc(s,l,d,h){return s.explicit&&l.explicit&&Be((function(y,w,x,A){return`Conflicting ${w.toString()} property "${y.toString()}" (${Xe(x)} and ${Xe(A)}). Using ${Xe(x)}.`})(d,h,s.value,l.value)),s}function qi(s,l,d,h){let y=arguments.length>4&&arguments[4]!==void 0?arguments[4]:Rc;return s===void 0||s.value===void 0?l:s.explicit&&!l.explicit?s:l.explicit&&!s.explicit?l:Ie(s.value,l.value)?s:y(s,l,d,h)}class Ty extends ji{constructor(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=arguments.length>2&&arguments[2]!==void 0&&arguments[2];super(l,d),this.explicit=l,this.implicit=d,this.parseNothing=h}clone(){let l=super.clone();return l.parseNothing=this.parseNothing,l}}function fs(s){return"url"in s}function mu(s){return"values"in s}function qf(s){return"name"in s&&!fs(s)&&!mu(s)&&!Eo(s)}function Eo(s){return s&&(Wf(s)||Vf(s)||Yf(s))}function Wf(s){return"sequence"in s}function Vf(s){return"sphere"in s}function Yf(s){return"graticule"in s}let nn=(function(s){return s[s.Raw=0]="Raw",s[s.Main=1]="Main",s[s.Row=2]="Row",s[s.Column=3]="Column",s[s.Lookup=4]="Lookup",s})({});function Hm(s){let{signals:l,hasLegend:d,index:h,...y}=s;return y.field=jt(y.field),y}function ps(s){let l=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:b.identity;if(b.isArray(s)){let h=s.map((y=>ps(y,l,d)));return l?`[${h.join(", ")}]`:h}return Gs(s)?d(l?js(s):(function(h){let y=Yd(h,!0);return h.utc?+new Date(Date.UTC(...y)):+new Date(...y)})(s)):l?d(Xe(s)):s}function Cy(s,l){for(let d of Te(s.component.selection??{})){let h=d.name,y=`${h}${ko}, ${d.resolve==="global"?"true":`{unit: ${Wa(s)}}`}`;for(let w of il)w.defined(d)&&(w.signals&&(l=w.signals(s,d,l)),w.modifyExpr&&(y=w.modifyExpr(s,d,y)));l.push({name:h+jy,on:[{events:{signal:d.name+ko},update:`modify(${b.stringValue(d.name+ms)}, ${y})`}]})}return Kf(l)}function Nc(s,l){if(s.component.selection&&be(s.component.selection).length){let d=b.stringValue(s.getName("cell"));l.unshift({name:"facet",value:{},on:[{events:b.parseSelector("pointermove","scope"),update:`isTuple(facet) ? facet : group(${d}).datum`}]})}return Kf(l)}function Ry(s,l){for(let d of Te(s.component.selection??{}))for(let h of il)h.defined(d)&&h.marks&&(l=h.marks(s,d,l));return l}function Kf(s){return s.map((l=>(l.on&&!l.on.length&&delete l.on,l)))}class qt{constructor(l,d){this.debugName=d,at(this,"_children",[]),at(this,"_parent",null),at(this,"_hash",void 0),l&&(this.parent=l)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(l){this._parent=l,l&&l.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(l,d){this._children.includes(l)?Be("Attempt to add the same child twice."):d!==void 0?this._children.splice(d,0,l):this._children.push(l)}removeChild(l){let d=this._children.indexOf(l);return this._children.splice(d,1),d}remove(){let l=this._parent.removeChild(this);for(let d of this._children)d._parent=this._parent,this._parent.addChild(d,l++)}insertAsParentOf(l){let d=l.parent;d.removeChild(this),this.parent=d,l.parent=this}swapWithParent(){let l=this._parent,d=l.parent;for(let y of this._children)y.parent=l;this._children=[],l.removeChild(this);let h=l.parent.removeChild(l);this._parent=d,d.addChild(this,h),l.parent=this}}class ia extends qt{clone(){let l=new this.constructor;return l.debugName=`clone_${this.debugName}`,l._source=this._source,l._name=`clone_${this._name}`,l.type=this.type,l.refCounts=this.refCounts,l.refCounts[l._name]=0,l}constructor(l,d,h,y){super(l,d),this.type=h,this.refCounts=y,at(this,"_source",void 0),at(this,"_name",void 0),this._source=this._name=d,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${Zt()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(l){this._source=l}}function qm(s){return s.as!==void 0}function Ny(s){return`${s}_end`}class Wi extends qt{clone(){return new Wi(null,j(this.timeUnits))}constructor(l,d){super(l),this.timeUnits=d}static makeFromEncoding(l,d){let h=d.reduceFieldDef(((y,w,x)=>{let{field:A,timeUnit:C}=w;if(C){let L;if(Mr(C)){if(cn(d)){let{mark:G,markDef:H,config:X}=d,J=Fi({fieldDef:w,markDef:H,config:X});(cc(G)||J)&&(L={timeUnit:jn(C),field:A})}}else L={as:je(w,{forAs:!0}),field:A,timeUnit:C};if(cn(d)){let{mark:G,markDef:H,config:X}=d,J=Fi({fieldDef:w,markDef:H,config:X});cc(G)&&un(x)&&J!==.5&&(L.rectBandPosition=J)}L&&(y[ne(L)]=L)}return y}),{});return ye(h)?null:new Wi(l,h)}static makeFromTransform(l,d){let{timeUnit:h,...y}={...d},w={...y,timeUnit:jn(h)};return new Wi(l,{[ne(w)]:w})}merge(l){this.timeUnits={...this.timeUnits};for(let d in l.timeUnits)this.timeUnits[d]||(this.timeUnits[d]=l.timeUnits[d]);for(let d of l.children)l.removeChild(d),d.parent=this;l.remove()}removeFormulas(l){let d={};for(let[h,y]of ke(this.timeUnits)){let w=qm(y)?y.as:`${y.field}_end`;l.has(w)||(d[h]=y)}this.timeUnits=d}producedFields(){return new Set(Te(this.timeUnits).map((l=>qm(l)?l.as:Ny(l.field))))}dependentFields(){return new Set(Te(this.timeUnits).map((l=>l.field)))}hash(){return`TimeUnit ${ne(this.timeUnits)}`}assemble(){let l=[];for(let d of Te(this.timeUnits)){let{rectBandPosition:h}=d,y=jn(d.timeUnit);if(qm(d)){let{field:w,as:x}=d,{unit:A,utc:C,...L}=y,G=[x,`${x}_end`];l.push({field:jt(w),type:"timeunit",...A?{units:oc(A)}:{},...C?{timezone:"utc"}:{},...L,as:G}),l.push(...oa(G,h,y))}else if(d){let{field:w}=d,x=w.replaceAll("\\.","."),A=Wm({timeUnit:y,field:x}),C=Ny(x);l.push({type:"formula",expr:A,as:C}),l.push(...oa([x,C],h,y))}}return l}}let Xf="offsetted_rect_start",$t="offsetted_rect_end";function Wm(s){let{timeUnit:l,field:d,reverse:h}=s,{unit:y,utc:w}=l,x=Lh(y),{part:A,step:C}=Xd(x,l.step);return`${w?"utcOffset":"timeOffset"}('${A}', datum['${d}'], ${h?-C:C})`}function oa(s,l,d){let[h,y]=s;if(l!==void 0&&l!==.5){let w=`datum['${h}']`,x=`datum['${y}']`;return[{type:"formula",expr:hs([Wm({timeUnit:d,field:h,reverse:!0}),w],l+.5),as:`${h}_${Xf}`},{type:"formula",expr:hs([w,x],l+.5),as:`${h}_${$t}`}]}return[]}function hs(s,l){let[d,h]=s;return`${1-l} * ${d} + ${l} * ${h}`}let Ic="_tuple_fields";class Vm{constructor(){at(this,"hasChannel",void 0),at(this,"hasField",void 0),at(this,"hasSelectionId",void 0),at(this,"timeUnit",void 0),at(this,"items",void 0);for(var l=arguments.length,d=new Array(l),h=0;h<l;h++)d[h]=arguments[h];this.items=d,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}let Vi={defined:()=>!0,parse:(s,l,d)=>{let h=l.name,y=l.project??=new Vm,w={},x={},A=new Set,C=(le,te)=>{let pe=te==="visual"?le.channel:le.field,ge=$e(`${h}_${pe}`);for(let xe=1;A.has(ge);xe++)ge=$e(`${h}_${pe}_${xe}`);return A.add(ge),{[te]:ge}},L=l.type,G=s.config.selection[L],H=d.value!==void 0?b.array(d.value):null,{fields:X,encodings:J}=b.isObject(d.select)?d.select:{};if(!X&&!J&&H){for(let le of H)if(b.isObject(le))for(let te of be(le))b_[te]?(J||(J=[])).push(te):L==="interval"?(Be('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),J=G.encodings):(X??=[]).push(te)}X||J||(J=G.encodings,"fields"in G&&(X=G.fields));for(let le of J??[]){let te=s.fieldDef(le);if(te){let pe=te.field;if(te.aggregate){Be(Di(le,te.aggregate));continue}if(!pe){Be(aa(le));continue}if(te.timeUnit&&!Mr(te.timeUnit)){pe=s.vgField(le);let ge={timeUnit:te.timeUnit,as:pe,field:te.field};x[ne(ge)]=ge}if(!w[pe]){let ge={field:pe,channel:le,type:L==="interval"&&Nr(le)&&Ha(s.getScaleComponent(le).get("type"))?"R":te.bin?"R-RE":"E",index:y.items.length};ge.signals={...C(ge,"data"),...C(ge,"visual")},y.items.push(w[pe]=ge),y.hasField[pe]=w[pe],y.hasSelectionId=y.hasSelectionId||pe===fr,Qo(le)?(ge.geoChannel=le,ge.channel=gh(le),y.hasChannel[ge.channel]=w[pe]):y.hasChannel[le]=w[pe]}}else Be(aa(le))}for(let le of X??[]){if(y.hasField[le])continue;let te={type:"E",field:le,index:y.items.length};te.signals={...C(te,"data")},y.items.push(te),y.hasField[le]=te,y.hasSelectionId=y.hasSelectionId||le===fr}H&&(l.init=H.map((le=>y.items.map((te=>b.isObject(le)?le[te.geoChannel||te.channel]!==void 0?le[te.geoChannel||te.channel]:le[te.field]:le))))),ye(x)||(y.timeUnit=new Wi(null,x))},signals:(s,l,d)=>{let h=l.name+Ic;return d.filter((y=>y.name===h)).length>0||l.project.hasSelectionId?d:d.concat({name:h,value:l.project.items.map(Hm)})}},Ra={defined:s=>s.type==="interval"&&s.resolve==="global"&&s.bind&&s.bind==="scales",parse:(s,l)=>{let d=l.scales=[];for(let h of l.project.items){let y=h.channel;if(!Nr(y))continue;let w=s.getScaleComponent(y),x=w?w.get("type"):void 0;w&&Ha(x)?(w.set("selectionExtent",{param:l.name,field:h.field},!0),d.push(h)):Be("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(s,l,d)=>{let h=l.scales.filter((x=>d.filter((A=>A.name===x.signals.data)).length===0));if(!s.parent||nl(s)||h.length===0)return d;let y=d.filter((x=>x.name===l.name))[0],w=y.update;if(w.indexOf(rg)>=0)y.update=`{${h.map((x=>`${b.stringValue(jt(x.field))}: ${x.signals.data}`)).join(", ")}}`;else{for(let x of h){let A=`${b.stringValue(jt(x.field))}: ${x.signals.data}`;w.includes(A)||(w=`${w.substring(0,w.length-1)}, ${A}}`)}y.update=w}return d.concat(h.map((x=>({name:x.signals.data}))))},signals:(s,l,d)=>{if(s.parent&&!nl(s))for(let h of l.scales){let y=d.filter((w=>w.name===h.signals.data))[0];y.push="outer",delete y.value,delete y.update}return d}};function qn(s,l){return`domain(${b.stringValue(s.scaleName(l))})`}function nl(s){return s.parent&&ws(s.parent)&&!s.parent.parent}let wo="_brush",Ym="_scale_trigger",gu="geo_interval_init_tick",Zf="_init",Km={defined:s=>s.type==="interval",parse:(s,l,d)=>{if(s.hasProjection){let h={...b.isObject(d.select)?d.select:{}};h.fields=[fr],h.encodings||(h.encodings=d.value?be(d.value):[$a,nt]),d.select={type:"interval",...h}}if(l.translate&&!Ra.defined(l)){let h=`!event.item || event.item.mark.name !== ${b.stringValue(l.name+wo)}`;for(let y of l.events){if(!y.between){Be(`${y} is not an ordered event stream for interval selections.`);continue}let w=b.array(y.between[0].filter??=[]);w.indexOf(h)<0&&w.push(h)}}},signals:(s,l,d)=>{let h=l.name,y=h+ko,w=Te(l.project.hasChannel).filter((A=>A.channel===Qt||A.channel===Bn)),x=l.init?l.init[0]:null;if(d.push(...w.reduce(((A,C)=>A.concat((function(L,G,H,X){let J=!L.hasProjection,le=H.channel,te=H.signals.visual,pe=b.stringValue(J?L.scaleName(le):L.projectionName()),ge=Re=>`scale(${pe}, ${Re})`,xe=L.getSizeSignalRef(le===Qt?"width":"height").signal,me=`${le}(unit)`,Ae=G.events.reduce(((Re,Pe)=>[...Re,{events:Pe.between[0],update:`[${me}, ${me}]`},{events:Pe,update:`[${te}[0], clamp(${me}, 0, ${xe})]`}]),[]);if(J){let Re=H.signals.data,Pe=Ra.defined(G),We=L.getScaleComponent(le),Je=We?We.get("type"):void 0,it=X?{init:ps(X,!0,ge)}:{value:[]};return Ae.push({events:{signal:G.name+Ym},update:Ha(Je)?`[${ge(`${Re}[0]`)}, ${ge(`${Re}[1]`)}]`:"[0, 0]"}),Pe?[{name:Re,on:[]}]:[{name:te,...it,on:Ae},{name:Re,...X?{init:ps(X)}:{},on:[{events:{signal:te},update:`${te}[0] === ${te}[1] ? null : invert(${pe}, ${te})`}]}]}{let Re=le===Qt?0:1,Pe=G.name+Zf;return[{name:te,...X?{init:`[${Pe}[0][${Re}], ${Pe}[1][${Re}]]`}:{value:[]},on:Ae}]}})(s,l,C,x&&x[C.index]))),[])),s.hasProjection){let A=b.stringValue(s.projectionName()),C=s.projectionName()+"_center",{x:L,y:G}=l.project.hasChannel,H=L&&L.signals.visual,X=G&&G.signals.visual,J=L?x&&x[L.index]:`${C}[0]`,le=G?x&&x[G.index]:`${C}[1]`,te=me=>s.getSizeSignalRef(me).signal,pe=`[[${H?H+"[0]":"0"}, ${X?X+"[0]":"0"}],[${H?H+"[1]":te("width")}, ${X?X+"[1]":te("height")}]]`;x&&(d.unshift({name:h+Zf,init:`[scale(${A}, [${L?J[0]:J}, ${G?le[0]:le}]), scale(${A}, [${L?J[1]:J}, ${G?le[1]:le}])]`}),!L||!G)&&(d.find((me=>me.name===C))||d.unshift({name:C,update:`invert(${A}, [${te("width")}/2, ${te("height")}/2])`}));let ge=`vlSelectionTuples(${`intersect(${pe}, {markname: ${b.stringValue(s.getName("marks"))}}, unit.mark)`}, ${`{unit: ${Wa(s)}}`})`,xe=w.map((me=>me.signals.visual));return d.concat({name:y,on:[{events:[...xe.length?[{signal:xe.join(" || ")}]:[],...x?[{signal:gu}]:[]],update:ge}]})}{if(!Ra.defined(l)){let L=h+Ym,G=w.map((H=>{let X=H.channel,{data:J,visual:le}=H.signals,te=b.stringValue(s.scaleName(X)),pe=Ha(s.getScaleComponent(X).get("type"))?"+":"";return`(!isArray(${J}) || (${pe}invert(${te}, ${le})[0] === ${pe}${J}[0] && ${pe}invert(${te}, ${le})[1] === ${pe}${J}[1]))`}));G.length&&d.push({name:L,value:{},on:[{events:w.map((H=>({scale:s.scaleName(H.channel)}))),update:G.join(" && ")+` ? ${L} : {}`}]})}let A=w.map((L=>L.signals.data)),C=`unit: ${Wa(s)}, fields: ${h+Ic}, values`;return d.concat({name:y,...x?{init:`{${C}: ${ps(x)}}`}:{},...A.length?{on:[{events:[{signal:A.join(" || ")}],update:`${A.join(" && ")} ? {${C}: [${A}]} : null`}]}:{}})}},topLevelSignals:(s,l,d)=>(cn(s)&&s.hasProjection&&l.init&&(d.filter((h=>h.name===gu)).length||d.unshift({name:gu,value:null,on:[{events:"timer{1}",update:`${gu} === null ? {} : ${gu}`}]})),d),marks:(s,l,d)=>{let h=l.name,{x:y,y:w}=l.project.hasChannel,x=y==null?void 0:y.signals.visual,A=w==null?void 0:w.signals.visual,C=`data(${b.stringValue(l.name+ms)})`;if(Ra.defined(l)||!y&&!w)return d;let L={x:y!==void 0?{signal:`${x}[0]`}:{value:0},y:w!==void 0?{signal:`${A}[0]`}:{value:0},x2:y!==void 0?{signal:`${x}[1]`}:{field:{group:"width"}},y2:w!==void 0?{signal:`${A}[1]`}:{field:{group:"height"}}};if(l.resolve==="global")for(let te of be(L))L[te]=[{test:`${C}.length && ${C}[0].unit === ${Wa(s)}`,...L[te]},{value:0}];let{fill:G,fillOpacity:H,cursor:X,...J}=l.mark,le=be(J).reduce(((te,pe)=>(te[pe]=[{test:[y!==void 0&&`${x}[0] !== ${x}[1]`,w!==void 0&&`${A}[0] !== ${A}[1]`].filter((ge=>ge)).join(" && "),value:J[pe]},{value:null}],te)),{});return[{name:`${h+wo}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:G},fillOpacity:{value:H}},update:L}},...d,{name:h+wo,type:"rect",clip:!0,encode:{enter:{...X?{cursor:{value:X}}:{},fill:{value:"transparent"}},update:{...L,...le}}}]}},al={defined:s=>s.type==="point",signals:(s,l,d)=>{let h=l.name,y=h+Ic,w=l.project,x="(item().isVoronoi ? datum.datum : datum)",A=Te(s.component.selection??{}).reduce(((H,X)=>X.type==="interval"?H.concat(X.name+wo):H),[]).map((H=>`indexof(item().mark.name, '${H}') < 0`)).join(" && "),C="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(A?` && ${A}`:""),L=`unit: ${Wa(s)}, `;l.project.hasSelectionId?L+=`${fr}: ${x}[${b.stringValue(fr)}]`:L+=`fields: ${y}, values: [${w.items.map((H=>{let X=s.fieldDef(H.channel);return X!=null&&X.bin?`[${x}[${b.stringValue(s.vgField(H.channel,{}))}], ${x}[${b.stringValue(s.vgField(H.channel,{binSuffix:"end"}))}]]`:`${x}[${b.stringValue(H.field)}]`})).join(", ")}]`;let G=l.events;return d.concat([{name:h+ko,on:G?[{events:G,update:`${C} ? {${L}} : null`,force:!0}]:[]}])}};function bu(s,l,d,h){let y=hf(l)&&l.condition,w=h(l);return y?{[d]:[...b.array(y).map((x=>{let A=h(x);if((function(C){return C.param})(x)){let{param:C,empty:L}=x;return{test:Eu(s,{param:C,empty:L}),...A}}return{test:Ki(s,x.test),...A}})),...w!==void 0?[w]:[]]}:w!==void 0?{[d]:w}:{}}function Jf(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"text",d=s.encoding[l];return bu(s,d,l,(h=>yu(h,s.config)))}function yu(s,l){let d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"datum";if(s){if(cr(s))return on(s.value);if(_t(s)){let{format:h,formatType:y}=Js(s);return Vh({fieldOrDatumDef:s,format:h,formatType:y,expr:d,config:l})}}}function Oc(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{encoding:d,markDef:h,config:y,stack:w}=s,x=d.tooltip;if(b.isArray(x))return{tooltip:Iy({tooltip:x},w,y,l)};{let A=l.reactiveGeom?"datum.datum":"datum";return bu(s,x,"tooltip",(C=>{let L=yu(C,y,A);if(L)return L;if(C===null)return;let G=Ht("tooltip",h,y);return G===!0&&(G={content:"encoding"}),b.isString(G)?{value:G}:b.isObject(G)?Ze(G)?G:G.content==="encoding"?Iy(d,w,y,l):{signal:A}:void 0}))}}function Dc(s,l,d){let{reactiveGeom:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y={...d,...d.tooltipFormat},w={},x=h?"datum.datum":"datum",A=[];function C(G,H){let X=Us(H),J=ma(G)?G:{...G,type:s[X].type},le=J.title||yf(J,y),te=b.array(le).join(", ").replaceAll(/"/g,'\\"'),pe;if(un(H)){let ge=H==="x"?"x2":"y2",xe=dr(s[ge]);if(zn(J.bin)&&xe){let me=je(J,{expr:x}),Ae=je(xe,{expr:x}),{format:Re,formatType:Pe}=Js(J);pe=yo(me,Ae,Re,Pe,y),w[ge]=!0}}if((un(H)||H===ar||H===mt)&&l&&l.fieldChannel===H&&l.offset==="normalize"){let{format:ge,formatType:xe}=Js(J);pe=Vh({fieldOrDatumDef:J,format:ge,formatType:xe,expr:x,config:y,normalizeStack:!0}).signal}pe??=yu(J,y,x).signal,A.push({channel:H,key:te,value:pe})}bc(s,((G,H)=>{ze(G)?C(G,H):mf(G)&&C(G.condition,H)}));let L={};for(let{channel:G,key:H,value:X}of A)w[G]||L[H]||(L[H]=X);return L}function Iy(s,l,d){let{reactiveGeom:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=Dc(s,l,d,{reactiveGeom:h}),w=ke(y).map((x=>{let[A,C]=x;return`"${A}": ${C}`}));return w.length>0?{signal:`{${w.join(", ")}}`}:void 0}function s1(s){let{markDef:l,config:d}=s,h=Ht("aria",l,d);return h===!1?{}:{...h?{aria:h}:{},...l1(s),...u1(s)}}function l1(s){let{mark:l,markDef:d,config:h}=s;if(h.aria===!1)return{};let y=Ht("ariaRoleDescription",d,h);return y!=null?{ariaRoleDescription:{value:y}}:l in Bd?{}:{ariaRoleDescription:{value:l}}}function u1(s){let{encoding:l,markDef:d,config:h,stack:y}=s,w=l.description;if(w)return bu(s,w,"description",(C=>yu(C,s.config)));let x=Ht("description",d,h);if(x!=null)return{description:on(x)};if(h.aria===!1)return{};let A=Dc(l,y,h);return ye(A)?void 0:{description:{signal:ke(A).map(((C,L)=>{let[G,H]=C;return`"${L>0?"; ":""}${G}: " + (${H})`})).join(" + ")}}}function Wn(s,l){let d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{markDef:h,encoding:y,config:w}=l,{vgChannel:x}=d,{defaultRef:A,defaultValue:C}=d;A===void 0&&(C??=Ht(s,h,w,{vgChannel:x,ignoreVgConfig:!0}),C!==void 0&&(A=on(C)));let L=y[s];return bu(l,L,x??s,(G=>Wh({channel:s,channelDef:G,markDef:h,config:w,scaleName:l.scaleName(s),scale:l.getScaleComponent(s),stack:null,defaultRef:A})))}function Mc(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{filled:void 0},{markDef:d,encoding:h,config:y}=s,{type:w}=d,x=l.filled??Ht("filled",d,y),A=Z(["bar","point","circle","square","geoshape"],w)?"transparent":void 0,C=Ht(x===!0?"color":void 0,d,y,{vgChannel:"fill"})??y.mark[x===!0&&"color"]??A,L=Ht(x===!1?"color":void 0,d,y,{vgChannel:"stroke"})??y.mark[x===!1&&"color"],G=x?"fill":"stroke",H={...C?{fill:on(C)}:{},...L?{stroke:on(L)}:{}};return d.color&&(x?d.fill:d.stroke)&&Be(D0("property",{fill:"fill"in d,stroke:"stroke"in d})),{...H,...Wn("color",s,{vgChannel:G,defaultValue:x?C:L}),...Wn("fill",s,{defaultValue:h.fill?C:void 0}),...Wn("stroke",s,{defaultValue:h.stroke?L:void 0})}}function Oy(s){let{encoding:l,mark:d}=s,h=l.order;return!is(d)&&cr(h)?bu(s,h,"zindex",(y=>on(y.value))):{}}function vu(s){let{channel:l,markDef:d,encoding:h={},model:y,bandPosition:w}=s,x=`${l}Offset`,A=d[x],C=h[x];if((x==="xOffset"||x==="yOffset")&&C)return{offsetType:"encoding",offset:Wh({channel:x,channelDef:C,markDef:d,config:y==null?void 0:y.config,scaleName:y.scaleName(x),scale:y.getScaleComponent(x),stack:null,defaultRef:on(A),bandPosition:w})};let L=d[x];return L?{offsetType:"visual",offset:L}:{}}function Vn(s,l,d){let{defaultPos:h,vgChannel:y}=d,{encoding:w,markDef:x,config:A,stack:C}=l,L=w[s],G=w[Ci(s)],H=l.scaleName(s),X=l.getScaleComponent(s),{offset:J,offsetType:le}=vu({channel:s,markDef:x,encoding:w,model:l,bandPosition:.5}),te=Qf({model:l,defaultPos:h,channel:s,scaleName:H,scale:X}),pe=!L&&un(s)&&(w.latitude||w.longitude)?{field:l.getName(s)}:(function(ge){let{channel:xe,channelDef:me,scaleName:Ae,stack:Re,offset:Pe,markDef:We}=ge;if(_t(me)&&Re&&xe===Re.fieldChannel){if(ze(me)){let Je=me.bandPosition;if(Je!==void 0||We.type!=="text"||xe!=="radius"&&xe!=="theta"||(Je=.5),Je!==void 0)return uf({scaleName:Ae,fieldOrDatumDef:me,startSuffix:"start",bandPosition:Je,offset:Pe})}return Ks(me,Ae,{suffix:"end"},{offset:Pe})}return Hh(ge)})({channel:s,channelDef:L,channel2Def:G,markDef:x,config:A,scaleName:H,scale:X,stack:C,offset:J,defaultRef:te,bandPosition:le==="encoding"?0:void 0});return pe?{[y||s]:pe}:void 0}function Qf(s){let{model:l,defaultPos:d,channel:h,scaleName:y,scale:w}=s,{markDef:x,config:A}=l;return()=>{let C=Us(h),L=sr(h),G=Ht(h,x,A,{vgChannel:L});if(G!==void 0)return Jl(h,G);switch(d){case"zeroOrMin":case"zeroOrMax":if(y){let H=w.get("type");if(!Z([Gt.LOG,Gt.TIME,Gt.UTC],H)){if(w.domainDefinitelyIncludesZero())return{scale:y,value:0}}}if(d==="zeroOrMin")return C==="y"?{field:{group:"height"}}:{value:0};switch(C){case"radius":return{signal:`min(${l.width.signal},${l.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...l[xa(h)],mult:.5}}}}let Dy={left:"x",center:"xc",right:"x2"},My={top:"y",middle:"yc",bottom:"y2"};function Xm(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle";if(s==="radius"||s==="theta")return sr(s);let y=s==="x"?"align":"baseline",w=Ht(y,l,d),x;return Ze(w)?(Be((function(A){return`The ${A} for range marks cannot be an expression`})(y)),x=void 0):x=w,s==="x"?Dy[x||(h==="top"?"left":"center")]:My[x||h]}function ep(s,l,d){let{defaultPos:h,defaultPos2:y,range:w}=d;return w?_o(s,l,{defaultPos:h,defaultPos2:y}):Vn(s,l,{defaultPos:h})}function _o(s,l,d){let{defaultPos:h,defaultPos2:y}=d,{markDef:w,config:x}=l,A=Ci(s),C=xa(s),L=(function(G,H,X){let{encoding:J,mark:le,markDef:te,stack:pe,config:ge}=G,xe=Us(X),me=xa(X),Ae=sr(X),Re=J[xe],Pe=G.scaleName(xe),We=G.getScaleComponent(xe),{offset:Je}=vu(X in J||X in te?{channel:X,markDef:te,encoding:J,model:G}:{channel:xe,markDef:te,encoding:J,model:G});if(!Re&&(X==="x2"||X==="y2")&&(J.latitude||J.longitude)){let Qe=xa(X),lt=G.markDef[Qe];return lt!=null?{[Qe]:{value:lt}}:{[Ae]:{field:G.getName(X)}}}let it=(function(Qe){let{channel:lt,channelDef:kt,channel2Def:Fn,markDef:dn,config:sn,scaleName:Ut,scale:Dt,stack:En,offset:Nn,defaultRef:fn}=Qe;return _t(kt)&&En&&lt.charAt(0)===En.fieldChannel.charAt(0)?Ks(kt,Ut,{suffix:"start"},{offset:Nn}):Hh({channel:lt,channelDef:Fn,scaleName:Ut,scale:Dt,stack:En,markDef:dn,config:sn,offset:Nn,defaultRef:fn})})({channel:X,channelDef:Re,channel2Def:J[X],markDef:te,config:ge,scaleName:Pe,scale:We,stack:pe,offset:Je,defaultRef:void 0});return it!==void 0?{[Ae]:it}:rl(X,te)||rl(X,{[X]:zd(X,te,ge.style),[me]:zd(me,te,ge.style)})||rl(X,ge[le])||rl(X,ge.mark)||{[Ae]:Qf({model:G,defaultPos:H,channel:X,scaleName:Pe,scale:We})()}})(l,y,A);return{...Vn(s,l,{defaultPos:h,vgChannel:L[C]?Xm(s,w,x):sr(s)}),...L}}function rl(s,l){let d=xa(s),h=sr(s);if(l[h]!==void 0)return{[h]:Jl(s,l[h])};if(l[s]!==void 0)return{[h]:Jl(s,l[s])};if(l[d]){let y=l[d];if(!Ys(y))return{[d]:Jl(s,y)};Be((function(w){return`Position range does not support relative band size for ${w}.`})(d))}}function li(s,l){let{config:d,encoding:h,markDef:y}=s,w=y.type,x=Ci(l),A=xa(l),C=h[l],L=h[x],G=s.getScaleComponent(l),H=G?G.get("type"):void 0,X=y.orient,J=h[A]??h.size??Ht("size",y,d,{vgChannel:A}),le=bh(l),te=w==="bar"&&(l==="x"?X==="vertical":X==="horizontal");return!ze(C)||!(Vt(C.bin)||zn(C.bin)||C.timeUnit&&!L)||J&&!Ys(J)||h[le]||Hn(H)?(_t(C)&&Hn(H)||te)&&!L?(function(pe,ge,xe){var ga,ln;let{markDef:me,encoding:Ae,config:Re,stack:Pe}=xe,We=me.orient,Je=xe.scaleName(ge),it=xe.getScaleComponent(ge),Qe=xa(ge),lt=Ci(ge),kt=bh(ge),Fn=xe.scaleName(kt),dn=xe.getScaleComponent(Ul(ge)),sn=We==="horizontal"&&ge==="y"||We==="vertical"&&ge==="x",Ut;(Ae.size||me.size)&&(sn?Ut=Wn("size",xe,{vgChannel:Qe,defaultRef:on(me.size)}):Be((function(At){return`Cannot apply size to non-oriented mark "${At}".`})(me.type)));let Dt=!!Ut,En=Qh({channel:ge,fieldDef:pe,markDef:me,config:Re,scaleType:(ga=it||dn)==null?void 0:ga.get("type"),useVlSizeChannel:sn});Ut=Ut||{[Qe]:Ly(Qe,Fn||Je,dn||it,Re,En,!!pe,me.type)};let Nn=((ln=it||dn)==null?void 0:ln.get("type"))==="band"&&Ys(En)&&!Dt?"top":"middle",fn=Xm(ge,me,Re,Nn),Oa=fn==="xc"||fn==="yc",{offset:Da,offsetType:Br}=vu({channel:ge,markDef:me,encoding:Ae,model:xe,bandPosition:Oa?.5:0}),Xn=Hh({channel:ge,channelDef:pe,markDef:me,config:Re,scaleName:Je,scale:it,stack:Pe,offset:Da,defaultRef:Qf({model:xe,defaultPos:"mid",channel:ge,scaleName:Je,scale:it}),bandPosition:Oa?Br==="encoding"?0:.5:Ze(En)?{signal:`(1-${En})/2`}:Ys(En)?(1-En.band)/2:0});if(Qe)return{[fn]:Xn,...Ut};{let At=sr(lt),wn=Ut[Qe],mi=Da?{...wn,offset:Da}:wn;return{[fn]:Xn,[At]:b.isArray(Xn)?[Xn[0],{...Xn[1],offset:mi}]:{...Xn,offset:mi}}}})(C,l,s):_o(l,s,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):(function(pe){var At;let{fieldDef:ge,fieldDef2:xe,channel:me,model:Ae}=pe,{config:Re,markDef:Pe,encoding:We}=Ae,Je=Ae.getScaleComponent(me),it=Ae.scaleName(me),Qe=Je?Je.get("type"):void 0,lt=Je.get("reverse"),kt=Qh({channel:me,fieldDef:ge,markDef:Pe,config:Re,scaleType:Qe}),Fn=(At=Ae.component.axes[me])==null?void 0:At[0],dn=(Fn==null?void 0:Fn.get("translate"))??.5,sn=un(me)?Ht("binSpacing",Pe,Re)??0:0,Ut=Ci(me),Dt=sr(me),En=sr(Ut),Nn=Ga("minBandSize",Pe,Re),{offset:fn}=vu({channel:me,markDef:Pe,encoding:We,model:Ae,bandPosition:0}),{offset:Oa}=vu({channel:Ut,markDef:Pe,encoding:We,model:Ae,bandPosition:0}),Da=(function(wn){let{scaleName:mi,fieldDef:gi}=wn,xs=je(gi,{expr:"datum"});return`abs(scale("${mi}", ${je(gi,{expr:"datum",suffix:"end"})}) - scale("${mi}", ${xs}))`})({fieldDef:ge,scaleName:it}),Br=Zm(me,sn,lt,dn,fn,Nn,Da),Xn=Zm(Ut,sn,lt,dn,Oa??fn,Nn,Da),ga=Ze(kt)?{signal:`(1-${kt.signal})/2`}:Ys(kt)?(1-kt.band)/2:.5,ln=Fi({fieldDef:ge,fieldDef2:xe,markDef:Pe,config:Re});if(Vt(ge.bin)||ge.timeUnit){let wn=ge.timeUnit&&ln!==.5;return{[En]:Jm({fieldDef:ge,scaleName:it,bandPosition:ga,offset:Xn,useRectOffsetField:wn}),[Dt]:Jm({fieldDef:ge,scaleName:it,bandPosition:Ze(ga)?{signal:`1-${ga.signal}`}:1-ga,offset:Br,useRectOffsetField:wn})}}if(zn(ge.bin)){let wn=Ks(ge,it,{},{offset:Xn});if(ze(xe))return{[En]:wn,[Dt]:Ks(xe,it,{},{offset:Br})};if(mo(ge.bin)&&ge.bin.step)return{[En]:wn,[Dt]:{signal:`scale("${it}", ${je(ge,{expr:"datum"})} + ${ge.bin.step})`,offset:Br}}}return void Be(Vd(Ut))})({fieldDef:C,fieldDef2:L,channel:l,model:s})}function Ly(s,l,d,h,y,w,x){if(Ys(y)){if(!d)return{mult:y.band,field:{group:s}};{let A=d.get("type");if(A==="band"){let C=`bandwidth('${l}')`;y.band!==1&&(C=`${y.band} * ${C}`);let L=Ga("minBandSize",{type:x},h);return{signal:L?`max(${pa(L)}, ${C})`:C}}y.band!==1&&(Be((function(C){return`Cannot use the relative band size with ${C} scale.`})(A)),y=void 0)}}else{if(Ze(y))return y;if(y)return{value:y}}if(d){let A=d.get("range");if(go(A)&&b.isNumber(A.step))return{value:A.step-2}}if(!w){let{bandPaddingInner:A,barBandPaddingInner:C,rectBandPaddingInner:L}=h.scale,G=Ke(A,x==="bar"?C:L);if(Ze(G))return{signal:`(1 - (${G.signal})) * ${s}`};if(b.isNumber(G))return{signal:`${1-G} * ${s}`}}return{value:fu(h.view,s)-2}}function Zm(s,l,d,h,y,w,x){if(Fd(s))return 0;let A=s==="x"||s==="y2",C=A?-l/2:l/2;if(Ze(d)||Ze(y)||Ze(h)||w){let L=pa(d),G=pa(y),H=pa(h),X=pa(w),J=w?`(${x} < ${X} ? ${A?"":"-"}0.5 * (${X} - (${x})) : ${C})`:C;return{signal:(H?`${H} + `:"")+(L?`(${L} ? -1 : 1) * `:"")+(G?`(${G} + ${J})`:J)}}return y=y||0,h+(d?-y-C:+y+C)}function Jm(s){let{fieldDef:l,scaleName:d,bandPosition:h,offset:y,useRectOffsetField:w}=s;return uf({scaleName:d,fieldOrDatumDef:l,bandPosition:h,offset:y,...w?{startSuffix:Xf,endSuffix:$t}:{}})}let c1=new Set(["aria","width","height"]);function Na(s,l){let{fill:d,stroke:h}=l.color==="include"?Mc(s):{};return{...d1(s.markDef,l),...tp(s,"fill",d),...tp(s,"stroke",h),...Wn("opacity",s),...Wn("fillOpacity",s),...Wn("strokeOpacity",s),...Wn("strokeWidth",s),...Wn("strokeDash",s),...Oy(s),...Oc(s),...Jf(s,"href"),...s1(s)}}function tp(s,l,d){let{config:h,mark:y,markDef:w}=s;if(Ht("invalid",w,h)==="hide"&&d&&!is(y)){let x=(function(A,C){let{invalid:L=!1,channels:G}=C,H=G.reduce(((J,le)=>{let te=A.getScaleComponent(le);if(te){let pe=te.get("type"),ge=A.vgField(le,{expr:"datum"});ge&&Ha(pe)&&(J[ge]=!0)}return J}),{}),X=be(H);if(X.length>0){let J=L?"||":"&&";return X.map((le=>qh(le,L))).join(` ${J} `)}})(s,{invalid:!0,channels:Gl});if(x)return{[l]:[{test:x,value:null},...b.array(d)]}}return d?{[l]:d}:{}}function d1(s,l){return Hl.reduce(((d,h)=>(c1.has(h)||s[h]===void 0||l[h]==="ignore"||(d[h]=on(s[h])),d)),{})}function Lc(s){let{config:l,markDef:d}=s;if(Ht("invalid",d,l)){let h=(function(y,w){let{invalid:x=!1,channels:A}=w,C=A.reduce(((G,H)=>{var J;let X=y.getScaleComponent(H);if(X){let le=X.get("type"),te=y.vgField(H,{expr:"datum",binSuffix:(J=y.stack)!=null&&J.impute?"mid":void 0});te&&Ha(le)&&(G[te]=!0)}return G}),{}),L=be(C);if(L.length>0){let G=x?"||":"&&";return L.map((H=>qh(H,x))).join(` ${G} `)}})(s,{channels:Qr});if(h)return{defined:{signal:h}}}return{}}function Fy(s,l){if(l!==void 0)return{[s]:on(l)}}let Fc="voronoi",Py={defined:s=>s.type==="point"&&s.nearest,parse:(s,l)=>{if(l.events)for(let d of l.events)d.markname=s.getName(Fc)},marks:(s,l,d)=>{let{x:h,y}=l.project.hasChannel,w=s.mark;if(is(w))return Be(`The "nearest" transform is not supported for ${w} marks.`),d;let x={name:s.getName(Fc),type:"path",interactive:!0,from:{data:s.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Oc(s,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:h||!y?"datum.datum.x || 0":"0"},y:{expr:y||!h?"datum.datum.y || 0":"0"},size:[s.getSizeSignalRef("width"),s.getSizeSignalRef("height")]}]},A=0,C=!1;return d.forEach(((L,G)=>{let H=L.name??"";H===s.component.mark[0].name?A=G:H.indexOf(Fc)>=0&&(C=!0)})),C||d.splice(A+1,0,x),d}},np={defined:s=>s.type==="point"&&s.resolve==="global"&&s.bind&&s.bind!=="scales"&&!Nf(s.bind),parse:(s,l,d)=>ui(l,d),topLevelSignals:(s,l,d)=>{let h=l.name,y=l.project,w=l.bind,x=l.init&&l.init[0],A=Py.defined(l)?"(item().isVoronoi ? datum.datum : datum)":"datum";return y.items.forEach(((C,L)=>{let G=$e(`${h}_${C.field}`);d.filter((H=>H.name===G)).length||d.unshift({name:G,...x?{init:ps(x[L])}:{value:null},on:l.events?[{events:l.events,update:`datum && item().mark.marktype !== 'group' ? ${A}[${b.stringValue(C.field)}] : null`}]:[],bind:w[C.field]??w[C.channel]??w})})),d},signals:(s,l,d)=>{let h=l.name,y=l.project,w=d.filter((L=>L.name===h+ko))[0],x=h+Ic,A=y.items.map((L=>$e(`${h}_${L.field}`))),C=A.map((L=>`${L} !== null`)).join(" && ");return A.length&&(w.update=`${C} ? {fields: ${x}, values: [${A.join(", ")}]} : null`),delete w.value,delete w.on,d}},Pc="_toggle",$y={defined:s=>s.type==="point"&&!!s.toggle,signals:(s,l,d)=>d.concat({name:l.name+Pc,value:!1,on:[{events:l.events,update:l.toggle}]}),modifyExpr:(s,l)=>{let d=l.name+ko,h=l.name+Pc;return`${h} ? null : ${d}, `+(l.resolve==="global"?`${h} ? null : true, `:`${h} ? null : {unit: ${Wa(s)}}, `)+`${h} ? ${d} : null`}},By={defined:s=>s.clear!==void 0&&s.clear!==!1,parse:(s,l)=>{l.clear&&(l.clear=b.isString(l.clear)?b.parseSelector(l.clear,"view"):l.clear)},topLevelSignals:(s,l,d)=>{if(np.defined(l))for(let h of l.project.items){let y=d.findIndex((w=>w.name===$e(`${l.name}_${h.field}`)));y!==-1&&d[y].on.push({events:l.clear,update:"null"})}return d},signals:(s,l,d)=>{function h(y,w){y!==-1&&d[y].on&&d[y].on.push({events:l.clear,update:w})}if(l.type==="interval")for(let y of l.project.items){let w=d.findIndex((x=>x.name===y.signals.visual));h(w,"[0, 0]"),w===-1&&h(d.findIndex((x=>x.name===y.signals.data)),"null")}else{let y=d.findIndex((w=>w.name===l.name+ko));h(y,"null"),$y.defined(l)&&(y=d.findIndex((w=>w.name===l.name+Pc)),h(y,"false"))}return d}},Uy={defined:s=>{let l=s.resolve==="global"&&s.bind&&Nf(s.bind),d=s.project.items.length===1&&s.project.items[0].field!==fr;return l&&!d&&Be("Legend bindings are only supported for selections over an individual field or encoding channel."),l&&d},parse:(s,l,d)=>{let h=j(d);if(h.select=b.isString(h.select)?{type:h.select,toggle:l.toggle}:{...h.select,toggle:l.toggle},ui(l,h),b.isObject(d.select)&&(d.select.on||d.select.clear)){let x='event.item && indexof(event.item.mark.role, "legend") < 0';for(let A of l.events)A.filter=b.array(A.filter??[]),A.filter.includes(x)||A.filter.push(x)}let y=If(l.bind)?l.bind.legend:"click",w=b.isString(y)?b.parseSelector(y,"view"):b.array(y);l.bind={legend:{merge:w}}},topLevelSignals:(s,l,d)=>{let h=l.name,y=If(l.bind)&&l.bind.legend,w=x=>A=>{let C=j(A);return C.markname=x,C};for(let x of l.project.items){if(!x.hasLegend)continue;let A=`${$e(x.field)}_legend`,C=`${h}_${A}`;if(d.filter((L=>L.name===C)).length===0){let L=y.merge.map(w(`${A}_symbols`)).concat(y.merge.map(w(`${A}_labels`))).concat(y.merge.map(w(`${A}_entries`)));d.unshift({name:C,...l.init?{}:{value:null},on:[{events:L,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:y.merge,update:`!event.item || !datum ? null : ${C}`,force:!0}]})}}return d},signals:(s,l,d)=>{let h=l.name,y=l.project,w=d.find((H=>H.name===h+ko)),x=h+Ic,A=y.items.filter((H=>H.hasLegend)).map((H=>$e(`${h}_${$e(H.field)}_legend`))),C=`${A.map((H=>`${H} !== null`)).join(" && ")} ? {fields: ${x}, values: [${A.join(", ")}]} : null`;l.events&&A.length>0?w.on.push({events:A.map((H=>({signal:H}))),update:C}):A.length>0&&(w.update=C,delete w.value,delete w.on);let L=d.find((H=>H.name===h+Pc)),G=If(l.bind)&&l.bind.legend;return L&&(l.events?L.on.push({...L.on[0],events:G}):L.on[0].events=G),d}},Qm="_translate_anchor",zy="_translate_delta",Gy={defined:s=>s.type==="interval"&&s.translate,signals:(s,l,d)=>{let h=l.name,y=Ra.defined(l),w=h+Qm,{x,y:A}=l.project.hasChannel,C=b.parseSelector(l.translate,"scope");return y||(C=C.map((L=>(L.between[0].markname=h+wo,L)))),d.push({name:w,value:{},on:[{events:C.map((L=>L.between[0])),update:"{x: x(unit), y: y(unit)"+(x!==void 0?`, extent_x: ${y?qn(s,Qt):`slice(${x.signals.visual})`}`:"")+(A!==void 0?`, extent_y: ${y?qn(s,Bn):`slice(${A.signals.visual})`}`:"")+"}"}]},{name:h+zy,value:{},on:[{events:C,update:`{x: ${w}.x - x(unit), y: ${w}.y - y(unit)}`}]}),x!==void 0&&eg(s,l,x,"width",d),A!==void 0&&eg(s,l,A,"height",d),d}};function eg(s,l,d,h,y){let w=l.name,x=w+Qm,A=w+zy,C=d.channel,L=Ra.defined(l),G=y.filter((ge=>ge.name===d.signals[L?"data":"visual"]))[0],H=s.getSizeSignalRef(h).signal,X=s.getScaleComponent(C),J=X&&X.get("type"),le=X&&X.get("reverse"),te=`${x}.extent_${C}`,pe=`${L&&X?J==="log"?"panLog":J==="symlog"?"panSymlog":J==="pow"?"panPow":"panLinear":"panLinear"}(${te}, ${`${L?C===Qt?le?"":"-":le?"-":"":""}${A}.${C} / ${L?`${H}`:`span(${te})`}`}${L?J==="pow"?`, ${X.get("exponent")??1}`:J==="symlog"?`, ${X.get("constant")??1}`:"":""})`;G.on.push({events:{signal:A},update:L?pe:`clampRange(${pe}, 0, ${H})`})}let tg="_zoom_anchor",ng="_zoom_delta",ag={defined:s=>s.type==="interval"&&s.zoom,signals:(s,l,d)=>{let h=l.name,y=Ra.defined(l),w=h+ng,{x,y:A}=l.project.hasChannel,C=b.stringValue(s.scaleName(Qt)),L=b.stringValue(s.scaleName(Bn)),G=b.parseSelector(l.zoom,"scope");return y||(G=G.map((H=>(H.markname=h+wo,H)))),d.push({name:h+tg,on:[{events:G,update:y?"{"+[C?`x: invert(${C}, x(unit))`:"",L?`y: invert(${L}, y(unit))`:""].filter((H=>H)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:w,on:[{events:G,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),x!==void 0&&$c(s,l,x,"width",d),A!==void 0&&$c(s,l,A,"height",d),d}};function $c(s,l,d,h,y){let w=l.name,x=d.channel,A=Ra.defined(l),C=y.filter((te=>te.name===d.signals[A?"data":"visual"]))[0],L=s.getSizeSignalRef(h).signal,G=s.getScaleComponent(x),H=G&&G.get("type"),X=A?qn(s,x):C.name,J=w+ng,le=`${A&&G?H==="log"?"zoomLog":H==="symlog"?"zoomSymlog":H==="pow"?"zoomPow":"zoomLinear":"zoomLinear"}(${X}, ${`${w}${tg}.${x}`}, ${J}${A?H==="pow"?`, ${G.get("exponent")??1}`:H==="symlog"?`, ${G.get("constant")??1}`:"":""})`;C.on.push({events:{signal:J},update:A?le:`clampRange(${le}, 0, ${L})`})}let ms="_store",ko="_tuple",jy="_modify",rg="vlSelectionResolve",il=[al,Km,Vi,$y,np,Ra,Uy,By,Gy,ag,Py];function Wa(s){let{escape:l}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{escape:!0},d=l?b.stringValue(s.name):s.name,h=(function(y){let w=y.parent;for(;w&&!Ya(w);)w=w.parent;return w})(s);if(h){let{facet:y}=h;for(let w of Ua)y[w]&&(d+=` + '__facet_${w}_' + (facet[${b.stringValue(h.vgField(w))}])`)}return d}function ig(s){return Te(s.component.selection??{}).reduce(((l,d)=>l||d.project.hasSelectionId),!1)}function ui(s,l){!b.isString(l.select)&&l.select.on||delete s.events,!b.isString(l.select)&&l.select.clear||delete s.clear,!b.isString(l.select)&&l.select.toggle||delete s.toggle}function Yi(s){let l=[];return s.type==="Identifier"?[s.name]:s.type==="Literal"?[s.value]:(s.type==="MemberExpression"&&(l.push(...Yi(s.object)),l.push(...Yi(s.property))),l)}function ap(s){return s.object.type==="MemberExpression"?ap(s.object):s.object.name==="datum"}function rp(s){let l=b.parseExpression(s),d=new Set;return l.visit((h=>{h.type==="MemberExpression"&&ap(h)&&d.add(Yi(h).slice(1).join("."))})),d}class ci extends qt{clone(){return new ci(null,this.model,j(this.filter))}constructor(l,d,h){super(l),this.model=d,this.filter=h,at(this,"expr",void 0),at(this,"_dependentFields",void 0),this.expr=Ki(this.model,this.filter,this),this._dependentFields=rp(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Eu(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"datum",y=b.isString(l)?l:l.param,w=$e(y),x=b.stringValue(w+ms),A;try{A=s.getSelectionComponent(w,y)}catch{return`!!${w}`}if(A.project.timeUnit){let G=d??s.component.data.raw,H=A.project.timeUnit.clone();G.parent?H.insertAsParentOf(G):G.parent=H}let C=`${A.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${x}, ${h}${A.resolve==="global"?")":`, ${b.stringValue(A.resolve)})`}`,L=`length(data(${x}))`;return l.empty===!1?`${L} && ${C}`:`!${L} || ${C}`}function So(s,l,d){let h=$e(l),y=d.encoding,w,x=d.field;try{w=s.getSelectionComponent(h,l)}catch{return h}if(y||x){if(y&&!x){let A=w.project.items.filter((C=>C.channel===y));!A.length||A.length>1?(x=w.project.items[0].field,Be((A.length?"Multiple ":"No ")+`matching ${b.stringValue(y)} encoding found for selection ${b.stringValue(d.param)}. Using "field": ${b.stringValue(x)}.`)):x=A[0].field}}else x=w.project.items[0].field,w.project.items.length>1&&Be(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${b.stringValue(x)}.`);return`${w.name}[${b.stringValue(jt(x))}]`}function Ki(s,l,d){return Le(l,(h=>b.isString(h)?h:(function(y){return y==null?void 0:y.param})(h)?Eu(s,h,d):ef(h)))}function gs(s,l,d,h){s.encode??={},s.encode[l]??={},s.encode[l].update??={},s.encode[l].update[d]=h}function Xi(s,l,d){var H,X;let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{header:!1},{disable:y,orient:w,scale:x,labelExpr:A,title:C,zindex:L,...G}=s.combine();if(!y){for(let J in G){let le=Ef[J],te=G[J];if(le&&le!==l&&le!=="both")delete G[J];else if(su(te)){let{condition:pe,...ge}=te,xe=b.array(pe),me=ls[J];if(me){let{vgProp:Ae,part:Re}=me;gs(G,Re,Ae,[...xe.map((Pe=>{let{test:We,...Je}=Pe;return{test:Ki(null,We),...Je}})),ge]),delete G[J]}else if(me===null){let Ae={signal:xe.map((Re=>{let{test:Pe,...We}=Re;return`${Ki(null,Pe)} ? ${ns(We)} : `})).join("")+ns(ge)};G[J]=Ae}}else if(Ze(te)){let pe=ls[J];if(pe){let{vgProp:ge,part:xe}=pe;gs(G,xe,ge,te),delete G[J]}}Z(["labelAlign","labelBaseline"],J)&&G[J]===null&&delete G[J]}if(l==="grid"){if(!G.grid)return;if(G.encode){let{grid:J}=G.encode;G.encode={...J?{grid:J}:{}},ye(G.encode)&&delete G.encode}return{scale:x,orient:w,...G,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:Ke(L,0)}}{if(!h.header&&s.mainExtracted)return;if(A!==void 0){let le=A;(X=(H=G.encode)==null?void 0:H.labels)!=null&&X.update&&Ze(G.encode.labels.update.text)&&(le=St(A,"datum.label",G.encode.labels.update.text.signal)),gs(G,"labels","text",{signal:le})}if(G.labelAlign===null&&delete G.labelAlign,G.encode){for(let le of us)s.hasAxisPart(le)||delete G.encode[le];ye(G.encode)&&delete G.encode}let J=(function(le,te){if(le)return b.isArray(le)&&!fa(le)?le.map((pe=>yf(pe,te))).join(", "):le})(C,d);return{scale:x,orient:w,grid:!1,...J?{title:J}:{},...G,...d.aria===!1?{aria:!1}:{},zindex:Ke(L,0)}}}}function wu(s){let{axes:l}=s.component,d=[];for(let h of Qr)if(l[h]){for(let y of l[h])if(!y.get("disable")&&!y.get("gridScale")){let w=h==="x"?"height":"width",x=s.getSizeSignalRef(w).signal;w!==x&&d.push({name:w,update:x})}}return d}function di(s,l,d,h){return Object.assign.apply(null,[{},...s.map((y=>{if(y==="axisOrient"){let w=d==="x"?"bottom":"left",x=l[d==="x"?"axisBottom":"axisLeft"]||{},A=l[d==="x"?"axisTop":"axisRight"]||{},C=new Set([...be(x),...be(A)]),L={};for(let G of C.values())L[G]={signal:`${h.signal} === "${w}" ? ${pa(x[G])} : ${pa(A[G])}`};return L}return l[y]}))])}function f1(s,l){var h;let d=[{}];for(let y of s){let w=(h=l[y])==null?void 0:h.style;if(w){w=b.array(w);for(let x of w)d.push(l.style[x])}}return Object.assign.apply(null,d)}function og(s,l,d){var w;let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=N0(s,d,l);if(y!==void 0)return{configFrom:"style",configValue:y};for(let x of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((w=h[x])==null?void 0:w[s])!==void 0)return{configFrom:x,configValue:h[x][s]};return{}}let Hy={scale:s=>{let{model:l,channel:d}=s;return l.scaleName(d)},format:s=>{let{format:l}=s;return l},formatType:s=>{let{formatType:l}=s;return l},grid:s=>{let{fieldOrDatumDef:l,axis:d,scaleType:h}=s;return d.grid??(function(y,w){return!Hn(y)&&ze(w)&&!Vt(w==null?void 0:w.bin)&&!zn(w==null?void 0:w.bin)})(h,l)},gridScale:s=>{let{model:l,channel:d}=s;return(function(h,y){let w=y==="x"?"y":"x";if(h.getScaleComponent(w))return h.scaleName(w)})(l,d)},labelAlign:s=>{let{axis:l,labelAngle:d,orient:h,channel:y}=s;return l.labelAlign||Wy(d,h,y)},labelAngle:s=>{let{labelAngle:l}=s;return l},labelBaseline:s=>{let{axis:l,labelAngle:d,orient:h,channel:y}=s;return l.labelBaseline||qy(d,h,y)},labelFlush:s=>{let{axis:l,fieldOrDatumDef:d,channel:h}=s;return l.labelFlush??(function(y,w){if(w==="x"&&Z(["quantitative","temporal"],y))return!0})(d.type,h)},labelOverlap:s=>{let{axis:l,fieldOrDatumDef:d,scaleType:h}=s;return l.labelOverlap??(function(y,w,x,A){if(x&&!b.isObject(A)||y!=="nominal"&&y!=="ordinal")return w!=="log"&&w!=="symlog"||"greedy"})(d.type,h,ze(d)&&!!d.timeUnit,ze(d)?d.sort:void 0)},orient:s=>{let{orient:l}=s;return l},tickCount:s=>{let{channel:l,model:d,axis:h,fieldOrDatumDef:y,scaleType:w}=s,x=l==="x"?"width":l==="y"?"height":void 0,A=x?d.getSizeSignalRef(x):void 0;return h.tickCount??(function(C){var J;let{fieldOrDatumDef:L,scaleType:G,size:H,values:X}=C;if(!X&&!Hn(G)&&G!=="log"){if(ze(L)){if(Vt(L.bin))return{signal:`ceil(${H.signal}/10)`};if(L.timeUnit&&Z(["month","hours","day","quarter"],(J=jn(L.timeUnit))==null?void 0:J.unit))return}return{signal:`ceil(${H.signal}/40)`}}})({fieldOrDatumDef:y,scaleType:w,size:A,values:h.values})},tickMinStep:function(s){let{format:l,fieldOrDatumDef:d}=s;if(l==="d")return 1;if(ze(d)){let{timeUnit:h}=d;if(h){let y=H0(h);if(y)return{signal:y}}}},title:s=>{let{axis:l,model:d,channel:h}=s;if(l.title!==void 0)return l.title;let y=Vy(d,h);if(y!==void 0)return y;let w=d.typedFieldDef(h),x=h==="x"?"x2":"y2",A=d.fieldDef(x);return Wl(w?[Jh(w)]:[],ze(A)?[Jh(A)]:[])},values:s=>{let{axis:l,fieldOrDatumDef:d}=s;return(function(h,y){let w=h.values;if(b.isArray(w))return mc(y,w);if(Ze(w))return w})(l,d)},zindex:s=>{let{axis:l,fieldOrDatumDef:d,mark:h}=s;return l.zindex??(function(y,w){return y==="rect"&&au(w)?1:0})(h,d)}};function sg(s){return`(((${s.signal} % 360) + 360) % 360)`}function qy(s,l,d,h){if(s!==void 0){if(d==="x"){if(Ze(s)){let y=sg(s);return{signal:`(45 < ${y} && ${y} < 135) || (225 < ${y} && ${y} < 315) ? "middle" :(${y} <= 45 || 315 <= ${y}) === ${Ze(l)?`(${l.signal} === "top")`:l==="top"} ? "bottom" : "top"`}}if(45<s&&s<135||225<s&&s<315)return"middle";if(Ze(l)){let y=s<=45||315<=s?"===":"!==";return{signal:`${l.signal} ${y} "top" ? "bottom" : "top"`}}return(s<=45||315<=s)==(l==="top")?"bottom":"top"}if(Ze(s)){let y=sg(s);return{signal:`${y} <= 45 || 315 <= ${y} || (135 <= ${y} && ${y} <= 225) ? ${h?'"middle"':"null"} : (45 <= ${y} && ${y} <= 135) === ${Ze(l)?`(${l.signal} === "left")`:l==="left"} ? "top" : "bottom"`}}if(s<=45||315<=s||135<=s&&s<=225)return h?"middle":null;if(Ze(l)){let y=45<=s&&s<=135?"===":"!==";return{signal:`${l.signal} ${y} "left" ? "top" : "bottom"`}}return(45<=s&&s<=135)==(l==="left")?"top":"bottom"}}function Wy(s,l,d){if(s===void 0)return;let h=d==="x",y=h?0:90,w=h?"bottom":"left";if(Ze(s)){let x=sg(s);return{signal:`(${y?`(${x} + 90)`:x} % 180 === 0) ? ${h?null:'"center"'} :(${y} < ${x} && ${x} < ${180+y}) === ${Ze(l)?`(${l.signal} === "${w}")`:l===w} ? "left" : "right"`}}if((s+y)%180==0)return h?null:"center";if(Ze(l)){let x=y<s&&s<180+y?"===":"!==";return{signal:`${`${l.signal} ${x} "${w}"`} ? "left" : "right"`}}return(y<s&&s<180+y)==(l===w)?"left":"right"}function Vy(s,l){let d=l==="x"?"x2":"y2",h=s.fieldDef(l),y=s.fieldDef(d),w=h?h.title:void 0,x=y?y.title:void 0;return w&&x?ti(w,x):w||x||(w!==void 0?w:x!==void 0?x:void 0)}class ol extends qt{clone(){return new ol(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,at(this,"_dependentFields",void 0),this._dependentFields=rp(this.transform.calculate)}static parseAllForSortIndex(l,d){return d.forEachFieldDef(((h,y)=>{if($i(h)&&fc(h.sort)){let{field:w,timeUnit:x}=h,A=h.sort,C=A.map(((L,G)=>`${ef({field:w,timeUnit:x,equal:L})} ? ${G} : `)).join("")+A.length;l=new ol(l,{calculate:C,as:sl(h,y,{forAs:!0})})}})),l}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 ${ne(this.transform)}`}}function sl(s,l,d){return je(s,{prefix:l,suffix:"sort_index",...d??{}})}function Bc(s,l){return Z(["top","bottom"],l)?"column":Z(["left","right"],l)||s==="row"?"row":"column"}function Zi(s,l,d,h){let y=h==="row"?d.headerRow:h==="column"?d.headerColumn:d.headerFacet;return Ke((l||{})[s],y[s],d.header[s])}function Uc(s,l,d,h){let y={};for(let w of s){let x=Zi(w,l||{},d,h);x!==void 0&&(y[w]=x)}return y}let _u=["row","column"],zc=["header","footer"];function bs(s,l){let d=s.component.layoutHeaders[l].title,h=s.config?s.config:void 0,y=s.component.layoutHeaders[l].facetFieldDef?s.component.layoutHeaders[l].facetFieldDef:void 0,{titleAnchor:w,titleAngle:x,titleOrient:A}=Uc(["titleAnchor","titleAngle","titleOrient"],y.header,h,l),C=Bc(l,A),L=Lt(x);return{name:`${l}-title`,type:"group",role:`${C}-title`,title:{text:d,...l==="row"?{orient:"left"}:{},style:"guide-title",...lg(L,C),...Mn(C,L,w),...Gc(h,y,l,pm,Ec)}}}function Mn(s,l){switch(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"middle"){case"start":return{align:"left"};case"end":return{align:"right"}}let d=Wy(l,s==="row"?"left":"top",s==="row"?"y":"x");return d?{align:d}:{}}function lg(s,l){let d=qy(s,l==="row"?"left":"top",l==="row"?"y":"x",!0);return d?{baseline:d}:{}}function Yy(s,l){let d=s.component.layoutHeaders[l],h=[];for(let y of zc)if(d[y])for(let w of d[y]){let x=ll(s,l,y,d,w);x!=null&&h.push(x)}return h}function ip(s,l){let{sort:d}=s;return ii(d)?{field:je(d,{expr:"datum"}),order:d.order??"ascending"}:b.isArray(d)?{field:sl(s,l,{expr:"datum"}),order:"ascending"}:{field:je(s,{expr:"datum"}),order:d??"ascending"}}function xo(s,l,d){let{format:h,formatType:y,labelAngle:w,labelAnchor:x,labelOrient:A,labelExpr:C}=Uc(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],s.header,d,l),L=Vh({fieldOrDatumDef:s,format:h,formatType:y,expr:"parent",config:d}).signal,G=Bc(l,A);return{text:{signal:C?St(St(C,"datum.label",L),"datum.value",je(s,{expr:"parent"})):L},...l==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...lg(w,G),...Mn(G,w,x),...Gc(d,s,l,hm,wc)}}function ll(s,l,d,h,y){if(y){let w=null,{facetFieldDef:x}=h,A=s.config?s.config:void 0;if(x&&y.labels){let{labelOrient:H}=Uc(["labelOrient"],x.header,A,l);(l==="row"&&!Z(["top","bottom"],H)||l==="column"&&!Z(["left","right"],H))&&(w=xo(x,l,A))}let C=Ya(s)&&!Ql(s.facet),L=y.axes,G=(L==null?void 0:L.length)>0;if(w||G){let H=l==="row"?"height":"width";return{name:s.getName(`${l}_${d}`),type:"group",role:`${l}-${d}`,...h.facetFieldDef?{from:{data:s.getName(`${l}_domain`)},sort:ip(x,l)}:{},...G&&C?{from:{data:s.getName(`facet_domain_${l}`)}}:{},...w?{title:w}:{},...y.sizeSignal?{encode:{update:{[H]:y.sizeSignal}}}:{},...G?{axes:L}:{}}}}return null}let Ky={column:{start:0,end:1},row:{start:1,end:0}};function Xy(s,l){return Ky[l][s]}function Gc(s,l,d,h,y){let w={};for(let x of h){if(!y[x])continue;let A=Zi(x,l==null?void 0:l.header,s,d);A!==void 0&&(w[y[x]]=A)}return w}function pr(s){return[...jc(s,"width"),...jc(s,"height"),...jc(s,"childWidth"),...jc(s,"childHeight")]}function jc(s,l){let d=l==="width"?"x":"y",h=s.component.layoutSize.get(l);if(!h||h==="merged")return[];let y=s.getSizeSignalRef(l).signal;if(h==="step"){let w=s.getScaleComponent(d);if(w){let x=w.get("type"),A=w.get("range");if(Hn(x)&&go(A)){let C=s.scaleName(d);return Ya(s.parent)&&s.parent.component.resolve.scale[d]==="independent"?[Hc(C,A)]:[Hc(C,A),{name:y,update:op(C,w,`domain('${C}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if(h=="container"){let w=y.endsWith("width"),x=w?"containerSize()[0]":"containerSize()[1]",A=`isFinite(${x}) ? ${x} : ${ds(s.config.view,w?"width":"height")}`;return[{name:y,init:A,on:[{update:A,events:"window:resize"}]}]}return[{name:y,value:h}]}function Hc(s,l){let d=`${s}_step`;return Ze(l.step)?{name:d,update:l.step.signal}:{name:d,value:l.step}}function op(s,l,d){let h=l.get("type"),y=l.get("padding"),w=Ke(l.get("paddingOuter"),y),x=l.get("paddingInner");return x=h==="band"?x!==void 0?x:y:1,`bandspace(${d}, ${pa(x)}, ${pa(w)}) * ${s}_step`}function ug(s){return s==="childWidth"?"width":s==="childHeight"?"height":s}function cg(s,l){return be(s).reduce(((d,h)=>{let y=s[h];return{...d,...bu(l,y,h,(w=>on(w.value)))}}),{})}function dg(s,l){if(Ya(l))return s==="theta"?"independent":"shared";if(ws(l))return"shared";if(Ji(l))return un(s)||s==="theta"||s==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function sp(s,l){let d=s.scale[l],h=un(l)?"axis":"legend";return d==="independent"?(s[h][l]==="shared"&&Be((function(y){return`Setting the scale to be independent for "${y}" means we also have to set the guide (axis or legend) to be independent.`})(l)),"independent"):s[h][l]||"shared"}let fg=be({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 Zy extends ji{}let ul={symbols:function(s,l){let{fieldOrDatumDef:d,model:h,channel:y,legendCmpt:w,legendType:x}=l;if(x!=="symbol")return;let{markDef:A,encoding:C,config:L,mark:G}=h,H=A.filled&&G!=="trail",X={...Ud({},h,j_),...Mc(h,{filled:H})},J=w.get("symbolOpacity")??L.legend.symbolOpacity,le=w.get("symbolFillColor")??L.legend.symbolFillColor,te=w.get("symbolStrokeColor")??L.legend.symbolStrokeColor,pe=J===void 0?pg(C.opacity)??A.opacity:void 0;if(X.fill){if(y==="fill"||H&&y===Fe)delete X.fill;else if(X.fill.field)le?delete X.fill:(X.fill=on(L.legend.symbolBaseFillColor??"black"),X.fillOpacity=on(pe??1));else if(b.isArray(X.fill)){let ge=hg(C.fill??C.color)??A.fill??(H&&A.color);ge&&(X.fill=on(ge))}}if(X.stroke){if(y==="stroke"||!H&&y===Fe)delete X.stroke;else if(X.stroke.field||te)delete X.stroke;else if(b.isArray(X.stroke)){let ge=Ke(hg(C.stroke||C.color),A.stroke,H?A.color:void 0);ge&&(X.stroke={value:ge})}}if(y!==xi){let ge=ze(d)&&qc(h,w,d);ge?X.opacity=[{test:ge,...on(pe??1)},on(L.legend.unselectedOpacity)]:pe&&(X.opacity=on(pe))}return X={...X,...s},ye(X)?void 0:X},gradient:function(s,l){let{model:d,legendType:h,legendCmpt:y}=l;if(h!=="gradient")return;let{config:w,markDef:x,encoding:A}=d,C={},L=(y.get("gradientOpacity")??w.legend.gradientOpacity)===void 0?pg(A.opacity)||x.opacity:void 0;return L&&(C.opacity=on(L)),C={...C,...s},ye(C)?void 0:C},labels:function(s,l){let{fieldOrDatumDef:d,model:h,channel:y,legendCmpt:w}=l,x=h.legend(y)||{},A=h.config,C=ze(d)?qc(h,w,d):void 0,L=C?[{test:C,value:1},{value:A.legend.unselectedOpacity}]:void 0,{format:G,formatType:H}=x,X;Xs(H)?X=ri({fieldOrDatumDef:d,field:"datum.value",format:G,formatType:H,config:A}):G===void 0&&H===void 0&&A.customFormatTypes&&(d.type==="quantitative"&&A.numberFormatType?X=ri({fieldOrDatumDef:d,field:"datum.value",format:A.numberFormat,formatType:A.numberFormatType,config:A}):d.type==="temporal"&&A.timeFormatType&&ze(d)&&d.timeUnit===void 0&&(X=ri({fieldOrDatumDef:d,field:"datum.value",format:A.timeFormat,formatType:A.timeFormatType,config:A})));let J={...L?{opacity:L}:{},...X?{text:X}:{},...s};return ye(J)?void 0:J},entries:function(s,l){let{legendCmpt:d}=l,h=d.get("selections");return h!=null&&h.length?{...s,fill:{value:"transparent"}}:s}};function pg(s){return mg(s,((l,d)=>Math.max(l,d.value)))}function hg(s){return mg(s,((l,d)=>Ke(l,d.value)))}function mg(s,l){return(function(d){let h=d==null?void 0:d.condition;return!!h&&(b.isArray(h)||cr(h))})(s)?b.array(s.condition).reduce(l,s.value):cr(s)?s.value:void 0}function qc(s,l,d){let h=l.get("selections");if(!(h!=null&&h.length))return;let y=b.stringValue(d.field);return h.map((w=>`(!length(data(${b.stringValue($e(w)+ms)})) || (${w}[${y}] && indexof(${w}[${y}], datum.value) >= 0))`)).join(" || ")}let fi={direction:s=>{let{direction:l}=s;return l},format:s=>{let{fieldOrDatumDef:l,legend:d,config:h}=s,{format:y,formatType:w}=d;return ay(l,l.type,y,w,h,!1)},formatType:s=>{let{legend:l,fieldOrDatumDef:d,scaleType:h}=s,{formatType:y}=l;return ry(y,d,h)},gradientLength:s=>{let{legend:l,legendConfig:d}=s;return l.gradientLength??d.gradientLength??(function(h){let{legendConfig:y,model:w,direction:x,orient:A,scaleType:C}=h,{gradientHorizontalMaxLength:L,gradientHorizontalMinLength:G,gradientVerticalMaxLength:H,gradientVerticalMinLength:X}=y;if(Lr(C))return x==="horizontal"?A==="top"||A==="bottom"?lp(w,"width",G,L):G:lp(w,"height",X,H)})(s)},labelOverlap:s=>{let{legend:l,legendConfig:d,scaleType:h}=s;return l.labelOverlap??d.labelOverlap??(function(y){if(Z(["quantile","threshold","log","symlog"],y))return"greedy"})(h)},symbolType:s=>{let{legend:l,markDef:d,channel:h,encoding:y}=s;return l.symbolType??(function(w,x,A,C){if(x!=="shape"){let L=hg(A)??C;if(L)return L}switch(w){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"}})(d.type,h,y.shape,d.shape)},title:s=>{let{fieldOrDatumDef:l,config:d}=s;return ss(l,d,{allowDisabling:!0})},type:s=>{let{legendType:l,scaleType:d,channel:h}=s;if(es(h)&&Lr(d)){if(l==="gradient")return}else if(l==="symbol")return;return l},values:s=>{let{fieldOrDatumDef:l,legend:d}=s;return(function(h,y){let w=h.values;if(b.isArray(w))return mc(y,w);if(Ze(w))return w})(d,l)}};function gg(s){let{legend:l}=s;return Ke(l.type,(function(d){let{channel:h,timeUnit:y,scaleType:w}=d;if(es(h)){if(Z(["quarter","month","day"],y))return"symbol";if(Lr(w))return"gradient"}return"symbol"})(s))}function bg(s){let{legendConfig:l,legendType:d,orient:h,legend:y}=s;return y.direction??l[d?"gradientDirection":"symbolDirection"]??(function(w,x){switch(w){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return x==="gradient"?"horizontal":void 0}})(h,d)}function lp(s,l,d,h){return{signal:`clamp(${s.getSizeSignalRef(l).signal}, ${d}, ${h})`}}function up(s){let l=cn(s)?(function(d){let{encoding:h}=d,y={};for(let w of[Fe,...Rf]){let x=vn(h[w]);x&&d.getScaleComponent(w)&&(w===Sn&&ze(x)&&x.type===Vs||(y[w]=Ao(d,w)))}return y})(s):(function(d){let{legends:h,resolve:y}=d.component;for(let w of d.children){up(w);for(let x of be(w.component.legends))y.legend[x]=sp(d.component.resolve,x),y.legend[x]==="shared"&&(h[x]=yg(h[x],w.component.legends[x]),h[x]||(y.legend[x]="independent",delete h[x]))}for(let w of be(h))for(let x of d.children)x.component.legends[w]&&y.legend[w]==="shared"&&delete x.component.legends[w];return h})(s);return s.component.legends=l,l}function cp(s,l,d,h){switch(l){case"disable":return d!==void 0;case"values":return!!(d!=null&&d.values);case"title":if(l==="title"&&s===(h==null?void 0:h.title))return!0}return s===(d||{})[l]}function Ao(s,l){var me;let d=s.legend(l),{markDef:h,encoding:y,config:w}=s,x=w.legend,A=new Zy({},(function(Ae,Re){let Pe=Ae.scaleName(Re);if(Ae.mark==="trail"){if(Re==="color")return{stroke:Pe};if(Re==="size")return{strokeWidth:Pe}}return Re==="color"?Ae.markDef.filled?{fill:Pe}:{stroke:Pe}:{[Re]:Pe}})(s,l));(function(Ae,Re,Pe){var Je;let We=(Je=Ae.fieldDef(Re))==null?void 0:Je.field;for(let it of Te(Ae.component.selection??{})){let Qe=it.project.hasField[We]??it.project.hasChannel[Re];if(Qe&&Uy.defined(it)){let lt=Pe.get("selections")??[];lt.push(it.name),Pe.set("selections",lt,!1),Qe.hasLegend=!0}}})(s,l,A);let C=d!==void 0?!d:x.disable;if(A.set("disable",C,d!==void 0),C)return A;d=d||{};let L=s.getScaleComponent(l).get("type"),G=vn(y[l]),H=ze(G)?(me=jn(G.timeUnit))==null?void 0:me.unit:void 0,X=d.orient||w.legend.orient||"right",J=gg({legend:d,channel:l,timeUnit:H,scaleType:L}),le={legend:d,channel:l,model:s,markDef:h,encoding:y,fieldOrDatumDef:G,legendConfig:x,config:w,scaleType:L,orient:X,legendType:J,direction:bg({legend:d,legendType:J,orient:X,legendConfig:x})};for(let Ae of fg){if(J==="gradient"&&Ae.startsWith("symbol")||J==="symbol"&&Ae.startsWith("gradient"))continue;let Re=Ae in fi?fi[Ae](le):d[Ae];if(Re!==void 0){let Pe=cp(Re,Ae,d,s.fieldDef(l));(Pe||w.legend[Ae]===void 0)&&A.set(Ae,Re,Pe)}}let te=(d==null?void 0:d.encoding)??{},pe=A.get("selections"),ge={},xe={fieldOrDatumDef:G,model:s,channel:l,legendCmpt:A,legendType:J};for(let Ae of["labels","legend","title","symbols","gradient","entries"]){let Re=cg(te[Ae]??{},s),Pe=Ae in ul?ul[Ae](Re,xe):Re;Pe===void 0||ye(Pe)||(ge[Ae]={...pe!=null&&pe.length&&ze(G)?{name:`${$e(G.field)}_legend_${Ae}`}:{},...pe!=null&&pe.length?{interactive:!!pe}:{},update:Pe})}return ye(ge)||A.set("encode",ge,!!(d!=null&&d.encoding)),A}function yg(s,l){var w,x,A,C;if(!s)return l.clone();let d=s.getWithExplicit("orient"),h=l.getWithExplicit("orient");if(d.explicit&&h.explicit&&d.value!==h.value)return;let y=!1;for(let L of fg){let G=qi(s.getWithExplicit(L),l.getWithExplicit(L),L,"legend",((H,X)=>{switch(L){case"symbolType":return Jy(H,X);case"title":return ni(H,X);case"type":return y=!0,Fr("symbol")}return Rc(H,X,L,"legend")}));s.setWithExplicit(L,G)}return y&&((x=(w=s.implicit)==null?void 0:w.encode)!=null&&x.gradient&&dt(s.implicit,["encode","gradient"]),(C=(A=s.explicit)==null?void 0:A.encode)!=null&&C.gradient&&dt(s.explicit,["encode","gradient"])),s}function Jy(s,l){return l.value==="circle"?l:s}function dp(s){let l=s.component.legends,d={};for(let h of be(l)){let y=Xe(s.getScaleComponent(h).get("domains"));if(d[y])for(let w of d[y])yg(w,l[h])||d[y].push(l[h]);else d[y]=[l[h].clone()]}return Te(d).flat().map((h=>(function(y,w){var G,H,X;let{disable:x,labelExpr:A,selections:C,...L}=y.combine();if(!x){if(w.aria===!1&&L.aria==null&&(L.aria=!1),(G=L.encode)!=null&&G.symbols){let J=L.encode.symbols.update;!J.fill||J.fill.value==="transparent"||J.stroke||L.stroke||(J.stroke={value:"transparent"});for(let le of Rf)L[le]&&delete J[le]}if(L.title||delete L.title,A!==void 0){let J=A;(X=(H=L.encode)==null?void 0:H.labels)!=null&&X.update&&Ze(L.encode.labels.update.text)&&(J=St(A,"datum.label",L.encode.labels.update.text.signal)),(function(le,te,pe,ge){le.encode??={},le.encode[te]??={},le.encode[te].update??={},le.encode[te].update[pe]=ge})(L,"labels","text",{signal:J})}return L}})(h,s.config))).filter((h=>h!==void 0))}function vg(s){return ws(s)||Ji(s)?(function(l){return l.children.reduce(((d,h)=>d.concat(h.assembleProjections())),Wc(l))})(s):Wc(s)}function Wc(s){let l=s.component.projection;if(!l||l.merged)return[];let d=l.combine(),{name:h}=d;if(l.data){let y={signal:`[${l.size.map((x=>x.signal)).join(", ")}]`},w=l.data.reduce(((x,A)=>{let C=Ze(A)?A.signal:`data('${s.lookupDataSource(A)}')`;return Z(x,C)||x.push(C),x}),[]);if(w.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:h,size:y,fit:{signal:w.length>1?`[${w.join(", ")}]`:w[0]},...d}]}return[{name:h,translate:{signal:"[width / 2, height / 2]"},...d}]}let Vc=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class Eg extends ji{constructor(l,d,h,y){super({...d},{name:l}),this.specifiedProjection=d,this.size=h,this.data=y,at(this,"merged",!1)}get isFit(){return!!this.data}}function wg(s){s.component.projection=cn(s)?(function(l){if(l.hasProjection){let d=ea(l.specifiedProjection),h=!(d&&(d.scale!=null||d.translate!=null)),y=h?[l.getSizeSignalRef("width"),l.getSizeSignalRef("height")]:void 0,w=h?(function(A){let C=[],{encoding:L}=A;for(let G of[[$a,nt],[rr,da]])(vn(L[G[0]])||vn(L[G[1]]))&&C.push({signal:A.getName(`geojson_${C.length}`)});return A.channelHasField(Sn)&&A.typedFieldDef(Sn).type===Vs&&C.push({signal:A.getName(`geojson_${C.length}`)}),C.length===0&&C.push(A.requestDataName(nn.Main)),C})(l):void 0,x=new Eg(l.projectionName(!0),{...ea(l.config.projection)??{},...d??{}},y,w);return x.get("type")||x.set("type","equalEarth",!1),x}})(s):(function(l){if(l.children.length===0)return;let d;for(let y of l.children)wg(y);let h=oe(l.children,(y=>{let w=y.component.projection;if(w){if(d){let x=(function(A,C){let L=oe(Vc,(G=>!b.hasOwnProperty(A.explicit,G)&&!b.hasOwnProperty(C.explicit,G)||!!(b.hasOwnProperty(A.explicit,G)&&b.hasOwnProperty(C.explicit,G)&&Ie(A.get(G),C.get(G)))));if(Ie(A.size,C.size)){if(L)return A;if(Ie(A.explicit,{}))return C;if(Ie(C.explicit,{}))return A}return null})(d,w);return x&&(d=x),!!x}return d=w,!0}return!0}));if(d&&h){let y=l.projectionName(!0),w=new Eg(y,d.specifiedProjection,d.size,j(d.data));for(let x of l.children){let A=x.component.projection;A&&(A.isFit&&w.data.push(...x.component.projection.data),x.renameProjection(A.get("name"),y),A.merged=!0)}return w}})(s)}function Qy(s,l,d,h){if(ou(l,d)){let y=cn(s)?s.axis(d)??s.legend(d)??{}:{},w=je(l,{expr:"datum"}),x=je(l,{expr:"datum",binSuffix:"end"});return{formulaAs:je(l,{binSuffix:"range",forAs:!0}),formula:yo(w,x,y.format,y.formatType,h)}}return{}}function fp(s,l){return`${Oi(s)}_${l}`}function To(s,l,d){let h=fp(rt(d,void 0)??{},l);return s.getName(`${h}_bins`)}function _g(s,l,d){let h,y;h=(function(L){return"as"in L})(s)?b.isString(s.as)?[s.as,`${s.as}_end`]:[s.as[0],s.as[1]]:[je(s,{forAs:!0}),je(s,{binSuffix:"end",forAs:!0})];let w={...rt(l,void 0)},x=fp(w,s.field),{signal:A,extentSignal:C}=(function(L,G){return{signal:L.getName(`${G}_bins`),extentSignal:L.getName(`${G}_extent`)}})(d,x);if(Or(w.extent)){let L=w.extent;y=So(d,L.param,L),delete w.extent}return{key:x,binComponent:{bin:w,field:s.field,as:[h],...A?{signal:A}:{},...C?{extentSignal:C}:{},...y?{span:y}:{}}}}class pi extends qt{clone(){return new pi(null,j(this.bins))}constructor(l,d){super(l),this.bins=d}static makeFromEncoding(l,d){let h=d.reduceFieldDef(((y,w,x)=>{if(ma(w)&&Vt(w.bin)){let{key:A,binComponent:C}=_g(w,w.bin,d);y[A]={...C,...y[A],...Qy(d,w,x,d.config)}}return y}),{});return ye(h)?null:new pi(l,h)}static makeFromTransform(l,d,h){let{key:y,binComponent:w}=_g(d,d.bin,h);return new pi(l,{[y]:w})}merge(l,d){for(let h of be(l.bins))h in this.bins?(d(l.bins[h].signal,this.bins[h].signal),this.bins[h].as=_e([...this.bins[h].as,...l.bins[h].as],ne)):this.bins[h]=l.bins[h];for(let h of l.children)l.removeChild(h),h.parent=this;l.remove()}producedFields(){return new Set(Te(this.bins).map((l=>l.as)).flat(2))}dependentFields(){return new Set(Te(this.bins).map((l=>l.field)))}hash(){return`Bin ${ne(this.bins)}`}assemble(){return Te(this.bins).flatMap((l=>{let d=[],[h,...y]=l.as,{extent:w,...x}=l.bin,A={type:"bin",field:jt(l.field),as:h,signal:l.signal,...Or(w)?{extent:null}:{extent:w},...l.span?{span:{signal:`span(${l.span})`}}:{},...x};!w&&l.extentSignal&&(d.push({type:"extent",field:jt(l.field),signal:l.extentSignal}),A.extent={signal:l.extentSignal}),d.push(A);for(let C of y)for(let L=0;L<2;L++)d.push({type:"formula",expr:je({field:h[L]},{expr:"datum"}),as:C[L]});return l.formula&&d.push({type:"formula",expr:l.formula,as:l.formulaAs}),d}))}}function ev(s,l,d,h){var w;let y=cn(h)?h.encoding[Ci(l)]:void 0;if(ma(d)&&cn(h)&&pf(d,y,h.markDef,h.config)){s.add(je(d,{})),s.add(je(d,{suffix:"end"}));let{mark:x,markDef:A,config:C}=h,L=Fi({fieldDef:d,markDef:A,config:C});cc(x)&&L!==.5&&un(l)&&(s.add(je(d,{suffix:Xf})),s.add(je(d,{suffix:$t}))),d.bin&&ou(d,l)&&s.add(je(d,{binSuffix:"range"}))}else if(Qo(l)){let x=gh(l);s.add(h.getName(x))}else s.add(je(d));return $i(d)&&(function(x){return b.isObject(x)&&"field"in x})((w=d.scale)==null?void 0:w.range)&&s.add(d.scale.range.field),s}class Va extends qt{clone(){return new Va(null,new Set(this.dimensions),j(this.measures))}constructor(l,d,h){super(l),this.dimensions=d,this.measures=h}get groupBy(){return this.dimensions}static makeFromEncoding(l,d){let h=!1;d.forEachFieldDef((x=>{x.aggregate&&(h=!0)}));let y={},w=new Set;return h?(d.forEachFieldDef(((x,A)=>{let{aggregate:C,field:L}=x;if(C)if(C==="count")y["*"]??={},y["*"].count=new Set([je(x,{forAs:!0})]);else{if(ei(C)||Ni(C)){let G=ei(C)?"argmin":"argmax",H=C[G];y[H]??={},y[H][G]=new Set([je({op:G,field:H},{forAs:!0})])}else y[L]??={},y[L][C]=new Set([je(x,{forAs:!0})]);Nr(A)&&d.scaleDomain(A)==="unaggregated"&&(y[L]??={},y[L].min=new Set([je({field:L,aggregate:"min"},{forAs:!0})]),y[L].max=new Set([je({field:L,aggregate:"max"},{forAs:!0})]))}else ev(w,A,x,d)})),w.size+be(y).length===0?null:new Va(l,w,y)):null}static makeFromTransform(l,d){let h=new Set,y={};for(let w of d.aggregate){let{op:x,field:A,as:C}=w;x&&(x==="count"?(y["*"]??={},y["*"].count=new Set([C||je(w,{forAs:!0})])):(y[A]??={},y[A][x]=new Set([C||je(w,{forAs:!0})])))}for(let w of d.groupby??[])h.add(w);return h.size+be(y).length===0?null:new Va(l,h,y)}merge(l){return Ce(this.dimensions,l.dimensions)?((function(d,h){for(let y of be(h)){let w=h[y];for(let x of be(w))y in d?d[y][x]=new Set([...d[y][x]??[],...w[x]]):d[y]={[x]:w[x]}}})(this.measures,l.measures),!0):((function(){ic.debug(...arguments)})("different dimensions, cannot merge"),!1)}addDimensions(l){l.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...be(this.measures)])}producedFields(){let l=new Set;for(let d of be(this.measures))for(let h of be(this.measures[d])){let y=this.measures[d][h];y.size===0?l.add(`${h}_${d}`):y.forEach(l.add,l)}return l}hash(){return`Aggregate ${ne({dimensions:this.dimensions,measures:this.measures})}`}assemble(){let l=[],d=[],h=[];for(let y of be(this.measures))for(let w of be(this.measures[y]))for(let x of this.measures[y][w])h.push(x),l.push(w),d.push(y==="*"?null:jt(y));return{type:"aggregate",groupby:[...this.dimensions].map(jt),ops:l,fields:d,as:h}}}class cl extends qt{constructor(l,d,h,y){super(l),this.model=d,this.name=h,this.data=y,at(this,"column",void 0),at(this,"row",void 0),at(this,"facet",void 0),at(this,"childModel",void 0);for(let w of Ua){let x=d.facet[w];if(x){let{bin:A,sort:C}=x;this[w]={name:d.getName(`${w}_domain`),fields:[je(x),...Vt(A)?[je(x,{binSuffix:"end"})]:[]],...ii(C)?{sortField:C}:b.isArray(C)?{sortIndexField:sl(x,w)}:{}}}}this.childModel=d.child}hash(){let l="Facet";for(let d of Ua)this[d]&&(l+=` ${d.charAt(0)}:${ne(this[d])}`);return l}get fields(){var d;let l=[];for(let h of Ua)(d=this[h])!=null&&d.fields&&l.push(...this[h].fields);return l}dependentFields(){let l=new Set(this.fields);for(let d of Ua)this[d]&&(this[d].sortField&&l.add(this[d].sortField.field),this[d].sortIndexField&&l.add(this[d].sortIndexField));return l}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){let l={};for(let d of Qr){let h=this.childModel.component.scales[d];if(h&&!h.merged){let y=h.get("type"),w=h.get("range");if(Hn(y)&&go(w)){let x=Rg(Es(this.childModel,d));x?l[d]=x:Be(ha(d))}}}return l}assembleRowColumnHeaderData(l,d,h){let y={row:"y",column:"x",facet:void 0}[l],w=[],x=[],A=[];y&&h&&h[y]&&(d?(w.push(`distinct_${h[y]}`),x.push("max")):(w.push(h[y]),x.push("distinct")),A.push(`distinct_${h[y]}`));let{sortField:C,sortIndexField:L}=this[l];if(C){let{op:G=dc,field:H}=C;w.push(H),x.push(G),A.push(je(C,{forAs:!0}))}else L&&(w.push(L),x.push("max"),A.push(L));return{name:this[l].name,source:d??this.data,transform:[{type:"aggregate",groupby:this[l].fields,...w.length?{fields:w,ops:x,as:A}:{}}]}}assembleFacetHeaderData(l){var C;let{columns:d}=this.model.layout,{layoutHeaders:h}=this.model.component,y=[],w={};for(let L of _u){for(let G of zc){let H=(h[L]&&h[L][G])??[];for(let X of H)if(((C=X.axes)==null?void 0:C.length)>0){w[L]=!0;break}}if(w[L]){let G=`length(data("${this.facet.name}"))`,H=L==="row"?d?{signal:`ceil(${G} / ${d})`}:1:d?{signal:`min(${G}, ${d})`}:{signal:G};y.push({name:`${this.facet.name}_${L}`,transform:[{type:"sequence",start:0,stop:H}]})}}let{row:x,column:A}=w;return(x||A)&&y.unshift(this.assembleRowColumnHeaderData("facet",null,l)),y}assemble(){let l=[],d=null,h=this.getChildIndependentFieldsWithStep(),{column:y,row:w,facet:x}=this;if(y&&w&&(h.x||h.y)){d=`cross_${this.column.name}_${this.row.name}`;let A=[].concat(h.x??[],h.y??[]),C=A.map((()=>"distinct"));l.push({name:d,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:A,ops:C}]})}for(let A of[Kr,tt])this[A]&&l.push(this.assembleRowColumnHeaderData(A,d,h));if(x){let A=this.assembleFacetHeaderData(h);A&&l.push(...A)}return l}}function Yc(s){return s.startsWith("'")&&s.endsWith("'")||s.startsWith('"')&&s.endsWith('"')?s.slice(1,-1):s}function p1(s){let l={};return P(s.filter,(d=>{if(Vl(d)){let h=null;Zd(d)?h=Gn(d.equal):qs(d)?h=Gn(d.lte):Hs(d)?h=Gn(d.lt):Ws(d)?h=Gn(d.gt):Ph(d)?h=Gn(d.gte):Jd(d)?h=d.range[0]:Qd(d)&&(h=(d.oneOf??d.in)[0]),h&&(Gs(h)?l[d.field]="date":b.isNumber(h)?l[d.field]="number":b.isString(h)&&(l[d.field]="string")),d.timeUnit&&(l[d.field]="date")}})),l}function Yn(s){let l={};function d(h){var y;It(h)?l[h.field]="date":h.type==="quantitative"&&(y=h.aggregate,b.isString(y)&&Z(["min","max"],y))?l[h.field]="number":Xt(h.field)>1?h.field in l||(l[h.field]="flatten"):$i(h)&&ii(h.sort)&&Xt(h.sort.field)>1&&(h.sort.field in l||(l[h.sort.field]="flatten"))}if((cn(s)||Ya(s))&&s.forEachFieldDef(((h,y)=>{if(ma(h))d(h);else{let w=Us(y),x=s.fieldDef(w);d({...h,type:x.type})}})),cn(s)){let{mark:h,markDef:y,encoding:w}=s;if(is(h)&&!s.encoding.order){let x=w[y.orient==="horizontal"?"y":"x"];ze(x)&&x.type==="quantitative"&&!(x.field in l)&&(l[x.field]="number")}}return l}class Kn extends qt{clone(){return new Kn(null,j(this._parse))}constructor(l,d){super(l),at(this,"_parse",void 0),this._parse=d}hash(){return`Parse ${ne(this._parse)}`}static makeExplicit(l,d,h){var x;let y={},w=d.data;return!Eo(w)&&((x=w==null?void 0:w.format)!=null&&x.parse)&&(y=w.format.parse),this.makeWithAncestors(l,y,{},h)}static makeWithAncestors(l,d,h,y){for(let A of be(h)){let C=y.getWithExplicit(A);C.value!==void 0&&(C.explicit||C.value===h[A]||C.value==="derived"||h[A]==="flatten"?delete h[A]:Be(Dr(A,h[A],C.value)))}for(let A of be(d)){let C=y.get(A);C!==void 0&&(C===d[A]?delete d[A]:Be(Dr(A,d[A],C)))}let w=new ji(d,h);y.copyAll(w);let x={};for(let A of be(w.combine())){let C=w.get(A);C!==null&&(x[A]=C)}return be(x).length===0||y.parseNothing?null:new Kn(l,x)}get parse(){return this._parse}merge(l){this._parse={...this._parse,...l.parse},l.remove()}assembleFormatParse(){let l={};for(let d of be(this._parse)){let h=this._parse[d];Xt(d)===1&&(l[d]=h)}return l}producedFields(){return new Set(be(this._parse))}dependentFields(){return new Set(be(this._parse))}assembleTransforms(){let l=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return be(this._parse).filter((d=>!l||Xt(d)>1)).map((d=>{let h=(function(y,w){let x=xt(y);return w==="number"?`toNumber(${x})`:w==="boolean"?`toBoolean(${x})`:w==="string"?`toString(${x})`:w==="date"?`toDate(${x})`:w==="flatten"?x:w.startsWith("date:")?`timeParse(${x},'${Yc(w.slice(5,w.length))}')`:w.startsWith("utc:")?`utcParse(${x},'${Yc(w.slice(4,w.length))}')`:(Be(`Unrecognized parse "${w}".`),null)})(d,this._parse[d]);return h?{type:"formula",expr:h,as:Tt(d)}:null})).filter((d=>d!==null))}}class Co extends qt{clone(){return new Co(null)}constructor(l){super(l)}dependentFields(){return new Set}producedFields(){return new Set([fr])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:fr}}}class Kc extends qt{clone(){return new Kc(null,this.params)}constructor(l,d){super(l),this.params=d}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${ne(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class Xc extends qt{clone(){return new Xc(null,this.params)}constructor(l,d){super(l),this.params=d}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${ne(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class Ro extends qt{constructor(l){let d;if(super(null),at(this,"_data",void 0),at(this,"_name",void 0),at(this,"_generator",void 0),l??={name:"source"},Eo(l)||(d=l.format?{...ee(l.format,["parse"])}:{}),mu(l))this._data={values:l.values};else if(fs(l)){if(this._data={url:l.url},!d.type){let h=/(?:\.([^.]+))?$/.exec(l.url)[1];Z(["json","csv","tsv","dsv","topojson"],h)||(h="json"),d.type=h}}else Vf(l)?this._data={values:[{type:"Sphere"}]}:(qf(l)||Eo(l))&&(this._data={});this._generator=Eo(l),l.name&&(this._name=l.name),d&&!ye(d)&&(this._data.format=d)}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(l){this._name=l}set parent(l){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 pp(s){return s instanceof Ro||s instanceof Kc||s instanceof Xc}var Zc=new WeakMap;class hp{constructor(){C_(this,Zc,{writable:!0,value:void 0}),I0(this,Zc,!1)}setModified(){I0(this,Zc,!0)}get modifiedFlag(){return(function(d,h){return h.get?h.get.call(d):h.value})(l=this,O0(l,Zc,"get"));var l}}class sa extends hp{getNodeDepths(l,d,h){h.set(l,d);for(let y of l.children)this.getNodeDepths(y,d+1,h);return h}optimize(l){let d=[...this.getNodeDepths(l,0,new Map).entries()].sort(((h,y)=>y[1]-h[1]));for(let h of d)this.run(h[0]);return this.modifiedFlag}}class mp extends hp{optimize(l){this.run(l);for(let d of l.children)this.optimize(d);return this.modifiedFlag}}class kg extends mp{mergeNodes(l,d){let h=d.shift();for(let y of d)l.removeChild(y),y.parent=h,y.remove()}run(l){let d=l.children.map((y=>y.hash())),h={};for(let y=0;y<d.length;y++)h[d[y]]===void 0?h[d[y]]=[l.children[y]]:h[d[y]].push(l.children[y]);for(let y of be(h))h[y].length>1&&(this.setModified(),this.mergeNodes(l,h[y]))}}class Sg extends mp{constructor(l){super(),at(this,"requiresSelectionId",void 0),this.requiresSelectionId=l&&ig(l)}run(l){l instanceof Co&&(this.requiresSelectionId&&(pp(l.parent)||l.parent instanceof Va||l.parent instanceof Kn)||(this.setModified(),l.remove()))}}class tv extends hp{optimize(l){return this.run(l,new Set),this.modifiedFlag}run(l,d){let h=new Set;l instanceof Wi&&(h=l.producedFields(),Me(h,d)&&(this.setModified(),l.removeFormulas(d),l.producedFields.length===0&&l.remove()));for(let y of l.children)this.run(y,new Set([...d,...h]))}}class ys extends mp{constructor(){super()}run(l){l instanceof ia&&!l.isRequired()&&(this.setModified(),l.remove())}}class Jc extends sa{run(l){if(!(pp(l)||l.numChildren()>1)){for(let d of l.children)if(d instanceof Kn)if(l instanceof Kn)this.setModified(),l.merge(d);else{if(Ee(l.producedFields(),d.dependentFields()))continue;this.setModified(),d.swapWithParent()}}}}class gp extends sa{run(l){let d=[...l.children],h=l.children.filter((y=>y instanceof Kn));if(l.numChildren()>1&&h.length>=1){let y={},w=new Set;for(let x of h){let A=x.parse;for(let C of be(A))C in y?y[C]!==A[C]&&w.add(C):y[C]=A[C]}for(let x of w)delete y[x];if(!ye(y)){this.setModified();let x=new Kn(l,y);for(let A of d){if(A instanceof Kn)for(let C of be(y))delete A.parse[C];l.removeChild(A),A.parent=x,A instanceof Kn&&be(A.parse).length===0&&A.remove()}}}}}class nv extends sa{run(l){l instanceof ia||l.numChildren()>0||l instanceof cl||l instanceof Ro||(this.setModified(),l.remove())}}class xg extends sa{run(l){let d=l.children.filter((y=>y instanceof Wi)),h=d.pop();for(let y of d)this.setModified(),h.merge(y)}}class av extends sa{run(l){let d=l.children.filter((y=>y instanceof Va)),h={};for(let y of d){let w=ne(y.groupBy);w in h||(h[w]=[]),h[w].push(y)}for(let y of be(h)){let w=h[y];if(w.length>1){let x=w.pop();for(let A of w)x.merge(A)&&(l.removeChild(A),A.parent=x,A.remove(),this.setModified())}}}}class rv extends sa{constructor(l){super(),this.model=l}run(l){let d=!(pp(l)||l instanceof ci||l instanceof Kn||l instanceof Co),h=[],y=[];for(let w of l.children)w instanceof pi&&(d&&!Ee(l.producedFields(),w.dependentFields())?h.push(w):y.push(w));if(h.length>0){let w=h.pop();for(let x of h)w.merge(x,this.model.renameSignal.bind(this.model));this.setModified(),l instanceof pi?l.merge(w,this.model.renameSignal.bind(this.model)):w.swapWithParent()}if(y.length>1){let w=y.pop();for(let x of y)w.merge(x,this.model.renameSignal.bind(this.model));this.setModified()}}}class h1 extends sa{run(l){let d=[...l.children];if(!ae(d,(w=>w instanceof ia))||l.numChildren()<=1)return;let h=[],y;for(let w of d)if(w instanceof ia){let x=w;for(;x.numChildren()===1;){let[A]=x.children;if(!(A instanceof ia))break;x=A}h.push(...x.children),y?(l.removeChild(w),w.parent=y.parent,y.parent.removeChild(y),y.parent=x,this.setModified()):y=x}else h.push(w);if(h.length){this.setModified();for(let w of h)w.parent.removeChild(w),w.parent=y}}}class dl extends qt{clone(){return new dl(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}addDimensions(l){this.transform.groupby=_e(this.transform.groupby.concat(l),(d=>d))}dependentFields(){let l=new Set;return this.transform.groupby&&this.transform.groupby.forEach(l.add,l),this.transform.joinaggregate.map((d=>d.field)).filter((d=>d!==void 0)).forEach(l.add,l),l}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(l){return l.as??je(l)}hash(){return`JoinAggregateTransform ${ne(this.transform)}`}assemble(){let l=[],d=[],h=[];for(let w of this.transform.joinaggregate)d.push(w.op),h.push(this.getDefaultName(w)),l.push(w.field===void 0?null:w.field);let y=this.transform.groupby;return{type:"joinaggregate",as:h,ops:d,fields:l,...y!==void 0?{groupby:y}:{}}}}class No extends qt{clone(){return new No(null,j(this._stack))}constructor(l,d){super(l),at(this,"_stack",void 0),this._stack=d}static makeFromTransform(l,d){let{stack:h,groupby:y,as:w,offset:x="zero"}=d,A=[],C=[];if(d.sort!==void 0)for(let H of d.sort)A.push(H.field),C.push(Ke(H.order,"ascending"));let L={field:A,order:C},G;return G=(function(H){return b.isArray(H)&&H.every((X=>b.isString(X)))&&H.length>1})(w)?w:b.isString(w)?[w,`${w}_end`]:[`${d.stack}_start`,`${d.stack}_end`],new No(l,{dimensionFieldDefs:[],stackField:h,groupby:y,offset:x,sort:L,facetby:[],as:G})}static makeFromEncoding(l,d){let h=d.stack,{encoding:y}=d;if(!h)return null;let{groupbyChannels:w,fieldChannel:x,offset:A,impute:C}=h,L=w.map((J=>dr(y[J]))).filter((J=>!!J)),G=(function(J){return J.stack.stackBy.reduce(((le,te)=>{let pe=je(te.fieldDef);return pe&&le.push(pe),le}),[])})(d),H=d.encoding.order,X;if(b.isArray(H)||ze(H))X=ql(H);else{let J=iy(H)?H.sort:x==="y"?"descending":"ascending";X=G.reduce(((le,te)=>(le.field.push(te),le.order.push(J),le)),{field:[],order:[]})}return new No(l,{dimensionFieldDefs:L,stackField:d.vgField(x),facetby:[],stackby:G,sort:X,offset:A,impute:C,as:[d.vgField(x,{suffix:"start",forAs:!0}),d.vgField(x,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(l){this._stack.facetby.push(...l)}dependentFields(){let l=new Set;return l.add(this._stack.stackField),this.getGroupbyFields().forEach(l.add,l),this._stack.facetby.forEach(l.add,l),this._stack.sort.field.forEach(l.add,l),l}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${ne(this._stack)}`}getGroupbyFields(){let{dimensionFieldDefs:l,impute:d,groupby:h}=this._stack;return l.length>0?l.map((y=>y.bin?d?[je(y,{binSuffix:"mid"})]:[je(y,{}),je(y,{binSuffix:"end"})]:[je(y)])).flat():h??[]}assemble(){let l=[],{facetby:d,dimensionFieldDefs:h,stackField:y,stackby:w,sort:x,offset:A,impute:C,as:L}=this._stack;if(C)for(let G of h){let{bandPosition:H=.5,bin:X}=G;if(X){let J=je(G,{expr:"datum"}),le=je(G,{expr:"datum",binSuffix:"end"});l.push({type:"formula",expr:`${H}*${J}+${1-H}*${le}`,as:je(G,{binSuffix:"mid",forAs:!0})})}l.push({type:"impute",field:y,groupby:[...w,...d],key:je(G,{binSuffix:"mid"}),method:"value",value:0})}return l.push({type:"stack",groupby:[...this.getGroupbyFields(),...d],field:y,sort:x,as:L,offset:A}),l}}class fl extends qt{clone(){return new fl(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}addDimensions(l){this.transform.groupby=_e(this.transform.groupby.concat(l),(d=>d))}dependentFields(){let l=new Set;return(this.transform.groupby??[]).forEach(l.add,l),(this.transform.sort??[]).forEach((d=>l.add(d.field))),this.transform.window.map((d=>d.field)).filter((d=>d!==void 0)).forEach(l.add,l),l}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(l){return l.as??je(l)}hash(){return`WindowTransform ${ne(this.transform)}`}assemble(){let l=[],d=[],h=[],y=[];for(let H of this.transform.window)d.push(H.op),h.push(this.getDefaultName(H)),y.push(H.param===void 0?null:H.param),l.push(H.field===void 0?null:H.field);let w=this.transform.frame,x=this.transform.groupby;if(w&&w[0]===null&&w[1]===null&&d.every((H=>xn(H))))return{type:"joinaggregate",as:h,ops:d,fields:l,...x!==void 0?{groupby:x}:{}};let A=[],C=[];if(this.transform.sort!==void 0)for(let H of this.transform.sort)A.push(H.field),C.push(H.order??"ascending");let L={field:A,order:C},G=this.transform.ignorePeers;return{type:"window",params:y,as:h,ops:d,fields:l,sort:L,...G!==void 0?{ignorePeers:G}:{},...x!==void 0?{groupby:x}:{},...w!==void 0?{frame:w}:{}}}}function Ag(s){if(s instanceof cl)if(s.numChildren()!==1||s.children[0]instanceof ia){let d=s.model.component.data.main;Tg(d);let h=(l=s,function w(x){if(!(x instanceof cl)){let A=x.clone();if(A instanceof ia){let C=Cg+A.getSource();A.setSource(C),l.model.component.data.outputNodes[C]=A}else(A instanceof Va||A instanceof No||A instanceof fl||A instanceof dl)&&A.addDimensions(l.fields);for(let C of x.children.flatMap(w))C.parent=A;return[A]}return x.children.flatMap(w)}),y=s.children.map(h).flat();for(let w of y)w.parent=d}else{let d=s.children[0];(d instanceof Va||d instanceof No||d instanceof fl||d instanceof dl)&&d.addDimensions(s.fields),d.swapWithParent(),Ag(s)}else s.children.map(Ag);var l}function Tg(s){if(s instanceof ia&&s.type===nn.Main&&s.numChildren()===1){let l=s.children[0];l instanceof cl||(l.swapWithParent(),Tg(s))}}let Cg="scale_",bp=5;function yp(s){for(let l of s){for(let d of l.children)if(d.parent!==l)return!1;if(!yp(l.children))return!1}return!0}function hi(s,l){let d=!1;for(let h of l)d=s.optimize(h)||d;return d}function iv(s,l,d){let h=s.sources,y=!1;return y=hi(new ys,h)||y,y=hi(new Sg(l),h)||y,h=h.filter((w=>w.numChildren()>0)),y=hi(new nv,h)||y,h=h.filter((w=>w.numChildren()>0)),d||(y=hi(new Jc,h)||y,y=hi(new rv(l),h)||y,y=hi(new tv,h)||y,y=hi(new gp,h)||y,y=hi(new av,h)||y,y=hi(new xg,h)||y,y=hi(new kg,h)||y,y=hi(new h1,h)||y),s.sources=h,y}class Ln{constructor(l){at(this,"signal",void 0),Object.defineProperty(this,"signal",{enumerable:!0,get:l})}static fromName(l,d){return new Ln((()=>l(d)))}}function ov(s){cn(s)?(function(l){let d=l.component.scales;for(let h of be(d)){let y=m1(l,h);if(d[h].setWithExplicit("domains",y),sv(l,h),l.component.data.isFaceted){let w=l;for(;!Ya(w)&&w.parent;)w=w.parent;if(w.component.resolve.scale[h]==="shared")for(let x of y.value)Aa(x)&&(x.data=Cg+x.data.replace(Cg,""))}}})(s):(function(l){for(let h of l.children)ov(h);let d=l.component.scales;for(let h of be(d)){let y,w=null;for(let x of l.children){let A=x.component.scales[h];if(A){y=y===void 0?A.getWithExplicit("domains"):qi(y,A.getWithExplicit("domains"),"domains","scale",td);let C=A.get("selectionExtent");w&&C&&w.param!==C.param&&Be(lr),w=C}}d[h].setWithExplicit("domains",y),w&&d[h].set("selectionExtent",w,!0)}})(s)}function m1(s,l){let d=s.getScaleComponent(l).get("type"),{encoding:h}=s,y=(function(w,x,A,C){if(w==="unaggregated"){let{valid:L,reason:G}=Ia(x,A);if(!L)return void Be(G)}else if(w===void 0&&C.useUnaggregatedDomain){let{valid:L}=Ia(x,A);if(L)return"unaggregated"}return w})(s.scaleDomain(l),s.typedFieldDef(l),d,s.config.scale);return y!==s.scaleDomain(l)&&(s.specifiedScales[l]={...s.specifiedScales[l],domain:y}),l==="x"&&vn(h.x2)?vn(h.x)?qi(vs(d,y,s,"x"),vs(d,y,s,"x2"),"domain","scale",td):vs(d,y,s,"x2"):l==="y"&&vn(h.y2)?vn(h.y)?qi(vs(d,y,s,"y"),vs(d,y,s,"y2"),"domain","scale",td):vs(d,y,s,"y2"):vs(d,y,s,l)}function Qc(s,l,d){var y;let h=(y=jn(d))==null?void 0:y.unit;return l==="temporal"||h?(function(w,x,A){return w.map((C=>({signal:`{data: ${iu(C,{timeUnit:A,type:x})}}`})))})(s,l,h):[s]}function vs(s,l,d,h){let{encoding:y,markDef:w,mark:x,config:A,stack:C}=d,L=vn(y[h]),{type:G}=L,H=L.timeUnit;if((function(le){return le==null?void 0:le.unionWith})(l)){let le=vs(s,void 0,d,h);return Hi([...Qc(l.unionWith,G,H),...le.value])}if(Ze(l))return Hi([l]);if(l&&l!=="unaggregated"&&!K0(l))return Hi(Qc(l,G,H));if(C&&h===C.fieldChannel){if(C.offset==="normalize")return Fr([[0,1]]);let le=d.requestDataName(nn.Main);return Fr([{data:le,field:d.vgField(h,{suffix:"start"})},{data:le,field:d.vgField(h,{suffix:"end"})}])}let X=Nr(h)&&ze(L)?(function(le,te,pe){if(!Hn(pe))return;let ge=le.fieldDef(te),xe=ge.sort;if(fc(xe))return{op:"min",field:sl(ge,te),order:"ascending"};let{stack:me}=le,Ae=me?new Set([...me.groupbyFields,...me.stackBy.map((Re=>Re.fieldDef.field))]):void 0;if(ii(xe))return ed(xe,me&&!Ae.has(xe.field));if(Zh(xe)){let{encoding:Re,order:Pe}=xe,We=le.fieldDef(Re),{aggregate:Je,field:it}=We,Qe=me&&!Ae.has(it);if(ei(Je)||Ni(Je))return ed({field:je(We),order:Pe},Qe);if(xn(Je)||!Je)return ed({op:Je,field:it,order:Pe},Qe)}else{if(xe==="descending")return{op:"min",field:le.vgField(te),order:"descending"};if(Z(["ascending",void 0],xe))return!0}})(d,h,s):void 0;if(Pi(L))return Fr(Qc([L.datum],G,H));let J=L;if(l==="unaggregated"){let le=d.requestDataName(nn.Main),{field:te}=L;return Fr([{data:le,field:je({field:te,aggregate:"min"})},{data:le,field:je({field:te,aggregate:"max"})}])}if(Vt(J.bin)){if(Hn(s))return Fr(s==="bin-ordinal"?[]:[{data:Ye(X)?d.requestDataName(nn.Main):d.requestDataName(nn.Raw),field:d.vgField(h,ou(J,h)?{binSuffix:"range"}:{}),sort:X!==!0&&b.isObject(X)?X:{field:d.vgField(h,{}),op:"min"}}]);{let{bin:le}=J;if(Vt(le)){let te=To(d,J.field,le);return Fr([new Ln((()=>{let pe=d.getSignalName(te);return`[${pe}.start, ${pe}.stop]`}))])}return Fr([{data:d.requestDataName(nn.Main),field:d.vgField(h,{})}])}}if(J.timeUnit&&Z(["time","utc"],s)){let le=y[Ci(h)];if(pf(J,le,w,A)){let te=d.requestDataName(nn.Main),pe=Fi({fieldDef:J,fieldDef2:le,markDef:w,config:A}),ge=cc(x)&&pe!==.5;return Fr([{data:te,field:d.vgField(h,ge?{suffix:Xf}:{})},{data:te,field:d.vgField(h,{suffix:ge?$t:"end"})}])}}return Fr(X?[{data:Ye(X)?d.requestDataName(nn.Main):d.requestDataName(nn.Raw),field:d.vgField(h),sort:X}]:[{data:d.requestDataName(nn.Main),field:d.vgField(h)}])}function ed(s,l){let{op:d,field:h,order:y}=s;return{op:d??(l?"sum":dc),...h?{field:jt(h)}:{},...y?{order:y}:{}}}function sv(s,l){var A;let d=s.component.scales[l],h=s.specifiedScales[l].domain,y=(A=s.fieldDef(l))==null?void 0:A.bin,w=K0(h)&&h,x=mo(y)&&Or(y.extent)&&y.extent;(w||x)&&d.set("selectionExtent",w??x,!0)}function Ia(s,l){let{aggregate:d,type:h}=s;return d?b.isString(d)&&!ho.has(d)?{valid:!1,reason:Nh(d)}:h==="quantitative"&&l==="log"?{valid:!1,reason:Ih(s)}:{valid:!0}:{valid:!1,reason:L0(s)}}function td(s,l,d,h){return s.explicit&&l.explicit&&Be((function(y,w,x,A){return`Conflicting ${w.toString()} property "${y.toString()}" (${Xe(x)} and ${Xe(A)}). Using the union of the two domains.`})(d,h,s.value,l.value)),{explicit:s.explicit,value:[...s.value,...l.value]}}function g1(s){let l=_e(s.map((x=>{if(Aa(x)){let{sort:A,...C}=x;return C}return x})),ne),d=_e(s.map((x=>{if(Aa(x)){let A=x.sort;return A===void 0||Ye(A)||("op"in A&&A.op==="count"&&delete A.field,A.order==="ascending"&&delete A.order),A}})).filter((x=>x!==void 0)),ne);if(l.length===0)return;if(l.length===1){let x=s[0];if(Aa(x)&&d.length>0){let A=d[0];if(d.length>1){Be(Dh);let C=d.filter((L=>b.isObject(L)&&"op"in L&&L.op!=="min"));A=!d.every((L=>b.isObject(L)&&"op"in L))||C.length!==1||C[0]}else if(b.isObject(A)&&"field"in A){let C=A.field;x.field===C&&(A=!A.order||{order:A.order})}return{...x,sort:A}}return x}let h=_e(d.map((x=>Ye(x)||!("op"in x)||b.isString(x.op)&&x.op in A0?x:(Be((function(A){return`Dropping sort property ${Xe(A)} as unioned domains only support boolean or op "count", "min", and "max".`})(x)),!0))),ne),y;h.length===1?y=h[0]:h.length>1&&(Be(Dh),y=!0);let w=_e(s.map((x=>Aa(x)?x.data:null)),(x=>x));return w.length===1&&w[0]!==null?{data:w[0],fields:l.map((x=>x.field)),...y?{sort:y}:{}}:{fields:l,...y?{sort:y}:{}}}function Rg(s){if(Aa(s)&&b.isString(s.field))return s.field;if((function(l){return!b.isArray(l)&&"fields"in l&&!("data"in l)})(s)){let l;for(let d of s.fields)if(Aa(d)&&b.isString(d.field))if(l){if(l!==d.field)return Be("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."),l}else l=d.field;return Be("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."),l}if((function(l){return!b.isArray(l)&&"fields"in l&&"data"in l})(s)){Be("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.");let l=s.fields[0];return b.isString(l)?l:void 0}}function Es(s,l){let d=s.component.scales[l].get("domains").map((h=>(Aa(h)&&(h.data=s.lookupDataSource(h.data)),h)));return g1(d)}function nd(s){return ws(s)||Ji(s)?s.children.reduce(((l,d)=>l.concat(nd(d))),Ng(s)):Ng(s)}function Ng(s){return be(s.component.scales).reduce(((l,d)=>{let h=s.component.scales[d];if(h.merged)return l;let y=h.combine(),{name:w,type:x,selectionExtent:A,domains:C,range:L,reverse:G,...H}=y,X=(function(te,pe,ge,xe){if(un(ge)){if(go(te))return{step:{signal:`${pe}_step`}}}else if(b.isObject(te)&&Aa(te))return{...te,data:xe.lookupDataSource(te.data)};return te})(y.range,w,d,s),J=Es(s,d),le=A?(function(te,pe,ge,xe){let me=So(te,pe.param,pe);return{signal:Ha(ge.get("type"))&&b.isArray(xe)&&xe[0]>xe[1]?`isValid(${me}) && reverse(${me})`:me}})(s,A,h,J):null;return l.push({name:w,type:x,...J?{domain:J}:{},...le?{domainRaw:le}:{},range:X,...G!==void 0?{reverse:G}:{},...H}),l}),[])}class Ig extends ji{constructor(l,d){super({},{name:l}),at(this,"merged",!1),this.setWithExplicit("type",d)}domainDefinitelyIncludesZero(){return this.get("zero")!==!1||ae(this.get("domains"),(l=>b.isArray(l)&&l.length===2&&b.isNumber(l[0])&&l[0]<=0&&b.isNumber(l[1])&&l[1]>=0))}}let pl=["range","scheme"];function Og(s,l){let d=s.fieldDef(l);if(d!=null&&d.bin){let{bin:h,field:y}=d,w=xa(l),x=s.getName(w);if(b.isObject(h)&&h.binned&&h.step!==void 0)return new Ln((()=>{let A=s.scaleName(l),C=`(domain("${A}")[1] - domain("${A}")[0]) / ${h.step}`;return`${s.getSignalName(x)} / (${C})`}));if(Vt(h)){let A=To(s,y,h);return new Ln((()=>{let C=s.getSignalName(A),L=`(${C}.stop - ${C}.start) / ${C}.step`;return`${s.getSignalName(x)} / (${L})`}))}}}function lv(s,l){let d=l.specifiedScales[s],{size:h}=l,y=l.getScaleComponent(s).get("type");for(let G of pl)if(d[G]!==void 0){let H=Bh(y,G),X=X0(s,G);if(H)if(X)Be(X);else switch(G){case"range":{let J=d.range;if(b.isArray(J)){if(un(s))return Hi(J.map((le=>{if(le==="width"||le==="height"){let te=l.getName(le),pe=l.getSignalName.bind(l);return Ln.fromName(pe,te)}return le})))}else if(b.isObject(J))return Hi({data:l.requestDataName(nn.Main),field:J.field,sort:{op:"min",field:l.vgField(s)}});return Hi(J)}case"scheme":return Hi(uv(d[G]))}else Be(F0(y,G,s))}let w=s===Qt||s==="xOffset"?"width":"height",x=h[w];if(qa(x)){if(un(s))if(Hn(y)){let G=dv(x,l,s);if(G)return Hi({step:G})}else Be(Oh(w));else if(Qn(s)){let G=s===mn?"x":"y";if(l.getScaleComponent(G).get("type")==="band"){let H=fv(x,y);if(H)return Hi(H)}}}let{rangeMin:A,rangeMax:C}=d,L=(function(G,H){let{size:X,config:J,mark:le,encoding:te}=H,{type:pe}=vn(te[G]),ge=H.getScaleComponent(G),xe=ge.get("type"),{domain:me,domainMid:Ae}=H.specifiedScales[G];switch(G){case Qt:case Bn:if(Z(["point","band"],xe)){let Re=Dg(G,X,J.view);if(qa(Re))return{step:dv(Re,H,G)}}return cv(G,H,xe);case mn:case Zo:return(function(Re,Pe,We){let Je=Re===mn?"x":"y",it=Pe.getScaleComponent(Je);if(!it)return cv(Je,Pe,We,{center:!0});let Qe=it.get("type"),lt=Pe.scaleName(Je),{markDef:kt,config:Fn}=Pe;if(Qe==="band"){let dn=Dg(Je,Pe.size,Pe.config.view);if(qa(dn)){let sn=fv(dn,We);if(sn)return sn}return[0,{signal:`bandwidth('${lt}')`}]}{let dn=Pe.encoding[Je];if(ze(dn)&&dn.timeUnit){let sn=H0(dn.timeUnit,(Nn=>`scale('${lt}', ${Nn})`)),Ut=Pe.config.scale.bandWithNestedOffsetPaddingInner,Dt=Fi({fieldDef:dn,markDef:kt,config:Fn})-.5,En=Dt!==0?` + ${Dt}`:"";return Ut?[{signal:`${Ze(Ut)?`${Ut.signal}/2`+En:`${Ut/2+Dt}`} * (${sn})`},{signal:`${Ze(Ut)?`(1 - ${Ut.signal}/2)`+En:`${1-Ut/2+Dt}`} * (${sn})`}]:[0,{signal:sn}]}return W(`Cannot use ${Re} scale if ${Je} scale is not discrete.`)}})(G,H,xe);case Si:{let Re=vp(le,H.component.scales[G].get("zero"),J),Pe=(function(We,Je,it,Qe){let lt={x:Og(it,"x"),y:Og(it,"y")};switch(We){case"bar":case"tick":{if(Qe.scale.maxBandSize!==void 0)return Qe.scale.maxBandSize;let kt=Lg(Je,lt,Qe.view);return b.isNumber(kt)?kt-1:new Ln((()=>`${kt.signal} - 1`))}case"line":case"trail":case"rule":return Qe.scale.maxStrokeWidth;case"text":return Qe.scale.maxFontSize;case"point":case"square":case"circle":{if(Qe.scale.maxSize)return Qe.scale.maxSize;let kt=Lg(Je,lt,Qe.view);return b.isNumber(kt)?Math.pow(Mg*kt,2):new Ln((()=>`pow(${Mg} * ${kt.signal}, 2)`))}}throw new Error(Mi("size",We))})(le,X,H,J);return Zl(xe)?(function(We,Je,it){let Qe=()=>{let lt=pa(Je),kt=pa(We),Fn=`(${lt} - ${kt}) / (${it} - 1)`;return`sequence(${kt}, ${lt} + ${Fn}, ${Fn})`};return Ze(Je)?new Ln(Qe):{signal:Qe()}})(Re,Pe,(function(We,Je,it,Qe){switch(We){case"quantile":return Je.scale.quantileCount;case"quantize":return Je.scale.quantizeCount;case"threshold":return it!==void 0&&b.isArray(it)?it.length+1:(Be((function(lt){return`Domain for ${lt} is required for threshold scale.`})(Qe)),3)}})(xe,J,me,G)):[Re,Pe]}case ar:return[0,2*Math.PI];case Ba:return[0,360];case mt:return[0,new Ln((()=>`min(${H.getSignalName("width")},${H.getSignalName("height")})/2`))];case fo:return[J.scale.minStrokeWidth,J.scale.maxStrokeWidth];case Jo:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Sn:return"symbol";case Fe:case Sa:case Zr:return xe==="ordinal"?pe==="nominal"?"category":"ordinal":Ae!==void 0?"diverging":le==="rect"||le==="geoshape"?"heatmap":"ramp";case xi:case Ft:case Ai:return[J.scale.minOpacity,J.scale.maxOpacity]}})(s,l);return(A!==void 0||C!==void 0)&&Bh(y,"rangeMin")&&b.isArray(L)&&L.length===2?Hi([A??L[0],C??L[1]]):Fr(L)}function uv(s){return(function(l){return!b.isString(l)&&!!l.name})(s)?{scheme:s.name,...ee(s,["name"])}:{scheme:s}}function cv(s,l,d){let{center:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=xa(s),w=l.getName(y),x=l.getSignalName.bind(l);return s===Bn&&Ha(d)?h?[Ln.fromName((A=>`${x(A)}/2`),w),Ln.fromName((A=>`-${x(A)}/2`),w)]:[Ln.fromName(x,w),0]:h?[Ln.fromName((A=>`-${x(A)}/2`),w),Ln.fromName((A=>`${x(A)}/2`),w)]:[0,Ln.fromName(x,w)]}function dv(s,l,d){let{encoding:h}=l,y=l.getScaleComponent(d),w=Ul(d),x=h[w];if(Mf({step:s,offsetIsDiscrete:_t(x)&&Yl(x.type)})==="offset"&&vo(h,w)){let C=l.getScaleComponent(w),L=`domain('${l.scaleName(w)}').length`;C.get("type")==="band"&&(L=`bandspace(${L}, ${C.get("paddingInner")??C.get("padding")??0}, ${C.get("paddingOuter")??C.get("padding")??0})`);let G=y.get("paddingInner")??y.get("padding");return{signal:`${s.step} * ${L} / (1-${A=G,Ze(A)?A.signal:b.stringValue(A)})`}}return s.step;var A}function fv(s,l){if(Mf({step:s,offsetIsDiscrete:Hn(l)})==="offset")return{step:s.step}}function Dg(s,l,d){let h=s===Qt?"width":"height";return l[h]||Ac(d,h)}function vp(s,l,d){if(l)return Ze(l)?{signal:`${l.signal} ? 0 : ${vp(s,!1,d)}`}:0;switch(s){case"bar":case"tick":return d.scale.minBandSize;case"line":case"trail":case"rule":return d.scale.minStrokeWidth;case"text":return d.scale.minFontSize;case"point":case"square":case"circle":return d.scale.minSize}throw new Error(Mi("size",s))}let Mg=.95;function Lg(s,l,d){let h=qa(s.width)?s.width.step:fu(d,"width"),y=qa(s.height)?s.height.step:fu(d,"height");return l.x||l.y?new Ln((()=>`min(${[l.x?l.x.signal:h,l.y?l.y.signal:y].join(", ")})`)):Math.min(h,y)}function Ep(s,l){cn(s)?(function(d,h){let y=d.component.scales,{config:w,encoding:x,markDef:A,specifiedScales:C}=d;for(let L of be(y)){let G=C[L],H=y[L],X=d.getScaleComponent(L),J=vn(x[L]),le=G[h],te=X.get("type"),pe=X.get("padding"),ge=X.get("paddingInner"),xe=Bh(te,h),me=X0(L,h);if(le!==void 0&&(xe?me&&Be(me):Be(F0(te,h,L))),xe&&me===void 0)if(le!==void 0){let Ae=J.timeUnit,Re=J.type;switch(h){case"domainMax":case"domainMin":Gs(G[h])||Re==="temporal"||Ae?H.set(h,{signal:iu(G[h],{type:Re,timeUnit:Ae})},!0):H.set(h,G[h],!0);break;default:H.copyKeyFromObject(h,G)}}else{let Ae=h in Fg?Fg[h]({model:d,channel:L,fieldOrDatumDef:J,scaleType:te,scalePadding:pe,scalePaddingInner:ge,domain:G.domain,domainMin:G.domainMin,domainMax:G.domainMax,markDef:A,config:w,hasNestedOffsetScale:cy(x,L),hasSecondaryRangeChannel:!!x[Ci(L)]}):w.scale[h];Ae!==void 0&&H.set(h,Ae,!1)}}})(s,l):hv(s,l)}let Fg={bins:s=>{let{model:l,fieldOrDatumDef:d}=s;return ze(d)?(function(h,y){let w=y.bin;if(Vt(w)){let x=To(h,y.field,w);return new Ln((()=>h.getSignalName(x)))}if(zn(w)&&mo(w)&&w.step!==void 0)return{step:w.step}})(l,d):void 0},interpolate:s=>{let{channel:l,fieldOrDatumDef:d}=s;return(function(h,y){if(Z([Fe,Sa,Zr],h)&&y!=="nominal")return"hcl"})(l,d.type)},nice:s=>{let{scaleType:l,channel:d,domain:h,domainMin:y,domainMax:w,fieldOrDatumDef:x}=s;return(function(A,C,L,G,H,X){var J;if(!((J=dr(X))!=null&&J.bin||b.isArray(L)||H!=null||G!=null||Z([Gt.TIME,Gt.UTC],A)))return!!un(C)||void 0})(l,d,h,y,w,x)},padding:s=>{let{channel:l,scaleType:d,fieldOrDatumDef:h,markDef:y,config:w}=s;return(function(x,A,C,L,G,H){if(un(x)){if(Lr(A)){if(C.continuousPadding!==void 0)return C.continuousPadding;let{type:X,orient:J}=G;if(X==="bar"&&(!ze(L)||!L.bin&&!L.timeUnit)&&(J==="vertical"&&x==="x"||J==="horizontal"&&x==="y"))return H.continuousBandSize}if(A===Gt.POINT)return C.pointPadding}})(l,d,w.scale,h,y,w.bar)},paddingInner:s=>{let{scalePadding:l,channel:d,markDef:h,scaleType:y,config:w,hasNestedOffsetScale:x}=s;return(function(A,C,L,G,H){let X=arguments.length>5&&arguments[5]!==void 0&&arguments[5];if(A===void 0){if(un(C)){let{bandPaddingInner:J,barBandPaddingInner:le,rectBandPaddingInner:te,bandWithNestedOffsetPaddingInner:pe}=H;return X?pe:Ke(J,L==="bar"?le:te)}if(Qn(C)&&G===Gt.BAND)return H.offsetBandPaddingInner}})(l,d,h.type,y,w.scale,x)},paddingOuter:s=>{let{scalePadding:l,channel:d,scaleType:h,scalePaddingInner:y,config:w,hasNestedOffsetScale:x}=s;return(function(A,C,L,G,H){let X=arguments.length>5&&arguments[5]!==void 0&&arguments[5];if(A===void 0){if(un(C)){let{bandPaddingOuter:J,bandWithNestedOffsetPaddingOuter:le}=H;if(X)return le;if(L===Gt.BAND)return Ke(J,Ze(G)?{signal:`${G.signal}/2`}:G/2)}else if(Qn(C)){if(L===Gt.POINT)return .5;if(L===Gt.BAND)return H.offsetBandPaddingOuter}}})(l,d,h,y,w.scale,x)},reverse:s=>{let{fieldOrDatumDef:l,scaleType:d,channel:h,config:y}=s;return(function(w,x,A,C){if(A==="x"&&C.xReverse!==void 0)return Ha(w)&&x==="descending"?Ze(C.xReverse)?{signal:`!${C.xReverse.signal}`}:!C.xReverse:C.xReverse;if(Ha(w)&&x==="descending")return!0})(d,ze(l)?l.sort:void 0,h,y.scale)},zero:s=>{let{channel:l,fieldOrDatumDef:d,domain:h,markDef:y,scaleType:w,config:x,hasSecondaryRangeChannel:A}=s;return(function(C,L,G,H,X,J,le){if(G&&G!=="unaggregated"&&Ha(X)){if(b.isArray(G)){let te=G[0],pe=G[G.length-1];if(b.isNumber(te)&&te<=0&&b.isNumber(pe)&&pe>=0)return!0}return!1}if(C==="size"&&L.type==="quantitative"&&!Zl(X))return!0;if((!ze(L)||!L.bin)&&Z([...Qr,...w0],C)){let{orient:te,type:pe}=H;return(!Z(["bar","area","line","trail"],pe)||!(te==="horizontal"&&C==="y"||te==="vertical"&&C==="x"))&&(!(!Z(["bar","area"],pe)||le)||(J==null?void 0:J.zero))}return!1})(l,d,h,y,w,x.scale,A)}};function pv(s){cn(s)?(function(l){let d=l.component.scales;for(let h of Gl){let y=d[h];if(!y)continue;let w=lv(h,l);y.setWithExplicit("range",w)}})(s):hv(s,"range")}function hv(s,l){let d=s.component.scales;for(let h of s.children)l==="range"?pv(h):Ep(h,l);for(let h of be(d)){let y;for(let w of s.children){let x=w.component.scales[h];x&&(y=qi(y,x.getWithExplicit(l),l,"scale",Ay(((A,C)=>l==="range"&&A.step&&C.step?A.step-C.step:0))))}d[h].setWithExplicit(l,y)}}function Pg(s,l,d,h){let y=(function(C,L,G,H){var X;switch(L.type){case"nominal":case"ordinal":if(es(C)||$d(C)==="discrete")return C==="shape"&&L.type==="ordinal"&&Be(qd(C,"ordinal")),"ordinal";if(un(C)||Qn(C)){if(Z(["rect","bar","image","rule"],G.type)||H)return"band"}else if(G.type==="arc"&&C in Qu)return"band";return Ys(G[xa(C)])||nu(L)&&((X=L.axis)!=null&&X.tickBand)?"band":"point";case"temporal":return es(C)?"time":$d(C)==="discrete"?(Be(qd(C,"temporal")),"ordinal"):ze(L)&&L.timeUnit&&jn(L.timeUnit).utc?"utc":"time";case"quantitative":return es(C)?ze(L)&&Vt(L.bin)?"bin-ordinal":"linear":$d(C)==="discrete"?(Be(qd(C,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(jd(L.type))})(l,d,h,arguments.length>4&&arguments[4]!==void 0&&arguments[4]),{type:w}=s;return Nr(l)?w!==void 0?(function(C,L){let G=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(!Nr(C))return!1;switch(C){case Qt:case Bn:case mn:case Zo:case ar:case mt:return!!Lr(L)||L==="band"||L==="point"&&!G;case Si:case fo:case xi:case Ft:case Ai:case Ba:return Lr(L)||Zl(L)||Z(["band","point","ordinal"],L);case Fe:case Sa:case Zr:return L!=="band";case Jo:case Sn:return L==="ordinal"||Zl(L)}})(l,w)?ze(d)&&(x=w,A=d.type,!(Z([tf,nf],A)?x===void 0||Hn(x):A===rs?Z([Gt.TIME,Gt.UTC,void 0],x):A!==bo||V0(x)||Zl(x)||x===void 0))?(Be((function(C,L){return`FieldDef does not work with "${C}" scale. We are using "${L}" scale instead.`})(w,y)),y):w:(Be((function(C,L,G){return`Channel "${C}" does not work with "${L}" scale. We are using "${G}" scale instead.`})(l,w,y)),y):y:null;var x,A}function wp(s){cn(s)?s.component.scales=(function(l){let{encoding:d,mark:h,markDef:y}=l,w={};for(let x of Gl){let A=vn(d[x]);if(A&&h===J0&&x===Sn&&A.type===Vs)continue;let C=A&&A.scale;if(A&&C!==null&&C!==!1){C??={};let L=Pg(C,x,A,y,cy(d,x));w[x]=new Ig(l.scaleName(`${x}`,!0),{value:L,explicit:C.type===L})}}return w})(s):s.component.scales=(function(l){let d=l.component.scales={},h={},y=l.component.resolve;for(let w of l.children){wp(w);for(let x of be(w.component.scales))if(y.scale[x]??=dg(x,l),y.scale[x]==="shared"){let A=h[x],C=w.component.scales[x].getWithExplicit("type");A?O_(A.value,C.value)?h[x]=qi(A,C,"type","scale",b1):(y.scale[x]="independent",delete h[x]):h[x]=C}}for(let w of be(h)){let x=l.scaleName(w,!0),A=h[w];d[w]=new Ig(x,A);for(let C of l.children){let L=C.component.scales[w];L&&(C.renameScale(L.get("name"),x),L.merged=!0)}}return d})(s)}let b1=Ay(((s,l)=>W0(s)-W0(l)));class $g{constructor(){at(this,"nameMap",void 0),this.nameMap={}}rename(l,d){this.nameMap[l]=d}has(l){return this.nameMap[l]!==void 0}get(l){for(;this.nameMap[l]&&l!==this.nameMap[l];)l=this.nameMap[l];return l}}function cn(s){return(s==null?void 0:s.type)==="unit"}function Ya(s){return(s==null?void 0:s.type)==="facet"}function Ji(s){return(s==null?void 0:s.type)==="concat"}function ws(s){return(s==null?void 0:s.type)==="layer"}class ad{constructor(l,d,h,y,w,x,A){this.type=d,this.parent=h,this.config=w,at(this,"name",void 0),at(this,"size",void 0),at(this,"title",void 0),at(this,"description",void 0),at(this,"data",void 0),at(this,"transforms",void 0),at(this,"layout",void 0),at(this,"scaleNameMap",void 0),at(this,"projectionNameMap",void 0),at(this,"signalNameMap",void 0),at(this,"component",void 0),at(this,"view",void 0),at(this,"children",void 0),at(this,"correctDataNames",(C=>{var L,G,H;return(L=C.from)!=null&&L.data&&(C.from.data=this.lookupDataSource(C.from.data)),(H=(G=C.from)==null?void 0:G.facet)!=null&&H.data&&(C.from.facet.data=this.lookupDataSource(C.from.facet.data)),C})),this.parent=h,this.config=w,this.view=ea(A),this.name=l.name??y,this.title=fa(l.title)?{text:l.title}:l.title?ea(l.title):void 0,this.scaleNameMap=h?h.scaleNameMap:new $g,this.projectionNameMap=h?h.projectionNameMap:new $g,this.signalNameMap=h?h.signalNameMap:new $g,this.data=l.data,this.description=l.description,this.transforms=(l.transform??[]).map((C=>Nm(C)?{filter:F(C.filter,lc)}:C)),this.layout=d==="layer"||d==="unit"?{}:(function(C,L,G){let H=G[L],X={},{spacing:J,columns:le}=H;J!==void 0&&(X.spacing=J),le!==void 0&&(pc(C)&&!Ql(C.facet)||kc(C))&&(X.columns=le),du(C)&&(X.columns=1);for(let te of xc)if(C[te]!==void 0)if(te==="spacing"){let pe=C[te];X[te]=b.isNumber(pe)?pe:{row:pe.row??J,column:pe.column??J}}else X[te]=C[te];return X})(l,d,w),this.component={data:{sources:h?h.component.data.sources:[],outputNodes:h?h.component.data.outputNodes:{},outputNodeRefCounts:h?h.component.data.outputNodeRefCounts:{},isFaceted:pc(l)||(h==null?void 0:h.component.data.isFaceted)&&l.data===void 0},layoutSize:new ji,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...x?j(x):{}},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(l){let{ignoreRange:d}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};wp(l),ov(l);for(let h of $_)Ep(l,h);d||pv(l)})(this)}parseProjection(){wg(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){up(this)}assembleEncodeFromView(l){let{style:d,...h}=l,y={};for(let w of be(h)){let x=h[w];x!==void 0&&(y[w]=on(x))}return y}assembleGroupEncodeEntry(l){let d={};return this.view&&(d=this.assembleEncodeFromView(this.view)),l||(this.description&&(d.description=on(this.description)),this.type!=="unit"&&this.type!=="layer")?ye(d)?void 0:d:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...d??{}}}assembleLayout(){if(!this.layout)return;let{spacing:l,...d}=this.layout,{component:h,config:y}=this,w=(function(x,A){let C={};for(let L of Ua){let G=x[L];if(G!=null&&G.facetFieldDef){let{titleAnchor:H,titleOrient:X}=Uc(["titleAnchor","titleOrient"],G.facetFieldDef.header,A,L),J=Bc(L,X),le=Xy(H,J);le!==void 0&&(C[J]=le)}}return ye(C)?void 0:C})(h.layoutHeaders,y);return{padding:l,...this.assembleDefaultLayout(),...d,...w?{titleBand:w}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){let{layoutHeaders:l}=this.component,d=[];for(let h of Ua)l[h].title&&d.push(bs(this,h));for(let h of _u)d=d.concat(Yy(this,h));return d}assembleAxes(){return(function(l,d){let{x:h=[],y=[]}=l;return[...h.map((w=>Xi(w,"grid",d))),...y.map((w=>Xi(w,"grid",d))),...h.map((w=>Xi(w,"main",d))),...y.map((w=>Xi(w,"main",d)))].filter((w=>w))})(this.component.axes,this.config)}assembleLegends(){return dp(this)}assembleProjections(){return vg(this)}assembleTitle(){let{encoding:l,...d}=this.title??{},h={...ac(this.config.title).nonMarkTitleProperties,...d,...l?{encode:{update:l}}:{}};if(h.text)return Z(["unit","layer"],this.type)?Z(["middle",void 0],h.anchor)&&(h.frame??="group"):h.anchor??="start",ye(h)?void 0:h}assembleGroup(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d={};l=l.concat(this.assembleSignals()),l.length>0&&(d.signals=l);let h=this.assembleLayout();h&&(d.layout=h),d.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());let y=!this.parent||Ya(this.parent)?nd(this):[];y.length>0&&(d.scales=y);let w=this.assembleAxes();w.length>0&&(d.axes=w);let x=this.assembleLegends();return x.length>0&&(d.legends=x),d}getName(l){return $e((this.name?`${this.name}_`:"")+l)}getDataName(l){return this.getName(nn[l].toLowerCase())}requestDataName(l){let d=this.getDataName(l),h=this.component.data.outputNodeRefCounts;return h[d]=(h[d]||0)+1,d}getSizeSignalRef(l){if(Ya(this.parent)){let d=ec(ug(l)),h=this.component.scales[d];if(h&&!h.merged){let y=h.get("type"),w=h.get("range");if(Hn(y)&&go(w)){let x=h.get("name"),A=Rg(Es(this,d));return A?{signal:op(x,h,je({aggregate:"distinct",field:A},{expr:"datum"}))}:(Be(ha(d)),null)}}}return{signal:this.signalNameMap.get(this.getName(l))}}lookupDataSource(l){let d=this.component.data.outputNodes[l];return d?d.getSource():l}getSignalName(l){return this.signalNameMap.get(l)}renameSignal(l,d){this.signalNameMap.rename(l,d)}renameScale(l,d){this.scaleNameMap.rename(l,d)}renameProjection(l,d){this.projectionNameMap.rename(l,d)}scaleName(l,d){return d?this.getName(l):b0(l)&&Nr(l)&&this.component.scales[l]||this.scaleNameMap.has(this.getName(l))?this.scaleNameMap.get(this.getName(l)):void 0}projectionName(l){return l?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(l){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");let d=this.component.scales[l];return d&&!d.merged?d:this.parent?this.parent.getScaleComponent(l):void 0}getSelectionComponent(l,d){let h=this.component.selection[l];if(!h&&this.parent&&(h=this.parent.getSelectionComponent(l,d)),!h)throw new Error((function(y){return`Cannot find a selection named "${y}".`})(d));return h}hasAxisOrientSignalRef(){var l,d;return((l=this.component.axes.x)==null?void 0:l.some((h=>h.hasOrientSignalRef())))||((d=this.component.axes.y)==null?void 0:d.some((h=>h.hasOrientSignalRef())))}}class rd extends ad{vgField(l){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=this.fieldDef(l);if(h)return je(h,d)}reduceFieldDef(l,d){return(function(h,y,w,x){return h?be(h).reduce(((A,C)=>{let L=h[C];return b.isArray(L)?L.reduce(((G,H)=>y.call(x,G,H,C)),A):y.call(x,A,L,C)}),w):w})(this.getMapping(),((h,y,w)=>{let x=dr(y);return x?l(h,x,w):h}),d)}forEachFieldDef(l,d){bc(this.getMapping(),((h,y)=>{let w=dr(h);w&&l(w,y)}),d)}}class ku extends qt{clone(){return new ku(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??"value",h[1]??"density"]}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${ne(this.transform)}`}assemble(){let{density:l,...d}=this.transform,h={type:"kde",field:l,...d};return this.transform.groupby&&(h.resolve="shared"),h}}class Su extends qt{clone(){return new Su(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${ne(this.transform)}`}assemble(){let{extent:l,param:d}=this.transform;return{type:"extent",field:l,signal:d}}}class Qi extends qt{clone(){return new Qi(null,{...this.filter})}constructor(l,d){super(l),this.filter=d}static make(l,d){let{config:h,mark:y,markDef:w}=d;if(Ht("invalid",w,h)!=="filter")return null;let x=d.reduceFieldDef(((A,C,L)=>{let G=Nr(L)&&d.getScaleComponent(L);return G&&Ha(G.get("type"))&&C.aggregate!=="count"&&!is(y)&&(A[C.field]=C),A}),{});return be(x).length?new Qi(l,x):null}dependentFields(){return new Set(be(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${ne(this.filter)}`}assemble(){let l=be(this.filter).reduce(((d,h)=>{let y=this.filter[h],w=je(y,{expr:"datum"});return y!==null&&(y.type==="temporal"?d.push(`(isDate(${w}) || (isValid(${w}) && isFinite(+${w})))`):y.type==="quantitative"&&(d.push(`isValid(${w})`),d.push(`isFinite(+${w})`))),d}),[]);return l.length>0?{type:"filter",expr:l.join(" && ")}:null}}class Pr extends qt{clone(){return new Pr(this.parent,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let{flatten:h,as:y=[]}=this.transform;this.transform.as=h.map(((w,x)=>y[x]??w))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${ne(this.transform)}`}assemble(){let{flatten:l,as:d}=this.transform;return{type:"flatten",fields:l,as:d}}}class _s extends qt{clone(){return new _s(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??"key",h[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${ne(this.transform)}`}assemble(){let{fold:l,as:d}=this.transform;return{type:"fold",fields:l,as:d}}}class eo extends qt{clone(){return new eo(null,j(this.fields),this.geojson,this.signal)}static parseAll(l,d){if(d.component.projection&&!d.component.projection.isFit)return l;let h=0;for(let y of[[$a,nt],[rr,da]]){let w=y.map((x=>{let A=vn(d.encoding[x]);return ze(A)?A.field:Pi(A)?{expr:`${A.datum}`}:cr(A)?{expr:`${A.value}`}:void 0}));(w[0]||w[1])&&(l=new eo(l,w,null,d.getName("geojson_"+h++)))}if(d.channelHasField(Sn)){let y=d.typedFieldDef(Sn);y.type===Vs&&(l=new eo(l,null,y.field,d.getName("geojson_"+h++)))}return l}constructor(l,d,h,y){super(l),this.fields=d,this.geojson=h,this.signal=y}dependentFields(){let l=(this.fields??[]).filter(b.isString);return new Set([...this.geojson?[this.geojson]:[],...l])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${ne(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class ks extends qt{clone(){return new ks(null,this.projection,j(this.fields),j(this.as))}constructor(l,d,h,y){super(l),this.projection=d,this.fields=h,this.as=y}static parseAll(l,d){if(!d.projectionName())return l;for(let h of[[$a,nt],[rr,da]]){let y=h.map((x=>{let A=vn(d.encoding[x]);return ze(A)?A.field:Pi(A)?{expr:`${A.datum}`}:cr(A)?{expr:`${A.value}`}:void 0})),w=h[0]===rr?"2":"";(y[0]||y[1])&&(l=new ks(l,d.projectionName(),y,[d.getName(`x${w}`),d.getName(`y${w}`)]))}return l}dependentFields(){return new Set(this.fields.filter(b.isString))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${ne(this.fields)} ${ne(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class hr extends qt{clone(){return new hr(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(l){let{start:d=0,stop:h,step:y}=l;return{signal:`sequence(${[d,h,...y?[y]:[]].join(",")})`}}static makeFromTransform(l,d){return new hr(l,d)}static makeFromEncoding(l,d){let h=d.encoding,y=h.x,w=h.y;if(ze(y)&&ze(w)){let x=y.impute?y:w.impute?w:void 0;if(x===void 0)return;let A=y.impute?w:w.impute?y:void 0,{method:C,value:L,frame:G,keyvals:H}=x.impute,X=im(d.mark,h);return new hr(l,{impute:x.field,key:A.field,...C?{method:C}:{},...L!==void 0?{value:L}:{},...G?{frame:G}:{},...H!==void 0?{keyvals:H}:{},...X.length?{groupby:X}:{}})}return null}hash(){return`Impute ${ne(this.transform)}`}assemble(){let{impute:l,key:d,keyvals:h,method:y,groupby:w,value:x,frame:A=[null,null]}=this.transform,C={type:"impute",field:l,key:d,...h?{keyvals:(L=h,(L==null?void 0:L.stop)!==void 0?this.processSequence(h):h)}:{},method:"value",...w?{groupby:w}:{},value:y&&y!=="value"?null:x};var L;return y&&y!=="value"?[C,{type:"window",as:[`imputed_${l}_value`],ops:[y],fields:[l],frame:A,ignorePeers:!1,...w?{groupby:w}:{}},{type:"formula",expr:`datum.${l} === null ? datum.imputed_${l}_value : datum.${l}`,as:l}]:[C]}}class to extends qt{clone(){return new to(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??d.on,h[1]??d.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${ne(this.transform)}`}assemble(){let{loess:l,on:d,...h}=this.transform;return{type:"loess",x:d,y:l,...h}}}class Ka extends qt{clone(){return new Ka(null,j(this.transform),this.secondary)}constructor(l,d,h){super(l),this.transform=d,this.secondary=h}static make(l,d,h,y){let w=d.component.data.sources,{from:x}=h,A=null;if((function(C){return"data"in C})(x)){let C=Ug(x.data,w);C||(C=new Ro(x.data),w.push(C));let L=d.getName(`lookup_${y}`);A=new ia(C,L,nn.Lookup,d.component.data.outputNodeRefCounts),d.component.data.outputNodes[L]=A}else if((function(C){return"param"in C})(x)){let C=x.param,L;h={as:C,...h};try{L=d.getSelectionComponent($e(C),C)}catch{throw new Error((function(H){return`Lookups can only be performed on selection parameters. "${H}" is a variable parameter.`})(C))}if(A=L.materialized,!A)throw new Error((function(G){return`Cannot define and lookup the "${G}" selection in the same view. Try moving the lookup into a second, layered view?`})(C))}return new Ka(l,h,A.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?b.array(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${ne({transform:this.transform,secondary:this.secondary})}`}assemble(){let l;if(this.transform.from.fields)l={values:this.transform.from.fields,...this.transform.as?{as:b.array(this.transform.as)}:{}};else{let d=this.transform.as;b.isString(d)||(Be('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.'),d="_lookup"),l={as:[d]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...l,...this.transform.default?{default:this.transform.default}:{}}}}class Io extends qt{clone(){return new Io(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??"prob",h[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${ne(this.transform)}`}assemble(){let{quantile:l,...d}=this.transform;return{type:"quantile",field:l,...d}}}class Oo extends qt{clone(){return new Oo(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??d.on,h[1]??d.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${ne(this.transform)}`}assemble(){let{regression:l,on:d,...h}=this.transform;return{type:"regression",x:d,y:l,...h}}}class hl extends qt{clone(){return new hl(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}addDimensions(l){this.transform.groupby=_e((this.transform.groupby??[]).concat(l),(d=>d))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${ne(this.transform)}`}assemble(){let{pivot:l,value:d,groupby:h,limit:y,op:w}=this.transform;return{type:"pivot",field:l,value:d,...y!==void 0?{limit:y}:{},...w!==void 0?{op:w}:{},...h!==void 0?{groupby:h}:{}}}}class ml extends qt{clone(){return new ml(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${ne(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function _p(s){let l=0;return function d(h,y){if(h instanceof Ro&&!h.isGenerator&&!fs(h.data)&&(s.push(y),y={name:null,source:y.name,transform:[]}),h instanceof Kn&&(h.parent instanceof Ro&&!y.source?(y.format={...y.format??{},parse:h.assembleFormatParse()},y.transform.push(...h.assembleTransforms(!0))):y.transform.push(...h.assembleTransforms())),h instanceof cl)return y.name||(y.name="data_"+l++),!y.source||y.transform.length>0?(s.push(y),h.data=y.name):h.data=y.source,void s.push(...h.assemble());switch((h instanceof Kc||h instanceof Xc||h instanceof Qi||h instanceof ci||h instanceof ol||h instanceof ks||h instanceof Va||h instanceof Ka||h instanceof fl||h instanceof dl||h instanceof _s||h instanceof Pr||h instanceof ku||h instanceof to||h instanceof Io||h instanceof Oo||h instanceof Co||h instanceof ml||h instanceof hl||h instanceof Su)&&y.transform.push(h.assemble()),(h instanceof pi||h instanceof Wi||h instanceof hr||h instanceof No||h instanceof eo)&&y.transform.push(...h.assemble()),h instanceof ia&&(y.source&&y.transform.length===0?h.setSource(y.source):h.parent instanceof ia?h.setSource(y.name):(y.name||(y.name="data_"+l++),h.setSource(y.name),h.numChildren()===1&&(s.push(y),y={name:null,source:y.name,transform:[]}))),h.numChildren()){case 0:h instanceof ia&&(!y.source||y.transform.length>0)&&s.push(y);break;case 1:d(h.children[0],y);break;default:{y.name||(y.name="data_"+l++);let w=y.name;!y.source||y.transform.length>0?s.push(y):w=y.source;for(let x of h.children)d(x,{name:null,source:w,transform:[]});break}}}}function Bg(s){return s==="top"||s==="left"||Ze(s)?"header":"footer"}function mv(s,l){var x;let{facet:d,config:h,child:y,component:w}=s;if(s.channelHasField(l)){let A=d[l],C=Zi("title",null,h,l),L=ss(A,h,{allowDisabling:!0,includeDefault:C===void 0||!!C});y.component.layoutHeaders[l].title&&(L=b.isArray(L)?L.join(", "):L,L+=` / ${y.component.layoutHeaders[l].title}`,y.component.layoutHeaders[l].title=null);let G=Zi("labelOrient",A.header,h,l),H=A.header!==null&&Ke((x=A.header)==null?void 0:x.labels,h.header.labels,!0),X=Z(["bottom","right"],G)?"footer":"header";w.layoutHeaders[l]={title:A.header!==null?L:null,facetFieldDef:A,[X]:l==="facet"?[]:[kp(s,l,H)]}}}function kp(s,l,d){let h=l==="row"?"height":"width";return{labels:d,sizeSignal:s.child.component.layoutSize.get(h)?s.child.getSizeSignalRef(h):void 0,axes:[]}}function Rn(s,l){let{child:d}=s;if(d.component.axes[l]){let{layoutHeaders:h,resolve:y}=s.component;if(y.axis[l]=sp(y,l),y.axis[l]==="shared"){let w=l==="x"?"column":"row",x=h[w];for(let A of d.component.axes[l]){let C=Bg(A.get("orient"));x[C]??=[kp(s,w,!1)];let L=Xi(A,"main",s.config,{header:!0});L&&x[C][0].axes.push(L),A.mainExtracted=!0}}}}function gl(s){for(let l of s.children)l.parseLayoutSize()}function Ss(s,l){let d=ug(l),h=ec(d),y=s.component.resolve,w=s.component.layoutSize,x;for(let A of s.children){let C=A.component.layoutSize.getWithExplicit(d),L=y.scale[h]??dg(h,s);if(L==="independent"&&C.value==="step"){x=void 0;break}if(x){if(L==="independent"&&x.value!==C.value){x=void 0;break}x=qi(x,C,d,"")}else x=C}if(x){for(let A of s.children)s.renameSignal(A.getName(d),s.getName(l)),A.component.layoutSize.set(d,"merged",!1);w.setWithExplicit(l,x)}else w.setWithExplicit(l,{explicit:!1,value:void 0})}function $r(s,l){let d=l==="width"?"x":"y",h=s.config,y=s.getScaleComponent(d);if(y){let w=y.get("type"),x=y.get("range");if(Hn(w)){let A=Ac(h.view,l);return go(x)||qa(A)?"step":A}return ds(h.view,l)}if(s.hasProjection||s.mark==="arc")return ds(h.view,l);{let w=Ac(h.view,l);return qa(w)?w.step:w}}function id(s,l,d){return je(l,{suffix:`by_${je(s)}`,...d??{}})}class bl extends rd{constructor(l,d,h,y){super(l,"facet",d,h,y,l.resolve),at(this,"facet",void 0),at(this,"child",void 0),at(this,"children",void 0),this.child=Vg(l.spec,this,this.getName("child"),void 0,y),this.children=[this.child],this.facet=this.initFacet(l.facet)}initFacet(l){if(!Ql(l))return{facet:this.initFacetFieldDef(l,"facet")};let d=be(l),h={};for(let y of d){if(![tt,Kr].includes(y)){Be(Mi(y,"facet"));break}let w=l[y];if(w.field===void 0){Be(Hd(w,y));break}h[y]=this.initFacetFieldDef(w,y)}return h}initFacetFieldDef(l,d){let h=ru(l,d);return h.header?h.header=ea(h.header):h.header===null&&(h.header=null),h}channelHasField(l){return!!this.facet[l]}fieldDef(l){return this.facet[l]}parseData(){this.component.data=Sp(this),this.child.parseData()}parseLayoutSize(){gl(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),(function(l){for(let d of Ua)mv(l,d);Rn(l,"x"),Rn(l,"y")})(this)}assembleSelectionTopLevelSignals(l){return this.child.assembleSelectionTopLevelSignals(l)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(l){return this.child.assembleSelectionData(l)}getHeaderLayoutMixins(){let l={};for(let d of Ua)for(let h of zc){let y=this.component.layoutHeaders[d],w=y[h],{facetFieldDef:x}=y;if(x){let A=Zi("titleOrient",x.header,this.config,d);if(["right","bottom"].includes(A)){let C=Bc(d,A);l.titleAnchor??={},l.titleAnchor[C]="end"}}if(w!=null&&w[0]){let A=d==="row"?"height":"width",C=h==="header"?"headerBand":"footerBand";d==="facet"||this.child.component.layoutSize.get(A)||(l[C]??={},l[C][d]=.5),y.title&&(l.offset??={},l.offset[d==="row"?"rowTitle":"columnTitle"]=10)}}return l}assembleDefaultLayout(){let{column:l,row:d}=this.facet,h=l?this.columnDistinctSignal():d?1:void 0,y="all";return(d||this.component.resolve.scale.x!=="independent")&&(l||this.component.resolve.scale.y!=="independent")||(y="none"),{...this.getHeaderLayoutMixins(),...h?{columns:h}:{},bounds:"full",align:y}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof bl))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(l){return this.parent&&this.parent instanceof bl?{...this.channelHasField("column")?{encode:{update:{columns:{field:je(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(l)}:super.assembleGroup(l)}getCardinalityAggregateForChild(){let l=[],d=[],h=[];if(this.child instanceof bl){if(this.child.channelHasField("column")){let y=je(this.child.facet.column);l.push(y),d.push("distinct"),h.push(`distinct_${y}`)}}else for(let y of Qr){let w=this.child.component.scales[y];if(w&&!w.merged){let x=w.get("type"),A=w.get("range");if(Hn(x)&&go(A)){let C=Rg(Es(this.child,y));C?(l.push(C),d.push("distinct"),h.push(`distinct_${C}`)):Be(ha(y))}}}return{fields:l,ops:d,as:h}}assembleFacet(){let{name:l,data:d}=this.component.data.facetRoot,{row:h,column:y}=this.facet,{fields:w,ops:x,as:A}=this.getCardinalityAggregateForChild(),C=[];for(let G of Ua){let H=this.facet[G];if(H){C.push(je(H));let{bin:X,sort:J}=H;if(Vt(X)&&C.push(je(H,{binSuffix:"end"})),ii(J)){let{field:le,op:te=dc}=J,pe=id(H,J);h&&y?(w.push(pe),x.push("max"),A.push(pe)):(w.push(le),x.push(te),A.push(pe))}else if(b.isArray(J)){let le=sl(H,G);w.push(le),x.push("max"),A.push(le)}}}let L=!!h&&!!y;return{name:l,data:d,groupby:C,...L||w.length>0?{aggregate:{...L?{cross:L}:{},...w.length?{fields:w,ops:x,as:A}:{}}}:{}}}facetSortFields(l){let{facet:d}=this,h=d[l];return h?ii(h.sort)?[id(h,h.sort,{expr:"datum"})]:b.isArray(h.sort)?[sl(h,l,{expr:"datum"})]:[je(h,{expr:"datum"})]:[]}facetSortOrder(l){let{facet:d}=this,h=d[l];if(h){let{sort:y}=h;return[(ii(y)?y.order:!b.isArray(y)&&y)||"ascending"]}return[]}assembleLabelTitle(){var y;let{facet:l,config:d}=this;if(l.facet)return xo(l.facet,"facet",d);let h={row:["top","bottom"],column:["left","right"]};for(let w of _u)if(l[w]){let x=Zi("labelOrient",(y=l[w])==null?void 0:y.header,d,w);if(h[w].includes(x))return xo(l[w],w,d)}}assembleMarks(){let{child:l}=this,d=(function(x){let A=[],C=_p(A);for(let L of x.children)C(L,{source:x.name,name:null,transform:[]});return A})(this.component.data.facetRoot),h=l.assembleGroupEncodeEntry(!1),y=this.assembleLabelTitle()||l.assembleTitle(),w=l.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...y?{title:y}:{},...w?{style:w}:{},from:{facet:this.assembleFacet()},sort:{field:Ua.map((x=>this.facetSortFields(x))).flat(),order:Ua.map((x=>this.facetSortOrder(x))).flat()},...d.length>0?{data:d}:{},...h?{encode:{update:h}}:{},...l.assembleGroup(Nc(this,[]))}]}getMapping(){return this.facet}}function Ug(s,l){var d,h,y,w;for(let x of l){let A=x.data;if(s.name&&x.hasName()&&s.name!==x.dataName)continue;let C=(d=s.format)==null?void 0:d.mesh,L=(h=A.format)==null?void 0:h.feature;if(C&&L)continue;let G=(y=s.format)==null?void 0:y.feature;if((G||L)&&G!==L)continue;let H=(w=A.format)==null?void 0:w.mesh;if(!C&&!H||C===H){if(mu(s)&&mu(A)){if(Ie(s.values,A.values))return x}else if(fs(s)&&fs(A)){if(s.url===A.url)return x}else if(qf(s)&&s.name===x.dataName)return x}}return null}function Sp(s){var le;let l=(function(te,pe){if(te.data||!te.parent){if(te.data===null){let xe=new Ro({values:[]});return pe.push(xe),xe}let ge=Ug(te.data,pe);if(ge)return Eo(te.data)||(ge.data.format=ce({},te.data.format,ge.data.format)),!ge.hasName()&&te.data.name&&(ge.dataName=te.data.name),ge;{let xe=new Ro(te.data);return pe.push(xe),xe}}return te.parent.component.data.facetRoot?te.parent.component.data.facetRoot:te.parent.component.data.main})(s,s.component.data.sources),{outputNodes:d,outputNodeRefCounts:h}=s.component.data,y=s.data,w=!(y&&(Eo(y)||fs(y)||mu(y)))&&s.parent?s.parent.component.data.ancestorParse.clone():new Ty;Eo(y)?(Wf(y)?l=new Xc(l,y.sequence):Yf(y)&&(l=new Kc(l,y.graticule)),w.parseNothing=!0):((le=y==null?void 0:y.format)==null?void 0:le.parse)===null&&(w.parseNothing=!0),l=Kn.makeExplicit(l,s,w)??l,l=new Co(l);let x=s.parent&&ws(s.parent);(cn(s)||Ya(s))&&x&&(l=pi.makeFromEncoding(l,s)??l),s.transforms.length>0&&(l=(function(te,pe,ge){let xe=0;for(let me of pe.transforms){let Ae,Re;if(r1(me))Re=te=new ol(te,me),Ae="derived";else if(Nm(me)){let Pe=p1(me);Re=te=Kn.makeWithAncestors(te,{},Pe,ge)??te,te=new ci(te,pe,me.filter)}else if(Bf(me))Re=te=pi.makeFromTransform(te,me,pe),Ae="number";else if(Uf(me))Ae="date",ge.getWithExplicit(me.field).value===void 0&&(te=new Kn(te,{[me.field]:Ae}),ge.set(me.field,Ae,!1)),Re=te=Wi.makeFromTransform(te,me);else if(Sy(me))Re=te=Va.makeFromTransform(te,me),Ae="number",ig(pe)&&(te=new Co(te));else if(Im(me))Re=te=Ka.make(te,pe,me,xe++),Ae="derived";else if(Dm(me))Re=te=new fl(te,me),Ae="number";else if(Mm(me))Re=te=new dl(te,me),Ae="number";else if(i1(me))Re=te=No.makeFromTransform(te,me),Ae="derived";else if(Fm(me))Re=te=new _s(te,me),Ae="derived";else if(Pm(me))Re=te=new Su(te,me),Ae="derived";else if(ky(me))Re=te=new Pr(te,me),Ae="derived";else if(n1(me))Re=te=new hl(te,me),Ae="derived";else if(_y(me))te=new ml(te,me);else if(Lm(me))Re=te=hr.makeFromTransform(te,me),Ae="derived";else if(Ey(me))Re=te=new ku(te,me),Ae="derived";else if(Om(me))Re=te=new Io(te,me),Ae="derived";else if(wy(me))Re=te=new Oo(te,me),Ae="derived";else{if(!a1(me)){Be(`Ignoring an invalid transform: ${Xe(me)}.`);continue}Re=te=new to(te,me),Ae="derived"}if(Re&&Ae!==void 0)for(let Pe of Re.producedFields()??[])ge.set(Pe,Ae,!1)}return te})(l,s,w));let A=(function(te){let pe={};if(cn(te)&&te.component.selection)for(let ge of be(te.component.selection)){let xe=te.component.selection[ge];for(let me of xe.project.items)!me.channel&&Xt(me.field)>1&&(pe[me.field]="flatten")}return pe})(s),C=Yn(s);l=Kn.makeWithAncestors(l,{},{...A,...C},w)??l,cn(s)&&(l=eo.parseAll(l,s),l=ks.parseAll(l,s)),(cn(s)||Ya(s))&&(x||(l=pi.makeFromEncoding(l,s)??l),l=Wi.makeFromEncoding(l,s)??l,l=ol.parseAllForSortIndex(l,s));let L=s.getDataName(nn.Raw),G=new ia(l,L,nn.Raw,h);if(d[L]=G,l=G,cn(s)){let te=Va.makeFromEncoding(l,s);te&&(l=te,ig(s)&&(l=new Co(l))),l=hr.makeFromEncoding(l,s)??l,l=No.makeFromEncoding(l,s)??l}cn(s)&&(l=Qi.make(l,s)??l);let H=s.getDataName(nn.Main),X=new ia(l,H,nn.Main,h);d[H]=X,l=X,cn(s)&&(function(te,pe){for(let[ge,xe]of ke(te.component.selection??{})){let me=te.getName(`lookup_${ge}`);te.component.data.outputNodes[me]=xe.materialized=new ia(new ci(pe,te,{param:ge}),me,nn.Lookup,te.component.data.outputNodeRefCounts)}})(s,X);let J=null;if(Ya(s)){let te=s.getName("facet");l=(function(pe,ge){let{row:xe,column:me}=ge;if(xe&&me){let Ae=null;for(let Re of[xe,me])if(ii(Re.sort)){let{field:Pe,op:We=dc}=Re.sort;pe=Ae=new dl(pe,{joinaggregate:[{op:We,field:Pe,as:id(Re,Re.sort,{forAs:!0})}],groupby:[je(Re)]})}return Ae}return null})(l,s.facet)??l,J=new cl(l,s,te,X.getSource()),d[te]=J}return{...s.component.data,outputNodes:d,outputNodeRefCounts:h,raw:G,main:X,facetRoot:J,ancestorParse:w}}class y1 extends ad{constructor(l,d,h,y){var w,x,A,C;super(l,"concat",d,h,y,l.resolve),at(this,"children",void 0),((x=(w=l.resolve)==null?void 0:w.axis)==null?void 0:x.x)!=="shared"&&((C=(A=l.resolve)==null?void 0:A.axis)==null?void 0:C.y)!=="shared"||Be("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(l).map(((L,G)=>Vg(L,this,this.getName(`concat_${G}`),void 0,y)))}parseData(){this.component.data=Sp(this);for(let l of this.children)l.parseData()}parseSelections(){this.component.selection={};for(let l of this.children){l.parseSelections();for(let d of be(l.component.selection))this.component.selection[d]=l.component.selection[d]}}parseMarkGroup(){for(let l of this.children)l.parseMarkGroup()}parseAxesAndHeaders(){for(let l of this.children)l.parseAxesAndHeaders()}getChildren(l){return du(l)?l.vconcat:Df(l)?l.hconcat:l.concat}parseLayoutSize(){(function(l){gl(l);let d=l.layout.columns===1?"width":"childWidth",h=l.layout.columns===void 0?"height":"childHeight";Ss(l,d),Ss(l,h)})(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(l){return this.children.reduce(((d,h)=>h.assembleSelectionTopLevelSignals(d)),l)}assembleSignals(){return this.children.forEach((l=>l.assembleSignals())),[]}assembleLayoutSignals(){let l=pr(this);for(let d of this.children)l.push(...d.assembleLayoutSignals());return l}assembleSelectionData(l){return this.children.reduce(((d,h)=>h.assembleSelectionData(d)),l)}assembleMarks(){return this.children.map((l=>{let d=l.assembleTitle(),h=l.assembleGroupStyle(),y=l.assembleGroupEncodeEntry(!1);return{type:"group",name:l.getName("group"),...d?{title:d}:{},...h?{style:h}:{},...y?{encode:{update:y}}:{},...l.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){let l=this.layout.columns;return{...l!=null?{columns:l}:{},bounds:"full",align:"each"}}}let xp={disable:1,gridScale:1,scale:1,...gc,labelExpr:1,encode:1},zg=be(xp);class Ap extends ji{constructor(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=arguments.length>2&&arguments[2]!==void 0&&arguments[2];super(),this.explicit=l,this.implicit=d,this.mainExtracted=h}clone(){return new Ap(j(this.explicit),j(this.implicit),this.mainExtracted)}hasAxisPart(l){return l==="axis"||(l==="grid"||l==="title"?!!this.get(l):!((d=this.get(l))===!1||d===null));var d}hasOrientSignalRef(){return Ze(this.explicit.orient)}}let Bt={bottom:"top",top:"bottom",left:"right",right:"left"};function gv(s,l){if(!s)return l.map((d=>d.clone()));{if(s.length!==l.length)return;let d=s.length;for(let h=0;h<d;h++){let y=s[h],w=l[h];if(!!y!=!!w)return;if(y&&w){let x=y.getWithExplicit("orient"),A=w.getWithExplicit("orient");if(x.explicit&&A.explicit&&x.value!==A.value)return;s[h]=yl(y,w)}}}return s}function yl(s,l){for(let d of zg){let h=qi(s.getWithExplicit(d),l.getWithExplicit(d),d,"axis",((y,w)=>{switch(d){case"title":return ni(y,w);case"gridScale":return{explicit:y.explicit,value:Ke(y.value,w.value)}}return Rc(y,w,d,"axis")}));s.setWithExplicit(d,h)}return s}function Gg(s,l,d,h,y){if(l==="disable")return d!==void 0;switch(d=d||{},l){case"titleAngle":case"labelAngle":return s===(Ze(d.labelAngle)?d.labelAngle:Lt(d.labelAngle));case"values":return!!d.values;case"encode":return!!d.encoding||!!d.labelAngle;case"title":if(s===Vy(h,y))return!0}return s===d[l]}let xu=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function jg(s,l){var ge,xe;let d=l.axis(s),h=new Ap,y=vn(l.encoding[s]),{mark:w,config:x}=l,A=(d==null?void 0:d.orient)||((ge=x[s==="x"?"axisX":"axisY"])==null?void 0:ge.orient)||((xe=x.axis)==null?void 0:xe.orient)||(function(me){return me==="x"?"bottom":"left"})(s),C=l.getScaleComponent(s).get("type"),L=(function(me,Ae,Re,Pe){let We=Ae==="band"?["axisDiscrete","axisBand"]:Ae==="point"?["axisDiscrete","axisPoint"]:V0(Ae)?["axisQuantitative"]:Ae==="time"||Ae==="utc"?["axisTemporal"]:[],Je=me==="x"?"axisX":"axisY",it=Ze(Re)?"axisOrient":`axis${yt(Re)}`,Qe=[...We,...We.map((kt=>Je+kt.substr(4)))],lt=["axis",it,Je];return{vlOnlyAxisConfig:di(Qe,Pe,me,Re),vgAxisConfig:di(lt,Pe,me,Re),axisConfigStyle:f1([...lt,...Qe],Pe)}})(s,C,A,l.config),G=d!==void 0?!d:og("disable",x.style,d==null?void 0:d.style,L).configValue;if(h.set("disable",G,d!==void 0),G)return h;d=d||{};let H=(function(me,Ae,Re,Pe,We){let Je=Ae==null?void 0:Ae.labelAngle;if(Je!==void 0)return Ze(Je)?Je:Lt(Je);{let{configValue:it}=og("labelAngle",Pe,Ae==null?void 0:Ae.style,We);return it!==void 0?Lt(it):Re!==Qt||!Z([nf,tf],me.type)||ze(me)&&me.timeUnit?void 0:270}})(y,d,s,x.style,L),X=ry(d.formatType,y,C),J=ay(y,y.type,d.format,d.formatType,x,!0),le={fieldOrDatumDef:y,axis:d,channel:s,model:l,scaleType:C,orient:A,labelAngle:H,format:J,formatType:X,mark:w,config:x};for(let me of zg){let Ae=me in Hy?Hy[me](le):uy(me)?d[me]:void 0,Re=Ae!==void 0,Pe=Gg(Ae,me,d,l,s);if(Re&&Pe)h.set(me,Ae,Pe);else{let{configValue:We,configFrom:Je}=uy(me)&&me!=="values"?og(me,x.style,d.style,L):{},it=We!==void 0;Re&&!it?h.set(me,Ae,Pe):(Je!=="vgAxisConfig"||xu.has(me)&&it||su(We)||Ze(We))&&h.set(me,We,!1)}}let te=d.encoding??{},pe=us.reduce(((me,Ae)=>{if(!h.hasAxisPart(Ae))return me;let Re=cg(te[Ae]??{},l),Pe=Ae==="labels"?(function(We,Je,it){let{encoding:Qe,config:lt}=We,kt=vn(Qe[Je])??vn(Qe[Ci(Je)]),Fn=We.axis(Je)||{},{format:dn,formatType:sn}=Fn;if(Xs(sn))return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:dn,formatType:sn,config:lt}),...it};if(dn===void 0&&sn===void 0&&lt.customFormatTypes){if(tu(kt)==="quantitative"){if(nu(kt)&&kt.stack==="normalize"&&lt.normalizedNumberFormatType)return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:lt.normalizedNumberFormat,formatType:lt.normalizedNumberFormatType,config:lt}),...it};if(lt.numberFormatType)return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:lt.numberFormat,formatType:lt.numberFormatType,config:lt}),...it}}if(tu(kt)==="temporal"&&lt.timeFormatType&&ze(kt)&&!kt.timeUnit)return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:lt.timeFormat,formatType:lt.timeFormatType,config:lt}),...it}}return it})(l,s,Re):Re;return Pe===void 0||ye(Pe)||(me[Ae]={update:Pe}),me}),{});return ye(pe)||h.set("encode",pe,!!d.encoding||d.labelAngle!==void 0),h}function Tp(s,l){let{config:d}=s;return{...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Wn("size",s),...Wn("angle",s),...bv(s,d,l)}}function bv(s,l,d){return d?{shape:{value:d}}:Wn("shape",s)}let yv={vgMark:"rule",encodeEntry:s=>{let{markDef:l}=s,d=l.orient;return s.encoding.x||s.encoding.y||s.encoding.latitude||s.encoding.longitude?{...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...ep("x",s,{defaultPos:d==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:d!=="vertical"}),...ep("y",s,{defaultPos:d==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:d!=="horizontal"}),...Wn("size",s,{vgChannel:"strokeWidth"})}:{}}};function v1(s,l,d){if(Ht("align",s,d)===void 0)return"center"}function vv(s,l,d){if(Ht("baseline",s,d)===void 0)return"middle"}let Cp={vgMark:"rect",encodeEntry:s=>{let{config:l,markDef:d}=s,h=d.orient,y=h==="horizontal"?"width":"height",w=h==="horizontal"?"height":"width";return{...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid",vgChannel:"xc"}),...Vn("y",s,{defaultPos:"mid",vgChannel:"yc"}),...Wn("size",s,{defaultValue:Ev(s),vgChannel:y}),[w]:on(Ht("thickness",d,l))}}};function Ev(s){let{config:l,markDef:d}=s,{orient:h}=d,y=h==="horizontal"?"width":"height",w=s.getScaleComponent(h==="horizontal"?"x":"y"),x=Ht("size",d,l,{vgChannel:y})??l.tick.bandSize;if(x!==void 0)return x;{let A=w?w.get("range"):void 0;return A&&go(A)&&b.isNumber(A.step)?3*A.step/4:3*fu(l.view,y)/4}}let od={arc:{vgMark:"arc",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...li(s,"radius"),...li(s,"theta")})},area:{vgMark:"area",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...ep("x",s,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:s.markDef.orient==="horizontal"}),...ep("y",s,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:s.markDef.orient==="vertical"}),...Lc(s)})},bar:{vgMark:"rect",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...li(s,"x"),...li(s,"y")})},circle:{vgMark:"symbol",encodeEntry:s=>Tp(s,"circle")},geoshape:{vgMark:"shape",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:s=>{let{encoding:l}=s,d=l.shape;return[{type:"geoshape",projection:s.projectionName(),...d&&ze(d)&&d.type===Vs?{field:je(d,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...li(s,"x"),...li(s,"y"),...Jf(s,"url")})},line:{vgMark:"line",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Wn("size",s,{vgChannel:"strokeWidth"}),...Lc(s)})},point:{vgMark:"symbol",encodeEntry:s=>Tp(s)},rect:{vgMark:"rect",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...li(s,"x"),...li(s,"y")})},rule:yv,square:{vgMark:"symbol",encodeEntry:s=>Tp(s,"square")},text:{vgMark:"text",encodeEntry:s=>{let{config:l,encoding:d}=s;return{...Na(s,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Jf(s),...Wn("size",s,{vgChannel:"fontSize"}),...Wn("angle",s),...Fy("align",v1(s.markDef,d,l)),...Fy("baseline",vv(s.markDef,d,l)),...Vn("radius",s,{defaultPos:null}),...Vn("theta",s,{defaultPos:null})}}},tick:Cp,trail:{vgMark:"trail",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Wn("size",s),...Lc(s)})}};function Hg(s){if(Z([uc,af,z_],s.mark)){let l=im(s.mark,s.encoding);if(l.length>0)return(function(d,h){return[{name:d.getName("pathgroup"),type:"group",from:{facet:{name:qg+d.requestDataName(nn.Main),data:d.requestDataName(nn.Main),groupby:h}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Rp(d,{fromPrefix:qg})}]})(s,l)}else if(s.mark===rf){let l=Ah.some((d=>Ht(d,s.markDef,s.config)));if(s.stack&&!s.fieldDef("size")&&l)return(function(d){var G;let[h]=Rp(d,{fromPrefix:Wg}),y=d.scaleName(d.stack.fieldChannel),w=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return d.vgField(d.stack.fieldChannel,H)},x=(H,X)=>`${H}(${[w({prefix:"min",suffix:"start",expr:X}),w({prefix:"max",suffix:"start",expr:X}),w({prefix:"min",suffix:"end",expr:X}),w({prefix:"max",suffix:"end",expr:X})].map((J=>`scale('${y}',${J})`)).join(",")})`,A,C;d.stack.fieldChannel==="x"?(A={...V(h.encode.update,["y","yc","y2","height",...Ah]),x:{signal:x("min","datum")},x2:{signal:x("max","datum")},clip:{value:!0}},C={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},h.encode.update={...ee(h.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(A={...V(h.encode.update,["x","xc","x2","width"]),y:{signal:x("min","datum")},y2:{signal:x("max","datum")},clip:{value:!0}},C={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},h.encode.update={...ee(h.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(let H of Ah){let X=Ga(H,d.markDef,d.config);h.encode.update[H]?(A[H]=h.encode.update[H],delete h.encode.update[H]):X&&(A[H]=on(X)),X&&(h.encode.update[H]={value:0})}let L=[];if(((G=d.stack.groupbyChannels)==null?void 0:G.length)>0)for(let H of d.stack.groupbyChannels){let X=d.fieldDef(H),J=je(X);J&&L.push(J),(X!=null&&X.bin||X!=null&&X.timeUnit)&&L.push(je(X,{binSuffix:"end"}))}return A=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((H,X)=>{if(h.encode.update[X])return{...H,[X]:h.encode.update[X]};{let J=Ga(X,d.markDef,d.config);return J!==void 0?{...H,[X]:on(J)}:H}}),A),A.stroke&&(A.strokeForeground={value:!0},A.strokeOffset={value:0}),[{type:"group",from:{facet:{data:d.requestDataName(nn.Main),name:Wg+d.requestDataName(nn.Main),groupby:L,aggregate:{fields:[w({suffix:"start"}),w({suffix:"start"}),w({suffix:"end"}),w({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:A},marks:[{type:"group",encode:{update:C},marks:[h]}]}]})(s)}return Rp(s)}let qg="faceted_path_",Wg="stack_group_";function Rp(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{fromPrefix:""},{mark:d,markDef:h,encoding:y,config:w}=s,x=Ke(h.clip,(function(J){let le=J.getScaleComponent("x"),te=J.getScaleComponent("y");return!(!(le!=null&&le.get("selectionExtent"))&&!(te!=null&&te.get("selectionExtent")))||void 0})(s),(function(J){let le=J.component.projection;return!(!le||le.isFit)||void 0})(s)),A=R0(h),C=y.key,L=(function(J){var Ae;let{encoding:le,stack:te,mark:pe,markDef:ge,config:xe}=J,me=le.order;if(!(!b.isArray(me)&&cr(me)&&he(me.value)||!me&&he(Ht("order",ge,xe)))){if((b.isArray(me)||ze(me))&&!te)return ql(me,{expr:"datum"});if(is(pe)){let Re=ge.orient==="horizontal"?"y":"x",Pe=le[Re];if(ze(Pe)){let We=Pe.sort;return b.isArray(We)?{field:je(Pe,{prefix:Re,suffix:"sort_index",expr:"datum"})}:ii(We)?{field:je({aggregate:rm(J.encoding)?We.op:void 0,field:We.field},{expr:"datum"})}:Zh(We)?{field:je(J.fieldDef(We.encoding),{expr:"datum"}),order:We.order}:We===null?void 0:{field:je(Pe,{binSuffix:(Ae=J.stack)!=null&&Ae.impute?"mid":void 0,expr:"datum"})}}}}})(s),G=(function(J){if(!J.component.selection)return null;let le=be(J.component.selection).length,te=le,pe=J.parent;for(;pe&&te===0;)te=be(pe.component.selection).length,pe=pe.parent;return te?{interactive:le>0||J.mark==="geoshape"||!!J.encoding.tooltip}:null})(s),H=Ht("aria",h,w),X=od[d].postEncodingTransform?od[d].postEncodingTransform(s):null;return[{name:s.getName("marks"),type:od[d].vgMark,...x?{clip:!0}:{},...A?{style:A}:{},...C?{key:C.field}:{},...L?{sort:L}:{},...G||{},...H===!1?{aria:H}:{},from:{data:l.fromPrefix+s.requestDataName(nn.Main)},encode:{update:od[d].encodeEntry(s)},...X?{transform:X}:{}}]}class Np extends rd{constructor(l,d,h){let y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},w=arguments.length>4?arguments[4]:void 0;super(l,"unit",d,h,w,void 0,Sc(l)?l.view:void 0),at(this,"markDef",void 0),at(this,"encoding",void 0),at(this,"specifiedScales",{}),at(this,"stack",void 0),at(this,"specifiedAxes",{}),at(this,"specifiedLegends",{}),at(this,"specifiedProjection",{}),at(this,"selection",[]),at(this,"children",[]);let x=Li(l.mark)?{...l.mark}:{type:l.mark},A=x.type;x.filled===void 0&&(x.filled=(function(L,G,H){let{graticule:X}=H;if(X)return!1;let J=Ga("filled",L,G),le=L.type;return Ke(J,le!==of&&le!==uc&&le!==sf)})(x,w,{graticule:l.data&&Yf(l.data)}));let C=this.encoding=(function(L,G,H,X){let J={};for(let te of be(L))b0(te)||Be(`${le=te}-encoding is dropped as ${le} is not a valid encoding channel.`);var le;for(let te of Zu){if(!L[te])continue;let pe=L[te];if(Qn(te)){let ge=v_(te),xe=J[ge];if(ze(xe)&&q0(xe.type)&&ze(pe)&&!xe.timeUnit){Be(Ch(ge));continue}}if(te!=="angle"||G!=="arc"||L.theta||(Be("Arc marks uses theta channel rather than angle, replacing angle with theta."),te=ar),_f(L,te,G)){if(te===Si&&G==="line"){let ge=dr(L[te]);if(ge!=null&&ge.aggregate){Be("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(te===Fe&&(H?"fill"in L:"stroke"in L))Be(D0("encoding",{fill:"fill"in L,stroke:"stroke"in L}));else if(te===po||te===Bs&&!b.isArray(pe)&&!cr(pe)||te===Jr&&b.isArray(pe)){if(pe){if(te===Bs){let ge=L[te];if(iy(ge)){J[te]=ge;continue}}J[te]=b.array(pe).reduce(((ge,xe)=>(ze(xe)?ge.push(ru(xe,te)):Be(Hd(xe,te)),ge)),[])}}else{if(te===Jr&&pe===null)J[te]=null;else if(!(ze(pe)||Pi(pe)||cr(pe)||hf(pe)||Ze(pe))){Be(Hd(pe,te));continue}J[te]=am(pe,te,X)}}else Be(Mi(te,G))}return J})(l.encoding||{},A,x.filled,w);this.markDef=yy(x,C,w),this.size=(function(L){let{encoding:G,size:H}=L;for(let X of Qr){let J=xa(X);qa(H[J])&&os(G[X])&&(delete H[J],Be(Oh(J)))}return H})({encoding:C,size:Sc(l)?{...y,...l.width?{width:l.width}:{},...l.height?{height:l.height}:{}}:y}),this.stack=_m(this.markDef,C),this.specifiedScales=this.initScales(A,C),this.specifiedAxes=this.initAxes(C),this.specifiedLegends=this.initLegends(C),this.specifiedProjection=l.projection,this.selection=(l.params??[]).filter((L=>_c(L)))}get hasProjection(){let{encoding:l}=this,d=this.mark===J0,h=l&&m0.some((y=>_t(l[y])));return d||h}scaleDomain(l){let d=this.specifiedScales[l];return d?d.domain:void 0}axis(l){return this.specifiedAxes[l]}legend(l){return this.specifiedLegends[l]}initScales(l,d){return Gl.reduce(((h,y)=>{let w=vn(d[y]);return w&&(h[y]=this.initScale(w.scale??{})),h}),{})}initScale(l){let{domain:d,range:h}=l,y=ea(l);return b.isArray(d)&&(y.domain=d.map(Gn)),b.isArray(h)&&(y.range=h.map(Gn)),y}initAxes(l){return Qr.reduce(((d,h)=>{let y=l[h];if(_t(y)||h===Qt&&_t(l.x2)||h===Bn&&_t(l.y2)){let w=_t(y)?y.axis:void 0;d[h]=w&&this.initAxis({...w})}return d}),{})}initAxis(l){let d=be(l),h={};for(let y of d){let w=l[y];h[y]=su(w)?T0(w):Gn(w)}return h}initLegends(l){return k0.reduce(((d,h)=>{let y=vn(l[h]);if(y&&(function(w){switch(w){case Fe:case Sa:case Zr:case Si:case Sn:case xi:case fo:case Jo:return!0;case Ft:case Ai:case Ba:return!1}})(h)){let w=y.legend;d[h]=w&&ea(w)}return d}),{})}parseData(){this.component.data=Sp(this)}parseLayoutSize(){(function(l){let{size:d,component:h}=l;for(let y of Qr){let w=xa(y);if(d[w]){let x=d[w];h.layoutSize.set(w,qa(x)?"step":x,!0)}else{let x=$r(l,w);h.layoutSize.set(w,x,!1)}}})(this)}parseSelections(){this.component.selection=(function(l,d){let h={},y=l.config.selection;if(!d||!d.length)return h;for(let w of d){let x=$e(w.name),A=w.select,C=b.isString(A)?A:A.type,L=b.isObject(A)?j(A):{type:C},G=y[C];for(let J in G)J!=="fields"&&J!=="encodings"&&(J==="mark"&&(L[J]={...G[J],...L[J]}),L[J]!==void 0&&L[J]!==!0||(L[J]=j(G[J]??L[J])));let H=h[x]={...L,name:x,type:C,init:w.value,bind:w.bind,events:b.isString(L.on)?b.parseSelector(L.on,"scope"):b.array(j(L.on))},X=j(w);for(let J of il)J.defined(H)&&J.parse&&J.parse(l,H,X)}return h})(this,this.selection)}parseMarkGroup(){this.component.mark=Hg(this)}parseAxesAndHeaders(){var l;this.component.axes=(l=this,Qr.reduce(((d,h)=>(l.component.scales[h]&&(d[h]=[jg(h,l)]),d)),{}))}assembleSelectionTopLevelSignals(l){return(function(d,h){let y=!1;for(let w of Te(d.component.selection??{})){let x=w.name,A=b.stringValue(x+ms);if(h.filter((C=>C.name===x)).length===0){let C=w.resolve==="global"?"union":w.resolve,L=w.type==="point"?", true, true)":")";h.push({name:w.name,update:`${rg}(${A}, ${b.stringValue(C)}${L}`})}y=!0;for(let C of il)C.defined(w)&&C.topLevelSignals&&(h=C.topLevelSignals(d,w,h))}return y&&h.filter((w=>w.name==="unit")).length===0&&h.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),Kf(h)})(this,l)}assembleSignals(){return[...wu(this),...Cy(this,[])]}assembleSelectionData(l){return(function(d,h){let y=[...h],w=Wa(d,{escape:!1});for(let x of Te(d.component.selection??{})){let A={name:x.name+ms};if(x.project.hasSelectionId&&(A.transform=[{type:"collect",sort:{field:fr}}]),x.init){let C=x.project.items.map(Hm);A.values=x.project.hasSelectionId?x.init.map((L=>({unit:w,[fr]:ps(L,!1)[0]}))):x.init.map((L=>({unit:w,fields:C,values:ps(L,!1)})))}y.filter((C=>C.name===x.name+ms)).length||y.push(A)}return y})(this,l)}assembleLayout(){return null}assembleLayoutSignals(){return pr(this)}assembleMarks(){let l=this.component.mark??[];return this.parent&&ws(this.parent)||(l=Ry(this,l)),l.map(this.correctDataNames)}assembleGroupStyle(){let{style:l}=this.view||{};return l!==void 0?l:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(l){return Ui(this.encoding,l)}fieldDef(l){return dr(this.encoding[l])}typedFieldDef(l){let d=this.fieldDef(l);return ma(d)?d:null}}class Au extends ad{constructor(l,d,h,y,w){super(l,"layer",d,h,w,l.resolve,l.view),at(this,"children",void 0);let x={...y,...l.width?{width:l.width}:{},...l.height?{height:l.height}:{}};this.children=l.layer.map(((A,C)=>{if(pu(A))return new Au(A,this,this.getName(`layer_${C}`),x,w);if(Bi(A))return new Np(A,this,this.getName(`layer_${C}`),x,w);throw new Error(Th(A))}))}parseData(){this.component.data=Sp(this);for(let l of this.children)l.parseData()}parseLayoutSize(){var l;gl(l=this),Ss(l,"width"),Ss(l,"height")}parseSelections(){this.component.selection={};for(let l of this.children){l.parseSelections();for(let d of be(l.component.selection))this.component.selection[d]=l.component.selection[d]}}parseMarkGroup(){for(let l of this.children)l.parseMarkGroup()}parseAxesAndHeaders(){(function(l){let{axes:d,resolve:h}=l.component,y={top:0,bottom:0,right:0,left:0};for(let w of l.children){w.parseAxesAndHeaders();for(let x of be(w.component.axes))h.axis[x]=sp(l.component.resolve,x),h.axis[x]==="shared"&&(d[x]=gv(d[x],w.component.axes[x]),d[x]||(h.axis[x]="independent",delete d[x]))}for(let w of Qr){for(let x of l.children)if(x.component.axes[w]){if(h.axis[w]==="independent"){d[w]=(d[w]??[]).concat(x.component.axes[w]);for(let A of x.component.axes[w]){let{value:C,explicit:L}=A.getWithExplicit("orient");if(!Ze(C)){if(y[C]>0&&!L){let G=Bt[C];y[C]>y[G]&&A.set("orient",G,!1)}y[C]++}}}delete x.component.axes[w]}if(h.axis[w]==="independent"&&d[w]&&d[w].length>1)for(let[x,A]of(d[w]||[]).entries())x>0&&A.get("grid")&&!A.explicit.grid&&(A.implicit.grid=!1)}})(this)}assembleSelectionTopLevelSignals(l){return this.children.reduce(((d,h)=>h.assembleSelectionTopLevelSignals(d)),l)}assembleSignals(){return this.children.reduce(((l,d)=>l.concat(d.assembleSignals())),wu(this))}assembleLayoutSignals(){return this.children.reduce(((l,d)=>l.concat(d.assembleLayoutSignals())),pr(this))}assembleSelectionData(l){return this.children.reduce(((d,h)=>h.assembleSelectionData(d)),l)}assembleGroupStyle(){let l=new Set;for(let h of this.children)for(let y of b.array(h.assembleGroupStyle()))l.add(y);let d=Array.from(l);return d.length>1?d:d.length===1?d[0]:void 0}assembleTitle(){let l=super.assembleTitle();if(l)return l;for(let d of this.children)if(l=d.assembleTitle(),l)return l}assembleLayout(){return null}assembleMarks(){return(function(l,d){for(let h of l.children)cn(h)&&(d=Ry(h,d));return d})(this,this.children.flatMap((l=>l.assembleMarks())))}assembleLegends(){return this.children.reduce(((l,d)=>l.concat(d.assembleLegends())),dp(this))}}function Vg(s,l,d,h,y){if(pc(s))return new bl(s,l,d,y);if(pu(s))return new Au(s,l,d,h,y);if(Bi(s))return new Np(s,l,d,h,y);if((function(w){return du(w)||Df(w)||kc(w)})(s))return new y1(s,l,d,y);throw new Error(Th(s))}let E1=S;p.accessPathDepth=Xt,p.accessPathWithDatum=xt,p.compile=function(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var d;l.logger&&(d=l.logger,ic=d),l.fieldTitle&&hc(l.fieldTitle);try{let h=vm(b.mergeConfig(l.config,s.config)),y=jf(s,h),w=Vg(y,null,"",void 0,h);return w.parse(),(function(A,C){yp(A.sources);let L=0,G=0;for(let H=0;H<bp&&iv(A,C,!0);H++)L++;A.sources.map(Ag);for(let H=0;H<bp&&iv(A,C,!1);H++)G++;yp(A.sources),Math.max(L,G)===bp&&Be(`Maximum optimization runs(${bp}) reached.`)})(w.component.data,w),{spec:(function(A,C){let L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3?arguments[3]:void 0,H=A.config?Lf(A.config):void 0,X=[].concat(A.assembleSelectionData([]),(function(Ae,Re){let Pe=[],We=_p(Pe),Je=0;for(let Qe of Ae.sources){Qe.hasName()||(Qe.dataName="source_"+Je++);let lt=Qe.assemble();We(Qe,lt)}for(let Qe of Pe)Qe.transform.length===0&&delete Qe.transform;let it=0;for(let[Qe,lt]of Pe.entries())(lt.transform??[]).length!==0||lt.source||Pe.splice(it++,0,Pe.splice(Qe,1)[0]);for(let Qe of Pe)for(let lt of Qe.transform??[])lt.type==="lookup"&&(lt.from=Ae.outputNodes[lt.from].getSource());for(let Qe of Pe)Qe.name in Re&&(Qe.values=Re[Qe.name]);return Pe})(A.component.data,L)),J=A.assembleProjections(),le=A.assembleTitle(),te=A.assembleGroupStyle(),pe=A.assembleGroupEncodeEntry(!0),ge=A.assembleLayoutSignals();ge=ge.filter((Ae=>Ae.name!=="width"&&Ae.name!=="height"||Ae.value===void 0||(C[Ae.name]=+Ae.value,!1)));let{params:xe,...me}=C;return{$schema:"https://vega.github.io/schema/vega/v5.json",...A.description?{description:A.description}:{},...me,...le?{title:le}:{},...te?{style:te}:{},...pe?{encode:{update:pe}}:{},data:X,...J.length>0?{projections:J}:{},...A.assembleGroup([...ge,...A.assembleSelectionTopLevelSignals([]),...Of(xe)]),...H?{config:H}:{},...G?{usermeta:G}:{}}})(w,(function(A,C,L,G){let H=G.component.layoutSize.get("width"),X=G.component.layoutSize.get("height");if(C===void 0?(C={type:"pad"},G.hasAxisOrientSignalRef()&&(C.resize=!0)):b.isString(C)&&(C={type:C}),H&&X&&(J=C.type,J==="fit"||J==="fit-x"||J==="fit-y")){if(H==="step"&&X==="step")Be(Cn()),C.type="pad";else if(H==="step"||X==="step"){let le=H==="step"?"width":"height";Be(Cn(ec(le)));let te=le==="width"?"height":"width";C.type=(function(pe){return pe?`fit-${ec(pe)}`:"fit"})(te)}}var J;return{...be(C).length===1&&C.type?C.type==="pad"?{}:{autosize:C.type}:{autosize:C},...Hf(L,!1),...Hf(A,!0)}})(s,y.autosize,h,w),s.datasets,s.usermeta),normalized:y}}finally{l.logger&&(ic=P0),l.fieldTitle&&hc(ly)}},p.contains=Z,p.deepEqual=Ie,p.deleteNestedProperty=dt,p.duplicate=j,p.entries=ke,p.every=oe,p.fieldIntersection=Ee,p.flatAccessWithDatum=rn,p.getFirstDefined=Ke,p.hasIntersection=Me,p.hash=ne,p.internalField=Et,p.isBoolean=Ye,p.isEmpty=ye,p.isEqual=function(s,l){let d=be(s),h=be(l);if(d.length!==h.length)return!1;for(let y of d)if(s[y]!==l[y])return!1;return!0},p.isInternalField=Jt,p.isNullOrFalse=he,p.isNumeric=Ct,p.keys=be,p.logicalExpr=Le,p.mergeDeep=ce,p.never=W,p.normalize=jf,p.normalizeAngle=Lt,p.omit=ee,p.pick=V,p.prefixGenerator=Ge,p.removePathFromField=Tt,p.replaceAll=St,p.replacePathInField=jt,p.resetIdCounter=function(){et=42},p.setEqual=Ce,p.some=ae,p.stringify=Xe,p.titleCase=yt,p.unique=_e,p.uniqueId=Zt,p.vals=Te,p.varName=$e,p.version=E1}))});var C2=rA((kG,d_)=>{var Hz=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{},D=(function(p){var b=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,S=0,T={},R={manual:p.Prism&&p.Prism.manual,disableWorkerMessageHandler:p.Prism&&p.Prism.disableWorkerMessageHandler,util:{encode:function Z(ae){return ae instanceof $?new $(ae.type,Z(ae.content),ae.alias):Array.isArray(ae)?ae.map(Z):ae.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(Z){return Object.prototype.toString.call(Z).slice(8,-1)},objId:function(Z){return Z.__id||Object.defineProperty(Z,"__id",{value:++S}),Z.__id},clone:function Z(ae,oe){var ce,de;switch(oe=oe||{},R.util.type(ae)){case"Object":if(de=R.util.objId(ae),oe[de])return oe[de];for(var _e in ce={},oe[de]=ce,ae)ae.hasOwnProperty(_e)&&(ce[_e]=Z(ae[_e],oe));return ce;case"Array":return de=R.util.objId(ae),oe[de]?oe[de]:(ce=[],oe[de]=ce,ae.forEach((function(Ce,Me){ce[Me]=Z(Ce,oe)})),ce);default:return ae}},getLanguage:function(Z){for(;Z;){var ae=b.exec(Z.className);if(ae)return ae[1].toLowerCase();Z=Z.parentElement}return"none"},setLanguage:function(Z,ae){Z.className=Z.className.replace(RegExp(b,"gi"),""),Z.classList.add("language-"+ae)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(ce){var Z=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(ce.stack)||[])[1];if(Z){var ae=document.getElementsByTagName("script");for(var oe in ae)if(ae[oe].src==Z)return ae[oe]}return null}},isActive:function(Z,ae,oe){for(var ce="no-"+ae;Z;){var de=Z.classList;if(de.contains(ae))return!0;if(de.contains(ce))return!1;Z=Z.parentElement}return!!oe}},languages:{plain:T,plaintext:T,text:T,txt:T,extend:function(Z,ae){var oe=R.util.clone(R.languages[Z]);for(var ce in ae)oe[ce]=ae[ce];return oe},insertBefore:function(Z,ae,oe,ce){var de=(ce=ce||R.languages)[Z],_e={};for(var Ce in de)if(de.hasOwnProperty(Ce)){if(Ce==ae)for(var Me in oe)oe.hasOwnProperty(Me)&&(_e[Me]=oe[Me]);oe.hasOwnProperty(Ce)||(_e[Ce]=de[Ce])}var Ge=ce[Z];return ce[Z]=_e,R.languages.DFS(R.languages,(function(Ee,ye){ye===Ge&&Ee!=Z&&(this[Ee]=_e)})),_e},DFS:function Z(ae,oe,ce,de){de=de||{};var _e=R.util.objId;for(var Ce in ae)if(ae.hasOwnProperty(Ce)){oe.call(ae,Ce,ae[Ce],ce||Ce);var Me=ae[Ce],Ge=R.util.type(Me);Ge!=="Object"||de[_e(Me)]?Ge!=="Array"||de[_e(Me)]||(de[_e(Me)]=!0,Z(Me,oe,Ce,de)):(de[_e(Me)]=!0,Z(Me,oe,null,de))}}},plugins:{},highlightAll:function(Z,ae){R.highlightAllUnder(document,Z,ae)},highlightAllUnder:function(Z,ae,oe){var ce={callback:oe,container:Z,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};R.hooks.run("before-highlightall",ce),ce.elements=Array.prototype.slice.apply(ce.container.querySelectorAll(ce.selector)),R.hooks.run("before-all-elements-highlight",ce);for(var de,_e=0;de=ce.elements[_e++];)R.highlightElement(de,ae===!0,ce.callback)},highlightElement:function(Z,ae,oe){var ce=R.util.getLanguage(Z),de=R.languages[ce];R.util.setLanguage(Z,ce);var _e=Z.parentElement;_e&&_e.nodeName.toLowerCase()==="pre"&&R.util.setLanguage(_e,ce);var Ce={element:Z,language:ce,grammar:de,code:Z.textContent};function Me(Ee){Ce.highlightedCode=Ee,R.hooks.run("before-insert",Ce),Ce.element.innerHTML=Ce.highlightedCode,R.hooks.run("after-highlight",Ce),R.hooks.run("complete",Ce),oe&&oe.call(Ce.element)}if(R.hooks.run("before-sanity-check",Ce),(_e=Ce.element.parentElement)&&_e.nodeName.toLowerCase()==="pre"&&!_e.hasAttribute("tabindex")&&_e.setAttribute("tabindex","0"),!Ce.code)return R.hooks.run("complete",Ce),void(oe&&oe.call(Ce.element));if(R.hooks.run("before-highlight",Ce),Ce.grammar)if(ae&&p.Worker){var Ge=new Worker(R.filename);Ge.onmessage=function(Ee){Me(Ee.data)},Ge.postMessage(JSON.stringify({language:Ce.language,code:Ce.code,immediateClose:!0}))}else Me(R.highlight(Ce.code,Ce.grammar,Ce.language));else Me(R.util.encode(Ce.code))},highlight:function(Z,ae,oe){var ce={code:Z,grammar:ae,language:oe};if(R.hooks.run("before-tokenize",ce),!ce.grammar)throw new Error('The language "'+ce.language+'" has no grammar.');return ce.tokens=R.tokenize(ce.code,ce.grammar),R.hooks.run("after-tokenize",ce),$.stringify(R.util.encode(ce.tokens),ce.language)},tokenize:function(Z,ae){var oe=ae.rest;if(oe){for(var ce in oe)ae[ce]=oe[ce];delete ae.rest}var de=new j;return W(de,de.head,Z),F(Z,de,ae,de.head,0),(function(_e){for(var Ce=[],Me=_e.head.next;Me!==_e.tail;)Ce.push(Me.value),Me=Me.next;return Ce})(de)},hooks:{all:{},add:function(Z,ae){var oe=R.hooks.all;oe[Z]=oe[Z]||[],oe[Z].push(ae)},run:function(Z,ae){var oe=R.hooks.all[Z];if(oe&&oe.length)for(var ce,de=0;ce=oe[de++];)ce(ae)}},Token:$};function $(Z,ae,oe,ce){this.type=Z,this.content=ae,this.alias=oe,this.length=0|(ce||"").length}function P(Z,ae,oe,ce){Z.lastIndex=ae;var de=Z.exec(oe);if(de&&ce&&de[1]){var _e=de[1].length;de.index+=_e,de[0]=de[0].slice(_e)}return de}function F(Z,ae,oe,ce,de,_e){for(var Ce in oe)if(oe.hasOwnProperty(Ce)&&oe[Ce]){var Me=oe[Ce];Me=Array.isArray(Me)?Me:[Me];for(var Ge=0;Ge<Me.length;++Ge){if(_e&&_e.cause==Ce+","+Ge)return;var Ee=Me[Ge],ye=Ee.inside,be=!!Ee.lookbehind,Te=!!Ee.greedy,ke=Ee.alias;if(Te&&!Ee.pattern.global){var Ye=Ee.pattern.toString().match(/[imsuy]*$/)[0];Ee.pattern=RegExp(Ee.pattern.source,Ye+"g")}for(var $e=Ee.pattern||Ee,Le=ce.next,dt=de;Le!==ae.tail&&!(_e&&dt>=_e.reach);dt+=Le.value.length,Le=Le.next){var yt=Le.value;if(ae.length>Z.length)return;if(!(yt instanceof $)){var xt,rn=1;if(Te){if(!(xt=P($e,dt,Z,be))||xt.index>=Z.length)break;var hn=xt.index,jt=xt.index+xt[0].length,St=dt;for(St+=Le.value.length;hn>=St;)St+=(Le=Le.next).value.length;if(dt=St-=Le.value.length,Le.value instanceof $)continue;for(var Tt=Le;Tt!==ae.tail&&(St<jt||typeof Tt.value=="string");Tt=Tt.next)rn++,St+=Tt.value.length;rn--,yt=Z.slice(dt,St),xt.index-=dt}else if(!(xt=P($e,0,yt,be)))continue;hn=xt.index;var Xt=xt[0],Ke=yt.slice(0,hn),et=yt.slice(hn+Xt.length),Zt=dt+yt.length;_e&&Zt>_e.reach&&(_e.reach=Zt);var Et=Le.prev;if(Ke&&(Et=W(ae,Et,Ke),dt+=Ke.length),V(ae,Et,rn),Le=W(ae,Et,new $(Ce,ye?R.tokenize(Xt,ye):Xt,ke,Xt)),et&&W(ae,Le,et),rn>1){var Jt={cause:Ce+","+Ge,reach:Zt};F(Z,ae,oe,Le.prev,dt,Jt),_e&&Jt.reach>_e.reach&&(_e.reach=Jt.reach)}}}}}}function j(){var Z={value:null,prev:null,next:null},ae={value:null,prev:Z,next:null};Z.next=ae,this.head=Z,this.tail=ae,this.length=0}function W(Z,ae,oe){var ce=ae.next,de={value:oe,prev:ae,next:ce};return ae.next=de,ce.prev=de,Z.length++,de}function V(Z,ae,oe){for(var ce=ae.next,de=0;de<oe&&ce!==Z.tail;de++)ce=ce.next;ae.next=ce,ce.prev=ae,Z.length-=de}if(p.Prism=R,$.stringify=function Z(ae,oe){if(typeof ae=="string")return ae;if(Array.isArray(ae)){var ce="";return ae.forEach((function(Ge){ce+=Z(Ge,oe)})),ce}var de={type:ae.type,content:Z(ae.content,oe),tag:"span",classes:["token",ae.type],attributes:{},language:oe},_e=ae.alias;_e&&(Array.isArray(_e)?Array.prototype.push.apply(de.classes,_e):de.classes.push(_e)),R.hooks.run("wrap",de);var Ce="";for(var Me in de.attributes)Ce+=" "+Me+'="'+(de.attributes[Me]||"").replace(/"/g,"&quot;")+'"';return"<"+de.tag+' class="'+de.classes.join(" ")+'"'+Ce+">"+de.content+"</"+de.tag+">"},!p.document)return p.addEventListener&&(R.disableWorkerMessageHandler||p.addEventListener("message",(function(Z){var ae=JSON.parse(Z.data),oe=ae.language,ce=ae.code,de=ae.immediateClose;p.postMessage(R.highlight(ce,R.languages[oe],oe)),de&&p.close()}),!1)),R;var ee=R.util.currentScript();function ne(){R.manual||R.highlightAll()}if(ee&&(R.filename=ee.src,ee.hasAttribute("data-manual")&&(R.manual=!0)),!R.manual){var he=document.readyState;he==="loading"||he==="interactive"&&ee&&ee.defer?document.addEventListener("DOMContentLoaded",ne):window.requestAnimationFrame?window.requestAnimationFrame(ne):window.setTimeout(ne,16)}return R})(Hz);typeof d_<"u"&&d_.exports&&(d_.exports=D),typeof global<"u"&&(global.Prism=D);D.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},D.languages.markup.tag.inside["attr-value"].inside.entity=D.languages.markup.entity,D.languages.markup.doctype.inside["internal-subset"].inside=D.languages.markup,D.hooks.add("wrap",(function(p){p.type==="entity"&&(p.attributes.title=p.content.replace(/&amp;/,"&"))})),Object.defineProperty(D.languages.markup.tag,"addInlined",{value:function(p,b){var S={};S["language-"+b]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:D.languages[b]},S.cdata=/^<!\[CDATA\[|\]\]>$/i;var T={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:S}};T["language-"+b]={pattern:/[\s\S]+/,inside:D.languages[b]};var R={};R[p]={pattern:RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,(function(){return p})),"i"),lookbehind:!0,greedy:!0,inside:T},D.languages.insertBefore("markup","cdata",R)}}),Object.defineProperty(D.languages.markup.tag,"addAttribute",{value:function(p,b){D.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(`(^|["'\\s])(?:`+p+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[b,"language-"+b],inside:D.languages[b]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),D.languages.html=D.languages.markup,D.languages.mathml=D.languages.markup,D.languages.svg=D.languages.markup,D.languages.xml=D.languages.extend("markup",{}),D.languages.ssml=D.languages.xml,D.languages.atom=D.languages.xml,D.languages.rss=D.languages.xml;(function(p){var b=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;p.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+b.source+")*?(?:;|(?=\\s*\\{))"),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+b.source+`|(?:[^\\\\\r
13
+ `)):i+"";var o})(a))}function fO(e){return"["+e.map(pO).join(", ")+"]"}function pO(e){return Ee(e)?"[\u2026]":ye(e)&&!Sn(e)?"{\u2026}":e}function hO(e,t){let n=this;if(t=t||{},el.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){let i=mt({},e.locale,t.locale);n.locale(Qh(i.number,i.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Fu.Canvas,n._scenegraph=new V1;let a=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||qB,n._redraw=!0,n._handler=new sb().scene(a),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=(function(i){let o=mt({defaults:{}},i),u=(c,f)=>{f.forEach((m=>{Ee(c[m])&&(c[m]=ir(c[m]))}))};return u(o.defaults,["prevent","allow"]),u(o,["view","window","selector"]),o})(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);let r=(function(i,o,u){return YI(i,tl,Wb,u).parse(o)})(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map((i=>({state:null,param:mt({},i)}))),r.root&&r.root.set(a),a.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(a.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=cO(n,n._width),n._viewHeight=dO(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,(function(i){var o=i._signals,u=o[sO],c=o[lO],f=o[Ix];function m(){i._autosize=i._resize=1}i._resizeWidth=i.add(null,(v=>{i._width=v.size,i._viewWidth=cO(i,v.size),m()}),{size:u}),i._resizeHeight=i.add(null,(v=>{i._height=v.size,i._viewHeight=dO(i,v.size),m()}),{size:c});let g=i.add(null,m,{pad:f});i._resizeWidth.rank=u.rank+1,i._resizeHeight.rank=c.rank+1,g.rank=f.rank+1})(n),(function(i){i.add(null,(o=>(i._background=o.bg,i._resize=1,o.bg)),{bg:i._signals.background})})(n),(function(i){let o=i._signals.cursor||(i._signals.cursor=i.add({user:Ax,item:null}));i.on(i.events("view","mousemove"),o,((u,c)=>{let f=o.value,m=f?Ft(f)?f:f.user:Ax,g=c.item&&c.item.cursor||null;return f&&m===f.user&&g==f.item?f:{user:m,item:g}})),i.add(null,(function(u){let c=u.cursor,f=this.value;return Ft(c)||(f=c.item,c=c.user),Tx(i,c&&c!==Ax?c:f||c),f}),{cursor:o})})(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind)}function gw(e,t){return nt(e._signals,t)?e._signals[t]:F("Unrecognized signal name: "+st(t))}function mO(e,t){let n=(e._targets||[]).filter((a=>a._update&&a._update.handler===t));return n.length?n[0]:null}function gO(e,t,n,a){let r=mO(n,a);return r||(r=Cx(e,(()=>a(t,n.value))),r.handler=a,e.on(n,null,r)),e}function bO(e,t,n){let a=mO(t,n);return a&&t._targets.remove(a),e}Fe(hO,el,{async evaluate(e,t,n){if(await el.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,(function(a){var r=pw(a),i=JI(a),o=QI(a);a._renderer.background(a.background()),a._renderer.resize(i,o,r),a._handler.origin(r),a._resizeListeners.forEach((u=>{try{u(i,o)}catch(c){a.error(c)}}))})(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(a){this.error(a)}return n&&vn(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){let t=e!=null?e+"":null;return t!==this._desc&&ZI(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){let a=gw(this,e);return arguments.length===1?a.value:this.update(a,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",oO(e)):oO(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(Xv(e)||F("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(el.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(gw(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(e,t,n,a,r,i){this.runAfter((o=>{let u=0;o._autosize=0,o.width()!==n&&(u=1,o.signal(sO,n,uO),o._resizeWidth.skip(!0)),o.height()!==a&&(u=1,o.signal(lO,a,uO),o._resizeHeight.skip(!0)),o._viewWidth!==e&&(o._resize=1,o._viewWidth=e),o._viewHeight!==t&&(o._resize=1,o._viewHeight=t),o._origin[0]===r[0]&&o._origin[1]===r[1]||(o._resize=1,o._origin=r),u&&o.run("enter"),i&&o.runAfter((c=>c.resize()))}),!1,1)},addEventListener(e,t,n){let a=t;return n&&n.trap===!1||(a=Cx(this,t),a.raw=t),this._handler.on(e,a),this},removeEventListener(e,t){for(var n,a,r=this._handler.handlers(e),i=r.length;--i>=0;)if(a=r[i].type,n=r[i].handler,e===a&&(t===n||t===n.raw)){this._handler.off(a,n);break}return this},addResizeListener(e){let t=this._resizeListeners;return t.indexOf(e)<0&&t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return gO(this,e,gw(this,e),t)},removeSignalListener(e,t){return bO(this,gw(this,e),t)},addDataListener(e,t){return gO(this,e,dw(this,e).values,t)},removeDataListener(e,t){return bO(this,dw(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){let t=Tx(this,null);this._globalCursor=!!e,t&&Tx(this,t)}return this}return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:function(e,t){this._timers.push((function(n,a,r){var i=new jE,o=a;return a==null?(i.restart(n,a,r),i):(i._restart=i.restart,i.restart=function(u,c,f){c=+c,f=f==null?vS():+f,i._restart((function m(g){g+=o,i._restart(m,o+=c,f),u(g)}),c,f)},i.restart(n,a,r),i)})((function(n){e({timestamp:Date.now(),elapsed:n})}),t))},events:function(e,t,n){var a,r=this,i=new Ui(n),o=function(f,m){r.runAsync(null,(()=>{e===eO&&(function(g,v){var E=g._eventConfig.defaults,k=E.prevent,_=E.allow;return k!==!1&&_!==!0&&(k===!0||_===!1||(k?k[v]:_?!_[v]:g.preventDefault()))})(r,t)&&f.preventDefault(),i.receive(CB(r,f,m))}))};if(e===RB)hw(r,"timer",t)&&r.timer(o,t);else if(e===eO)hw(r,"view",t)&&r.addEventListener(t,o,IB);else if(e===NB?hw(r,"window",t)&&typeof window<"u"&&(a=[window]):typeof document<"u"&&hw(r,"selector",t)&&(a=Array.from(document.querySelectorAll(e))),a){for(var u=0,c=a.length;u<c;++u)a[u].addEventListener(t,o);tO(r,a,t,o)}else r.warn("Can not resolve event source: "+e);return i},finalize:function(){var e,t,n,a=this._tooltip,r=this._timers,i=this._eventListeners;for(e=r.length;--e>=0;)r[e].stop();for(e=i.length;--e>=0;)for(t=(n=i[e]).sources.length;--t>=0;)n.sources[t].removeEventListener(n.type,n.handler);return a&&a.call(this,this._handler,null,null,null),this},hover:function(e,t){return t=[t||"update",(e=[e||"hover"])[0]],this.on(this.events("view","mouseover",nO),aO,rO(e)),this.on(this.events("view","mouseout",nO),aO,rO(t)),this},data:function(e,t){return arguments.length<2?dw(this,e).values.value:fw.call(this,e,us().remove(Z).insert(t))},change:fw,insert:function(e,t){return fw.call(this,e,us().insert(t))},remove:function(e,t){return fw.call(this,e,us().remove(t))},scale:function(e){var t=this._runtime.scales;return nt(t,e)||F("Unrecognized scale or projection: "+e),t[e].value},initialize:function(e,t){let n=this,a=n._renderType,r=n._eventConfig.bind,i=Xv(a);e=n._el=e?Rx(n,e,!0):null,(function(c){let f=c.container();f&&(f.setAttribute("role","graphics-document"),f.setAttribute("aria-roleDescription","visualization"),ZI(f,c.description()))})(n),i||n.error("Unrecognized renderer type: "+a);let o=i.handler||sb,u=e?i.renderer:i.headless;return n._renderer=u?iO(n,n._renderer,e,u):null,n._handler=(function(c,f,m,g){let v=new g(c.loader(),Cx(c,c.tooltip())).scene(c.scenegraph().root).initialize(m,pw(c),c);return f&&f.handlers().forEach((E=>{v.on(E.type,E.handler)})),v})(n,n._handler,e,o),n._redraw=!0,e&&r!=="none"&&(t=t?n._elBind=Rx(n,t,!0):e.appendChild(wi("form",{class:"vega-bindings"})),n._bind.forEach((c=>{c.param.element&&r!=="container"&&(c.element=Rx(n,c.param.element,!!c.param.input))})),n._bind.forEach((c=>{(function(f,m,g){if(!m)return;let v=g.param,E=g.state;E||(E=g.state={elements:null,active:!1,set:null,update:k=>{k!=f.signal(v.signal)&&f.runAsync(null,(()=>{E.source=!0,f.signal(v.signal,k)}))}},v.debounce&&(E.update=Zo(v.debounce,E.update))),(v.input==null&&v.element?LB:FB)(E,m,v,f),E.active||(f.on(f._signals[v.signal],null,(()=>{E.source?E.source=!1:E.set(f.signal(v.signal))})),E.active=!0)})(n,c.element||t,c)}))),n},toImageURL:async function(e,t){e!==Fu.Canvas&&e!==Fu.SVG&&e!==Fu.PNG&&F("Unrecognized image type: "+e);let n=await Nx(this,e,t);return e===Fu.SVG?(function(a,r){let i=new Blob([a],{type:r});return window.URL.createObjectURL(i)})(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(e,t){return(await Nx(this,Fu.Canvas,e,t)).canvas()},toSVG:async function(e){return(await Nx(this,Fu.SVG,e)).svg()},getState:function(e){return this._runtime.getState(e||{data:jB,signals:HB,recurse:!0})},setState:function(e){return this.runAsync(null,(t=>{t._trigger=!1,t._runtime.setState(e)}),(t=>{t._trigger=!0})),this}});let WB="view",bw="[",yw="]",yO="{",vO="}",VB=":",EO=",",YB="@",KB=">",XB=/[[\]{}]/,ZB={"*":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},wO,_O;function kO(e,t,n){return wO=t||WB,_O=n||ZB,SO(e.trim()).map(Ox)}function Kb(e,t,n,a,r){let i=e.length,o,u=0;for(;t<i;++t){if(o=e[t],!u&&o===n)return t;r&&r.indexOf(o)>=0?--u:a&&a.indexOf(o)>=0&&++u}return t}function SO(e){let t=[],n=e.length,a=0,r=0;for(;r<n;)r=Kb(e,r,EO,bw+yO,yw+vO),t.push(e.substring(a,r).trim()),a=++r;if(t.length===0)throw"Empty event selector: "+e;return t}function Ox(e){return e[0]==="["?(function(t){let n=t.length,a,r=1;if(r=Kb(t,r,yw,bw,yw),r===n)throw"Empty between selector: "+t;if(a=SO(t.substring(1,r)),a.length!==2)throw"Between selector must have two elements: "+t;if(t=t.slice(r+1).trim(),t[0]!==KB)throw"Expected '>' after between selector: "+t;a=a.map(Ox);let i=Ox(t.slice(1).trim());return i.between?{between:a,stream:i}:(i.between=a,i)})(e):(function(t){let n={source:wO},a=[],r,i,o=[0,0],u=0,c=0,f=t.length,m=0;if(t[f-1]===vO){if(m=t.lastIndexOf(yO),!(m>=0))throw"Unmatched right brace: "+t;try{o=(function(g){let v=g.split(EO);if(!g.length||v.length>2)throw g;return v.map((E=>{let k=+E;if(k!=k)throw g;return k}))})(t.substring(m+1,f-1))}catch{throw"Invalid throttle specification: "+t}f=(t=t.slice(0,m).trim()).length,m=0}if(!f)throw t;if(t[0]===YB&&(u=++m),r=Kb(t,m,VB),r<f&&(a.push(t.substring(c,r).trim()),c=m=++r),m=Kb(t,m,bw),m===f)a.push(t.substring(c,f).trim());else if(a.push(t.substring(c,m).trim()),i=[],c=++m,c===f)throw"Unmatched left bracket: "+t;for(;m<f;){if(m=Kb(t,m,yw),m===f)throw"Unmatched left bracket: "+t;if(i.push(t.substring(c,m).trim()),m<f-1&&t[++m]!==bw)throw"Expected left bracket: "+t;c=++m}if(!(f=a.length)||XB.test(a[f-1]))throw"Invalid event selector: "+t;return f>1?(n.type=a[1],u?n.markname=a[0].slice(1):(function(g){return _O[g]})(a[0])?n.marktype=a[0]:n.source=a[0]):n.type=a[0],n.type.slice(-1)==="!"&&(n.consume=!0,n.type=n.type.slice(0,-1)),i!=null&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n})(e)}function JB(e){return ye(e)?e:{type:e||"pad"}}let Xb=e=>+e||0,QB=e=>({top:e,bottom:e,left:e,right:e});function eU(e){return ye(e)?e.signal?e:{top:Xb(e.top),bottom:Xb(e.bottom),left:Xb(e.left),right:Xb(e.right)}:QB(Xb(e))}let va=e=>ye(e)&&!Ee(e)?mt({},e):{value:e};function xO(e,t,n,a){return n!=null?(ye(n)&&!Ee(n)||Ee(n)&&n.length&&ye(n[0])?e.update[t]=n:e[a||"enter"][t]={value:n},1):0}function Fa(e,t,n){for(let a in t)xO(e,a,t[a]);for(let a in n)xO(e,a,n[a],"update")}function eh(e,t,n){for(let a in t)n&&nt(n,a)||(e[a]=mt(e[a]||{},t[a]));return e}function th(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}let Dx="mark",Mx="frame",Lx="scope",tU="axis",nU="axis-domain",aU="axis-grid",rU="axis-label",iU="axis-tick",oU="axis-title",sU="legend",lU="legend-band",uU="legend-entry",cU="legend-gradient",AO="legend-label",dU="legend-symbol",fU="legend-title",pU="title",hU="title-text",mU="title-subtitle";function Fx(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}let TO=e=>Ft(e)?st(e):e.signal?`(${e.signal})`:CO(e);function vw(e){if(e.gradient!=null)return(function(n){let a=[n.start,n.stop,n.count].map((r=>r==null?null:st(r)));for(;a.length&&$e(a)==null;)a.pop();return a.unshift(TO(n.gradient)),`gradient(${a.join(",")})`})(e);let t=e.signal?`(${e.signal})`:e.color?(function(n){return n.c?Ew("hcl",n.h,n.c,n.l):n.h||n.s?Ew("hsl",n.h,n.s,n.l):n.l||n.a?Ew("lab",n.l,n.a,n.b):n.r||n.g||n.b?Ew("rgb",n.r,n.g,n.b):null})(e.color):e.field!=null?CO(e.field):e.value!==void 0?st(e.value):void 0;return e.scale!=null&&(t=(function(n,a){let r=TO(n.scale);return n.range!=null?a=`lerp(_range(${r}), ${+n.range})`:(a!==void 0&&(a=`_scale(${r}, ${a})`),n.band&&(a=(a?a+"+":"")+`_bandwidth(${r})`+(+n.band==1?"":"*"+ww(n.band)),n.extra&&(a=`(datum.extra ? _scale(${r}, datum.extra.value) : ${a})`)),a==null&&(a="0")),a})(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${ww(e.exponent)})`),e.mult!=null&&(t+=`*${ww(e.mult)}`),e.offset!=null&&(t+=`+${ww(e.offset)}`),e.round&&(t=`round(${t})`),t}let Ew=(e,t,n,a)=>`(${e}(${[t,n,a].map(vw).join(",")})+'')`;function ww(e){return ye(e)?"("+vw(e)+")":e}function CO(e){return RO(ye(e)?e:{datum:e})}function RO(e){let t,n,a;if(e.signal)t="datum",a=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(a=e.parent,t+=".datum"):a=e.group}else e.datum?(t="datum",a=e.datum):F("Invalid field reference: "+st(e));return e.signal||(a=Ft(a)?j(a).map(st).join("]["):RO(a)),t+"["+a+"]"}function NO(e,t,n,a,r,i){let o={};(i=i||{}).encoders={$encode:o},e=(function(u,c,f,m,g){let v={},E={},k,_,N,O;for(_ in _="lineBreak",c!=="text"||g[_]==null||th(_,u)||Fx(v,_,g[_]),(f=="legend"||String(f).startsWith("axis"))&&(f=null),O=f===Mx?g.group:f===Dx?mt({},g.mark,g[c]):null,O)N=th(_,u)||(_==="fill"||_==="stroke")&&(th("fill",u)||th("stroke",u)),N||Fx(v,_,O[_]);for(_ in Ie(m).forEach((I=>{let B=g.style&&g.style[I];for(let M in B)th(M,u)||Fx(v,M,B[M])})),u=mt({},u),v)O=v[_],O.signal?(k=k||{})[_]=O:E[_]=O;return u.enter=mt(E,u.enter),k&&(u.update=mt(k,u.update)),u})(e,t,n,a,r.config);for(let u in e)o[u]=gU(e[u],t,i,r);return i}function gU(e,t,n,a){let r={},i={};for(let u in e)e[u]!=null&&(r[u]=bU((o=e[u],Ee(o)?(function(c){let f="";return c.forEach((m=>{let g=vw(m);f+=m.test?`(${m.test})?${g}:`:g})),$e(f)===":"&&(f+="null"),f})(o):vw(o)),a,n,i));var o;return{$expr:{marktype:t,channels:r},$fields:Object.keys(i),$output:Object.keys(e)}}function bU(e,t,n,a){let r=Ms(e,t);return r.$fields.forEach((i=>a[i]=1)),mt(n,r.$params),r.$expr}let yU="outer",vU=["value","update","init","react","bind"];function IO(e,t){F(e+' for "outer" push: '+st(t))}function OO(e,t){let n=e.name;if(e.push===yU)t.signals[n]||IO("No prior signal definition",n),vU.forEach((a=>{e[a]!==void 0&&IO("Invalid property ",a)}));else{let a=t.addSignal(n,e.value);e.react===!1&&(a.react=!1),e.bind&&t.addBinding(n,e.bind)}}function Px(e,t,n,a){this.id=-1,this.type=e,this.value=t,this.params=n,a&&(this.parent=a)}function _w(e,t,n,a){return new Px(e,t,n,a)}function kw(e,t){return _w("operator",e,t)}function pt(e){let t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Zb(e,t){return t?{$field:e,$name:t}:{$field:e}}let $x=Zb("key");function DO(e,t){return{$compare:e,$order:t}}let EU="descending";function Sw(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}let Bx="scope",Ux="view";function ua(e){return e&&e.signal}function xw(e){if(ua(e))return!0;if(ye(e)){for(let t in e)if(xw(e[t]))return!0}return!1}function Wo(e,t){return e??t}function kd(e){return e&&e.signal||e}let MO="timer";function Jb(e,t){return(e.merge?wU:e.stream?_U:e.type?kU:F("Invalid stream specification: "+st(e)))(e,t)}function wU(e,t){let n=zx({merge:e.merge.map((a=>Jb(a,t)))},e,t);return t.addStream(n).id}function _U(e,t){let n=zx({stream:Jb(e.stream,t)},e,t);return t.addStream(n).id}function kU(e,t){let n;e.type===MO?(n=t.event(MO,e.throttle),e={between:e.between,filter:e.filter}):n=t.event((function(r){return r===Bx?Ux:r||Ux})(e.source),e.type);let a=zx({stream:n},e,t);return Object.keys(a).length===1?n:t.addStream(a).id}function zx(e,t,n){let a=t.between;return a&&(a.length!==2&&F('Stream "between" parameter must have 2 entries: '+st(t)),e.between=[Jb(a[0],n),Jb(a[1],n)]),a=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&a.push((function(r,i,o){let u="event.item";return u+(r&&r!=="*"?"&&"+u+".mark.marktype==='"+r+"'":"")+(o?"&&"+u+".mark.role==='"+o+"'":"")+(i?"&&"+u+".mark.name==='"+i+"'":"")})(t.marktype,t.markname,t.markrole)),t.source===Bx&&a.push("inScope(event.item)"),a.length&&(e.filter=Ms("("+a.join(")&&(")+")",n).$expr),(a=t.throttle)!=null&&(e.throttle=+a),(a=t.debounce)!=null&&(e.debounce=+a),t.consume&&(e.consume=!0),e}let SU={code:"_.$value",ast:{type:"Identifier",value:"value"}};function xU(e,t,n){let a=e.encode,r={target:n},i=e.events,o=e.update,u=[];i||F("Signal update missing events specification."),Ft(i)&&(i=kO(i,t.isSubscope()?Bx:Ux)),i=Ie(i).filter((c=>c.signal||c.scale?(u.push(c),0):1)),u.length>1&&(u=[AU(u)]),i.length&&u.push(i.length>1?{merge:i}:i[0]),a!=null&&(o&&F("Signal encode and update are mutually exclusive."),o="encode(item(),"+st(a)+")"),r.update=Ft(o)?Ms(o,t):o.expr!=null?Ms(o.expr,t):o.value!=null?o.value:o.signal!=null?{$expr:SU,$params:{$value:t.signalRef(o.signal)}}:F("Invalid signal update specification."),e.force&&(r.options={force:!0}),u.forEach((c=>t.addUpdate(mt((function(f,m){return{source:f.signal?m.signalRef(f.signal):f.scale?m.scaleRef(f.scale):Jb(f,m)}})(c,t),r))))}function AU(e){return{signal:"["+e.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}let an=e=>(t,n,a)=>_w(e,n,t||void 0,a),LO=an("aggregate"),TU=an("axisticks"),FO=an("bound"),Vo=an("collect"),PO=an("compare"),CU=an("datajoin"),$O=an("encode"),RU=an("expression"),NU=an("facet"),IU=an("field"),OU=an("key"),DU=an("legendentries"),MU=an("load"),LU=an("mark"),FU=an("multiextent"),PU=an("multivalues"),$U=an("overlap"),BU=an("params"),BO=an("prefacet"),UU=an("projection"),zU=an("proxy"),GU=an("relay"),UO=an("render"),jU=an("scale"),Sd=an("sieve"),HU=an("sortitems"),zO=an("viewlayout"),qU=an("values"),WU=0,GO={min:"min",max:"max",count:"sum"};function VU(e,t){let n=t.getScale(e.name).params,a;for(a in n.domain=jO(e.domain,e,t),e.range!=null&&(n.range=qO(e,t,n)),e.interpolate!=null&&(function(r,i){i.interpolate=io(r.type||r),r.gamma!=null&&(i.interpolateGamma=io(r.gamma))})(e.interpolate,n),e.nice!=null&&(n.nice=(function(r){return ye(r)?{interval:io(r.interval),step:io(r.step)}:io(r)})(e.nice)),e.bins!=null&&(n.bins=(function(r,i){return r.signal||Ee(r)?Aw(r,i):i.objectProperty(r)})(e.bins,t)),e)nt(n,a)||a==="name"||(n[a]=io(e[a],t))}function io(e,t){return ye(e)?e.signal?t.signalRef(e.signal):F("Unsupported object: "+st(e)):e}function Aw(e,t){return e.signal?t.signalRef(e.signal):e.map((n=>io(n,t)))}function Tw(e){F("Can not find data set: "+st(e))}function jO(e,t,n){if(e)return e.signal?n.signalRef(e.signal):(Ee(e)?YU:e.fields?XU:KU)(e,t,n);t.domainMin==null&&t.domainMax==null||F("No scale domain defined for domainMin/domainMax to override.")}function YU(e,t,n){return e.map((a=>io(a,n)))}function KU(e,t,n){let a=n.getData(e.data);return a||Tw(e.data),xu(t.type)?a.valuesRef(n,e.field,HO(e.sort,!1)):yv(t.type)?a.domainRef(n,e.field):a.extentRef(n,e.field)}function XU(e,t,n){let a=e.data,r=e.fields.reduce(((i,o)=>(o=Ft(o)?{data:a,field:o}:Ee(o)||o.signal?(function(u,c){let f="_:vega:_"+WU++,m=Vo({});if(Ee(u))m.value={$ingest:u};else if(u.signal){let g="setdata("+st(f)+","+u.signal+")";m.params.input=c.signalRef(g)}return c.addDataPipeline(f,[m,Sd({})]),{data:f,field:"data"}})(o,n):o,i.push(o),i)),[]);return(xu(t.type)?ZU:yv(t.type)?JU:QU)(e,n,r)}function ZU(e,t,n){let a=HO(e.sort,!0),r,i,o=n.map((f=>{let m=t.getData(f.data);return m||Tw(f.data),m.countsRef(t,f.field,a)})),u={groupby:$x,pulse:o};a&&(r=a.op||"count",i=a.field?Sw(r,a.field):"count",u.ops=[GO[r]],u.fields=[t.fieldRef(i)],u.as=[i]),r=t.add(LO(u));let c=t.add(Vo({pulse:pt(r)}));return i=t.add(qU({field:$x,sort:t.sortRef(a),pulse:pt(c)})),pt(i)}function HO(e,t){return e&&(e.field||e.op?e.field||e.op==="count"?t&&e.field&&e.op&&!GO[e.op]&&F("Multiple domain scales can not be sorted using "+e.op):F("No field provided for sort aggregate op: "+e.op):ye(e)?e.field="key":e={field:"key"}),e}function JU(e,t,n){let a=n.map((r=>{let i=t.getData(r.data);return i||Tw(r.data),i.domainRef(t,r.field)}));return pt(t.add(PU({values:a})))}function QU(e,t,n){let a=n.map((r=>{let i=t.getData(r.data);return i||Tw(r.data),i.extentRef(t,r.field)}));return pt(t.add(FU({extents:a})))}function qO(e,t,n){let a=t.config.range,r=e.range;if(r.signal)return t.signalRef(r.signal);if(Ft(r)){if(a&&nt(a,r))return qO(e=mt({},e,{range:a[r]}),t,n);r==="width"?r=[0,{signal:"width"}]:r==="height"?r=xu(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:F("Unrecognized scale range value: "+st(r))}else{if(r.scheme)return n.scheme=Ee(r.scheme)?Aw(r.scheme,t):io(r.scheme,t),r.extent&&(n.schemeExtent=Aw(r.extent,t)),void(r.count&&(n.schemeCount=io(r.count,t)));if(r.step)return void(n.rangeStep=io(r.step,t));if(xu(e.type)&&!Ee(r))return jO(r,e,t);Ee(r)||F("Unsupported range type: "+st(r))}return r.map((i=>(Ee(i)?Aw:io)(i,t)))}function Gx(e,t,n){return Ee(e)?e.map((a=>Gx(a,t,n))):ye(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:F("Unsupported parameter object: "+st(e)):e}let Yo="top",nh="left",ah="right",Wu="bottom",WO="center",e3="vertical",t3="start",n3="end",jx="index",Hx="label",a3="offset",rh="perc",r3="perc2",oo="value",Qb="guide-label",qx="guide-title",i3="group-title",o3="group-subtitle",VO="symbol",Cw="gradient",Wx="discrete",Vx="size",Yx=[Vx,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],e0={name:1,style:1,interactive:1},zt={value:0},so={value:1},Rw="group",YO="rect",Kx="rule",s3="symbol",xd="text";function t0(e){return e.type=Rw,e.interactive=e.interactive||!1,e}function Wr(e,t){let n=(a,r)=>Wo(e[a],Wo(t[a],r));return n.isVertical=a=>e3===Wo(e.direction,t.direction||(a?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>Wo(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>Wo(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>Wo(e.columns,Wo(t.columns,+n.isVertical(!0))),n}function KO(e,t){let n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function Nw(e,t,n){return`item.anchor === '${t3}' ? ${e} : item.anchor === '${n3}' ? ${t} : ${n}`}let Xx=Nw(st(nh),st(ah),st(WO));function XO(e,t){return t?e?ye(e)?Object.assign({},e,{offset:XO(e.offset,t)}):{value:e,offset:t}:t:e}function _i(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=eh(e.encode,t,e0)):e.interactive=!1,e}function l3(e,t,n,a){let r=Wr(e,n),i=r.isVertical(),o=r.gradientThickness(),u=r.gradientLength(),c,f,m,g,v;i?(f=[0,1],m=[0,0],g=o,v=u):(f=[0,0],m=[1,0],g=u,v=o);let E={enter:c={opacity:zt,x:zt,y:zt,width:va(g),height:va(v)},update:mt({},c,{opacity:so,fill:{gradient:t,start:f,stop:m}}),exit:{opacity:zt}};return Fa(E,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),_i({type:YO,role:cU,encode:E},a)}function u3(e,t,n,a,r){let i=Wr(e,n),o=i.isVertical(),u=i.gradientThickness(),c=i.gradientLength(),f,m,g,v,E="";o?(f="y",g="y2",m="x",v="width",E="1-"):(f="x",g="x2",m="y",v="height");let k={opacity:zt,fill:{scale:t,field:oo}};k[f]={signal:E+"datum."+rh,mult:c},k[m]=zt,k[g]={signal:E+"datum."+r3,mult:c},k[v]=va(u);let _={enter:k,update:mt({},k,{opacity:so}),exit:{opacity:zt}};return Fa(_,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),_i({type:YO,role:lU,key:oo,from:r,encode:_},a)}let c3=`datum.${rh}<=0?"${nh}":datum.${rh}>=1?"${ah}":"${WO}"`,d3=`datum.${rh}<=0?"${Wu}":datum.${rh}>=1?"${Yo}":"middle"`;function ZO(e,t,n,a){let r=Wr(e,t),i=r.isVertical(),o=va(r.gradientThickness()),u=r.gradientLength(),c,f,m,g,v=r("labelOverlap"),E="",k={enter:c={opacity:zt},update:f={opacity:so,text:{field:Hx}},exit:{opacity:zt}};return Fa(k,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:Wo(e.labelLimit,t.gradientLabelLimit)}),i?(c.align={value:"left"},c.baseline=f.baseline={signal:d3},m="y",g="x",E="1-"):(c.align=f.align={signal:c3},c.baseline={value:"top"},m="x",g="y"),c[m]=f[m]={signal:E+"datum."+rh,mult:u},c[g]=f[g]=o,o.offset=Wo(e.labelOffset,t.gradientLabelOffset)||0,v=v?{separation:r("labelSeparation"),method:v,order:"datum."+jx}:void 0,_i({type:xd,role:AO,style:Qb,key:oo,from:a,encode:k,overlap:v},n)}function f3(e,t,n,a,r){let i=Wr(e,t),o=n.entries,u=!(!o||!o.interactive),c=o?o.name:void 0,f=i("clipHeight"),m=i("symbolOffset"),g={data:"value"},v=`(${r}) ? datum.${a3} : datum.${Vx}`,E=f?va(f):{field:Vx},k=`datum.${jx}`,_=`max(1, ${r})`,N,O,I,B,M;E.mult=.5,N={enter:O={opacity:zt,x:{signal:v,mult:.5,offset:m},y:E},update:I={opacity:so,x:O.x,y:O.y},exit:{opacity:zt}};let U=null,z=null;e.fill||(U=t.symbolBaseFillColor,z=t.symbolBaseStrokeColor),Fa(N,{fill:i("symbolFillColor",U),shape:i("symbolType"),size:i("symbolSize"),stroke:i("symbolStrokeColor",z),strokeDash:i("symbolDash"),strokeDashOffset:i("symbolDashOffset"),strokeWidth:i("symbolStrokeWidth")},{opacity:i("symbolOpacity")}),Yx.forEach((re=>{e[re]&&(I[re]=O[re]={scale:e[re],field:oo})}));let q=_i({type:s3,role:dU,key:oo,from:g,clip:!!f||void 0,encode:N},n.symbols),Y=va(m);Y.offset=i("labelOffset"),N={enter:O={opacity:zt,x:{signal:v,offset:Y},y:E},update:I={opacity:so,text:{field:Hx},x:O.x,y:O.y},exit:{opacity:zt}},Fa(N,{align:i("labelAlign"),baseline:i("labelBaseline"),fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:i("labelLimit")});let K=_i({type:xd,role:AO,style:Qb,key:oo,from:g,encode:N},n.labels);return N={enter:{noBound:{value:!f},width:zt,height:f?va(f):zt,opacity:zt},exit:{opacity:zt},update:I={opacity:so,row:{signal:null},column:{signal:null}}},i.isVertical(!0)?(B=`ceil(item.mark.items.length / ${_})`,I.row.signal=`${k}%${B}`,I.column.signal=`floor(${k} / ${B})`,M={field:["row",k]}):(I.row.signal=`floor(${k} / ${_})`,I.column.signal=`${k} % ${_}`,M={field:k}),I.column.signal=`(${r})?${I.column.signal}:${k}`,t0({role:Lx,from:a={facet:{data:a,name:"value",groupby:jx}},encode:eh(N,o,e0),marks:[q,K],name:c,interactive:u,sort:M})}let Zx='item.orient === "left"',Jx='item.orient === "right"',Iw=`(${Zx} || ${Jx})`,p3=`datum.vgrad && ${Iw}`,h3=Nw('"top"','"bottom"','"middle"'),m3=`datum.vgrad && ${Jx} ? (${Nw('"right"','"left"','"center"')}) : (${Iw} && !(datum.vgrad && ${Zx})) ? "left" : ${Xx}`,g3=`item._anchor || (${Iw} ? "middle" : "start")`,b3=`${p3} ? (${Zx} ? -90 : 90) : 0`,y3=`${Iw} ? (datum.vgrad ? (${Jx} ? "bottom" : "top") : ${h3}) : "top"`;function v3(e,t){let n;return ye(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+JO(e.path)+")":e.sphere&&(n="geoShape("+JO(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function JO(e){return ye(e)&&e.signal?e.signal:st(e)}function QO(e){let t=e.role||"";return t.indexOf("axis")&&t.indexOf("legend")&&t.indexOf("title")?e.type===Rw?Lx:t||Dx:t}function E3(e){return{marktype:e.type,name:e.name||void 0,role:e.role||QO(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function w3(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function Qx(e,t){let n=om(e.type);n||F("Unrecognized transform type: "+st(e.type));let a=_w(n.type.toLowerCase(),null,eD(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(a)),a.metadata=n.metadata||{},a}function eD(e,t,n){let a={},r=e.params.length;for(let i=0;i<r;++i){let o=e.params[i];a[o.name]=_3(o,t,n)}return a}function _3(e,t,n){let a=e.type,r=t[e.name];return a==="index"?(function(i,o,u){return Ft(o.from)||F('Lookup "from" parameter must be a string literal.'),u.getData(o.from).lookupRef(u,o.key)})(0,t,n):r!==void 0?a==="param"?(function(i,o,u){let c=o[i.name];return i.array?(Ee(c)||F("Expected an array of sub-parameters. Instead: "+st(c)),c.map((f=>nD(i,f,u)))):nD(i,c,u)})(e,t,n):a==="projection"?n.projectionRef(t[e.name]):e.array&&!ua(r)?r.map((i=>tD(e,i,n))):tD(e,r,n):void(e.required&&F("Missing required "+st(t.type)+" parameter: "+st(e.name)))}function tD(e,t,n){let a=e.type;if(ua(t))return aD(a)?F("Expression references can not be signals."):eA(a)?n.fieldRef(t):rD(a)?n.compareRef(t):n.signalRef(t.signal);{let r=e.expr||eA(a);return r&&k3(t)?n.exprRef(t.expr,t.as):r&&S3(t)?Zb(t.field,t.as):aD(a)?Ms(t,n):x3(a)?pt(n.getData(t).values):eA(a)?Zb(t):rD(a)?n.compareRef(t):t}}function nD(e,t,n){let a=e.params.length,r;for(let o=0;o<a;++o){r=e.params[o];for(let u in r.key)if(r.key[u]!==t[u]){r=null;break}if(r)break}r||F("Unsupported parameter: "+st(t));let i=mt(eD(r,t,n),r.key);return pt(n.add(BU(i)))}let k3=e=>e&&e.expr,S3=e=>e&&e.field,x3=e=>e==="data",aD=e=>e==="expr",eA=e=>e==="field",rD=e=>e==="compare";function Ow(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:pt(t.getData(e.data).output)}function Ad(e,t,n,a,r){this.scope=e,this.input=t,this.output=n,this.values=a,this.aggregate=r,this.index={}}function iD(e){return Ft(e)?e:null}function oD(e,t,n){let a=Sw(n.op,n.field),r;if(t.ops){for(let i=0,o=t.as.length;i<o;++i)if(t.as[i]===a)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(a))}function n0(e,t,n,a,r,i,o){let u=t[n]||(t[n]={}),c=(function(v){return ye(v)?(v.order===EU?"-":"+")+Sw(v.op,v.field):""})(i),f,m,g=iD(r);if(g!=null&&(e=t.scope,g+=c?"|"+c:"",f=u[g]),!f){let v=i?{field:$x,pulse:t.countsRef(e,r,i)}:{field:e.fieldRef(r),pulse:pt(t.output)};c&&(v.sort=e.sortRef(i)),m=e.add(_w(a,void 0,v)),o&&(t.index[r]=m),f=pt(m),g!=null&&(u[g]=f)}return f}function sD(e,t,n){let a=e.remove,r=e.insert,i=e.toggle,o=e.modify,u=e.values,c=t.add(kw()),f=Ms("if("+e.trigger+',modify("'+n+'",'+[r,a,i,o,u].map((m=>m??"null")).join(",")+"),0)",t);c.update=f.$expr,c.params=f.$params}function Dw(e,t){let n=QO(e),a=e.type===Rw,r=e.from&&e.from.facet,i=e.overlap,o,u,c,f,m,g,v,E=e.layout||n===Lx||n===Mx,k=n===Dx||E||r,_=(function(z,q,Y){let K,re,Q,ie,se;return z?(K=z.facet)&&(q||F("Only group marks can be faceted."),K.field!=null?ie=se=Ow(K,Y):(z.data?se=pt(Y.getData(z.data).aggregate):(Q=Qx(mt({type:"aggregate",groupby:Ie(K.groupby)},K.aggregate),Y),Q.params.key=Y.keyRef(K.groupby),Q.params.pulse=Ow(K,Y),ie=se=pt(Y.add(Q))),re=Y.keyRef(K.groupby,!0))):ie=pt(Y.add(Vo(null,[{}]))),ie||(ie=Ow(z,Y)),{key:re,pulse:ie,parent:se}})(e.from,a,t);u=t.add(CU({key:_.key||(e.key?Zb(e.key):void 0),pulse:_.pulse,clean:!a}));let N=pt(u);u=c=t.add(Vo({pulse:N})),u=t.add(LU({markdef:E3(e),interactive:w3(e.interactive,t),clip:v3(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:pt(u)}));let O=pt(u);u=f=t.add($O(NO(e.encode,e.type,n,e.style,t,{mod:!1,pulse:O}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach((z=>{let q=Qx(z,t),Y=q.metadata;(Y.generates||Y.changes)&&F("Mark transforms should not generate new data."),Y.nomod||(f.params.mod=!0),q.params.pulse=pt(u),t.add(u=q)})),e.sort&&(u=t.add(HU({sort:t.compareRef(e.sort),pulse:pt(u)})));let I=pt(u);(r||E)&&(E=t.add(zO({layout:t.objectProperty(e.layout),legends:t.legends,mark:O,pulse:I})),g=pt(E));let B=t.add(FO({mark:O,pulse:g||I}));v=pt(B),a&&(k&&(o=t.operators,o.pop(),E&&o.pop()),t.pushState(I,g||v,N),r?(function(z,q,Y){let K=z.from.facet,re=K.name,Q=Ow(K,q),ie;K.name||F("Facet must have a name: "+st(K)),K.data||F("Facet must reference a data set: "+st(K)),K.field?ie=q.add(BO({field:q.fieldRef(K.field),pulse:Q})):K.groupby?ie=q.add(NU({key:q.keyRef(K.groupby),group:pt(q.proxy(Y.parent)),pulse:Q})):F("Facet must specify groupby or field: "+st(K));let se=q.fork(),ue=se.add(Vo()),fe=se.add(Sd({pulse:pt(ue)}));se.addData(re,new Ad(se,ue,ue,fe)),se.addSignal("parent",null),ie.params.subflow={$subflow:se.parse(z).toRuntime()}})(e,t,_):k?(function(z,q,Y){let K=q.add(BO({pulse:Y.pulse})),re=q.fork();re.add(Sd()),re.addSignal("parent",null),K.params.subflow={$subflow:re.parse(z).toRuntime()}})(e,t,_):t.parse(e),t.popState(),k&&(E&&o.push(E),o.push(B))),i&&(v=(function(z,q,Y){let K=z.method,re=z.bound,Q=z.separation,ie={separation:ua(Q)?Y.signalRef(Q.signal):Q,method:ua(K)?Y.signalRef(K.signal):K,pulse:q};if(z.order&&(ie.sort=Y.compareRef({field:z.order})),re){let se=re.tolerance;ie.boundTolerance=ua(se)?Y.signalRef(se.signal):+se,ie.boundScale=Y.scaleRef(re.scale),ie.boundOrient=re.orient}return pt(Y.add($U(ie)))})(i,v,t));let M=t.add(UO({pulse:v})),U=t.add(Sd({pulse:pt(M)},void 0,t.parent()));e.name!=null&&(m=e.name,t.addData(m,new Ad(t,c,M,U)),e.on&&e.on.forEach((z=>{(z.insert||z.remove||z.toggle)&&F("Marks only support modify triggers."),sD(z,t,m)})))}function A3(e,t){let n=t.config.legend,a=e.encode||{},r=Wr(e,n),i=a.legend||{},o=i.name||void 0,u=i.interactive,c=i.style,f={},m,g,v,E=0;Yx.forEach((I=>e[I]?(f[I]=e[I],E=E||e[I]):0)),E||F("Missing valid scale for legend.");let k=(function(I,B){let M=I.type||VO;return I.type||(function(U){return Yx.reduce(((z,q)=>z+(U[q]?1:0)),0)})(I)!==1||!I.fill&&!I.stroke||(M=Gg(B)?Cw:jg(B)?Wx:VO),M!==Cw?M:jg(B)?Wx:Cw})(e,t.scaleType(E)),_={title:e.title!=null,scales:f,type:k,vgrad:k!=="symbol"&&r.isVertical()},N=pt(t.add(Vo(null,[_]))),O=pt(t.add(DU(g={type:k,scale:t.scaleRef(E),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return k===Cw?(v=[l3(e,E,n,a.gradient),ZO(e,n,a.labels,O)],g.count=g.count||t.signalRef(`max(2,2*floor((${kd(r.gradientLength())})/100))`)):k===Wx?v=[u3(e,E,n,a.gradient,O),ZO(e,n,a.labels,O)]:(m=(function(I,B){let M=Wr(I,B);return{align:M("gridAlign"),columns:M.entryColumns(),center:{row:!0,column:!1},padding:{row:M("rowPadding"),column:M("columnPadding")}}})(e,n),v=[f3(e,n,a,O,kd(m.columns))],g.size=(function(I,B,M){let U=kd(lD("size",I,M)),z=kd(lD("strokeWidth",I,M)),q=kd((function(Y,K,re){return KO("fontSize",Y)||(function(Q,ie,se){let ue=ie.config.style[se];return ue&&ue[Q]})("fontSize",K,re)})(M[1].encode,B,Qb));return Ms(`max(ceil(sqrt(${U})+${z}),${q})`,B)})(e,t,v[0].marks)),v=[t0({role:uU,from:N,encode:{enter:{x:{value:0},y:{value:0}}},marks:v,layout:m,interactive:u})],_.title&&v.push((function(I,B,M,U){let z=Wr(I,B),q={enter:{opacity:zt},update:{opacity:so,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:zt}};return Fa(q,{orient:z("titleOrient"),_anchor:z("titleAnchor"),anchor:{signal:g3},angle:{signal:b3},align:{signal:m3},baseline:{signal:y3},text:I.title,fill:z("titleColor"),fillOpacity:z("titleOpacity"),font:z("titleFont"),fontSize:z("titleFontSize"),fontStyle:z("titleFontStyle"),fontWeight:z("titleFontWeight"),limit:z("titleLimit"),lineHeight:z("titleLineHeight")},{align:z("titleAlign"),baseline:z("titleBaseline")}),_i({type:xd,role:fU,style:qx,from:U,encode:q},M)})(e,n,a.title,N)),Dw(t0({role:sU,from:N,encode:eh(T3(r,e,n),i,e0),marks:v,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:o,interactive:u,style:c}),t)}function T3(e,t,n){let a={enter:{},update:{}};return Fa(a,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),a}function lD(e,t,n){return t[e]?`scale("${t[e]}",datum)`:KO(e,n[0].encode)}Ad.fromEntries=function(e,t){let n=t.length,a=t[n-1],r=t[n-2],i=t[0],o=null,u=1;for(i&&i.type==="load"&&(i=t[1]),e.add(t[0]);u<n;++u)t[u].params.pulse=pt(t[u-1]),e.add(t[u]),t[u].type==="aggregate"&&(o=t[u]);return new Ad(e,i,r,a,o)},Ad.prototype={countsRef(e,t,n){let a=this,r=a.counts||(a.counts={}),i=iD(t),o,u,c;return i!=null&&(e=a.scope,o=r[i]),o?n&&n.field&&oD(e,o.agg.params,n):(c={groupby:e.fieldRef(t,"key"),pulse:pt(a.output)},n&&n.field&&oD(e,c,n),u=e.add(LO(c)),o=e.add(Vo({pulse:pt(u)})),o={agg:u,ref:pt(o)},i!=null&&(r[i]=o)),o.ref},tuplesRef(){return pt(this.values)},extentRef(e,t){return n0(e,this,"extent","extent",t,!1)},domainRef(e,t){return n0(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return n0(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return n0(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return n0(e,this,"indata","tupleindex",t,!0,!0)}};let C3=`item.orient==="${nh}"?-90:item.orient==="${ah}"?90:0`;function R3(e,t){let n=Wr(e=Ft(e)?{text:e}:e,t.config.title),a=e.encode||{},r=a.group||{},i=r.name||void 0,o=r.interactive,u=r.style,c=[],f=pt(t.add(Vo(null,[{}])));return c.push((function(m,g,v,E){let k={value:0},_=m.text,N={enter:{opacity:k},update:{opacity:{value:1}},exit:{opacity:k}};return Fa(N,{text:_,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:g("dx"),dy:g("dy"),fill:g("color"),font:g("font"),fontSize:g("fontSize"),fontStyle:g("fontStyle"),fontWeight:g("fontWeight"),lineHeight:g("lineHeight")},{align:g("align"),angle:g("angle"),baseline:g("baseline")}),_i({type:xd,role:hU,style:i3,from:E,encode:N},v)})(e,n,(function(m){let g=m.encode;return g&&g.title||mt({name:m.name,interactive:m.interactive,style:m.style},g)})(e),f)),e.subtitle&&c.push((function(m,g,v,E){let k={value:0},_=m.subtitle,N={enter:{opacity:k},update:{opacity:{value:1}},exit:{opacity:k}};return Fa(N,{text:_,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:g("dx"),dy:g("dy"),fill:g("subtitleColor"),font:g("subtitleFont"),fontSize:g("subtitleFontSize"),fontStyle:g("subtitleFontStyle"),fontWeight:g("subtitleFontWeight"),lineHeight:g("subtitleLineHeight")},{align:g("align"),angle:g("angle"),baseline:g("baseline")}),_i({type:xd,role:mU,style:o3,from:E,encode:N},v)})(e,n,a.subtitle,f)),Dw(t0({role:pU,from:f,encode:N3(n,r),marks:c,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:i,interactive:o,style:u}),t)}function N3(e,t){let n={enter:{},update:{}};return Fa(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:Xx},angle:{signal:C3},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),eh(n,t,e0)}function I3(e,t){let n=[];e.transform&&e.transform.forEach((a=>{n.push(Qx(a,t))})),e.on&&e.on.forEach((a=>{sD(a,t,e.name)})),t.addDataPipeline(e.name,(function(a,r,i){let o=[],u,c,f,m,g,v=null,E=!1,k=!1;for(a.values?ua(a.values)||xw(a.format)?(o.push(uD(r,a)),o.push(v=Td())):o.push(v=Td({$ingest:a.values,$format:a.format})):a.url?xw(a.url)||xw(a.format)?(o.push(uD(r,a)),o.push(v=Td())):o.push(v=Td({$request:a.url,$format:a.format})):a.source&&(v=u=Ie(a.source).map((_=>pt(r.getData(_).output))),o.push(null)),c=0,f=i.length;c<f;++c)m=i[c],g=m.metadata,v||g.source||o.push(v=Td()),o.push(m),g.generates&&(k=!0),g.modifies&&!k&&(E=!0),g.source?v=m:g.changes&&(v=null);return u&&(f=u.length-1,o[0]=GU({derive:E,pulse:f?u:u[0]}),(E||f)&&o.splice(1,0,Td())),v||o.push(Td()),o.push(Sd({})),o})(e,t,n))}function Td(e){let t=Vo({},e);return t.metadata={source:!0},t}function uD(e,t){return MU({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}let cD=e=>e===Wu||e===Yo,Mw=(e,t,n)=>ua(e)?L3(e.signal,t,n):e===nh||e===Yo?t:n,Ea=(e,t,n)=>ua(e)?D3(e.signal,t,n):cD(e)?t:n,Ko=(e,t,n)=>ua(e)?M3(e.signal,t,n):cD(e)?n:t,dD=(e,t,n)=>ua(e)?F3(e.signal,t,n):e===Yo?{value:t}:{value:n},O3=(e,t,n)=>ua(e)?P3(e.signal,t,n):e===ah?{value:t}:{value:n},D3=(e,t,n)=>fD(`${e} === '${Yo}' || ${e} === '${Wu}'`,t,n),M3=(e,t,n)=>fD(`${e} !== '${Yo}' && ${e} !== '${Wu}'`,t,n),L3=(e,t,n)=>tA(`${e} === '${nh}' || ${e} === '${Yo}'`,t,n),F3=(e,t,n)=>tA(`${e} === '${Yo}'`,t,n),P3=(e,t,n)=>tA(`${e} === '${ah}'`,t,n),fD=(e,t,n)=>(t=t!=null?va(t):t,n=n!=null?va(n):n,pD(t)&&pD(n)?{signal:`${e} ? (${t=t?t.signal||st(t.value):null}) : (${n=n?n.signal||st(n.value):null})`}:[mt({test:e},t)].concat(n||[])),pD=e=>e==null||Object.keys(e).length===1,tA=(e,t,n)=>({signal:`${e} ? (${ih(t)}) : (${ih(n)})`}),$3=(e,t,n,a,r)=>({signal:(a!=null?`${e} === '${nh}' ? (${ih(a)}) : `:"")+(n!=null?`${e} === '${Wu}' ? (${ih(n)}) : `:"")+(r!=null?`${e} === '${ah}' ? (${ih(r)}) : `:"")+(t!=null?`${e} === '${Yo}' ? (${ih(t)}) : `:"")+"(null)"}),ih=e=>ua(e)?e.signal:e==null?null:st(e),B3=(e,t)=>t===0?0:ua(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},oh=(e,t)=>{let n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function sh(e,t,n,a){let r;if(t&&nt(t,e))return t[e];if(nt(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return a[qx][r]}if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return a[Qb][r]}return null}function hD(e){let t={};for(let n of e)if(n)for(let a in n)t[a]=1;return Object.keys(t)}function mD(e,t){return{scale:e.scale,range:t}}function U3(e,t,n,a,r){let i=Wr(e,t),o=e.orient,u=e.gridScale,c=Mw(o,1,-1),f=(function(I,B){if(B!==1)if(ye(I)){let M=I=mt({},I);for(;M.mult!=null;){if(!ye(M.mult))return M.mult=ua(B)?{signal:`(${M.mult}) * (${B.signal})`}:M.mult*B,I;M=M.mult=mt({},M.mult)}M.mult=B}else I=ua(B)?{signal:`(${B.signal}) * (${I||0})`}:B*(I||0);return I})(e.offset,c),m,g,v,E={enter:m={opacity:zt},update:v={opacity:so},exit:g={opacity:zt}};Fa(E,{stroke:i("gridColor"),strokeCap:i("gridCap"),strokeDash:i("gridDash"),strokeDashOffset:i("gridDashOffset"),strokeOpacity:i("gridOpacity"),strokeWidth:i("gridWidth")});let k={scale:e.scale,field:oo,band:r.band,extra:r.extra,offset:r.offset,round:i("tickRound")},_=Ea(o,{signal:"height"},{signal:"width"}),N=u?{scale:u,range:0,mult:c,offset:f}:{value:0,offset:f},O=u?{scale:u,range:1,mult:c,offset:f}:mt(_,{mult:c,offset:f});return m.x=v.x=Ea(o,k,N),m.y=v.y=Ko(o,k,N),m.x2=v.x2=Ko(o,O),m.y2=v.y2=Ea(o,O),g.x=Ea(o,k),g.y=Ko(o,k),_i({type:Kx,role:aU,key:oo,from:a,encode:E},n)}function nA(e,t,n,a,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+a+","+r+")"}}function z3(e,t,n,a){let r=Wr(e,t),i=e.orient,o=Mw(i,-1,1),u,c,f={enter:u={opacity:zt,anchor:va(r("titleAnchor",null)),align:{signal:Xx}},update:c=mt({},u,{opacity:so,text:va(e.title)}),exit:{opacity:zt}},m={signal:`lerp(range("${e.scale}"), ${Nw(0,1,.5)})`};return c.x=Ea(i,m),c.y=Ko(i,m),u.angle=Ea(i,zt,B3(o,90)),u.baseline=Ea(i,dD(i,Wu,Yo),{value:Wu}),c.angle=u.angle,c.baseline=u.baseline,Fa(f,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),(function(g,v,E,k){let _=(I,B)=>I!=null?(E.update[B]=oh(va(I),E.update[B]),!1):!th(B,k),N=_(g("titleX"),"x"),O=_(g("titleY"),"y");E.enter.auto=O===N?va(O):Ea(v,va(O),va(N))})(r,i,f,n),f.update.align=oh(f.update.align,u.align),f.update.angle=oh(f.update.angle,u.angle),f.update.baseline=oh(f.update.baseline,u.baseline),_i({type:xd,role:oU,style:qx,from:a,encode:f},n)}function G3(e,t){let n=(function(_,N){var O,I,B,M=N.config,U=M.style,z=M.axis,q=N.scaleType(_.scale)==="band"&&M.axisBand,Y=_.orient;if(ua(Y)){let K=hD([M.axisX,M.axisY]),re=hD([M.axisTop,M.axisBottom,M.axisLeft,M.axisRight]);for(B of(O={},K))O[B]=Ea(Y,sh(B,M.axisX,z,U),sh(B,M.axisY,z,U));for(B of(I={},re))I[B]=$3(Y.signal,sh(B,M.axisTop,z,U),sh(B,M.axisBottom,z,U),sh(B,M.axisLeft,z,U),sh(B,M.axisRight,z,U))}else O=Y===Yo||Y===Wu?M.axisX:M.axisY,I=M["axis"+Y[0].toUpperCase()+Y.slice(1)];return O||I||q?mt({},z,O,I,q):z})(e,t),a=e.encode||{},r=a.axis||{},i=r.name||void 0,o=r.interactive,u=r.style,c=Wr(e,n),f=(function(_){let N=_("tickBand"),O,I,B=_("tickOffset");return N?N.signal?(O={signal:`(${N.signal}) === 'extent' ? 1 : 0.5`},I={signal:`(${N.signal}) === 'extent'`},ye(B)||(B={signal:`(${N.signal}) === 'extent' ? 0 : ${B}`})):N==="extent"?(O=1,I=!0,B=0):(O=.5,I=!1):(O=_("bandPosition"),I=_("tickExtra")),{extra:I,band:O,offset:B}})(c),m={scale:e.scale,ticks:!!c("ticks"),labels:!!c("labels"),grid:!!c("grid"),domain:!!c("domain"),title:e.title!=null},g=pt(t.add(Vo({},[m]))),v=pt(t.add(TU({scale:t.scaleRef(e.scale),extra:t.property(f.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),E=[],k;return m.grid&&E.push(U3(e,n,a.grid,v,f)),m.ticks&&(k=c("tickSize"),E.push((function(_,N,O,I,B,M){let U=Wr(_,N),z=_.orient,q=Mw(z,-1,1),Y,K,re,Q={enter:Y={opacity:zt},update:re={opacity:so},exit:K={opacity:zt}};Fa(Q,{stroke:U("tickColor"),strokeCap:U("tickCap"),strokeDash:U("tickDash"),strokeDashOffset:U("tickDashOffset"),strokeOpacity:U("tickOpacity"),strokeWidth:U("tickWidth")});let ie=va(B);ie.mult=q;let se={scale:_.scale,field:oo,band:M.band,extra:M.extra,offset:M.offset,round:U("tickRound")};return re.y=Y.y=Ea(z,zt,se),re.y2=Y.y2=Ea(z,ie),K.x=Ea(z,se),re.x=Y.x=Ko(z,zt,se),re.x2=Y.x2=Ko(z,ie),K.y=Ko(z,se),_i({type:Kx,role:iU,key:oo,from:I,encode:Q},O)})(e,n,a.ticks,v,k,f))),m.labels&&(k=m.ticks?k:0,E.push((function(_,N,O,I,B,M){let U=Wr(_,N),z=_.orient,q=_.scale,Y=Mw(z,-1,1),K=kd(U("labelFlush")),re=kd(U("labelFlushOffset")),Q=U("labelAlign"),ie=U("labelBaseline"),se,ue=K===0||!!K,fe=va(B);fe.mult=Y,fe.offset=va(U("labelPadding")||0),fe.offset.mult=Y;let ve={scale:q,field:oo,band:.5,offset:XO(M.offset,U("labelOffset"))},we=Ea(z,ue?nA(q,K,'"left"','"right"','"center"'):{value:"center"},O3(z,"left","right")),Oe=Ea(z,dD(z,"bottom","top"),ue?nA(q,K,'"top"','"bottom"','"middle"'):{value:"middle"}),Ue=nA(q,K,`-(${re})`,re,0);ue=ue&&re;let He={opacity:zt,x:Ea(z,ve,fe),y:Ko(z,ve,fe)},De={enter:He,update:se={opacity:so,text:{field:Hx},x:He.x,y:He.y,align:we,baseline:Oe},exit:{opacity:zt,x:He.x,y:He.y}};Fa(De,{dx:!Q&&ue?Ea(z,Ue):null,dy:!ie&&ue?Ko(z,Ue):null}),Fa(De,{angle:U("labelAngle"),fill:U("labelColor"),fillOpacity:U("labelOpacity"),font:U("labelFont"),fontSize:U("labelFontSize"),fontWeight:U("labelFontWeight"),fontStyle:U("labelFontStyle"),limit:U("labelLimit"),lineHeight:U("labelLineHeight")},{align:Q,baseline:ie});let ut=U("labelBound"),ct=U("labelOverlap");return ct=ct||ut?{separation:U("labelSeparation"),method:ct,order:"datum.index",bound:ut?{scale:q,orient:z,tolerance:ut}:null}:void 0,se.align!==we&&(se.align=oh(se.align,we)),se.baseline!==Oe&&(se.baseline=oh(se.baseline,Oe)),_i({type:xd,role:rU,style:Qb,key:oo,from:I,encode:De,overlap:ct},O)})(e,n,a.labels,v,k,f))),m.domain&&E.push((function(_,N,O,I){let B=Wr(_,N),M=_.orient,U,z,q={enter:U={opacity:zt},update:z={opacity:so},exit:{opacity:zt}};Fa(q,{stroke:B("domainColor"),strokeCap:B("domainCap"),strokeDash:B("domainDash"),strokeDashOffset:B("domainDashOffset"),strokeWidth:B("domainWidth"),strokeOpacity:B("domainOpacity")});let Y=mD(_,0),K=mD(_,1);return U.x=z.x=Ea(M,Y,zt),U.x2=z.x2=Ea(M,K),U.y=z.y=Ko(M,Y,zt),U.y2=z.y2=Ko(M,K),_i({type:Kx,role:nU,from:I,encode:q},O)})(e,n,a.domain,g)),m.title&&E.push(z3(e,n,a.title,g)),Dw(t0({role:tU,from:g,encode:eh(j3(c,e),r,e0),marks:E,aria:c("aria"),description:c("description"),zindex:c("zindex"),name:i,interactive:o,style:u}),t)}function j3(e,t){let n={enter:{},update:{}};return Fa(n,{orient:e("orient"),offset:e("offset")||0,position:Wo(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function gD(e,t,n){let a=Ie(e.signals),r=Ie(e.scales);return n||a.forEach((i=>OO(i,t))),Ie(e.projections).forEach((i=>(function(o,u){let c=u.config.projection||{},f={};for(let m in o)m!=="name"&&(f[m]=Gx(o[m],m,u));for(let m in c)f[m]==null&&(f[m]=Gx(c[m],m,u));u.addProjection(o.name,f)})(i,t))),r.forEach((i=>(function(o,u){let c=o.type||"linear";gv(c)||F("Unrecognized scale type: "+st(c)),u.addScale(o.name,{type:c,domain:void 0})})(i,t))),Ie(e.data).forEach((i=>I3(i,t))),r.forEach((i=>VU(i,t))),(n||a).forEach((i=>(function(o,u){let c=u.getSignal(o.name),f=o.update;o.init&&(f?F("Signals can not include both init and update expressions."):(f=o.init,c.initonly=!0)),f&&(f=Ms(f,u),c.update=f.$expr,c.params=f.$params),o.on&&o.on.forEach((m=>xU(m,u,c.id)))})(i,t))),Ie(e.axes).forEach((i=>G3(i,t))),Ie(e.marks).forEach((i=>Dw(i,t))),Ie(e.legends).forEach((i=>A3(i,t))),e.title&&R3(e.title,t),t.parseLambdas(),t}let H3=e=>eh({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function q3(e,t){let n=t.config,a=pt(t.root=t.add(kw())),r=(function(f,m){let g=_=>Wo(f[_],m[_]),v=[a0("background",g("background")),a0("autosize",JB(g("autosize"))),a0("padding",eU(g("padding"))),a0("width",g("width")||0),a0("height",g("height")||0)],E=v.reduce(((_,N)=>(_[N.name]=N,_)),{}),k={};return Ie(f.signals).forEach((_=>{nt(E,_.name)?_=mt(E[_.name],_):v.push(_),k[_.name]=_})),Ie(m.signals).forEach((_=>{nt(k,_.name)||nt(E,_.name)||v.push(_)})),v})(e,n);r.forEach((f=>OO(f,t))),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;let i=t.add(Vo()),o=t.add($O(NO(H3(e.encode),Rw,Mx,e.style,t,{pulse:pt(i)}))),u=t.add(zO({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:a,pulse:pt(o)}));t.operators.pop(),t.pushState(pt(o),pt(u),null),gD(e,t,r),t.operators.push(u);let c=t.add(FO({mark:a,pulse:pt(u)}));return c=t.add(UO({pulse:pt(c)})),c=t.add(Sd({pulse:pt(c)})),t.addData("root",new Ad(t,i,i,c)),t}function a0(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function bD(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function yD(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}function aA(e){return(Ee(e)?W3:V3)(e)}function W3(e){let t=e.length,n="[";for(let a=0;a<t;++a){let r=e[a];n+=(a>0?",":"")+(ye(r)?r.signal||aA(r):st(r))}return n+"]"}function V3(e){let t,n,a="{",r=0;for(t in e)n=e[t],a+=(++r>1?",":"")+st(t)+":"+(ye(n)?n.signal||aA(n):st(n));return a+"}"}bD.prototype=yD.prototype={parse(e){return gD(e,this)},fork(){return new yD(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach((t=>{t.$ref=e.id})),e.refs=null),e},proxy(e){let t=e instanceof Px?pt(e):e;return this.add(zU({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;for(e in this.root&&(this.root.root=!0),this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(a,r,i){let o,u;a&&(o=a.data||(a.data={}),u=o[r]||(o[r]=[]),u.push(i))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(let a in t.index)n(t.index[a],e,"index:"+a)}return this},pushState(e,t,n){this._encode.push(pt(this.add(Sd({pulse:e})))),this._parent.push(t),this._lookup.push(n?pt(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return $e(this._parent)},encode(){return $e(this._encode)},lookup(){return $e(this._lookup)},markpath(){let e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(Ft(e))return Zb(e,t);e.signal||F("Unsupported field reference: "+st(e));let n=e.signal,a=this.field[n];if(!a){let r={name:this.signalRef(n)};t&&(r.as=t),this.field[n]=a=pt(this.add(IU(r)))}return a},compareRef(e){let t=!1,n=i=>ua(i)?(t=!0,this.signalRef(i.signal)):(function(o){return o&&o.expr})(i)?(t=!0,this.exprRef(i.expr)):i,a=Ie(e.field).map(n),r=Ie(e.order).map(n);return t?pt(this.add(PO({fields:a,orders:r}))):DO(a,r)},keyRef(e,t){let n=!1,a=this.signals;return e=Ie(e).map((r=>ua(r)?(n=!0,pt(a[r.signal])):r)),n?pt(this.add(OU({fields:e,flat:t}))):(function(r,i){let o={$key:r};return i&&(o.$flat=!0),o})(e,t)},sortRef(e){if(!e)return e;let t=Sw(e.op,e.field),n=e.order||"ascending";return n.signal?pt(this.add(PO({fields:t,orders:this.signalRef(n.signal)}))):DO(t,n)},event(e,t){let n=e+":"+t;if(!this.events[n]){let a=this.id();this.streams.push({id:a,source:e,type:t}),this.events[n]=a}return this.events[n]},hasOwnSignal(e){return nt(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&F("Duplicate signal name: "+st(e));let n=t instanceof Px?t:this.add(kw(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||F("Unrecognized signal name: "+st(e)),this.signals[e]},signalRef(e){return this.signals[e]?pt(this.signals[e]):(nt(this.lambdas,e)||(this.lambdas[e]=this.add(kw(null))),pt(this.lambdas[e]))},parseLambdas(){let e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){let a=e[t],r=Ms(a,this),i=this.lambdas[a];i.params=r.$params,i.update=r.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return e&&ye(e)?this.signalRef(e.signal||aA(e)):e},exprRef(e,t){let n={expr:Ms(e,this)};return t&&(n.expr.$name=t),pt(this.add(RU(n)))},addBinding(e,t){this.bindings||F("Nested signals do not support binding: "+st(e)),this.bindings.push(mt({signal:e},t))},addScaleProj(e,t){nt(this.scales,e)&&F("Duplicate scale or projection name: "+st(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,jU(t))},addProjection(e,t){this.addScaleProj(e,UU(t))},getScale(e){return this.scales[e]||F("Unrecognized scale name: "+st(e)),this.scales[e]},scaleRef(e){return pt(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return nt(this.data,e)&&F("Duplicate data set name: "+st(e)),this.data[e]=t},getData(e){return this.data[e]||F("Undefined data set name: "+st(e)),this.data[e]},addDataPipeline(e,t){return nt(this.data,e)&&F("Duplicate data set name: "+st(e)),this.addData(e,Ad.fromEntries(this,t))}},mt(tl,Xf,jL,eF,UF,sP,zP,IP,GP,a$,d$,h$),p.Bounds=In,p.CanvasHandler=sb,p.CanvasRenderer=Wv,p.DATE=ha,p.DAY=aa,p.DAYOFYEAR=Di,p.Dataflow=el,p.Debug=Me,p.Error=de,p.EventStream=Ui,p.Gradient=Je,p.GroupItem=vl,p.HOURS=ja,p.Handler=Mu,p.Info=Ce,p.Item=Lo,p.MILLISECONDS=Dr,p.MINUTES=lr,p.MONTH=na,p.Marks=yi,p.MultiPulse=yc,p.None=ce,p.Operator=Yt,p.Parameters=gc,p.Pulse=oi,p.QUARTER=Ta,p.RenderType=Fu,p.Renderer=Cs,p.ResourceLoader=El,p.SECONDS=ur,p.SVGHandler=J1,p.SVGRenderer=ik,p.SVGStringRenderer=sk,p.Scenegraph=V1,p.TIME_UNITS=Gd,p.Transform=Se,p.View=hO,p.WEEK=Cn,p.Warn=_e,p.YEAR=ta,p.accessor=b,p.accessorFields=T,p.accessorName=S,p.array=Ie,p.ascending=Qt,p.bandwidthNRD=um,p.bin=cm,p.bootstrapCI=dm,p.boundClip=tC,p.boundContext=Jg,p.boundItem=W1,p.boundMark=yT,p.boundStroke=_l,p.changeset=us,p.clampRange=Xe,p.codegenExpression=AI,p.compare=Fl,p.constant=mn,p.cumulativeLogNormal=fr,p.cumulativeNormal=Ec,p.cumulativeUniform=kc,p.dayofyear=M0,p.debounce=Zo,p.defaultLocale=pf,p.definition=om,p.densityLogNormal=Rf,p.densityNormal=fm,p.densityUniform=Of,p.domChild=Ur,p.domClear=Bo,p.domCreate=Du,p.domFind=Y1,p.dotbin=Tf,p.error=F,p.expressionFunction=Zn,p.extend=mt,p.extent=Un,p.extentIndex=ar,p.falsy=ae,p.fastmap=da,p.field=W,p.flush=rr,p.font=Pv,p.fontFamily=ab,p.fontSize=Ts,p.format=hc,p.formatLocale=fc,p.formats=ss,p.hasOwnProperty=nt,p.id=V,p.identity=ee,p.inferType=em,p.inferTypes=tm,p.ingest=It,p.inherits=Fe,p.inrange=Sa,p.interpolate=Hg,p.interpolateColors=Cp,p.interpolateRange=vv,p.intersect=ZT,p.intersectBoxLine=Dp,p.intersectPath=N1,p.intersectPoint=I1,p.intersectRule=aT,p.isArray=Ee,p.isBoolean=Zr,p.isDate=Sn,p.isFunction=tt,p.isIterable=Si,p.isNumber=Ba,p.isObject=ye,p.isRegExp=xi,p.isString=Ft,p.isTuple=ru,p.key=Ai,p.lerp=fo,p.lineHeight=Iu,p.loader=Js,p.locale=Qh,p.logger=Ge,p.lruCache=Pl,p.markup=rk,p.merge=Bs,p.mergeConfig=Te,p.multiLineOffset=j1,p.one=he,p.pad=Ku,p.panLinear=St,p.panLog=Tt,p.panPow=Xt,p.panSymlog=Ke,p.parse=function(e,t,n){return ye(e)||F("Input Vega specification must be an object."),q3(e,new bD(t=Te((function(){let a="sans-serif",r="#4c78a8",i="#000",o="#888",u="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:r},area:{fill:r},image:null,line:{stroke:r,strokeWidth:2},path:{stroke:r},rect:{fill:r},rule:{stroke:i},shape:{stroke:r},symbol:{fill:r,size:64},text:{fill:i,font:a,fontSize:11},trail:{fill:r,size:2},style:{"guide-label":{fill:i,font:a,fontSize:10},"guide-title":{fill:i,font:a,fontSize:11,fontWeight:"bold"},"group-title":{fill:i,font:a,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:i,font:a,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:u},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:o,grid:!1,gridWidth:1,gridColor:u,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:o,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:u,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:o,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}})(),t,e.config),n)).toRuntime()},p.parseExpression=kI,p.parseSelector=kO,p.path=Oc,p.pathCurves=Qe,p.pathEqual=nC,p.pathParse=Ut,p.pathRectangle=Kg,p.pathRender=wn,p.pathSymbols=Xa,p.pathTrail=Xg,p.peek=$e,p.point=Bv,p.projection=rS,p.quantileLogNormal=mm,p.quantileNormal=wc,p.quantileUniform=du,p.quantiles=lm,p.quantizeInterpolator=Ev,p.quarter=Ct,p.quartiles=Af,p.randomInteger=function(e,t){let n,a,r;t==null&&(t=e,e=0);let i={min(o){return arguments.length?(n=o||0,r=a-n,i):n},max(o){return arguments.length?(a=o||0,r=a-n,i):a},sample:()=>n+Math.floor(r*p.random()),pdf:o=>o===Math.floor(o)&&o>=n&&o<a?1/r:0,cdf(o){let u=Math.floor(o);return u<n?0:u>=a?1:(u-n+1)/r},icdf:o=>o>=0&&o<=1?n-1+Math.floor(o*r):NaN};return i.min(e).max(t)},p.randomKDE=hm,p.randomLCG=function(e){return function(){return(e=(1103515245*e+12345)%2147483647)/2147483647}},p.randomLogNormal=Nf,p.randomMixture=If,p.randomNormal=pm,p.randomUniform=Df,p.read=yf,p.regressionConstant=Mf,p.regressionExp=gm,p.regressionLinear=fu,p.regressionLoess=vm,p.regressionLog=Ac,p.regressionPoly=bm,p.regressionPow=my,p.regressionQuad=si,p.renderModule=Xv,p.repeat=po,p.resetDefaultLocale=function(){return Zh(),pc(),pf()},p.resetSVGClipId=xv,p.resetSVGDefIds=function(){xv(),me=0},p.responseType=bf,p.runtimeContext=YI,p.sampleCurve=Lf,p.sampleLogNormal=Cf,p.sampleNormal=cu,p.sampleUniform=_c,p.scale=Bt,p.sceneEqual=uk,p.sceneFromJSON=ET,p.scenePickVisit=Ov,p.sceneToJSON=vT,p.sceneVisit=Po,p.sceneZOrder=O1,p.scheme=Np,p.serializeXML=GT,p.setRandom=function(e){p.random=e},p.span=Jr,p.splitAccessPath=j,p.stringValue=st,p.textMetrics=$o,p.timeBin=ai,p.timeFloor=B0,p.timeFormatLocale=Zs,p.timeInterval=as,p.timeOffset=Kd,p.timeSequence=Lh,p.timeUnitSpecifier=Hd,p.timeUnits=jd,p.toBoolean=$l,p.toDate=Ld,p.toNumber=Le,p.toSet=ir,p.toString=Fd,p.transform=sm,p.transforms=tl,p.truncate=gh,p.truthy=Z,p.tupleid=rt,p.typeParsers=cr,p.utcFloor=Yd,p.utcInterval=Mr,p.utcOffset=G0,p.utcSequence=Fh,p.utcdayofyear=Oh,p.utcquarter=ht,p.utcweek=Dh,p.version="5.25.0",p.visitArray=Qo,p.week=qd,p.writeConfig=ke,p.zero=ne,p.zoomLinear=Zt,p.zoomLog=wt,p.zoomPow=Jt,p.zoomSymlog=Lt}))});var wM=rA((Vw,EM)=>{(function(p,b){typeof Vw=="object"&&typeof EM<"u"?b(Vw,wA()):typeof define=="function"&&define.amd?define(["exports","vega"],b):b((p=typeof globalThis<"u"?globalThis:p||self).vegaLite={},p.vega)})(Vw,(function(p,b){"use strict";var S="5.16.1";function T(s){return!!s.or}function R(s){return!!s.and}function $(s){return!!s.not}function P(s,l){if($(s))P(s.not,l);else if(R(s))for(let d of s.and)P(d,l);else if(T(s))for(let d of s.or)P(d,l);else l(s)}function F(s,l){return $(s)?{not:F(s.not,l)}:R(s)?{and:s.and.map((d=>F(d,l)))}:T(s)?{or:s.or.map((d=>F(d,l)))}:l(s)}let j=globalThis.structuredClone;function W(s){throw new Error(s)}function V(s,l){let d={};for(let h of l)b.hasOwnProperty(s,h)&&(d[h]=s[h]);return d}function ee(s,l){let d={...s};for(let h of l)delete d[h];return d}function ne(s){if(b.isNumber(s))return s;let l=b.isString(s)?s:Xe(s);if(l.length<250)return l;let d=0;for(let h=0;h<l.length;h++)d=(d<<5)-d+l.charCodeAt(h),d&=d;return d}function he(s){return s===!1||s===null}function Z(s,l){return s.includes(l)}function ae(s,l){let d=0;for(let[h,y]of s.entries())if(l(y,h,d++))return!0;return!1}function oe(s,l){let d=0;for(let[h,y]of s.entries())if(!l(y,h,d++))return!1;return!0}function ce(s){for(var l=arguments.length,d=new Array(l>1?l-1:0),h=1;h<l;h++)d[h-1]=arguments[h];for(let y of d)de(s,y??{});return s}function de(s,l){for(let d of be(l))b.writeConfig(s,d,l[d],!0)}function _e(s,l){let d=[],h={},y;for(let w of s)y=l(w),y in h||(h[y]=1,d.push(w));return d}function Ce(s,l){if(s.size!==l.size)return!1;for(let d of s)if(!l.has(d))return!1;return!0}function Me(s,l){for(let d of s)if(l.has(d))return!0;return!1}function Ge(s){let l=new Set;for(let d of s){let h=b.splitAccessPath(d).map(((w,x)=>x===0?w:`[${w}]`)),y=h.map(((w,x)=>h.slice(0,x+1).join("")));for(let w of y)l.add(w)}return l}function Ee(s,l){return s===void 0||l===void 0||Me(Ge(s),Ge(l))}function ye(s){return be(s).length===0}Set.prototype.toJSON=function(){return`Set(${[...this].map((s=>Xe(s))).join(",")})`};let be=Object.keys,Te=Object.values,ke=Object.entries;function Ye(s){return s===!0||s===!1}function $e(s){let l=s.replace(/\W/g,"_");return(s.match(/^\d+/)?"_":"")+l}function Le(s,l){return $(s)?`!(${Le(s.not,l)})`:R(s)?`(${s.and.map((d=>Le(d,l))).join(") && (")})`:T(s)?`(${s.or.map((d=>Le(d,l))).join(") || (")})`:l(s)}function dt(s,l){if(l.length===0)return!0;let d=l.shift();return d in s&&dt(s[d],l)&&delete s[d],ye(s)}function yt(s){return s.charAt(0).toUpperCase()+s.substr(1)}function xt(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"datum",d=b.splitAccessPath(s),h=[];for(let y=1;y<=d.length;y++){let w=`[${d.slice(0,y).map(b.stringValue).join("][")}]`;h.push(`${l}${w}`)}return h.join(" && ")}function rn(s){return`${arguments.length>1&&arguments[1]!==void 0?arguments[1]:"datum"}[${b.stringValue(b.splitAccessPath(s).join("."))}]`}function hn(s){return s.replace(/(\[|\]|\.|'|")/g,"\\$1")}function jt(s){return`${b.splitAccessPath(s).map(hn).join("\\.")}`}function St(s,l,d){return s.replace(new RegExp(l.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),d)}function Tt(s){return`${b.splitAccessPath(s).join(".")}`}function Xt(s){return s?b.splitAccessPath(s).length:0}function Ke(){for(var s=arguments.length,l=new Array(s),d=0;d<s;d++)l[d]=arguments[d];for(let h of l)if(h!==void 0)return h}let et=42;function Zt(s){let l=++et;return s?String(s)+l:l}function wt(s){return Jt(s)?s:`__${s}`}function Jt(s){return s.startsWith("__")}function Lt(s){if(s!==void 0)return(s%360+360)%360}function Ct(s){return!!b.isNumber(s)||!isNaN(s)&&!isNaN(parseFloat(s))}let ht=Object.getPrototypeOf(globalThis.structuredClone({}));function Ie(s,l){if(s===l)return!0;if(s&&l&&typeof s=="object"&&typeof l=="object"){if(s.constructor.name!==l.constructor.name)return!1;let d,h;if(Array.isArray(s)){if(d=s.length,d!=l.length)return!1;for(h=d;h--!=0;)if(!Ie(s[h],l[h]))return!1;return!0}if(s instanceof Map&&l instanceof Map){if(s.size!==l.size)return!1;for(h of s.entries())if(!l.has(h[0]))return!1;for(h of s.entries())if(!Ie(h[1],l.get(h[0])))return!1;return!0}if(s instanceof Set&&l instanceof Set){if(s.size!==l.size)return!1;for(h of s.entries())if(!l.has(h[0]))return!1;return!0}if(ArrayBuffer.isView(s)&&ArrayBuffer.isView(l)){if(d=s.length,d!=l.length)return!1;for(h=d;h--!=0;)if(s[h]!==l[h])return!1;return!0}if(s.constructor===RegExp)return s.source===l.source&&s.flags===l.flags;if(s.valueOf!==Object.prototype.valueOf&&s.valueOf!==ht.valueOf)return s.valueOf()===l.valueOf();if(s.toString!==Object.prototype.toString&&s.toString!==ht.toString)return s.toString()===l.toString();let y=Object.keys(s);if(d=y.length,d!==Object.keys(l).length)return!1;for(h=d;h--!=0;)if(!Object.prototype.hasOwnProperty.call(l,y[h]))return!1;for(h=d;h--!=0;){let w=y[h];if(!Ie(s[w],l[w]))return!1}return!0}return s!=s&&l!=l}function Xe(s){let l=[];return(function d(h){if(h&&h.toJSON&&typeof h.toJSON=="function"&&(h=h.toJSON()),h===void 0)return;if(typeof h=="number")return isFinite(h)?""+h:"null";if(typeof h!="object")return JSON.stringify(h);let y,w;if(Array.isArray(h)){for(w="[",y=0;y<h.length;y++)y&&(w+=","),w+=d(h[y])||"null";return w+"]"}if(h===null)return"null";if(l.includes(h))throw new TypeError("Converting circular structure to JSON");let x=l.push(h)-1,A=Object.keys(h).sort();for(w="",y=0;y<A.length;y++){let C=A[y],L=d(h[C]);L&&(w&&(w+=","),w+=JSON.stringify(C)+":"+L)}return l.splice(x,1),`{${w}}`})(s)}let tt="row",Kr="column",Fl="facet",Qt="x",Bn="y",Xr="x2",ki="y2",mn="xOffset",Zo="yOffset",mt="radius",Un="radius2",ar="theta",co="theta2",nt="latitude",$a="longitude",da="latitude2",rr="longitude2",Fe="color",Sa="fill",Zr="stroke",Sn="shape",Si="size",Ba="angle",xi="opacity",Ft="fillOpacity",Ai="strokeOpacity",fo="strokeWidth",Jo="strokeDash",Pl="text",Bs="order",po="detail",Ku="key",Jr="tooltip",st="href",$l="url",Md="description",Ld={theta:1,theta2:1,radius:1,radius2:1};function Fd(s){return s in Ld}let ir={longitude:1,longitude2:1,latitude:1,latitude2:1};function gh(s){switch(s){case nt:return"y";case da:return"y2";case $a:return"x";case rr:return"x2"}}function Qo(s){return s in ir}let m0=be(ir),Xu={x:1,y:1,x2:1,y2:1,...Ld,...ir,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 es(s){return s===Fe||s===Sa||s===Zr}let Bl={row:1,column:1,facet:1},Ua=be(Bl),Pd={...Xu,...Bl},g0=be(Pd),{order:or,detail:$A,tooltip:BA,...h_}=Pd,{row:UA,column:m_,facet:g_,...b_}=h_;function b0(s){return!!Pd[s]}let y_=[Xr,ki,da,rr,co,Un];function Ti(s){return Us(s)!==s}function Us(s){switch(s){case Xr:return Qt;case ki:return Bn;case da:return nt;case rr:return $a;case co:return ar;case Un:return mt}return s}function sr(s){if(Fd(s))switch(s){case ar:return"startAngle";case co:return"endAngle";case mt:return"outerRadius";case Un:return"innerRadius"}return s}function Ci(s){switch(s){case Qt:return Xr;case Bn:return ki;case nt:return da;case $a:return rr;case ar:return co;case mt:return Un}}function xa(s){switch(s){case Qt:case Xr:return"width";case Bn:case ki:return"height"}}function bh(s){switch(s){case Qt:return"xOffset";case Bn:return"yOffset";case Xr:return"x2Offset";case ki:return"y2Offset";case ar:return"thetaOffset";case mt:return"radiusOffset";case co:return"theta2Offset";case Un:return"radius2Offset"}}function Ul(s){switch(s){case Qt:return"xOffset";case Bn:return"yOffset"}}function v_(s){switch(s){case"xOffset":return"x";case"yOffset":return"y"}}let Zu=be(Xu),{x:za,y:E_,x2:yh,y2:y0,xOffset:w_,yOffset:__,latitude:k_,longitude:S_,latitude2:zA,longitude2:GA,theta:jA,theta2:vh,radius:v0,radius2:E0,...Ri}=Xu,zs=be(Ri),Ju={x:1,y:1},Qr=be(Ju);function un(s){return s in Ju}let Qu={theta:1,radius:1},w0=be(Qu);function ec(s){return s==="width"?Qt:Bn}let Eh={xOffset:1,yOffset:1};function Qn(s){return s in Eh}let{text:x_,tooltip:HA,href:wh,url:tc,description:A_,detail:qA,key:zl,order:_0,..._h}=Ri,k0=be(_h),kh={...Ju,...Qu,...Eh,..._h},Gl=be(kh);function Nr(s){return!!kh[s]}function Sh(s,l){return(function(d){switch(d){case Fe:case Sa:case Zr:case Md:case po:case Ku:case Jr:case st:case Bs:case xi:case Ft:case Ai:case fo:case Fl:case tt:case Kr:return xh;case Qt:case Bn:case mn:case Zo:case nt:case $a:return S0;case Xr:case ki:case da:case rr:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Si:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case Jo:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case Sn:return{point:"always",geoshape:"always"};case Pl:return{text:"always"};case Ba:return{point:"always",square:"always",text:"always"};case $l:return{image:"always"};case ar:case mt:return{text:"always",arc:"always"};case co:case Un:return{arc:"always"}}})(s)[l]}let xh={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:T_,...S0}=xh;function $d(s){switch(s){case Qt:case Bn:case ar:case mt:case mn:case Zo:case Si:case Ba:case fo:case xi:case Ft:case Ai:case Xr:case ki:case co:case Un:return;case Fl:case tt:case Kr:case Sn:case Jo:case Pl:case Jr:case st:case $l:case Md:return"discrete";case Fe:case Sa:case Zr:return"flexible";case nt:case $a:case da:case rr:case po:case Ku:case Bs:return}}let x0={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},A0={count:1,min:1,max:1};function ei(s){return!!s&&!!s.argmin}function Ni(s){return!!s&&!!s.argmax}function xn(s){return b.isString(s)&&!!x0[s]}let jl=new Set(["count","valid","missing","distinct"]);function Ii(s){return b.isString(s)&&jl.has(s)}let Ir=new Set(["count","sum","distinct","valid","missing"]),ho=new Set(["mean","average","median","q1","q3","min","max"]);function Oi(s){return b.isBoolean(s)&&(s=rt(s,void 0)),"bin"+be(s).map((l=>Or(s[l])?$e(`_${l}_${ke(s[l])}`):$e(`_${l}_${s[l]}`))).join("")}function Vt(s){return s===!0||mo(s)&&!s.binned}function zn(s){return s==="binned"||mo(s)&&s.binned===!0}function mo(s){return b.isObject(s)}function Or(s){return s==null?void 0:s.param}function nc(s){switch(s){case tt:case Kr:case Si:case Fe:case Sa:case Zr:case fo:case xi:case Ft:case Ai:case Sn:return 6;case Jo:return 4;default:return 10}}function ts(s){return!!(s!=null&&s.expr)}function ea(s){let l=be(s||{}),d={};for(let h of l)d[h]=Gn(s[h]);return d}function ac(s){let{anchor:l,frame:d,offset:h,orient:y,angle:w,limit:x,color:A,subtitleColor:C,subtitleFont:L,subtitleFontSize:G,subtitleFontStyle:H,subtitleFontWeight:X,subtitleLineHeight:J,subtitlePadding:le,...te}=s,pe={...l?{anchor:l}:{},...d?{frame:d}:{},...h?{offset:h}:{},...y?{orient:y}:{},...w!==void 0?{angle:w}:{},...x!==void 0?{limit:x}:{}},ge={...C?{subtitleColor:C}:{},...L?{subtitleFont:L}:{},...G?{subtitleFontSize:G}:{},...H?{subtitleFontStyle:H}:{},...X?{subtitleFontWeight:X}:{},...J?{subtitleLineHeight:J}:{},...le?{subtitlePadding:le}:{}};return{titleMarkConfig:{...te,...A?{fill:A}:{}},subtitleMarkConfig:V(s,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:pe,subtitle:ge}}function fa(s){return b.isString(s)||b.isArray(s)&&b.isString(s[0])}function Ze(s){return!!(s!=null&&s.signal)}function go(s){return!!s.step}function Aa(s){return!b.isArray(s)&&"field"in s&&"data"in s}let Hl=be({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}),Bd={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},Ah=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function T0(s){let l=b.isArray(s.condition)?s.condition.map(C0):C0(s.condition);return{...Gn(s),condition:l}}function Gn(s){if(ts(s)){let{expr:l,...d}=s;return{signal:l,...d}}return s}function C0(s){if(ts(s)){let{expr:l,...d}=s;return{signal:l,...d}}return s}function on(s){if(ts(s)){let{expr:l,...d}=s;return{signal:l,...d}}return Ze(s)?s:s!==void 0?{value:s}:void 0}function ns(s){return Ze(s)?s.signal:b.stringValue(s.value)}function pa(s){return Ze(s)?s.signal:s==null?null:b.stringValue(s)}function Ud(s,l,d){for(let h of d){let y=Ga(h,l.markDef,l.config);y!==void 0&&(s[h]=on(y))}return s}function R0(s){return[].concat(s.type,s.style??[])}function Ht(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},{vgChannel:y,ignoreVgConfig:w}=h;return y&&l[y]!==void 0?l[y]:l[s]!==void 0?l[s]:!w||y&&y!==s?Ga(s,l,d,h):void 0}function Ga(s,l,d){let{vgChannel:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Ke(h?zd(s,l,d.style):void 0,zd(s,l,d.style),h?d[l.type][h]:void 0,d[l.type][s],h?d.mark[h]:d.mark[s])}function zd(s,l,d){return N0(s,R0(l),d)}function N0(s,l,d){let h;l=b.array(l);for(let y of l){let w=d[y];w&&w[s]!==void 0&&(h=w[s])}return h}function ql(s,l){return b.array(s).reduce(((d,h)=>(d.field.push(je(h,l)),d.order.push(h.sort??"ascending"),d)),{field:[],order:[]})}function Wl(s,l){let d=[...s];return l.forEach((h=>{for(let y of d)if(Ie(y,h))return;d.push(h)})),d}function ti(s,l){return Ie(s,l)||!l?s:s?[...b.array(s),...b.array(l)].join(", "):l}function ni(s,l){let d=s.value,h=l.value;if(d==null||h===null)return{explicit:s.explicit,value:null};if((fa(d)||Ze(d))&&(fa(h)||Ze(h)))return{explicit:s.explicit,value:ti(d,h)};if(fa(d)||Ze(d))return{explicit:s.explicit,value:d};if(fa(h)||Ze(h))return{explicit:s.explicit,value:h};if(!(fa(d)||Ze(d)||fa(h)||Ze(h)))return{explicit:s.explicit,value:Wl(d,h)};throw new Error("It should never reach here")}function at(s,l,d){return(l=(function(h){var y=(function(w,x){if(typeof w!="object"||w===null)return w;var A=w[Symbol.toPrimitive];if(A!==void 0){var C=A.call(w,x||"default");if(typeof C!="object")return C;throw new TypeError("@@toPrimitive must return a primitive value.")}return(x==="string"?String:Number)(w)})(h,"string");return typeof y=="symbol"?y:String(y)})(l))in s?Object.defineProperty(s,l,{value:d,enumerable:!0,configurable:!0,writable:!0}):s[l]=d,s}function I0(s,l,d){return(function(h,y,w){if(y.set)y.set.call(h,w);else{if(!y.writable)throw new TypeError("attempted to set read only private field");y.value=w}})(s,O0(s,l,"set"),d),d}function O0(s,l,d){if(!l.has(s))throw new TypeError("attempted to "+d+" private field on non-instance");return l.get(s)}function C_(s,l,d){(function(h,y){if(y.has(h))throw new TypeError("Cannot initialize the same private elements twice on an object")})(s,l),l.set(s,d)}function Th(s){return`Invalid specification ${Xe(s)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}let ta='Autosize "fit" only works for single views and layered views.';function Ta(s){return`${s=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function na(s){return`${s=="width"?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${s=="width"?"x":"y"}".`}function Cn(s){return s?`Dropping "fit-${s}" because spec has discrete ${xa(s)}.`:'Dropping "fit" because spec has discrete size.'}function ha(s){return`Unknown field for ${s}. Cannot calculate view size.`}function aa(s){return`Cannot project a selection on encoding channel "${s}", which has no field.`}function Di(s,l){return`Cannot project a selection on encoding channel "${s}" as it uses an aggregate function ("${l}").`}function ja(s){return`Selection not supported for ${s} yet.`}let lr="The same selection must be used to override scale domains in a layered view.";function ur(s){return`The "columns" property cannot be used when "${s}" has nested row/column.`}function Dr(s,l,d){return`An ancestor parsed field "${s}" as ${d} but a child wants to parse the field as ${l}.`}function Gd(s){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${s} are dropped.`}function Ch(s){return`${s}Offset dropped because ${s} is continuous`}function jd(s){return`Invalid field type "${s}".`}function D0(s,l){let{fill:d,stroke:h}=l;return`Dropping color ${s} as the plot also has ${d&&h?"fill and stroke":d?"fill":"stroke"}.`}function Hd(s,l){return`Dropping ${Xe(s)} from channel "${l}" since it does not contain any data field, datum, value, or signal.`}function Mi(s,l,d){return`${s} dropped as it is incompatible with "${l}"${d?` when ${d}`:""}.`}function Rh(s){return`${s} encoding should be discrete (ordinal / nominal / binned).`}function M0(s){return`${s} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function qd(s,l){return`Using discrete channel "${s}" to encode "${l}" field can be misleading as it does not encode ${l==="ordinal"?"order":"magnitude"}.`}function L0(s){return`Using unaggregated domain with raw field has no effect (${Xe(s)}).`}function Nh(s){return`Unaggregated domain not applicable for "${s}" since it produces values outside the origin domain of the source data.`}function Ih(s){return`Unaggregated domain is currently unsupported for log scale (${Xe(s)}).`}function F0(s,l,d){return`${d}-scale's "${l}" is dropped as it does not work with ${s} scale.`}function Oh(s){return`The step for "${s}" is dropped because the ${s==="width"?"x":"y"} is continuous.`}let Dh="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function rc(s,l){return`Invalid ${s}: ${Xe(l)}.`}function Wd(s){return`1D error band does not support ${s}.`}function Vd(s){return`Channel ${s} is required for "binned" bin.`}let P0=b.logger(b.Warn),ic=P0;function Be(){ic.warn(...arguments)}function Gs(s){if(s&&b.isObject(s)){for(let l of as)if(l in s)return!0}return!1}let $0=["january","february","march","april","may","june","july","august","september","october","november","december"],B0=$0.map((s=>s.substr(0,3))),U0=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],R_=U0.map((s=>s.substr(0,3)));function Yd(s,l){let d=[];if(l&&s.day!==void 0&&be(s).length>1&&(Be((function(h){return`Dropping day from datetime ${Xe(h)} as day cannot be combined with other units.`})(s)),delete(s=j(s)).day),s.year!==void 0?d.push(s.year):d.push(2012),s.month!==void 0){let h=l?(function(y){if(Ct(y)&&(y=+y),b.isNumber(y))return y-1;{let w=y.toLowerCase(),x=$0.indexOf(w);if(x!==-1)return x;let A=w.substr(0,3),C=B0.indexOf(A);if(C!==-1)return C;throw new Error(rc("month",y))}})(s.month):s.month;d.push(h)}else if(s.quarter!==void 0){let h=l?(function(y){if(Ct(y)&&(y=+y),b.isNumber(y))return y>4&&Be(rc("quarter",y)),y-1;throw new Error(rc("quarter",y))})(s.quarter):s.quarter;d.push(b.isNumber(h)?3*h:`${h}*3`)}else d.push(0);if(s.date!==void 0)d.push(s.date);else if(s.day!==void 0){let h=l?(function(y){if(Ct(y)&&(y=+y),b.isNumber(y))return y%7;{let w=y.toLowerCase(),x=U0.indexOf(w);if(x!==-1)return x;let A=w.substr(0,3),C=R_.indexOf(A);if(C!==-1)return C;throw new Error(rc("day",y))}})(s.day):s.day;d.push(b.isNumber(h)?h+1:`${h}+1`)}else d.push(1);for(let h of["hours","minutes","seconds","milliseconds"]){let y=s[h];d.push(y===void 0?0:y)}return d}function js(s){let l=Yd(s,!0).join(", ");return s.utc?`utc(${l})`:`datetime(${l})`}let z0={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},as=be(z0);function Mr(s){return b.isObject(s)?s.binned:Mh(s)}function Mh(s){return s&&s.startsWith("binned")}function Kd(s){return s.startsWith("utc")}let G0={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function oc(s){return as.filter((l=>Fh(s,l)))}function Lh(s){let l=oc(s);return l[l.length-1]}function Fh(s,l){let d=s.indexOf(l);return!(d<0)&&!(d>0&&l==="seconds"&&s.charAt(d-1)==="i")&&!(s.length>d+3&&l==="day"&&s.charAt(d+3)==="o")&&!(d>0&&l==="year"&&s.charAt(d-1)==="f")}function N_(s,l){let{end:d}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{end:!1},h=xt(l),y=Kd(s)?"utc":"",w,x={};for(let C of as)Fh(s,C)&&(x[C]=(A=C)==="quarter"?`(${y}quarter(${h})-1)`:`${y}${A}(${h})`,w=C);var A;return d&&(x[w]+="+1"),(function(C){let L=Yd(C,!1).join(", ");return C.utc?`utc(${L})`:`datetime(${L})`})(x)}function j0(s){if(s)return`timeUnitSpecifier(${Xe(oc(s))}, ${Xe(G0)})`}function jn(s){if(!s)return;let l;return b.isString(s)?l=Mh(s)?{unit:s.substring(6),binned:!0}:{unit:s}:b.isObject(s)&&(l={...s,...s.unit?{unit:s.unit}:{}}),Kd(l.unit)&&(l.utc=!0,l.unit=l.unit.substring(3)),l}function H0(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:y=>y,d=jn(s),h=Lh(d.unit);if(h&&h!=="day"){let y={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:w,part:x}=Xd(h,d.step);return`${l(js({...y,[x]:+y[x]+w}))} - ${l(js(y))}`}}let I_={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function Xd(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;if((function(d){return!!I_[d]})(s))return{part:s,step:l};switch(s){case"day":case"dayofyear":return{part:"date",step:l};case"quarter":return{part:"month",step:3*l};case"week":return{part:"date",step:7*l}}}function Zd(s){return!!(s!=null&&s.field)&&s.equal!==void 0}function Hs(s){return!!(s!=null&&s.field)&&s.lt!==void 0}function qs(s){return!!(s!=null&&s.field)&&s.lte!==void 0}function Ws(s){return!!(s!=null&&s.field)&&s.gt!==void 0}function Ph(s){return!!(s!=null&&s.field)&&s.gte!==void 0}function Jd(s){return!!(s!=null&&s.field&&(b.isArray(s.range)&&s.range.length===2||Ze(s.range)))}function Qd(s){return!!(s!=null&&s.field)&&(b.isArray(s.oneOf)||b.isArray(s.in))}function Vl(s){return Qd(s)||Zd(s)||Jd(s)||Hs(s)||Ws(s)||qs(s)||Ph(s)}function ai(s,l){return iu(s,{timeUnit:l,wrapTime:!0})}function ef(s){let l=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],{field:d}=s,h=jn(s.timeUnit),{unit:y,binned:w}=h||{},x=je(s,{expr:"datum"}),A=y?`time(${w?x:N_(y,d)})`:x;if(Zd(s))return`${A}===${ai(s.equal,y)}`;if(Hs(s))return`${A}<${ai(s.lt,y)}`;if(Ws(s))return`${A}>${ai(s.gt,y)}`;if(qs(s))return`${A}<=${ai(s.lte,y)}`;if(Ph(s))return`${A}>=${ai(s.gte,y)}`;if(Qd(s))return`indexof([${(function(C,L){return C.map((G=>ai(G,L)))})(s.oneOf,y).join(",")}], ${A}) !== -1`;if((function(C){return!!(C!=null&&C.field)&&C.valid!==void 0})(s))return sc(A,s.valid);if(Jd(s)){let{range:C}=s,L=Ze(C)?{signal:`${C.signal}[0]`}:C[0],G=Ze(C)?{signal:`${C.signal}[1]`}:C[1];if(L!==null&&G!==null&&l)return"inrange("+A+", ["+ai(L,y)+", "+ai(G,y)+"])";let H=[];return L!==null&&H.push(`${A} >= ${ai(L,y)}`),G!==null&&H.push(`${A} <= ${ai(G,y)}`),H.length>0?H.join(" && "):"true"}throw new Error(`Invalid field predicate: ${Xe(s)}`)}function sc(s){return!(arguments.length>1&&arguments[1]!==void 0)||arguments[1]?`isValid(${s}) && isFinite(+${s})`:`!isValid(${s}) || !isFinite(+${s})`}function lc(s){return Vl(s)&&s.timeUnit?{...s,timeUnit:jn(s.timeUnit)}:s}function q0(s){return s==="quantitative"||s==="temporal"}function Yl(s){return s==="ordinal"||s==="nominal"}let bo="quantitative",tf="ordinal",rs="temporal",nf="nominal",Vs="geojson",Gt={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},$h={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 O_(s,l){let d=$h[s],h=$h[l];return d===h||d==="ordinal-position"&&h==="time"||h==="ordinal-position"&&d==="time"}let Pt={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 W0(s){return Pt[s]}let Kl=new Set(["linear","log","pow","sqrt","symlog"]),Xl=new Set([...Kl,"time","utc"]);function V0(s){return Kl.has(s)}let Y0=new Set(["quantile","quantize","threshold"]),D_=new Set([...Xl,...Y0,"sequential","identity"]),M_=new Set(["ordinal","bin-ordinal","point","band"]);function Hn(s){return M_.has(s)}function Ha(s){return D_.has(s)}function Lr(s){return Xl.has(s)}function Zl(s){return Y0.has(s)}function K0(s){return s==null?void 0:s.param}let{type:WA,domain:L_,range:VA,rangeMax:F_,rangeMin:YA,scheme:KA,...P_}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},$_=be(P_);function Bh(s,l){switch(l){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(s);case"bins":return!["point","band","identity","ordinal"].includes(s);case"round":return Lr(s)||s==="band"||s==="point";case"padding":case"rangeMin":case"rangeMax":return Lr(s)||["point","band"].includes(s);case"paddingOuter":case"align":return["point","band"].includes(s);case"paddingInner":return s==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Lr(s);case"nice":return Lr(s)||s==="quantize"||s==="threshold";case"exponent":return s==="pow";case"base":return s==="log";case"constant":return s==="symlog";case"zero":return Ha(s)&&!Z(["log","time","utc","threshold","quantile"],s)}}function X0(s,l){switch(l){case"interpolate":case"scheme":case"domainMid":return es(s)?void 0:`Cannot use the scale property "${l}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}let Ca={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"},Uh=Ca.arc,af=Ca.area,rf=Ca.bar,B_=Ca.image,uc=Ca.line,of=Ca.point,U_=Ca.rect,sf=Ca.rule,Z0=Ca.text,zh=Ca.tick,z_=Ca.trail,lf=Ca.circle,Gh=Ca.square,J0=Ca.geoshape;function is(s){return["line","area","trail"].includes(s)}function cc(s){return["rect","bar","image","arc"].includes(s)}let G_=new Set(be(Ca));function Li(s){return s.type}let j_=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Q0=be({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),jh=be({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 Ys(s){return s&&s.band!=null}let H_={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},q_={binSpacing:1,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},ey={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5};function Hh(s){let{channel:l,channelDef:d,markDef:h,scale:y,config:w}=s,x=Wh(s);return ze(d)&&!Ii(d.aggregate)&&y&&Lr(y.get("type"))?(function(A){let{fieldDef:C,channel:L,markDef:G,ref:H,config:X}=A;return is(G.type)?H:Ht("invalid",G,X)===null?[W_(C,L),H]:H})({fieldDef:d,channel:l,markDef:h,ref:x,config:w}):x}function W_(s,l){return{test:qh(s,!0),...Us(l)==="y"?{field:{group:"height"}}:{value:0}}}function qh(s){let l=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return sc(b.isString(s)?s:je(s,{expr:"datum"}),!l)}function Ks(s,l,d,h){let y={};if(l&&(y.scale=l),Pi(s)){let{datum:w}=s;Gs(w)?y.signal=js(w):Ze(w)?y.signal=w.signal:ts(w)?y.signal=w.expr:y.value=w}else y.field=je(s,d);if(h){let{offset:w,band:x}=h;w&&(y.offset=w),x&&(y.band=x)}return y}function uf(s){let{scaleName:l,fieldOrDatumDef:d,fieldOrDatumDef2:h,offset:y,startSuffix:w,endSuffix:x="end",bandPosition:A=.5}=s,C=!Ze(A)&&0<A&&A<1?"datum":void 0,L=je(d,{expr:C,suffix:w}),G=h!==void 0?je(h,{expr:C}):je(d,{suffix:x,expr:C}),H={};if(A===0||A===1){H.scale=l;let X=A===0?L:G;H.field=X}else{let X=Ze(A)?`(1-${A.signal}) * ${L} + ${A.signal} * ${G}`:`${1-A} * ${L} + ${A} * ${G}`;H.signal=`scale("${l}", ${X})`}return y&&(H.offset=y),H}function Wh(s){let{channel:l,channelDef:d,channel2Def:h,markDef:y,config:w,scaleName:x,scale:A,stack:C,offset:L,defaultRef:G,bandPosition:H}=s;if(d){if(_t(d)){let X=A==null?void 0:A.get("type");if(ma(d)){H??=Fi({fieldDef:d,fieldDef2:h,markDef:y,config:w});let{bin:J,timeUnit:le,type:te}=d;if(Vt(J)||H&&le&&te===rs)return C!=null&&C.impute?Ks(d,x,{binSuffix:"mid"},{offset:L}):H&&!Hn(X)?uf({scaleName:x,fieldOrDatumDef:d,bandPosition:H,offset:L}):Ks(d,x,ou(d,l)?{binSuffix:"range"}:{},{offset:L});if(zn(J)){if(ze(h))return uf({scaleName:x,fieldOrDatumDef:d,fieldOrDatumDef2:h,bandPosition:H,offset:L});Be(Vd(l===Qt?Xr:ki))}}return Ks(d,x,Hn(X)?{binSuffix:"range"}:{},{offset:L,band:X==="band"?H??d.bandPosition??.5:void 0})}if(cr(d)){let X=L?{offset:L}:{};return{...Jl(l,d.value),...X}}}return b.isFunction(G)&&(G=G()),G&&{...G,...L?{offset:L}:{}}}function Jl(s,l){return Z(["x","x2"],s)&&l==="width"?{field:{group:"width"}}:Z(["y","y2"],s)&&l==="height"?{field:{group:"height"}}:on(l)}function Xs(s){return s&&s!=="number"&&s!=="time"}function ty(s,l,d){return`${s}(${l}${d?`, ${Xe(d)}`:""})`}let V_=" \u2013 ";function Vh(s){var L,G;let{fieldOrDatumDef:l,format:d,formatType:h,expr:y,normalizeStack:w,config:x}=s;if(Xs(h))return ri({fieldOrDatumDef:l,format:d,formatType:h,expr:y,config:x});let A=ny(l,y,w),C=tu(l);if(d===void 0&&h===void 0&&x.customFormatTypes){if(C==="quantitative"){if(w&&x.normalizedNumberFormatType)return ri({fieldOrDatumDef:l,format:x.normalizedNumberFormat,formatType:x.normalizedNumberFormatType,expr:y,config:x});if(x.numberFormatType)return ri({fieldOrDatumDef:l,format:x.numberFormat,formatType:x.numberFormatType,expr:y,config:x})}if(C==="temporal"&&x.timeFormatType&&ze(l)&&l.timeUnit===void 0)return ri({fieldOrDatumDef:l,format:x.timeFormat,formatType:x.timeFormatType,expr:y,config:x})}if(It(l)){let H=(function(X){let{field:J,timeUnit:le,format:te,formatType:pe,rawTimeFormat:ge,isUTCScale:xe}=X;return!le||te?!le&&pe?`${pe}(${J}, '${te}')`:(te=b.isString(te)?te:ge,`${xe?"utc":"time"}Format(${J}, '${te}')`):(function(me,Ae,Re){if(!me)return;let Pe=j0(me);return`${Re||Kd(me)?"utc":"time"}Format(${Ae}, ${Pe})`})(le,J,xe)})({field:A,timeUnit:ze(l)?(L=jn(l.timeUnit))==null?void 0:L.unit:void 0,format:d,formatType:x.timeFormatType,rawTimeFormat:x.timeFormat,isUTCScale:$i(l)&&((G=l.scale)==null?void 0:G.type)===Gt.UTC});return H?{signal:H}:void 0}return d=cf({type:C,specifiedFormat:d,config:x,normalizeStack:w}),ze(l)&&Vt(l.bin)?{signal:yo(A,je(l,{expr:y,binSuffix:"end"}),d,h,x)}:d||tu(l)==="quantitative"?{signal:`${Yh(A,d)}`}:{signal:`isValid(${A}) ? ${A} : ""+${A}`}}function ny(s,l,d){return ze(s)?d?`${je(s,{expr:l,suffix:"end"})}-${je(s,{expr:l,suffix:"start"})}`:je(s,{expr:l}):(function(h){let{datum:y}=h;return Gs(y)?js(y):`${Xe(y)}`})(s)}function ri(s){let{fieldOrDatumDef:l,format:d,formatType:h,expr:y,normalizeStack:w,config:x,field:A}=s;return A??=ny(l,y,w),A!=="datum.value"&&ze(l)&&Vt(l.bin)?{signal:yo(A,je(l,{expr:y,binSuffix:"end"}),d,h,x)}:{signal:ty(h,A,d)}}function ay(s,l,d,h,y,w){var x;if(!b.isString(h)||!Xs(h)){if(d===void 0&&h===void 0&&y.customFormatTypes&&tu(s)==="quantitative"&&(y.normalizedNumberFormatType&&nu(s)&&s.stack==="normalize"||y.numberFormatType))return;if(nu(s)&&s.stack==="normalize"&&y.normalizedNumberFormat)return cf({type:"quantitative",config:y,normalizeStack:!0});if(It(s)){let A=ze(s)?(x=jn(s.timeUnit))==null?void 0:x.unit:void 0;return A===void 0&&y.customFormatTypes&&y.timeFormatType?void 0:(function(C){let{specifiedFormat:L,timeUnit:G,config:H,omitTimeFormatConfig:X}=C;return L||(G?{signal:j0(G)}:X?void 0:H.timeFormat)})({specifiedFormat:d,timeUnit:A,config:y,omitTimeFormatConfig:w})}return cf({type:l,specifiedFormat:d,config:y})}}function ry(s,l,d){var h;return s&&(Ze(s)||s==="number"||s==="time")?s:It(l)&&d!=="time"&&d!=="utc"?ze(l)&&((h=jn(l==null?void 0:l.timeUnit))!=null&&h.utc)?"utc":"time":void 0}function cf(s){let{type:l,specifiedFormat:d,config:h,normalizeStack:y}=s;return b.isString(d)?d:l===bo?y?h.normalizedNumberFormat:h.numberFormat:void 0}function Yh(s,l){return`format(${s}, "${l||""}")`}function Kh(s,l,d,h){return Xs(d)?ty(d,s,l):Yh(s,(b.isString(l)?l:void 0)??h.numberFormat)}function yo(s,l,d,h,y){if(d===void 0&&h===void 0&&y.customFormatTypes&&y.numberFormatType)return yo(s,l,y.numberFormat,y.numberFormatType,y);let w=Kh(s,d,h,y),x=Kh(l,d,h,y);return`${sc(s,!1)} ? "null" : ${w} + "${V_}" + ${x}`}let dc="min",Xh={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 df(s){return s in Xh}function Zh(s){return!!(s!=null&&s.encoding)}function ii(s){return s&&(s.op==="count"||!!s.field)}function fc(s){return s&&b.isArray(s)}function Ql(s){return"row"in s||"column"in s}function ff(s){return!!s&&"header"in s}function pc(s){return"facet"in s}function Jh(s){let{field:l,timeUnit:d,bin:h,aggregate:y}=s;return{...d?{timeUnit:d}:{},...h?{bin:h}:{},...y?{aggregate:y}:{},field:l}}function Zs(s){return"sort"in s}function Fi(s){let{fieldDef:l,fieldDef2:d,markDef:h,config:y}=s;if(_t(l)&&l.bandPosition!==void 0)return l.bandPosition;if(ze(l)){let{timeUnit:w,bin:x}=l;if(w&&!d)return Ga("timeUnitBandPosition",h,y);if(Vt(x))return .5}}function Qh(s){var G,H,X;let{channel:l,fieldDef:d,fieldDef2:h,markDef:y,config:w,scaleType:x,useVlSizeChannel:A}=s,C=xa(l),L=Ht(A?"size":C,y,w,{vgChannel:C});if(L!==void 0)return L;if(ze(d)){let{timeUnit:J,bin:le}=d;if(J&&!h)return{band:Ga("timeUnitBandSize",y,w)};if(Vt(le)&&!Hn(x))return{band:1}}return cc(y.type)?x?Hn(x)?((G=w[y.type])==null?void 0:G.discreteBandSize)||{band:1}:(H=w[y.type])==null?void 0:H.continuousBandSize:(X=w[y.type])==null?void 0:X.discreteBandSize:void 0}function pf(s,l,d,h){return!!(Vt(s.bin)||s.timeUnit&&ma(s)&&s.type==="temporal")&&Fi({fieldDef:s,fieldDef2:l,markDef:d,config:h})!==void 0}function iy(s){return s&&!!s.sort&&!s.field}function hf(s){return s&&"condition"in s}function mf(s){let l=s==null?void 0:s.condition;return!!l&&!b.isArray(l)&&ze(l)}function eu(s){let l=s==null?void 0:s.condition;return!!l&&!b.isArray(l)&&_t(l)}function ze(s){return s&&(!!s.field||s.aggregate==="count")}function tu(s){return s==null?void 0:s.type}function Pi(s){return s&&"datum"in s}function os(s){return ma(s)&&!au(s)||gf(s)}function oy(s){return ma(s)&&s.type==="quantitative"&&!s.bin||gf(s)}function gf(s){return Pi(s)&&b.isNumber(s.datum)}function _t(s){return ze(s)||Pi(s)}function ma(s){return s&&("field"in s||s.aggregate==="count")&&"type"in s}function cr(s){return s&&"value"in s&&"value"in s}function $i(s){return s&&("scale"in s||"sort"in s)}function nu(s){return s&&("axis"in s||"stack"in s||"impute"in s)}function em(s){return s&&"legend"in s}function tm(s){return s&&("format"in s||"formatType"in s)}function sy(s){return ee(s,["legend","axis","header","scale"])}function je(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=s.field,h=l.prefix,y=l.suffix,w="";if((function(x){return x.aggregate==="count"})(s))d=wt("count");else{let x;if(!l.nofn)if((function(A){return"op"in A})(s))x=s.op;else{let{bin:A,aggregate:C,timeUnit:L}=s;Vt(A)?(x=Oi(A),y=(l.binSuffix??"")+(l.suffix??"")):C?Ni(C)?(w=`["${d}"]`,d=`argmax_${C.argmax}`):ei(C)?(w=`["${d}"]`,d=`argmin_${C.argmin}`):x=String(C):L&&!Mr(L)&&(x=(function(G){let{utc:H,...X}=jn(G);return X.unit?(H?"utc":"")+be(X).map((J=>$e(`${J==="unit"?"":`_${J}_`}${X[J]}`))).join(""):(H?"utc":"")+"timeunit"+be(X).map((J=>$e(`_${J}_${X[J]}`))).join("")})(L),y=(!["range","mid"].includes(l.binSuffix)&&l.binSuffix||"")+(l.suffix??""))}x&&(d=d?`${x}_${d}`:x)}return y&&(d=`${d}_${y}`),h&&(d=`${h}_${d}`),l.forAs?Tt(d):l.expr?rn(d,l.expr)+w:jt(d)+w}function au(s){switch(s.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return ze(s)&&!!s.bin;case"temporal":return!1}throw new Error(jd(s.type))}let ly=(s,l)=>{switch(l.fieldTitle){case"plain":return s.field;case"functional":return(function(d){let{aggregate:h,bin:y,timeUnit:w,field:x}=d;if(Ni(h))return`${x} for argmax(${h.argmax})`;if(ei(h))return`${x} for argmin(${h.argmin})`;let A=w&&!Mr(w)?jn(w):void 0,C=h||(A==null?void 0:A.unit)||(A==null?void 0:A.maxbins)&&"timeunit"||Vt(y)&&"bin";return C?`${C.toUpperCase()}(${x})`:x})(s);default:return(function(d,h){var C;let{field:y,bin:w,timeUnit:x,aggregate:A}=d;if(A==="count")return h.countTitle;if(Vt(w))return`${y} (binned)`;if(x&&!Mr(x)){let L=(C=jn(x))==null?void 0:C.unit;if(L)return`${y} (${oc(L).join("-")})`}else if(A)return Ni(A)?`${y} for max ${A.argmax}`:ei(A)?`${y} for min ${A.argmin}`:`${yt(A)} of ${y}`;return y})(s,l)}},nm=ly;function hc(s){nm=s}function ss(s,l,d){var C;let{allowDisabling:h,includeDefault:y=!0}=d,w=(C=bf(s))==null?void 0:C.title;if(!ze(s))return w??s.title;let x=s,A=y?yf(x,l):void 0;return h?Ke(w,x.title,A):w??x.title??A}function bf(s){return nu(s)&&s.axis?s.axis:em(s)&&s.legend?s.legend:ff(s)&&s.header?s.header:void 0}function yf(s,l){return nm(s,l)}function Js(s){if(tm(s)){let{format:l,formatType:d}=s;return{format:l,formatType:d}}{let l=bf(s)??{},{format:d,formatType:h}=l;return{format:d,formatType:h}}}function dr(s){return ze(s)?s:mf(s)?s.condition:void 0}function vn(s){return _t(s)?s:eu(s)?s.condition:void 0}function am(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return b.isString(s)||b.isNumber(s)||b.isBoolean(s)?(Be((function(y,w,x){return`Channel ${y} is a ${w}. Converted to {value: ${Xe(x)}}.`})(l,b.isString(s)?"string":b.isNumber(s)?"number":"boolean",s)),{value:s}):_t(s)?vf(s,l,d,h):eu(s)?{...s,condition:vf(s.condition,l,d,h)}:s}function vf(s,l,d,h){if(tm(s)){let{format:y,formatType:w,...x}=s;if(Xs(w)&&!d.customFormatTypes)return Be(Gd(l)),vf(x,l,d,h)}else{let y=nu(s)?"axis":em(s)?"legend":ff(s)?"header":null;if(y&&s[y]){let{format:w,formatType:x,...A}=s[y];if(Xs(x)&&!d.customFormatTypes)return Be(Gd(l)),vf({...s,[y]:A},l,d,h)}}return ze(s)?ru(s,l,h):(function(y){let w=y.type;if(w)return y;let{datum:x}=y;return w=b.isNumber(x)?"quantitative":b.isString(x)?"nominal":Gs(x)?"temporal":void 0,{...y,type:w}})(s)}function ru(s,l){let{compositeMark:d=!1}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{aggregate:h,timeUnit:y,bin:w,field:x}=s,A={...s};if(d||!h||xn(h)||Ni(h)||ei(h)||(Be((function(C){return`Invalid aggregation operator "${C}".`})(h)),delete A.aggregate),y&&(A.timeUnit=jn(y)),x&&(A.field=`${x}`),Vt(w)&&(A.bin=rt(w,l)),zn(w)&&!un(l)&&Be((function(C){return`Channel ${C} should not be used with "binned" bin.`})(l)),ma(A)){let{type:C}=A,L=(function(G){if(G)switch(G=G.toLowerCase()){case"q":case bo:return"quantitative";case"t":case rs:return"temporal";case"o":case tf:return"ordinal";case"n":case nf:return"nominal";case Vs:return"geojson"}})(C);C!==L&&(A.type=L),C!=="quantitative"&&Ii(h)&&(Be((function(G,H){return`Invalid field type "${G}" for aggregate: "${H}", using "quantitative" instead.`})(C,h)),A.type="quantitative")}else if(!Ti(l)){let C=(function(L,G){var le;switch(G){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(Zs(L)&&b.isArray(L.sort))return"ordinal";let{aggregate:H,bin:X,timeUnit:J}=L;if(J)return"temporal";if(X||H&&!Ni(H)&&!ei(H))return"quantitative";if($i(L)&&((le=L.scale)!=null&&le.type))switch($h[L.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"})(A,l);A.type=C}if(ma(A)){let{compatible:C,warning:L}=(function(G,H){var le;let X=G.type;if(X==="geojson"&&H!=="shape")return{compatible:!1,warning:`Channel ${H} should not be used with a geojson data.`};switch(H){case tt:case Kr:case Fl:return au(G)?Qs:{compatible:!1,warning:Rh(H)};case Qt:case Bn:case mn:case Zo:case Fe:case Sa:case Zr:case Pl:case po:case Ku:case Jr:case st:case $l:case Ba:case ar:case mt:case Md:return Qs;case $a:case rr:case nt:case da:return X!==bo?{compatible:!1,warning:`Channel ${H} should be used with a quantitative field only, not ${G.type} field.`}:Qs;case xi:case Ft:case Ai:case fo:case Si:case co:case Un:case Xr:case ki:return X!=="nominal"||G.sort?Qs:{compatible:!1,warning:`Channel ${H} should not be used with an unsorted discrete field.`};case Sn:case Jo:return au(G)||$i(J=G)&&Zl((le=J.scale)==null?void 0:le.type)?Qs:{compatible:!1,warning:M0(H)};case Bs:return G.type!=="nominal"||"sort"in G?Qs:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var J})(A,l)||{};C===!1&&Be(L)}if(Zs(A)&&b.isString(A.sort)){let{sort:C}=A;if(df(C))return{...A,sort:{encoding:C}};let L=C.substr(1);if(C.charAt(0)==="-"&&df(L))return{...A,sort:{encoding:L,order:"descending"}}}if(ff(A)){let{header:C}=A;if(C){let{orient:L,...G}=C;if(L)return{...A,header:{...G,labelOrient:C.labelOrient||L,titleOrient:C.titleOrient||L}}}}return A}function rt(s,l){return b.isBoolean(s)?{maxbins:nc(l)}:s==="binned"?{binned:!0}:s.maxbins||s.step?s:{...s,maxbins:nc(l)}}let Qs={compatible:!0};function It(s){let{formatType:l}=Js(s);return l==="time"||!l&&(d=s)&&(d.type==="temporal"||ze(d)&&!!d.timeUnit);var d}function iu(s,l){var L;let{timeUnit:d,type:h,wrapTime:y,undefinedIfExprNotRequired:w}=l,x=d&&((L=jn(d))==null?void 0:L.unit),A,C=x||h==="temporal";return ts(s)?A=s.expr:Ze(s)?A=s.signal:Gs(s)?(C=!0,A=js(s)):(b.isString(s)||b.isNumber(s))&&C&&(A=`datetime(${Xe(s)})`,(function(G){return!!z0[G]})(x)&&(b.isNumber(s)&&s<1e4||b.isString(s)&&isNaN(Date.parse(s)))&&(A=js({[x]:s}))),A?y&&C?`time(${A})`:A:w?void 0:Xe(s)}function mc(s,l){let{type:d}=s;return l.map((h=>{let y=iu(h,{timeUnit:ze(s)&&!Mr(s.timeUnit)?s.timeUnit:void 0,type:d,undefinedIfExprNotRequired:!0});return y!==void 0?{signal:y}:h}))}function ou(s,l){return Vt(s.bin)?Nr(l)&&["ordinal","nominal"].includes(s.type):(console.warn("Only call this method for binned field defs."),!1)}let ls={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 su(s){return s==null?void 0:s.condition}let us=["domain","grid","labels","ticks","title"],Ef={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"},gc={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},Y_={...gc,style:1,labelExpr:1,encoding:1};function uy(s){return!!Y_[s]}let Yt=be({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 Bi(s){return"mark"in s}class wf{constructor(l,d){this.name=l,this.run=d}hasMatchingType(l){return!!Bi(l)&&(Li(d=l.mark)?d.type:d)===this.name;var d}}function Ui(s,l){let d=s&&s[l];return!!d&&(b.isArray(d)?ae(d,(h=>!!h.field)):ze(d)||mf(d))}function vo(s,l){let d=s&&s[l];return!!d&&(b.isArray(d)?ae(d,(h=>!!h.field)):ze(d)||Pi(d)||eu(d))}function cy(s,l){if(un(l)){let d=s[l];if((ze(d)||Pi(d))&&(Yl(d.type)||ze(d)&&d.timeUnit))return vo(s,Ul(l))}return!1}function rm(s){return ae(g0,(l=>{if(Ui(s,l)){let d=s[l];if(b.isArray(d))return ae(d,(h=>!!h.aggregate));{let h=dr(d);return h&&!!h.aggregate}}return!1}))}function dy(s,l){let d=[],h=[],y=[],w=[],x={};return bc(s,((A,C)=>{if(ze(A)){let{field:L,aggregate:G,bin:H,timeUnit:X,...J}=A;if(G||X||H){let le=bf(A),te=le==null?void 0:le.title,pe=je(A,{forAs:!0}),ge={...te?[]:{title:ss(A,l,{allowDisabling:!0})},...J,field:pe};if(G){let xe;if(Ni(G)?(xe="argmax",pe=je({op:"argmax",field:G.argmax},{forAs:!0}),ge.field=`${pe}.${L}`):ei(G)?(xe="argmin",pe=je({op:"argmin",field:G.argmin},{forAs:!0}),ge.field=`${pe}.${L}`):G!=="boxplot"&&G!=="errorbar"&&G!=="errorband"&&(xe=G),xe){let me={op:xe,as:pe};L&&(me.field=L),w.push(me)}}else if(d.push(pe),ma(A)&&Vt(H)){if(h.push({bin:H,field:L,as:pe}),d.push(je(A,{binSuffix:"end"})),ou(A,C)&&d.push(je(A,{binSuffix:"range"})),un(C)){let xe={field:`${pe}_end`};x[`${C}2`]=xe}ge.bin="binned",Ti(C)||(ge.type=bo)}else if(X&&!Mr(X)){y.push({timeUnit:X,field:L,as:pe});let xe=ma(A)&&A.type!==rs&&"time";xe&&(C===Pl||C===Jr?ge.formatType=xe:(function(me){return!!Ri[me]})(C)?ge.legend={formatType:xe,...ge.legend}:un(C)&&(ge.axis={formatType:xe,...ge.axis}))}x[C]=ge}else d.push(L),x[C]=s[C]}else x[C]=s[C]})),{bins:h,timeUnits:y,aggregate:w,groupby:d,encoding:x}}function _f(s,l,d){let h=Sh(l,d);if(!h)return!1;if(h==="binned"){let y=s[l===Xr?Qt:Bn];return!!(ze(y)&&ze(s[l])&&zn(y.bin))}return!0}function oi(s,l){let d={};for(let h of be(s)){let y=am(s[h],h,l,{compositeMark:!0});d[h]=y}return d}function bc(s,l,d){if(s)for(let h of be(s)){let y=s[h];if(b.isArray(y))for(let w of y)l.call(d,w,h);else l.call(d,y,h)}}function im(s,l){return be(l).reduce(((d,h)=>{switch(h){case Qt:case Bn:case st:case Md:case $l:case Xr:case ki:case mn:case Zo:case ar:case co:case mt:case Un:case nt:case $a:case da:case rr:case Pl:case Sn:case Ba:case Jr:return d;case Bs:if(s==="line"||s==="trail")return d;case po:case Ku:{let y=l[h];if(b.isArray(y)||ze(y))for(let w of b.array(y))w.aggregate||d.push(je(w,{}));return d}case Si:if(s==="trail")return d;case Fe:case Sa:case Zr:case xi:case Ft:case Ai:case Jo:case fo:{let y=dr(l[h]);return y&&!y.aggregate&&d.push(je(y,{})),d}}}),[])}function lu(s,l,d){let h=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3];return"tooltip"in d?{tooltip:d.tooltip}:{tooltip:[...s.map((y=>{let{fieldPrefix:w,titlePrefix:x}=y,A=h?` of ${yc(l)}`:"";return{field:w+l.field,type:l.type,title:Ze(x)?{signal:`${x}"${escape(A)}"`}:x+A}})),..._e((function(y){let w=[];for(let x of be(y))if(Ui(y,x)){let A=y[x],C=b.array(A);for(let L of C)ze(L)?w.push(L):mf(L)&&w.push(L.condition)}return w})(d).map(sy),ne)]}}function yc(s){let{title:l,field:d}=s;return Ke(l,d)}function kf(s,l,d,h,y){let{scale:w,axis:x}=d;return A=>{let{partName:C,mark:L,positionPrefix:G,endPositionPrefix:H,extraEncoding:X={}}=A,J=yc(d);return Sf(s,C,y,{mark:L,encoding:{[l]:{field:`${G}_${d.field}`,type:d.type,...J!==void 0?{title:J}:{},...w!==void 0?{scale:w}:{},...x!==void 0?{axis:x}:{}},...b.isString(H)?{[`${l}2`]:{field:`${H}_${d.field}`}}:{},...h,...X}})}}function Sf(s,l,d,h){let{clip:y,color:w,opacity:x}=s,A=s.type;return s[l]||s[l]===void 0&&d[l]?[{...h,mark:{...d[l],...y?{clip:y}:{},...w?{color:w}:{},...x?{opacity:x}:{},...Li(h.mark)?h.mark:{type:h.mark},style:`${A}-${String(l)}`,...b.isBoolean(s[l])?{}:s[l]}}]:[]}function fy(s,l,d){let{encoding:h}=s,y=l==="vertical"?"y":"x",w=h[y],x=h[`${y}2`],A=h[`${y}Error`],C=h[`${y}Error2`];return{continuousAxisChannelDef:vc(w,d),continuousAxisChannelDef2:vc(x,d),continuousAxisChannelDefError:vc(A,d),continuousAxisChannelDefError2:vc(C,d),continuousAxis:y}}function vc(s,l){if(s!=null&&s.aggregate){let{aggregate:d,...h}=s;return d!==l&&Be((function(y,w){return`Continuous axis should not have customized aggregation function ${y}; ${w} already agregates the axis.`})(d,l)),h}return s}function el(s,l){let{mark:d,encoding:h}=s,{x:y,y:w}=h;if(Li(d)&&d.orient)return d.orient;if(os(y)){if(os(w)){let x=ze(y)&&y.aggregate,A=ze(w)&&w.aggregate;if(x||A!==l){if(A||x!==l){if(x===l&&A===l)throw new Error("Both x and y cannot have aggregate");return It(w)&&!It(y)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(os(w))return"vertical";throw new Error(`Need a valid continuous axis for ${l}s`)}let cs="boxplot",Se=new wf(cs,om);function tl(s){return b.isNumber(s)?"tukey":s}function om(s,l){let{config:d}=l;s={...s,encoding:oi(s.encoding,d)};let{mark:h,encoding:y,params:w,projection:x,...A}=s,C=Li(h)?h:{type:h};w&&Be(ja("boxplot"));let L=C.extent??d.boxplot.extent,G=Ht("size",C,d),H=C.invalid,X=tl(L),{bins:J,timeUnits:le,transform:te,continuousAxisChannelDef:pe,continuousAxis:ge,groupby:xe,aggregate:me,encodingWithoutContinuousAxis:Ae,ticksOrient:Re,boxOrient:Pe,customTooltipWithoutAggregatedField:We}=(function(sd,Yg,Mo){let Tu=el(sd,cs),{continuousAxisChannelDef:Kg,continuousAxis:Xg}=fy(sd,Tu,cs),_n=Kg.field,As=tl(Yg),ld=[...sm(_n),{op:"median",field:_n,as:`mid_box_${_n}`},{op:"min",field:_n,as:(As==="min-max"?"lower_whisker_":"min_")+_n},{op:"max",field:_n,as:(As==="min-max"?"upper_whisker_":"max_")+_n}],Ip=As==="min-max"||As==="tukey"?[]:[{calculate:`datum["upper_box_${_n}"] - datum["lower_box_${_n}"]`,as:`iqr_${_n}`},{calculate:`min(datum["upper_box_${_n}"] + datum["iqr_${_n}"] * ${Yg}, datum["max_${_n}"])`,as:`upper_whisker_${_n}`},{calculate:`max(datum["lower_box_${_n}"] - datum["iqr_${_n}"] * ${Yg}, datum["min_${_n}"])`,as:`lower_whisker_${_n}`}],{[Xg]:XA,...w1}=sd.encoding,{customTooltipWithoutAggregatedField:_1,filteredEncoding:k1}=(function(In){let{tooltip:Lo,...vl}=In;if(!Lo)return{filteredEncoding:vl};let El,no;if(b.isArray(Lo)){for(let wl of Lo)wl.aggregate?(El||(El=[]),El.push(wl)):(no||(no=[]),no.push(wl));El&&(vl.tooltip=El)}else Lo.aggregate?vl.tooltip=Lo:no=Lo;return b.isArray(no)&&no.length===1&&(no=no[0]),{customTooltipWithoutAggregatedField:no,filteredEncoding:vl}})(w1),{bins:wv,timeUnits:_v,aggregate:kv,groupby:Op,encoding:Cu}=dy(k1,Mo),Sv=Tu==="vertical"?"horizontal":"vertical",xv=Tu,Zg=[...wv,..._v,{aggregate:[...kv,...ld],groupby:Op},...Ip];return{bins:wv,timeUnits:_v,transform:Zg,groupby:Op,aggregate:kv,continuousAxisChannelDef:Kg,continuousAxis:Xg,encodingWithoutContinuousAxis:Cu,ticksOrient:Sv,boxOrient:xv,customTooltipWithoutAggregatedField:_1}})(s,L,d),{color:Je,size:it,...Qe}=Ae,lt=sd=>kf(C,ge,pe,sd,d.boxplot),kt=lt(Qe),Fn=lt(Ae),dn=lt({...Qe,...it?{size:it}:{}}),sn=lu([{fieldPrefix:X==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:X==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],pe,Ae),Ut={type:"tick",color:"black",opacity:1,orient:Re,invalid:H,aria:!1},Dt=X==="min-max"?sn:lu([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],pe,Ae),En=[...kt({partName:"rule",mark:{type:"rule",invalid:H,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:Dt}),...kt({partName:"rule",mark:{type:"rule",invalid:H,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:Dt}),...kt({partName:"ticks",mark:Ut,positionPrefix:"lower_whisker",extraEncoding:Dt}),...kt({partName:"ticks",mark:Ut,positionPrefix:"upper_whisker",extraEncoding:Dt})],Nn=[...X!=="tukey"?En:[],...Fn({partName:"box",mark:{type:"bar",...G?{size:G}:{},orient:Pe,invalid:H,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:sn}),...dn({partName:"median",mark:{type:"tick",invalid:H,...b.isObject(d.boxplot.median)&&d.boxplot.median.color?{color:d.boxplot.median.color}:{},...G?{size:G}:{},orient:Re,aria:!1},positionPrefix:"mid_box",extraEncoding:sn})];if(X==="min-max")return{...A,transform:(A.transform??[]).concat(te),layer:Nn};let fn=`datum["lower_box_${pe.field}"]`,Oa=`datum["upper_box_${pe.field}"]`,Da=`(${Oa} - ${fn})`,Br=`${fn} - ${L} * ${Da}`,Xn=`${Oa} + ${L} * ${Da}`,ga=`datum["${pe.field}"]`,ln={joinaggregate:sm(pe.field),groupby:xe},At={transform:[{filter:`(${Br} <= ${ga}) && (${ga} <= ${Xn})`},{aggregate:[{op:"min",field:pe.field,as:`lower_whisker_${pe.field}`},{op:"max",field:pe.field,as:`upper_whisker_${pe.field}`},{op:"min",field:`lower_box_${pe.field}`,as:`lower_box_${pe.field}`},{op:"max",field:`upper_box_${pe.field}`,as:`upper_box_${pe.field}`},...me],groupby:xe}],layer:En},{tooltip:wn,...mi}=Qe,{scale:gi,axis:xs}=pe,Xa=yc(pe),mr=ee(xs,["title"]),ba=Sf(C,"outliers",d.boxplot,{transform:[{filter:`(${ga} < ${Br}) || (${ga} > ${Xn})`}],mark:"point",encoding:{[ge]:{field:pe.field,type:pe.type,...Xa!==void 0?{title:Xa}:{},...gi!==void 0?{scale:gi}:{},...ye(mr)?{}:{axis:mr}},...mi,...Je?{color:Je}:{},...We?{tooltip:We}:{}}})[0],bi,Do=[...J,...le,ln];return ba?bi={transform:Do,layer:[ba,At]}:(bi=At,bi.transform.unshift(...Do)),{...A,layer:[bi,{transform:te,layer:Nn}]}}function sm(s){return[{op:"q1",field:s,as:`lower_box_${s}`},{op:"q3",field:s,as:`upper_box_${s}`}]}let xf="errorbar",lm=new wf(xf,Af);function Af(s,l){let{config:d}=l;s={...s,encoding:oi(s.encoding,d)};let{transform:h,continuousAxisChannelDef:y,continuousAxis:w,encodingWithoutContinuousAxis:x,ticksOrient:A,markDef:C,outerSpec:L,tooltipEncoding:G}=cm(s,xf,d);delete x.size;let H=kf(C,w,y,x,d.errorbar),X=C.thickness,J=C.size,le={type:"tick",orient:A,aria:!1,...X!==void 0?{thickness:X}:{},...J!==void 0?{size:J}:{}},te=[...H({partName:"ticks",mark:le,positionPrefix:"lower",extraEncoding:G}),...H({partName:"ticks",mark:le,positionPrefix:"upper",extraEncoding:G}),...H({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...X!==void 0?{size:X}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:G})];return{...L,transform:h,...te.length>1?{layer:te}:{...te[0]}}}function um(s,l){let{encoding:d}=s;if((function(A){return(_t(A.x)||_t(A.y))&&!_t(A.x2)&&!_t(A.y2)&&!_t(A.xError)&&!_t(A.xError2)&&!_t(A.yError)&&!_t(A.yError2)})(d))return{orient:el(s,l),inputType:"raw"};let h=(function(A){return _t(A.x2)||_t(A.y2)})(d),y=(function(A){return _t(A.xError)||_t(A.xError2)||_t(A.yError)||_t(A.yError2)})(d),w=d.x,x=d.y;if(h){if(y)throw new Error(`${l} cannot be both type aggregated-upper-lower and aggregated-error`);let A=d.x2,C=d.y2;if(_t(A)&&_t(C))throw new Error(`${l} cannot have both x2 and y2`);if(_t(A)){if(os(w))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${l}`)}if(_t(C)){if(os(x))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${l}`)}throw new Error("No ranged axis")}{let A=d.xError,C=d.xError2,L=d.yError,G=d.yError2;if(_t(C)&&!_t(A))throw new Error(`${l} cannot have xError2 without xError`);if(_t(G)&&!_t(L))throw new Error(`${l} cannot have yError2 without yError`);if(_t(A)&&_t(L))throw new Error(`${l} cannot have both xError and yError with both are quantiative`);if(_t(A)){if(os(w))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(_t(L)){if(os(x))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 cm(s,l,d){let{mark:h,encoding:y,params:w,projection:x,...A}=s,C=Li(h)?h:{type:h};w&&Be(ja(l));let{orient:L,inputType:G}=um(s,l),{continuousAxisChannelDef:H,continuousAxisChannelDef2:X,continuousAxisChannelDefError:J,continuousAxisChannelDefError2:le,continuousAxis:te}=fy(s,L,l),{errorBarSpecificAggregate:pe,postAggregateCalculates:ge,tooltipSummary:xe,tooltipTitleWithFieldName:me}=(function(Dt,En,Nn,fn,Oa,Da,Br,Xn){let ga=[],ln=[],At=En.field,wn,mi=!1;if(Da==="raw"){let Xa=Dt.center?Dt.center:Dt.extent?Dt.extent==="iqr"?"median":"mean":Xn.errorbar.center,mr=Dt.extent?Dt.extent:Xa==="mean"?"stderr":"iqr";if(Xa==="median"!=(mr==="iqr")&&Be((function(ba,bi,Do){return`${ba} is not usually used with ${bi} for ${Do}.`})(Xa,mr,Br)),mr==="stderr"||mr==="stdev")ga=[{op:mr,field:At,as:`extent_${At}`},{op:Xa,field:At,as:`center_${At}`}],ln=[{calculate:`datum["center_${At}"] + datum["extent_${At}"]`,as:`upper_${At}`},{calculate:`datum["center_${At}"] - datum["extent_${At}"]`,as:`lower_${At}`}],wn=[{fieldPrefix:"center_",titlePrefix:yt(Xa)},{fieldPrefix:"upper_",titlePrefix:dm(Xa,mr,"+")},{fieldPrefix:"lower_",titlePrefix:dm(Xa,mr,"-")}],mi=!0;else{let ba,bi,Do;mr==="ci"?(ba="mean",bi="ci0",Do="ci1"):(ba="median",bi="q1",Do="q3"),ga=[{op:bi,field:At,as:`lower_${At}`},{op:Do,field:At,as:`upper_${At}`},{op:ba,field:At,as:`center_${At}`}],wn=[{fieldPrefix:"upper_",titlePrefix:ss({field:At,aggregate:Do,type:"quantitative"},Xn,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:ss({field:At,aggregate:bi,type:"quantitative"},Xn,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:ss({field:At,aggregate:ba,type:"quantitative"},Xn,{allowDisabling:!1})}]}}else{(Dt.center||Dt.extent)&&Be((gi=Dt.center,`${(xs=Dt.extent)?"extent ":""}${xs&&gi?"and ":""}${gi?"center ":""}${xs&&gi?"are ":"is "}not needed when data are aggregated.`)),Da==="aggregated-upper-lower"?(wn=[],ln=[{calculate:`datum["${Nn.field}"]`,as:`upper_${At}`},{calculate:`datum["${At}"]`,as:`lower_${At}`}]):Da==="aggregated-error"&&(wn=[{fieldPrefix:"",titlePrefix:At}],ln=[{calculate:`datum["${At}"] + datum["${fn.field}"]`,as:`upper_${At}`}],Oa?ln.push({calculate:`datum["${At}"] + datum["${Oa.field}"]`,as:`lower_${At}`}):ln.push({calculate:`datum["${At}"] - datum["${fn.field}"]`,as:`lower_${At}`}));for(let Xa of ln)wn.push({fieldPrefix:Xa.as.substring(0,6),titlePrefix:St(St(Xa.calculate,'datum["',""),'"]',"")})}var gi,xs;return{postAggregateCalculates:ln,errorBarSpecificAggregate:ga,tooltipSummary:wn,tooltipTitleWithFieldName:mi}})(C,H,X,J,le,G,l,d),{[te]:Ae,[te==="x"?"x2":"y2"]:Re,[te==="x"?"xError":"yError"]:Pe,[te==="x"?"xError2":"yError2"]:We,...Je}=y,{bins:it,timeUnits:Qe,aggregate:lt,groupby:kt,encoding:Fn}=dy(Je,d),dn=[...lt,...pe],sn=G!=="raw"?[]:kt,Ut=lu(xe,H,Fn,me);return{transform:[...A.transform??[],...it,...Qe,...dn.length===0?[]:[{aggregate:dn,groupby:sn}],...ge],groupby:sn,continuousAxisChannelDef:H,continuousAxis:te,encodingWithoutContinuousAxis:Fn,ticksOrient:L==="vertical"?"horizontal":"vertical",markDef:C,outerSpec:A,tooltipEncoding:Ut}}function dm(s,l,d){return`${yt(s)} ${d} ${l}`}let Tf="errorband",py=new wf(Tf,hy);function hy(s,l){let{config:d}=l;s={...s,encoding:oi(s.encoding,d)};let{transform:h,continuousAxisChannelDef:y,continuousAxis:w,encodingWithoutContinuousAxis:x,markDef:A,outerSpec:C,tooltipEncoding:L}=cm(s,Tf,d),G=A,H=kf(G,w,y,x,d.errorband),X=s.encoding.x!==void 0&&s.encoding.y!==void 0,J={type:X?"area":"rect"},le={type:X?"line":"rule"},te={...G.interpolate?{interpolate:G.interpolate}:{},...G.tension&&G.interpolate?{tension:G.tension}:{}};return X?(J={...J,...te,ariaRoleDescription:"errorband"},le={...le,...te,aria:!1}):G.interpolate?Be(Wd("interpolate")):G.tension&&Be(Wd("tension")),{...C,transform:h,layer:[...H({partName:"band",mark:J,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:L}),...H({partName:"borders",mark:le,positionPrefix:"lower",extraEncoding:L}),...H({partName:"borders",mark:le,positionPrefix:"upper",extraEncoding:L})]}}let uu={};function cu(s,l,d){let h=new wf(s,l);uu[s]={normalizer:h,parts:d}}cu(cs,om,["box","median","outliers","rule","ticks"]),cu(xf,Af,["ticks","rule"]),cu(Tf,hy,["band","borders"]);let fm=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],Ec={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"},wc={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"},pm=be(Ec),hm=be(wc),Cf=be({header:1,headerRow:1,headerColumn:1,headerFacet:1}),Rf=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],fr="_vgsid_",mm={point:{on:"click",fields:[fr],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Nf(s){return s==="legend"||!!(s!=null&&s.legend)}function If(s){return Nf(s)&&b.isObject(s)}function _c(s){return!!(s!=null&&s.select)}function Of(s){let l=[];for(let d of s||[]){if(_c(d))continue;let{expr:h,bind:y,...w}=d;if(y&&h){let x={...w,bind:y,init:h};l.push(x)}else{let x={...w,...h?{update:h}:{},...y?{bind:y}:{}};l.push(x)}}return l}function kc(s){return"concat"in s}function du(s){return"vconcat"in s}function Df(s){return"hconcat"in s}function Mf(s){let{step:l,offsetIsDiscrete:d}=s;return d?l.for??"offset":"position"}function qa(s){return b.isObject(s)&&s.step!==void 0}function Sc(s){return s.view||s.width||s.height}let xc=be({align:1,bounds:1,center:1,columns:1,spacing:1});function ds(s,l){return s[l]??s[l==="width"?"continuousWidth":"continuousHeight"]}function fu(s,l){let d=Ac(s,l);return qa(d)?d.step:gm}function Ac(s,l){return Ke(s[l]??s[l==="width"?"discreteWidth":"discreteHeight"],{step:s.step})}let gm=20,my={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:gm},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:q_,circle:{},geoshape:{},image:{},line:{},point:{},rect:ey,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,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:mm,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},si=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],bm={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},gy={blue:si[0],orange:si[1],red:si[2],teal:si[3],green:si[4],yellow:si[5],purple:si[6],pink:si[7],brown:si[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 ym(s){let l=be(s||{}),d={};for(let h of l){let y=s[h];d[h]=su(y)?T0(y):Gn(y)}return d}let by=[...jh,...Yt,...Cf,"background","padding","legend","lineBreak","scale","style","title","view"];function vm(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{color:l,font:d,fontSize:h,selection:y,...w}=s,x=b.mergeConfig({},j(my),d?(function(C){return{text:{font:C},style:{"guide-label":{font:C},"guide-title":{font:C},"group-title":{font:C},"group-subtitle":{font:C}}}})(d):{},l?(function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{signals:[{name:"color",value:b.isObject(C)?{...gy,...C}:gy}],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"}]}}})(l):{},h?(function(C){return{signals:[{name:"fontSize",value:b.isObject(C)?{...bm,...C}:bm}],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"}}}}})(h):{},w||{});y&&b.writeConfig(x,"selection",y,!0);let A=ee(x,by);for(let C of["background","lineBreak","padding"])x[C]&&(A[C]=Gn(x[C]));for(let C of jh)x[C]&&(A[C]=ea(x[C]));for(let C of Yt)x[C]&&(A[C]=ym(x[C]));for(let C of Cf)x[C]&&(A[C]=ea(x[C]));return x.legend&&(A.legend=ea(x.legend)),x.scale&&(A.scale=ea(x.scale)),x.style&&(A.style=(function(C){let L=be(C),G={};for(let H of L)G[H]=ym(C[H]);return G})(x.style)),x.title&&(A.title=ea(x.title)),x.view&&(A.view=ea(x.view)),A}let K_=new Set(["view",...G_]),X_=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Z_={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],line:["point"],tick:["bandSize","thickness"]};function Lf(s){s=j(s);for(let l of X_)delete s[l];if(s.axis)for(let l in s.axis)su(s.axis[l])&&delete s.axis[l];if(s.legend)for(let l of fm)delete s.legend[l];if(s.mark){for(let l of Q0)delete s.mark[l];s.mark.tooltip&&b.isObject(s.mark.tooltip)&&delete s.mark.tooltip}s.params&&(s.signals=(s.signals||[]).concat(Of(s.params)),delete s.params);for(let l of K_){for(let h of Q0)delete s[l][h];let d=Z_[l];if(d)for(let h of d)delete s[l][h];J_(s,l)}for(let l of be(uu))delete s[l];(function(l){let{titleMarkConfig:d,subtitleMarkConfig:h,subtitle:y}=ac(l.title);ye(d)||(l.style["group-title"]={...l.style["group-title"],...d}),ye(h)||(l.style["group-subtitle"]={...l.style["group-subtitle"],...h}),ye(y)?delete l.title:l.title=y})(s);for(let l in s)b.isObject(s[l])&&ye(s[l])&&delete s[l];return ye(s)?void 0:s}function J_(s,l,d,h){l==="view"&&(d="cell");let y={...h?s[l][h]:s[l],...s.style[d??l]};ye(y)||(s.style[d??l]=y),h||delete s[l]}function pu(s){return"layer"in s}class Ff{map(l,d){return pc(l)?this.mapFacet(l,d):(function(h){return"repeat"in h})(l)?this.mapRepeat(l,d):Df(l)?this.mapHConcat(l,d):du(l)?this.mapVConcat(l,d):kc(l)?this.mapConcat(l,d):this.mapLayerOrUnit(l,d)}mapLayerOrUnit(l,d){if(pu(l))return this.mapLayer(l,d);if(Bi(l))return this.mapUnit(l,d);throw new Error(Th(l))}mapLayer(l,d){return{...l,layer:l.layer.map((h=>this.mapLayerOrUnit(h,d)))}}mapHConcat(l,d){return{...l,hconcat:l.hconcat.map((h=>this.map(h,d)))}}mapVConcat(l,d){return{...l,vconcat:l.vconcat.map((h=>this.map(h,d)))}}mapConcat(l,d){let{concat:h,...y}=l;return{...y,concat:h.map((w=>this.map(w,d)))}}mapFacet(l,d){return{...l,spec:this.map(l.spec,d)}}mapRepeat(l,d){return{...l,spec:this.map(l.spec,d)}}}let Em={zero:1,center:1,normalize:1},Q_=new Set([Uh,rf,af,sf,of,lf,Gh,uc,Z0,zh]),Tc=new Set([rf,af,Uh]);function zi(s){return ze(s)&&tu(s)==="quantitative"&&!s.bin}function wm(s,l,d){let{orient:h,type:y}=d,w=l==="x"?"y":"radius",x=l==="x",A=s[l],C=s[w];if(ze(A)&&ze(C))if(zi(A)&&zi(C)){if(A.stack)return l;if(C.stack)return w;let L=ze(A)&&!!A.aggregate;if(L!==(ze(C)&&!!C.aggregate))return L?l:w;if(x&&["bar","area"].includes(y)){if(h==="vertical")return w;if(h==="horizontal")return l}}else{if(zi(A))return l;if(zi(C))return w}else{if(zi(A))return l;if(zi(C))return w}}function _m(s,l){var pe,ge;let d=Li(s)?s:{type:s},h=d.type;if(!Q_.has(h))return null;let y=wm(l,"x",d)||wm(l,"theta",d);if(!y)return null;let w=l[y],x=ze(w)?je(w,{}):void 0,A=(function(xe){switch(xe){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}})(y),C=[],L=new Set;if(l[A]){let xe=l[A],me=ze(xe)?je(xe,{}):void 0;me&&me!==x&&(C.push(A),L.add(me))}let G=A==="x"?"xOffset":"yOffset",H=l[G],X=ze(H)?je(H,{}):void 0;X&&X!==x&&(C.push(G),L.add(X));let J=zs.reduce(((xe,me)=>{if(me!=="tooltip"&&Ui(l,me)){let Ae=l[me];for(let Re of b.array(Ae)){let Pe=dr(Re);if(Pe.aggregate)continue;let We=je(Pe,{});We&&L.has(We)||xe.push({channel:me,fieldDef:Pe})}}return xe}),[]),le;return w.stack!==void 0?le=b.isBoolean(w.stack)?w.stack?"zero":null:w.stack:Tc.has(h)&&(le="zero"),le&&le in Em?rm(l)&&J.length===0?null:(pe=w==null?void 0:w.scale)!=null&&pe.type&&((ge=w==null?void 0:w.scale)==null?void 0:ge.type)!==Gt.LINEAR?(w!=null&&w.stack&&Be((function(xe){return`Cannot stack non-linear scale (${xe}).`})(w.scale.type)),null):_t(l[Ci(y)])?(w.stack!==void 0&&Be(`Cannot stack "${te=y}" if there is already "${te}2".`),null):(ze(w)&&w.aggregate&&!Ir.has(w.aggregate)&&Be(`Stacking is applied even though the aggregate function is non-summative ("${w.aggregate}").`),{groupbyChannels:C,groupbyFields:L,fieldChannel:y,impute:w.impute!==null&&is(h),stackBy:J,offset:le}):null;var te}function yy(s,l,d){let h=ea(s),y=Ht("orient",h,d);if(h.orient=(function(w,x,A){switch(w){case of:case lf:case Gh:case Z0:case U_:case B_:return}let{x:C,y:L,x2:G,y2:H}=x;switch(w){case rf:if(ze(C)&&(zn(C.bin)||ze(L)&&L.aggregate&&!C.aggregate))return"vertical";if(ze(L)&&(zn(L.bin)||ze(C)&&C.aggregate&&!L.aggregate))return"horizontal";if(H||G){if(A)return A;if(!G)return(ze(C)&&C.type===bo&&!Vt(C.bin)||gf(C))&&ze(L)&&zn(L.bin)?"horizontal":"vertical";if(!H)return(ze(L)&&L.type===bo&&!Vt(L.bin)||gf(L))&&ze(C)&&zn(C.bin)?"vertical":"horizontal"}case sf:if(G&&(!ze(C)||!zn(C.bin))&&H&&(!ze(L)||!zn(L.bin)))return;case af:if(H)return ze(L)&&zn(L.bin)?"horizontal":"vertical";if(G)return ze(C)&&zn(C.bin)?"vertical":"horizontal";if(w===sf){if(C&&!L)return"vertical";if(L&&!C)return"horizontal"}case uc:case zh:{let X=oy(C),J=oy(L);if(A)return A;if(X&&!J)return w!=="tick"?"horizontal":"vertical";if(!X&&J)return w!=="tick"?"vertical":"horizontal";if(X&&J)return"vertical";{let le=ma(C)&&C.type===rs,te=ma(L)&&L.type===rs;if(le&&!te)return"vertical";if(!le&&te)return"horizontal"}return}}return"vertical"})(h.type,l,y),y!==void 0&&y!==h.orient&&Be(`Specified orient "${h.orient}" overridden with "${y}".`),h.type==="bar"&&h.orient){let w=Ht("cornerRadiusEnd",h,d);if(w!==void 0){let x=h.orient==="horizontal"&&l.x2||h.orient==="vertical"&&l.y2?["cornerRadius"]:H_[h.orient];for(let A of x)h[A]=w;h.cornerRadiusEnd!==void 0&&delete h.cornerRadiusEnd}}return Ht("opacity",h,d)===void 0&&(h.opacity=(function(w,x){if(Z([of,zh,lf,Gh],w)&&!rm(x))return .7})(h.type,l)),Ht("cursor",h,d)===void 0&&(h.cursor=(function(w,x,A){return x.href||w.href||Ht("href",w,A)?"pointer":w.cursor})(h,l,d)),h}function e1(s){let{point:l,line:d,...h}=s;return be(h).length>1?h:h.type}function t1(s){for(let l of["line","area","rule","trail"])s[l]&&(s={...s,[l]:ee(s[l],["point","line"])});return s}function km(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},d=arguments.length>2?arguments[2]:void 0;return s.point==="transparent"?{opacity:0}:s.point?b.isObject(s.point)?s.point:{}:s.point!==void 0?null:l.point||d.shape?b.isObject(l.point)?l.point:{}:void 0}function Sm(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s.line?s.line===!0?{}:s.line:s.line!==void 0?null:l.line?l.line===!0?{}:l.line:void 0}class xm{constructor(){at(this,"name","path-overlay")}hasMatchingType(l,d){if(Bi(l)){let{mark:h,encoding:y}=l,w=Li(h)?h:{type:h};switch(w.type){case"line":case"rule":case"trail":return!!km(w,d[w.type],y);case"area":return!!km(w,d[w.type],y)||!!Sm(w,d[w.type])}}return!1}run(l,d,h){let{config:y}=d,{params:w,projection:x,mark:A,name:C,encoding:L,...G}=l,H=oi(L,y),X=Li(A)?A:{type:A},J=km(X,y[X.type],H),le=X.type==="area"&&Sm(X,y[X.type]),te=[{name:C,...w?{params:w}:{},mark:e1({...X.type==="area"&&X.opacity===void 0&&X.fillOpacity===void 0?{opacity:.7}:{},...X}),encoding:ee(H,["shape"])}],pe=_m(yy(X,H,y),H),ge=H;if(pe){let{fieldChannel:xe,offset:me}=pe;ge={...H,[xe]:{...H[xe],...me?{stack:me}:{}}}}return ge=ee(ge,["y2","x2"]),le&&te.push({...x?{projection:x}:{},mark:{type:"line",...V(X,["clip","interpolate","tension","tooltip"]),...le},encoding:ge}),J&&te.push({...x?{projection:x}:{},mark:{type:"point",opacity:1,filled:!0,...V(X,["clip","tooltip"]),...J},encoding:ge}),h({...G,layer:te},{...d,config:t1(y)})}}function ra(s,l){return l?Ql(s)?vy(s,l):Am(s,l):s}function Gi(s,l){return l?vy(s,l):s}function Cc(s,l,d){let h=l[s];return(y=h)&&!b.isString(y)&&"repeat"in y?h.repeat in d?{...l,[s]:d[h.repeat]}:void Be((function(w){return`Unknown repeated value "${w}".`})(h.repeat)):l;var y}function Am(s,l){if((s=Cc("field",s,l))!==void 0){if(s===null)return null;if(Zs(s)&&ii(s.sort)){let d=Cc("field",s.sort,l);s={...s,...d?{sort:d}:{}}}return s}}function Pf(s,l){if(ze(s))return Am(s,l);{let d=Cc("datum",s,l);return d===s||d.type||(d.type="nominal"),d}}function Tm(s,l){if(!_t(s)){if(eu(s)){let d=Pf(s.condition,l);if(d)return{...s,condition:d};{let{condition:h,...y}=s;return y}}return s}{let d=Pf(s,l);if(d)return d;if(hf(s))return{condition:s.condition}}}function vy(s,l){let d={};for(let h in s)if(b.hasOwnProperty(s,h)){let y=s[h];if(b.isArray(y))d[h]=y.map((w=>Tm(w,l))).filter((w=>w));else{let w=Tm(y,l);w!==void 0&&(d[h]=w)}}return d}class Cm{constructor(){at(this,"name","RuleForRangedLine")}hasMatchingType(l){if(Bi(l)){let{encoding:d,mark:h}=l;if(h==="line"||Li(h)&&h.type==="line")for(let y of y_){let w=d[Us(y)];if(d[y]&&(ze(w)&&!zn(w.bin)||Pi(w)))return!0}}return!1}run(l,d,h){let{encoding:y,mark:w}=l;var x,A;return Be((x=!!y.x2,A=!!y.y2,`Line mark is for continuous lines and thus cannot be used with ${x&&A?"x2 and y2":x?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),h({...l,mark:b.isObject(w)?{...w,type:"rule"}:"rule"},d)}}function $f(s){let{parentEncoding:l,encoding:d={},layer:h}=s,y={};if(l){let w=new Set([...be(l),...be(d)]);for(let x of w){let A=d[x],C=l[x];if(_t(A)){let L={...C,...A};y[x]=L}else eu(A)?y[x]={...A,condition:{...C,...A.condition}}:A||A===null?y[x]=A:(h||cr(C)||Ze(C)||_t(C)||b.isArray(C))&&(y[x]=C)}}else y=d;return!y||ye(y)?void 0:y}function Rm(s){let{parentProjection:l,projection:d}=s;return l&&d&&Be((function(h){let{parentProjection:y,projection:w}=h;return`Layer's shared projection ${Xe(y)} is overridden by a child projection ${Xe(w)}.`})({parentProjection:l,projection:d})),d??l}function Nm(s){return"filter"in s}function Im(s){return"lookup"in s}function n1(s){return"pivot"in s}function Ey(s){return"density"in s}function Om(s){return"quantile"in s}function wy(s){return"regression"in s}function a1(s){return"loess"in s}function _y(s){return"sample"in s}function Dm(s){return"window"in s}function Mm(s){return"joinaggregate"in s}function ky(s){return"flatten"in s}function r1(s){return"calculate"in s}function Bf(s){return"bin"in s}function Lm(s){return"impute"in s}function Uf(s){return"timeUnit"in s}function Sy(s){return"aggregate"in s}function i1(s){return"stack"in s}function Fm(s){return"fold"in s}function Pm(s){return"extent"in s&&!("density"in s)}function zf(s,l){let{transform:d,...h}=s;return d?{...h,transform:d.map((y=>{if(Nm(y))return{filter:hu(y,l)};if(Bf(y)&&mo(y.bin))return{...y,bin:$m(y.bin)};if(Im(y)){let{selection:w,...x}=y.from;return w?{...y,from:{param:w,...x}}:y}return y}))}:s}function Gf(s,l){var h,y;let d=j(s);if(ze(d)&&mo(d.bin)&&(d.bin=$m(d.bin)),$i(d)&&((y=(h=d.scale)==null?void 0:h.domain)==null?void 0:y.selection)){let{selection:w,...x}=d.scale.domain;d.scale.domain={...x,...w?{param:w}:{}}}if(hf(d))if(b.isArray(d.condition))d.condition=d.condition.map((w=>{let{selection:x,param:A,test:C,...L}=w;return A?w:{...L,test:hu(w,l)}}));else{let{selection:w,param:x,test:A,...C}=Gf(d.condition,l);d.condition=x?d.condition:{...C,test:hu(d.condition,l)}}return d}function $m(s){let l=s.extent;if(l!=null&&l.selection){let{selection:d,...h}=l;return{...s,extent:{...h,param:d}}}return s}function hu(s,l){let d=h=>F(h,(y=>{let w={param:y,empty:l.emptySelections[y]??!0};return l.selectionPredicates[y]??=[],l.selectionPredicates[y].push(w),w}));return s.selection?d(s.selection):F(s.test||s.filter,(h=>h.selection?d(h.selection):h))}class Bm extends Ff{map(l,d){let h=d.selections??[];if(l.params&&!Bi(l)){let y=[];for(let w of l.params)_c(w)?h.push(w):y.push(w);l.params=y}return d.selections=h,super.map(l,d)}mapUnit(l,d){let h=d.selections;if(!h||!h.length)return l;let y=(d.path??[]).concat(l.name),w=[];for(let x of h)if(x.views&&x.views.length)for(let A of x.views)(b.isString(A)&&(A===l.name||y.includes(A))||b.isArray(A)&&A.map((C=>y.indexOf(C))).every(((C,L,G)=>C!==-1&&(L===0||C>G[L-1]))))&&w.push(x);else w.push(x);return w.length&&(l.params=w),l}}for(let s of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){let l=Bm.prototype[s];Bm.prototype[s]=function(d,h){return l.call(this,d,Um(d,h))}}function Um(s,l){return s.name?{...l,path:(l.path??[]).concat(s.name)}:l}function jf(s,l){l===void 0&&(l=vm(s.config));let d=(function(x){let C={config:arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}};return o1.map(zm.map(xy.map(x,C),C),C)})(s,l),{width:h,height:y}=s,w=(function(x,A,C){let{width:L,height:G}=A,H=Bi(x)||pu(x),X={};H?L=="container"&&G=="container"?(X.type="fit",X.contains="padding"):L=="container"?(X.type="fit-x",X.contains="padding"):G=="container"&&(X.type="fit-y",X.contains="padding"):(L=="container"&&(Be(Ta("width")),L=void 0),G=="container"&&(Be(Ta("height")),G=void 0));let J={type:"pad",...X,...C?Gm(C.autosize):{},...Gm(x.autosize)};if(J.type!=="fit"||H||(Be(ta),J.type="pad"),L=="container"&&J.type!="fit"&&J.type!="fit-x"&&Be(na("width")),G=="container"&&J.type!="fit"&&J.type!="fit-y"&&Be(na("height")),!Ie(J,{type:"pad"}))return J})(d,{width:h,height:y,autosize:s.autosize},l);return{...d,...w?{autosize:w}:{}}}let zm=new class extends Ff{constructor(){super(...arguments),at(this,"nonFacetUnitNormalizers",[Se,lm,py,new xm,new Cm])}map(s,l){if(Bi(s)){let d=Ui(s.encoding,tt),h=Ui(s.encoding,Kr),y=Ui(s.encoding,Fl);if(d||h||y)return this.mapFacetedUnit(s,l)}return super.map(s,l)}mapUnit(s,l){let{parentEncoding:d,parentProjection:h}=l,y=Gi(s.encoding,l.repeater),w={...s,...s.name?{name:[l.repeaterPrefix,s.name].filter((A=>A)).join("_")}:{},...y?{encoding:y}:{}};if(d||h)return this.mapUnitWithParentEncodingOrProjection(w,l);let x=this.mapLayerOrUnit.bind(this);for(let A of this.nonFacetUnitNormalizers)if(A.hasMatchingType(w,l.config))return A.run(w,l,x);return w}mapRepeat(s,l){return(function(d){return!b.isArray(d.repeat)&&d.repeat.layer})(s)?this.mapLayerRepeat(s,l):this.mapNonLayerRepeat(s,l)}mapLayerRepeat(s,l){let{repeat:d,spec:h,...y}=s,{row:w,column:x,layer:A}=d,{repeater:C={},repeaterPrefix:L=""}=l;return w||x?this.mapRepeat({...s,repeat:{...w?{row:w}:{},...x?{column:x}:{}},spec:{repeat:{layer:A},spec:h}},l):{...y,layer:A.map((G=>{let H={...C,layer:G},X=`${(h.name?`${h.name}_`:"")+L}child__layer_${$e(G)}`,J=this.mapLayerOrUnit(h,{...l,repeater:H,repeaterPrefix:X});return J.name=X,J}))}}mapNonLayerRepeat(s,l){let{repeat:d,spec:h,data:y,...w}=s;!b.isArray(d)&&s.columns&&(s=ee(s,["columns"]),Be(ur("repeat")));let x=[],{repeater:A={},repeaterPrefix:C=""}=l,L=!b.isArray(d)&&d.row||[A?A.row:null],G=!b.isArray(d)&&d.column||[A?A.column:null],H=b.isArray(d)&&d||[A?A.repeat:null];for(let J of H)for(let le of L)for(let te of G){let pe={repeat:J,row:le,column:te,layer:A.layer},ge=(h.name?`${h.name}_`:"")+C+"child__"+(b.isArray(d)?`${$e(J)}`:(d.row?`row_${$e(le)}`:"")+(d.column?`column_${$e(te)}`:"")),xe=this.map(h,{...l,repeater:pe,repeaterPrefix:ge});xe.name=ge,x.push(ee(xe,["data"]))}let X=b.isArray(d)?s.columns:d.column?d.column.length:1;return{data:h.data??y,align:"all",...w,columns:X,concat:x}}mapFacet(s,l){let{facet:d}=s;return Ql(d)&&s.columns&&(s=ee(s,["columns"]),Be(ur("facet"))),super.mapFacet(s,l)}mapUnitWithParentEncodingOrProjection(s,l){let{encoding:d,projection:h}=s,{parentEncoding:y,parentProjection:w,config:x}=l,A=Rm({parentProjection:w,projection:h}),C=$f({parentEncoding:y,encoding:Gi(d,l.repeater)});return this.mapUnit({...s,...A?{projection:A}:{},...C?{encoding:C}:{}},{config:x})}mapFacetedUnit(s,l){let{row:d,column:h,facet:y,...w}=s.encoding,{mark:x,width:A,projection:C,height:L,view:G,params:H,encoding:X,...J}=s,{facetMapping:le,layout:te}=this.getFacetMappingAndLayout({row:d,column:h,facet:y},l),pe=Gi(w,l.repeater);return this.mapFacet({...J,...te,facet:le,spec:{...A?{width:A}:{},...L?{height:L}:{},...G?{view:G}:{},...C?{projection:C}:{},mark:x,encoding:pe,...H?{params:H}:{}}},l)}getFacetMappingAndLayout(s,l){let{row:d,column:h,facet:y}=s;if(d||h){y&&Be(`Facet encoding dropped as ${(w=[...d?[tt]:[],...h?[Kr]:[]]).join(" and ")} ${w.length>1?"are":"is"} also specified.`);let x={},A={};for(let C of[tt,Kr]){let L=s[C];if(L){let{align:G,center:H,spacing:X,columns:J,...le}=L;x[C]=le;for(let te of["align","center","spacing"])L[te]!==void 0&&(A[te]??={},A[te][C]=L[te])}}return{facetMapping:x,layout:A}}{let{align:x,center:A,spacing:C,columns:L,...G}=y;return{facetMapping:ra(G,l.repeater),layout:{...x?{align:x}:{},...A?{center:A}:{},...C?{spacing:C}:{},...L?{columns:L}:{}}}}var w}mapLayer(s,l){let{parentEncoding:d,parentProjection:h,...y}=l,{encoding:w,projection:x,...A}=s,C={...y,parentEncoding:$f({parentEncoding:d,encoding:w,layer:!0}),parentProjection:Rm({parentProjection:h,projection:x})};return super.mapLayer({...A,...s.name?{name:[C.repeaterPrefix,s.name].filter((L=>L)).join("_")}:{}},C)}},xy=new class extends Ff{map(s,l){return l.emptySelections??={},l.selectionPredicates??={},s=zf(s,l),super.map(s,l)}mapLayerOrUnit(s,l){if((s=zf(s,l)).encoding){let d={};for(let[h,y]of ke(s.encoding))d[h]=Gf(y,l);s={...s,encoding:d}}return super.mapLayerOrUnit(s,l)}mapUnit(s,l){let{selection:d,...h}=s;return d?{...h,params:ke(d).map((y=>{let[w,x]=y,{init:A,bind:C,empty:L,...G}=x;G.type==="single"?(G.type="point",G.toggle=!1):G.type==="multi"&&(G.type="point"),l.emptySelections[w]=L!=="none";for(let H of Te(l.selectionPredicates[w]??{}))H.empty=L!=="none";return{name:w,value:A,select:G,bind:C}}))}:s}},o1=new Bm;function Gm(s){return b.isString(s)?{type:s}:s??{}}let jm=["background","padding"];function Hf(s,l){let d={};for(let h of jm)s&&s[h]!==void 0&&(d[h]=Gn(s[h]));return l&&(d.params=s.params),d}class ji{constructor(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.explicit=l,this.implicit=d}clone(){return new ji(j(this.explicit),j(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(l){return Ke(this.explicit[l],this.implicit[l])}getWithExplicit(l){return this.explicit[l]!==void 0?{explicit:!0,value:this.explicit[l]}:this.implicit[l]!==void 0?{explicit:!1,value:this.implicit[l]}:{explicit:!1,value:void 0}}setWithExplicit(l,d){let{value:h,explicit:y}=d;h!==void 0&&this.set(l,h,y)}set(l,d,h){return delete this[h?"implicit":"explicit"][l],this[h?"explicit":"implicit"][l]=d,this}copyKeyFromSplit(l,d){let{explicit:h,implicit:y}=d;h[l]!==void 0?this.set(l,h[l],!0):y[l]!==void 0&&this.set(l,y[l],!1)}copyKeyFromObject(l,d){d[l]!==void 0&&this.set(l,d[l],!0)}copyAll(l){for(let d of be(l.combine())){let h=l.getWithExplicit(d);this.setWithExplicit(d,h)}}}function Hi(s){return{explicit:!0,value:s}}function Fr(s){return{explicit:!1,value:s}}function Ay(s){return(l,d,h,y)=>{let w=s(l.value,d.value);return w>0?l:w<0?d:Rc(l,d,h,y)}}function Rc(s,l,d,h){return s.explicit&&l.explicit&&Be((function(y,w,x,A){return`Conflicting ${w.toString()} property "${y.toString()}" (${Xe(x)} and ${Xe(A)}). Using ${Xe(x)}.`})(d,h,s.value,l.value)),s}function qi(s,l,d,h){let y=arguments.length>4&&arguments[4]!==void 0?arguments[4]:Rc;return s===void 0||s.value===void 0?l:s.explicit&&!l.explicit?s:l.explicit&&!s.explicit?l:Ie(s.value,l.value)?s:y(s,l,d,h)}class Ty extends ji{constructor(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=arguments.length>2&&arguments[2]!==void 0&&arguments[2];super(l,d),this.explicit=l,this.implicit=d,this.parseNothing=h}clone(){let l=super.clone();return l.parseNothing=this.parseNothing,l}}function fs(s){return"url"in s}function mu(s){return"values"in s}function qf(s){return"name"in s&&!fs(s)&&!mu(s)&&!Eo(s)}function Eo(s){return s&&(Wf(s)||Vf(s)||Yf(s))}function Wf(s){return"sequence"in s}function Vf(s){return"sphere"in s}function Yf(s){return"graticule"in s}let nn=(function(s){return s[s.Raw=0]="Raw",s[s.Main=1]="Main",s[s.Row=2]="Row",s[s.Column=3]="Column",s[s.Lookup=4]="Lookup",s})({});function Hm(s){let{signals:l,hasLegend:d,index:h,...y}=s;return y.field=jt(y.field),y}function ps(s){let l=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:b.identity;if(b.isArray(s)){let h=s.map((y=>ps(y,l,d)));return l?`[${h.join(", ")}]`:h}return Gs(s)?d(l?js(s):(function(h){let y=Yd(h,!0);return h.utc?+new Date(Date.UTC(...y)):+new Date(...y)})(s)):l?d(Xe(s)):s}function Cy(s,l){for(let d of Te(s.component.selection??{})){let h=d.name,y=`${h}${ko}, ${d.resolve==="global"?"true":`{unit: ${Wa(s)}}`}`;for(let w of il)w.defined(d)&&(w.signals&&(l=w.signals(s,d,l)),w.modifyExpr&&(y=w.modifyExpr(s,d,y)));l.push({name:h+jy,on:[{events:{signal:d.name+ko},update:`modify(${b.stringValue(d.name+ms)}, ${y})`}]})}return Kf(l)}function Nc(s,l){if(s.component.selection&&be(s.component.selection).length){let d=b.stringValue(s.getName("cell"));l.unshift({name:"facet",value:{},on:[{events:b.parseSelector("pointermove","scope"),update:`isTuple(facet) ? facet : group(${d}).datum`}]})}return Kf(l)}function Ry(s,l){for(let d of Te(s.component.selection??{}))for(let h of il)h.defined(d)&&h.marks&&(l=h.marks(s,d,l));return l}function Kf(s){return s.map((l=>(l.on&&!l.on.length&&delete l.on,l)))}class qt{constructor(l,d){this.debugName=d,at(this,"_children",[]),at(this,"_parent",null),at(this,"_hash",void 0),l&&(this.parent=l)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(l){this._parent=l,l&&l.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(l,d){this._children.includes(l)?Be("Attempt to add the same child twice."):d!==void 0?this._children.splice(d,0,l):this._children.push(l)}removeChild(l){let d=this._children.indexOf(l);return this._children.splice(d,1),d}remove(){let l=this._parent.removeChild(this);for(let d of this._children)d._parent=this._parent,this._parent.addChild(d,l++)}insertAsParentOf(l){let d=l.parent;d.removeChild(this),this.parent=d,l.parent=this}swapWithParent(){let l=this._parent,d=l.parent;for(let y of this._children)y.parent=l;this._children=[],l.removeChild(this);let h=l.parent.removeChild(l);this._parent=d,d.addChild(this,h),l.parent=this}}class ia extends qt{clone(){let l=new this.constructor;return l.debugName=`clone_${this.debugName}`,l._source=this._source,l._name=`clone_${this._name}`,l.type=this.type,l.refCounts=this.refCounts,l.refCounts[l._name]=0,l}constructor(l,d,h,y){super(l,d),this.type=h,this.refCounts=y,at(this,"_source",void 0),at(this,"_name",void 0),this._source=this._name=d,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${Zt()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(l){this._source=l}}function qm(s){return s.as!==void 0}function Ny(s){return`${s}_end`}class Wi extends qt{clone(){return new Wi(null,j(this.timeUnits))}constructor(l,d){super(l),this.timeUnits=d}static makeFromEncoding(l,d){let h=d.reduceFieldDef(((y,w,x)=>{let{field:A,timeUnit:C}=w;if(C){let L;if(Mr(C)){if(cn(d)){let{mark:G,markDef:H,config:X}=d,J=Fi({fieldDef:w,markDef:H,config:X});(cc(G)||J)&&(L={timeUnit:jn(C),field:A})}}else L={as:je(w,{forAs:!0}),field:A,timeUnit:C};if(cn(d)){let{mark:G,markDef:H,config:X}=d,J=Fi({fieldDef:w,markDef:H,config:X});cc(G)&&un(x)&&J!==.5&&(L.rectBandPosition=J)}L&&(y[ne(L)]=L)}return y}),{});return ye(h)?null:new Wi(l,h)}static makeFromTransform(l,d){let{timeUnit:h,...y}={...d},w={...y,timeUnit:jn(h)};return new Wi(l,{[ne(w)]:w})}merge(l){this.timeUnits={...this.timeUnits};for(let d in l.timeUnits)this.timeUnits[d]||(this.timeUnits[d]=l.timeUnits[d]);for(let d of l.children)l.removeChild(d),d.parent=this;l.remove()}removeFormulas(l){let d={};for(let[h,y]of ke(this.timeUnits)){let w=qm(y)?y.as:`${y.field}_end`;l.has(w)||(d[h]=y)}this.timeUnits=d}producedFields(){return new Set(Te(this.timeUnits).map((l=>qm(l)?l.as:Ny(l.field))))}dependentFields(){return new Set(Te(this.timeUnits).map((l=>l.field)))}hash(){return`TimeUnit ${ne(this.timeUnits)}`}assemble(){let l=[];for(let d of Te(this.timeUnits)){let{rectBandPosition:h}=d,y=jn(d.timeUnit);if(qm(d)){let{field:w,as:x}=d,{unit:A,utc:C,...L}=y,G=[x,`${x}_end`];l.push({field:jt(w),type:"timeunit",...A?{units:oc(A)}:{},...C?{timezone:"utc"}:{},...L,as:G}),l.push(...oa(G,h,y))}else if(d){let{field:w}=d,x=w.replaceAll("\\.","."),A=Wm({timeUnit:y,field:x}),C=Ny(x);l.push({type:"formula",expr:A,as:C}),l.push(...oa([x,C],h,y))}}return l}}let Xf="offsetted_rect_start",$t="offsetted_rect_end";function Wm(s){let{timeUnit:l,field:d,reverse:h}=s,{unit:y,utc:w}=l,x=Lh(y),{part:A,step:C}=Xd(x,l.step);return`${w?"utcOffset":"timeOffset"}('${A}', datum['${d}'], ${h?-C:C})`}function oa(s,l,d){let[h,y]=s;if(l!==void 0&&l!==.5){let w=`datum['${h}']`,x=`datum['${y}']`;return[{type:"formula",expr:hs([Wm({timeUnit:d,field:h,reverse:!0}),w],l+.5),as:`${h}_${Xf}`},{type:"formula",expr:hs([w,x],l+.5),as:`${h}_${$t}`}]}return[]}function hs(s,l){let[d,h]=s;return`${1-l} * ${d} + ${l} * ${h}`}let Ic="_tuple_fields";class Vm{constructor(){at(this,"hasChannel",void 0),at(this,"hasField",void 0),at(this,"hasSelectionId",void 0),at(this,"timeUnit",void 0),at(this,"items",void 0);for(var l=arguments.length,d=new Array(l),h=0;h<l;h++)d[h]=arguments[h];this.items=d,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}let Vi={defined:()=>!0,parse:(s,l,d)=>{let h=l.name,y=l.project??=new Vm,w={},x={},A=new Set,C=(le,te)=>{let pe=te==="visual"?le.channel:le.field,ge=$e(`${h}_${pe}`);for(let xe=1;A.has(ge);xe++)ge=$e(`${h}_${pe}_${xe}`);return A.add(ge),{[te]:ge}},L=l.type,G=s.config.selection[L],H=d.value!==void 0?b.array(d.value):null,{fields:X,encodings:J}=b.isObject(d.select)?d.select:{};if(!X&&!J&&H){for(let le of H)if(b.isObject(le))for(let te of be(le))b_[te]?(J||(J=[])).push(te):L==="interval"?(Be('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),J=G.encodings):(X??=[]).push(te)}X||J||(J=G.encodings,"fields"in G&&(X=G.fields));for(let le of J??[]){let te=s.fieldDef(le);if(te){let pe=te.field;if(te.aggregate){Be(Di(le,te.aggregate));continue}if(!pe){Be(aa(le));continue}if(te.timeUnit&&!Mr(te.timeUnit)){pe=s.vgField(le);let ge={timeUnit:te.timeUnit,as:pe,field:te.field};x[ne(ge)]=ge}if(!w[pe]){let ge={field:pe,channel:le,type:L==="interval"&&Nr(le)&&Ha(s.getScaleComponent(le).get("type"))?"R":te.bin?"R-RE":"E",index:y.items.length};ge.signals={...C(ge,"data"),...C(ge,"visual")},y.items.push(w[pe]=ge),y.hasField[pe]=w[pe],y.hasSelectionId=y.hasSelectionId||pe===fr,Qo(le)?(ge.geoChannel=le,ge.channel=gh(le),y.hasChannel[ge.channel]=w[pe]):y.hasChannel[le]=w[pe]}}else Be(aa(le))}for(let le of X??[]){if(y.hasField[le])continue;let te={type:"E",field:le,index:y.items.length};te.signals={...C(te,"data")},y.items.push(te),y.hasField[le]=te,y.hasSelectionId=y.hasSelectionId||le===fr}H&&(l.init=H.map((le=>y.items.map((te=>b.isObject(le)?le[te.geoChannel||te.channel]!==void 0?le[te.geoChannel||te.channel]:le[te.field]:le))))),ye(x)||(y.timeUnit=new Wi(null,x))},signals:(s,l,d)=>{let h=l.name+Ic;return d.filter((y=>y.name===h)).length>0||l.project.hasSelectionId?d:d.concat({name:h,value:l.project.items.map(Hm)})}},Ra={defined:s=>s.type==="interval"&&s.resolve==="global"&&s.bind&&s.bind==="scales",parse:(s,l)=>{let d=l.scales=[];for(let h of l.project.items){let y=h.channel;if(!Nr(y))continue;let w=s.getScaleComponent(y),x=w?w.get("type"):void 0;w&&Ha(x)?(w.set("selectionExtent",{param:l.name,field:h.field},!0),d.push(h)):Be("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(s,l,d)=>{let h=l.scales.filter((x=>d.filter((A=>A.name===x.signals.data)).length===0));if(!s.parent||nl(s)||h.length===0)return d;let y=d.filter((x=>x.name===l.name))[0],w=y.update;if(w.indexOf(rg)>=0)y.update=`{${h.map((x=>`${b.stringValue(jt(x.field))}: ${x.signals.data}`)).join(", ")}}`;else{for(let x of h){let A=`${b.stringValue(jt(x.field))}: ${x.signals.data}`;w.includes(A)||(w=`${w.substring(0,w.length-1)}, ${A}}`)}y.update=w}return d.concat(h.map((x=>({name:x.signals.data}))))},signals:(s,l,d)=>{if(s.parent&&!nl(s))for(let h of l.scales){let y=d.filter((w=>w.name===h.signals.data))[0];y.push="outer",delete y.value,delete y.update}return d}};function qn(s,l){return`domain(${b.stringValue(s.scaleName(l))})`}function nl(s){return s.parent&&ws(s.parent)&&!s.parent.parent}let wo="_brush",Ym="_scale_trigger",gu="geo_interval_init_tick",Zf="_init",Km={defined:s=>s.type==="interval",parse:(s,l,d)=>{if(s.hasProjection){let h={...b.isObject(d.select)?d.select:{}};h.fields=[fr],h.encodings||(h.encodings=d.value?be(d.value):[$a,nt]),d.select={type:"interval",...h}}if(l.translate&&!Ra.defined(l)){let h=`!event.item || event.item.mark.name !== ${b.stringValue(l.name+wo)}`;for(let y of l.events){if(!y.between){Be(`${y} is not an ordered event stream for interval selections.`);continue}let w=b.array(y.between[0].filter??=[]);w.indexOf(h)<0&&w.push(h)}}},signals:(s,l,d)=>{let h=l.name,y=h+ko,w=Te(l.project.hasChannel).filter((A=>A.channel===Qt||A.channel===Bn)),x=l.init?l.init[0]:null;if(d.push(...w.reduce(((A,C)=>A.concat((function(L,G,H,X){let J=!L.hasProjection,le=H.channel,te=H.signals.visual,pe=b.stringValue(J?L.scaleName(le):L.projectionName()),ge=Re=>`scale(${pe}, ${Re})`,xe=L.getSizeSignalRef(le===Qt?"width":"height").signal,me=`${le}(unit)`,Ae=G.events.reduce(((Re,Pe)=>[...Re,{events:Pe.between[0],update:`[${me}, ${me}]`},{events:Pe,update:`[${te}[0], clamp(${me}, 0, ${xe})]`}]),[]);if(J){let Re=H.signals.data,Pe=Ra.defined(G),We=L.getScaleComponent(le),Je=We?We.get("type"):void 0,it=X?{init:ps(X,!0,ge)}:{value:[]};return Ae.push({events:{signal:G.name+Ym},update:Ha(Je)?`[${ge(`${Re}[0]`)}, ${ge(`${Re}[1]`)}]`:"[0, 0]"}),Pe?[{name:Re,on:[]}]:[{name:te,...it,on:Ae},{name:Re,...X?{init:ps(X)}:{},on:[{events:{signal:te},update:`${te}[0] === ${te}[1] ? null : invert(${pe}, ${te})`}]}]}{let Re=le===Qt?0:1,Pe=G.name+Zf;return[{name:te,...X?{init:`[${Pe}[0][${Re}], ${Pe}[1][${Re}]]`}:{value:[]},on:Ae}]}})(s,l,C,x&&x[C.index]))),[])),s.hasProjection){let A=b.stringValue(s.projectionName()),C=s.projectionName()+"_center",{x:L,y:G}=l.project.hasChannel,H=L&&L.signals.visual,X=G&&G.signals.visual,J=L?x&&x[L.index]:`${C}[0]`,le=G?x&&x[G.index]:`${C}[1]`,te=me=>s.getSizeSignalRef(me).signal,pe=`[[${H?H+"[0]":"0"}, ${X?X+"[0]":"0"}],[${H?H+"[1]":te("width")}, ${X?X+"[1]":te("height")}]]`;x&&(d.unshift({name:h+Zf,init:`[scale(${A}, [${L?J[0]:J}, ${G?le[0]:le}]), scale(${A}, [${L?J[1]:J}, ${G?le[1]:le}])]`}),!L||!G)&&(d.find((me=>me.name===C))||d.unshift({name:C,update:`invert(${A}, [${te("width")}/2, ${te("height")}/2])`}));let ge=`vlSelectionTuples(${`intersect(${pe}, {markname: ${b.stringValue(s.getName("marks"))}}, unit.mark)`}, ${`{unit: ${Wa(s)}}`})`,xe=w.map((me=>me.signals.visual));return d.concat({name:y,on:[{events:[...xe.length?[{signal:xe.join(" || ")}]:[],...x?[{signal:gu}]:[]],update:ge}]})}{if(!Ra.defined(l)){let L=h+Ym,G=w.map((H=>{let X=H.channel,{data:J,visual:le}=H.signals,te=b.stringValue(s.scaleName(X)),pe=Ha(s.getScaleComponent(X).get("type"))?"+":"";return`(!isArray(${J}) || (${pe}invert(${te}, ${le})[0] === ${pe}${J}[0] && ${pe}invert(${te}, ${le})[1] === ${pe}${J}[1]))`}));G.length&&d.push({name:L,value:{},on:[{events:w.map((H=>({scale:s.scaleName(H.channel)}))),update:G.join(" && ")+` ? ${L} : {}`}]})}let A=w.map((L=>L.signals.data)),C=`unit: ${Wa(s)}, fields: ${h+Ic}, values`;return d.concat({name:y,...x?{init:`{${C}: ${ps(x)}}`}:{},...A.length?{on:[{events:[{signal:A.join(" || ")}],update:`${A.join(" && ")} ? {${C}: [${A}]} : null`}]}:{}})}},topLevelSignals:(s,l,d)=>(cn(s)&&s.hasProjection&&l.init&&(d.filter((h=>h.name===gu)).length||d.unshift({name:gu,value:null,on:[{events:"timer{1}",update:`${gu} === null ? {} : ${gu}`}]})),d),marks:(s,l,d)=>{let h=l.name,{x:y,y:w}=l.project.hasChannel,x=y==null?void 0:y.signals.visual,A=w==null?void 0:w.signals.visual,C=`data(${b.stringValue(l.name+ms)})`;if(Ra.defined(l)||!y&&!w)return d;let L={x:y!==void 0?{signal:`${x}[0]`}:{value:0},y:w!==void 0?{signal:`${A}[0]`}:{value:0},x2:y!==void 0?{signal:`${x}[1]`}:{field:{group:"width"}},y2:w!==void 0?{signal:`${A}[1]`}:{field:{group:"height"}}};if(l.resolve==="global")for(let te of be(L))L[te]=[{test:`${C}.length && ${C}[0].unit === ${Wa(s)}`,...L[te]},{value:0}];let{fill:G,fillOpacity:H,cursor:X,...J}=l.mark,le=be(J).reduce(((te,pe)=>(te[pe]=[{test:[y!==void 0&&`${x}[0] !== ${x}[1]`,w!==void 0&&`${A}[0] !== ${A}[1]`].filter((ge=>ge)).join(" && "),value:J[pe]},{value:null}],te)),{});return[{name:`${h+wo}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:G},fillOpacity:{value:H}},update:L}},...d,{name:h+wo,type:"rect",clip:!0,encode:{enter:{...X?{cursor:{value:X}}:{},fill:{value:"transparent"}},update:{...L,...le}}}]}},al={defined:s=>s.type==="point",signals:(s,l,d)=>{let h=l.name,y=h+Ic,w=l.project,x="(item().isVoronoi ? datum.datum : datum)",A=Te(s.component.selection??{}).reduce(((H,X)=>X.type==="interval"?H.concat(X.name+wo):H),[]).map((H=>`indexof(item().mark.name, '${H}') < 0`)).join(" && "),C="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(A?` && ${A}`:""),L=`unit: ${Wa(s)}, `;l.project.hasSelectionId?L+=`${fr}: ${x}[${b.stringValue(fr)}]`:L+=`fields: ${y}, values: [${w.items.map((H=>{let X=s.fieldDef(H.channel);return X!=null&&X.bin?`[${x}[${b.stringValue(s.vgField(H.channel,{}))}], ${x}[${b.stringValue(s.vgField(H.channel,{binSuffix:"end"}))}]]`:`${x}[${b.stringValue(H.field)}]`})).join(", ")}]`;let G=l.events;return d.concat([{name:h+ko,on:G?[{events:G,update:`${C} ? {${L}} : null`,force:!0}]:[]}])}};function bu(s,l,d,h){let y=hf(l)&&l.condition,w=h(l);return y?{[d]:[...b.array(y).map((x=>{let A=h(x);if((function(C){return C.param})(x)){let{param:C,empty:L}=x;return{test:Eu(s,{param:C,empty:L}),...A}}return{test:Ki(s,x.test),...A}})),...w!==void 0?[w]:[]]}:w!==void 0?{[d]:w}:{}}function Jf(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"text",d=s.encoding[l];return bu(s,d,l,(h=>yu(h,s.config)))}function yu(s,l){let d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"datum";if(s){if(cr(s))return on(s.value);if(_t(s)){let{format:h,formatType:y}=Js(s);return Vh({fieldOrDatumDef:s,format:h,formatType:y,expr:d,config:l})}}}function Oc(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{encoding:d,markDef:h,config:y,stack:w}=s,x=d.tooltip;if(b.isArray(x))return{tooltip:Iy({tooltip:x},w,y,l)};{let A=l.reactiveGeom?"datum.datum":"datum";return bu(s,x,"tooltip",(C=>{let L=yu(C,y,A);if(L)return L;if(C===null)return;let G=Ht("tooltip",h,y);return G===!0&&(G={content:"encoding"}),b.isString(G)?{value:G}:b.isObject(G)?Ze(G)?G:G.content==="encoding"?Iy(d,w,y,l):{signal:A}:void 0}))}}function Dc(s,l,d){let{reactiveGeom:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y={...d,...d.tooltipFormat},w={},x=h?"datum.datum":"datum",A=[];function C(G,H){let X=Us(H),J=ma(G)?G:{...G,type:s[X].type},le=J.title||yf(J,y),te=b.array(le).join(", ").replaceAll(/"/g,'\\"'),pe;if(un(H)){let ge=H==="x"?"x2":"y2",xe=dr(s[ge]);if(zn(J.bin)&&xe){let me=je(J,{expr:x}),Ae=je(xe,{expr:x}),{format:Re,formatType:Pe}=Js(J);pe=yo(me,Ae,Re,Pe,y),w[ge]=!0}}if((un(H)||H===ar||H===mt)&&l&&l.fieldChannel===H&&l.offset==="normalize"){let{format:ge,formatType:xe}=Js(J);pe=Vh({fieldOrDatumDef:J,format:ge,formatType:xe,expr:x,config:y,normalizeStack:!0}).signal}pe??=yu(J,y,x).signal,A.push({channel:H,key:te,value:pe})}bc(s,((G,H)=>{ze(G)?C(G,H):mf(G)&&C(G.condition,H)}));let L={};for(let{channel:G,key:H,value:X}of A)w[G]||L[H]||(L[H]=X);return L}function Iy(s,l,d){let{reactiveGeom:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=Dc(s,l,d,{reactiveGeom:h}),w=ke(y).map((x=>{let[A,C]=x;return`"${A}": ${C}`}));return w.length>0?{signal:`{${w.join(", ")}}`}:void 0}function s1(s){let{markDef:l,config:d}=s,h=Ht("aria",l,d);return h===!1?{}:{...h?{aria:h}:{},...l1(s),...u1(s)}}function l1(s){let{mark:l,markDef:d,config:h}=s;if(h.aria===!1)return{};let y=Ht("ariaRoleDescription",d,h);return y!=null?{ariaRoleDescription:{value:y}}:l in Bd?{}:{ariaRoleDescription:{value:l}}}function u1(s){let{encoding:l,markDef:d,config:h,stack:y}=s,w=l.description;if(w)return bu(s,w,"description",(C=>yu(C,s.config)));let x=Ht("description",d,h);if(x!=null)return{description:on(x)};if(h.aria===!1)return{};let A=Dc(l,y,h);return ye(A)?void 0:{description:{signal:ke(A).map(((C,L)=>{let[G,H]=C;return`"${L>0?"; ":""}${G}: " + (${H})`})).join(" + ")}}}function Wn(s,l){let d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},{markDef:h,encoding:y,config:w}=l,{vgChannel:x}=d,{defaultRef:A,defaultValue:C}=d;A===void 0&&(C??=Ht(s,h,w,{vgChannel:x,ignoreVgConfig:!0}),C!==void 0&&(A=on(C)));let L=y[s];return bu(l,L,x??s,(G=>Wh({channel:s,channelDef:G,markDef:h,config:w,scaleName:l.scaleName(s),scale:l.getScaleComponent(s),stack:null,defaultRef:A})))}function Mc(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{filled:void 0},{markDef:d,encoding:h,config:y}=s,{type:w}=d,x=l.filled??Ht("filled",d,y),A=Z(["bar","point","circle","square","geoshape"],w)?"transparent":void 0,C=Ht(x===!0?"color":void 0,d,y,{vgChannel:"fill"})??y.mark[x===!0&&"color"]??A,L=Ht(x===!1?"color":void 0,d,y,{vgChannel:"stroke"})??y.mark[x===!1&&"color"],G=x?"fill":"stroke",H={...C?{fill:on(C)}:{},...L?{stroke:on(L)}:{}};return d.color&&(x?d.fill:d.stroke)&&Be(D0("property",{fill:"fill"in d,stroke:"stroke"in d})),{...H,...Wn("color",s,{vgChannel:G,defaultValue:x?C:L}),...Wn("fill",s,{defaultValue:h.fill?C:void 0}),...Wn("stroke",s,{defaultValue:h.stroke?L:void 0})}}function Oy(s){let{encoding:l,mark:d}=s,h=l.order;return!is(d)&&cr(h)?bu(s,h,"zindex",(y=>on(y.value))):{}}function vu(s){let{channel:l,markDef:d,encoding:h={},model:y,bandPosition:w}=s,x=`${l}Offset`,A=d[x],C=h[x];if((x==="xOffset"||x==="yOffset")&&C)return{offsetType:"encoding",offset:Wh({channel:x,channelDef:C,markDef:d,config:y==null?void 0:y.config,scaleName:y.scaleName(x),scale:y.getScaleComponent(x),stack:null,defaultRef:on(A),bandPosition:w})};let L=d[x];return L?{offsetType:"visual",offset:L}:{}}function Vn(s,l,d){let{defaultPos:h,vgChannel:y}=d,{encoding:w,markDef:x,config:A,stack:C}=l,L=w[s],G=w[Ci(s)],H=l.scaleName(s),X=l.getScaleComponent(s),{offset:J,offsetType:le}=vu({channel:s,markDef:x,encoding:w,model:l,bandPosition:.5}),te=Qf({model:l,defaultPos:h,channel:s,scaleName:H,scale:X}),pe=!L&&un(s)&&(w.latitude||w.longitude)?{field:l.getName(s)}:(function(ge){let{channel:xe,channelDef:me,scaleName:Ae,stack:Re,offset:Pe,markDef:We}=ge;if(_t(me)&&Re&&xe===Re.fieldChannel){if(ze(me)){let Je=me.bandPosition;if(Je!==void 0||We.type!=="text"||xe!=="radius"&&xe!=="theta"||(Je=.5),Je!==void 0)return uf({scaleName:Ae,fieldOrDatumDef:me,startSuffix:"start",bandPosition:Je,offset:Pe})}return Ks(me,Ae,{suffix:"end"},{offset:Pe})}return Hh(ge)})({channel:s,channelDef:L,channel2Def:G,markDef:x,config:A,scaleName:H,scale:X,stack:C,offset:J,defaultRef:te,bandPosition:le==="encoding"?0:void 0});return pe?{[y||s]:pe}:void 0}function Qf(s){let{model:l,defaultPos:d,channel:h,scaleName:y,scale:w}=s,{markDef:x,config:A}=l;return()=>{let C=Us(h),L=sr(h),G=Ht(h,x,A,{vgChannel:L});if(G!==void 0)return Jl(h,G);switch(d){case"zeroOrMin":case"zeroOrMax":if(y){let H=w.get("type");if(!Z([Gt.LOG,Gt.TIME,Gt.UTC],H)){if(w.domainDefinitelyIncludesZero())return{scale:y,value:0}}}if(d==="zeroOrMin")return C==="y"?{field:{group:"height"}}:{value:0};switch(C){case"radius":return{signal:`min(${l.width.signal},${l.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...l[xa(h)],mult:.5}}}}let Dy={left:"x",center:"xc",right:"x2"},My={top:"y",middle:"yc",bottom:"y2"};function Xm(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"middle";if(s==="radius"||s==="theta")return sr(s);let y=s==="x"?"align":"baseline",w=Ht(y,l,d),x;return Ze(w)?(Be((function(A){return`The ${A} for range marks cannot be an expression`})(y)),x=void 0):x=w,s==="x"?Dy[x||(h==="top"?"left":"center")]:My[x||h]}function ep(s,l,d){let{defaultPos:h,defaultPos2:y,range:w}=d;return w?_o(s,l,{defaultPos:h,defaultPos2:y}):Vn(s,l,{defaultPos:h})}function _o(s,l,d){let{defaultPos:h,defaultPos2:y}=d,{markDef:w,config:x}=l,A=Ci(s),C=xa(s),L=(function(G,H,X){let{encoding:J,mark:le,markDef:te,stack:pe,config:ge}=G,xe=Us(X),me=xa(X),Ae=sr(X),Re=J[xe],Pe=G.scaleName(xe),We=G.getScaleComponent(xe),{offset:Je}=vu(X in J||X in te?{channel:X,markDef:te,encoding:J,model:G}:{channel:xe,markDef:te,encoding:J,model:G});if(!Re&&(X==="x2"||X==="y2")&&(J.latitude||J.longitude)){let Qe=xa(X),lt=G.markDef[Qe];return lt!=null?{[Qe]:{value:lt}}:{[Ae]:{field:G.getName(X)}}}let it=(function(Qe){let{channel:lt,channelDef:kt,channel2Def:Fn,markDef:dn,config:sn,scaleName:Ut,scale:Dt,stack:En,offset:Nn,defaultRef:fn}=Qe;return _t(kt)&&En&&lt.charAt(0)===En.fieldChannel.charAt(0)?Ks(kt,Ut,{suffix:"start"},{offset:Nn}):Hh({channel:lt,channelDef:Fn,scaleName:Ut,scale:Dt,stack:En,markDef:dn,config:sn,offset:Nn,defaultRef:fn})})({channel:X,channelDef:Re,channel2Def:J[X],markDef:te,config:ge,scaleName:Pe,scale:We,stack:pe,offset:Je,defaultRef:void 0});return it!==void 0?{[Ae]:it}:rl(X,te)||rl(X,{[X]:zd(X,te,ge.style),[me]:zd(me,te,ge.style)})||rl(X,ge[le])||rl(X,ge.mark)||{[Ae]:Qf({model:G,defaultPos:H,channel:X,scaleName:Pe,scale:We})()}})(l,y,A);return{...Vn(s,l,{defaultPos:h,vgChannel:L[C]?Xm(s,w,x):sr(s)}),...L}}function rl(s,l){let d=xa(s),h=sr(s);if(l[h]!==void 0)return{[h]:Jl(s,l[h])};if(l[s]!==void 0)return{[h]:Jl(s,l[s])};if(l[d]){let y=l[d];if(!Ys(y))return{[d]:Jl(s,y)};Be((function(w){return`Position range does not support relative band size for ${w}.`})(d))}}function li(s,l){let{config:d,encoding:h,markDef:y}=s,w=y.type,x=Ci(l),A=xa(l),C=h[l],L=h[x],G=s.getScaleComponent(l),H=G?G.get("type"):void 0,X=y.orient,J=h[A]??h.size??Ht("size",y,d,{vgChannel:A}),le=bh(l),te=w==="bar"&&(l==="x"?X==="vertical":X==="horizontal");return!ze(C)||!(Vt(C.bin)||zn(C.bin)||C.timeUnit&&!L)||J&&!Ys(J)||h[le]||Hn(H)?(_t(C)&&Hn(H)||te)&&!L?(function(pe,ge,xe){var ga,ln;let{markDef:me,encoding:Ae,config:Re,stack:Pe}=xe,We=me.orient,Je=xe.scaleName(ge),it=xe.getScaleComponent(ge),Qe=xa(ge),lt=Ci(ge),kt=bh(ge),Fn=xe.scaleName(kt),dn=xe.getScaleComponent(Ul(ge)),sn=We==="horizontal"&&ge==="y"||We==="vertical"&&ge==="x",Ut;(Ae.size||me.size)&&(sn?Ut=Wn("size",xe,{vgChannel:Qe,defaultRef:on(me.size)}):Be((function(At){return`Cannot apply size to non-oriented mark "${At}".`})(me.type)));let Dt=!!Ut,En=Qh({channel:ge,fieldDef:pe,markDef:me,config:Re,scaleType:(ga=it||dn)==null?void 0:ga.get("type"),useVlSizeChannel:sn});Ut=Ut||{[Qe]:Ly(Qe,Fn||Je,dn||it,Re,En,!!pe,me.type)};let Nn=((ln=it||dn)==null?void 0:ln.get("type"))==="band"&&Ys(En)&&!Dt?"top":"middle",fn=Xm(ge,me,Re,Nn),Oa=fn==="xc"||fn==="yc",{offset:Da,offsetType:Br}=vu({channel:ge,markDef:me,encoding:Ae,model:xe,bandPosition:Oa?.5:0}),Xn=Hh({channel:ge,channelDef:pe,markDef:me,config:Re,scaleName:Je,scale:it,stack:Pe,offset:Da,defaultRef:Qf({model:xe,defaultPos:"mid",channel:ge,scaleName:Je,scale:it}),bandPosition:Oa?Br==="encoding"?0:.5:Ze(En)?{signal:`(1-${En})/2`}:Ys(En)?(1-En.band)/2:0});if(Qe)return{[fn]:Xn,...Ut};{let At=sr(lt),wn=Ut[Qe],mi=Da?{...wn,offset:Da}:wn;return{[fn]:Xn,[At]:b.isArray(Xn)?[Xn[0],{...Xn[1],offset:mi}]:{...Xn,offset:mi}}}})(C,l,s):_o(l,s,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):(function(pe){var At;let{fieldDef:ge,fieldDef2:xe,channel:me,model:Ae}=pe,{config:Re,markDef:Pe,encoding:We}=Ae,Je=Ae.getScaleComponent(me),it=Ae.scaleName(me),Qe=Je?Je.get("type"):void 0,lt=Je.get("reverse"),kt=Qh({channel:me,fieldDef:ge,markDef:Pe,config:Re,scaleType:Qe}),Fn=(At=Ae.component.axes[me])==null?void 0:At[0],dn=(Fn==null?void 0:Fn.get("translate"))??.5,sn=un(me)?Ht("binSpacing",Pe,Re)??0:0,Ut=Ci(me),Dt=sr(me),En=sr(Ut),Nn=Ga("minBandSize",Pe,Re),{offset:fn}=vu({channel:me,markDef:Pe,encoding:We,model:Ae,bandPosition:0}),{offset:Oa}=vu({channel:Ut,markDef:Pe,encoding:We,model:Ae,bandPosition:0}),Da=(function(wn){let{scaleName:mi,fieldDef:gi}=wn,xs=je(gi,{expr:"datum"});return`abs(scale("${mi}", ${je(gi,{expr:"datum",suffix:"end"})}) - scale("${mi}", ${xs}))`})({fieldDef:ge,scaleName:it}),Br=Zm(me,sn,lt,dn,fn,Nn,Da),Xn=Zm(Ut,sn,lt,dn,Oa??fn,Nn,Da),ga=Ze(kt)?{signal:`(1-${kt.signal})/2`}:Ys(kt)?(1-kt.band)/2:.5,ln=Fi({fieldDef:ge,fieldDef2:xe,markDef:Pe,config:Re});if(Vt(ge.bin)||ge.timeUnit){let wn=ge.timeUnit&&ln!==.5;return{[En]:Jm({fieldDef:ge,scaleName:it,bandPosition:ga,offset:Xn,useRectOffsetField:wn}),[Dt]:Jm({fieldDef:ge,scaleName:it,bandPosition:Ze(ga)?{signal:`1-${ga.signal}`}:1-ga,offset:Br,useRectOffsetField:wn})}}if(zn(ge.bin)){let wn=Ks(ge,it,{},{offset:Xn});if(ze(xe))return{[En]:wn,[Dt]:Ks(xe,it,{},{offset:Br})};if(mo(ge.bin)&&ge.bin.step)return{[En]:wn,[Dt]:{signal:`scale("${it}", ${je(ge,{expr:"datum"})} + ${ge.bin.step})`,offset:Br}}}return void Be(Vd(Ut))})({fieldDef:C,fieldDef2:L,channel:l,model:s})}function Ly(s,l,d,h,y,w,x){if(Ys(y)){if(!d)return{mult:y.band,field:{group:s}};{let A=d.get("type");if(A==="band"){let C=`bandwidth('${l}')`;y.band!==1&&(C=`${y.band} * ${C}`);let L=Ga("minBandSize",{type:x},h);return{signal:L?`max(${pa(L)}, ${C})`:C}}y.band!==1&&(Be((function(C){return`Cannot use the relative band size with ${C} scale.`})(A)),y=void 0)}}else{if(Ze(y))return y;if(y)return{value:y}}if(d){let A=d.get("range");if(go(A)&&b.isNumber(A.step))return{value:A.step-2}}if(!w){let{bandPaddingInner:A,barBandPaddingInner:C,rectBandPaddingInner:L}=h.scale,G=Ke(A,x==="bar"?C:L);if(Ze(G))return{signal:`(1 - (${G.signal})) * ${s}`};if(b.isNumber(G))return{signal:`${1-G} * ${s}`}}return{value:fu(h.view,s)-2}}function Zm(s,l,d,h,y,w,x){if(Fd(s))return 0;let A=s==="x"||s==="y2",C=A?-l/2:l/2;if(Ze(d)||Ze(y)||Ze(h)||w){let L=pa(d),G=pa(y),H=pa(h),X=pa(w),J=w?`(${x} < ${X} ? ${A?"":"-"}0.5 * (${X} - (${x})) : ${C})`:C;return{signal:(H?`${H} + `:"")+(L?`(${L} ? -1 : 1) * `:"")+(G?`(${G} + ${J})`:J)}}return y=y||0,h+(d?-y-C:+y+C)}function Jm(s){let{fieldDef:l,scaleName:d,bandPosition:h,offset:y,useRectOffsetField:w}=s;return uf({scaleName:d,fieldOrDatumDef:l,bandPosition:h,offset:y,...w?{startSuffix:Xf,endSuffix:$t}:{}})}let c1=new Set(["aria","width","height"]);function Na(s,l){let{fill:d,stroke:h}=l.color==="include"?Mc(s):{};return{...d1(s.markDef,l),...tp(s,"fill",d),...tp(s,"stroke",h),...Wn("opacity",s),...Wn("fillOpacity",s),...Wn("strokeOpacity",s),...Wn("strokeWidth",s),...Wn("strokeDash",s),...Oy(s),...Oc(s),...Jf(s,"href"),...s1(s)}}function tp(s,l,d){let{config:h,mark:y,markDef:w}=s;if(Ht("invalid",w,h)==="hide"&&d&&!is(y)){let x=(function(A,C){let{invalid:L=!1,channels:G}=C,H=G.reduce(((J,le)=>{let te=A.getScaleComponent(le);if(te){let pe=te.get("type"),ge=A.vgField(le,{expr:"datum"});ge&&Ha(pe)&&(J[ge]=!0)}return J}),{}),X=be(H);if(X.length>0){let J=L?"||":"&&";return X.map((le=>qh(le,L))).join(` ${J} `)}})(s,{invalid:!0,channels:Gl});if(x)return{[l]:[{test:x,value:null},...b.array(d)]}}return d?{[l]:d}:{}}function d1(s,l){return Hl.reduce(((d,h)=>(c1.has(h)||s[h]===void 0||l[h]==="ignore"||(d[h]=on(s[h])),d)),{})}function Lc(s){let{config:l,markDef:d}=s;if(Ht("invalid",d,l)){let h=(function(y,w){let{invalid:x=!1,channels:A}=w,C=A.reduce(((G,H)=>{var J;let X=y.getScaleComponent(H);if(X){let le=X.get("type"),te=y.vgField(H,{expr:"datum",binSuffix:(J=y.stack)!=null&&J.impute?"mid":void 0});te&&Ha(le)&&(G[te]=!0)}return G}),{}),L=be(C);if(L.length>0){let G=x?"||":"&&";return L.map((H=>qh(H,x))).join(` ${G} `)}})(s,{channels:Qr});if(h)return{defined:{signal:h}}}return{}}function Fy(s,l){if(l!==void 0)return{[s]:on(l)}}let Fc="voronoi",Py={defined:s=>s.type==="point"&&s.nearest,parse:(s,l)=>{if(l.events)for(let d of l.events)d.markname=s.getName(Fc)},marks:(s,l,d)=>{let{x:h,y}=l.project.hasChannel,w=s.mark;if(is(w))return Be(`The "nearest" transform is not supported for ${w} marks.`),d;let x={name:s.getName(Fc),type:"path",interactive:!0,from:{data:s.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Oc(s,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:h||!y?"datum.datum.x || 0":"0"},y:{expr:y||!h?"datum.datum.y || 0":"0"},size:[s.getSizeSignalRef("width"),s.getSizeSignalRef("height")]}]},A=0,C=!1;return d.forEach(((L,G)=>{let H=L.name??"";H===s.component.mark[0].name?A=G:H.indexOf(Fc)>=0&&(C=!0)})),C||d.splice(A+1,0,x),d}},np={defined:s=>s.type==="point"&&s.resolve==="global"&&s.bind&&s.bind!=="scales"&&!Nf(s.bind),parse:(s,l,d)=>ui(l,d),topLevelSignals:(s,l,d)=>{let h=l.name,y=l.project,w=l.bind,x=l.init&&l.init[0],A=Py.defined(l)?"(item().isVoronoi ? datum.datum : datum)":"datum";return y.items.forEach(((C,L)=>{let G=$e(`${h}_${C.field}`);d.filter((H=>H.name===G)).length||d.unshift({name:G,...x?{init:ps(x[L])}:{value:null},on:l.events?[{events:l.events,update:`datum && item().mark.marktype !== 'group' ? ${A}[${b.stringValue(C.field)}] : null`}]:[],bind:w[C.field]??w[C.channel]??w})})),d},signals:(s,l,d)=>{let h=l.name,y=l.project,w=d.filter((L=>L.name===h+ko))[0],x=h+Ic,A=y.items.map((L=>$e(`${h}_${L.field}`))),C=A.map((L=>`${L} !== null`)).join(" && ");return A.length&&(w.update=`${C} ? {fields: ${x}, values: [${A.join(", ")}]} : null`),delete w.value,delete w.on,d}},Pc="_toggle",$y={defined:s=>s.type==="point"&&!!s.toggle,signals:(s,l,d)=>d.concat({name:l.name+Pc,value:!1,on:[{events:l.events,update:l.toggle}]}),modifyExpr:(s,l)=>{let d=l.name+ko,h=l.name+Pc;return`${h} ? null : ${d}, `+(l.resolve==="global"?`${h} ? null : true, `:`${h} ? null : {unit: ${Wa(s)}}, `)+`${h} ? ${d} : null`}},By={defined:s=>s.clear!==void 0&&s.clear!==!1,parse:(s,l)=>{l.clear&&(l.clear=b.isString(l.clear)?b.parseSelector(l.clear,"view"):l.clear)},topLevelSignals:(s,l,d)=>{if(np.defined(l))for(let h of l.project.items){let y=d.findIndex((w=>w.name===$e(`${l.name}_${h.field}`)));y!==-1&&d[y].on.push({events:l.clear,update:"null"})}return d},signals:(s,l,d)=>{function h(y,w){y!==-1&&d[y].on&&d[y].on.push({events:l.clear,update:w})}if(l.type==="interval")for(let y of l.project.items){let w=d.findIndex((x=>x.name===y.signals.visual));h(w,"[0, 0]"),w===-1&&h(d.findIndex((x=>x.name===y.signals.data)),"null")}else{let y=d.findIndex((w=>w.name===l.name+ko));h(y,"null"),$y.defined(l)&&(y=d.findIndex((w=>w.name===l.name+Pc)),h(y,"false"))}return d}},Uy={defined:s=>{let l=s.resolve==="global"&&s.bind&&Nf(s.bind),d=s.project.items.length===1&&s.project.items[0].field!==fr;return l&&!d&&Be("Legend bindings are only supported for selections over an individual field or encoding channel."),l&&d},parse:(s,l,d)=>{let h=j(d);if(h.select=b.isString(h.select)?{type:h.select,toggle:l.toggle}:{...h.select,toggle:l.toggle},ui(l,h),b.isObject(d.select)&&(d.select.on||d.select.clear)){let x='event.item && indexof(event.item.mark.role, "legend") < 0';for(let A of l.events)A.filter=b.array(A.filter??[]),A.filter.includes(x)||A.filter.push(x)}let y=If(l.bind)?l.bind.legend:"click",w=b.isString(y)?b.parseSelector(y,"view"):b.array(y);l.bind={legend:{merge:w}}},topLevelSignals:(s,l,d)=>{let h=l.name,y=If(l.bind)&&l.bind.legend,w=x=>A=>{let C=j(A);return C.markname=x,C};for(let x of l.project.items){if(!x.hasLegend)continue;let A=`${$e(x.field)}_legend`,C=`${h}_${A}`;if(d.filter((L=>L.name===C)).length===0){let L=y.merge.map(w(`${A}_symbols`)).concat(y.merge.map(w(`${A}_labels`))).concat(y.merge.map(w(`${A}_entries`)));d.unshift({name:C,...l.init?{}:{value:null},on:[{events:L,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:y.merge,update:`!event.item || !datum ? null : ${C}`,force:!0}]})}}return d},signals:(s,l,d)=>{let h=l.name,y=l.project,w=d.find((H=>H.name===h+ko)),x=h+Ic,A=y.items.filter((H=>H.hasLegend)).map((H=>$e(`${h}_${$e(H.field)}_legend`))),C=`${A.map((H=>`${H} !== null`)).join(" && ")} ? {fields: ${x}, values: [${A.join(", ")}]} : null`;l.events&&A.length>0?w.on.push({events:A.map((H=>({signal:H}))),update:C}):A.length>0&&(w.update=C,delete w.value,delete w.on);let L=d.find((H=>H.name===h+Pc)),G=If(l.bind)&&l.bind.legend;return L&&(l.events?L.on.push({...L.on[0],events:G}):L.on[0].events=G),d}},Qm="_translate_anchor",zy="_translate_delta",Gy={defined:s=>s.type==="interval"&&s.translate,signals:(s,l,d)=>{let h=l.name,y=Ra.defined(l),w=h+Qm,{x,y:A}=l.project.hasChannel,C=b.parseSelector(l.translate,"scope");return y||(C=C.map((L=>(L.between[0].markname=h+wo,L)))),d.push({name:w,value:{},on:[{events:C.map((L=>L.between[0])),update:"{x: x(unit), y: y(unit)"+(x!==void 0?`, extent_x: ${y?qn(s,Qt):`slice(${x.signals.visual})`}`:"")+(A!==void 0?`, extent_y: ${y?qn(s,Bn):`slice(${A.signals.visual})`}`:"")+"}"}]},{name:h+zy,value:{},on:[{events:C,update:`{x: ${w}.x - x(unit), y: ${w}.y - y(unit)}`}]}),x!==void 0&&eg(s,l,x,"width",d),A!==void 0&&eg(s,l,A,"height",d),d}};function eg(s,l,d,h,y){let w=l.name,x=w+Qm,A=w+zy,C=d.channel,L=Ra.defined(l),G=y.filter((ge=>ge.name===d.signals[L?"data":"visual"]))[0],H=s.getSizeSignalRef(h).signal,X=s.getScaleComponent(C),J=X&&X.get("type"),le=X&&X.get("reverse"),te=`${x}.extent_${C}`,pe=`${L&&X?J==="log"?"panLog":J==="symlog"?"panSymlog":J==="pow"?"panPow":"panLinear":"panLinear"}(${te}, ${`${L?C===Qt?le?"":"-":le?"-":"":""}${A}.${C} / ${L?`${H}`:`span(${te})`}`}${L?J==="pow"?`, ${X.get("exponent")??1}`:J==="symlog"?`, ${X.get("constant")??1}`:"":""})`;G.on.push({events:{signal:A},update:L?pe:`clampRange(${pe}, 0, ${H})`})}let tg="_zoom_anchor",ng="_zoom_delta",ag={defined:s=>s.type==="interval"&&s.zoom,signals:(s,l,d)=>{let h=l.name,y=Ra.defined(l),w=h+ng,{x,y:A}=l.project.hasChannel,C=b.stringValue(s.scaleName(Qt)),L=b.stringValue(s.scaleName(Bn)),G=b.parseSelector(l.zoom,"scope");return y||(G=G.map((H=>(H.markname=h+wo,H)))),d.push({name:h+tg,on:[{events:G,update:y?"{"+[C?`x: invert(${C}, x(unit))`:"",L?`y: invert(${L}, y(unit))`:""].filter((H=>H)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:w,on:[{events:G,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),x!==void 0&&$c(s,l,x,"width",d),A!==void 0&&$c(s,l,A,"height",d),d}};function $c(s,l,d,h,y){let w=l.name,x=d.channel,A=Ra.defined(l),C=y.filter((te=>te.name===d.signals[A?"data":"visual"]))[0],L=s.getSizeSignalRef(h).signal,G=s.getScaleComponent(x),H=G&&G.get("type"),X=A?qn(s,x):C.name,J=w+ng,le=`${A&&G?H==="log"?"zoomLog":H==="symlog"?"zoomSymlog":H==="pow"?"zoomPow":"zoomLinear":"zoomLinear"}(${X}, ${`${w}${tg}.${x}`}, ${J}${A?H==="pow"?`, ${G.get("exponent")??1}`:H==="symlog"?`, ${G.get("constant")??1}`:"":""})`;C.on.push({events:{signal:J},update:A?le:`clampRange(${le}, 0, ${L})`})}let ms="_store",ko="_tuple",jy="_modify",rg="vlSelectionResolve",il=[al,Km,Vi,$y,np,Ra,Uy,By,Gy,ag,Py];function Wa(s){let{escape:l}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{escape:!0},d=l?b.stringValue(s.name):s.name,h=(function(y){let w=y.parent;for(;w&&!Ya(w);)w=w.parent;return w})(s);if(h){let{facet:y}=h;for(let w of Ua)y[w]&&(d+=` + '__facet_${w}_' + (facet[${b.stringValue(h.vgField(w))}])`)}return d}function ig(s){return Te(s.component.selection??{}).reduce(((l,d)=>l||d.project.hasSelectionId),!1)}function ui(s,l){!b.isString(l.select)&&l.select.on||delete s.events,!b.isString(l.select)&&l.select.clear||delete s.clear,!b.isString(l.select)&&l.select.toggle||delete s.toggle}function Yi(s){let l=[];return s.type==="Identifier"?[s.name]:s.type==="Literal"?[s.value]:(s.type==="MemberExpression"&&(l.push(...Yi(s.object)),l.push(...Yi(s.property))),l)}function ap(s){return s.object.type==="MemberExpression"?ap(s.object):s.object.name==="datum"}function rp(s){let l=b.parseExpression(s),d=new Set;return l.visit((h=>{h.type==="MemberExpression"&&ap(h)&&d.add(Yi(h).slice(1).join("."))})),d}class ci extends qt{clone(){return new ci(null,this.model,j(this.filter))}constructor(l,d,h){super(l),this.model=d,this.filter=h,at(this,"expr",void 0),at(this,"_dependentFields",void 0),this.expr=Ki(this.model,this.filter,this),this._dependentFields=rp(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Eu(s,l,d){let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"datum",y=b.isString(l)?l:l.param,w=$e(y),x=b.stringValue(w+ms),A;try{A=s.getSelectionComponent(w,y)}catch{return`!!${w}`}if(A.project.timeUnit){let G=d??s.component.data.raw,H=A.project.timeUnit.clone();G.parent?H.insertAsParentOf(G):G.parent=H}let C=`${A.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${x}, ${h}${A.resolve==="global"?")":`, ${b.stringValue(A.resolve)})`}`,L=`length(data(${x}))`;return l.empty===!1?`${L} && ${C}`:`!${L} || ${C}`}function So(s,l,d){let h=$e(l),y=d.encoding,w,x=d.field;try{w=s.getSelectionComponent(h,l)}catch{return h}if(y||x){if(y&&!x){let A=w.project.items.filter((C=>C.channel===y));!A.length||A.length>1?(x=w.project.items[0].field,Be((A.length?"Multiple ":"No ")+`matching ${b.stringValue(y)} encoding found for selection ${b.stringValue(d.param)}. Using "field": ${b.stringValue(x)}.`)):x=A[0].field}}else x=w.project.items[0].field,w.project.items.length>1&&Be(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${b.stringValue(x)}.`);return`${w.name}[${b.stringValue(jt(x))}]`}function Ki(s,l,d){return Le(l,(h=>b.isString(h)?h:(function(y){return y==null?void 0:y.param})(h)?Eu(s,h,d):ef(h)))}function gs(s,l,d,h){s.encode??={},s.encode[l]??={},s.encode[l].update??={},s.encode[l].update[d]=h}function Xi(s,l,d){var H,X;let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{header:!1},{disable:y,orient:w,scale:x,labelExpr:A,title:C,zindex:L,...G}=s.combine();if(!y){for(let J in G){let le=Ef[J],te=G[J];if(le&&le!==l&&le!=="both")delete G[J];else if(su(te)){let{condition:pe,...ge}=te,xe=b.array(pe),me=ls[J];if(me){let{vgProp:Ae,part:Re}=me;gs(G,Re,Ae,[...xe.map((Pe=>{let{test:We,...Je}=Pe;return{test:Ki(null,We),...Je}})),ge]),delete G[J]}else if(me===null){let Ae={signal:xe.map((Re=>{let{test:Pe,...We}=Re;return`${Ki(null,Pe)} ? ${ns(We)} : `})).join("")+ns(ge)};G[J]=Ae}}else if(Ze(te)){let pe=ls[J];if(pe){let{vgProp:ge,part:xe}=pe;gs(G,xe,ge,te),delete G[J]}}Z(["labelAlign","labelBaseline"],J)&&G[J]===null&&delete G[J]}if(l==="grid"){if(!G.grid)return;if(G.encode){let{grid:J}=G.encode;G.encode={...J?{grid:J}:{}},ye(G.encode)&&delete G.encode}return{scale:x,orient:w,...G,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:Ke(L,0)}}{if(!h.header&&s.mainExtracted)return;if(A!==void 0){let le=A;(X=(H=G.encode)==null?void 0:H.labels)!=null&&X.update&&Ze(G.encode.labels.update.text)&&(le=St(A,"datum.label",G.encode.labels.update.text.signal)),gs(G,"labels","text",{signal:le})}if(G.labelAlign===null&&delete G.labelAlign,G.encode){for(let le of us)s.hasAxisPart(le)||delete G.encode[le];ye(G.encode)&&delete G.encode}let J=(function(le,te){if(le)return b.isArray(le)&&!fa(le)?le.map((pe=>yf(pe,te))).join(", "):le})(C,d);return{scale:x,orient:w,grid:!1,...J?{title:J}:{},...G,...d.aria===!1?{aria:!1}:{},zindex:Ke(L,0)}}}}function wu(s){let{axes:l}=s.component,d=[];for(let h of Qr)if(l[h]){for(let y of l[h])if(!y.get("disable")&&!y.get("gridScale")){let w=h==="x"?"height":"width",x=s.getSizeSignalRef(w).signal;w!==x&&d.push({name:w,update:x})}}return d}function di(s,l,d,h){return Object.assign.apply(null,[{},...s.map((y=>{if(y==="axisOrient"){let w=d==="x"?"bottom":"left",x=l[d==="x"?"axisBottom":"axisLeft"]||{},A=l[d==="x"?"axisTop":"axisRight"]||{},C=new Set([...be(x),...be(A)]),L={};for(let G of C.values())L[G]={signal:`${h.signal} === "${w}" ? ${pa(x[G])} : ${pa(A[G])}`};return L}return l[y]}))])}function f1(s,l){var h;let d=[{}];for(let y of s){let w=(h=l[y])==null?void 0:h.style;if(w){w=b.array(w);for(let x of w)d.push(l.style[x])}}return Object.assign.apply(null,d)}function og(s,l,d){var w;let h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=N0(s,d,l);if(y!==void 0)return{configFrom:"style",configValue:y};for(let x of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((w=h[x])==null?void 0:w[s])!==void 0)return{configFrom:x,configValue:h[x][s]};return{}}let Hy={scale:s=>{let{model:l,channel:d}=s;return l.scaleName(d)},format:s=>{let{format:l}=s;return l},formatType:s=>{let{formatType:l}=s;return l},grid:s=>{let{fieldOrDatumDef:l,axis:d,scaleType:h}=s;return d.grid??(function(y,w){return!Hn(y)&&ze(w)&&!Vt(w==null?void 0:w.bin)&&!zn(w==null?void 0:w.bin)})(h,l)},gridScale:s=>{let{model:l,channel:d}=s;return(function(h,y){let w=y==="x"?"y":"x";if(h.getScaleComponent(w))return h.scaleName(w)})(l,d)},labelAlign:s=>{let{axis:l,labelAngle:d,orient:h,channel:y}=s;return l.labelAlign||Wy(d,h,y)},labelAngle:s=>{let{labelAngle:l}=s;return l},labelBaseline:s=>{let{axis:l,labelAngle:d,orient:h,channel:y}=s;return l.labelBaseline||qy(d,h,y)},labelFlush:s=>{let{axis:l,fieldOrDatumDef:d,channel:h}=s;return l.labelFlush??(function(y,w){if(w==="x"&&Z(["quantitative","temporal"],y))return!0})(d.type,h)},labelOverlap:s=>{let{axis:l,fieldOrDatumDef:d,scaleType:h}=s;return l.labelOverlap??(function(y,w,x,A){if(x&&!b.isObject(A)||y!=="nominal"&&y!=="ordinal")return w!=="log"&&w!=="symlog"||"greedy"})(d.type,h,ze(d)&&!!d.timeUnit,ze(d)?d.sort:void 0)},orient:s=>{let{orient:l}=s;return l},tickCount:s=>{let{channel:l,model:d,axis:h,fieldOrDatumDef:y,scaleType:w}=s,x=l==="x"?"width":l==="y"?"height":void 0,A=x?d.getSizeSignalRef(x):void 0;return h.tickCount??(function(C){var J;let{fieldOrDatumDef:L,scaleType:G,size:H,values:X}=C;if(!X&&!Hn(G)&&G!=="log"){if(ze(L)){if(Vt(L.bin))return{signal:`ceil(${H.signal}/10)`};if(L.timeUnit&&Z(["month","hours","day","quarter"],(J=jn(L.timeUnit))==null?void 0:J.unit))return}return{signal:`ceil(${H.signal}/40)`}}})({fieldOrDatumDef:y,scaleType:w,size:A,values:h.values})},tickMinStep:function(s){let{format:l,fieldOrDatumDef:d}=s;if(l==="d")return 1;if(ze(d)){let{timeUnit:h}=d;if(h){let y=H0(h);if(y)return{signal:y}}}},title:s=>{let{axis:l,model:d,channel:h}=s;if(l.title!==void 0)return l.title;let y=Vy(d,h);if(y!==void 0)return y;let w=d.typedFieldDef(h),x=h==="x"?"x2":"y2",A=d.fieldDef(x);return Wl(w?[Jh(w)]:[],ze(A)?[Jh(A)]:[])},values:s=>{let{axis:l,fieldOrDatumDef:d}=s;return(function(h,y){let w=h.values;if(b.isArray(w))return mc(y,w);if(Ze(w))return w})(l,d)},zindex:s=>{let{axis:l,fieldOrDatumDef:d,mark:h}=s;return l.zindex??(function(y,w){return y==="rect"&&au(w)?1:0})(h,d)}};function sg(s){return`(((${s.signal} % 360) + 360) % 360)`}function qy(s,l,d,h){if(s!==void 0){if(d==="x"){if(Ze(s)){let y=sg(s);return{signal:`(45 < ${y} && ${y} < 135) || (225 < ${y} && ${y} < 315) ? "middle" :(${y} <= 45 || 315 <= ${y}) === ${Ze(l)?`(${l.signal} === "top")`:l==="top"} ? "bottom" : "top"`}}if(45<s&&s<135||225<s&&s<315)return"middle";if(Ze(l)){let y=s<=45||315<=s?"===":"!==";return{signal:`${l.signal} ${y} "top" ? "bottom" : "top"`}}return(s<=45||315<=s)==(l==="top")?"bottom":"top"}if(Ze(s)){let y=sg(s);return{signal:`${y} <= 45 || 315 <= ${y} || (135 <= ${y} && ${y} <= 225) ? ${h?'"middle"':"null"} : (45 <= ${y} && ${y} <= 135) === ${Ze(l)?`(${l.signal} === "left")`:l==="left"} ? "top" : "bottom"`}}if(s<=45||315<=s||135<=s&&s<=225)return h?"middle":null;if(Ze(l)){let y=45<=s&&s<=135?"===":"!==";return{signal:`${l.signal} ${y} "left" ? "top" : "bottom"`}}return(45<=s&&s<=135)==(l==="left")?"top":"bottom"}}function Wy(s,l,d){if(s===void 0)return;let h=d==="x",y=h?0:90,w=h?"bottom":"left";if(Ze(s)){let x=sg(s);return{signal:`(${y?`(${x} + 90)`:x} % 180 === 0) ? ${h?null:'"center"'} :(${y} < ${x} && ${x} < ${180+y}) === ${Ze(l)?`(${l.signal} === "${w}")`:l===w} ? "left" : "right"`}}if((s+y)%180==0)return h?null:"center";if(Ze(l)){let x=y<s&&s<180+y?"===":"!==";return{signal:`${`${l.signal} ${x} "${w}"`} ? "left" : "right"`}}return(y<s&&s<180+y)==(l===w)?"left":"right"}function Vy(s,l){let d=l==="x"?"x2":"y2",h=s.fieldDef(l),y=s.fieldDef(d),w=h?h.title:void 0,x=y?y.title:void 0;return w&&x?ti(w,x):w||x||(w!==void 0?w:x!==void 0?x:void 0)}class ol extends qt{clone(){return new ol(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,at(this,"_dependentFields",void 0),this._dependentFields=rp(this.transform.calculate)}static parseAllForSortIndex(l,d){return d.forEachFieldDef(((h,y)=>{if($i(h)&&fc(h.sort)){let{field:w,timeUnit:x}=h,A=h.sort,C=A.map(((L,G)=>`${ef({field:w,timeUnit:x,equal:L})} ? ${G} : `)).join("")+A.length;l=new ol(l,{calculate:C,as:sl(h,y,{forAs:!0})})}})),l}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 ${ne(this.transform)}`}}function sl(s,l,d){return je(s,{prefix:l,suffix:"sort_index",...d??{}})}function Bc(s,l){return Z(["top","bottom"],l)?"column":Z(["left","right"],l)||s==="row"?"row":"column"}function Zi(s,l,d,h){let y=h==="row"?d.headerRow:h==="column"?d.headerColumn:d.headerFacet;return Ke((l||{})[s],y[s],d.header[s])}function Uc(s,l,d,h){let y={};for(let w of s){let x=Zi(w,l||{},d,h);x!==void 0&&(y[w]=x)}return y}let _u=["row","column"],zc=["header","footer"];function bs(s,l){let d=s.component.layoutHeaders[l].title,h=s.config?s.config:void 0,y=s.component.layoutHeaders[l].facetFieldDef?s.component.layoutHeaders[l].facetFieldDef:void 0,{titleAnchor:w,titleAngle:x,titleOrient:A}=Uc(["titleAnchor","titleAngle","titleOrient"],y.header,h,l),C=Bc(l,A),L=Lt(x);return{name:`${l}-title`,type:"group",role:`${C}-title`,title:{text:d,...l==="row"?{orient:"left"}:{},style:"guide-title",...lg(L,C),...Mn(C,L,w),...Gc(h,y,l,pm,Ec)}}}function Mn(s,l){switch(arguments.length>2&&arguments[2]!==void 0?arguments[2]:"middle"){case"start":return{align:"left"};case"end":return{align:"right"}}let d=Wy(l,s==="row"?"left":"top",s==="row"?"y":"x");return d?{align:d}:{}}function lg(s,l){let d=qy(s,l==="row"?"left":"top",l==="row"?"y":"x",!0);return d?{baseline:d}:{}}function Yy(s,l){let d=s.component.layoutHeaders[l],h=[];for(let y of zc)if(d[y])for(let w of d[y]){let x=ll(s,l,y,d,w);x!=null&&h.push(x)}return h}function ip(s,l){let{sort:d}=s;return ii(d)?{field:je(d,{expr:"datum"}),order:d.order??"ascending"}:b.isArray(d)?{field:sl(s,l,{expr:"datum"}),order:"ascending"}:{field:je(s,{expr:"datum"}),order:d??"ascending"}}function xo(s,l,d){let{format:h,formatType:y,labelAngle:w,labelAnchor:x,labelOrient:A,labelExpr:C}=Uc(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],s.header,d,l),L=Vh({fieldOrDatumDef:s,format:h,formatType:y,expr:"parent",config:d}).signal,G=Bc(l,A);return{text:{signal:C?St(St(C,"datum.label",L),"datum.value",je(s,{expr:"parent"})):L},...l==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...lg(w,G),...Mn(G,w,x),...Gc(d,s,l,hm,wc)}}function ll(s,l,d,h,y){if(y){let w=null,{facetFieldDef:x}=h,A=s.config?s.config:void 0;if(x&&y.labels){let{labelOrient:H}=Uc(["labelOrient"],x.header,A,l);(l==="row"&&!Z(["top","bottom"],H)||l==="column"&&!Z(["left","right"],H))&&(w=xo(x,l,A))}let C=Ya(s)&&!Ql(s.facet),L=y.axes,G=(L==null?void 0:L.length)>0;if(w||G){let H=l==="row"?"height":"width";return{name:s.getName(`${l}_${d}`),type:"group",role:`${l}-${d}`,...h.facetFieldDef?{from:{data:s.getName(`${l}_domain`)},sort:ip(x,l)}:{},...G&&C?{from:{data:s.getName(`facet_domain_${l}`)}}:{},...w?{title:w}:{},...y.sizeSignal?{encode:{update:{[H]:y.sizeSignal}}}:{},...G?{axes:L}:{}}}}return null}let Ky={column:{start:0,end:1},row:{start:1,end:0}};function Xy(s,l){return Ky[l][s]}function Gc(s,l,d,h,y){let w={};for(let x of h){if(!y[x])continue;let A=Zi(x,l==null?void 0:l.header,s,d);A!==void 0&&(w[y[x]]=A)}return w}function pr(s){return[...jc(s,"width"),...jc(s,"height"),...jc(s,"childWidth"),...jc(s,"childHeight")]}function jc(s,l){let d=l==="width"?"x":"y",h=s.component.layoutSize.get(l);if(!h||h==="merged")return[];let y=s.getSizeSignalRef(l).signal;if(h==="step"){let w=s.getScaleComponent(d);if(w){let x=w.get("type"),A=w.get("range");if(Hn(x)&&go(A)){let C=s.scaleName(d);return Ya(s.parent)&&s.parent.component.resolve.scale[d]==="independent"?[Hc(C,A)]:[Hc(C,A),{name:y,update:op(C,w,`domain('${C}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if(h=="container"){let w=y.endsWith("width"),x=w?"containerSize()[0]":"containerSize()[1]",A=`isFinite(${x}) ? ${x} : ${ds(s.config.view,w?"width":"height")}`;return[{name:y,init:A,on:[{update:A,events:"window:resize"}]}]}return[{name:y,value:h}]}function Hc(s,l){let d=`${s}_step`;return Ze(l.step)?{name:d,update:l.step.signal}:{name:d,value:l.step}}function op(s,l,d){let h=l.get("type"),y=l.get("padding"),w=Ke(l.get("paddingOuter"),y),x=l.get("paddingInner");return x=h==="band"?x!==void 0?x:y:1,`bandspace(${d}, ${pa(x)}, ${pa(w)}) * ${s}_step`}function ug(s){return s==="childWidth"?"width":s==="childHeight"?"height":s}function cg(s,l){return be(s).reduce(((d,h)=>{let y=s[h];return{...d,...bu(l,y,h,(w=>on(w.value)))}}),{})}function dg(s,l){if(Ya(l))return s==="theta"?"independent":"shared";if(ws(l))return"shared";if(Ji(l))return un(s)||s==="theta"||s==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function sp(s,l){let d=s.scale[l],h=un(l)?"axis":"legend";return d==="independent"?(s[h][l]==="shared"&&Be((function(y){return`Setting the scale to be independent for "${y}" means we also have to set the guide (axis or legend) to be independent.`})(l)),"independent"):s[h][l]||"shared"}let fg=be({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 Zy extends ji{}let ul={symbols:function(s,l){let{fieldOrDatumDef:d,model:h,channel:y,legendCmpt:w,legendType:x}=l;if(x!=="symbol")return;let{markDef:A,encoding:C,config:L,mark:G}=h,H=A.filled&&G!=="trail",X={...Ud({},h,j_),...Mc(h,{filled:H})},J=w.get("symbolOpacity")??L.legend.symbolOpacity,le=w.get("symbolFillColor")??L.legend.symbolFillColor,te=w.get("symbolStrokeColor")??L.legend.symbolStrokeColor,pe=J===void 0?pg(C.opacity)??A.opacity:void 0;if(X.fill){if(y==="fill"||H&&y===Fe)delete X.fill;else if(X.fill.field)le?delete X.fill:(X.fill=on(L.legend.symbolBaseFillColor??"black"),X.fillOpacity=on(pe??1));else if(b.isArray(X.fill)){let ge=hg(C.fill??C.color)??A.fill??(H&&A.color);ge&&(X.fill=on(ge))}}if(X.stroke){if(y==="stroke"||!H&&y===Fe)delete X.stroke;else if(X.stroke.field||te)delete X.stroke;else if(b.isArray(X.stroke)){let ge=Ke(hg(C.stroke||C.color),A.stroke,H?A.color:void 0);ge&&(X.stroke={value:ge})}}if(y!==xi){let ge=ze(d)&&qc(h,w,d);ge?X.opacity=[{test:ge,...on(pe??1)},on(L.legend.unselectedOpacity)]:pe&&(X.opacity=on(pe))}return X={...X,...s},ye(X)?void 0:X},gradient:function(s,l){let{model:d,legendType:h,legendCmpt:y}=l;if(h!=="gradient")return;let{config:w,markDef:x,encoding:A}=d,C={},L=(y.get("gradientOpacity")??w.legend.gradientOpacity)===void 0?pg(A.opacity)||x.opacity:void 0;return L&&(C.opacity=on(L)),C={...C,...s},ye(C)?void 0:C},labels:function(s,l){let{fieldOrDatumDef:d,model:h,channel:y,legendCmpt:w}=l,x=h.legend(y)||{},A=h.config,C=ze(d)?qc(h,w,d):void 0,L=C?[{test:C,value:1},{value:A.legend.unselectedOpacity}]:void 0,{format:G,formatType:H}=x,X;Xs(H)?X=ri({fieldOrDatumDef:d,field:"datum.value",format:G,formatType:H,config:A}):G===void 0&&H===void 0&&A.customFormatTypes&&(d.type==="quantitative"&&A.numberFormatType?X=ri({fieldOrDatumDef:d,field:"datum.value",format:A.numberFormat,formatType:A.numberFormatType,config:A}):d.type==="temporal"&&A.timeFormatType&&ze(d)&&d.timeUnit===void 0&&(X=ri({fieldOrDatumDef:d,field:"datum.value",format:A.timeFormat,formatType:A.timeFormatType,config:A})));let J={...L?{opacity:L}:{},...X?{text:X}:{},...s};return ye(J)?void 0:J},entries:function(s,l){let{legendCmpt:d}=l,h=d.get("selections");return h!=null&&h.length?{...s,fill:{value:"transparent"}}:s}};function pg(s){return mg(s,((l,d)=>Math.max(l,d.value)))}function hg(s){return mg(s,((l,d)=>Ke(l,d.value)))}function mg(s,l){return(function(d){let h=d==null?void 0:d.condition;return!!h&&(b.isArray(h)||cr(h))})(s)?b.array(s.condition).reduce(l,s.value):cr(s)?s.value:void 0}function qc(s,l,d){let h=l.get("selections");if(!(h!=null&&h.length))return;let y=b.stringValue(d.field);return h.map((w=>`(!length(data(${b.stringValue($e(w)+ms)})) || (${w}[${y}] && indexof(${w}[${y}], datum.value) >= 0))`)).join(" || ")}let fi={direction:s=>{let{direction:l}=s;return l},format:s=>{let{fieldOrDatumDef:l,legend:d,config:h}=s,{format:y,formatType:w}=d;return ay(l,l.type,y,w,h,!1)},formatType:s=>{let{legend:l,fieldOrDatumDef:d,scaleType:h}=s,{formatType:y}=l;return ry(y,d,h)},gradientLength:s=>{let{legend:l,legendConfig:d}=s;return l.gradientLength??d.gradientLength??(function(h){let{legendConfig:y,model:w,direction:x,orient:A,scaleType:C}=h,{gradientHorizontalMaxLength:L,gradientHorizontalMinLength:G,gradientVerticalMaxLength:H,gradientVerticalMinLength:X}=y;if(Lr(C))return x==="horizontal"?A==="top"||A==="bottom"?lp(w,"width",G,L):G:lp(w,"height",X,H)})(s)},labelOverlap:s=>{let{legend:l,legendConfig:d,scaleType:h}=s;return l.labelOverlap??d.labelOverlap??(function(y){if(Z(["quantile","threshold","log","symlog"],y))return"greedy"})(h)},symbolType:s=>{let{legend:l,markDef:d,channel:h,encoding:y}=s;return l.symbolType??(function(w,x,A,C){if(x!=="shape"){let L=hg(A)??C;if(L)return L}switch(w){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"}})(d.type,h,y.shape,d.shape)},title:s=>{let{fieldOrDatumDef:l,config:d}=s;return ss(l,d,{allowDisabling:!0})},type:s=>{let{legendType:l,scaleType:d,channel:h}=s;if(es(h)&&Lr(d)){if(l==="gradient")return}else if(l==="symbol")return;return l},values:s=>{let{fieldOrDatumDef:l,legend:d}=s;return(function(h,y){let w=h.values;if(b.isArray(w))return mc(y,w);if(Ze(w))return w})(d,l)}};function gg(s){let{legend:l}=s;return Ke(l.type,(function(d){let{channel:h,timeUnit:y,scaleType:w}=d;if(es(h)){if(Z(["quarter","month","day"],y))return"symbol";if(Lr(w))return"gradient"}return"symbol"})(s))}function bg(s){let{legendConfig:l,legendType:d,orient:h,legend:y}=s;return y.direction??l[d?"gradientDirection":"symbolDirection"]??(function(w,x){switch(w){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return x==="gradient"?"horizontal":void 0}})(h,d)}function lp(s,l,d,h){return{signal:`clamp(${s.getSizeSignalRef(l).signal}, ${d}, ${h})`}}function up(s){let l=cn(s)?(function(d){let{encoding:h}=d,y={};for(let w of[Fe,...Rf]){let x=vn(h[w]);x&&d.getScaleComponent(w)&&(w===Sn&&ze(x)&&x.type===Vs||(y[w]=Ao(d,w)))}return y})(s):(function(d){let{legends:h,resolve:y}=d.component;for(let w of d.children){up(w);for(let x of be(w.component.legends))y.legend[x]=sp(d.component.resolve,x),y.legend[x]==="shared"&&(h[x]=yg(h[x],w.component.legends[x]),h[x]||(y.legend[x]="independent",delete h[x]))}for(let w of be(h))for(let x of d.children)x.component.legends[w]&&y.legend[w]==="shared"&&delete x.component.legends[w];return h})(s);return s.component.legends=l,l}function cp(s,l,d,h){switch(l){case"disable":return d!==void 0;case"values":return!!(d!=null&&d.values);case"title":if(l==="title"&&s===(h==null?void 0:h.title))return!0}return s===(d||{})[l]}function Ao(s,l){var me;let d=s.legend(l),{markDef:h,encoding:y,config:w}=s,x=w.legend,A=new Zy({},(function(Ae,Re){let Pe=Ae.scaleName(Re);if(Ae.mark==="trail"){if(Re==="color")return{stroke:Pe};if(Re==="size")return{strokeWidth:Pe}}return Re==="color"?Ae.markDef.filled?{fill:Pe}:{stroke:Pe}:{[Re]:Pe}})(s,l));(function(Ae,Re,Pe){var Je;let We=(Je=Ae.fieldDef(Re))==null?void 0:Je.field;for(let it of Te(Ae.component.selection??{})){let Qe=it.project.hasField[We]??it.project.hasChannel[Re];if(Qe&&Uy.defined(it)){let lt=Pe.get("selections")??[];lt.push(it.name),Pe.set("selections",lt,!1),Qe.hasLegend=!0}}})(s,l,A);let C=d!==void 0?!d:x.disable;if(A.set("disable",C,d!==void 0),C)return A;d=d||{};let L=s.getScaleComponent(l).get("type"),G=vn(y[l]),H=ze(G)?(me=jn(G.timeUnit))==null?void 0:me.unit:void 0,X=d.orient||w.legend.orient||"right",J=gg({legend:d,channel:l,timeUnit:H,scaleType:L}),le={legend:d,channel:l,model:s,markDef:h,encoding:y,fieldOrDatumDef:G,legendConfig:x,config:w,scaleType:L,orient:X,legendType:J,direction:bg({legend:d,legendType:J,orient:X,legendConfig:x})};for(let Ae of fg){if(J==="gradient"&&Ae.startsWith("symbol")||J==="symbol"&&Ae.startsWith("gradient"))continue;let Re=Ae in fi?fi[Ae](le):d[Ae];if(Re!==void 0){let Pe=cp(Re,Ae,d,s.fieldDef(l));(Pe||w.legend[Ae]===void 0)&&A.set(Ae,Re,Pe)}}let te=(d==null?void 0:d.encoding)??{},pe=A.get("selections"),ge={},xe={fieldOrDatumDef:G,model:s,channel:l,legendCmpt:A,legendType:J};for(let Ae of["labels","legend","title","symbols","gradient","entries"]){let Re=cg(te[Ae]??{},s),Pe=Ae in ul?ul[Ae](Re,xe):Re;Pe===void 0||ye(Pe)||(ge[Ae]={...pe!=null&&pe.length&&ze(G)?{name:`${$e(G.field)}_legend_${Ae}`}:{},...pe!=null&&pe.length?{interactive:!!pe}:{},update:Pe})}return ye(ge)||A.set("encode",ge,!!(d!=null&&d.encoding)),A}function yg(s,l){var w,x,A,C;if(!s)return l.clone();let d=s.getWithExplicit("orient"),h=l.getWithExplicit("orient");if(d.explicit&&h.explicit&&d.value!==h.value)return;let y=!1;for(let L of fg){let G=qi(s.getWithExplicit(L),l.getWithExplicit(L),L,"legend",((H,X)=>{switch(L){case"symbolType":return Jy(H,X);case"title":return ni(H,X);case"type":return y=!0,Fr("symbol")}return Rc(H,X,L,"legend")}));s.setWithExplicit(L,G)}return y&&((x=(w=s.implicit)==null?void 0:w.encode)!=null&&x.gradient&&dt(s.implicit,["encode","gradient"]),(C=(A=s.explicit)==null?void 0:A.encode)!=null&&C.gradient&&dt(s.explicit,["encode","gradient"])),s}function Jy(s,l){return l.value==="circle"?l:s}function dp(s){let l=s.component.legends,d={};for(let h of be(l)){let y=Xe(s.getScaleComponent(h).get("domains"));if(d[y])for(let w of d[y])yg(w,l[h])||d[y].push(l[h]);else d[y]=[l[h].clone()]}return Te(d).flat().map((h=>(function(y,w){var G,H,X;let{disable:x,labelExpr:A,selections:C,...L}=y.combine();if(!x){if(w.aria===!1&&L.aria==null&&(L.aria=!1),(G=L.encode)!=null&&G.symbols){let J=L.encode.symbols.update;!J.fill||J.fill.value==="transparent"||J.stroke||L.stroke||(J.stroke={value:"transparent"});for(let le of Rf)L[le]&&delete J[le]}if(L.title||delete L.title,A!==void 0){let J=A;(X=(H=L.encode)==null?void 0:H.labels)!=null&&X.update&&Ze(L.encode.labels.update.text)&&(J=St(A,"datum.label",L.encode.labels.update.text.signal)),(function(le,te,pe,ge){le.encode??={},le.encode[te]??={},le.encode[te].update??={},le.encode[te].update[pe]=ge})(L,"labels","text",{signal:J})}return L}})(h,s.config))).filter((h=>h!==void 0))}function vg(s){return ws(s)||Ji(s)?(function(l){return l.children.reduce(((d,h)=>d.concat(h.assembleProjections())),Wc(l))})(s):Wc(s)}function Wc(s){let l=s.component.projection;if(!l||l.merged)return[];let d=l.combine(),{name:h}=d;if(l.data){let y={signal:`[${l.size.map((x=>x.signal)).join(", ")}]`},w=l.data.reduce(((x,A)=>{let C=Ze(A)?A.signal:`data('${s.lookupDataSource(A)}')`;return Z(x,C)||x.push(C),x}),[]);if(w.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:h,size:y,fit:{signal:w.length>1?`[${w.join(", ")}]`:w[0]},...d}]}return[{name:h,translate:{signal:"[width / 2, height / 2]"},...d}]}let Vc=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class Eg extends ji{constructor(l,d,h,y){super({...d},{name:l}),this.specifiedProjection=d,this.size=h,this.data=y,at(this,"merged",!1)}get isFit(){return!!this.data}}function wg(s){s.component.projection=cn(s)?(function(l){if(l.hasProjection){let d=ea(l.specifiedProjection),h=!(d&&(d.scale!=null||d.translate!=null)),y=h?[l.getSizeSignalRef("width"),l.getSizeSignalRef("height")]:void 0,w=h?(function(A){let C=[],{encoding:L}=A;for(let G of[[$a,nt],[rr,da]])(vn(L[G[0]])||vn(L[G[1]]))&&C.push({signal:A.getName(`geojson_${C.length}`)});return A.channelHasField(Sn)&&A.typedFieldDef(Sn).type===Vs&&C.push({signal:A.getName(`geojson_${C.length}`)}),C.length===0&&C.push(A.requestDataName(nn.Main)),C})(l):void 0,x=new Eg(l.projectionName(!0),{...ea(l.config.projection)??{},...d??{}},y,w);return x.get("type")||x.set("type","equalEarth",!1),x}})(s):(function(l){if(l.children.length===0)return;let d;for(let y of l.children)wg(y);let h=oe(l.children,(y=>{let w=y.component.projection;if(w){if(d){let x=(function(A,C){let L=oe(Vc,(G=>!b.hasOwnProperty(A.explicit,G)&&!b.hasOwnProperty(C.explicit,G)||!!(b.hasOwnProperty(A.explicit,G)&&b.hasOwnProperty(C.explicit,G)&&Ie(A.get(G),C.get(G)))));if(Ie(A.size,C.size)){if(L)return A;if(Ie(A.explicit,{}))return C;if(Ie(C.explicit,{}))return A}return null})(d,w);return x&&(d=x),!!x}return d=w,!0}return!0}));if(d&&h){let y=l.projectionName(!0),w=new Eg(y,d.specifiedProjection,d.size,j(d.data));for(let x of l.children){let A=x.component.projection;A&&(A.isFit&&w.data.push(...x.component.projection.data),x.renameProjection(A.get("name"),y),A.merged=!0)}return w}})(s)}function Qy(s,l,d,h){if(ou(l,d)){let y=cn(s)?s.axis(d)??s.legend(d)??{}:{},w=je(l,{expr:"datum"}),x=je(l,{expr:"datum",binSuffix:"end"});return{formulaAs:je(l,{binSuffix:"range",forAs:!0}),formula:yo(w,x,y.format,y.formatType,h)}}return{}}function fp(s,l){return`${Oi(s)}_${l}`}function To(s,l,d){let h=fp(rt(d,void 0)??{},l);return s.getName(`${h}_bins`)}function _g(s,l,d){let h,y;h=(function(L){return"as"in L})(s)?b.isString(s.as)?[s.as,`${s.as}_end`]:[s.as[0],s.as[1]]:[je(s,{forAs:!0}),je(s,{binSuffix:"end",forAs:!0})];let w={...rt(l,void 0)},x=fp(w,s.field),{signal:A,extentSignal:C}=(function(L,G){return{signal:L.getName(`${G}_bins`),extentSignal:L.getName(`${G}_extent`)}})(d,x);if(Or(w.extent)){let L=w.extent;y=So(d,L.param,L),delete w.extent}return{key:x,binComponent:{bin:w,field:s.field,as:[h],...A?{signal:A}:{},...C?{extentSignal:C}:{},...y?{span:y}:{}}}}class pi extends qt{clone(){return new pi(null,j(this.bins))}constructor(l,d){super(l),this.bins=d}static makeFromEncoding(l,d){let h=d.reduceFieldDef(((y,w,x)=>{if(ma(w)&&Vt(w.bin)){let{key:A,binComponent:C}=_g(w,w.bin,d);y[A]={...C,...y[A],...Qy(d,w,x,d.config)}}return y}),{});return ye(h)?null:new pi(l,h)}static makeFromTransform(l,d,h){let{key:y,binComponent:w}=_g(d,d.bin,h);return new pi(l,{[y]:w})}merge(l,d){for(let h of be(l.bins))h in this.bins?(d(l.bins[h].signal,this.bins[h].signal),this.bins[h].as=_e([...this.bins[h].as,...l.bins[h].as],ne)):this.bins[h]=l.bins[h];for(let h of l.children)l.removeChild(h),h.parent=this;l.remove()}producedFields(){return new Set(Te(this.bins).map((l=>l.as)).flat(2))}dependentFields(){return new Set(Te(this.bins).map((l=>l.field)))}hash(){return`Bin ${ne(this.bins)}`}assemble(){return Te(this.bins).flatMap((l=>{let d=[],[h,...y]=l.as,{extent:w,...x}=l.bin,A={type:"bin",field:jt(l.field),as:h,signal:l.signal,...Or(w)?{extent:null}:{extent:w},...l.span?{span:{signal:`span(${l.span})`}}:{},...x};!w&&l.extentSignal&&(d.push({type:"extent",field:jt(l.field),signal:l.extentSignal}),A.extent={signal:l.extentSignal}),d.push(A);for(let C of y)for(let L=0;L<2;L++)d.push({type:"formula",expr:je({field:h[L]},{expr:"datum"}),as:C[L]});return l.formula&&d.push({type:"formula",expr:l.formula,as:l.formulaAs}),d}))}}function ev(s,l,d,h){var w;let y=cn(h)?h.encoding[Ci(l)]:void 0;if(ma(d)&&cn(h)&&pf(d,y,h.markDef,h.config)){s.add(je(d,{})),s.add(je(d,{suffix:"end"}));let{mark:x,markDef:A,config:C}=h,L=Fi({fieldDef:d,markDef:A,config:C});cc(x)&&L!==.5&&un(l)&&(s.add(je(d,{suffix:Xf})),s.add(je(d,{suffix:$t}))),d.bin&&ou(d,l)&&s.add(je(d,{binSuffix:"range"}))}else if(Qo(l)){let x=gh(l);s.add(h.getName(x))}else s.add(je(d));return $i(d)&&(function(x){return b.isObject(x)&&"field"in x})((w=d.scale)==null?void 0:w.range)&&s.add(d.scale.range.field),s}class Va extends qt{clone(){return new Va(null,new Set(this.dimensions),j(this.measures))}constructor(l,d,h){super(l),this.dimensions=d,this.measures=h}get groupBy(){return this.dimensions}static makeFromEncoding(l,d){let h=!1;d.forEachFieldDef((x=>{x.aggregate&&(h=!0)}));let y={},w=new Set;return h?(d.forEachFieldDef(((x,A)=>{let{aggregate:C,field:L}=x;if(C)if(C==="count")y["*"]??={},y["*"].count=new Set([je(x,{forAs:!0})]);else{if(ei(C)||Ni(C)){let G=ei(C)?"argmin":"argmax",H=C[G];y[H]??={},y[H][G]=new Set([je({op:G,field:H},{forAs:!0})])}else y[L]??={},y[L][C]=new Set([je(x,{forAs:!0})]);Nr(A)&&d.scaleDomain(A)==="unaggregated"&&(y[L]??={},y[L].min=new Set([je({field:L,aggregate:"min"},{forAs:!0})]),y[L].max=new Set([je({field:L,aggregate:"max"},{forAs:!0})]))}else ev(w,A,x,d)})),w.size+be(y).length===0?null:new Va(l,w,y)):null}static makeFromTransform(l,d){let h=new Set,y={};for(let w of d.aggregate){let{op:x,field:A,as:C}=w;x&&(x==="count"?(y["*"]??={},y["*"].count=new Set([C||je(w,{forAs:!0})])):(y[A]??={},y[A][x]=new Set([C||je(w,{forAs:!0})])))}for(let w of d.groupby??[])h.add(w);return h.size+be(y).length===0?null:new Va(l,h,y)}merge(l){return Ce(this.dimensions,l.dimensions)?((function(d,h){for(let y of be(h)){let w=h[y];for(let x of be(w))y in d?d[y][x]=new Set([...d[y][x]??[],...w[x]]):d[y]={[x]:w[x]}}})(this.measures,l.measures),!0):((function(){ic.debug(...arguments)})("different dimensions, cannot merge"),!1)}addDimensions(l){l.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...be(this.measures)])}producedFields(){let l=new Set;for(let d of be(this.measures))for(let h of be(this.measures[d])){let y=this.measures[d][h];y.size===0?l.add(`${h}_${d}`):y.forEach(l.add,l)}return l}hash(){return`Aggregate ${ne({dimensions:this.dimensions,measures:this.measures})}`}assemble(){let l=[],d=[],h=[];for(let y of be(this.measures))for(let w of be(this.measures[y]))for(let x of this.measures[y][w])h.push(x),l.push(w),d.push(y==="*"?null:jt(y));return{type:"aggregate",groupby:[...this.dimensions].map(jt),ops:l,fields:d,as:h}}}class cl extends qt{constructor(l,d,h,y){super(l),this.model=d,this.name=h,this.data=y,at(this,"column",void 0),at(this,"row",void 0),at(this,"facet",void 0),at(this,"childModel",void 0);for(let w of Ua){let x=d.facet[w];if(x){let{bin:A,sort:C}=x;this[w]={name:d.getName(`${w}_domain`),fields:[je(x),...Vt(A)?[je(x,{binSuffix:"end"})]:[]],...ii(C)?{sortField:C}:b.isArray(C)?{sortIndexField:sl(x,w)}:{}}}}this.childModel=d.child}hash(){let l="Facet";for(let d of Ua)this[d]&&(l+=` ${d.charAt(0)}:${ne(this[d])}`);return l}get fields(){var d;let l=[];for(let h of Ua)(d=this[h])!=null&&d.fields&&l.push(...this[h].fields);return l}dependentFields(){let l=new Set(this.fields);for(let d of Ua)this[d]&&(this[d].sortField&&l.add(this[d].sortField.field),this[d].sortIndexField&&l.add(this[d].sortIndexField));return l}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){let l={};for(let d of Qr){let h=this.childModel.component.scales[d];if(h&&!h.merged){let y=h.get("type"),w=h.get("range");if(Hn(y)&&go(w)){let x=Rg(Es(this.childModel,d));x?l[d]=x:Be(ha(d))}}}return l}assembleRowColumnHeaderData(l,d,h){let y={row:"y",column:"x",facet:void 0}[l],w=[],x=[],A=[];y&&h&&h[y]&&(d?(w.push(`distinct_${h[y]}`),x.push("max")):(w.push(h[y]),x.push("distinct")),A.push(`distinct_${h[y]}`));let{sortField:C,sortIndexField:L}=this[l];if(C){let{op:G=dc,field:H}=C;w.push(H),x.push(G),A.push(je(C,{forAs:!0}))}else L&&(w.push(L),x.push("max"),A.push(L));return{name:this[l].name,source:d??this.data,transform:[{type:"aggregate",groupby:this[l].fields,...w.length?{fields:w,ops:x,as:A}:{}}]}}assembleFacetHeaderData(l){var C;let{columns:d}=this.model.layout,{layoutHeaders:h}=this.model.component,y=[],w={};for(let L of _u){for(let G of zc){let H=(h[L]&&h[L][G])??[];for(let X of H)if(((C=X.axes)==null?void 0:C.length)>0){w[L]=!0;break}}if(w[L]){let G=`length(data("${this.facet.name}"))`,H=L==="row"?d?{signal:`ceil(${G} / ${d})`}:1:d?{signal:`min(${G}, ${d})`}:{signal:G};y.push({name:`${this.facet.name}_${L}`,transform:[{type:"sequence",start:0,stop:H}]})}}let{row:x,column:A}=w;return(x||A)&&y.unshift(this.assembleRowColumnHeaderData("facet",null,l)),y}assemble(){let l=[],d=null,h=this.getChildIndependentFieldsWithStep(),{column:y,row:w,facet:x}=this;if(y&&w&&(h.x||h.y)){d=`cross_${this.column.name}_${this.row.name}`;let A=[].concat(h.x??[],h.y??[]),C=A.map((()=>"distinct"));l.push({name:d,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:A,ops:C}]})}for(let A of[Kr,tt])this[A]&&l.push(this.assembleRowColumnHeaderData(A,d,h));if(x){let A=this.assembleFacetHeaderData(h);A&&l.push(...A)}return l}}function Yc(s){return s.startsWith("'")&&s.endsWith("'")||s.startsWith('"')&&s.endsWith('"')?s.slice(1,-1):s}function p1(s){let l={};return P(s.filter,(d=>{if(Vl(d)){let h=null;Zd(d)?h=Gn(d.equal):qs(d)?h=Gn(d.lte):Hs(d)?h=Gn(d.lt):Ws(d)?h=Gn(d.gt):Ph(d)?h=Gn(d.gte):Jd(d)?h=d.range[0]:Qd(d)&&(h=(d.oneOf??d.in)[0]),h&&(Gs(h)?l[d.field]="date":b.isNumber(h)?l[d.field]="number":b.isString(h)&&(l[d.field]="string")),d.timeUnit&&(l[d.field]="date")}})),l}function Yn(s){let l={};function d(h){var y;It(h)?l[h.field]="date":h.type==="quantitative"&&(y=h.aggregate,b.isString(y)&&Z(["min","max"],y))?l[h.field]="number":Xt(h.field)>1?h.field in l||(l[h.field]="flatten"):$i(h)&&ii(h.sort)&&Xt(h.sort.field)>1&&(h.sort.field in l||(l[h.sort.field]="flatten"))}if((cn(s)||Ya(s))&&s.forEachFieldDef(((h,y)=>{if(ma(h))d(h);else{let w=Us(y),x=s.fieldDef(w);d({...h,type:x.type})}})),cn(s)){let{mark:h,markDef:y,encoding:w}=s;if(is(h)&&!s.encoding.order){let x=w[y.orient==="horizontal"?"y":"x"];ze(x)&&x.type==="quantitative"&&!(x.field in l)&&(l[x.field]="number")}}return l}class Kn extends qt{clone(){return new Kn(null,j(this._parse))}constructor(l,d){super(l),at(this,"_parse",void 0),this._parse=d}hash(){return`Parse ${ne(this._parse)}`}static makeExplicit(l,d,h){var x;let y={},w=d.data;return!Eo(w)&&((x=w==null?void 0:w.format)!=null&&x.parse)&&(y=w.format.parse),this.makeWithAncestors(l,y,{},h)}static makeWithAncestors(l,d,h,y){for(let A of be(h)){let C=y.getWithExplicit(A);C.value!==void 0&&(C.explicit||C.value===h[A]||C.value==="derived"||h[A]==="flatten"?delete h[A]:Be(Dr(A,h[A],C.value)))}for(let A of be(d)){let C=y.get(A);C!==void 0&&(C===d[A]?delete d[A]:Be(Dr(A,d[A],C)))}let w=new ji(d,h);y.copyAll(w);let x={};for(let A of be(w.combine())){let C=w.get(A);C!==null&&(x[A]=C)}return be(x).length===0||y.parseNothing?null:new Kn(l,x)}get parse(){return this._parse}merge(l){this._parse={...this._parse,...l.parse},l.remove()}assembleFormatParse(){let l={};for(let d of be(this._parse)){let h=this._parse[d];Xt(d)===1&&(l[d]=h)}return l}producedFields(){return new Set(be(this._parse))}dependentFields(){return new Set(be(this._parse))}assembleTransforms(){let l=arguments.length>0&&arguments[0]!==void 0&&arguments[0];return be(this._parse).filter((d=>!l||Xt(d)>1)).map((d=>{let h=(function(y,w){let x=xt(y);return w==="number"?`toNumber(${x})`:w==="boolean"?`toBoolean(${x})`:w==="string"?`toString(${x})`:w==="date"?`toDate(${x})`:w==="flatten"?x:w.startsWith("date:")?`timeParse(${x},'${Yc(w.slice(5,w.length))}')`:w.startsWith("utc:")?`utcParse(${x},'${Yc(w.slice(4,w.length))}')`:(Be(`Unrecognized parse "${w}".`),null)})(d,this._parse[d]);return h?{type:"formula",expr:h,as:Tt(d)}:null})).filter((d=>d!==null))}}class Co extends qt{clone(){return new Co(null)}constructor(l){super(l)}dependentFields(){return new Set}producedFields(){return new Set([fr])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:fr}}}class Kc extends qt{clone(){return new Kc(null,this.params)}constructor(l,d){super(l),this.params=d}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${ne(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class Xc extends qt{clone(){return new Xc(null,this.params)}constructor(l,d){super(l),this.params=d}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${ne(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class Ro extends qt{constructor(l){let d;if(super(null),at(this,"_data",void 0),at(this,"_name",void 0),at(this,"_generator",void 0),l??={name:"source"},Eo(l)||(d=l.format?{...ee(l.format,["parse"])}:{}),mu(l))this._data={values:l.values};else if(fs(l)){if(this._data={url:l.url},!d.type){let h=/(?:\.([^.]+))?$/.exec(l.url)[1];Z(["json","csv","tsv","dsv","topojson"],h)||(h="json"),d.type=h}}else Vf(l)?this._data={values:[{type:"Sphere"}]}:(qf(l)||Eo(l))&&(this._data={});this._generator=Eo(l),l.name&&(this._name=l.name),d&&!ye(d)&&(this._data.format=d)}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(l){this._name=l}set parent(l){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 pp(s){return s instanceof Ro||s instanceof Kc||s instanceof Xc}var Zc=new WeakMap;class hp{constructor(){C_(this,Zc,{writable:!0,value:void 0}),I0(this,Zc,!1)}setModified(){I0(this,Zc,!0)}get modifiedFlag(){return(function(d,h){return h.get?h.get.call(d):h.value})(l=this,O0(l,Zc,"get"));var l}}class sa extends hp{getNodeDepths(l,d,h){h.set(l,d);for(let y of l.children)this.getNodeDepths(y,d+1,h);return h}optimize(l){let d=[...this.getNodeDepths(l,0,new Map).entries()].sort(((h,y)=>y[1]-h[1]));for(let h of d)this.run(h[0]);return this.modifiedFlag}}class mp extends hp{optimize(l){this.run(l);for(let d of l.children)this.optimize(d);return this.modifiedFlag}}class kg extends mp{mergeNodes(l,d){let h=d.shift();for(let y of d)l.removeChild(y),y.parent=h,y.remove()}run(l){let d=l.children.map((y=>y.hash())),h={};for(let y=0;y<d.length;y++)h[d[y]]===void 0?h[d[y]]=[l.children[y]]:h[d[y]].push(l.children[y]);for(let y of be(h))h[y].length>1&&(this.setModified(),this.mergeNodes(l,h[y]))}}class Sg extends mp{constructor(l){super(),at(this,"requiresSelectionId",void 0),this.requiresSelectionId=l&&ig(l)}run(l){l instanceof Co&&(this.requiresSelectionId&&(pp(l.parent)||l.parent instanceof Va||l.parent instanceof Kn)||(this.setModified(),l.remove()))}}class tv extends hp{optimize(l){return this.run(l,new Set),this.modifiedFlag}run(l,d){let h=new Set;l instanceof Wi&&(h=l.producedFields(),Me(h,d)&&(this.setModified(),l.removeFormulas(d),l.producedFields.length===0&&l.remove()));for(let y of l.children)this.run(y,new Set([...d,...h]))}}class ys extends mp{constructor(){super()}run(l){l instanceof ia&&!l.isRequired()&&(this.setModified(),l.remove())}}class Jc extends sa{run(l){if(!(pp(l)||l.numChildren()>1)){for(let d of l.children)if(d instanceof Kn)if(l instanceof Kn)this.setModified(),l.merge(d);else{if(Ee(l.producedFields(),d.dependentFields()))continue;this.setModified(),d.swapWithParent()}}}}class gp extends sa{run(l){let d=[...l.children],h=l.children.filter((y=>y instanceof Kn));if(l.numChildren()>1&&h.length>=1){let y={},w=new Set;for(let x of h){let A=x.parse;for(let C of be(A))C in y?y[C]!==A[C]&&w.add(C):y[C]=A[C]}for(let x of w)delete y[x];if(!ye(y)){this.setModified();let x=new Kn(l,y);for(let A of d){if(A instanceof Kn)for(let C of be(y))delete A.parse[C];l.removeChild(A),A.parent=x,A instanceof Kn&&be(A.parse).length===0&&A.remove()}}}}}class nv extends sa{run(l){l instanceof ia||l.numChildren()>0||l instanceof cl||l instanceof Ro||(this.setModified(),l.remove())}}class xg extends sa{run(l){let d=l.children.filter((y=>y instanceof Wi)),h=d.pop();for(let y of d)this.setModified(),h.merge(y)}}class av extends sa{run(l){let d=l.children.filter((y=>y instanceof Va)),h={};for(let y of d){let w=ne(y.groupBy);w in h||(h[w]=[]),h[w].push(y)}for(let y of be(h)){let w=h[y];if(w.length>1){let x=w.pop();for(let A of w)x.merge(A)&&(l.removeChild(A),A.parent=x,A.remove(),this.setModified())}}}}class rv extends sa{constructor(l){super(),this.model=l}run(l){let d=!(pp(l)||l instanceof ci||l instanceof Kn||l instanceof Co),h=[],y=[];for(let w of l.children)w instanceof pi&&(d&&!Ee(l.producedFields(),w.dependentFields())?h.push(w):y.push(w));if(h.length>0){let w=h.pop();for(let x of h)w.merge(x,this.model.renameSignal.bind(this.model));this.setModified(),l instanceof pi?l.merge(w,this.model.renameSignal.bind(this.model)):w.swapWithParent()}if(y.length>1){let w=y.pop();for(let x of y)w.merge(x,this.model.renameSignal.bind(this.model));this.setModified()}}}class h1 extends sa{run(l){let d=[...l.children];if(!ae(d,(w=>w instanceof ia))||l.numChildren()<=1)return;let h=[],y;for(let w of d)if(w instanceof ia){let x=w;for(;x.numChildren()===1;){let[A]=x.children;if(!(A instanceof ia))break;x=A}h.push(...x.children),y?(l.removeChild(w),w.parent=y.parent,y.parent.removeChild(y),y.parent=x,this.setModified()):y=x}else h.push(w);if(h.length){this.setModified();for(let w of h)w.parent.removeChild(w),w.parent=y}}}class dl extends qt{clone(){return new dl(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}addDimensions(l){this.transform.groupby=_e(this.transform.groupby.concat(l),(d=>d))}dependentFields(){let l=new Set;return this.transform.groupby&&this.transform.groupby.forEach(l.add,l),this.transform.joinaggregate.map((d=>d.field)).filter((d=>d!==void 0)).forEach(l.add,l),l}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(l){return l.as??je(l)}hash(){return`JoinAggregateTransform ${ne(this.transform)}`}assemble(){let l=[],d=[],h=[];for(let w of this.transform.joinaggregate)d.push(w.op),h.push(this.getDefaultName(w)),l.push(w.field===void 0?null:w.field);let y=this.transform.groupby;return{type:"joinaggregate",as:h,ops:d,fields:l,...y!==void 0?{groupby:y}:{}}}}class No extends qt{clone(){return new No(null,j(this._stack))}constructor(l,d){super(l),at(this,"_stack",void 0),this._stack=d}static makeFromTransform(l,d){let{stack:h,groupby:y,as:w,offset:x="zero"}=d,A=[],C=[];if(d.sort!==void 0)for(let H of d.sort)A.push(H.field),C.push(Ke(H.order,"ascending"));let L={field:A,order:C},G;return G=(function(H){return b.isArray(H)&&H.every((X=>b.isString(X)))&&H.length>1})(w)?w:b.isString(w)?[w,`${w}_end`]:[`${d.stack}_start`,`${d.stack}_end`],new No(l,{dimensionFieldDefs:[],stackField:h,groupby:y,offset:x,sort:L,facetby:[],as:G})}static makeFromEncoding(l,d){let h=d.stack,{encoding:y}=d;if(!h)return null;let{groupbyChannels:w,fieldChannel:x,offset:A,impute:C}=h,L=w.map((J=>dr(y[J]))).filter((J=>!!J)),G=(function(J){return J.stack.stackBy.reduce(((le,te)=>{let pe=je(te.fieldDef);return pe&&le.push(pe),le}),[])})(d),H=d.encoding.order,X;if(b.isArray(H)||ze(H))X=ql(H);else{let J=iy(H)?H.sort:x==="y"?"descending":"ascending";X=G.reduce(((le,te)=>(le.field.push(te),le.order.push(J),le)),{field:[],order:[]})}return new No(l,{dimensionFieldDefs:L,stackField:d.vgField(x),facetby:[],stackby:G,sort:X,offset:A,impute:C,as:[d.vgField(x,{suffix:"start",forAs:!0}),d.vgField(x,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(l){this._stack.facetby.push(...l)}dependentFields(){let l=new Set;return l.add(this._stack.stackField),this.getGroupbyFields().forEach(l.add,l),this._stack.facetby.forEach(l.add,l),this._stack.sort.field.forEach(l.add,l),l}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${ne(this._stack)}`}getGroupbyFields(){let{dimensionFieldDefs:l,impute:d,groupby:h}=this._stack;return l.length>0?l.map((y=>y.bin?d?[je(y,{binSuffix:"mid"})]:[je(y,{}),je(y,{binSuffix:"end"})]:[je(y)])).flat():h??[]}assemble(){let l=[],{facetby:d,dimensionFieldDefs:h,stackField:y,stackby:w,sort:x,offset:A,impute:C,as:L}=this._stack;if(C)for(let G of h){let{bandPosition:H=.5,bin:X}=G;if(X){let J=je(G,{expr:"datum"}),le=je(G,{expr:"datum",binSuffix:"end"});l.push({type:"formula",expr:`${H}*${J}+${1-H}*${le}`,as:je(G,{binSuffix:"mid",forAs:!0})})}l.push({type:"impute",field:y,groupby:[...w,...d],key:je(G,{binSuffix:"mid"}),method:"value",value:0})}return l.push({type:"stack",groupby:[...this.getGroupbyFields(),...d],field:y,sort:x,as:L,offset:A}),l}}class fl extends qt{clone(){return new fl(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}addDimensions(l){this.transform.groupby=_e(this.transform.groupby.concat(l),(d=>d))}dependentFields(){let l=new Set;return(this.transform.groupby??[]).forEach(l.add,l),(this.transform.sort??[]).forEach((d=>l.add(d.field))),this.transform.window.map((d=>d.field)).filter((d=>d!==void 0)).forEach(l.add,l),l}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(l){return l.as??je(l)}hash(){return`WindowTransform ${ne(this.transform)}`}assemble(){let l=[],d=[],h=[],y=[];for(let H of this.transform.window)d.push(H.op),h.push(this.getDefaultName(H)),y.push(H.param===void 0?null:H.param),l.push(H.field===void 0?null:H.field);let w=this.transform.frame,x=this.transform.groupby;if(w&&w[0]===null&&w[1]===null&&d.every((H=>xn(H))))return{type:"joinaggregate",as:h,ops:d,fields:l,...x!==void 0?{groupby:x}:{}};let A=[],C=[];if(this.transform.sort!==void 0)for(let H of this.transform.sort)A.push(H.field),C.push(H.order??"ascending");let L={field:A,order:C},G=this.transform.ignorePeers;return{type:"window",params:y,as:h,ops:d,fields:l,sort:L,...G!==void 0?{ignorePeers:G}:{},...x!==void 0?{groupby:x}:{},...w!==void 0?{frame:w}:{}}}}function Ag(s){if(s instanceof cl)if(s.numChildren()!==1||s.children[0]instanceof ia){let d=s.model.component.data.main;Tg(d);let h=(l=s,function w(x){if(!(x instanceof cl)){let A=x.clone();if(A instanceof ia){let C=Cg+A.getSource();A.setSource(C),l.model.component.data.outputNodes[C]=A}else(A instanceof Va||A instanceof No||A instanceof fl||A instanceof dl)&&A.addDimensions(l.fields);for(let C of x.children.flatMap(w))C.parent=A;return[A]}return x.children.flatMap(w)}),y=s.children.map(h).flat();for(let w of y)w.parent=d}else{let d=s.children[0];(d instanceof Va||d instanceof No||d instanceof fl||d instanceof dl)&&d.addDimensions(s.fields),d.swapWithParent(),Ag(s)}else s.children.map(Ag);var l}function Tg(s){if(s instanceof ia&&s.type===nn.Main&&s.numChildren()===1){let l=s.children[0];l instanceof cl||(l.swapWithParent(),Tg(s))}}let Cg="scale_",bp=5;function yp(s){for(let l of s){for(let d of l.children)if(d.parent!==l)return!1;if(!yp(l.children))return!1}return!0}function hi(s,l){let d=!1;for(let h of l)d=s.optimize(h)||d;return d}function iv(s,l,d){let h=s.sources,y=!1;return y=hi(new ys,h)||y,y=hi(new Sg(l),h)||y,h=h.filter((w=>w.numChildren()>0)),y=hi(new nv,h)||y,h=h.filter((w=>w.numChildren()>0)),d||(y=hi(new Jc,h)||y,y=hi(new rv(l),h)||y,y=hi(new tv,h)||y,y=hi(new gp,h)||y,y=hi(new av,h)||y,y=hi(new xg,h)||y,y=hi(new kg,h)||y,y=hi(new h1,h)||y),s.sources=h,y}class Ln{constructor(l){at(this,"signal",void 0),Object.defineProperty(this,"signal",{enumerable:!0,get:l})}static fromName(l,d){return new Ln((()=>l(d)))}}function ov(s){cn(s)?(function(l){let d=l.component.scales;for(let h of be(d)){let y=m1(l,h);if(d[h].setWithExplicit("domains",y),sv(l,h),l.component.data.isFaceted){let w=l;for(;!Ya(w)&&w.parent;)w=w.parent;if(w.component.resolve.scale[h]==="shared")for(let x of y.value)Aa(x)&&(x.data=Cg+x.data.replace(Cg,""))}}})(s):(function(l){for(let h of l.children)ov(h);let d=l.component.scales;for(let h of be(d)){let y,w=null;for(let x of l.children){let A=x.component.scales[h];if(A){y=y===void 0?A.getWithExplicit("domains"):qi(y,A.getWithExplicit("domains"),"domains","scale",td);let C=A.get("selectionExtent");w&&C&&w.param!==C.param&&Be(lr),w=C}}d[h].setWithExplicit("domains",y),w&&d[h].set("selectionExtent",w,!0)}})(s)}function m1(s,l){let d=s.getScaleComponent(l).get("type"),{encoding:h}=s,y=(function(w,x,A,C){if(w==="unaggregated"){let{valid:L,reason:G}=Ia(x,A);if(!L)return void Be(G)}else if(w===void 0&&C.useUnaggregatedDomain){let{valid:L}=Ia(x,A);if(L)return"unaggregated"}return w})(s.scaleDomain(l),s.typedFieldDef(l),d,s.config.scale);return y!==s.scaleDomain(l)&&(s.specifiedScales[l]={...s.specifiedScales[l],domain:y}),l==="x"&&vn(h.x2)?vn(h.x)?qi(vs(d,y,s,"x"),vs(d,y,s,"x2"),"domain","scale",td):vs(d,y,s,"x2"):l==="y"&&vn(h.y2)?vn(h.y)?qi(vs(d,y,s,"y"),vs(d,y,s,"y2"),"domain","scale",td):vs(d,y,s,"y2"):vs(d,y,s,l)}function Qc(s,l,d){var y;let h=(y=jn(d))==null?void 0:y.unit;return l==="temporal"||h?(function(w,x,A){return w.map((C=>({signal:`{data: ${iu(C,{timeUnit:A,type:x})}}`})))})(s,l,h):[s]}function vs(s,l,d,h){let{encoding:y,markDef:w,mark:x,config:A,stack:C}=d,L=vn(y[h]),{type:G}=L,H=L.timeUnit;if((function(le){return le==null?void 0:le.unionWith})(l)){let le=vs(s,void 0,d,h);return Hi([...Qc(l.unionWith,G,H),...le.value])}if(Ze(l))return Hi([l]);if(l&&l!=="unaggregated"&&!K0(l))return Hi(Qc(l,G,H));if(C&&h===C.fieldChannel){if(C.offset==="normalize")return Fr([[0,1]]);let le=d.requestDataName(nn.Main);return Fr([{data:le,field:d.vgField(h,{suffix:"start"})},{data:le,field:d.vgField(h,{suffix:"end"})}])}let X=Nr(h)&&ze(L)?(function(le,te,pe){if(!Hn(pe))return;let ge=le.fieldDef(te),xe=ge.sort;if(fc(xe))return{op:"min",field:sl(ge,te),order:"ascending"};let{stack:me}=le,Ae=me?new Set([...me.groupbyFields,...me.stackBy.map((Re=>Re.fieldDef.field))]):void 0;if(ii(xe))return ed(xe,me&&!Ae.has(xe.field));if(Zh(xe)){let{encoding:Re,order:Pe}=xe,We=le.fieldDef(Re),{aggregate:Je,field:it}=We,Qe=me&&!Ae.has(it);if(ei(Je)||Ni(Je))return ed({field:je(We),order:Pe},Qe);if(xn(Je)||!Je)return ed({op:Je,field:it,order:Pe},Qe)}else{if(xe==="descending")return{op:"min",field:le.vgField(te),order:"descending"};if(Z(["ascending",void 0],xe))return!0}})(d,h,s):void 0;if(Pi(L))return Fr(Qc([L.datum],G,H));let J=L;if(l==="unaggregated"){let le=d.requestDataName(nn.Main),{field:te}=L;return Fr([{data:le,field:je({field:te,aggregate:"min"})},{data:le,field:je({field:te,aggregate:"max"})}])}if(Vt(J.bin)){if(Hn(s))return Fr(s==="bin-ordinal"?[]:[{data:Ye(X)?d.requestDataName(nn.Main):d.requestDataName(nn.Raw),field:d.vgField(h,ou(J,h)?{binSuffix:"range"}:{}),sort:X!==!0&&b.isObject(X)?X:{field:d.vgField(h,{}),op:"min"}}]);{let{bin:le}=J;if(Vt(le)){let te=To(d,J.field,le);return Fr([new Ln((()=>{let pe=d.getSignalName(te);return`[${pe}.start, ${pe}.stop]`}))])}return Fr([{data:d.requestDataName(nn.Main),field:d.vgField(h,{})}])}}if(J.timeUnit&&Z(["time","utc"],s)){let le=y[Ci(h)];if(pf(J,le,w,A)){let te=d.requestDataName(nn.Main),pe=Fi({fieldDef:J,fieldDef2:le,markDef:w,config:A}),ge=cc(x)&&pe!==.5;return Fr([{data:te,field:d.vgField(h,ge?{suffix:Xf}:{})},{data:te,field:d.vgField(h,{suffix:ge?$t:"end"})}])}}return Fr(X?[{data:Ye(X)?d.requestDataName(nn.Main):d.requestDataName(nn.Raw),field:d.vgField(h),sort:X}]:[{data:d.requestDataName(nn.Main),field:d.vgField(h)}])}function ed(s,l){let{op:d,field:h,order:y}=s;return{op:d??(l?"sum":dc),...h?{field:jt(h)}:{},...y?{order:y}:{}}}function sv(s,l){var A;let d=s.component.scales[l],h=s.specifiedScales[l].domain,y=(A=s.fieldDef(l))==null?void 0:A.bin,w=K0(h)&&h,x=mo(y)&&Or(y.extent)&&y.extent;(w||x)&&d.set("selectionExtent",w??x,!0)}function Ia(s,l){let{aggregate:d,type:h}=s;return d?b.isString(d)&&!ho.has(d)?{valid:!1,reason:Nh(d)}:h==="quantitative"&&l==="log"?{valid:!1,reason:Ih(s)}:{valid:!0}:{valid:!1,reason:L0(s)}}function td(s,l,d,h){return s.explicit&&l.explicit&&Be((function(y,w,x,A){return`Conflicting ${w.toString()} property "${y.toString()}" (${Xe(x)} and ${Xe(A)}). Using the union of the two domains.`})(d,h,s.value,l.value)),{explicit:s.explicit,value:[...s.value,...l.value]}}function g1(s){let l=_e(s.map((x=>{if(Aa(x)){let{sort:A,...C}=x;return C}return x})),ne),d=_e(s.map((x=>{if(Aa(x)){let A=x.sort;return A===void 0||Ye(A)||("op"in A&&A.op==="count"&&delete A.field,A.order==="ascending"&&delete A.order),A}})).filter((x=>x!==void 0)),ne);if(l.length===0)return;if(l.length===1){let x=s[0];if(Aa(x)&&d.length>0){let A=d[0];if(d.length>1){Be(Dh);let C=d.filter((L=>b.isObject(L)&&"op"in L&&L.op!=="min"));A=!d.every((L=>b.isObject(L)&&"op"in L))||C.length!==1||C[0]}else if(b.isObject(A)&&"field"in A){let C=A.field;x.field===C&&(A=!A.order||{order:A.order})}return{...x,sort:A}}return x}let h=_e(d.map((x=>Ye(x)||!("op"in x)||b.isString(x.op)&&x.op in A0?x:(Be((function(A){return`Dropping sort property ${Xe(A)} as unioned domains only support boolean or op "count", "min", and "max".`})(x)),!0))),ne),y;h.length===1?y=h[0]:h.length>1&&(Be(Dh),y=!0);let w=_e(s.map((x=>Aa(x)?x.data:null)),(x=>x));return w.length===1&&w[0]!==null?{data:w[0],fields:l.map((x=>x.field)),...y?{sort:y}:{}}:{fields:l,...y?{sort:y}:{}}}function Rg(s){if(Aa(s)&&b.isString(s.field))return s.field;if((function(l){return!b.isArray(l)&&"fields"in l&&!("data"in l)})(s)){let l;for(let d of s.fields)if(Aa(d)&&b.isString(d.field))if(l){if(l!==d.field)return Be("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."),l}else l=d.field;return Be("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."),l}if((function(l){return!b.isArray(l)&&"fields"in l&&"data"in l})(s)){Be("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.");let l=s.fields[0];return b.isString(l)?l:void 0}}function Es(s,l){let d=s.component.scales[l].get("domains").map((h=>(Aa(h)&&(h.data=s.lookupDataSource(h.data)),h)));return g1(d)}function nd(s){return ws(s)||Ji(s)?s.children.reduce(((l,d)=>l.concat(nd(d))),Ng(s)):Ng(s)}function Ng(s){return be(s.component.scales).reduce(((l,d)=>{let h=s.component.scales[d];if(h.merged)return l;let y=h.combine(),{name:w,type:x,selectionExtent:A,domains:C,range:L,reverse:G,...H}=y,X=(function(te,pe,ge,xe){if(un(ge)){if(go(te))return{step:{signal:`${pe}_step`}}}else if(b.isObject(te)&&Aa(te))return{...te,data:xe.lookupDataSource(te.data)};return te})(y.range,w,d,s),J=Es(s,d),le=A?(function(te,pe,ge,xe){let me=So(te,pe.param,pe);return{signal:Ha(ge.get("type"))&&b.isArray(xe)&&xe[0]>xe[1]?`isValid(${me}) && reverse(${me})`:me}})(s,A,h,J):null;return l.push({name:w,type:x,...J?{domain:J}:{},...le?{domainRaw:le}:{},range:X,...G!==void 0?{reverse:G}:{},...H}),l}),[])}class Ig extends ji{constructor(l,d){super({},{name:l}),at(this,"merged",!1),this.setWithExplicit("type",d)}domainDefinitelyIncludesZero(){return this.get("zero")!==!1||ae(this.get("domains"),(l=>b.isArray(l)&&l.length===2&&b.isNumber(l[0])&&l[0]<=0&&b.isNumber(l[1])&&l[1]>=0))}}let pl=["range","scheme"];function Og(s,l){let d=s.fieldDef(l);if(d!=null&&d.bin){let{bin:h,field:y}=d,w=xa(l),x=s.getName(w);if(b.isObject(h)&&h.binned&&h.step!==void 0)return new Ln((()=>{let A=s.scaleName(l),C=`(domain("${A}")[1] - domain("${A}")[0]) / ${h.step}`;return`${s.getSignalName(x)} / (${C})`}));if(Vt(h)){let A=To(s,y,h);return new Ln((()=>{let C=s.getSignalName(A),L=`(${C}.stop - ${C}.start) / ${C}.step`;return`${s.getSignalName(x)} / (${L})`}))}}}function lv(s,l){let d=l.specifiedScales[s],{size:h}=l,y=l.getScaleComponent(s).get("type");for(let G of pl)if(d[G]!==void 0){let H=Bh(y,G),X=X0(s,G);if(H)if(X)Be(X);else switch(G){case"range":{let J=d.range;if(b.isArray(J)){if(un(s))return Hi(J.map((le=>{if(le==="width"||le==="height"){let te=l.getName(le),pe=l.getSignalName.bind(l);return Ln.fromName(pe,te)}return le})))}else if(b.isObject(J))return Hi({data:l.requestDataName(nn.Main),field:J.field,sort:{op:"min",field:l.vgField(s)}});return Hi(J)}case"scheme":return Hi(uv(d[G]))}else Be(F0(y,G,s))}let w=s===Qt||s==="xOffset"?"width":"height",x=h[w];if(qa(x)){if(un(s))if(Hn(y)){let G=dv(x,l,s);if(G)return Hi({step:G})}else Be(Oh(w));else if(Qn(s)){let G=s===mn?"x":"y";if(l.getScaleComponent(G).get("type")==="band"){let H=fv(x,y);if(H)return Hi(H)}}}let{rangeMin:A,rangeMax:C}=d,L=(function(G,H){let{size:X,config:J,mark:le,encoding:te}=H,{type:pe}=vn(te[G]),ge=H.getScaleComponent(G),xe=ge.get("type"),{domain:me,domainMid:Ae}=H.specifiedScales[G];switch(G){case Qt:case Bn:if(Z(["point","band"],xe)){let Re=Dg(G,X,J.view);if(qa(Re))return{step:dv(Re,H,G)}}return cv(G,H,xe);case mn:case Zo:return(function(Re,Pe,We){let Je=Re===mn?"x":"y",it=Pe.getScaleComponent(Je);if(!it)return cv(Je,Pe,We,{center:!0});let Qe=it.get("type"),lt=Pe.scaleName(Je),{markDef:kt,config:Fn}=Pe;if(Qe==="band"){let dn=Dg(Je,Pe.size,Pe.config.view);if(qa(dn)){let sn=fv(dn,We);if(sn)return sn}return[0,{signal:`bandwidth('${lt}')`}]}{let dn=Pe.encoding[Je];if(ze(dn)&&dn.timeUnit){let sn=H0(dn.timeUnit,(Nn=>`scale('${lt}', ${Nn})`)),Ut=Pe.config.scale.bandWithNestedOffsetPaddingInner,Dt=Fi({fieldDef:dn,markDef:kt,config:Fn})-.5,En=Dt!==0?` + ${Dt}`:"";return Ut?[{signal:`${Ze(Ut)?`${Ut.signal}/2`+En:`${Ut/2+Dt}`} * (${sn})`},{signal:`${Ze(Ut)?`(1 - ${Ut.signal}/2)`+En:`${1-Ut/2+Dt}`} * (${sn})`}]:[0,{signal:sn}]}return W(`Cannot use ${Re} scale if ${Je} scale is not discrete.`)}})(G,H,xe);case Si:{let Re=vp(le,H.component.scales[G].get("zero"),J),Pe=(function(We,Je,it,Qe){let lt={x:Og(it,"x"),y:Og(it,"y")};switch(We){case"bar":case"tick":{if(Qe.scale.maxBandSize!==void 0)return Qe.scale.maxBandSize;let kt=Lg(Je,lt,Qe.view);return b.isNumber(kt)?kt-1:new Ln((()=>`${kt.signal} - 1`))}case"line":case"trail":case"rule":return Qe.scale.maxStrokeWidth;case"text":return Qe.scale.maxFontSize;case"point":case"square":case"circle":{if(Qe.scale.maxSize)return Qe.scale.maxSize;let kt=Lg(Je,lt,Qe.view);return b.isNumber(kt)?Math.pow(Mg*kt,2):new Ln((()=>`pow(${Mg} * ${kt.signal}, 2)`))}}throw new Error(Mi("size",We))})(le,X,H,J);return Zl(xe)?(function(We,Je,it){let Qe=()=>{let lt=pa(Je),kt=pa(We),Fn=`(${lt} - ${kt}) / (${it} - 1)`;return`sequence(${kt}, ${lt} + ${Fn}, ${Fn})`};return Ze(Je)?new Ln(Qe):{signal:Qe()}})(Re,Pe,(function(We,Je,it,Qe){switch(We){case"quantile":return Je.scale.quantileCount;case"quantize":return Je.scale.quantizeCount;case"threshold":return it!==void 0&&b.isArray(it)?it.length+1:(Be((function(lt){return`Domain for ${lt} is required for threshold scale.`})(Qe)),3)}})(xe,J,me,G)):[Re,Pe]}case ar:return[0,2*Math.PI];case Ba:return[0,360];case mt:return[0,new Ln((()=>`min(${H.getSignalName("width")},${H.getSignalName("height")})/2`))];case fo:return[J.scale.minStrokeWidth,J.scale.maxStrokeWidth];case Jo:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Sn:return"symbol";case Fe:case Sa:case Zr:return xe==="ordinal"?pe==="nominal"?"category":"ordinal":Ae!==void 0?"diverging":le==="rect"||le==="geoshape"?"heatmap":"ramp";case xi:case Ft:case Ai:return[J.scale.minOpacity,J.scale.maxOpacity]}})(s,l);return(A!==void 0||C!==void 0)&&Bh(y,"rangeMin")&&b.isArray(L)&&L.length===2?Hi([A??L[0],C??L[1]]):Fr(L)}function uv(s){return(function(l){return!b.isString(l)&&!!l.name})(s)?{scheme:s.name,...ee(s,["name"])}:{scheme:s}}function cv(s,l,d){let{center:h}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},y=xa(s),w=l.getName(y),x=l.getSignalName.bind(l);return s===Bn&&Ha(d)?h?[Ln.fromName((A=>`${x(A)}/2`),w),Ln.fromName((A=>`-${x(A)}/2`),w)]:[Ln.fromName(x,w),0]:h?[Ln.fromName((A=>`-${x(A)}/2`),w),Ln.fromName((A=>`${x(A)}/2`),w)]:[0,Ln.fromName(x,w)]}function dv(s,l,d){let{encoding:h}=l,y=l.getScaleComponent(d),w=Ul(d),x=h[w];if(Mf({step:s,offsetIsDiscrete:_t(x)&&Yl(x.type)})==="offset"&&vo(h,w)){let C=l.getScaleComponent(w),L=`domain('${l.scaleName(w)}').length`;C.get("type")==="band"&&(L=`bandspace(${L}, ${C.get("paddingInner")??C.get("padding")??0}, ${C.get("paddingOuter")??C.get("padding")??0})`);let G=y.get("paddingInner")??y.get("padding");return{signal:`${s.step} * ${L} / (1-${A=G,Ze(A)?A.signal:b.stringValue(A)})`}}return s.step;var A}function fv(s,l){if(Mf({step:s,offsetIsDiscrete:Hn(l)})==="offset")return{step:s.step}}function Dg(s,l,d){let h=s===Qt?"width":"height";return l[h]||Ac(d,h)}function vp(s,l,d){if(l)return Ze(l)?{signal:`${l.signal} ? 0 : ${vp(s,!1,d)}`}:0;switch(s){case"bar":case"tick":return d.scale.minBandSize;case"line":case"trail":case"rule":return d.scale.minStrokeWidth;case"text":return d.scale.minFontSize;case"point":case"square":case"circle":return d.scale.minSize}throw new Error(Mi("size",s))}let Mg=.95;function Lg(s,l,d){let h=qa(s.width)?s.width.step:fu(d,"width"),y=qa(s.height)?s.height.step:fu(d,"height");return l.x||l.y?new Ln((()=>`min(${[l.x?l.x.signal:h,l.y?l.y.signal:y].join(", ")})`)):Math.min(h,y)}function Ep(s,l){cn(s)?(function(d,h){let y=d.component.scales,{config:w,encoding:x,markDef:A,specifiedScales:C}=d;for(let L of be(y)){let G=C[L],H=y[L],X=d.getScaleComponent(L),J=vn(x[L]),le=G[h],te=X.get("type"),pe=X.get("padding"),ge=X.get("paddingInner"),xe=Bh(te,h),me=X0(L,h);if(le!==void 0&&(xe?me&&Be(me):Be(F0(te,h,L))),xe&&me===void 0)if(le!==void 0){let Ae=J.timeUnit,Re=J.type;switch(h){case"domainMax":case"domainMin":Gs(G[h])||Re==="temporal"||Ae?H.set(h,{signal:iu(G[h],{type:Re,timeUnit:Ae})},!0):H.set(h,G[h],!0);break;default:H.copyKeyFromObject(h,G)}}else{let Ae=h in Fg?Fg[h]({model:d,channel:L,fieldOrDatumDef:J,scaleType:te,scalePadding:pe,scalePaddingInner:ge,domain:G.domain,domainMin:G.domainMin,domainMax:G.domainMax,markDef:A,config:w,hasNestedOffsetScale:cy(x,L),hasSecondaryRangeChannel:!!x[Ci(L)]}):w.scale[h];Ae!==void 0&&H.set(h,Ae,!1)}}})(s,l):hv(s,l)}let Fg={bins:s=>{let{model:l,fieldOrDatumDef:d}=s;return ze(d)?(function(h,y){let w=y.bin;if(Vt(w)){let x=To(h,y.field,w);return new Ln((()=>h.getSignalName(x)))}if(zn(w)&&mo(w)&&w.step!==void 0)return{step:w.step}})(l,d):void 0},interpolate:s=>{let{channel:l,fieldOrDatumDef:d}=s;return(function(h,y){if(Z([Fe,Sa,Zr],h)&&y!=="nominal")return"hcl"})(l,d.type)},nice:s=>{let{scaleType:l,channel:d,domain:h,domainMin:y,domainMax:w,fieldOrDatumDef:x}=s;return(function(A,C,L,G,H,X){var J;if(!((J=dr(X))!=null&&J.bin||b.isArray(L)||H!=null||G!=null||Z([Gt.TIME,Gt.UTC],A)))return!!un(C)||void 0})(l,d,h,y,w,x)},padding:s=>{let{channel:l,scaleType:d,fieldOrDatumDef:h,markDef:y,config:w}=s;return(function(x,A,C,L,G,H){if(un(x)){if(Lr(A)){if(C.continuousPadding!==void 0)return C.continuousPadding;let{type:X,orient:J}=G;if(X==="bar"&&(!ze(L)||!L.bin&&!L.timeUnit)&&(J==="vertical"&&x==="x"||J==="horizontal"&&x==="y"))return H.continuousBandSize}if(A===Gt.POINT)return C.pointPadding}})(l,d,w.scale,h,y,w.bar)},paddingInner:s=>{let{scalePadding:l,channel:d,markDef:h,scaleType:y,config:w,hasNestedOffsetScale:x}=s;return(function(A,C,L,G,H){let X=arguments.length>5&&arguments[5]!==void 0&&arguments[5];if(A===void 0){if(un(C)){let{bandPaddingInner:J,barBandPaddingInner:le,rectBandPaddingInner:te,bandWithNestedOffsetPaddingInner:pe}=H;return X?pe:Ke(J,L==="bar"?le:te)}if(Qn(C)&&G===Gt.BAND)return H.offsetBandPaddingInner}})(l,d,h.type,y,w.scale,x)},paddingOuter:s=>{let{scalePadding:l,channel:d,scaleType:h,scalePaddingInner:y,config:w,hasNestedOffsetScale:x}=s;return(function(A,C,L,G,H){let X=arguments.length>5&&arguments[5]!==void 0&&arguments[5];if(A===void 0){if(un(C)){let{bandPaddingOuter:J,bandWithNestedOffsetPaddingOuter:le}=H;if(X)return le;if(L===Gt.BAND)return Ke(J,Ze(G)?{signal:`${G.signal}/2`}:G/2)}else if(Qn(C)){if(L===Gt.POINT)return .5;if(L===Gt.BAND)return H.offsetBandPaddingOuter}}})(l,d,h,y,w.scale,x)},reverse:s=>{let{fieldOrDatumDef:l,scaleType:d,channel:h,config:y}=s;return(function(w,x,A,C){if(A==="x"&&C.xReverse!==void 0)return Ha(w)&&x==="descending"?Ze(C.xReverse)?{signal:`!${C.xReverse.signal}`}:!C.xReverse:C.xReverse;if(Ha(w)&&x==="descending")return!0})(d,ze(l)?l.sort:void 0,h,y.scale)},zero:s=>{let{channel:l,fieldOrDatumDef:d,domain:h,markDef:y,scaleType:w,config:x,hasSecondaryRangeChannel:A}=s;return(function(C,L,G,H,X,J,le){if(G&&G!=="unaggregated"&&Ha(X)){if(b.isArray(G)){let te=G[0],pe=G[G.length-1];if(b.isNumber(te)&&te<=0&&b.isNumber(pe)&&pe>=0)return!0}return!1}if(C==="size"&&L.type==="quantitative"&&!Zl(X))return!0;if((!ze(L)||!L.bin)&&Z([...Qr,...w0],C)){let{orient:te,type:pe}=H;return(!Z(["bar","area","line","trail"],pe)||!(te==="horizontal"&&C==="y"||te==="vertical"&&C==="x"))&&(!(!Z(["bar","area"],pe)||le)||(J==null?void 0:J.zero))}return!1})(l,d,h,y,w,x.scale,A)}};function pv(s){cn(s)?(function(l){let d=l.component.scales;for(let h of Gl){let y=d[h];if(!y)continue;let w=lv(h,l);y.setWithExplicit("range",w)}})(s):hv(s,"range")}function hv(s,l){let d=s.component.scales;for(let h of s.children)l==="range"?pv(h):Ep(h,l);for(let h of be(d)){let y;for(let w of s.children){let x=w.component.scales[h];x&&(y=qi(y,x.getWithExplicit(l),l,"scale",Ay(((A,C)=>l==="range"&&A.step&&C.step?A.step-C.step:0))))}d[h].setWithExplicit(l,y)}}function Pg(s,l,d,h){let y=(function(C,L,G,H){var X;switch(L.type){case"nominal":case"ordinal":if(es(C)||$d(C)==="discrete")return C==="shape"&&L.type==="ordinal"&&Be(qd(C,"ordinal")),"ordinal";if(un(C)||Qn(C)){if(Z(["rect","bar","image","rule"],G.type)||H)return"band"}else if(G.type==="arc"&&C in Qu)return"band";return Ys(G[xa(C)])||nu(L)&&((X=L.axis)!=null&&X.tickBand)?"band":"point";case"temporal":return es(C)?"time":$d(C)==="discrete"?(Be(qd(C,"temporal")),"ordinal"):ze(L)&&L.timeUnit&&jn(L.timeUnit).utc?"utc":"time";case"quantitative":return es(C)?ze(L)&&Vt(L.bin)?"bin-ordinal":"linear":$d(C)==="discrete"?(Be(qd(C,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(jd(L.type))})(l,d,h,arguments.length>4&&arguments[4]!==void 0&&arguments[4]),{type:w}=s;return Nr(l)?w!==void 0?(function(C,L){let G=arguments.length>2&&arguments[2]!==void 0&&arguments[2];if(!Nr(C))return!1;switch(C){case Qt:case Bn:case mn:case Zo:case ar:case mt:return!!Lr(L)||L==="band"||L==="point"&&!G;case Si:case fo:case xi:case Ft:case Ai:case Ba:return Lr(L)||Zl(L)||Z(["band","point","ordinal"],L);case Fe:case Sa:case Zr:return L!=="band";case Jo:case Sn:return L==="ordinal"||Zl(L)}})(l,w)?ze(d)&&(x=w,A=d.type,!(Z([tf,nf],A)?x===void 0||Hn(x):A===rs?Z([Gt.TIME,Gt.UTC,void 0],x):A!==bo||V0(x)||Zl(x)||x===void 0))?(Be((function(C,L){return`FieldDef does not work with "${C}" scale. We are using "${L}" scale instead.`})(w,y)),y):w:(Be((function(C,L,G){return`Channel "${C}" does not work with "${L}" scale. We are using "${G}" scale instead.`})(l,w,y)),y):y:null;var x,A}function wp(s){cn(s)?s.component.scales=(function(l){let{encoding:d,mark:h,markDef:y}=l,w={};for(let x of Gl){let A=vn(d[x]);if(A&&h===J0&&x===Sn&&A.type===Vs)continue;let C=A&&A.scale;if(A&&C!==null&&C!==!1){C??={};let L=Pg(C,x,A,y,cy(d,x));w[x]=new Ig(l.scaleName(`${x}`,!0),{value:L,explicit:C.type===L})}}return w})(s):s.component.scales=(function(l){let d=l.component.scales={},h={},y=l.component.resolve;for(let w of l.children){wp(w);for(let x of be(w.component.scales))if(y.scale[x]??=dg(x,l),y.scale[x]==="shared"){let A=h[x],C=w.component.scales[x].getWithExplicit("type");A?O_(A.value,C.value)?h[x]=qi(A,C,"type","scale",b1):(y.scale[x]="independent",delete h[x]):h[x]=C}}for(let w of be(h)){let x=l.scaleName(w,!0),A=h[w];d[w]=new Ig(x,A);for(let C of l.children){let L=C.component.scales[w];L&&(C.renameScale(L.get("name"),x),L.merged=!0)}}return d})(s)}let b1=Ay(((s,l)=>W0(s)-W0(l)));class $g{constructor(){at(this,"nameMap",void 0),this.nameMap={}}rename(l,d){this.nameMap[l]=d}has(l){return this.nameMap[l]!==void 0}get(l){for(;this.nameMap[l]&&l!==this.nameMap[l];)l=this.nameMap[l];return l}}function cn(s){return(s==null?void 0:s.type)==="unit"}function Ya(s){return(s==null?void 0:s.type)==="facet"}function Ji(s){return(s==null?void 0:s.type)==="concat"}function ws(s){return(s==null?void 0:s.type)==="layer"}class ad{constructor(l,d,h,y,w,x,A){this.type=d,this.parent=h,this.config=w,at(this,"name",void 0),at(this,"size",void 0),at(this,"title",void 0),at(this,"description",void 0),at(this,"data",void 0),at(this,"transforms",void 0),at(this,"layout",void 0),at(this,"scaleNameMap",void 0),at(this,"projectionNameMap",void 0),at(this,"signalNameMap",void 0),at(this,"component",void 0),at(this,"view",void 0),at(this,"children",void 0),at(this,"correctDataNames",(C=>{var L,G,H;return(L=C.from)!=null&&L.data&&(C.from.data=this.lookupDataSource(C.from.data)),(H=(G=C.from)==null?void 0:G.facet)!=null&&H.data&&(C.from.facet.data=this.lookupDataSource(C.from.facet.data)),C})),this.parent=h,this.config=w,this.view=ea(A),this.name=l.name??y,this.title=fa(l.title)?{text:l.title}:l.title?ea(l.title):void 0,this.scaleNameMap=h?h.scaleNameMap:new $g,this.projectionNameMap=h?h.projectionNameMap:new $g,this.signalNameMap=h?h.signalNameMap:new $g,this.data=l.data,this.description=l.description,this.transforms=(l.transform??[]).map((C=>Nm(C)?{filter:F(C.filter,lc)}:C)),this.layout=d==="layer"||d==="unit"?{}:(function(C,L,G){let H=G[L],X={},{spacing:J,columns:le}=H;J!==void 0&&(X.spacing=J),le!==void 0&&(pc(C)&&!Ql(C.facet)||kc(C))&&(X.columns=le),du(C)&&(X.columns=1);for(let te of xc)if(C[te]!==void 0)if(te==="spacing"){let pe=C[te];X[te]=b.isNumber(pe)?pe:{row:pe.row??J,column:pe.column??J}}else X[te]=C[te];return X})(l,d,w),this.component={data:{sources:h?h.component.data.sources:[],outputNodes:h?h.component.data.outputNodes:{},outputNodeRefCounts:h?h.component.data.outputNodeRefCounts:{},isFaceted:pc(l)||(h==null?void 0:h.component.data.isFaceted)&&l.data===void 0},layoutSize:new ji,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...x?j(x):{}},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(l){let{ignoreRange:d}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};wp(l),ov(l);for(let h of $_)Ep(l,h);d||pv(l)})(this)}parseProjection(){wg(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){up(this)}assembleEncodeFromView(l){let{style:d,...h}=l,y={};for(let w of be(h)){let x=h[w];x!==void 0&&(y[w]=on(x))}return y}assembleGroupEncodeEntry(l){let d={};return this.view&&(d=this.assembleEncodeFromView(this.view)),l||(this.description&&(d.description=on(this.description)),this.type!=="unit"&&this.type!=="layer")?ye(d)?void 0:d:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...d??{}}}assembleLayout(){if(!this.layout)return;let{spacing:l,...d}=this.layout,{component:h,config:y}=this,w=(function(x,A){let C={};for(let L of Ua){let G=x[L];if(G!=null&&G.facetFieldDef){let{titleAnchor:H,titleOrient:X}=Uc(["titleAnchor","titleOrient"],G.facetFieldDef.header,A,L),J=Bc(L,X),le=Xy(H,J);le!==void 0&&(C[J]=le)}}return ye(C)?void 0:C})(h.layoutHeaders,y);return{padding:l,...this.assembleDefaultLayout(),...d,...w?{titleBand:w}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){let{layoutHeaders:l}=this.component,d=[];for(let h of Ua)l[h].title&&d.push(bs(this,h));for(let h of _u)d=d.concat(Yy(this,h));return d}assembleAxes(){return(function(l,d){let{x:h=[],y=[]}=l;return[...h.map((w=>Xi(w,"grid",d))),...y.map((w=>Xi(w,"grid",d))),...h.map((w=>Xi(w,"main",d))),...y.map((w=>Xi(w,"main",d)))].filter((w=>w))})(this.component.axes,this.config)}assembleLegends(){return dp(this)}assembleProjections(){return vg(this)}assembleTitle(){let{encoding:l,...d}=this.title??{},h={...ac(this.config.title).nonMarkTitleProperties,...d,...l?{encode:{update:l}}:{}};if(h.text)return Z(["unit","layer"],this.type)?Z(["middle",void 0],h.anchor)&&(h.frame??="group"):h.anchor??="start",ye(h)?void 0:h}assembleGroup(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],d={};l=l.concat(this.assembleSignals()),l.length>0&&(d.signals=l);let h=this.assembleLayout();h&&(d.layout=h),d.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());let y=!this.parent||Ya(this.parent)?nd(this):[];y.length>0&&(d.scales=y);let w=this.assembleAxes();w.length>0&&(d.axes=w);let x=this.assembleLegends();return x.length>0&&(d.legends=x),d}getName(l){return $e((this.name?`${this.name}_`:"")+l)}getDataName(l){return this.getName(nn[l].toLowerCase())}requestDataName(l){let d=this.getDataName(l),h=this.component.data.outputNodeRefCounts;return h[d]=(h[d]||0)+1,d}getSizeSignalRef(l){if(Ya(this.parent)){let d=ec(ug(l)),h=this.component.scales[d];if(h&&!h.merged){let y=h.get("type"),w=h.get("range");if(Hn(y)&&go(w)){let x=h.get("name"),A=Rg(Es(this,d));return A?{signal:op(x,h,je({aggregate:"distinct",field:A},{expr:"datum"}))}:(Be(ha(d)),null)}}}return{signal:this.signalNameMap.get(this.getName(l))}}lookupDataSource(l){let d=this.component.data.outputNodes[l];return d?d.getSource():l}getSignalName(l){return this.signalNameMap.get(l)}renameSignal(l,d){this.signalNameMap.rename(l,d)}renameScale(l,d){this.scaleNameMap.rename(l,d)}renameProjection(l,d){this.projectionNameMap.rename(l,d)}scaleName(l,d){return d?this.getName(l):b0(l)&&Nr(l)&&this.component.scales[l]||this.scaleNameMap.has(this.getName(l))?this.scaleNameMap.get(this.getName(l)):void 0}projectionName(l){return l?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(l){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");let d=this.component.scales[l];return d&&!d.merged?d:this.parent?this.parent.getScaleComponent(l):void 0}getSelectionComponent(l,d){let h=this.component.selection[l];if(!h&&this.parent&&(h=this.parent.getSelectionComponent(l,d)),!h)throw new Error((function(y){return`Cannot find a selection named "${y}".`})(d));return h}hasAxisOrientSignalRef(){var l,d;return((l=this.component.axes.x)==null?void 0:l.some((h=>h.hasOrientSignalRef())))||((d=this.component.axes.y)==null?void 0:d.some((h=>h.hasOrientSignalRef())))}}class rd extends ad{vgField(l){let d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=this.fieldDef(l);if(h)return je(h,d)}reduceFieldDef(l,d){return(function(h,y,w,x){return h?be(h).reduce(((A,C)=>{let L=h[C];return b.isArray(L)?L.reduce(((G,H)=>y.call(x,G,H,C)),A):y.call(x,A,L,C)}),w):w})(this.getMapping(),((h,y,w)=>{let x=dr(y);return x?l(h,x,w):h}),d)}forEachFieldDef(l,d){bc(this.getMapping(),((h,y)=>{let w=dr(h);w&&l(w,y)}),d)}}class ku extends qt{clone(){return new ku(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??"value",h[1]??"density"]}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${ne(this.transform)}`}assemble(){let{density:l,...d}=this.transform,h={type:"kde",field:l,...d};return this.transform.groupby&&(h.resolve="shared"),h}}class Su extends qt{clone(){return new Su(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${ne(this.transform)}`}assemble(){let{extent:l,param:d}=this.transform;return{type:"extent",field:l,signal:d}}}class Qi extends qt{clone(){return new Qi(null,{...this.filter})}constructor(l,d){super(l),this.filter=d}static make(l,d){let{config:h,mark:y,markDef:w}=d;if(Ht("invalid",w,h)!=="filter")return null;let x=d.reduceFieldDef(((A,C,L)=>{let G=Nr(L)&&d.getScaleComponent(L);return G&&Ha(G.get("type"))&&C.aggregate!=="count"&&!is(y)&&(A[C.field]=C),A}),{});return be(x).length?new Qi(l,x):null}dependentFields(){return new Set(be(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${ne(this.filter)}`}assemble(){let l=be(this.filter).reduce(((d,h)=>{let y=this.filter[h],w=je(y,{expr:"datum"});return y!==null&&(y.type==="temporal"?d.push(`(isDate(${w}) || (isValid(${w}) && isFinite(+${w})))`):y.type==="quantitative"&&(d.push(`isValid(${w})`),d.push(`isFinite(+${w})`))),d}),[]);return l.length>0?{type:"filter",expr:l.join(" && ")}:null}}class Pr extends qt{clone(){return new Pr(this.parent,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let{flatten:h,as:y=[]}=this.transform;this.transform.as=h.map(((w,x)=>y[x]??w))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${ne(this.transform)}`}assemble(){let{flatten:l,as:d}=this.transform;return{type:"flatten",fields:l,as:d}}}class _s extends qt{clone(){return new _s(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??"key",h[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${ne(this.transform)}`}assemble(){let{fold:l,as:d}=this.transform;return{type:"fold",fields:l,as:d}}}class eo extends qt{clone(){return new eo(null,j(this.fields),this.geojson,this.signal)}static parseAll(l,d){if(d.component.projection&&!d.component.projection.isFit)return l;let h=0;for(let y of[[$a,nt],[rr,da]]){let w=y.map((x=>{let A=vn(d.encoding[x]);return ze(A)?A.field:Pi(A)?{expr:`${A.datum}`}:cr(A)?{expr:`${A.value}`}:void 0}));(w[0]||w[1])&&(l=new eo(l,w,null,d.getName("geojson_"+h++)))}if(d.channelHasField(Sn)){let y=d.typedFieldDef(Sn);y.type===Vs&&(l=new eo(l,null,y.field,d.getName("geojson_"+h++)))}return l}constructor(l,d,h,y){super(l),this.fields=d,this.geojson=h,this.signal=y}dependentFields(){let l=(this.fields??[]).filter(b.isString);return new Set([...this.geojson?[this.geojson]:[],...l])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${ne(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class ks extends qt{clone(){return new ks(null,this.projection,j(this.fields),j(this.as))}constructor(l,d,h,y){super(l),this.projection=d,this.fields=h,this.as=y}static parseAll(l,d){if(!d.projectionName())return l;for(let h of[[$a,nt],[rr,da]]){let y=h.map((x=>{let A=vn(d.encoding[x]);return ze(A)?A.field:Pi(A)?{expr:`${A.datum}`}:cr(A)?{expr:`${A.value}`}:void 0})),w=h[0]===rr?"2":"";(y[0]||y[1])&&(l=new ks(l,d.projectionName(),y,[d.getName(`x${w}`),d.getName(`y${w}`)]))}return l}dependentFields(){return new Set(this.fields.filter(b.isString))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${ne(this.fields)} ${ne(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class hr extends qt{clone(){return new hr(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(l){let{start:d=0,stop:h,step:y}=l;return{signal:`sequence(${[d,h,...y?[y]:[]].join(",")})`}}static makeFromTransform(l,d){return new hr(l,d)}static makeFromEncoding(l,d){let h=d.encoding,y=h.x,w=h.y;if(ze(y)&&ze(w)){let x=y.impute?y:w.impute?w:void 0;if(x===void 0)return;let A=y.impute?w:w.impute?y:void 0,{method:C,value:L,frame:G,keyvals:H}=x.impute,X=im(d.mark,h);return new hr(l,{impute:x.field,key:A.field,...C?{method:C}:{},...L!==void 0?{value:L}:{},...G?{frame:G}:{},...H!==void 0?{keyvals:H}:{},...X.length?{groupby:X}:{}})}return null}hash(){return`Impute ${ne(this.transform)}`}assemble(){let{impute:l,key:d,keyvals:h,method:y,groupby:w,value:x,frame:A=[null,null]}=this.transform,C={type:"impute",field:l,key:d,...h?{keyvals:(L=h,(L==null?void 0:L.stop)!==void 0?this.processSequence(h):h)}:{},method:"value",...w?{groupby:w}:{},value:y&&y!=="value"?null:x};var L;return y&&y!=="value"?[C,{type:"window",as:[`imputed_${l}_value`],ops:[y],fields:[l],frame:A,ignorePeers:!1,...w?{groupby:w}:{}},{type:"formula",expr:`datum.${l} === null ? datum.imputed_${l}_value : datum.${l}`,as:l}]:[C]}}class to extends qt{clone(){return new to(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??d.on,h[1]??d.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${ne(this.transform)}`}assemble(){let{loess:l,on:d,...h}=this.transform;return{type:"loess",x:d,y:l,...h}}}class Ka extends qt{clone(){return new Ka(null,j(this.transform),this.secondary)}constructor(l,d,h){super(l),this.transform=d,this.secondary=h}static make(l,d,h,y){let w=d.component.data.sources,{from:x}=h,A=null;if((function(C){return"data"in C})(x)){let C=Ug(x.data,w);C||(C=new Ro(x.data),w.push(C));let L=d.getName(`lookup_${y}`);A=new ia(C,L,nn.Lookup,d.component.data.outputNodeRefCounts),d.component.data.outputNodes[L]=A}else if((function(C){return"param"in C})(x)){let C=x.param,L;h={as:C,...h};try{L=d.getSelectionComponent($e(C),C)}catch{throw new Error((function(H){return`Lookups can only be performed on selection parameters. "${H}" is a variable parameter.`})(C))}if(A=L.materialized,!A)throw new Error((function(G){return`Cannot define and lookup the "${G}" selection in the same view. Try moving the lookup into a second, layered view?`})(C))}return new Ka(l,h,A.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?b.array(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${ne({transform:this.transform,secondary:this.secondary})}`}assemble(){let l;if(this.transform.from.fields)l={values:this.transform.from.fields,...this.transform.as?{as:b.array(this.transform.as)}:{}};else{let d=this.transform.as;b.isString(d)||(Be('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.'),d="_lookup"),l={as:[d]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...l,...this.transform.default?{default:this.transform.default}:{}}}}class Io extends qt{clone(){return new Io(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??"prob",h[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${ne(this.transform)}`}assemble(){let{quantile:l,...d}=this.transform;return{type:"quantile",field:l,...d}}}class Oo extends qt{clone(){return new Oo(null,j(this.transform))}constructor(l,d){super(l),this.transform=d,this.transform=j(d);let h=this.transform.as??[void 0,void 0];this.transform.as=[h[0]??d.on,h[1]??d.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${ne(this.transform)}`}assemble(){let{regression:l,on:d,...h}=this.transform;return{type:"regression",x:d,y:l,...h}}}class hl extends qt{clone(){return new hl(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}addDimensions(l){this.transform.groupby=_e((this.transform.groupby??[]).concat(l),(d=>d))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${ne(this.transform)}`}assemble(){let{pivot:l,value:d,groupby:h,limit:y,op:w}=this.transform;return{type:"pivot",field:l,value:d,...y!==void 0?{limit:y}:{},...w!==void 0?{op:w}:{},...h!==void 0?{groupby:h}:{}}}}class ml extends qt{clone(){return new ml(null,j(this.transform))}constructor(l,d){super(l),this.transform=d}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${ne(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function _p(s){let l=0;return function d(h,y){if(h instanceof Ro&&!h.isGenerator&&!fs(h.data)&&(s.push(y),y={name:null,source:y.name,transform:[]}),h instanceof Kn&&(h.parent instanceof Ro&&!y.source?(y.format={...y.format??{},parse:h.assembleFormatParse()},y.transform.push(...h.assembleTransforms(!0))):y.transform.push(...h.assembleTransforms())),h instanceof cl)return y.name||(y.name="data_"+l++),!y.source||y.transform.length>0?(s.push(y),h.data=y.name):h.data=y.source,void s.push(...h.assemble());switch((h instanceof Kc||h instanceof Xc||h instanceof Qi||h instanceof ci||h instanceof ol||h instanceof ks||h instanceof Va||h instanceof Ka||h instanceof fl||h instanceof dl||h instanceof _s||h instanceof Pr||h instanceof ku||h instanceof to||h instanceof Io||h instanceof Oo||h instanceof Co||h instanceof ml||h instanceof hl||h instanceof Su)&&y.transform.push(h.assemble()),(h instanceof pi||h instanceof Wi||h instanceof hr||h instanceof No||h instanceof eo)&&y.transform.push(...h.assemble()),h instanceof ia&&(y.source&&y.transform.length===0?h.setSource(y.source):h.parent instanceof ia?h.setSource(y.name):(y.name||(y.name="data_"+l++),h.setSource(y.name),h.numChildren()===1&&(s.push(y),y={name:null,source:y.name,transform:[]}))),h.numChildren()){case 0:h instanceof ia&&(!y.source||y.transform.length>0)&&s.push(y);break;case 1:d(h.children[0],y);break;default:{y.name||(y.name="data_"+l++);let w=y.name;!y.source||y.transform.length>0?s.push(y):w=y.source;for(let x of h.children)d(x,{name:null,source:w,transform:[]});break}}}}function Bg(s){return s==="top"||s==="left"||Ze(s)?"header":"footer"}function mv(s,l){var x;let{facet:d,config:h,child:y,component:w}=s;if(s.channelHasField(l)){let A=d[l],C=Zi("title",null,h,l),L=ss(A,h,{allowDisabling:!0,includeDefault:C===void 0||!!C});y.component.layoutHeaders[l].title&&(L=b.isArray(L)?L.join(", "):L,L+=` / ${y.component.layoutHeaders[l].title}`,y.component.layoutHeaders[l].title=null);let G=Zi("labelOrient",A.header,h,l),H=A.header!==null&&Ke((x=A.header)==null?void 0:x.labels,h.header.labels,!0),X=Z(["bottom","right"],G)?"footer":"header";w.layoutHeaders[l]={title:A.header!==null?L:null,facetFieldDef:A,[X]:l==="facet"?[]:[kp(s,l,H)]}}}function kp(s,l,d){let h=l==="row"?"height":"width";return{labels:d,sizeSignal:s.child.component.layoutSize.get(h)?s.child.getSizeSignalRef(h):void 0,axes:[]}}function Rn(s,l){let{child:d}=s;if(d.component.axes[l]){let{layoutHeaders:h,resolve:y}=s.component;if(y.axis[l]=sp(y,l),y.axis[l]==="shared"){let w=l==="x"?"column":"row",x=h[w];for(let A of d.component.axes[l]){let C=Bg(A.get("orient"));x[C]??=[kp(s,w,!1)];let L=Xi(A,"main",s.config,{header:!0});L&&x[C][0].axes.push(L),A.mainExtracted=!0}}}}function gl(s){for(let l of s.children)l.parseLayoutSize()}function Ss(s,l){let d=ug(l),h=ec(d),y=s.component.resolve,w=s.component.layoutSize,x;for(let A of s.children){let C=A.component.layoutSize.getWithExplicit(d),L=y.scale[h]??dg(h,s);if(L==="independent"&&C.value==="step"){x=void 0;break}if(x){if(L==="independent"&&x.value!==C.value){x=void 0;break}x=qi(x,C,d,"")}else x=C}if(x){for(let A of s.children)s.renameSignal(A.getName(d),s.getName(l)),A.component.layoutSize.set(d,"merged",!1);w.setWithExplicit(l,x)}else w.setWithExplicit(l,{explicit:!1,value:void 0})}function $r(s,l){let d=l==="width"?"x":"y",h=s.config,y=s.getScaleComponent(d);if(y){let w=y.get("type"),x=y.get("range");if(Hn(w)){let A=Ac(h.view,l);return go(x)||qa(A)?"step":A}return ds(h.view,l)}if(s.hasProjection||s.mark==="arc")return ds(h.view,l);{let w=Ac(h.view,l);return qa(w)?w.step:w}}function id(s,l,d){return je(l,{suffix:`by_${je(s)}`,...d??{}})}class bl extends rd{constructor(l,d,h,y){super(l,"facet",d,h,y,l.resolve),at(this,"facet",void 0),at(this,"child",void 0),at(this,"children",void 0),this.child=Vg(l.spec,this,this.getName("child"),void 0,y),this.children=[this.child],this.facet=this.initFacet(l.facet)}initFacet(l){if(!Ql(l))return{facet:this.initFacetFieldDef(l,"facet")};let d=be(l),h={};for(let y of d){if(![tt,Kr].includes(y)){Be(Mi(y,"facet"));break}let w=l[y];if(w.field===void 0){Be(Hd(w,y));break}h[y]=this.initFacetFieldDef(w,y)}return h}initFacetFieldDef(l,d){let h=ru(l,d);return h.header?h.header=ea(h.header):h.header===null&&(h.header=null),h}channelHasField(l){return!!this.facet[l]}fieldDef(l){return this.facet[l]}parseData(){this.component.data=Sp(this),this.child.parseData()}parseLayoutSize(){gl(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),(function(l){for(let d of Ua)mv(l,d);Rn(l,"x"),Rn(l,"y")})(this)}assembleSelectionTopLevelSignals(l){return this.child.assembleSelectionTopLevelSignals(l)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(l){return this.child.assembleSelectionData(l)}getHeaderLayoutMixins(){let l={};for(let d of Ua)for(let h of zc){let y=this.component.layoutHeaders[d],w=y[h],{facetFieldDef:x}=y;if(x){let A=Zi("titleOrient",x.header,this.config,d);if(["right","bottom"].includes(A)){let C=Bc(d,A);l.titleAnchor??={},l.titleAnchor[C]="end"}}if(w!=null&&w[0]){let A=d==="row"?"height":"width",C=h==="header"?"headerBand":"footerBand";d==="facet"||this.child.component.layoutSize.get(A)||(l[C]??={},l[C][d]=.5),y.title&&(l.offset??={},l.offset[d==="row"?"rowTitle":"columnTitle"]=10)}}return l}assembleDefaultLayout(){let{column:l,row:d}=this.facet,h=l?this.columnDistinctSignal():d?1:void 0,y="all";return(d||this.component.resolve.scale.x!=="independent")&&(l||this.component.resolve.scale.y!=="independent")||(y="none"),{...this.getHeaderLayoutMixins(),...h?{columns:h}:{},bounds:"full",align:y}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof bl))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(l){return this.parent&&this.parent instanceof bl?{...this.channelHasField("column")?{encode:{update:{columns:{field:je(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(l)}:super.assembleGroup(l)}getCardinalityAggregateForChild(){let l=[],d=[],h=[];if(this.child instanceof bl){if(this.child.channelHasField("column")){let y=je(this.child.facet.column);l.push(y),d.push("distinct"),h.push(`distinct_${y}`)}}else for(let y of Qr){let w=this.child.component.scales[y];if(w&&!w.merged){let x=w.get("type"),A=w.get("range");if(Hn(x)&&go(A)){let C=Rg(Es(this.child,y));C?(l.push(C),d.push("distinct"),h.push(`distinct_${C}`)):Be(ha(y))}}}return{fields:l,ops:d,as:h}}assembleFacet(){let{name:l,data:d}=this.component.data.facetRoot,{row:h,column:y}=this.facet,{fields:w,ops:x,as:A}=this.getCardinalityAggregateForChild(),C=[];for(let G of Ua){let H=this.facet[G];if(H){C.push(je(H));let{bin:X,sort:J}=H;if(Vt(X)&&C.push(je(H,{binSuffix:"end"})),ii(J)){let{field:le,op:te=dc}=J,pe=id(H,J);h&&y?(w.push(pe),x.push("max"),A.push(pe)):(w.push(le),x.push(te),A.push(pe))}else if(b.isArray(J)){let le=sl(H,G);w.push(le),x.push("max"),A.push(le)}}}let L=!!h&&!!y;return{name:l,data:d,groupby:C,...L||w.length>0?{aggregate:{...L?{cross:L}:{},...w.length?{fields:w,ops:x,as:A}:{}}}:{}}}facetSortFields(l){let{facet:d}=this,h=d[l];return h?ii(h.sort)?[id(h,h.sort,{expr:"datum"})]:b.isArray(h.sort)?[sl(h,l,{expr:"datum"})]:[je(h,{expr:"datum"})]:[]}facetSortOrder(l){let{facet:d}=this,h=d[l];if(h){let{sort:y}=h;return[(ii(y)?y.order:!b.isArray(y)&&y)||"ascending"]}return[]}assembleLabelTitle(){var y;let{facet:l,config:d}=this;if(l.facet)return xo(l.facet,"facet",d);let h={row:["top","bottom"],column:["left","right"]};for(let w of _u)if(l[w]){let x=Zi("labelOrient",(y=l[w])==null?void 0:y.header,d,w);if(h[w].includes(x))return xo(l[w],w,d)}}assembleMarks(){let{child:l}=this,d=(function(x){let A=[],C=_p(A);for(let L of x.children)C(L,{source:x.name,name:null,transform:[]});return A})(this.component.data.facetRoot),h=l.assembleGroupEncodeEntry(!1),y=this.assembleLabelTitle()||l.assembleTitle(),w=l.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...y?{title:y}:{},...w?{style:w}:{},from:{facet:this.assembleFacet()},sort:{field:Ua.map((x=>this.facetSortFields(x))).flat(),order:Ua.map((x=>this.facetSortOrder(x))).flat()},...d.length>0?{data:d}:{},...h?{encode:{update:h}}:{},...l.assembleGroup(Nc(this,[]))}]}getMapping(){return this.facet}}function Ug(s,l){var d,h,y,w;for(let x of l){let A=x.data;if(s.name&&x.hasName()&&s.name!==x.dataName)continue;let C=(d=s.format)==null?void 0:d.mesh,L=(h=A.format)==null?void 0:h.feature;if(C&&L)continue;let G=(y=s.format)==null?void 0:y.feature;if((G||L)&&G!==L)continue;let H=(w=A.format)==null?void 0:w.mesh;if(!C&&!H||C===H){if(mu(s)&&mu(A)){if(Ie(s.values,A.values))return x}else if(fs(s)&&fs(A)){if(s.url===A.url)return x}else if(qf(s)&&s.name===x.dataName)return x}}return null}function Sp(s){var le;let l=(function(te,pe){if(te.data||!te.parent){if(te.data===null){let xe=new Ro({values:[]});return pe.push(xe),xe}let ge=Ug(te.data,pe);if(ge)return Eo(te.data)||(ge.data.format=ce({},te.data.format,ge.data.format)),!ge.hasName()&&te.data.name&&(ge.dataName=te.data.name),ge;{let xe=new Ro(te.data);return pe.push(xe),xe}}return te.parent.component.data.facetRoot?te.parent.component.data.facetRoot:te.parent.component.data.main})(s,s.component.data.sources),{outputNodes:d,outputNodeRefCounts:h}=s.component.data,y=s.data,w=!(y&&(Eo(y)||fs(y)||mu(y)))&&s.parent?s.parent.component.data.ancestorParse.clone():new Ty;Eo(y)?(Wf(y)?l=new Xc(l,y.sequence):Yf(y)&&(l=new Kc(l,y.graticule)),w.parseNothing=!0):((le=y==null?void 0:y.format)==null?void 0:le.parse)===null&&(w.parseNothing=!0),l=Kn.makeExplicit(l,s,w)??l,l=new Co(l);let x=s.parent&&ws(s.parent);(cn(s)||Ya(s))&&x&&(l=pi.makeFromEncoding(l,s)??l),s.transforms.length>0&&(l=(function(te,pe,ge){let xe=0;for(let me of pe.transforms){let Ae,Re;if(r1(me))Re=te=new ol(te,me),Ae="derived";else if(Nm(me)){let Pe=p1(me);Re=te=Kn.makeWithAncestors(te,{},Pe,ge)??te,te=new ci(te,pe,me.filter)}else if(Bf(me))Re=te=pi.makeFromTransform(te,me,pe),Ae="number";else if(Uf(me))Ae="date",ge.getWithExplicit(me.field).value===void 0&&(te=new Kn(te,{[me.field]:Ae}),ge.set(me.field,Ae,!1)),Re=te=Wi.makeFromTransform(te,me);else if(Sy(me))Re=te=Va.makeFromTransform(te,me),Ae="number",ig(pe)&&(te=new Co(te));else if(Im(me))Re=te=Ka.make(te,pe,me,xe++),Ae="derived";else if(Dm(me))Re=te=new fl(te,me),Ae="number";else if(Mm(me))Re=te=new dl(te,me),Ae="number";else if(i1(me))Re=te=No.makeFromTransform(te,me),Ae="derived";else if(Fm(me))Re=te=new _s(te,me),Ae="derived";else if(Pm(me))Re=te=new Su(te,me),Ae="derived";else if(ky(me))Re=te=new Pr(te,me),Ae="derived";else if(n1(me))Re=te=new hl(te,me),Ae="derived";else if(_y(me))te=new ml(te,me);else if(Lm(me))Re=te=hr.makeFromTransform(te,me),Ae="derived";else if(Ey(me))Re=te=new ku(te,me),Ae="derived";else if(Om(me))Re=te=new Io(te,me),Ae="derived";else if(wy(me))Re=te=new Oo(te,me),Ae="derived";else{if(!a1(me)){Be(`Ignoring an invalid transform: ${Xe(me)}.`);continue}Re=te=new to(te,me),Ae="derived"}if(Re&&Ae!==void 0)for(let Pe of Re.producedFields()??[])ge.set(Pe,Ae,!1)}return te})(l,s,w));let A=(function(te){let pe={};if(cn(te)&&te.component.selection)for(let ge of be(te.component.selection)){let xe=te.component.selection[ge];for(let me of xe.project.items)!me.channel&&Xt(me.field)>1&&(pe[me.field]="flatten")}return pe})(s),C=Yn(s);l=Kn.makeWithAncestors(l,{},{...A,...C},w)??l,cn(s)&&(l=eo.parseAll(l,s),l=ks.parseAll(l,s)),(cn(s)||Ya(s))&&(x||(l=pi.makeFromEncoding(l,s)??l),l=Wi.makeFromEncoding(l,s)??l,l=ol.parseAllForSortIndex(l,s));let L=s.getDataName(nn.Raw),G=new ia(l,L,nn.Raw,h);if(d[L]=G,l=G,cn(s)){let te=Va.makeFromEncoding(l,s);te&&(l=te,ig(s)&&(l=new Co(l))),l=hr.makeFromEncoding(l,s)??l,l=No.makeFromEncoding(l,s)??l}cn(s)&&(l=Qi.make(l,s)??l);let H=s.getDataName(nn.Main),X=new ia(l,H,nn.Main,h);d[H]=X,l=X,cn(s)&&(function(te,pe){for(let[ge,xe]of ke(te.component.selection??{})){let me=te.getName(`lookup_${ge}`);te.component.data.outputNodes[me]=xe.materialized=new ia(new ci(pe,te,{param:ge}),me,nn.Lookup,te.component.data.outputNodeRefCounts)}})(s,X);let J=null;if(Ya(s)){let te=s.getName("facet");l=(function(pe,ge){let{row:xe,column:me}=ge;if(xe&&me){let Ae=null;for(let Re of[xe,me])if(ii(Re.sort)){let{field:Pe,op:We=dc}=Re.sort;pe=Ae=new dl(pe,{joinaggregate:[{op:We,field:Pe,as:id(Re,Re.sort,{forAs:!0})}],groupby:[je(Re)]})}return Ae}return null})(l,s.facet)??l,J=new cl(l,s,te,X.getSource()),d[te]=J}return{...s.component.data,outputNodes:d,outputNodeRefCounts:h,raw:G,main:X,facetRoot:J,ancestorParse:w}}class y1 extends ad{constructor(l,d,h,y){var w,x,A,C;super(l,"concat",d,h,y,l.resolve),at(this,"children",void 0),((x=(w=l.resolve)==null?void 0:w.axis)==null?void 0:x.x)!=="shared"&&((C=(A=l.resolve)==null?void 0:A.axis)==null?void 0:C.y)!=="shared"||Be("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(l).map(((L,G)=>Vg(L,this,this.getName(`concat_${G}`),void 0,y)))}parseData(){this.component.data=Sp(this);for(let l of this.children)l.parseData()}parseSelections(){this.component.selection={};for(let l of this.children){l.parseSelections();for(let d of be(l.component.selection))this.component.selection[d]=l.component.selection[d]}}parseMarkGroup(){for(let l of this.children)l.parseMarkGroup()}parseAxesAndHeaders(){for(let l of this.children)l.parseAxesAndHeaders()}getChildren(l){return du(l)?l.vconcat:Df(l)?l.hconcat:l.concat}parseLayoutSize(){(function(l){gl(l);let d=l.layout.columns===1?"width":"childWidth",h=l.layout.columns===void 0?"height":"childHeight";Ss(l,d),Ss(l,h)})(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(l){return this.children.reduce(((d,h)=>h.assembleSelectionTopLevelSignals(d)),l)}assembleSignals(){return this.children.forEach((l=>l.assembleSignals())),[]}assembleLayoutSignals(){let l=pr(this);for(let d of this.children)l.push(...d.assembleLayoutSignals());return l}assembleSelectionData(l){return this.children.reduce(((d,h)=>h.assembleSelectionData(d)),l)}assembleMarks(){return this.children.map((l=>{let d=l.assembleTitle(),h=l.assembleGroupStyle(),y=l.assembleGroupEncodeEntry(!1);return{type:"group",name:l.getName("group"),...d?{title:d}:{},...h?{style:h}:{},...y?{encode:{update:y}}:{},...l.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){let l=this.layout.columns;return{...l!=null?{columns:l}:{},bounds:"full",align:"each"}}}let xp={disable:1,gridScale:1,scale:1,...gc,labelExpr:1,encode:1},zg=be(xp);class Ap extends ji{constructor(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=arguments.length>2&&arguments[2]!==void 0&&arguments[2];super(),this.explicit=l,this.implicit=d,this.mainExtracted=h}clone(){return new Ap(j(this.explicit),j(this.implicit),this.mainExtracted)}hasAxisPart(l){return l==="axis"||(l==="grid"||l==="title"?!!this.get(l):!((d=this.get(l))===!1||d===null));var d}hasOrientSignalRef(){return Ze(this.explicit.orient)}}let Bt={bottom:"top",top:"bottom",left:"right",right:"left"};function gv(s,l){if(!s)return l.map((d=>d.clone()));{if(s.length!==l.length)return;let d=s.length;for(let h=0;h<d;h++){let y=s[h],w=l[h];if(!!y!=!!w)return;if(y&&w){let x=y.getWithExplicit("orient"),A=w.getWithExplicit("orient");if(x.explicit&&A.explicit&&x.value!==A.value)return;s[h]=yl(y,w)}}}return s}function yl(s,l){for(let d of zg){let h=qi(s.getWithExplicit(d),l.getWithExplicit(d),d,"axis",((y,w)=>{switch(d){case"title":return ni(y,w);case"gridScale":return{explicit:y.explicit,value:Ke(y.value,w.value)}}return Rc(y,w,d,"axis")}));s.setWithExplicit(d,h)}return s}function Gg(s,l,d,h,y){if(l==="disable")return d!==void 0;switch(d=d||{},l){case"titleAngle":case"labelAngle":return s===(Ze(d.labelAngle)?d.labelAngle:Lt(d.labelAngle));case"values":return!!d.values;case"encode":return!!d.encoding||!!d.labelAngle;case"title":if(s===Vy(h,y))return!0}return s===d[l]}let xu=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function jg(s,l){var ge,xe;let d=l.axis(s),h=new Ap,y=vn(l.encoding[s]),{mark:w,config:x}=l,A=(d==null?void 0:d.orient)||((ge=x[s==="x"?"axisX":"axisY"])==null?void 0:ge.orient)||((xe=x.axis)==null?void 0:xe.orient)||(function(me){return me==="x"?"bottom":"left"})(s),C=l.getScaleComponent(s).get("type"),L=(function(me,Ae,Re,Pe){let We=Ae==="band"?["axisDiscrete","axisBand"]:Ae==="point"?["axisDiscrete","axisPoint"]:V0(Ae)?["axisQuantitative"]:Ae==="time"||Ae==="utc"?["axisTemporal"]:[],Je=me==="x"?"axisX":"axisY",it=Ze(Re)?"axisOrient":`axis${yt(Re)}`,Qe=[...We,...We.map((kt=>Je+kt.substr(4)))],lt=["axis",it,Je];return{vlOnlyAxisConfig:di(Qe,Pe,me,Re),vgAxisConfig:di(lt,Pe,me,Re),axisConfigStyle:f1([...lt,...Qe],Pe)}})(s,C,A,l.config),G=d!==void 0?!d:og("disable",x.style,d==null?void 0:d.style,L).configValue;if(h.set("disable",G,d!==void 0),G)return h;d=d||{};let H=(function(me,Ae,Re,Pe,We){let Je=Ae==null?void 0:Ae.labelAngle;if(Je!==void 0)return Ze(Je)?Je:Lt(Je);{let{configValue:it}=og("labelAngle",Pe,Ae==null?void 0:Ae.style,We);return it!==void 0?Lt(it):Re!==Qt||!Z([nf,tf],me.type)||ze(me)&&me.timeUnit?void 0:270}})(y,d,s,x.style,L),X=ry(d.formatType,y,C),J=ay(y,y.type,d.format,d.formatType,x,!0),le={fieldOrDatumDef:y,axis:d,channel:s,model:l,scaleType:C,orient:A,labelAngle:H,format:J,formatType:X,mark:w,config:x};for(let me of zg){let Ae=me in Hy?Hy[me](le):uy(me)?d[me]:void 0,Re=Ae!==void 0,Pe=Gg(Ae,me,d,l,s);if(Re&&Pe)h.set(me,Ae,Pe);else{let{configValue:We,configFrom:Je}=uy(me)&&me!=="values"?og(me,x.style,d.style,L):{},it=We!==void 0;Re&&!it?h.set(me,Ae,Pe):(Je!=="vgAxisConfig"||xu.has(me)&&it||su(We)||Ze(We))&&h.set(me,We,!1)}}let te=d.encoding??{},pe=us.reduce(((me,Ae)=>{if(!h.hasAxisPart(Ae))return me;let Re=cg(te[Ae]??{},l),Pe=Ae==="labels"?(function(We,Je,it){let{encoding:Qe,config:lt}=We,kt=vn(Qe[Je])??vn(Qe[Ci(Je)]),Fn=We.axis(Je)||{},{format:dn,formatType:sn}=Fn;if(Xs(sn))return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:dn,formatType:sn,config:lt}),...it};if(dn===void 0&&sn===void 0&&lt.customFormatTypes){if(tu(kt)==="quantitative"){if(nu(kt)&&kt.stack==="normalize"&&lt.normalizedNumberFormatType)return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:lt.normalizedNumberFormat,formatType:lt.normalizedNumberFormatType,config:lt}),...it};if(lt.numberFormatType)return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:lt.numberFormat,formatType:lt.numberFormatType,config:lt}),...it}}if(tu(kt)==="temporal"&&lt.timeFormatType&&ze(kt)&&!kt.timeUnit)return{text:ri({fieldOrDatumDef:kt,field:"datum.value",format:lt.timeFormat,formatType:lt.timeFormatType,config:lt}),...it}}return it})(l,s,Re):Re;return Pe===void 0||ye(Pe)||(me[Ae]={update:Pe}),me}),{});return ye(pe)||h.set("encode",pe,!!d.encoding||d.labelAngle!==void 0),h}function Tp(s,l){let{config:d}=s;return{...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Wn("size",s),...Wn("angle",s),...bv(s,d,l)}}function bv(s,l,d){return d?{shape:{value:d}}:Wn("shape",s)}let yv={vgMark:"rule",encodeEntry:s=>{let{markDef:l}=s,d=l.orient;return s.encoding.x||s.encoding.y||s.encoding.latitude||s.encoding.longitude?{...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...ep("x",s,{defaultPos:d==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:d!=="vertical"}),...ep("y",s,{defaultPos:d==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:d!=="horizontal"}),...Wn("size",s,{vgChannel:"strokeWidth"})}:{}}};function v1(s,l,d){if(Ht("align",s,d)===void 0)return"center"}function vv(s,l,d){if(Ht("baseline",s,d)===void 0)return"middle"}let Cp={vgMark:"rect",encodeEntry:s=>{let{config:l,markDef:d}=s,h=d.orient,y=h==="horizontal"?"width":"height",w=h==="horizontal"?"height":"width";return{...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid",vgChannel:"xc"}),...Vn("y",s,{defaultPos:"mid",vgChannel:"yc"}),...Wn("size",s,{defaultValue:Ev(s),vgChannel:y}),[w]:on(Ht("thickness",d,l))}}};function Ev(s){let{config:l,markDef:d}=s,{orient:h}=d,y=h==="horizontal"?"width":"height",w=s.getScaleComponent(h==="horizontal"?"x":"y"),x=Ht("size",d,l,{vgChannel:y})??l.tick.bandSize;if(x!==void 0)return x;{let A=w?w.get("range"):void 0;return A&&go(A)&&b.isNumber(A.step)?3*A.step/4:3*fu(l.view,y)/4}}let od={arc:{vgMark:"arc",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...li(s,"radius"),...li(s,"theta")})},area:{vgMark:"area",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...ep("x",s,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:s.markDef.orient==="horizontal"}),...ep("y",s,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:s.markDef.orient==="vertical"}),...Lc(s)})},bar:{vgMark:"rect",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...li(s,"x"),...li(s,"y")})},circle:{vgMark:"symbol",encodeEntry:s=>Tp(s,"circle")},geoshape:{vgMark:"shape",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:s=>{let{encoding:l}=s,d=l.shape;return[{type:"geoshape",projection:s.projectionName(),...d&&ze(d)&&d.type===Vs?{field:je(d,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...li(s,"x"),...li(s,"y"),...Jf(s,"url")})},line:{vgMark:"line",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Wn("size",s,{vgChannel:"strokeWidth"}),...Lc(s)})},point:{vgMark:"symbol",encodeEntry:s=>Tp(s)},rect:{vgMark:"rect",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...li(s,"x"),...li(s,"y")})},rule:yv,square:{vgMark:"symbol",encodeEntry:s=>Tp(s,"square")},text:{vgMark:"text",encodeEntry:s=>{let{config:l,encoding:d}=s;return{...Na(s,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Jf(s),...Wn("size",s,{vgChannel:"fontSize"}),...Wn("angle",s),...Fy("align",v1(s.markDef,d,l)),...Fy("baseline",vv(s.markDef,d,l)),...Vn("radius",s,{defaultPos:null}),...Vn("theta",s,{defaultPos:null})}}},tick:Cp,trail:{vgMark:"trail",encodeEntry:s=>({...Na(s,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Vn("x",s,{defaultPos:"mid"}),...Vn("y",s,{defaultPos:"mid"}),...Wn("size",s),...Lc(s)})}};function Hg(s){if(Z([uc,af,z_],s.mark)){let l=im(s.mark,s.encoding);if(l.length>0)return(function(d,h){return[{name:d.getName("pathgroup"),type:"group",from:{facet:{name:qg+d.requestDataName(nn.Main),data:d.requestDataName(nn.Main),groupby:h}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Rp(d,{fromPrefix:qg})}]})(s,l)}else if(s.mark===rf){let l=Ah.some((d=>Ht(d,s.markDef,s.config)));if(s.stack&&!s.fieldDef("size")&&l)return(function(d){var G;let[h]=Rp(d,{fromPrefix:Wg}),y=d.scaleName(d.stack.fieldChannel),w=function(){let H=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return d.vgField(d.stack.fieldChannel,H)},x=(H,X)=>`${H}(${[w({prefix:"min",suffix:"start",expr:X}),w({prefix:"max",suffix:"start",expr:X}),w({prefix:"min",suffix:"end",expr:X}),w({prefix:"max",suffix:"end",expr:X})].map((J=>`scale('${y}',${J})`)).join(",")})`,A,C;d.stack.fieldChannel==="x"?(A={...V(h.encode.update,["y","yc","y2","height",...Ah]),x:{signal:x("min","datum")},x2:{signal:x("max","datum")},clip:{value:!0}},C={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},h.encode.update={...ee(h.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(A={...V(h.encode.update,["x","xc","x2","width"]),y:{signal:x("min","datum")},y2:{signal:x("max","datum")},clip:{value:!0}},C={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},h.encode.update={...ee(h.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(let H of Ah){let X=Ga(H,d.markDef,d.config);h.encode.update[H]?(A[H]=h.encode.update[H],delete h.encode.update[H]):X&&(A[H]=on(X)),X&&(h.encode.update[H]={value:0})}let L=[];if(((G=d.stack.groupbyChannels)==null?void 0:G.length)>0)for(let H of d.stack.groupbyChannels){let X=d.fieldDef(H),J=je(X);J&&L.push(J),(X!=null&&X.bin||X!=null&&X.timeUnit)&&L.push(je(X,{binSuffix:"end"}))}return A=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((H,X)=>{if(h.encode.update[X])return{...H,[X]:h.encode.update[X]};{let J=Ga(X,d.markDef,d.config);return J!==void 0?{...H,[X]:on(J)}:H}}),A),A.stroke&&(A.strokeForeground={value:!0},A.strokeOffset={value:0}),[{type:"group",from:{facet:{data:d.requestDataName(nn.Main),name:Wg+d.requestDataName(nn.Main),groupby:L,aggregate:{fields:[w({suffix:"start"}),w({suffix:"start"}),w({suffix:"end"}),w({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:A},marks:[{type:"group",encode:{update:C},marks:[h]}]}]})(s)}return Rp(s)}let qg="faceted_path_",Wg="stack_group_";function Rp(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{fromPrefix:""},{mark:d,markDef:h,encoding:y,config:w}=s,x=Ke(h.clip,(function(J){let le=J.getScaleComponent("x"),te=J.getScaleComponent("y");return!(!(le!=null&&le.get("selectionExtent"))&&!(te!=null&&te.get("selectionExtent")))||void 0})(s),(function(J){let le=J.component.projection;return!(!le||le.isFit)||void 0})(s)),A=R0(h),C=y.key,L=(function(J){var Ae;let{encoding:le,stack:te,mark:pe,markDef:ge,config:xe}=J,me=le.order;if(!(!b.isArray(me)&&cr(me)&&he(me.value)||!me&&he(Ht("order",ge,xe)))){if((b.isArray(me)||ze(me))&&!te)return ql(me,{expr:"datum"});if(is(pe)){let Re=ge.orient==="horizontal"?"y":"x",Pe=le[Re];if(ze(Pe)){let We=Pe.sort;return b.isArray(We)?{field:je(Pe,{prefix:Re,suffix:"sort_index",expr:"datum"})}:ii(We)?{field:je({aggregate:rm(J.encoding)?We.op:void 0,field:We.field},{expr:"datum"})}:Zh(We)?{field:je(J.fieldDef(We.encoding),{expr:"datum"}),order:We.order}:We===null?void 0:{field:je(Pe,{binSuffix:(Ae=J.stack)!=null&&Ae.impute?"mid":void 0,expr:"datum"})}}}}})(s),G=(function(J){if(!J.component.selection)return null;let le=be(J.component.selection).length,te=le,pe=J.parent;for(;pe&&te===0;)te=be(pe.component.selection).length,pe=pe.parent;return te?{interactive:le>0||J.mark==="geoshape"||!!J.encoding.tooltip}:null})(s),H=Ht("aria",h,w),X=od[d].postEncodingTransform?od[d].postEncodingTransform(s):null;return[{name:s.getName("marks"),type:od[d].vgMark,...x?{clip:!0}:{},...A?{style:A}:{},...C?{key:C.field}:{},...L?{sort:L}:{},...G||{},...H===!1?{aria:H}:{},from:{data:l.fromPrefix+s.requestDataName(nn.Main)},encode:{update:od[d].encodeEntry(s)},...X?{transform:X}:{}}]}class Np extends rd{constructor(l,d,h){let y=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},w=arguments.length>4?arguments[4]:void 0;super(l,"unit",d,h,w,void 0,Sc(l)?l.view:void 0),at(this,"markDef",void 0),at(this,"encoding",void 0),at(this,"specifiedScales",{}),at(this,"stack",void 0),at(this,"specifiedAxes",{}),at(this,"specifiedLegends",{}),at(this,"specifiedProjection",{}),at(this,"selection",[]),at(this,"children",[]);let x=Li(l.mark)?{...l.mark}:{type:l.mark},A=x.type;x.filled===void 0&&(x.filled=(function(L,G,H){let{graticule:X}=H;if(X)return!1;let J=Ga("filled",L,G),le=L.type;return Ke(J,le!==of&&le!==uc&&le!==sf)})(x,w,{graticule:l.data&&Yf(l.data)}));let C=this.encoding=(function(L,G,H,X){let J={};for(let te of be(L))b0(te)||Be(`${le=te}-encoding is dropped as ${le} is not a valid encoding channel.`);var le;for(let te of Zu){if(!L[te])continue;let pe=L[te];if(Qn(te)){let ge=v_(te),xe=J[ge];if(ze(xe)&&q0(xe.type)&&ze(pe)&&!xe.timeUnit){Be(Ch(ge));continue}}if(te!=="angle"||G!=="arc"||L.theta||(Be("Arc marks uses theta channel rather than angle, replacing angle with theta."),te=ar),_f(L,te,G)){if(te===Si&&G==="line"){let ge=dr(L[te]);if(ge!=null&&ge.aggregate){Be("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(te===Fe&&(H?"fill"in L:"stroke"in L))Be(D0("encoding",{fill:"fill"in L,stroke:"stroke"in L}));else if(te===po||te===Bs&&!b.isArray(pe)&&!cr(pe)||te===Jr&&b.isArray(pe)){if(pe){if(te===Bs){let ge=L[te];if(iy(ge)){J[te]=ge;continue}}J[te]=b.array(pe).reduce(((ge,xe)=>(ze(xe)?ge.push(ru(xe,te)):Be(Hd(xe,te)),ge)),[])}}else{if(te===Jr&&pe===null)J[te]=null;else if(!(ze(pe)||Pi(pe)||cr(pe)||hf(pe)||Ze(pe))){Be(Hd(pe,te));continue}J[te]=am(pe,te,X)}}else Be(Mi(te,G))}return J})(l.encoding||{},A,x.filled,w);this.markDef=yy(x,C,w),this.size=(function(L){let{encoding:G,size:H}=L;for(let X of Qr){let J=xa(X);qa(H[J])&&os(G[X])&&(delete H[J],Be(Oh(J)))}return H})({encoding:C,size:Sc(l)?{...y,...l.width?{width:l.width}:{},...l.height?{height:l.height}:{}}:y}),this.stack=_m(this.markDef,C),this.specifiedScales=this.initScales(A,C),this.specifiedAxes=this.initAxes(C),this.specifiedLegends=this.initLegends(C),this.specifiedProjection=l.projection,this.selection=(l.params??[]).filter((L=>_c(L)))}get hasProjection(){let{encoding:l}=this,d=this.mark===J0,h=l&&m0.some((y=>_t(l[y])));return d||h}scaleDomain(l){let d=this.specifiedScales[l];return d?d.domain:void 0}axis(l){return this.specifiedAxes[l]}legend(l){return this.specifiedLegends[l]}initScales(l,d){return Gl.reduce(((h,y)=>{let w=vn(d[y]);return w&&(h[y]=this.initScale(w.scale??{})),h}),{})}initScale(l){let{domain:d,range:h}=l,y=ea(l);return b.isArray(d)&&(y.domain=d.map(Gn)),b.isArray(h)&&(y.range=h.map(Gn)),y}initAxes(l){return Qr.reduce(((d,h)=>{let y=l[h];if(_t(y)||h===Qt&&_t(l.x2)||h===Bn&&_t(l.y2)){let w=_t(y)?y.axis:void 0;d[h]=w&&this.initAxis({...w})}return d}),{})}initAxis(l){let d=be(l),h={};for(let y of d){let w=l[y];h[y]=su(w)?T0(w):Gn(w)}return h}initLegends(l){return k0.reduce(((d,h)=>{let y=vn(l[h]);if(y&&(function(w){switch(w){case Fe:case Sa:case Zr:case Si:case Sn:case xi:case fo:case Jo:return!0;case Ft:case Ai:case Ba:return!1}})(h)){let w=y.legend;d[h]=w&&ea(w)}return d}),{})}parseData(){this.component.data=Sp(this)}parseLayoutSize(){(function(l){let{size:d,component:h}=l;for(let y of Qr){let w=xa(y);if(d[w]){let x=d[w];h.layoutSize.set(w,qa(x)?"step":x,!0)}else{let x=$r(l,w);h.layoutSize.set(w,x,!1)}}})(this)}parseSelections(){this.component.selection=(function(l,d){let h={},y=l.config.selection;if(!d||!d.length)return h;for(let w of d){let x=$e(w.name),A=w.select,C=b.isString(A)?A:A.type,L=b.isObject(A)?j(A):{type:C},G=y[C];for(let J in G)J!=="fields"&&J!=="encodings"&&(J==="mark"&&(L[J]={...G[J],...L[J]}),L[J]!==void 0&&L[J]!==!0||(L[J]=j(G[J]??L[J])));let H=h[x]={...L,name:x,type:C,init:w.value,bind:w.bind,events:b.isString(L.on)?b.parseSelector(L.on,"scope"):b.array(j(L.on))},X=j(w);for(let J of il)J.defined(H)&&J.parse&&J.parse(l,H,X)}return h})(this,this.selection)}parseMarkGroup(){this.component.mark=Hg(this)}parseAxesAndHeaders(){var l;this.component.axes=(l=this,Qr.reduce(((d,h)=>(l.component.scales[h]&&(d[h]=[jg(h,l)]),d)),{}))}assembleSelectionTopLevelSignals(l){return(function(d,h){let y=!1;for(let w of Te(d.component.selection??{})){let x=w.name,A=b.stringValue(x+ms);if(h.filter((C=>C.name===x)).length===0){let C=w.resolve==="global"?"union":w.resolve,L=w.type==="point"?", true, true)":")";h.push({name:w.name,update:`${rg}(${A}, ${b.stringValue(C)}${L}`})}y=!0;for(let C of il)C.defined(w)&&C.topLevelSignals&&(h=C.topLevelSignals(d,w,h))}return y&&h.filter((w=>w.name==="unit")).length===0&&h.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),Kf(h)})(this,l)}assembleSignals(){return[...wu(this),...Cy(this,[])]}assembleSelectionData(l){return(function(d,h){let y=[...h],w=Wa(d,{escape:!1});for(let x of Te(d.component.selection??{})){let A={name:x.name+ms};if(x.project.hasSelectionId&&(A.transform=[{type:"collect",sort:{field:fr}}]),x.init){let C=x.project.items.map(Hm);A.values=x.project.hasSelectionId?x.init.map((L=>({unit:w,[fr]:ps(L,!1)[0]}))):x.init.map((L=>({unit:w,fields:C,values:ps(L,!1)})))}y.filter((C=>C.name===x.name+ms)).length||y.push(A)}return y})(this,l)}assembleLayout(){return null}assembleLayoutSignals(){return pr(this)}assembleMarks(){let l=this.component.mark??[];return this.parent&&ws(this.parent)||(l=Ry(this,l)),l.map(this.correctDataNames)}assembleGroupStyle(){let{style:l}=this.view||{};return l!==void 0?l:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(l){return Ui(this.encoding,l)}fieldDef(l){return dr(this.encoding[l])}typedFieldDef(l){let d=this.fieldDef(l);return ma(d)?d:null}}class Au extends ad{constructor(l,d,h,y,w){super(l,"layer",d,h,w,l.resolve,l.view),at(this,"children",void 0);let x={...y,...l.width?{width:l.width}:{},...l.height?{height:l.height}:{}};this.children=l.layer.map(((A,C)=>{if(pu(A))return new Au(A,this,this.getName(`layer_${C}`),x,w);if(Bi(A))return new Np(A,this,this.getName(`layer_${C}`),x,w);throw new Error(Th(A))}))}parseData(){this.component.data=Sp(this);for(let l of this.children)l.parseData()}parseLayoutSize(){var l;gl(l=this),Ss(l,"width"),Ss(l,"height")}parseSelections(){this.component.selection={};for(let l of this.children){l.parseSelections();for(let d of be(l.component.selection))this.component.selection[d]=l.component.selection[d]}}parseMarkGroup(){for(let l of this.children)l.parseMarkGroup()}parseAxesAndHeaders(){(function(l){let{axes:d,resolve:h}=l.component,y={top:0,bottom:0,right:0,left:0};for(let w of l.children){w.parseAxesAndHeaders();for(let x of be(w.component.axes))h.axis[x]=sp(l.component.resolve,x),h.axis[x]==="shared"&&(d[x]=gv(d[x],w.component.axes[x]),d[x]||(h.axis[x]="independent",delete d[x]))}for(let w of Qr){for(let x of l.children)if(x.component.axes[w]){if(h.axis[w]==="independent"){d[w]=(d[w]??[]).concat(x.component.axes[w]);for(let A of x.component.axes[w]){let{value:C,explicit:L}=A.getWithExplicit("orient");if(!Ze(C)){if(y[C]>0&&!L){let G=Bt[C];y[C]>y[G]&&A.set("orient",G,!1)}y[C]++}}}delete x.component.axes[w]}if(h.axis[w]==="independent"&&d[w]&&d[w].length>1)for(let[x,A]of(d[w]||[]).entries())x>0&&A.get("grid")&&!A.explicit.grid&&(A.implicit.grid=!1)}})(this)}assembleSelectionTopLevelSignals(l){return this.children.reduce(((d,h)=>h.assembleSelectionTopLevelSignals(d)),l)}assembleSignals(){return this.children.reduce(((l,d)=>l.concat(d.assembleSignals())),wu(this))}assembleLayoutSignals(){return this.children.reduce(((l,d)=>l.concat(d.assembleLayoutSignals())),pr(this))}assembleSelectionData(l){return this.children.reduce(((d,h)=>h.assembleSelectionData(d)),l)}assembleGroupStyle(){let l=new Set;for(let h of this.children)for(let y of b.array(h.assembleGroupStyle()))l.add(y);let d=Array.from(l);return d.length>1?d:d.length===1?d[0]:void 0}assembleTitle(){let l=super.assembleTitle();if(l)return l;for(let d of this.children)if(l=d.assembleTitle(),l)return l}assembleLayout(){return null}assembleMarks(){return(function(l,d){for(let h of l.children)cn(h)&&(d=Ry(h,d));return d})(this,this.children.flatMap((l=>l.assembleMarks())))}assembleLegends(){return this.children.reduce(((l,d)=>l.concat(d.assembleLegends())),dp(this))}}function Vg(s,l,d,h,y){if(pc(s))return new bl(s,l,d,y);if(pu(s))return new Au(s,l,d,h,y);if(Bi(s))return new Np(s,l,d,h,y);if((function(w){return du(w)||Df(w)||kc(w)})(s))return new y1(s,l,d,y);throw new Error(Th(s))}let E1=S;p.accessPathDepth=Xt,p.accessPathWithDatum=xt,p.compile=function(s){let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var d;l.logger&&(d=l.logger,ic=d),l.fieldTitle&&hc(l.fieldTitle);try{let h=vm(b.mergeConfig(l.config,s.config)),y=jf(s,h),w=Vg(y,null,"",void 0,h);return w.parse(),(function(A,C){yp(A.sources);let L=0,G=0;for(let H=0;H<bp&&iv(A,C,!0);H++)L++;A.sources.map(Ag);for(let H=0;H<bp&&iv(A,C,!1);H++)G++;yp(A.sources),Math.max(L,G)===bp&&Be(`Maximum optimization runs(${bp}) reached.`)})(w.component.data,w),{spec:(function(A,C){let L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},G=arguments.length>3?arguments[3]:void 0,H=A.config?Lf(A.config):void 0,X=[].concat(A.assembleSelectionData([]),(function(Ae,Re){let Pe=[],We=_p(Pe),Je=0;for(let Qe of Ae.sources){Qe.hasName()||(Qe.dataName="source_"+Je++);let lt=Qe.assemble();We(Qe,lt)}for(let Qe of Pe)Qe.transform.length===0&&delete Qe.transform;let it=0;for(let[Qe,lt]of Pe.entries())(lt.transform??[]).length!==0||lt.source||Pe.splice(it++,0,Pe.splice(Qe,1)[0]);for(let Qe of Pe)for(let lt of Qe.transform??[])lt.type==="lookup"&&(lt.from=Ae.outputNodes[lt.from].getSource());for(let Qe of Pe)Qe.name in Re&&(Qe.values=Re[Qe.name]);return Pe})(A.component.data,L)),J=A.assembleProjections(),le=A.assembleTitle(),te=A.assembleGroupStyle(),pe=A.assembleGroupEncodeEntry(!0),ge=A.assembleLayoutSignals();ge=ge.filter((Ae=>Ae.name!=="width"&&Ae.name!=="height"||Ae.value===void 0||(C[Ae.name]=+Ae.value,!1)));let{params:xe,...me}=C;return{$schema:"https://vega.github.io/schema/vega/v5.json",...A.description?{description:A.description}:{},...me,...le?{title:le}:{},...te?{style:te}:{},...pe?{encode:{update:pe}}:{},data:X,...J.length>0?{projections:J}:{},...A.assembleGroup([...ge,...A.assembleSelectionTopLevelSignals([]),...Of(xe)]),...H?{config:H}:{},...G?{usermeta:G}:{}}})(w,(function(A,C,L,G){let H=G.component.layoutSize.get("width"),X=G.component.layoutSize.get("height");if(C===void 0?(C={type:"pad"},G.hasAxisOrientSignalRef()&&(C.resize=!0)):b.isString(C)&&(C={type:C}),H&&X&&(J=C.type,J==="fit"||J==="fit-x"||J==="fit-y")){if(H==="step"&&X==="step")Be(Cn()),C.type="pad";else if(H==="step"||X==="step"){let le=H==="step"?"width":"height";Be(Cn(ec(le)));let te=le==="width"?"height":"width";C.type=(function(pe){return pe?`fit-${ec(pe)}`:"fit"})(te)}}var J;return{...be(C).length===1&&C.type?C.type==="pad"?{}:{autosize:C.type}:{autosize:C},...Hf(L,!1),...Hf(A,!0)}})(s,y.autosize,h,w),s.datasets,s.usermeta),normalized:y}}finally{l.logger&&(ic=P0),l.fieldTitle&&hc(ly)}},p.contains=Z,p.deepEqual=Ie,p.deleteNestedProperty=dt,p.duplicate=j,p.entries=ke,p.every=oe,p.fieldIntersection=Ee,p.flatAccessWithDatum=rn,p.getFirstDefined=Ke,p.hasIntersection=Me,p.hash=ne,p.internalField=wt,p.isBoolean=Ye,p.isEmpty=ye,p.isEqual=function(s,l){let d=be(s),h=be(l);if(d.length!==h.length)return!1;for(let y of d)if(s[y]!==l[y])return!1;return!0},p.isInternalField=Jt,p.isNullOrFalse=he,p.isNumeric=Ct,p.keys=be,p.logicalExpr=Le,p.mergeDeep=ce,p.never=W,p.normalize=jf,p.normalizeAngle=Lt,p.omit=ee,p.pick=V,p.prefixGenerator=Ge,p.removePathFromField=Tt,p.replaceAll=St,p.replacePathInField=jt,p.resetIdCounter=function(){et=42},p.setEqual=Ce,p.some=ae,p.stringify=Xe,p.titleCase=yt,p.unique=_e,p.uniqueId=Zt,p.vals=Te,p.varName=$e,p.version=E1}))});var C2=rA((kG,d_)=>{var Hz=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{},D=(function(p){var b=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,S=0,T={},R={manual:p.Prism&&p.Prism.manual,disableWorkerMessageHandler:p.Prism&&p.Prism.disableWorkerMessageHandler,util:{encode:function Z(ae){return ae instanceof $?new $(ae.type,Z(ae.content),ae.alias):Array.isArray(ae)?ae.map(Z):ae.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(Z){return Object.prototype.toString.call(Z).slice(8,-1)},objId:function(Z){return Z.__id||Object.defineProperty(Z,"__id",{value:++S}),Z.__id},clone:function Z(ae,oe){var ce,de;switch(oe=oe||{},R.util.type(ae)){case"Object":if(de=R.util.objId(ae),oe[de])return oe[de];for(var _e in ce={},oe[de]=ce,ae)ae.hasOwnProperty(_e)&&(ce[_e]=Z(ae[_e],oe));return ce;case"Array":return de=R.util.objId(ae),oe[de]?oe[de]:(ce=[],oe[de]=ce,ae.forEach((function(Ce,Me){ce[Me]=Z(Ce,oe)})),ce);default:return ae}},getLanguage:function(Z){for(;Z;){var ae=b.exec(Z.className);if(ae)return ae[1].toLowerCase();Z=Z.parentElement}return"none"},setLanguage:function(Z,ae){Z.className=Z.className.replace(RegExp(b,"gi"),""),Z.classList.add("language-"+ae)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(ce){var Z=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(ce.stack)||[])[1];if(Z){var ae=document.getElementsByTagName("script");for(var oe in ae)if(ae[oe].src==Z)return ae[oe]}return null}},isActive:function(Z,ae,oe){for(var ce="no-"+ae;Z;){var de=Z.classList;if(de.contains(ae))return!0;if(de.contains(ce))return!1;Z=Z.parentElement}return!!oe}},languages:{plain:T,plaintext:T,text:T,txt:T,extend:function(Z,ae){var oe=R.util.clone(R.languages[Z]);for(var ce in ae)oe[ce]=ae[ce];return oe},insertBefore:function(Z,ae,oe,ce){var de=(ce=ce||R.languages)[Z],_e={};for(var Ce in de)if(de.hasOwnProperty(Ce)){if(Ce==ae)for(var Me in oe)oe.hasOwnProperty(Me)&&(_e[Me]=oe[Me]);oe.hasOwnProperty(Ce)||(_e[Ce]=de[Ce])}var Ge=ce[Z];return ce[Z]=_e,R.languages.DFS(R.languages,(function(Ee,ye){ye===Ge&&Ee!=Z&&(this[Ee]=_e)})),_e},DFS:function Z(ae,oe,ce,de){de=de||{};var _e=R.util.objId;for(var Ce in ae)if(ae.hasOwnProperty(Ce)){oe.call(ae,Ce,ae[Ce],ce||Ce);var Me=ae[Ce],Ge=R.util.type(Me);Ge!=="Object"||de[_e(Me)]?Ge!=="Array"||de[_e(Me)]||(de[_e(Me)]=!0,Z(Me,oe,Ce,de)):(de[_e(Me)]=!0,Z(Me,oe,null,de))}}},plugins:{},highlightAll:function(Z,ae){R.highlightAllUnder(document,Z,ae)},highlightAllUnder:function(Z,ae,oe){var ce={callback:oe,container:Z,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};R.hooks.run("before-highlightall",ce),ce.elements=Array.prototype.slice.apply(ce.container.querySelectorAll(ce.selector)),R.hooks.run("before-all-elements-highlight",ce);for(var de,_e=0;de=ce.elements[_e++];)R.highlightElement(de,ae===!0,ce.callback)},highlightElement:function(Z,ae,oe){var ce=R.util.getLanguage(Z),de=R.languages[ce];R.util.setLanguage(Z,ce);var _e=Z.parentElement;_e&&_e.nodeName.toLowerCase()==="pre"&&R.util.setLanguage(_e,ce);var Ce={element:Z,language:ce,grammar:de,code:Z.textContent};function Me(Ee){Ce.highlightedCode=Ee,R.hooks.run("before-insert",Ce),Ce.element.innerHTML=Ce.highlightedCode,R.hooks.run("after-highlight",Ce),R.hooks.run("complete",Ce),oe&&oe.call(Ce.element)}if(R.hooks.run("before-sanity-check",Ce),(_e=Ce.element.parentElement)&&_e.nodeName.toLowerCase()==="pre"&&!_e.hasAttribute("tabindex")&&_e.setAttribute("tabindex","0"),!Ce.code)return R.hooks.run("complete",Ce),void(oe&&oe.call(Ce.element));if(R.hooks.run("before-highlight",Ce),Ce.grammar)if(ae&&p.Worker){var Ge=new Worker(R.filename);Ge.onmessage=function(Ee){Me(Ee.data)},Ge.postMessage(JSON.stringify({language:Ce.language,code:Ce.code,immediateClose:!0}))}else Me(R.highlight(Ce.code,Ce.grammar,Ce.language));else Me(R.util.encode(Ce.code))},highlight:function(Z,ae,oe){var ce={code:Z,grammar:ae,language:oe};if(R.hooks.run("before-tokenize",ce),!ce.grammar)throw new Error('The language "'+ce.language+'" has no grammar.');return ce.tokens=R.tokenize(ce.code,ce.grammar),R.hooks.run("after-tokenize",ce),$.stringify(R.util.encode(ce.tokens),ce.language)},tokenize:function(Z,ae){var oe=ae.rest;if(oe){for(var ce in oe)ae[ce]=oe[ce];delete ae.rest}var de=new j;return W(de,de.head,Z),F(Z,de,ae,de.head,0),(function(_e){for(var Ce=[],Me=_e.head.next;Me!==_e.tail;)Ce.push(Me.value),Me=Me.next;return Ce})(de)},hooks:{all:{},add:function(Z,ae){var oe=R.hooks.all;oe[Z]=oe[Z]||[],oe[Z].push(ae)},run:function(Z,ae){var oe=R.hooks.all[Z];if(oe&&oe.length)for(var ce,de=0;ce=oe[de++];)ce(ae)}},Token:$};function $(Z,ae,oe,ce){this.type=Z,this.content=ae,this.alias=oe,this.length=0|(ce||"").length}function P(Z,ae,oe,ce){Z.lastIndex=ae;var de=Z.exec(oe);if(de&&ce&&de[1]){var _e=de[1].length;de.index+=_e,de[0]=de[0].slice(_e)}return de}function F(Z,ae,oe,ce,de,_e){for(var Ce in oe)if(oe.hasOwnProperty(Ce)&&oe[Ce]){var Me=oe[Ce];Me=Array.isArray(Me)?Me:[Me];for(var Ge=0;Ge<Me.length;++Ge){if(_e&&_e.cause==Ce+","+Ge)return;var Ee=Me[Ge],ye=Ee.inside,be=!!Ee.lookbehind,Te=!!Ee.greedy,ke=Ee.alias;if(Te&&!Ee.pattern.global){var Ye=Ee.pattern.toString().match(/[imsuy]*$/)[0];Ee.pattern=RegExp(Ee.pattern.source,Ye+"g")}for(var $e=Ee.pattern||Ee,Le=ce.next,dt=de;Le!==ae.tail&&!(_e&&dt>=_e.reach);dt+=Le.value.length,Le=Le.next){var yt=Le.value;if(ae.length>Z.length)return;if(!(yt instanceof $)){var xt,rn=1;if(Te){if(!(xt=P($e,dt,Z,be))||xt.index>=Z.length)break;var hn=xt.index,jt=xt.index+xt[0].length,St=dt;for(St+=Le.value.length;hn>=St;)St+=(Le=Le.next).value.length;if(dt=St-=Le.value.length,Le.value instanceof $)continue;for(var Tt=Le;Tt!==ae.tail&&(St<jt||typeof Tt.value=="string");Tt=Tt.next)rn++,St+=Tt.value.length;rn--,yt=Z.slice(dt,St),xt.index-=dt}else if(!(xt=P($e,0,yt,be)))continue;hn=xt.index;var Xt=xt[0],Ke=yt.slice(0,hn),et=yt.slice(hn+Xt.length),Zt=dt+yt.length;_e&&Zt>_e.reach&&(_e.reach=Zt);var wt=Le.prev;if(Ke&&(wt=W(ae,wt,Ke),dt+=Ke.length),V(ae,wt,rn),Le=W(ae,wt,new $(Ce,ye?R.tokenize(Xt,ye):Xt,ke,Xt)),et&&W(ae,Le,et),rn>1){var Jt={cause:Ce+","+Ge,reach:Zt};F(Z,ae,oe,Le.prev,dt,Jt),_e&&Jt.reach>_e.reach&&(_e.reach=Jt.reach)}}}}}}function j(){var Z={value:null,prev:null,next:null},ae={value:null,prev:Z,next:null};Z.next=ae,this.head=Z,this.tail=ae,this.length=0}function W(Z,ae,oe){var ce=ae.next,de={value:oe,prev:ae,next:ce};return ae.next=de,ce.prev=de,Z.length++,de}function V(Z,ae,oe){for(var ce=ae.next,de=0;de<oe&&ce!==Z.tail;de++)ce=ce.next;ae.next=ce,ce.prev=ae,Z.length-=de}if(p.Prism=R,$.stringify=function Z(ae,oe){if(typeof ae=="string")return ae;if(Array.isArray(ae)){var ce="";return ae.forEach((function(Ge){ce+=Z(Ge,oe)})),ce}var de={type:ae.type,content:Z(ae.content,oe),tag:"span",classes:["token",ae.type],attributes:{},language:oe},_e=ae.alias;_e&&(Array.isArray(_e)?Array.prototype.push.apply(de.classes,_e):de.classes.push(_e)),R.hooks.run("wrap",de);var Ce="";for(var Me in de.attributes)Ce+=" "+Me+'="'+(de.attributes[Me]||"").replace(/"/g,"&quot;")+'"';return"<"+de.tag+' class="'+de.classes.join(" ")+'"'+Ce+">"+de.content+"</"+de.tag+">"},!p.document)return p.addEventListener&&(R.disableWorkerMessageHandler||p.addEventListener("message",(function(Z){var ae=JSON.parse(Z.data),oe=ae.language,ce=ae.code,de=ae.immediateClose;p.postMessage(R.highlight(ce,R.languages[oe],oe)),de&&p.close()}),!1)),R;var ee=R.util.currentScript();function ne(){R.manual||R.highlightAll()}if(ee&&(R.filename=ee.src,ee.hasAttribute("data-manual")&&(R.manual=!0)),!R.manual){var he=document.readyState;he==="loading"||he==="interactive"&&ee&&ee.defer?document.addEventListener("DOMContentLoaded",ne):window.requestAnimationFrame?window.requestAnimationFrame(ne):window.setTimeout(ne,16)}return R})(Hz);typeof d_<"u"&&d_.exports&&(d_.exports=D),typeof global<"u"&&(global.Prism=D);D.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},D.languages.markup.tag.inside["attr-value"].inside.entity=D.languages.markup.entity,D.languages.markup.doctype.inside["internal-subset"].inside=D.languages.markup,D.hooks.add("wrap",(function(p){p.type==="entity"&&(p.attributes.title=p.content.replace(/&amp;/,"&"))})),Object.defineProperty(D.languages.markup.tag,"addInlined",{value:function(p,b){var S={};S["language-"+b]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:D.languages[b]},S.cdata=/^<!\[CDATA\[|\]\]>$/i;var T={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:S}};T["language-"+b]={pattern:/[\s\S]+/,inside:D.languages[b]};var R={};R[p]={pattern:RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,(function(){return p})),"i"),lookbehind:!0,greedy:!0,inside:T},D.languages.insertBefore("markup","cdata",R)}}),Object.defineProperty(D.languages.markup.tag,"addAttribute",{value:function(p,b){D.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(`(^|["'\\s])(?:`+p+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[b,"language-"+b],inside:D.languages[b]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),D.languages.html=D.languages.markup,D.languages.mathml=D.languages.markup,D.languages.svg=D.languages.markup,D.languages.xml=D.languages.extend("markup",{}),D.languages.ssml=D.languages.xml,D.languages.atom=D.languages.xml,D.languages.rss=D.languages.xml;(function(p){var b=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;p.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+b.source+")*?(?:;|(?=\\s*\\{))"),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+b.source+`|(?:[^\\\\\r
14
14
  ()"']|\\\\[^])*)\\)`,"i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+b.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+b.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:b,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},p.languages.css.atrule.inside.rest=p.languages.css;var S=p.languages.markup;S&&(S.tag.addInlined("style","css"),S.tag.addAttribute("style","css"))})(D);D.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};D.languages.javascript=D.languages.extend("clike",{"class-name":[D.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),D.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,D.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r
15
15
  ]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r
16
16
  ])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r
@@ -109,7 +109,7 @@ ${new Date().toString()}
109
109
 
110
110
  ---
111
111
 
112
- `+$,Rd.writeFileSync(S,$,{encoding:"utf-8"})}function az(p){return new Promise((b,S)=>{let T={Authorization:`Client-ID ${nz}`};iA.post({url:`${tz}image`,encoding:"utf8",formData:{image:Rd.createReadStream(p)},json:!0,headers:T},(R,$,P)=>{if(R)return S(R);if(P.success){let F=P.data.link;return AD(p,F),b(F)}else return b(P.data.error.message)})})}function rz(p){return new Promise((b,S)=>{let T={authority:"sm.ms","user-agent":"crossnote",referer:""};iA.post({url:"https://sm.ms/api/v2/upload",formData:{smfile:Rd.createReadStream(p)},headers:T},(R,$,P)=>{try{if(P=JSON.parse(P),R)return S("Failed to upload image");if(P.code==="error")return S(P.msg);{let F=P.data.url;return AD(p,F),b(F)}}catch{return S("Failed to connect to sm.ms host")}})})}function iz(p,b,S,T,R){return new Promise(($,P)=>{if(!b)return P("Error: Qiniu AccessKey is missing");if(!S)return P("Error: Qiniu SecretKey is missing");if(!T)return P("Error: Qiniu Bucket is missing");if(!R)return P("Error: Qiniu Domain is missing");import("qiniu").then(F=>{let j=new F.auth.digest.Mac(b,S),V=new F.rs.PutPolicy({scope:T}).uploadToken(j),ee=new F.conf.Config,ne=xD.basename(p),he=new F.form_up.FormUploader(ee),Z=new F.form_up.PutExtra;return he.putFile(V,ne,p,Z,(ae,oe,ce)=>{if(ae)return P(ae.message);if(ce.statusCode===200){let _e=new F.rs.BucketManager(j,ee).publicDownloadUrl(R,ne);return $(_e)}else return P(ce.error)})}).catch(F=>P(F))})}function oA(p,{method:b="imgur",qiniu:S={AccessKey:"",SecretKey:"",Bucket:"",Domain:""}}){return b==="imgur"?az(p):b==="qiniu"?iz(p,S.AccessKey,S.SecretKey,S.Bucket,S.Domain):rz(p)}var TD={};"structuredClone"in globalThis||(globalThis.structuredClone=CD.default);Fw.track();function Xo(p){return new Promise((b,S)=>{Fw.open(p,(T,R)=>T?S(T.toString()):b(R))})}function Nd(p){if(process.platform==="win32")return p.match(/^[a-zA-Z]:\\/)&&(p="file:///"+p),p.startsWith("file:///")?lh.execFile("explorer.exe",[p]):lh.exec(`start ${p}`);process.platform==="darwin"?lh.execFile("open",[p]):lh.execFile("xdg-open",[p])}function Pw(p=""){p.startsWith("---")&&(p=p.trim().replace(/^---\r?\n/,"").replace(/\r?\n---$/,""));try{return ID.parse(p)}catch(b){return{error:b.toString()}}}var OD=(()=>{if(typeof __dirname<"u")return i0.resolve(__dirname,"../");if(TD.url){let p=(0,ND.fileURLToPath)(TD.url),b=i0.dirname(p);return i0.resolve(b,"../")}else return""})();function DD(p){OD=p}function wt(){return OD}var sA=null;function MD(p){sA=p}function yn(p,b){return sA&&b?sA(p,b):(p.startsWith("file://")||(p="file:///"+p),p=p.replace(/^file:\/+/,"file:///"),p)}function Fs(p){let b=/^(?:(?:file|(vscode)-(?:webview-)?resource|vscode--resource):\/+)(.*)/m;return p.replace(b,(S,T,R)=>(T&&(R=R.replace(/^file\/+/,"")),process.platform!=="win32"&&!R.startsWith("/")?"/"+R:R))}function LD(p){let b=globalThis.eval;try{return globalThis.eval=S=>uh.runInThisContext(S),p()}finally{globalThis.eval=b}}function FD(p){let b=globalThis.Function;try{return globalThis.Function=lA,p()}finally{globalThis.Function=b}}async function PD(p){let b=globalThis.Function,S=globalThis.eval;try{return globalThis.Function=lA,globalThis.eval=T=>uh.runInThisContext(T),await p()}finally{globalThis.eval=S,globalThis.Function=b}}var o0=p=>p.attributes.cmd===!0?p.language:p.attributes.cmd;function lA(...p){let b="",S=[];if(p.length){b=p[p.length-1];for(let R=0;R<p.length-1;R++)S.push(p[R])}let T=[];for(let R=0,$=S.length;R<$;R++){let P=S[R];typeof P=="string"&&(P=P.split(/\s*,\s*/)),T.push.apply(T,P)}return uh.runInThisContext(`
112
+ `+$,Rd.writeFileSync(S,$,{encoding:"utf-8"})}function az(p){return new Promise((b,S)=>{let T={Authorization:`Client-ID ${nz}`};iA.post({url:`${tz}image`,encoding:"utf8",formData:{image:Rd.createReadStream(p)},json:!0,headers:T},(R,$,P)=>{if(R)return S(R);if(P.success){let F=P.data.link;return AD(p,F),b(F)}else return b(P.data.error.message)})})}function rz(p){return new Promise((b,S)=>{let T={authority:"sm.ms","user-agent":"crossnote",referer:""};iA.post({url:"https://sm.ms/api/v2/upload",formData:{smfile:Rd.createReadStream(p)},headers:T},(R,$,P)=>{try{if(P=JSON.parse(P),R)return S("Failed to upload image");if(P.code==="error")return S(P.msg);{let F=P.data.url;return AD(p,F),b(F)}}catch{return S("Failed to connect to sm.ms host")}})})}function iz(p,b,S,T,R){return new Promise(($,P)=>{if(!b)return P("Error: Qiniu AccessKey is missing");if(!S)return P("Error: Qiniu SecretKey is missing");if(!T)return P("Error: Qiniu Bucket is missing");if(!R)return P("Error: Qiniu Domain is missing");import("qiniu").then(F=>{let j=new F.auth.digest.Mac(b,S),V=new F.rs.PutPolicy({scope:T}).uploadToken(j),ee=new F.conf.Config,ne=xD.basename(p),he=new F.form_up.FormUploader(ee),Z=new F.form_up.PutExtra;return he.putFile(V,ne,p,Z,(ae,oe,ce)=>{if(ae)return P(ae.message);if(ce.statusCode===200){let _e=new F.rs.BucketManager(j,ee).publicDownloadUrl(R,ne);return $(_e)}else return P(ce.error)})}).catch(F=>P(F))})}function oA(p,{method:b="imgur",qiniu:S={AccessKey:"",SecretKey:"",Bucket:"",Domain:""}}){return b==="imgur"?az(p):b==="qiniu"?iz(p,S.AccessKey,S.SecretKey,S.Bucket,S.Domain):rz(p)}var TD={};"structuredClone"in globalThis||(globalThis.structuredClone=CD.default);Fw.track();function Xo(p){return new Promise((b,S)=>{Fw.open(p,(T,R)=>T?S(T.toString()):b(R))})}function Nd(p){if(process.platform==="win32")return p.match(/^[a-zA-Z]:\\/)&&(p="file:///"+p),p.startsWith("file:///")?lh.execFile("explorer.exe",[p]):lh.exec(`start ${p}`);process.platform==="darwin"?lh.execFile("open",[p]):lh.execFile("xdg-open",[p])}function Pw(p=""){p.startsWith("---")&&(p=p.trim().replace(/^---\r?\n/,"").replace(/\r?\n---$/,""));try{return ID.parse(p)}catch(b){return{error:b.toString()}}}var OD=(()=>{if(typeof __dirname<"u")return i0.resolve(__dirname,"../");if(TD.url){let p=(0,ND.fileURLToPath)(TD.url),b=i0.dirname(p);return i0.resolve(b,"../")}else return""})();function DD(p){OD=p}function Et(){return OD}var sA=null;function MD(p){sA=p}function yn(p,b){return sA&&b?sA(p,b):(p.startsWith("file://")||(p="file:///"+p),p=p.replace(/^file:\/+/,"file:///"),p)}function Fs(p){let b=/^(?:(?:file|(vscode)-(?:webview-)?resource|vscode--resource):\/+)(.*)/m;return p.replace(b,(S,T,R)=>(T&&(R=R.replace(/^file\/+/,"")),process.platform!=="win32"&&!R.startsWith("/")?"/"+R:R))}function LD(p){let b=globalThis.eval;try{return globalThis.eval=S=>uh.runInThisContext(S),p()}finally{globalThis.eval=b}}function FD(p){let b=globalThis.Function;try{return globalThis.Function=lA,p()}finally{globalThis.Function=b}}async function PD(p){let b=globalThis.Function,S=globalThis.eval;try{return globalThis.Function=lA,globalThis.eval=T=>uh.runInThisContext(T),await p()}finally{globalThis.eval=S,globalThis.Function=b}}var o0=p=>p.attributes.cmd===!0?p.language:p.attributes.cmd;function lA(...p){let b="",S=[];if(p.length){b=p[p.length-1];for(let R=0;R<p.length-1;R++)S.push(p[R])}let T=[];for(let R=0,$=S.length;R<$;R++){let P=S[R];typeof P=="string"&&(P=P.split(/\s*,\s*/)),T.push.apply(T,P)}return uh.runInThisContext(`
113
113
  (function(${T.join(", ")}) {
114
114
  ${b}
115
115
  })
@@ -142,28 +142,28 @@ ${T}<${S} data-source-line="${p+1}" class="${b}" style="margin:0;"></${S}>
142
142
  ${R}
143
143
  ${R}`}var pA=null;function mz(p){return new Promise((b,S)=>{if(!p.match(/^https?:\/\//))return b(p);pA||(pA=iM.mkdirSync("crossnote_downloads")),mA.default.get({url:p,encoding:"binary"},async(T,R,$)=>{if(T)return S(T);{let P=Cr.resolve(pA??"/tmp/crossnote_downloads",Pa(p))+Cr.extname(p);return await nM.writeFile(P,$,"binary"),P}})})}async function gz(p,{fileDirectoryPath:b,imageDirectoryPath:S,notebook:T},R={}){if(R[p])return R[p];if(p.endsWith(".less")){let $=await T.fs.readFile(p);return await new Promise((P,F)=>{aM.render($,{paths:[Cr.dirname(p)]},(j,W)=>j?F(j):P((W==null?void 0:W.css)||""))})}else if(p.endsWith(".pdf")){let $=await mz(p);return await Uw($,{markdownDirectoryPath:b,svgDirectoryPath:S})}else return p.match(/^https?:\/\//)?(p.startsWith("https://github.com/")&&(p=p.replace("https://github.com/","https://raw.githubusercontent.com/").replace("/blob/","/")),await new Promise(($,P)=>{(0,mA.default)(p,(F,j,W)=>{F?P(F):$(W.toString())})})):await T.fs.readFile(p)}async function Vu(p,{fileDirectoryPath:b="",projectDirectoryPath:S="",filesCache:T={},useRelativeFilePath:R=!1,forPreview:$=!1,forMarkdownExport:P=!1,usePandocParser:F=!1,protocolsWhiteListRegExp:j=null,notSourceFile:W=!1,imageDirectoryPath:V="",headingIdGenerator:ee=new uo,notebook:ne,forJest:he=!1,fileHash:Z,timestamp:ae}){p=p.replace(/\r\n/g,`
144
144
  `);let oe=null,ce=0,de=[],_e=[],Ce=[],Me=!1,Ge="";async function Ee(be,Te=0){let ke="";function Ye(Le){let dt=p.indexOf(`
145
- `,Le);dt<0&&(dt=p.length);let yt=p.substring(Le,dt),xt="",rn=yt.match(/^\s*(>+)\s?/);return rn?(xt=rn[0],yt=yt.replace(rn[0],"")):xt="",{line:yt,blockquotePrefix:xt,end:dt}}let $e=()=>$&&!W;for(;be<p.length;){let{line:Le,blockquotePrefix:dt,end:yt}=Ye(be);ke+=dt;let xt=!!oe,rn=(Le.match(/^\s*[`]{3,}/)||[])[0];if(rn&&!Le.substring(rn.length).trim().match(/[`]{3,}/)){if(!xt&&$e()){let Zt=Le.indexOf("{"),Et=Le.lastIndexOf("}");if(Zt>0&&Et>0){let Jt=Le.substring(Zt+1,Et);Le=Le.substring(0,Zt)+` {${Jt} data-source-line="${Te+1}"}`}else Le=Le.trimEnd()+` {data-source-line="${Te+1}"}`}let et=!!Le.match(/"?cmd"?\s*[:=\s}]/);!xt&&!W&&et&&(Le=Le.replace("{",`{code_chunk_offset=${ce}, `),ce++),xt?oe!==null&&rn.trim().length===oe.trim().length&&(oe=null):oe=rn,be=yt+1,Te=Te+1,ke=ke+Le+`
145
+ `,Le);dt<0&&(dt=p.length);let yt=p.substring(Le,dt),xt="",rn=yt.match(/^\s*(>+)\s?/);return rn?(xt=rn[0],yt=yt.replace(rn[0],"")):xt="",{line:yt,blockquotePrefix:xt,end:dt}}let $e=()=>$&&!W;for(;be<p.length;){let{line:Le,blockquotePrefix:dt,end:yt}=Ye(be);ke+=dt;let xt=!!oe,rn=(Le.match(/^\s*[`]{3,}/)||[])[0];if(rn&&!Le.substring(rn.length).trim().match(/[`]{3,}/)){if(!xt&&$e()){let Zt=Le.indexOf("{"),wt=Le.lastIndexOf("}");if(Zt>0&&wt>0){let Jt=Le.substring(Zt+1,wt);Le=Le.substring(0,Zt)+` {${Jt} data-source-line="${Te+1}"}`}else Le=Le.trimEnd()+` {data-source-line="${Te+1}"}`}let et=!!Le.match(/"?cmd"?\s*[:=\s}]/);!xt&&!W&&et&&(Le=Le.replace("{",`{code_chunk_offset=${ce}, `),ce++),xt?oe!==null&&rn.trim().length===oe.trim().length&&(oe=null):oe=rn,be=yt+1,Te=Te+1,ke=ke+Le+`
146
146
  `;continue}if(xt){be=yt+1,Te=Te+1,ke=ke+Le+`
147
147
  `;continue}let hn,jt;if(Le.match(/^<!--/)){let Ke=p.indexOf("-->",be+4);if(Ke<0){be=p.length,Te=Te+1,ke=ke+`
148
- `;continue}else Ke+=3;let et=Le.match(/^<!--\s+([^\s]+)/);if(et){let Zt=et[1];if(Zt==="@import"){let Et=Le.lastIndexOf("-->");Et>0&&(Le=Le.slice(4,Et).trim())}else if(Zt in dA){let Et=p.slice(be+4,Ke-3),Jt=Et.match(/\n/g),Lt=Jt?Jt.length:0,Ct=Et.trim().match(/^([^\s]+?)\s([\s\S]+)$/),ht={};if(Ct&&Ct[2]&&(ht=Yr(Ct[2])),ht.lineNo=Te+1,Zt==="pagebreak"||Zt==="newpage"){be=Ke,Te=Te+Lt,ke=ke+'<div class="pagebreak"> </div>'+`
149
- `.repeat(Lt);continue}else if(Zt.match(/^\.?slide:?$/))if(de.push(ht),P){be=Ke,Te=Te+Lt,ke=ke+`<!-- ${Et} -->
148
+ `;continue}else Ke+=3;let et=Le.match(/^<!--\s+([^\s]+)/);if(et){let Zt=et[1];if(Zt==="@import"){let wt=Le.lastIndexOf("-->");wt>0&&(Le=Le.slice(4,wt).trim())}else if(Zt in dA){let wt=p.slice(be+4,Ke-3),Jt=wt.match(/\n/g),Lt=Jt?Jt.length:0,Ct=wt.trim().match(/^([^\s]+?)\s([\s\S]+)$/),ht={};if(Ct&&Ct[2]&&(ht=Yr(Ct[2])),ht.lineNo=Te+1,Zt==="pagebreak"||Zt==="newpage"){be=Ke,Te=Te+Lt,ke=ke+'<div class="pagebreak"> </div>'+`
149
+ `.repeat(Lt);continue}else if(Zt.match(/^\.?slide:?$/))if(de.push(ht),P){be=Ke,Te=Te+Lt,ke=ke+`<!-- ${wt} -->
150
150
  `;continue}else{be=Ke,Te=Te+Lt,ke=ke+(F?`<p${$e()?` data-source-line="${Te-Lt+1}"`:""}><span>[CROSSNOTESLIDE]</span></p> `:"<span>[CROSSNOTESLIDE]</span> ")+`
151
151
  `.repeat(Lt);continue}}else{let Jt=p.slice(be+4,Ke-3).match(/\n/g),Lt=Jt?Jt.length:0;be=Ke,Te=Te+Lt,ke=ke+`
152
- `.repeat(Lt);continue}}else{let Et=p.slice(be+4,Ke-3).match(/\n/g),Jt=Et?Et.length:0;be=Ke,Te=Te+Jt,ke=ke+`
153
- `.repeat(Jt);continue}}else if(hn=Le.match(/^(#{1,7})\s.*/)){let Ke=Le.replace(hn[1],"").trim(),et=hn[1],Zt=et.length,Et=Ke.match(/{[^{]+\}\s*$/),Jt="",Lt="",Ct=!1,ht={};if(Et){Ke=Ke.replace(Et[0],"").trim();try{ht=Yr(Et[0]),Jt=ht.class??"",Lt=ht.id??"",Ct=ht.ignore,delete ht.class,delete ht.id,delete ht.ignore}catch{Ke="OptionsError: "+Et[1],Ct=!0}}if(Lt||(Lt=ee.generateId(Ke),ne.config.usePandocParser&&(Lt=Lt.replace(/^[\d-]+/,""),Lt||(Lt="section"))),Ct||Ce.push({content:Ke,level:Zt,id:Lt,lineNo:Te+1}),P){be=yt+1,Te=Te+1,ke=ke+Le+`
152
+ `.repeat(Lt);continue}}else{let wt=p.slice(be+4,Ke-3).match(/\n/g),Jt=wt?wt.length:0;be=Ke,Te=Te+Jt,ke=ke+`
153
+ `.repeat(Jt);continue}}else if(hn=Le.match(/^(#{1,7})\s.*/)){let Ke=Le.replace(hn[1],"").trim(),et=hn[1],Zt=et.length,wt=Ke.match(/{[^{]+\}\s*$/),Jt="",Lt="",Ct=!1,ht={};if(wt){Ke=Ke.replace(wt[0],"").trim();try{ht=Yr(wt[0]),Jt=ht.class??"",Lt=ht.id??"",Ct=ht.ignore,delete ht.class,delete ht.id,delete ht.ignore}catch{Ke="OptionsError: "+wt[1],Ct=!0}}if(Lt||(Lt=ee.generateId(Ke),ne.config.usePandocParser&&(Lt=Lt.replace(/^[\d-]+/,""),Lt||(Lt="section"))),Ct||Ce.push({content:Ke,level:Zt,id:Lt,lineNo:Te+1}),P){be=yt+1,Te=Te+1,ke=ke+Le+`
154
154
  `;continue}else{let Ie="{";if(Lt&&(Ie+=`#${Lt} `),Jt&&(Ie+="."+Jt.replace(/\s+/g," .")+" "),ht)for(let Xe in ht)typeof ht[Xe]=="number"?Ie+=" "+Xe+"="+ht[Xe]:Ie+=" "+Xe+'="'+ht[Xe]+'"';$e()&&(Ie+=` data-source-line="${Te+1}"`),Ie+="}",Ie==="{}"&&(Ie=""),be=yt+1,Te=Te+1,ke=ke+`${et} ${Ke} ${Ie}
155
155
  `;continue}}else if(Le.match(/^\s*\[toc\]\s*$/i)){Me=!0,be=yt+1,Te=Te+1,ke=ke+(F?`<p${$e()?` data-source-line="${Te}"`:""}><span>[CROSSNOTETOC]</span></p>
156
156
  `:`<span>[CROSSNOTETOC]</span>
157
157
  `);continue}else if(jt=Le.match(/^\s*(?:[*\-+]|\d+\.)\s+(\[[xX\s]\])\s/)){let Ke=jt[1]!=="[ ]";P||(Le=Le.replace(jt[1],`<input type="checkbox" class="task-list-item-checkbox" ${$e()?`data-source-line="${Te+1}"`:""}${Ke?" checked":""}>`)),be=yt+1,Te=Te+1,ke=ke+Le+`
158
- `;continue}let St=Le.match(/^(\s*)@import(\s+)"([^"]+)";?/),Tt=Le.match(/^(\s*)!\[([^\]]*)\]\(([^)]+)\)(?:{([^}]*)})?(\s*)$/),Xt=Le.match(/^(\s*)!\[\[(.+?)\]\](?:{([^}]*)})?\s*$/);if(St||Tt||Xt){let Ke="";if(St)ke+=St[1],Ke=St[3].trim();else if(Tt)ke+=Tt[1],Ke=Tt[3].trim().replace(/\s"[^"]*"\s*$/,"");else if(Xt){ke+=Xt[1];let{link:Ie}=ne.processWikilink(Xt[2]);Ke=Ie}let et={},Zt="";if(Tt&&Tt[4])Zt=Tt[4];else if(Xt&&Xt[3])Zt=Xt[3];else if(St){let Ie=Le.indexOf("{");if(Ie>0){let Xe=Le.lastIndexOf("}");Xe>0&&(Zt=Le.substring(Ie+1,Xe))}}if(Zt.length>0)try{et=Yr(Zt)}catch{}$e()&&(et["data-source-line"]=Te+1);let Et;j&&Ke.match(j)?Et=Ke:Ke.startsWith("/")?Et=Cr.resolve(S,"."+Ke):Et=Cr.resolve(b,Ke);let Jt="",Lt=Et.lastIndexOf("#");Lt>0&&(Jt=Et.substring(Lt),Et=Et.substring(0,Lt));let Ct=Cr.extname(Et).toLocaleLowerCase(),ht="";if(Ke==="[TOC]"){et.cmd="toc",et.hide=!0,et.run_on_save=!0,et.modify_source=!0,W||(et.code_chunk_offset=ce,ce++);let Ie=`\`\`\`text ${pn(et)}
159
- \`\`\` `;be=yt+1,Te=Te+1,ke=ke+Ie;continue}else if(Ct.match(/^\.(apng|avif|gif|jpeg|jpg|png|svg|bmp|webp|emf)/)||Ct===""){if(St||Xt){let Ie=T[Ke];Ie||(j&&Ke.match(j)?Ie=Ke:R?Ie=Cr.relative(b,Et)+"?"+(ae??Math.random()):Ie="/"+Cr.relative(S,Et)+"?"+(ae??Math.random()),Ie=Ie.replace(/ /g,"%20").replace(/\\/g,"/"),T[Ke]=Ie),ht="![",et.alt&&(ht+=et.alt,delete et.alt),ht+=`](${Ie}`,et.title&&(ht+=` "${et.title}"`,delete et.title),ht+=")";let Xe=pn(et);Xe?ht+=`{${Xe}} `:ht+=" "}else if(Tt){let Ie=pn(et);ht=`![${Tt[2]??""}](${Tt[3]??""})${Ie?`{${Ie}}`:""}${Tt[5]}`}be=yt+1,Te=Te+1,ke=ke+ht+`
160
- `;continue}else try{let Ie=await gz(Et,{fileDirectoryPath:b,imageDirectoryPath:V,notebook:ne},T);if(T[Et]=Ie,et.line_begin||et.line_end){let Xe=Ie.split(/\n/);Ie=Xe.slice(parseInt(et.line_begin,10)||0,parseInt(et.line_end,10)||Xe.length).join(`
158
+ `;continue}let St=Le.match(/^(\s*)@import(\s+)"([^"]+)";?/),Tt=Le.match(/^(\s*)!\[([^\]]*)\]\(([^)]+)\)(?:{([^}]*)})?(\s*)$/),Xt=Le.match(/^(\s*)!\[\[(.+?)\]\](?:{([^}]*)})?\s*$/);if(St||Tt||Xt){let Ke="";if(St)ke+=St[1],Ke=St[3].trim();else if(Tt)ke+=Tt[1],Ke=Tt[3].trim().replace(/\s"[^"]*"\s*$/,"");else if(Xt){ke+=Xt[1];let{link:Ie}=ne.processWikilink(Xt[2]);Ke=Ie}let et={},Zt="";if(Tt&&Tt[4])Zt=Tt[4];else if(Xt&&Xt[3])Zt=Xt[3];else if(St){let Ie=Le.indexOf("{");if(Ie>0){let Xe=Le.lastIndexOf("}");Xe>0&&(Zt=Le.substring(Ie+1,Xe))}}if(Zt.length>0)try{et=Yr(Zt)}catch{}$e()&&(et["data-source-line"]=Te+1);let wt;j&&Ke.match(j)?wt=Ke:Ke.startsWith("/")?wt=Cr.resolve(S,"."+Ke):wt=Cr.resolve(b,Ke);let Jt="",Lt=wt.lastIndexOf("#");Lt>0&&(Jt=wt.substring(Lt),wt=wt.substring(0,Lt));let Ct=Cr.extname(wt).toLocaleLowerCase(),ht="";if(Ke==="[TOC]"){et.cmd="toc",et.hide=!0,et.run_on_save=!0,et.modify_source=!0,W||(et.code_chunk_offset=ce,ce++);let Ie=`\`\`\`text ${pn(et)}
159
+ \`\`\` `;be=yt+1,Te=Te+1,ke=ke+Ie;continue}else if(Ct.match(/^\.(apng|avif|gif|jpeg|jpg|png|svg|bmp|webp|emf)/)||Ct===""){if(St||Xt){let Ie=T[Ke];Ie||(j&&Ke.match(j)?Ie=Ke:R?Ie=Cr.relative(b,wt)+"?"+(ae??Math.random()):Ie="/"+Cr.relative(S,wt)+"?"+(ae??Math.random()),Ie=Ie.replace(/ /g,"%20").replace(/\\/g,"/"),T[Ke]=Ie),ht="![",et.alt&&(ht+=et.alt,delete et.alt),ht+=`](${Ie}`,et.title&&(ht+=` "${et.title}"`,delete et.title),ht+=")";let Xe=pn(et);Xe?ht+=`{${Xe}} `:ht+=" "}else if(Tt){let Ie=pn(et);ht=`![${Tt[2]??""}](${Tt[3]??""})${Ie?`{${Ie}}`:""}${Tt[5]}`}be=yt+1,Te=Te+1,ke=ke+ht+`
160
+ `;continue}else try{let Ie=await gz(wt,{fileDirectoryPath:b,imageDirectoryPath:V,notebook:ne},T);if(T[wt]=Ie,et.line_begin||et.line_end){let Xe=Ie.split(/\n/);Ie=Xe.slice(parseInt(et.line_begin,10)||0,parseInt(et.line_end,10)||Xe.length).join(`
161
161
  `)}if(et.code_block){let Xe=Ct.slice(1,Ct.length);ht=`\`\`\`${et.as||fA[Xe]||Xe} ${pn(et)}
162
162
  ${Ie}
163
- \`\`\` `}else if(et.cmd){et.id||(et.id=Pa(Et)),W||(et.code_chunk_offset=ce,ce++);let Xe=Ct.slice(1,Ct.length);ht=`\`\`\`${et.as||fA[Xe]||Xe} ${pn(et)}
163
+ \`\`\` `}else if(et.cmd){et.id||(et.id=Pa(wt)),W||(et.code_chunk_offset=ce,ce++);let Xe=Ct.slice(1,Ct.length);ht=`\`\`\`${et.as||fA[Xe]||Xe} ${pn(et)}
164
164
  ${Ie}
165
- \`\`\` `}else if(ne.config.markdownFileExtensions.includes(Ct)){ne.config.parserConfig.onWillParseMarkdown&&(Ie=await ne.config.parserConfig.onWillParseMarkdown(Ie));let{outputString:Xe,headings:tt}=await Vu(Ie,{fileDirectoryPath:Cr.dirname(Et),projectDirectoryPath:S,filesCache:T,useRelativeFilePath:!1,forPreview:!1,usePandocParser:F,forMarkdownExport:P,protocolsWhiteListRegExp:j,notSourceFile:!0,imageDirectoryPath:V,notebook:ne,headingIdGenerator:ee,fileHash:Jt});ht=`
166
- `+Xe+" ",Ce=Ce.concat(tt)}else if(Ct===".html")ht="<div>"+Ie+"</div> ";else if(Ct===".csv"){let Xe=rM.parse(Ie.trim());Xe.errors.length?ht=`<pre class="language-text"><code>${(0,hA.escape)(Xe.errors[0].toString())}</code></pre> `:ht=pz(Xe.data)}else if(Ct===".css"||Ct===".js"){if($)ht="";else{let Xe;j&&Ke.match(j)?Xe=Ke:R?Xe=Cr.relative(b,Et):Xe="file:///"+Et,Ct===".js"?ht=`<script type="text/javascript" src="${Xe}"></script>`:ht=`<link rel="stylesheet" href="${Xe}">`}_e.push(Ke)}else if(Ct===".less")ht=`<style>${Ie}</style>`;else if(Ct===".pdf")if(et.page_no){let Xe=Ie.split(`
165
+ \`\`\` `}else if(ne.config.markdownFileExtensions.includes(Ct)){ne.config.parserConfig.onWillParseMarkdown&&(Ie=await ne.config.parserConfig.onWillParseMarkdown(Ie));let{outputString:Xe,headings:tt}=await Vu(Ie,{fileDirectoryPath:Cr.dirname(wt),projectDirectoryPath:S,filesCache:T,useRelativeFilePath:!1,forPreview:!1,usePandocParser:F,forMarkdownExport:P,protocolsWhiteListRegExp:j,notSourceFile:!0,imageDirectoryPath:V,notebook:ne,headingIdGenerator:ee,fileHash:Jt});ht=`
166
+ `+Xe+" ",Ce=Ce.concat(tt)}else if(Ct===".html")ht="<div>"+Ie+"</div> ";else if(Ct===".csv"){let Xe=rM.parse(Ie.trim());Xe.errors.length?ht=`<pre class="language-text"><code>${(0,hA.escape)(Xe.errors[0].toString())}</code></pre> `:ht=pz(Xe.data)}else if(Ct===".css"||Ct===".js"){if($)ht="";else{let Xe;j&&Ke.match(j)?Xe=Ke:R?Xe=Cr.relative(b,wt):Xe="file:///"+wt,Ct===".js"?ht=`<script type="text/javascript" src="${Xe}"></script>`:ht=`<link rel="stylesheet" href="${Xe}">`}_e.push(Ke)}else if(Ct===".less")ht=`<style>${Ie}</style>`;else if(Ct===".pdf")if(et.page_no){let Xe=Ie.split(`
167
167
  `),tt=parseInt(et.page_no,10)-1;tt<0&&(tt=0),ht=Xe[tt]||""}else if(et&&(et.page_begin||et.page_end)){let Xe=Ie.split(`
168
168
  `),tt=parseInt(et.page_begin,10)-1||0,Kr=et.page_end||Xe.length-1;tt<0&&(tt=0),ht=Xe.slice(tt,Kr).join(`
169
169
  `)||""}else ht=Ie;else if(Ct===".dot"||Ct===".gv"||Ct===".viz"||Ct===".graphviz")ht=`\`\`\`dot ${pn(et,!0)}
@@ -171,7 +171,7 @@ ${Ie}
171
171
  \`\`\` `;else if(Ct===".mermaid")ht=`\`\`\`mermaid ${pn(et,!0)}
172
172
  ${Ie}
173
173
  \`\`\` `;else if(Ct===".plantuml"||Ct===".puml")ht=`\`\`\`puml ${pn(et,!0)}
174
- ' @crossnote_file_directory_path:${Cr.dirname(Et)}
174
+ ' @crossnote_file_directory_path:${Cr.dirname(wt)}
175
175
  ${Ie}
176
176
  \`\`\` `;else{let Xe=et.as??null;if(et.code_block===!1)ht=Ie;else{let tt=Ct.slice(1,Ct.length);ht=`\`\`\`${Xe||fA[tt]||tt} ${et?pn(et):""}
177
177
  ${Ie}
@@ -342,10 +342,10 @@ ${p}`}var f0=class{constructor(){this.map={}}addReference(b,S,T){if(b===S&&!T){b
342
342
  `;$.push(`<div class="line-highlight-wrapper">${F}<div aria-hidden="true" class="line-highlight" data-range="${P}" data-start="${P}">
343
343
  </div></div>`)}}),p.append($.join("")),p.attr("data-line",S.join(","))}var N2=require("path");async function f_(p,b,S){let T=[];p("img").each((R,$)=>{let P=p($),F=S(P.attr("src"),!1);if(F.match(/^(file|vscode-resource):\/\/+/)){F=Fs(F),F=F.replace(/\?(\.|\d)+$/,"");let W=(0,N2.extname)(F).slice(1);if(W==="svg")return;T.push(new Promise(V=>{b.fs.readFile(decodeURI(F),"base64").then(ee=>(P.attr("src",`data:image/${W};charset=utf-8;base64,${ee}`),V(ee))).catch(ee=>(console.error(ee),V(null)))}))}}),await Promise.all(T)}var I2=require("path");async function TA(p,b,S){let T=[];p("img").each((R,$)=>{let P=p($),F=S(P.attr("src"),!1);if(F.match(/^(file|vscode-resource):\/\/+/)){if(F=Fs(F),F=F.replace(/\?(\.|\d)+$/,""),(0,I2.extname)(F).slice(1)!=="svg")return;T.push(new Promise(V=>{b.fs.readFile(decodeURI(F),"base64").then(ee=>(P.attr("src",`data:image/svg+xml;charset=utf-8;base64,${ee}`),V(ee))).catch(()=>V(null))}))}}),await Promise.all(T)}async function CA(p){let b=[],S=[],T=[];p("table").each((R,$)=>{let P=p($),F=null;P.children().each((j,W)=>{p(W).children().each((ee,ne)=>{let he=p(ne);he.children().each((Z,ae)=>{let oe=p(ae),ce=oe.text(),de=oe.html();if(!ce.length&&!(de!=null&&de.length)){let _e=oe.prev();_e.length&&T.push([_e,oe])}else if(ce.trim()==="^"&&F){let _e=p(F.children()[Z]);_e.length&&b.push([_e,oe])}else if(ce.trim()===">"){let _e=oe.next();_e.length&&S.push([oe,_e])}}),F=he})})});for(let R=b.length-1;R>=0;R--){let[$,P]=b[R],F=(parseInt($.attr("rowspan"),10)||1)+(parseInt(P.attr("rowspan"),10)||1);$.attr("rowspan",F.toString()),P.remove()}for(let R=0;R<S.length;R++){let[$,P]=S[R],F=(parseInt($.attr("colspan"),10)||1)+(parseInt(P.attr("colspan"),10)||1);P.attr("colspan",F.toString()),$.remove()}for(let R=T.length-1;R>=0;R--){let[$,P]=T[R],F=(parseInt($.attr("colspan"),10)||1)+(parseInt(P.attr("colspan"),10)||1);$.attr("colspan",F.toString()),P.remove()}}var RA=require("html-escaper");async function NA(p,b,S,T){let R=[],$=[];p('[data-role="codeBlock"]').each((P,F)=>{let j=p(F);if(j.data("executor"))return;let W=j.data("normalizedInfo");W.attributes.cmd&&(j.data("executor","fenced-code-chunks"),R.push(Yz(j,W,p,b,$,S,T)))}),await Promise.all(R)}async function Yz(p,b,S,T,R,$,P){let F=p.text(),j=b.attributes.id||"code-chunk-id-"+R.length,W=o0(b),V=["js","javascript"].indexOf(W)!==-1,ee=S('<div class="code-chunk"></div>');ee.attr("data-id",j),ee.attr("data-cmd",W),V&&ee.attr("data-code",F),p.replaceWith(ee);let ne=S('<div class="input-div"/>');ne.append(p),ee.append(ne);let he=T[j],Z=R.length?R[R.length-1].id:"";he?(he.code=F,he.normalizedInfo=b,he.prev=Z):(he={id:j,code:F,normalizedInfo:b,result:"",plainResult:"",running:!1,prev:Z,next:null},T[j]=he),Z&&T[Z]&&(T[Z].next=j),R.push(he),$.triggeredBySave&&b.attributes.run_on_save&&await p_(j,T,P);let ae=he.result;!ae&&he.normalizedInfo.attributes.element&&(ae=he.normalizedInfo.attributes.element,he.result=ae),he.running&&ee.addClass("running");let oe='<div class="status">running...</div>',ce='<div class="code-chunk-btn-group"><div class="run-btn btn btn-xs btn-primary"><span>\u25B6\uFE0E</span></div><div class="run-all-btn btn btn-xs btn-primary">all</div></div>',de=`<div class="output-div">${ae}</div>`;!$.isForPreview&&V&&(de+=`<script>${F}</script>`,ae=he.normalizedInfo.attributes.element||""),ne.append(ce),ne.append(oe),b.attributes.output_first===!0?ee.prepend(de):ee.append(de)}async function p_(p,b,S){let{headings:T,enableScriptExecution:R,filePath:$,fileDirectoryPath:P,latexEngine:F,modifySource:j,parseMD:W}=S,V=b[p];if(!V||V.running)return"";let ee=[V.code],ne=V;for(;ne.normalizedInfo.attributes.continue;){let de=ne.normalizedInfo.attributes.continue;if(de===!0&&(de=ne.prev),ne=b[de],!ne)break;ee.unshift(ne.code)}let he=ee.join(`
344
344
  `),Z=o0(V.normalizedInfo);V.running=!0;let ae,oe="text",ce=V.normalizedInfo.attributes.modify_source;try{let de=V.normalizedInfo.attributes;if(Z==="toc")ae=dh(T,{ordered:de.ordered_list,depthFrom:de.depth_from,depthTo:de.depth_to,tab:de.tab||" ",ignoreLink:de.ignore_link}).content,oe="markdown",ce=!0;else{if(!R)return"";ae=await uM(he,P,Z,V.normalizedInfo.attributes,F)}if(V.plainResult=ae,ce&&"code_chunk_offset"in V.normalizedInfo.attributes)return V.result="",j(V,ae,$);if(Z.match(/(la)?tex/)||Z==="pdflatex"||de.matplotlib||de.mpl?oe="markdown":V.normalizedInfo.attributes.output&&(oe=V.normalizedInfo.attributes.output),!ae)ae="";else if(oe!=="html")if(oe==="png")ae=`<img src="data:image/png;charset=utf-8;base64,${new Buffer(ae).toString("base64")}">`;else if(oe==="markdown"){let{html:_e}=await W(ae,{useRelativeFilePath:!0,isForPreview:!1,hideFrontMatter:!0});ae=_e}else oe==="none"?ae="":ae=`<pre class="language-text"><code>${(0,RA.escape)(ae)}</code></pre>`}catch(de){ae=`<pre class="language-text"><code>${(0,RA.escape)(de.toString())}</code></pre>`}return V.result=ae,V.running=!1,ae}async function IA(p,b){let S=[];for(let T in p)p.hasOwnProperty(T)&&S.push(p_(T,p,b));return Promise.all(S)}var P2=Ve(require("cross-fetch")),mh=require("html-escaper"),$2=Ve(require("yaml"));var O2=require("html-escaper");async function D2(p,b){try{let S=require("bit-field/lib/render"),T=require("onml"),R=s0(p),$=S(R,b);return T.stringify($)}catch(S){return`<pre class="language-text"><code>${(0,O2.escape)(S.toString())}</code></pre>`}}var M2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",OA=class{constructor(){this.str="";this.partial=0;this.partialSize=0}addBits(b,S){for(this.partial=this.partial<<S|b,this.partialSize+=S;this.partialSize>=6;)this.str+=M2.charAt(this.partial>>this.partialSize-6&63),this.partialSize-=6}finish(){return this.partialSize&&(this.str+=M2.charAt(this.partial<<6-this.partialSize&63),this.partialSize=0,this.partial=0),this.str}};function Kz(p){let b=new OA;for(let S=0;S<p.length;S++)b.addBits(p.charCodeAt(S),8);return b.finish()}function Xz(p){let b=p.replace(/\r\n/g,`
345
- `),S="";for(let T=0;T<b.length;T++){let R=b.charCodeAt(T);R<128?S+=String.fromCharCode(R):R>127&&R<2048?(S+=String.fromCharCode(R>>6|192),S+=String.fromCharCode(R&63|128)):(S+=String.fromCharCode(R>>12|224),S+=String.fromCharCode(R>>6&63|128),S+=String.fromCharCode(R&63|128))}return S}function L2(p){return p>=16383?String.fromCharCode(128|p>>14&127)+String.fromCharCode(128|p>>7&127)+String.fromCharCode(p&127):p>=127?String.fromCharCode(128|p>>7&127)+String.fromCharCode(p&127):String.fromCharCode(p)}function Zz(p){let S="",T=0,R={},$=p.length-4;for(let P=4;P<p.length;P++){let F=p.substr(P-4,4);R[F]===void 0&&(R[F]=[]),R[F].push(P-4)}for(;T<$;){let P=4,F=!1,j={distance:0,length:0},W=p.substr(T,4),V=R[W];if(V!==void 0)for(let ee=0;ee<V.length;ee++){let ne=V[ee];if(ne+P>=T)break;for(;ne+P<T&&p.substr(ne,P)===p.substr(T,P);){let Z=P;P++,F&&Z>j.length&&(j.distance=T-ne-Z,j.length=Z),F=!0}}j.length?(S+="\0"+L2(j.distance)+L2(j.length),T+=j.length):(p.charCodeAt(T)!==0?S+=p.charAt(T):S+="\0\0",T++)}return S+p.slice(T).replace(/\0/g,"\0\0")}function Jz(p){return Kz(Zz(Xz(p)))}function F2(p,b,S,T){let R=Jz(p),$=`${b}/cgi-bin/cdraw?lz=${R}`;return S&&($+=`&s=${S}`),T&&($+=`&apikey=${T}`),$}var h0=(p,b)=>{let S=p.class||"";return S.split(" ").indexOf(b)===-1?{...p,class:`${S} ${b}`.trim()}:p},Qz=["mermaid","puml","plantuml","wavedrom","bitfield","bit-field","graphviz","viz","dot","vega","vega-lite","wsd"];async function DA({$:p,graphsCache:b,fileDirectoryPath:S,imageDirectoryPath:T,plantumlServer:R,plantumlJarPath:$,kirokiServer:P,webSequenceDiagramsServer:F,webSequenceDiagramsApiKey:j}){let W=[];p('[data-role="codeBlock"]').each((V,ee)=>{let ne=p(ee);if(ne.data("executor"))return;let he=ne.data("normalizedInfo"),Z=!!he.attributes.kroki||he.language.startsWith("kroki-");he.attributes.literate===!1||he.attributes.cmd===!1||Qz.indexOf(he.language)===-1&&!Z||he.attributes.code_block===!0||(ne.data("executor","fenced-diagrams"),he.attributes.literate!==!1&&W.push(e4({$container:ne,normalizedInfo:he,$:p,graphsCache:b,fileDirectoryPath:S,imageDirectoryPath:T,plantumlServer:R,plantumlJarPath:$,isKroki:Z,kirokiServer:P,webSequenceDiagramsServer:F,webSequenceDiagramsApiKey:j})))}),await Promise.all(W)}async function e4({$container:p,normalizedInfo:b,$:S,graphsCache:T,fileDirectoryPath:R,plantumlServer:$,plantumlJarPath:P,isKroki:F,kirokiServer:j,webSequenceDiagramsServer:W,webSequenceDiagramsApiKey:V}){let ee=null,ne=p.text(),he=Pa(JSON.stringify(b)+ne),Z=T[he];if(F)if(Z)ee=Z;else{let ae=j||"https://kroki.io",oe=typeof b.attributes.kroki=="string"?b.attributes.kroki:b.language.replace(/^kroki-/,"");try{let de=await(await(0,P2.default)(`${ae}/${oe}/${b.attributes.output??"svg"}`,{method:"POST",body:ne,headers:{"Content-Type":"text/plain; charset=utf-8"}})).text();ee=`<div ${pn(h0(b.attributes,b.language))}>${de}</div>`,T[he]=ee}catch(ce){ee=`<pre class="language-text"><code>${(0,mh.escape)(ce.toString())}</code></pre>`}}else try{switch(b.language){case"mermaid":{ee=`<div ${pn(h0(b.attributes,b.language))}>${(0,mh.escape)(ne)}</div>`;break}case"wavedrom":{ee=`<div ${pn(h0(b.attributes,b.language))}><script type="WaveDrom">${ne}</script></div>`;break}case"puml":case"plantuml":{let ae=Z;ae||(ae=await qw({content:ne,fileDirectoryPath:R,serverURL:$,plantumlJarPath:P}),T[he]=ae),ee=`<p ${pn(b.attributes)}>${ae}</p>`;break}case"bitfield":case"bit-field":{let ae=Z;ae||(ae=await D2(ne,b.attributes),T[he]=ae),ee=`<p ${pn(b.attributes)}>${ae}</p>`;break}case"graphviz":case"viz":case"dot":{let ae=Z;if(!ae){let oe=b.attributes.engine||"dot";ae=await Xw(ne,{engine:oe}),T[he]=ae}ee=`<p ${pn(b.attributes)}>${ae}</p>`;break}case"vega":case"vega-lite":{if(b.attributes.interactive===!0){let ae=ne.trim(),oe;ae[0]!=="{"?oe=$2.parse(ae):oe=JSON.parse(ae),ee=t4((0,mh.escape)(JSON.stringify(oe)),b.attributes,b.language)}else{let ae=Z;ae||(ae=await(b.language==="vega"?fh:Yw)(ne,R),T[he]=ae),ee=`<p data-processed ${pn(b.attributes)}>${ae}</p>`}break}case"wsd":{let ae=W||"https://www.websequencediagrams.com",oe=b.attributes.style||"default",de=F2(ne,ae,oe,V||void 0);ee=`<div ${pn(h0(b.attributes,"wsd"))}><img src="${(0,mh.escape)(de)}" alt="Sequence Diagram"></div>`;break}}}catch(ae){ee=S(`<pre class="language-text"><code>${(0,mh.escape)(ae.toString())}</code></pre>`)}ee!==null&&(b.attributes.output_first===!0?p.before(ee):p.after(ee)),b.attributes.hide!==!1&&b.attributes.code_block!==!0&&p.data("hiddenByEnhancer",!0)}var t4=(p,b,S)=>`<p ${pn(h0(b,S))}><span style="display: none">${p}</span></p>`;var B2=require("html-escaper");var n4=["math"];async function MA(p,b,S,T){return p('[data-role="codeBlock"]').each((R,$)=>{let P=p($);if(P.data("executor"))return;let F=P.data("normalizedInfo");if(F.attributes.literate===!1||F.attributes.cmd===!1||n4.indexOf(F.language)===-1||(P.data("executor","math"),F.attributes.literate===!1))return;let j=P.text(),W=a4(j,F,b,S,T);F.attributes.output_first===!0?P.before(W):P.after(W),F.attributes.hide!==!1&&P.data("hiddenByEnhancer",!0)}),p}var a4=(p,b,S,T,R)=>{let $=null;try{let P=t_({content:p,displayMode:!0,openTag:T.length?T[0][0]:"",closeTag:T.length?T[0][1]:"",renderingOption:S,katexConfig:R});$=`<p ${pn(b.attributes)}>${P}</p>`}catch(P){$=`<pre class="language-text"><code>${(0,B2.escape)(P.toString())}</code></pre>`}return $};async function LA(p,b,S){p("img, a").each((T,R)=>{let $="src";R.name==="a"&&($="href");let P=p(R),F=P.attr($);P.attr($,S(F,b.useRelativeFilePath,b.fileDirectoryPath))})}var r4=/^\s*(javascript|vbscript)\s*:|^\s*data\s*:\s*text\/html/i,i4="script, object, embed, applet",o4=["href","src","action","formaction","xlink:href"];function U2(p){p(i4).remove(),p("*").each((b,S)=>{let T=S.attribs;if(T)for(let R of Object.keys(T)){if(/^on/i.test(R)){delete T[R];continue}o4.includes(R.toLowerCase())&&r4.test(T[R])&&delete T[R]}}),p("iframe").each((b,S)=>{let T=S.attribs;T&&(T.sandbox="",delete T.srcdoc)})}var z2=[{key:"vega",version:"5.25.0"},{key:"vega-lite",version:"5.16.1"},{key:"vega-embed",version:"6.23.0"}],Dd=class Dd{constructor({filePath:b,notebook:S}){this.graphsCache={};this.codeChunksData={};this.filesCache={};this.isPreviewInPresentationMode=!1;this.filePath=b,this.notebook=S,this.fileDirectoryPath=qe.dirname(this.filePath),this.projectDirectoryPath=this.notebook.notebookPath||this.fileDirectoryPath,this.fs=this.notebook.fs,this.headings=[],this.tocHTML=""}get protocolsWhiteListRegExp(){let b=(this.notebook.config.protocolsWhiteList??Id().protocolsWhiteList??"").split(",").map(S=>S.trim());return new RegExp("^("+b.join("|")+")")}cacheCodeChunkResult(b,S){let T=this.codeChunksData[b];T&&(T.result=PA.default.AES.decrypt(S,"crossnote").toString(PA.default.enc.Utf8))}generateScriptsForPreview(b=!1,S={},T=null){let R="";if(R+="<script>var exports = undefined</script>",R+=`<script type="text/javascript" src="${yn(qe.resolve(wt(),"./dependencies/mermaid/mermaid.min.js"),T)}" charset="UTF-8"></script>`,R+=`<script type="module">
345
+ `),S="";for(let T=0;T<b.length;T++){let R=b.charCodeAt(T);R<128?S+=String.fromCharCode(R):R>127&&R<2048?(S+=String.fromCharCode(R>>6|192),S+=String.fromCharCode(R&63|128)):(S+=String.fromCharCode(R>>12|224),S+=String.fromCharCode(R>>6&63|128),S+=String.fromCharCode(R&63|128))}return S}function L2(p){return p>=16383?String.fromCharCode(128|p>>14&127)+String.fromCharCode(128|p>>7&127)+String.fromCharCode(p&127):p>=127?String.fromCharCode(128|p>>7&127)+String.fromCharCode(p&127):String.fromCharCode(p)}function Zz(p){let S="",T=0,R={},$=p.length-4;for(let P=4;P<p.length;P++){let F=p.substr(P-4,4);R[F]===void 0&&(R[F]=[]),R[F].push(P-4)}for(;T<$;){let P=4,F=!1,j={distance:0,length:0},W=p.substr(T,4),V=R[W];if(V!==void 0)for(let ee=0;ee<V.length;ee++){let ne=V[ee];if(ne+P>=T)break;for(;ne+P<T&&p.substr(ne,P)===p.substr(T,P);){let Z=P;P++,F&&Z>j.length&&(j.distance=T-ne-Z,j.length=Z),F=!0}}j.length?(S+="\0"+L2(j.distance)+L2(j.length),T+=j.length):(p.charCodeAt(T)!==0?S+=p.charAt(T):S+="\0\0",T++)}return S+p.slice(T).replace(/\0/g,"\0\0")}function Jz(p){return Kz(Zz(Xz(p)))}function F2(p,b,S,T){let R=Jz(p),$=`${b}/cgi-bin/cdraw?lz=${R}`;return S&&($+=`&s=${S}`),T&&($+=`&apikey=${T}`),$}var h0=(p,b)=>{let S=p.class||"";return S.split(" ").indexOf(b)===-1?{...p,class:`${S} ${b}`.trim()}:p},Qz=["mermaid","puml","plantuml","wavedrom","bitfield","bit-field","graphviz","viz","dot","vega","vega-lite","wsd"];async function DA({$:p,graphsCache:b,fileDirectoryPath:S,imageDirectoryPath:T,plantumlServer:R,plantumlJarPath:$,kirokiServer:P,webSequenceDiagramsServer:F,webSequenceDiagramsApiKey:j}){let W=[];p('[data-role="codeBlock"]').each((V,ee)=>{let ne=p(ee);if(ne.data("executor"))return;let he=ne.data("normalizedInfo"),Z=!!he.attributes.kroki||he.language.startsWith("kroki-");he.attributes.literate===!1||he.attributes.cmd===!1||Qz.indexOf(he.language)===-1&&!Z||he.attributes.code_block===!0||(ne.data("executor","fenced-diagrams"),he.attributes.literate!==!1&&W.push(e4({$container:ne,normalizedInfo:he,$:p,graphsCache:b,fileDirectoryPath:S,imageDirectoryPath:T,plantumlServer:R,plantumlJarPath:$,isKroki:Z,kirokiServer:P,webSequenceDiagramsServer:F,webSequenceDiagramsApiKey:j})))}),await Promise.all(W)}async function e4({$container:p,normalizedInfo:b,$:S,graphsCache:T,fileDirectoryPath:R,plantumlServer:$,plantumlJarPath:P,isKroki:F,kirokiServer:j,webSequenceDiagramsServer:W,webSequenceDiagramsApiKey:V}){let ee=null,ne=p.text(),he=Pa(JSON.stringify(b)+ne),Z=T[he];if(F)if(Z)ee=Z;else{let ae=j||"https://kroki.io",oe=typeof b.attributes.kroki=="string"?b.attributes.kroki:b.language.replace(/^kroki-/,"");try{let de=await(await(0,P2.default)(`${ae}/${oe}/${b.attributes.output??"svg"}`,{method:"POST",body:ne,headers:{"Content-Type":"text/plain; charset=utf-8"}})).text();ee=`<div ${pn(h0(b.attributes,b.language))}>${de}</div>`,T[he]=ee}catch(ce){ee=`<pre class="language-text"><code>${(0,mh.escape)(ce.toString())}</code></pre>`}}else try{switch(b.language){case"mermaid":{ee=`<div ${pn(h0(b.attributes,b.language))}>${(0,mh.escape)(ne)}</div>`;break}case"wavedrom":{ee=`<div ${pn(h0(b.attributes,b.language))}><script type="WaveDrom">${ne}</script></div>`;break}case"puml":case"plantuml":{let ae=Z;ae||(ae=await qw({content:ne,fileDirectoryPath:R,serverURL:$,plantumlJarPath:P}),T[he]=ae),ee=`<p ${pn(b.attributes)}>${ae}</p>`;break}case"bitfield":case"bit-field":{let ae=Z;ae||(ae=await D2(ne,b.attributes),T[he]=ae),ee=`<p ${pn(b.attributes)}>${ae}</p>`;break}case"graphviz":case"viz":case"dot":{let ae=Z;if(!ae){let oe=b.attributes.engine||"dot";ae=await Xw(ne,{engine:oe}),T[he]=ae}ee=`<p ${pn(b.attributes)}>${ae}</p>`;break}case"vega":case"vega-lite":{if(b.attributes.interactive===!0){let ae=ne.trim(),oe;ae[0]!=="{"?oe=$2.parse(ae):oe=JSON.parse(ae),ee=t4((0,mh.escape)(JSON.stringify(oe)),b.attributes,b.language)}else{let ae=Z;ae||(ae=await(b.language==="vega"?fh:Yw)(ne,R),T[he]=ae),ee=`<p data-processed ${pn(b.attributes)}>${ae}</p>`}break}case"wsd":{let ae=W||"https://www.websequencediagrams.com",oe=b.attributes.style||"default",de=F2(ne,ae,oe,V||void 0);ee=`<div ${pn(h0(b.attributes,"wsd"))}><img src="${(0,mh.escape)(de)}" alt="Sequence Diagram"></div>`;break}}}catch(ae){ee=S(`<pre class="language-text"><code>${(0,mh.escape)(ae.toString())}</code></pre>`)}ee!==null&&(b.attributes.output_first===!0?p.before(ee):p.after(ee)),b.attributes.hide!==!1&&b.attributes.code_block!==!0&&p.data("hiddenByEnhancer",!0)}var t4=(p,b,S)=>`<p ${pn(h0(b,S))}><span style="display: none">${p}</span></p>`;var B2=require("html-escaper");var n4=["math"];async function MA(p,b,S,T){return p('[data-role="codeBlock"]').each((R,$)=>{let P=p($);if(P.data("executor"))return;let F=P.data("normalizedInfo");if(F.attributes.literate===!1||F.attributes.cmd===!1||n4.indexOf(F.language)===-1||(P.data("executor","math"),F.attributes.literate===!1))return;let j=P.text(),W=a4(j,F,b,S,T);F.attributes.output_first===!0?P.before(W):P.after(W),F.attributes.hide!==!1&&P.data("hiddenByEnhancer",!0)}),p}var a4=(p,b,S,T,R)=>{let $=null;try{let P=t_({content:p,displayMode:!0,openTag:T.length?T[0][0]:"",closeTag:T.length?T[0][1]:"",renderingOption:S,katexConfig:R});$=`<p ${pn(b.attributes)}>${P}</p>`}catch(P){$=`<pre class="language-text"><code>${(0,B2.escape)(P.toString())}</code></pre>`}return $};async function LA(p,b,S){p("img, a").each((T,R)=>{let $="src";R.name==="a"&&($="href");let P=p(R),F=P.attr($);P.attr($,S(F,b.useRelativeFilePath,b.fileDirectoryPath))})}var r4=/^\s*(javascript|vbscript)\s*:|^\s*data\s*:\s*text\/html/i,i4="script, object, embed, applet",o4=["href","src","action","formaction","xlink:href"];function U2(p){p(i4).remove(),p("*").each((b,S)=>{let T=S.attribs;if(T)for(let R of Object.keys(T)){if(/^on/i.test(R)){delete T[R];continue}o4.includes(R.toLowerCase())&&r4.test(T[R])&&delete T[R]}}),p("iframe").each((b,S)=>{let T=S.attribs;T&&(T.sandbox="",delete T.srcdoc)})}var z2=[{key:"vega",version:"5.25.0"},{key:"vega-lite",version:"5.16.1"},{key:"vega-embed",version:"6.23.0"}],Dd=class Dd{constructor({filePath:b,notebook:S}){this.graphsCache={};this.codeChunksData={};this.filesCache={};this.isPreviewInPresentationMode=!1;this.filePath=b,this.notebook=S,this.fileDirectoryPath=qe.dirname(this.filePath),this.projectDirectoryPath=this.notebook.notebookPath||this.fileDirectoryPath,this.fs=this.notebook.fs,this.headings=[],this.tocHTML=""}get protocolsWhiteListRegExp(){let b=(this.notebook.config.protocolsWhiteList??Id().protocolsWhiteList??"").split(",").map(S=>S.trim());return new RegExp("^("+b.join("|")+")")}cacheCodeChunkResult(b,S){let T=this.codeChunksData[b];T&&(T.result=PA.default.AES.decrypt(S,"crossnote").toString(PA.default.enc.Utf8))}generateScriptsForPreview(b=!1,S={},T=null){let R="";if(R+="<script>var exports = undefined</script>",R+=`<script type="text/javascript" src="${yn(qe.resolve(Et(),"./dependencies/mermaid/mermaid.min.js"),T)}" charset="UTF-8"></script>`,R+=`<script type="module">
346
346
  import zenuml from 'https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml@0.1.0/dist/mermaid-zenuml.esm.min.mjs';
347
347
  await mermaid.registerExternalDiagrams([zenuml]);
348
- </script>`,R+=`<script type="text/javascript" src="${yn(qe.resolve(wt(),"./dependencies/wavedrom/skins/default.js"),T)}" charset="UTF-8"></script>`,R+=`<script type="text/javascript" src="${yn(qe.resolve(wt(),"./dependencies/wavedrom/skins/narrow.js"),T)}" charset="UTF-8"></script>`,R+=`<script type="text/javascript" src="${yn(qe.resolve(wt(),"./dependencies/wavedrom/wavedrom.min.js"),T)}" charset="UTF-8"></script>`,this.notebook.config.mathRenderingOption==="MathJax"||this.notebook.config.usePandocParser){let P=(0,FA.copy)({...this.notebook.config.mathjaxConfig});P.tex=P.tex||{},P.tex.inlineMath=this.notebook.config.mathInlineDelimiters,P.tex.displayMath=this.notebook.config.mathBlockDelimiters,P.startup=P.startup||{},b||(P.startup.typeset=!1,P.startup.elements=[".hidden-preview"]),R+=`<script type="text/javascript"> window.MathJax = (${JSON.stringify(P)}); </script>`,R+=`<script type="text/javascript" async src="${this.notebook.config.mathjaxV3ScriptSrc}" charset="UTF-8"></script>`}let $="";if(b){R+=`<script src='${yn(qe.resolve(wt(),"./dependencies/reveal/js/reveal.js"),T)}'></script>`;let P=S.presentation||{};typeof P!="object"&&(P={});let F=P.dependencies||[];F instanceof Array||(F=[]),P.dependencies=F,$+=`
348
+ </script>`,R+=`<script type="text/javascript" src="${yn(qe.resolve(Et(),"./dependencies/wavedrom/skins/default.js"),T)}" charset="UTF-8"></script>`,R+=`<script type="text/javascript" src="${yn(qe.resolve(Et(),"./dependencies/wavedrom/skins/narrow.js"),T)}" charset="UTF-8"></script>`,R+=`<script type="text/javascript" src="${yn(qe.resolve(Et(),"./dependencies/wavedrom/wavedrom.min.js"),T)}" charset="UTF-8"></script>`,this.notebook.config.mathRenderingOption==="MathJax"||this.notebook.config.usePandocParser){let P=(0,FA.copy)({...this.notebook.config.mathjaxConfig});P.tex=P.tex||{},P.tex.inlineMath=this.notebook.config.mathInlineDelimiters,P.tex.displayMath=this.notebook.config.mathBlockDelimiters,P.startup=P.startup||{},b||(P.startup.typeset=!1,P.startup.elements=[".hidden-preview"]),R+=`<script type="text/javascript"> window.MathJax = (${JSON.stringify(P)}); </script>`,R+=`<script type="text/javascript" async src="${this.notebook.config.mathjaxV3ScriptSrc}" charset="UTF-8"></script>`}let $="";if(b){R+=`<script src='${yn(qe.resolve(Et(),"./dependencies/reveal/js/reveal.js"),T)}'></script>`;let P=S.presentation||{};typeof P!="object"&&(P={});let F=P.dependencies||[];F instanceof Array||(F=[]),P.dependencies=F,$+=`
349
349
  await Reveal.initialize(${JSON.stringify({margin:.1,...P})})
350
350
  // NOTE: We have to add the promise below otherwise
351
351
  // initPresentationEvents in preview.ts will have problem slide to the correct slide.
@@ -379,7 +379,7 @@ if (typeof(window['Reveal']) !== 'undefined') {
379
379
  }
380
380
  </script>`,b&&($+=`
381
381
  WaveDrom.ProcessAll()
382
- `),z2.forEach(({key:P})=>{R+=`<script src="${yn(qe.resolve(wt(),`./dependencies/${P}/${P}.min.js`),T)}" charset="UTF-8"></script>`}),b&&($+=`
382
+ `),z2.forEach(({key:P})=>{R+=`<script src="${yn(qe.resolve(Et(),`./dependencies/${P}/${P}.min.js`),T)}" charset="UTF-8"></script>`}),b&&($+=`
383
383
  var vegaEls = document.querySelectorAll('.vega, .vega-lite');
384
384
  function reportVegaError(el, error) {
385
385
  el.innerHTML = '<pre class="language-text"><code>' + error.toString() + '</code></pre>'
@@ -402,7 +402,7 @@ if (typeof(window['Reveal']) !== 'undefined') {
402
402
  window["initRevealPresentation"] = async function() {
403
403
  ${$}
404
404
  }
405
- </script>`,R+$}getPrismTheme(b=!1,S={}){if(this.notebook.config.codeBlockTheme==="auto.css")if(b){let T=S.presentation&&typeof S.presentation=="object"&&S.presentation.theme?S.presentation.theme:this.notebook.config.revealjsTheme;return Dd.AutoPrismThemeMapForPresentation[T]??"default.css"}else return Dd.AutoPrismThemeMap[this.notebook.config.previewTheme]??"default.css";else return this.notebook.config.codeBlockTheme}generateStylesForPreview(b=!1,S={},T=null){let R="";return this.notebook.config.mathRenderingOption==="KaTeX"&&!this.notebook.config.usePandocParser&&(R+=`<link rel="stylesheet" href="${yn(qe.resolve(wt(),"./dependencies/katex/katex.min.css"),T)}">`),R+=`<link rel="stylesheet" href="${yn(qe.resolve(wt(),"./dependencies/font-awesome/css/all.min.css"),T)}">`,b?(R+=`<link rel="stylesheet" href="${yn(qe.resolve(wt(),"./dependencies/reveal/css/reveal.css"),T)}" >`,R+=`<link rel="stylesheet" href="${yn(qe.resolve(wt(),`./dependencies/reveal/css/theme/${S.presentation&&typeof S.presentation=="object"&&S.presentation.theme?S.presentation.theme:this.notebook.config.revealjsTheme}`),T)}" >`):R+=`<link rel="stylesheet" href="${yn(qe.resolve(wt(),`./styles/preview_theme/${this.notebook.config.previewTheme}`),T)}">`,R+=`<link rel="stylesheet" href="${yn(qe.resolve(wt(),`./styles/prism_theme/${this.getPrismTheme(b,S)}`),T)}">`,R+=`<link rel="stylesheet" media="screen" href="${yn(qe.resolve(wt(),"./styles/style-template.css"),T)}">`,R+=`<link rel="stylesheet" media="screen" href="${yn(qe.resolve(wt(),"./styles/markdown-it-admonition.css"),T)}">`,R+=`<link rel="stylesheet" media="screen" href="${yn(qe.resolve(wt(),"./styles/markdown-it-callout.css"),T)}">`,R+=`<style>${this.notebook.config.globalCss}</style>`,R}generateJSAndCssFilesForPreview(b=[],S=null){let T="";return b.forEach(R=>{let $=R;R[0]==="/"?$=yn(qe.resolve(this.projectDirectoryPath.fsPath,"."+R),S):R.match(/^file:\/\//)||R.match(/^https?:\/\//)||($=yn(qe.resolve(this.fileDirectoryPath,R),S)),$.endsWith(".js")?T+=`<script type="text/javascript" src="${$}"></script>`:T+=`<link rel="stylesheet" href="${$}">`}),T}async generateHTMLTemplateForPreview({inputString:b="",body:S="",webviewScript:T="",scripts:R="",styles:$="",head:P=`<base href="${this.filePath}">`,config:F,vscodePreviewPanel:j=null,contentSecurityPolicy:W="",isVSCodeWebExtension:V}){b||(b=await this.fs.readFile(this.filePath));let ee="";T||(T=yn(qe.resolve(wt(),"./webview/preview.js"),j),ee=yn(qe.resolve(wt(),"./webview/preview.css"),j)),S||(S="");let{yamlConfig:ne,JSAndCssFiles:he,html:Z}=await this.parseMD(b,{isForPreview:!0,useRelativeFilePath:!1,hideFrontMatter:!1,vscodePreviewPanel:j}),ae=ne.isPresentationMode;return`<!DOCTYPE html>
405
+ </script>`,R+$}getPrismTheme(b=!1,S={}){if(this.notebook.config.codeBlockTheme==="auto.css")if(b){let T=S.presentation&&typeof S.presentation=="object"&&S.presentation.theme?S.presentation.theme:this.notebook.config.revealjsTheme;return Dd.AutoPrismThemeMapForPresentation[T]??"default.css"}else return Dd.AutoPrismThemeMap[this.notebook.config.previewTheme]??"default.css";else return this.notebook.config.codeBlockTheme}generateStylesForPreview(b=!1,S={},T=null){let R="";return this.notebook.config.mathRenderingOption==="KaTeX"&&!this.notebook.config.usePandocParser&&(R+=`<link rel="stylesheet" href="${yn(qe.resolve(Et(),"./dependencies/katex/katex.min.css"),T)}">`),R+=`<link rel="stylesheet" href="${yn(qe.resolve(Et(),"./dependencies/font-awesome/css/all.min.css"),T)}">`,b?(R+=`<link rel="stylesheet" href="${yn(qe.resolve(Et(),"./dependencies/reveal/css/reveal.css"),T)}" >`,R+=`<link rel="stylesheet" href="${yn(qe.resolve(Et(),`./dependencies/reveal/css/theme/${S.presentation&&typeof S.presentation=="object"&&S.presentation.theme?S.presentation.theme:this.notebook.config.revealjsTheme}`),T)}" >`):R+=`<link rel="stylesheet" href="${yn(qe.resolve(Et(),`./styles/preview_theme/${this.notebook.config.previewTheme}`),T)}">`,R+=`<link rel="stylesheet" href="${yn(qe.resolve(Et(),`./styles/prism_theme/${this.getPrismTheme(b,S)}`),T)}">`,R+=`<link rel="stylesheet" media="screen" href="${yn(qe.resolve(Et(),"./styles/style-template.css"),T)}">`,R+=`<link rel="stylesheet" media="screen" href="${yn(qe.resolve(Et(),"./styles/markdown-it-admonition.css"),T)}">`,R+=`<link rel="stylesheet" media="screen" href="${yn(qe.resolve(Et(),"./styles/markdown-it-callout.css"),T)}">`,R+=`<style>${this.notebook.config.globalCss}</style>`,R}generateJSAndCssFilesForPreview(b=[],S=null){let T="";return b.forEach(R=>{let $=R;R[0]==="/"?$=yn(qe.resolve(this.projectDirectoryPath.fsPath,"."+R),S):R.match(/^file:\/\//)||R.match(/^https?:\/\//)||($=yn(qe.resolve(this.fileDirectoryPath,R),S)),$.endsWith(".js")?T+=`<script type="text/javascript" src="${$}"></script>`:T+=`<link rel="stylesheet" href="${$}">`}),T}async generateHTMLTemplateForPreview({inputString:b="",body:S="",webviewScript:T="",scripts:R="",styles:$="",head:P=`<base href="${this.filePath}">`,config:F,vscodePreviewPanel:j=null,contentSecurityPolicy:W="",isVSCodeWebExtension:V}){b||(b=await this.fs.readFile(this.filePath));let ee="";T||(T=yn(qe.resolve(Et(),"./webview/preview.js"),j),ee=yn(qe.resolve(Et(),"./webview/preview.css"),j)),S||(S="");let{yamlConfig:ne,JSAndCssFiles:he,html:Z}=await this.parseMD(b,{isForPreview:!0,useRelativeFilePath:!1,hideFrontMatter:!1,vscodePreviewPanel:j}),ae=ne.isPresentationMode;return`<!DOCTYPE html>
406
406
  <html>
407
407
  <head>
408
408
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
@@ -427,7 +427,7 @@ window["initRevealPresentation"] = async function() {
427
427
  }
428
428
  </style>
429
429
  `:""}
430
- <link rel="stylesheet" href="${yn(qe.resolve(wt(),"./styles/preview.css"),j)}">
430
+ <link rel="stylesheet" href="${yn(qe.resolve(Et(),"./styles/preview.css"),j)}">
431
431
  ${this.generateJSAndCssFilesForPreview(he,j)}
432
432
  ${await this.resolvePathsInHeader(this.notebook.config.includeInHeader)}
433
433
  ${P}
@@ -448,7 +448,7 @@ window["initRevealPresentation"] = async function() {
448
448
  window.MathJax = (${JSON.stringify(Te)});
449
449
  </script>
450
450
  <script type="text/javascript" async src="${this.notebook.config.mathjaxV3ScriptSrc}"></script>
451
- `}else this.notebook.config.mathRenderingOption==="KaTeX"?T.offline?P=`<link rel="stylesheet" href="file:///${qe.resolve(wt(),"./dependencies/katex/katex.min.css")}">`:P=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.38/dist/katex.min.css">`:P="";let F="";b.indexOf('<i class="fa')>=0&&(T.offline?F=`<link rel="stylesheet" href="file:///${qe.resolve(wt(),"./dependencies/font-awesome/css/all.min.css")}">`:F=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css">`);let j="",W="";b.indexOf(' class="mermaid')>=0&&(T.offline?j=`<script type="text/javascript" src="file:///${qe.resolve(wt(),"./dependencies/mermaid/mermaid.min.js")}" charset="UTF-8"></script>`:j=`<script src="https://${this.notebook.config.jsdelivrCdnHost}/npm/mermaid@11.13.0/dist/mermaid.min.js"></script>`,W+=`<script type="module">
451
+ `}else this.notebook.config.mathRenderingOption==="KaTeX"?T.offline?P=`<link rel="stylesheet" href="file:///${qe.resolve(Et(),"./dependencies/katex/katex.min.css")}">`:P=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.38/dist/katex.min.css">`:P="";let F="";b.indexOf('<i class="fa')>=0&&(T.offline?F=`<link rel="stylesheet" href="file:///${qe.resolve(Et(),"./dependencies/font-awesome/css/all.min.css")}">`:F=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css">`);let j="",W="";b.indexOf(' class="mermaid')>=0&&(T.offline?j=`<script type="text/javascript" src="file:///${qe.resolve(Et(),"./dependencies/mermaid/mermaid.min.js")}" charset="UTF-8"></script>`:j=`<script src="https://${this.notebook.config.jsdelivrCdnHost}/npm/mermaid@11.13.0/dist/mermaid.min.js"></script>`,W+=`<script type="module">
452
452
  // TODO: If ZenUML gets integrated into mermaid in the future,
453
453
  // we can remove the following lines.
454
454
  ${b.match(/zenuml/i)?`import zenuml from 'https://${this.notebook.config.jsdelivrCdnHost}/npm/@mermaid-js/mermaid-zenuml@0.1.0/dist/mermaid-zenuml.esm.min.mjs';
@@ -485,7 +485,7 @@ if (typeof(window['Reveal']) !== 'undefined') {
485
485
  nodes: document.querySelectorAll('.mermaid')
486
486
  })
487
487
  }
488
- </script>`);let V="",ee="";b.indexOf(' class="wavedrom')>=0&&(T.offline?(V+=`<script type="text/javascript" src="file:///${qe.resolve(wt(),"./dependencies/wavedrom/skins/default.js")}" charset="UTF-8"></script>`,V+=`<script type="text/javascript" src="file:///${qe.resolve(wt(),"./dependencies/wavedrom/skins/narrow.js")}" charset="UTF-8"></script>`,V+=`<script type="text/javascript" src="file:///${qe.resolve(wt(),"./dependencies/wavedrom/wavedrom.min.js")}" charset="UTF-8"></script>`):(V+=`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/wavedrom@3.3.0/skins/default.js"></script>`,V+=`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/wavedrom@3.3.0/skins/narrow.js"></script>`,V+=`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/wavedrom@3.3.0/wavedrom.min.js"></script>`),ee="<script>WaveDrom.ProcessAll()</script>");let ne="",he="";(b.indexOf(' class="vega')>=0||b.indexOf(' class="vega-lite')>=0)&&(z2.forEach(({key:Te,version:ke})=>{ne+=T.offline?`<script type="text/javascript" src="file:///${qe.resolve(wt(),`./dependencies/${Te}/${Te}.min.js`)}" charset="UTF-8"></script>`:`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/${Te}@${ke}/build/${Te}.js"></script>`}),he+=`<script>
488
+ </script>`);let V="",ee="";b.indexOf(' class="wavedrom')>=0&&(T.offline?(V+=`<script type="text/javascript" src="file:///${qe.resolve(Et(),"./dependencies/wavedrom/skins/default.js")}" charset="UTF-8"></script>`,V+=`<script type="text/javascript" src="file:///${qe.resolve(Et(),"./dependencies/wavedrom/skins/narrow.js")}" charset="UTF-8"></script>`,V+=`<script type="text/javascript" src="file:///${qe.resolve(Et(),"./dependencies/wavedrom/wavedrom.min.js")}" charset="UTF-8"></script>`):(V+=`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/wavedrom@3.3.0/skins/default.js"></script>`,V+=`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/wavedrom@3.3.0/skins/narrow.js"></script>`,V+=`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/wavedrom@3.3.0/wavedrom.min.js"></script>`),ee="<script>WaveDrom.ProcessAll()</script>");let ne="",he="";(b.indexOf(' class="vega')>=0||b.indexOf(' class="vega-lite')>=0)&&(z2.forEach(({key:Te,version:ke})=>{ne+=T.offline?`<script type="text/javascript" src="file:///${qe.resolve(Et(),`./dependencies/${Te}/${Te}.min.js`)}" charset="UTF-8"></script>`:`<script type="text/javascript" src="https://${this.notebook.config.jsdelivrCdnHost}/npm/${Te}@${ke}/build/${Te}.js"></script>`}),he+=`<script>
489
489
  var vegaEls = document.querySelectorAll('.vega, .vega-lite');
490
490
  function reportVegaError(el, error) {
491
491
  el.innerHTML = '<pre class="language-text"><code>' + error.toString() + '</code></pre>'
@@ -506,17 +506,17 @@ if (typeof(window['Reveal']) !== 'undefined') {
506
506
  }
507
507
  }
508
508
  </script>`);let Z="",ae="",oe="";if(S.isPresentationMode){T.offline?Z=`
509
- <script src='file:///${qe.resolve(wt(),"./dependencies/reveal/js/reveal.js")}'></script>`:Z=`
510
- <script src='https://${this.notebook.config.jsdelivrCdnHost}/npm/reveal.js@4.6.0/dist/reveal.js'></script>`;let Te=S.presentation||{},ke=Te.dependencies||[];Te.enableSpeakerNotes&&(T.offline?ke.push({src:qe.resolve(wt(),"./dependencies/reveal/plugin/notes/notes.js"),async:!0}):ke.push({src:"revealjs_deps/notes.js",async:!0})),Te.dependencies=ke,ae=`
509
+ <script src='file:///${qe.resolve(Et(),"./dependencies/reveal/js/reveal.js")}'></script>`:Z=`
510
+ <script src='https://${this.notebook.config.jsdelivrCdnHost}/npm/reveal.js@4.6.0/dist/reveal.js'></script>`;let Te=S.presentation||{},ke=Te.dependencies||[];Te.enableSpeakerNotes&&(T.offline?ke.push({src:qe.resolve(Et(),"./dependencies/reveal/plugin/notes/notes.js"),async:!0}):ke.push({src:"revealjs_deps/notes.js",async:!0})),Te.dependencies=ke,ae=`
511
511
  <style>
512
- ${await this.fs.readFile(qe.resolve(wt(),"./dependencies/reveal/css/reveal.css"))}
513
- ${T.isForPrint?await this.fs.readFile(qe.resolve(wt(),"./dependencies/reveal/css/print/pdf.css")):""}
512
+ ${await this.fs.readFile(qe.resolve(Et(),"./dependencies/reveal/css/reveal.css"))}
513
+ ${T.isForPrint?await this.fs.readFile(qe.resolve(Et(),"./dependencies/reveal/css/print/pdf.css")):""}
514
514
  </style>
515
515
  `,oe=`
516
516
  <script>
517
517
  Reveal.initialize(${JSON.stringify({margin:.1,...Te})})
518
518
  </script>
519
- `}let ce="";T.isForPrince&&(ce="prince");let de=qe.basename(this.filePath);de=de.slice(0,de.length-qe.extname(de).length),S.title&&(de=S.title);let _e="";try{if(_e+=!this.notebook.config.printBackground&&!S.print_background&&!S.isPresentationMode?await this.fs.readFile(qe.resolve(wt(),"./styles/prism_theme/github.css")):await this.fs.readFile(qe.resolve(wt(),`./styles/prism_theme/${this.getPrismTheme(S.isPresentationMode,S)}`)),S.isPresentationMode){let Te=S.presentation&&typeof S.presentation=="object"&&S.presentation.theme?S.presentation.theme:this.notebook.config.revealjsTheme;T.offline?ae+=`<link rel="stylesheet" href="file:///${qe.resolve(wt(),`./dependencies/reveal/css/theme/${Te}`)}">`:ae+=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/reveal.js@4.6.0/dist/theme/${Te}">`}else _e+=!this.notebook.config.printBackground&&!S.print_background?await this.fs.readFile(qe.resolve(wt(),"./styles/preview_theme/github-light.css")):await this.fs.readFile(qe.resolve(wt(),`./styles/preview_theme/${this.notebook.config.previewTheme}`));_e+=await this.fs.readFile(qe.resolve(wt(),"./styles/style-template.css")),b.indexOf("admonition")>0&&(_e+=await this.fs.readFile(qe.resolve(wt(),"./styles/markdown-it-admonition.css")))}catch{_e=""}let Ce=this.notebook.config.globalCss,Me="",Ge="",Ee="";if(this.notebook.config.enableScriptExecution&&!S.isPresentationMode&&!T.isForPrint&&(!("html"in S)||S.html&&S.html.toc!==!1)&&(Me=`<div class="md-sidebar-toc">${this.tocHTML}</div>`,Ee='<a id="sidebar-toc-btn">\u2261</a>',Ge=`
519
+ `}let ce="";T.isForPrince&&(ce="prince");let de=qe.basename(this.filePath);de=de.slice(0,de.length-qe.extname(de).length),S.title&&(de=S.title);let _e="";try{if(_e+=!this.notebook.config.printBackground&&!S.print_background&&!S.isPresentationMode?await this.fs.readFile(qe.resolve(Et(),"./styles/prism_theme/github.css")):await this.fs.readFile(qe.resolve(Et(),`./styles/prism_theme/${this.getPrismTheme(S.isPresentationMode,S)}`)),S.isPresentationMode){let Te=S.presentation&&typeof S.presentation=="object"&&S.presentation.theme?S.presentation.theme:this.notebook.config.revealjsTheme;T.offline?ae+=`<link rel="stylesheet" href="file:///${qe.resolve(Et(),`./dependencies/reveal/css/theme/${Te}`)}">`:ae+=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/reveal.js@4.6.0/dist/theme/${Te}">`}else _e+=!this.notebook.config.printBackground&&!S.print_background?await this.fs.readFile(qe.resolve(Et(),"./styles/preview_theme/github-light.css")):await this.fs.readFile(qe.resolve(Et(),`./styles/preview_theme/${this.notebook.config.previewTheme}`));_e+=await this.fs.readFile(qe.resolve(Et(),"./styles/style-template.css")),b.indexOf("admonition")>0&&(_e+=await this.fs.readFile(qe.resolve(Et(),"./styles/markdown-it-admonition.css"))),b.indexOf("callout")>0&&(_e+=await this.fs.readFile(qe.resolve(Et(),"./styles/markdown-it-callout.css")))}catch{_e=""}let Ce=this.notebook.config.globalCss,Me="",Ge="",Ee="";if(this.notebook.config.enableScriptExecution&&!S.isPresentationMode&&!T.isForPrint&&(!("html"in S)||S.html&&S.html.toc!==!1)&&(Me=`<div class="md-sidebar-toc">${this.tocHTML}</div>`,Ee='<a id="sidebar-toc-btn">\u2261</a>',Ge=`
520
520
  <script>
521
521
  ${S.html&&S.html.toc?"document.body.setAttribute('html-show-sidebar-toc', true)":""}
522
522
  var sidebarTOCBtn = document.getElementById('sidebar-toc-btn')
@@ -563,7 +563,7 @@ sidebarTOCBtn.addEventListener('click', function(event) {
563
563
  ${he}
564
564
  ${Ge}
565
565
  </html>
566
- `,T.embedLocalImages||T.embedSVG){let Te=Ll.load(b);T.embedLocalImages&&await f_(Te,this.notebook,this.resolveFilePath.bind(this)),T.embedSVG&&await TA(Te,this.notebook,this.resolveFilePath.bind(this)),b=Te.html()}return b.trim()}async openInBrowser({runAllCodeChunks:b=!1}){let S=await this.fs.readFile(this.filePath),T,R;({html:T,yamlConfig:R}=await this.parseMD(S,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:b})),T=await this.generateHTMLTemplateForExport(T,R,{isForPrint:!1,isForPrince:!1,offline:!0,embedLocalImages:!1});let $=await Xo({prefix:"crossnote",suffix:".html"});Jn.writeFileSync($.fd,T),Nd($.path)}async htmlExport({offline:b=!1,runAllCodeChunks:S=!1}){let T=await this.fs.readFile(this.filePath),R,$;({html:R,yamlConfig:$}=await this.parseMD(T,{useRelativeFilePath:!0,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:S}));let P=$.html||{};"offline"in P&&(b=P.offline);let F=P.embed_local_images,j=!0;"embed_svg"in P&&(j=P.embed_svg);let W=this.filePath,V=qe.extname(W);if(W=W.replace(new RegExp(V+"$"),".html"),R=await this.generateHTMLTemplateForExport(R,$,{isForPrint:!1,isForPrince:!1,embedLocalImages:F,offline:b,embedSVG:j}),!b&&R.indexOf('[{"src":"revealjs_deps/notes.js","async":true}]')>=0){let ee=qe.resolve(qe.dirname(W),"revealjs_deps");Jn.existsSync(ee)||Jn.mkdirSync(ee),Jn.createReadStream(qe.resolve(wt(),"./dependencies/reveal/plugin/notes/notes.js")).pipe(Jn.createWriteStream(qe.resolve(ee,"notes.js"))),Jn.createReadStream(qe.resolve(wt(),"./dependencies/reveal/plugin/notes/notes.html")).pipe(Jn.createWriteStream(qe.resolve(ee,"notes.html")))}return await this.fs.writeFile(W,R),W}async chromeExport({fileType:b="pdf",runAllCodeChunks:S=!1,openFileAfterGeneration:T=!1}){let R=await this.fs.readFile(this.filePath),$,P;({html:$,yamlConfig:P}=await this.parseMD(R,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:S}));let F=this.filePath,j=qe.extname(F);F=F.replace(new RegExp(j+"$"),"."+b),$=await this.generateHTMLTemplateForExport($,P,{isForPrint:!0,isForPrince:!1,embedLocalImages:!1,offline:!0});let W="";try{if(W=this.notebook.config.chromePath,!W){let ce=(await import("chrome-paths")).default;W=ce.chrome||ce.chromeCanary||ce.chromium}}catch{W=""}if(!W)throw new Error("Chrome executable path is not set.");let ee=await(await import("puppeteer-core/lib/cjs/puppeteer/puppeteer-core.js")).launch({args:this.notebook.config.puppeteerArgs||[],executablePath:W,headless:!0}),ne=await Xo({prefix:"crossnote",suffix:".html"});Jn.writeFileSync(ne.fd,$);let he=await ee.newPage(),Z="file:///"+ne.path+(P.isPresentationMode?"?print-pdf":"");await he.goto(Z);let ae={path:F,...P.isPresentationMode?{}:{margin:{top:"1cm",bottom:"1cm",left:"1cm",right:"1cm"}},printBackground:this.notebook.config.printBackground,...P.chrome||P.puppeteer||{}},oe=0;return P.chrome&&P.chrome.timeout?oe=P.chrome.timeout:P.puppeteer&&P.puppeteer.timeout&&(oe=P.puppeteer.timeout),oe&&typeof oe=="number"?await new Promise(ce=>setTimeout(ce,oe)):this.notebook.config.puppeteerWaitForTimeout&&this.notebook.config.puppeteerWaitForTimeout>0&&await new Promise(ce=>setTimeout(ce,this.notebook.config.puppeteerWaitForTimeout)),b==="pdf"?await he.pdf(ae):(ae.fullPage=!0,await he.screenshot(ae)),ee.close(),T&&Nd(F),F}async princeExport({runAllCodeChunks:b=!1,openFileAfterGeneration:S=!1}){let T=await this.fs.readFile(this.filePath),R,$;({html:R,yamlConfig:$}=await this.parseMD(T,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:b}));let P=this.filePath,F=qe.extname(P);P=P.replace(new RegExp(F+"$"),".pdf"),R=await this.generateHTMLTemplateForExport(R,$,{isForPrint:!0,isForPrince:!0,embedLocalImages:!1,offline:!0});let j=await Xo({prefix:"crossnote",suffix:".html"});return Jn.writeFileSync(j.fd,R),$.isPresentationMode?"file:///"+j.path+"?print-pdf":(await WM(j.path,P),S&&Nd(P),P)}async eBookDownloadImages(b,S){let T=[];(qe.extname(S)===".epub"||qe.extname("dest")===".mobi")&&b("img").each(($,P)=>{let F=b(P);(F.attr("src")||"").match(/^https?:\/\//)&&T.push(F)});let R=T.map($=>new Promise(P=>{let F=$.attr("src"),j=Math.random().toString(36).substr(2,9)+"_"+qe.basename(F);j=qe.resolve(this.fileDirectoryPath,j),(0,j2.default)(F).pipe(Jn.createWriteStream(j)).on("finish",()=>($.attr("src","file:///"+j),P(j)))}));return Promise.all(R)}async eBookExport({fileType:b="epub",runAllCodeChunks:S=!1}){let T=await this.fs.readFile(this.filePath),R=b==="pdf",$,P;({html:$,yamlConfig:P}=await this.parseMD(T,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:S,emojiToSvg:R}));let F=this.filePath,j=qe.extname(F);F=F.replace(new RegExp(j+"$"),"."+b.toLowerCase());let W=P.ebook||{};if(!W)throw new Error("eBook config not found. Please insert ebook front-matter to your markdown file.");if(W.cover){let ye=W.cover;W.cover=Fs(this.resolveFilePath(ye,!1))}let V=Ll.load(`<div>${$}</div>`),ee=[],ne=new uo,he=V("div > ul").last();if(he.length){if(W.include_toc===!1){let ye=he.prev();ye.length&&ye[0].name.match(/^h\d$/i)&&ye.remove()}V("h1, h2, h3, h4, h5, h6").each((ye,be)=>{let Te=V(be),ke=parseInt(Te[0].name.slice(1),10)-1;Te.attr("ebook-toc-level-"+(ke+1),""),Te.attr("heading",Te.html())}),Z(he,0),W.include_toc===!1&&he.remove()}function Z(ye,be){ye.children("li").each((Te,ke)=>{let Ye=V(ke),$e=Ye.children("a").first();if(!$e.length){Ye.children().length>=1&&Z(Ye.children().last(),be+1);return}let Le=decodeURIComponent($e.attr("href")),dt=$e.html()??"",yt=ne.generateId("ebook-heading-"+dt);ee.push({level:be,filePath:Le,heading:dt,id:yt}),$e.attr("href","#"+yt),Ye.children().length>1&&Z(Ye.children().last(),be+1)})}let ae=ee.map(({heading:ye,id:be,level:Te,filePath:ke},Ye)=>new Promise(($e,Le)=>{if(ke=Fs(ke),ke.match(/^https?:\/\//))return $e({heading:ye,id:be,level:Te,filePath:ke,html:"",offset:Ye});Jn.readFile(ke,{encoding:"utf-8"},(dt,yt)=>{if(dt)return Le(dt.toString());let xt=qe.dirname(this.filePath);yt=yt.replace(/(!\[[^\]]*\]\()(\.[^)\s]*)/g,(rn,hn,jt)=>{let St=qe.resolve(qe.dirname(ke),jt),Tt=qe.relative(xt,St);return hn+Tt}),this.parseMD(yt,{useRelativeFilePath:!1,isForPreview:!1,hideFrontMatter:!0,emojiToSvg:R,fileDirectoryPath:qe.dirname(ke)}).then(({html:rn})=>$e({heading:ye,id:be,level:Te,filePath:ke,html:rn,offset:Ye}))})})),oe=V.html().replace(/^<div>(.+)<\/div>$/,"$1"),ce=await Promise.all(ae);ce=ce.sort((ye,be)=>ye.offset-be.offset),ce.forEach(({heading:ye,id:be,level:Te,html:ke})=>{let Ye=Ll.load(`<div>${ke}</div>`);Ye("a").each(($e,Le)=>{let dt=Ye(Le),yt=dt.attr("href");yt.startsWith("file://")&&ce.forEach(xt=>{xt.filePath===Fs(yt)&&dt.attr("href","#"+xt.id)})}),oe+=`<div id="${be}" ebook-toc-level-${Te+1} heading="${ye}">${Ye.html()}</div>`}),V=Ll.load(oe);let de=await this.eBookDownloadImages(V,F);if(qe.extname(F)===".html"){if(W.cover){let ye=W.cover[0]==="/"?"file:///"+W.cover:W.cover;V(":root").children().first().prepend(`<img style="display:block; margin-bottom: 24px;" src="${ye}">`)}await f_(V,this.notebook,this.resolveFilePath.bind(this))}oe=V.html();let _e=W.title||"no title",Ce="";oe.indexOf('class="katex"')>0&&(qe.extname(F)===".html"&&W.html&&W.html.cdn?Ce=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.38/dist/katex.min.css">`:Ce=`<link rel="stylesheet" href="file:///${qe.resolve(wt(),"./dependencies/katex/katex.min.css")}">`);let Me="";try{Me=(await Promise.all([await this.fs.readFile(qe.resolve(wt(),"./styles/style-template.css")),await this.fs.readFile(qe.resolve(wt(),`./styles/prism_theme/${Dd.AutoPrismThemeMap[W.theme||this.notebook.config.previewTheme]}`)),await this.fs.readFile(qe.resolve(wt(),"./styles/twemoji.css")),await this.fs.readFile(qe.resolve(wt(),`./styles/preview_theme/${W.theme||this.notebook.config.previewTheme}`)),oe.indexOf("admonition")>0?await this.fs.readFile(qe.resolve(wt(),"./styles/markdown-it-admonition.css")):"",oe.indexOf("callout")>0?await this.fs.readFile(qe.resolve(wt(),"./styles/markdown-it-callout.css")):""])).join("")}catch{Me=""}let Ge="";try{Ge=this.notebook.config.globalCss}catch{}if($=`
566
+ `,T.embedLocalImages||T.embedSVG){let Te=Ll.load(b);T.embedLocalImages&&await f_(Te,this.notebook,this.resolveFilePath.bind(this)),T.embedSVG&&await TA(Te,this.notebook,this.resolveFilePath.bind(this)),b=Te.html()}return b.trim()}async openInBrowser({runAllCodeChunks:b=!1}){let S=await this.fs.readFile(this.filePath),T,R;({html:T,yamlConfig:R}=await this.parseMD(S,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:b})),T=await this.generateHTMLTemplateForExport(T,R,{isForPrint:!1,isForPrince:!1,offline:!0,embedLocalImages:!1});let $=await Xo({prefix:"crossnote",suffix:".html"});Jn.writeFileSync($.fd,T),Nd($.path)}async htmlExport({offline:b=!1,runAllCodeChunks:S=!1}){let T=await this.fs.readFile(this.filePath),R,$;({html:R,yamlConfig:$}=await this.parseMD(T,{useRelativeFilePath:!0,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:S}));let P=$.html||{};"offline"in P&&(b=P.offline);let F=P.embed_local_images,j=!0;"embed_svg"in P&&(j=P.embed_svg);let W=this.filePath,V=qe.extname(W);if(W=W.replace(new RegExp(V+"$"),".html"),R=await this.generateHTMLTemplateForExport(R,$,{isForPrint:!1,isForPrince:!1,embedLocalImages:F,offline:b,embedSVG:j}),!b&&R.indexOf('[{"src":"revealjs_deps/notes.js","async":true}]')>=0){let ee=qe.resolve(qe.dirname(W),"revealjs_deps");Jn.existsSync(ee)||Jn.mkdirSync(ee),Jn.createReadStream(qe.resolve(Et(),"./dependencies/reveal/plugin/notes/notes.js")).pipe(Jn.createWriteStream(qe.resolve(ee,"notes.js"))),Jn.createReadStream(qe.resolve(Et(),"./dependencies/reveal/plugin/notes/notes.html")).pipe(Jn.createWriteStream(qe.resolve(ee,"notes.html")))}return await this.fs.writeFile(W,R),W}async chromeExport({fileType:b="pdf",runAllCodeChunks:S=!1,openFileAfterGeneration:T=!1}){let R=await this.fs.readFile(this.filePath),$,P;({html:$,yamlConfig:P}=await this.parseMD(R,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:S}));let F=this.filePath,j=qe.extname(F);F=F.replace(new RegExp(j+"$"),"."+b),$=await this.generateHTMLTemplateForExport($,P,{isForPrint:!0,isForPrince:!1,embedLocalImages:!1,offline:!0});let W="";try{if(W=this.notebook.config.chromePath,!W){let ce=(await import("chrome-paths")).default;W=ce.chrome||ce.chromeCanary||ce.chromium}}catch{W=""}if(!W)throw new Error("Chrome executable path is not set.");let ee=await(await import("puppeteer-core/lib/cjs/puppeteer/puppeteer-core.js")).launch({args:this.notebook.config.puppeteerArgs||[],executablePath:W,headless:!0}),ne=await Xo({prefix:"crossnote",suffix:".html"});Jn.writeFileSync(ne.fd,$);let he=await ee.newPage(),Z="file:///"+ne.path+(P.isPresentationMode?"?print-pdf":"");await he.goto(Z);let ae={path:F,...P.isPresentationMode?{}:{margin:{top:"1cm",bottom:"1cm",left:"1cm",right:"1cm"}},printBackground:this.notebook.config.printBackground,...P.chrome||P.puppeteer||{}},oe=0;return P.chrome&&P.chrome.timeout?oe=P.chrome.timeout:P.puppeteer&&P.puppeteer.timeout&&(oe=P.puppeteer.timeout),oe&&typeof oe=="number"?await new Promise(ce=>setTimeout(ce,oe)):this.notebook.config.puppeteerWaitForTimeout&&this.notebook.config.puppeteerWaitForTimeout>0&&await new Promise(ce=>setTimeout(ce,this.notebook.config.puppeteerWaitForTimeout)),b==="pdf"?await he.pdf(ae):(ae.fullPage=!0,await he.screenshot(ae)),ee.close(),T&&Nd(F),F}async princeExport({runAllCodeChunks:b=!1,openFileAfterGeneration:S=!1}){let T=await this.fs.readFile(this.filePath),R,$;({html:R,yamlConfig:$}=await this.parseMD(T,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:b}));let P=this.filePath,F=qe.extname(P);P=P.replace(new RegExp(F+"$"),".pdf"),R=await this.generateHTMLTemplateForExport(R,$,{isForPrint:!0,isForPrince:!0,embedLocalImages:!1,offline:!0});let j=await Xo({prefix:"crossnote",suffix:".html"});return Jn.writeFileSync(j.fd,R),$.isPresentationMode?"file:///"+j.path+"?print-pdf":(await WM(j.path,P),S&&Nd(P),P)}async eBookDownloadImages(b,S){let T=[];(qe.extname(S)===".epub"||qe.extname("dest")===".mobi")&&b("img").each(($,P)=>{let F=b(P);(F.attr("src")||"").match(/^https?:\/\//)&&T.push(F)});let R=T.map($=>new Promise(P=>{let F=$.attr("src"),j=Math.random().toString(36).substr(2,9)+"_"+qe.basename(F);j=qe.resolve(this.fileDirectoryPath,j),(0,j2.default)(F).pipe(Jn.createWriteStream(j)).on("finish",()=>($.attr("src","file:///"+j),P(j)))}));return Promise.all(R)}async eBookExport({fileType:b="epub",runAllCodeChunks:S=!1}){let T=await this.fs.readFile(this.filePath),R=b==="pdf",$,P;({html:$,yamlConfig:P}=await this.parseMD(T,{useRelativeFilePath:!1,hideFrontMatter:!0,isForPreview:!1,runAllCodeChunks:S,emojiToSvg:R}));let F=this.filePath,j=qe.extname(F);F=F.replace(new RegExp(j+"$"),"."+b.toLowerCase());let W=P.ebook||{};if(!W)throw new Error("eBook config not found. Please insert ebook front-matter to your markdown file.");if(W.cover){let ye=W.cover;W.cover=Fs(this.resolveFilePath(ye,!1))}let V=Ll.load(`<div>${$}</div>`),ee=[],ne=new uo,he=V("div > ul").last();if(he.length){if(W.include_toc===!1){let ye=he.prev();ye.length&&ye[0].name.match(/^h\d$/i)&&ye.remove()}V("h1, h2, h3, h4, h5, h6").each((ye,be)=>{let Te=V(be),ke=parseInt(Te[0].name.slice(1),10)-1;Te.attr("ebook-toc-level-"+(ke+1),""),Te.attr("heading",Te.html())}),Z(he,0),W.include_toc===!1&&he.remove()}function Z(ye,be){ye.children("li").each((Te,ke)=>{let Ye=V(ke),$e=Ye.children("a").first();if(!$e.length){Ye.children().length>=1&&Z(Ye.children().last(),be+1);return}let Le=decodeURIComponent($e.attr("href")),dt=$e.html()??"",yt=ne.generateId("ebook-heading-"+dt);ee.push({level:be,filePath:Le,heading:dt,id:yt}),$e.attr("href","#"+yt),Ye.children().length>1&&Z(Ye.children().last(),be+1)})}let ae=ee.map(({heading:ye,id:be,level:Te,filePath:ke},Ye)=>new Promise(($e,Le)=>{if(ke=Fs(ke),ke.match(/^https?:\/\//))return $e({heading:ye,id:be,level:Te,filePath:ke,html:"",offset:Ye});Jn.readFile(ke,{encoding:"utf-8"},(dt,yt)=>{if(dt)return Le(dt.toString());let xt=qe.dirname(this.filePath);yt=yt.replace(/(!\[[^\]]*\]\()(\.[^)\s]*)/g,(rn,hn,jt)=>{let St=qe.resolve(qe.dirname(ke),jt),Tt=qe.relative(xt,St);return hn+Tt}),this.parseMD(yt,{useRelativeFilePath:!1,isForPreview:!1,hideFrontMatter:!0,emojiToSvg:R,fileDirectoryPath:qe.dirname(ke)}).then(({html:rn})=>$e({heading:ye,id:be,level:Te,filePath:ke,html:rn,offset:Ye}))})})),oe=V.html().replace(/^<div>(.+)<\/div>$/,"$1"),ce=await Promise.all(ae);ce=ce.sort((ye,be)=>ye.offset-be.offset),ce.forEach(({heading:ye,id:be,level:Te,html:ke})=>{let Ye=Ll.load(`<div>${ke}</div>`);Ye("a").each(($e,Le)=>{let dt=Ye(Le),yt=dt.attr("href");yt.startsWith("file://")&&ce.forEach(xt=>{xt.filePath===Fs(yt)&&dt.attr("href","#"+xt.id)})}),oe+=`<div id="${be}" ebook-toc-level-${Te+1} heading="${ye}">${Ye.html()}</div>`}),V=Ll.load(oe);let de=await this.eBookDownloadImages(V,F);if(qe.extname(F)===".html"){if(W.cover){let ye=W.cover[0]==="/"?"file:///"+W.cover:W.cover;V(":root").children().first().prepend(`<img style="display:block; margin-bottom: 24px;" src="${ye}">`)}await f_(V,this.notebook,this.resolveFilePath.bind(this))}oe=V.html();let _e=W.title||"no title",Ce="";oe.indexOf('class="katex"')>0&&(qe.extname(F)===".html"&&W.html&&W.html.cdn?Ce=`<link rel="stylesheet" href="https://${this.notebook.config.jsdelivrCdnHost}/npm/katex@0.16.38/dist/katex.min.css">`:Ce=`<link rel="stylesheet" href="file:///${qe.resolve(Et(),"./dependencies/katex/katex.min.css")}">`);let Me="";try{Me=(await Promise.all([await this.fs.readFile(qe.resolve(Et(),"./styles/style-template.css")),await this.fs.readFile(qe.resolve(Et(),`./styles/prism_theme/${Dd.AutoPrismThemeMap[W.theme||this.notebook.config.previewTheme]}`)),await this.fs.readFile(qe.resolve(Et(),"./styles/twemoji.css")),await this.fs.readFile(qe.resolve(Et(),`./styles/preview_theme/${W.theme||this.notebook.config.previewTheme}`)),oe.indexOf("admonition")>0?await this.fs.readFile(qe.resolve(Et(),"./styles/markdown-it-admonition.css")):"",oe.indexOf("callout")>0?await this.fs.readFile(qe.resolve(Et(),"./styles/markdown-it-callout.css")):""])).join("")}catch{Me=""}let Ge="";try{Ge=this.notebook.config.globalCss}catch{}if($=`
567
567
  <!DOCTYPE html>
568
568
  <html>
569
569
  <head>
@@ -613,4 +613,4 @@ ${S}
613
613
  <!-- /code_chunk_output -->
614
614
  `,...ne.slice(ee+1)];return await this.notebook.fs.writeFile(T,ae.join(`
615
615
  `)),""}},F=$.split(`
616
- `)||[],j=F.length,W=0,V=b.normalizedInfo.attributes.code_chunk_offset;for(let ee=0;ee<j;ee++){let ne=F[ee];if(ne.match(/^```(.+)"?cmd"?\s*[=\s}]/))if(W===V){for(ee=ee+1;ee<j&&!F[ee].match(/^```\s*/);)ee+=1;await P(ee,F);break}else W++;else if(ne.match(/@import\s+(.+)"?cmd"?\s*[=\s}]/))if(W===V){await P(ee,F);break}else W++}return R()}generateRunOptions(){return{enableScriptExecution:this.notebook.config.enableScriptExecution,fileDirectoryPath:this.fileDirectoryPath,filePath:this.filePath,imageFolderPath:this.notebook.config.imageFolderPath,latexEngine:this.notebook.config.latexEngine,modifySource:this.modifySource.bind(this),parseMD:this.parseMD.bind(this),headings:this.headings}}};Dd.AutoPrismThemeMap={"atom-dark.css":"atom-dark.css","atom-light.css":"atom-light.css","atom-material.css":"atom-material.css","github-dark.css":"github-dark.css","github-light.css":"github.css","gothic.css":"github.css","medium.css":"github.css","monokai.css":"monokai.css","newsprint.css":"pen-paper-coffee.css","night.css":"darcula.css","one-dark.css":"one-dark.css","one-light.css":"one-light.css","solarized-light.css":"solarized-light.css","solarized-dark.css":"solarized-dark.css","vue.css":"vue.css"},Dd.AutoPrismThemeMapForPresentation={"beige.css":"pen-paper-coffee.css","black.css":"one-dark.css","blood.css":"monokai.css","league.css":"okaidia.css","moon.css":"funky.css","night.css":"atom-dark.css","serif.css":"github.css","simple.css":"github.css","sky.css":"default.css","solarized.css":"solarized-light.css","white.css":"default.css"};var p0=Dd;var s4={addFileProtocol:yn,getCrossnoteBuildDirectory:wt,openFile:Nd,setCrossnoteBuildDirectory:DD,useExternalAddFileProtocolFunction:MD,uploadImage:oA};0&&(module.exports={HeadingIdGenerator,IS_NODE,MarkdownEngine,Notebook,PreviewMode,getDefaultKatexConfig,getDefaultMathjaxConfig,getDefaultMermaidConfig,getDefaultNotebookConfig,getDefaultParserConfig,loadConfigsInDirectory,transformMarkdown,utility,wrapNodeFSAsApi});
616
+ `)||[],j=F.length,W=0,V=b.normalizedInfo.attributes.code_chunk_offset;for(let ee=0;ee<j;ee++){let ne=F[ee];if(ne.match(/^```(.+)"?cmd"?\s*[=\s}]/))if(W===V){for(ee=ee+1;ee<j&&!F[ee].match(/^```\s*/);)ee+=1;await P(ee,F);break}else W++;else if(ne.match(/@import\s+(.+)"?cmd"?\s*[=\s}]/))if(W===V){await P(ee,F);break}else W++}return R()}generateRunOptions(){return{enableScriptExecution:this.notebook.config.enableScriptExecution,fileDirectoryPath:this.fileDirectoryPath,filePath:this.filePath,imageFolderPath:this.notebook.config.imageFolderPath,latexEngine:this.notebook.config.latexEngine,modifySource:this.modifySource.bind(this),parseMD:this.parseMD.bind(this),headings:this.headings}}};Dd.AutoPrismThemeMap={"atom-dark.css":"atom-dark.css","atom-light.css":"atom-light.css","atom-material.css":"atom-material.css","github-dark.css":"github-dark.css","github-light.css":"github.css","gothic.css":"github.css","medium.css":"github.css","monokai.css":"monokai.css","newsprint.css":"pen-paper-coffee.css","night.css":"darcula.css","one-dark.css":"one-dark.css","one-light.css":"one-light.css","solarized-light.css":"solarized-light.css","solarized-dark.css":"solarized-dark.css","vue.css":"vue.css"},Dd.AutoPrismThemeMapForPresentation={"beige.css":"pen-paper-coffee.css","black.css":"one-dark.css","blood.css":"monokai.css","league.css":"okaidia.css","moon.css":"funky.css","night.css":"atom-dark.css","serif.css":"github.css","simple.css":"github.css","sky.css":"default.css","solarized.css":"solarized-light.css","white.css":"default.css"};var p0=Dd;var s4={addFileProtocol:yn,getCrossnoteBuildDirectory:Et,openFile:Nd,setCrossnoteBuildDirectory:DD,useExternalAddFileProtocolFunction:MD,uploadImage:oA};0&&(module.exports={HeadingIdGenerator,IS_NODE,MarkdownEngine,Notebook,PreviewMode,getDefaultKatexConfig,getDefaultMathjaxConfig,getDefaultMermaidConfig,getDefaultNotebookConfig,getDefaultParserConfig,loadConfigsInDirectory,transformMarkdown,utility,wrapNodeFSAsApi});