Socket
Socket
Sign inDemoInstall

vega-scenegraph

Package Overview
Dependencies
Maintainers
2
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-scenegraph - npm Package Compare versions

Comparing version 4.4.1 to 4.5.0

6

build/vega-scenegraph-schema.json

@@ -315,2 +315,8 @@ {

}
},
"strokeForeground": {
"type": "boolean"
},
"strokeOffset": {
"type": "number"
}

@@ -317,0 +323,0 @@ },

2

build/vega-scenegraph.min.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-canvas"),require("vega-loader"),require("d3-shape"),require("d3-path")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-canvas","vega-loader","d3-shape","d3-path"],e):e((t=t||self).vega={},t.vega,t.vega,t.vega,t.d3,t.d3)}(this,(function(t,e,n,i,r,o){"use strict";function s(t){this.clear(),t&&this.union(t)}var a=s.prototype;a.clone=function(){return new s(this)},a.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},a.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},a.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},a.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},a.add=function(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},a.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},a.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},a.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},a.rotate=function(t,e,n){const i=this.rotatedPoints(t,e,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},a.rotatedPoints=function(t,e,n){var{x1:i,y1:r,x2:o,y2:s}=this,a=Math.cos(t),u=Math.sin(t),l=e-e*a+n*u,h=n-e*u-n*a;return[a*i-u*r+l,u*i+a*r+h,a*i-u*s+l,u*i+a*s+h,a*o-u*r+l,u*o+a*r+h,a*o-u*s+l,u*o+a*s+h]},a.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},a.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},a.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},a.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},a.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},a.contains=function(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},a.width=function(){return this.x2-this.x1},a.height=function(){return this.y2-this.y1};var u=0;const l="p_";function h(t){return t&&t.gradient}function c(t,e,n){let i=t.id,r=t.gradient,o="radial"===r?l:"";return i||(i=t.id="gradient_"+u++,"radial"===r?(t.x1=f(t.x1,.5),t.y1=f(t.y1,.5),t.r1=f(t.r1,0),t.x2=f(t.x2,.5),t.y2=f(t.y2,.5),t.r2=f(t.r2,.5),o=l):(t.x1=f(t.x1,0),t.y1=f(t.y1,0),t.x2=f(t.x2,1),t.y2=f(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function f(t,e){return null!=t?t:e}function d(t){this.mark=t,this.bounds=this.bounds||new s}function v(t){d.call(this,t),this.items=this.items||[]}function g(t){this._pending=0,this._loader=t||i.loader()}e.inherits(v,d);var p=g.prototype;function y(t){t._pending+=1}function m(t){t._pending-=1}p.pending=function(){return this._pending},p.sanitizeURL=function(t){var e=this;return y(e),e._loader.sanitize(t,{context:"href"}).then((function(t){return m(e),t})).catch((function(){return m(e),null}))},p.loadImage=function(t){var e=this,i=n.image();return y(e),e._loader.sanitize(t,{context:"image"}).then((function(t){var n=t.href;if(!n||!i)throw{url:n};var r=new i;return r.onload=function(){m(e)},r.onerror=function(){m(e)},r.src=n,r})).catch((function(t){return m(e),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},p.ready=function(){var t=this;return new Promise((function(e){!function n(i){t.pending()?setTimeout((function(){n(!0)}),10):e(i)}(!1)}))};var _={basis:{curve:r.curveBasis},"basis-closed":{curve:r.curveBasisClosed},"basis-open":{curve:r.curveBasisOpen},bundle:{curve:r.curveBundle,tension:"beta",value:.85},cardinal:{curve:r.curveCardinal,tension:"tension",value:0},"cardinal-open":{curve:r.curveCardinalOpen,tension:"tension",value:0},"cardinal-closed":{curve:r.curveCardinalClosed,tension:"tension",value:0},"catmull-rom":{curve:r.curveCatmullRom,tension:"alpha",value:.5},"catmull-rom-closed":{curve:r.curveCatmullRomClosed,tension:"alpha",value:.5},"catmull-rom-open":{curve:r.curveCatmullRomOpen,tension:"alpha",value:.5},linear:{curve:r.curveLinear},"linear-closed":{curve:r.curveLinearClosed},monotone:{horizontal:r.curveMonotoneY,vertical:r.curveMonotoneX},natural:{curve:r.curveNatural},step:{curve:r.curveStep},"step-after":{curve:r.curveStepAfter},"step-before":{curve:r.curveStepBefore}};function x(t,n,i){var r=e.hasOwnProperty(_,t)&&_[t],o=null;return r&&(o=r.curve||r[n||"vertical"],r.tension&&null!=i&&(o=o[r.tension](i))),o}var b={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},k=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function w(t){var e,n,i,r,o,s,a,u,l,h,c,f=[];for(u=0,h=(e=t.slice().replace(k[0],"###$1").split(k[1]).slice(1)).length;u<h;++u){for(i=(n=e[u]).slice(1).trim().replace(k[2],"$1###$2").split(k[3]),r=[s=n.charAt(0)],l=0,c=i.length;l<c;++l)(o=+i[l])===o&&r.push(o);if(a=b[s.toLowerCase()],r.length-1>a)for(l=1,c=r.length;l<c;l+=a)f.push([s].concat(r.slice(l,l+a)));else f.push(r)}return f}var T=Math.PI/180,A=Math.PI/2,M=2*Math.PI,z=Math.sqrt(3)/2,C={},R={},P=[].join;function L(t){var e=P.call(t);if(R[e])return R[e];var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],a=t[5],u=t[6],l=t[7],h=l*s,c=-u*a,f=u*s,d=l*a,v=Math.cos(r),g=Math.sin(r),p=Math.cos(o),y=Math.sin(o),m=.5*(o-r),_=Math.sin(.5*m),x=8/3*_*_/Math.sin(m),b=n+v-x*g,k=i+g+x*v,w=n+p,T=i+y,A=w+x*y,M=T-x*p;return R[e]=[h*b+c*k,f*b+d*k,h*A+c*M,f*A+d*M,h*w+c*T,f*w+d*T]}var S=["l",0,0,0,0,0,0,0];function N(t,e,n){var i=S[0]=t[0];if("a"===i||"A"===i)S[1]=e*t[1],S[2]=n*t[2],S[3]=t[3],S[4]=t[4],S[5]=t[5],S[6]=e*t[6],S[7]=n*t[7];else if("h"===i||"H"===i)S[1]=e*t[1];else if("v"===i||"V"===i)S[1]=n*t[1];else for(var r=1,o=t.length;r<o;++r)S[r]=(r%2==1?e:n)*t[r];return S}function q(t,e,n,i,r,o){var s,a,u,l,h,c=null,f=0,d=0,v=0,g=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==o&&(o=r),t.beginPath&&t.beginPath();for(var p=0,y=e.length;p<y;++p){switch(s=e[p],1===r&&1===o||(s=N(s,r,o)),s[0]){case"l":f+=s[1],d+=s[2],t.lineTo(f+n,d+i);break;case"L":f=s[1],d=s[2],t.lineTo(f+n,d+i);break;case"h":f+=s[1],t.lineTo(f+n,d+i);break;case"H":f=s[1],t.lineTo(f+n,d+i);break;case"v":d+=s[1],t.lineTo(f+n,d+i);break;case"V":d=s[1],t.lineTo(f+n,d+i);break;case"m":f+=s[1],d+=s[2],t.moveTo(f+n,d+i);break;case"M":f=s[1],d=s[2],t.moveTo(f+n,d+i);break;case"c":a=f+s[5],u=d+s[6],v=f+s[3],g=d+s[4],t.bezierCurveTo(f+s[1]+n,d+s[2]+i,v+n,g+i,a+n,u+i),f=a,d=u;break;case"C":f=s[5],d=s[6],v=s[3],g=s[4],t.bezierCurveTo(s[1]+n,s[2]+i,v+n,g+i,f+n,d+i);break;case"s":a=f+s[3],u=d+s[4],v=2*f-v,g=2*d-g,t.bezierCurveTo(v+n,g+i,f+s[1]+n,d+s[2]+i,a+n,u+i),v=f+s[1],g=d+s[2],f=a,d=u;break;case"S":a=s[3],u=s[4],v=2*f-v,g=2*d-g,t.bezierCurveTo(v+n,g+i,s[1]+n,s[2]+i,a+n,u+i),f=a,d=u,v=s[1],g=s[2];break;case"q":a=f+s[3],u=d+s[4],v=f+s[1],g=d+s[2],t.quadraticCurveTo(v+n,g+i,a+n,u+i),f=a,d=u;break;case"Q":a=s[3],u=s[4],t.quadraticCurveTo(s[1]+n,s[2]+i,a+n,u+i),f=a,d=u,v=s[1],g=s[2];break;case"t":a=f+s[1],u=d+s[2],null===c[0].match(/[QqTt]/)?(v=f,g=d):"t"===c[0]?(v=2*f-l,g=2*d-h):"q"===c[0]&&(v=2*f-v,g=2*d-g),l=v,h=g,t.quadraticCurveTo(v+n,g+i,a+n,u+i),d=u,v=(f=a)+s[1],g=d+s[2];break;case"T":a=s[1],u=s[2],v=2*f-v,g=2*d-g,t.quadraticCurveTo(v+n,g+i,a+n,u+i),f=a,d=u;break;case"a":O(t,f+n,d+i,[s[1],s[2],s[3],s[4],s[5],s[6]+f+n,s[7]+d+i]),f+=s[6],d+=s[7];break;case"A":O(t,f+n,d+i,[s[1],s[2],s[3],s[4],s[5],s[6]+n,s[7]+i]),f=s[6],d=s[7];break;case"z":case"Z":t.closePath()}c=s}}function O(t,e,n,i){for(var r=function(t,e,n,i,r,o,s,a,u){var l=P.call(arguments);if(C[l])return C[l];var h=s*T,c=Math.sin(h),f=Math.cos(h),d=f*(a-t)*.5+c*(u-e)*.5,v=f*(u-e)*.5-c*(a-t)*.5,g=d*d/((n=Math.abs(n))*n)+v*v/((i=Math.abs(i))*i);g>1&&(n*=g=Math.sqrt(g),i*=g);var p=f/n,y=c/n,m=-c/i,_=f/i,x=p*a+y*u,b=m*a+_*u,k=p*t+y*e,w=m*t+_*e,z=1/((k-x)*(k-x)+(w-b)*(w-b))-.25;z<0&&(z=0);var R=Math.sqrt(z);o==r&&(R=-R);var L=.5*(x+k)-R*(w-b),S=.5*(b+w)+R*(k-x),N=Math.atan2(b-S,x-L),q=Math.atan2(w-S,k-L)-N;q<0&&1===o?q+=M:q>0&&0===o&&(q-=M);for(var O=Math.ceil(Math.abs(q/(A+.001))),E=[],D=0;D<O;++D){var I=N+D*q/O,B=N+(D+1)*q/O;E[D]=[L,S,I,B,n,i,c,f]}return C[l]=E}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,n),o=0;o<r.length;++o){var s=L(r[o]);t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}var E={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,M)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/2.5;t.moveTo(-n,-i),t.lineTo(-n,i),t.lineTo(-i,i),t.lineTo(-i,n),t.lineTo(i,n),t.lineTo(i,i),t.lineTo(n,i),t.lineTo(n,-i),t.lineTo(i,-i),t.lineTo(i,-n),t.lineTo(-i,-n),t.lineTo(-i,-i),t.closePath()}},diamond:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),i=-n/2;t.rect(i,i,n,n)}},arrow:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/7,r=n/2.5,o=n/8;t.moveTo(-i,n),t.lineTo(i,n),t.lineTo(i,-o),t.lineTo(r,-o),t.lineTo(0,-n),t.lineTo(-r,-o),t.lineTo(-i,-o),t.closePath()}},wedge:{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n,r=i-.5773502691896257*n,o=n/4;t.moveTo(0,-i-r),t.lineTo(-o,i-r),t.lineTo(o,i-r),t.closePath()}},triangle:{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n,r=i-.5773502691896257*n;t.moveTo(0,-i-r),t.lineTo(-n,i-r),t.lineTo(n,i-r),t.closePath()}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(0,-i),t.lineTo(-n,i),t.lineTo(n,i),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(0,i),t.lineTo(-n,-i),t.lineTo(n,-i),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(i,0),t.lineTo(-i,-n),t.lineTo(-i,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(-i,0),t.lineTo(i,-n),t.lineTo(i,n),t.closePath()}},stroke:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(n,0)}}};function D(t){return e.hasOwnProperty(E,t)?E[t]:function(t){if(!e.hasOwnProperty(I,t)){var n=w(t);I[t]={draw:function(t,e){q(t,n,0,0,Math.sqrt(e)/2)}}}return I[t]}(t)}var I={};const B=.448084975506;function V(t){return t.x}function H(t){return t.y}function G(t){return t.width}function W(t){return t.height}function U(t){return"function"==typeof t?t:()=>+t}function X(t,e,n){return Math.max(e,Math.min(t,n))}function j(){var t=V,e=H,n=G,i=W,r=U(0),s=r,a=r,u=r,l=null;function h(h,c,f){var d,v=null!=c?c:+t.call(this,h),g=null!=f?f:+e.call(this,h),p=+n.call(this,h),y=+i.call(this,h),m=Math.min(p,y)/2,_=X(+r.call(this,h),0,m),x=X(+s.call(this,h),0,m),b=X(+a.call(this,h),0,m),k=X(+u.call(this,h),0,m);if(l||(l=d=o.path()),_<=0&&x<=0&&b<=0&&k<=0)l.rect(v,g,p,y);else{var w=v+p,T=g+y;l.moveTo(v+_,g),l.lineTo(w-x,g),l.bezierCurveTo(w-B*x,g,w,g+B*x,w,g+x),l.lineTo(w,T-k),l.bezierCurveTo(w,T-B*k,w-B*k,T,w-k,T),l.lineTo(v+b,T),l.bezierCurveTo(v+B*b,T,v,T-B*b,v,T-b),l.lineTo(v,g+_),l.bezierCurveTo(v,g+B*_,v+B*_,g,v+_,g),l.closePath()}if(d)return l=null,d+""||null}return h.x=function(e){return arguments.length?(t=U(e),h):t},h.y=function(t){return arguments.length?(e=U(t),h):e},h.width=function(t){return arguments.length?(n=U(t),h):n},h.height=function(t){return arguments.length?(i=U(t),h):i},h.cornerRadius=function(t,e,n,i){return arguments.length?(r=U(t),s=null!=e?U(e):r,u=null!=n?U(n):r,a=null!=i?U(i):s,h):r},h.context=function(t){return arguments.length?(l=null==t?null:t,h):l},h}function J(){var t,e,n,i,r,s,a,u,l=null;function h(t,e,n){var i=n/2;if(r){var o=a-e,h=t-s;if(o||h){var c=Math.sqrt(o*o+h*h),f=(o/=c)*u,d=(h/=c)*u,v=Math.atan2(h,o);l.moveTo(s-f,a-d),l.lineTo(t-o*i,e-h*i),l.arc(t,e,i,v-Math.PI,v),l.lineTo(s+f,a+d),l.arc(s,a,u,v,v+Math.PI)}else l.arc(t,e,i,0,M);l.closePath()}else r=1;s=t,a=e,u=i}function c(s){var a,u,c,f=s.length,d=!1;for(null==l&&(l=c=o.path()),a=0;a<=f;++a)!(a<f&&i(u=s[a],a,s))===d&&(d=!d)&&(r=0),d&&h(+t(u,a,s),+e(u,a,s),+n(u,a,s));if(c)return l=null,c+""||null}return c.x=function(e){return arguments.length?(t=e,c):t},c.y=function(t){return arguments.length?(e=t,c):e},c.size=function(t){return arguments.length?(n=t,c):n},c.defined=function(t){return arguments.length?(i=t,c):i},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}function Y(t,e){return null!=t?t:e}const F=t=>t.x||0,Q=t=>t.y||0,Z=t=>!(!1===t.defined),$=r.arc().startAngle(t=>t.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),K=r.area().x(F).y1(Q).y0(t=>(t.y||0)+(t.height||0)).defined(Z),tt=r.area().y(Q).x1(F).x0(t=>(t.x||0)+(t.width||0)).defined(Z),et=r.line().x(F).y(Q).defined(Z),nt=j().x(F).y(Q).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>Y(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>Y(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>Y(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>Y(t.cornerRadiusBottomLeft,t.cornerRadius)||0),it=r.symbol().type(t=>D(t.shape||"circle")).size(t=>Y(t.size,64)),rt=J().x(F).y(Q).defined(Z).size(t=>t.size||1);function ot(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function st(t,e,n,i){return nt.context(t)(e,n,i)}function at(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const i=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(i+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,i):0))}return t}var ut,lt=M-1e-8;function ht(t){return ut=t,ht}function ct(){}function ft(t,e){ut.add(t,e)}ht.beginPath=ct,ht.closePath=ct,ht.moveTo=ft,ht.lineTo=ft,ht.rect=function(t,e,n,i){ft(t,e),ft(t+n,e+i)},ht.quadraticCurveTo=function(t,e,n,i){ft(t,e),ft(n,i)},ht.bezierCurveTo=function(t,e,n,i,r,o){ft(t,e),ft(n,i),ft(r,o)},ht.arc=function(t,e,n,i,r,o){if(Math.abs(r-i)>lt)return ft(t-n,e-n),void ft(t+n,e+n);var s,a,u,l,h=1/0,c=-1/0,f=1/0,d=-1/0;function v(t){u=n*Math.cos(t),l=n*Math.sin(t),u<h&&(h=u),u>c&&(c=u),l<f&&(f=l),l>d&&(d=l)}if(v(i),v(r),r!==i)if((i%=M)<0&&(i+=M),(r%=M)<0&&(r+=M),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=M,s=i-i%A,a=0;a<4&&s>r;++a,s-=A)v(s);else for(s=i-i%A+A,a=0;a<4&&s<r;++a,s+=A)v(s);ft(t+h,e+f),ft(t+c,e+d)};var dt=(dt=n.canvas(1,1))?dt.getContext("2d"):null;const vt=new s;function gt(t){return function(e,n){if(!dt)return!0;t(dt,e),vt.clear().union(e.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:s}=vt;for(let t=r;t<=s;++t)for(let e=i;e<=o;++e)if(dt.isPointInPath(e,t))return!0;return!1}}function pt(t,e){return e.contains(t.x||0,t.y||0)}function yt(t,e){const n=t.x||0,i=t.y||0,r=t.width||0,o=t.height||0;return e.intersects(vt.set(n,i,n+r,i+o))}function mt(t,e){const n=t.x||0,i=t.y||0;return _t(e,n,i,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i)}function _t(t,e,n,i,r){const{x1:o,y1:s,x2:a,y2:u}=t,l=i-e,h=r-n;let c,f,d,v,g=0,p=1;for(v=0;v<4;++v){if(0===v&&(c=-l,f=-(o-e)),1===v&&(c=l,f=a-e),2===v&&(c=-h,f=-(s-n)),3===v&&(c=h,f=u-n),Math.abs(c)<1e-10&&f<0)return!1;if(d=f/c,c<0){if(d>p)return!1;d>g&&(g=d)}else if(c>0){if(d<g)return!1;d<p&&(p=d)}}return!0}function xt(t,e){return null==t?e:t}function bt(t,e,n){return h(n)?function(t,e,n){const i=n.width(),r=n.height(),o=e.stops,s=o.length,a="radial"===e.gradient?t.createRadialGradient(n.x1+xt(e.x1,.5)*i,n.y1+xt(e.y1,.5)*r,Math.max(i,r)*xt(e.r1,0),n.x1+xt(e.x2,.5)*i,n.y1+xt(e.y2,.5)*r,Math.max(i,r)*xt(e.r2,.5)):t.createLinearGradient(n.x1+xt(e.x1,0)*i,n.y1+xt(e.y1,0)*r,n.x1+xt(e.x2,1)*i,n.y1+xt(e.y2,0)*r);for(let t=0;t<s;++t)a.addColorStop(o[t].offset,o[t].color);return a}(t,n,e.bounds):n}function kt(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=bt(t,e,e.fill),!0)}var wt=[];function Tt(t,e,n){var i=null!=(i=e.strokeWidth)?i:1;return!(i<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=bt(t,e,e.stroke),t.lineWidth=i,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||wt),t.lineDashOffset=e.strokeDashOffset||0),!0))}function At(t,e){return t.zindex-e.zindex||t.index-e.index}function Mt(t){if(!t.zdirty)return t.zitems;var e,n,i,r=t.items,o=[];for(n=0,i=r.length;n<i;++n)(e=r[n]).index=n,e.zindex&&o.push(e);return t.zdirty=!1,t.zitems=o.sort(At)}function zt(t,e){var n,i,r=t.items;if(r&&r.length){var o=Mt(t);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||e(r[n]);r=o}for(n=0,i=r.length;n<i;++n)e(r[n])}}function Ct(t,e){var n,i,r=t.items;if(!r||!r.length)return null;var o=Mt(t);for(o&&o.length&&(r=o),i=r.length;--i>=0;)if(n=e(r[i]))return n;if(r===o)for(i=(r=t.items).length;--i>=0;)if(!r[i].zindex&&(n=e(r[i])))return n;return null}function Rt(t){return function(e,n,i){zt(n,(function(n){i&&!i.intersects(n.bounds)||Lt(t,e,n,n)}))}}function Pt(t){return function(e,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Lt(t,e,n.items[0],n.items)}}function Lt(t,e,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(t(e,i)||(n.fill&&kt(e,n,r)&&e.fill(),n.stroke&&Tt(e,n,r)&&e.stroke()))}function St(t){return t=t||e.truthy,function(e,n,i,r,o,s){return i*=e.pixelRatio,r*=e.pixelRatio,Ct(n,(function(n){var a=n.bounds;if((!a||a.contains(o,s))&&a)return t(e,n,i,r,o,s)?n:void 0}))}}function Nt(t,e){return function(n,i,r,o){var s,a,u=Array.isArray(i)?i[0]:i,l=null==e?u.fill:e,h=u.stroke&&n.isPointInStroke;return h&&(s=u.strokeWidth,a=u.strokeCap,n.lineWidth=null!=s?s:1,n.lineCap=null!=a?a:"butt"),!t(n,i)&&(l&&n.isPointInPath(r,o)||h&&n.isPointInStroke(r,o))}}function qt(t){return St(Nt(t))}function Ot(t,e){return"translate("+t+","+e+")"}function Et(t){return"rotate("+t+")"}function Dt(t){return Ot(t.x||0,t.y||0)}function It(t){return Ot(t.x||0,t.y||0)+(t.angle?" "+Et(t.angle):"")+(t.scaleX||t.scaleY?" "+(e=t.scaleX||1,n=t.scaleY||1,"scale("+e+","+n+")"):"");var e,n}function Bt(t,e,n){function i(t,n){var i=n.x||0,r=n.y||0,o=n.angle||0;t.translate(i,r),o&&t.rotate(o*=T),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-i,-r)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",It(n)),t("d",e(null,n))},bound:function(t,n){var i=n.x||0,r=n.y||0;return e(ht(t),n),at(t,n).translate(i,r),n.angle&&t.rotate(n.angle*T,i,r),t},draw:Rt(i),pick:qt(i),isect:n||gt(i)}}var Vt=Bt("arc",(function(t,e){return $.context(t)(e)}));function Ht(t,e,n){function i(t,n){t.beginPath(),e(t,n)}var r=Nt(i);return{type:t,tag:"path",nested:!0,attr:function(t,n){var i=n.mark.items;i.length&&t("d",e(null,i))},bound:function(t,n){var i=n.items;return 0===i.length?t:(e(ht(t),i),at(t,i[0]))},draw:Pt(i),pick:function(t,e,n,i,o,s){var a=e.items,u=e.bounds;return!a||!a.length||u&&!u.contains(o,s)?null:(n*=t.pixelRatio,i*=t.pixelRatio,r(t,a,n,i)?a[0]:null)},isect:pt,tip:n}}var Gt=Ht("area",(function(t,e){var n=e[0],i=n.interpolate||"linear";return("horizontal"===n.orient?tt:K).curve(x(i,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,i,r="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",s=t.length,a=1/0;--s>=0;)!1!==t[s].defined&&(i=Math.abs(t[s][o]-r))<a&&(a=i,n=t[s]);return n}));function Wt(t,e){t.beginPath(),ot(e)?st(t,e,0,0):t.rect(0,0,e.width||0,e.height||0),t.clip()}var Ut=1;function Xt(t,n,i){var r=n.clip,o=t._defs,s=n.clip_id||(n.clip_id="clip"+Ut++),a=o.clipping[s]||(o.clipping[s]={id:s});return e.isFunction(r)?a.path=r(null):ot(i)?a.path=st(null,i,0,0):(a.width=i.width||0,a.height=i.height||0),"url(#"+s+")"}var jt=.5;function Jt(t,e){var n=e.stroke?jt:0;t.beginPath(),st(t,e,n,n)}var Yt=Nt(Jt);var Ft={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Dt(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,i=0,r=n.length;i<r;++i)t.union(n[i].bounds);return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),at(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var i=this;zt(e,(function(e){var r,o=e.x||0,s=e.y||0;t.save(),t.translate(o,s),(e.stroke||e.fill)&&(r=null==e.opacity?1:e.opacity)>0&&(Jt(t,e),e.fill&&kt(t,e,r)&&t.fill(),e.stroke&&Tt(t,e,r)&&t.stroke()),e.clip&&Wt(t,e),n&&n.translate(-o,-s),zt(e,(function(e){i.draw(t,e,n)})),n&&n.translate(o,s),t.restore()}))},pick:function(t,e,n,i,r,o){if(e.bounds&&!e.bounds.contains(r,o)||!e.items)return null;var s=this,a=n*t.pixelRatio,u=i*t.pixelRatio;return Ct(e,(function(l){var h,c,f,d,v,g,p;if((!(g=l.bounds)||g.contains(r,o))&&(c=l.x||0,f=l.y||0,d=c+(l.width||0),v=f+(l.height||0),!(p=l.clip)||!(r<c||r>d||o<c||o>v))){if(t.save(),t.translate(c,f),c=r-c,f=o-f,!p||!ot(l)||Yt(t,l,a,u))return!(h=Ct(l,(function(t){return function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?s.pick(t,n,i,c,f):null})))&&!1!==e.interactive&&(l.fill||l.stroke)&&Yt(t,l,a,u)&&(h=l),t.restore(),h||null;t.restore()}}))},isect:yt,background:function(t,e){var n=e.stroke?jt:0;t("class","background"),t("d",st(null,e,n,n))},foreground:function(t,e,n){t("clip-path",e.clip?Xt(n,e,e):null)}};function Qt(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then(e=>{t.image=e,t.image.url=t.url})),n}function Zt(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function $t(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function Kt(t,e){return"center"===t?e/2:"right"===t?e:0}function te(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var ee={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var i=Qt(e,n),r=e.x||0,o=e.y||0,s=Zt(e,i),a=$t(e,i),u=!1===e.aspect?"none":"xMidYMid";r-=Kt(e.align,s),o-=te(e.baseline,a),!i.src&&i.toDataURL?t("href",i.toDataURL(),"http://www.w3.org/1999/xlink","xlink:href"):t("href",i.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Ot(r,o)),t("width",s),t("height",a),t("preserveAspectRatio",u)},bound:function(t,e){var n=e.image,i=e.x||0,r=e.y||0,o=Zt(e,n),s=$t(e,n);return i-=Kt(e.align,o),r-=te(e.baseline,s),t.set(i,r,i+o,r+s)},draw:function(t,e,n){var i=this;zt(e,(function(e){if(!n||n.intersects(e.bounds)){var r,o,s,a,u=Qt(e,i),l=e.x||0,h=e.y||0,c=Zt(e,u),f=$t(e,u);l-=Kt(e.align,c),h-=te(e.baseline,f),!1!==e.aspect&&(o=u.width/u.height,s=e.width/e.height,o==o&&s==s&&o!==s&&(s<o?(h+=(f-(a=c/o))/2,f=a):(l+=(c-(a=f*o))/2,c=a))),(u.complete||u.toDataURL)&&(t.globalAlpha=null!=(r=e.opacity)?r:1,t.imageSmoothingEnabled=!1!==e.smooth,t.drawImage(u,l,h,c,f))}}))},pick:St(),isect:e.truthy,get:Qt,xOffset:Kt,yOffset:te},ne=Ht("line",(function(t,e){var n=e[0],i=n.interpolate||"linear";return et.curve(x(i,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,i,r=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(i=t[o].y-e[1])*i<r)return t[o];return null}));function ie(t,e){var n=e.path;if(null==n)return!0;var i=e.x||0,r=e.y||0,o=e.scaleX||1,s=e.scaleY||1,a=(e.angle||0)*T,u=e.pathCache;u&&u.path===n||((e.pathCache=u=w(n)).path=n),a&&t.rotate&&t.translate?(t.translate(i,r),t.rotate(a),q(t,u,0,0,o,s),t.rotate(-a),t.translate(-i,-r)):q(t,u,i,r,o,s)}var re={type:"path",tag:"path",nested:!1,attr:function(t,e){var n=e.scaleX||1,i=e.scaleY||1;1===n&&1===i||t("vector-effect","non-scaling-stroke"),t("transform",It(e)),t("d",e.path)},bound:function(t,e){return ie(ht(t),e)?t.set(0,0,0,0):at(t,e,!0),e.angle&&t.rotate(e.angle*T,e.x||0,e.y||0),t},draw:Rt(ie),pick:qt(ie),isect:gt(ie)};function oe(t,e){t.beginPath(),st(t,e)}var se={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",st(null,e))},bound:function(t,e){var n,i;return at(t.set(n=e.x||0,i=e.y||0,n+e.width||0,i+e.height||0),e)},draw:Rt(oe),pick:qt(oe),isect:yt};function ae(t,e,n){var i,r,o,s;return!(!e.stroke||!Tt(t,e,n))&&(i=e.x||0,r=e.y||0,o=null!=e.x2?e.x2:i,s=null!=e.y2?e.y2:r,t.beginPath(),t.moveTo(i,r),t.lineTo(o,s),!0)}var ue,le={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",Dt(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,i;return at(t.set(n=e.x||0,i=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i),e)},draw:function(t,e,n){zt(e,(function(e){if(!n||n.intersects(e.bounds)){var i=null==e.opacity?1:e.opacity;i&&ae(t,e,i)&&t.stroke()}}))},pick:St((function(t,e,n,i){return!!t.isPointInStroke&&(ae(t,e,1)&&t.isPointInStroke(n,i))})),isect:mt},he=Bt("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),ce=Bt("symbol",(function(t,e){return it.context(t)(e)}),pt),fe={height:ye,measureWidth:ge,estimateWidth:de,width:de,canvas:me};function de(t,e){return ue=ye(t),ve(be(t,e))}function ve(t){return~~(.8*t.length*ue)}function ge(t,e){return ye(t)<=0?0:(dt.font=we(t),pe(be(t,e)))}function pe(t){return dt.measureText(t).width}function ye(t){return null!=t.fontSize?t.fontSize:11}function me(t){fe.width=t&&dt?ge:de}function _e(t){return null!=t.lineHeight?t.lineHeight:ye(t)+2}function xe(t){return n=t.lineBreak&&t.text&&!e.isArray(t.text)?t.text.split(t.lineBreak):t.text,e.isArray(n)?n.length>1?n:n[0]:n;var n}function be(t,e){return null==e?"":t.limit>0?function(t,e){var n,i=+t.limit,r=e+"";fe.width===ge?(dt.font=we(t),n=pe):(ue=ye(t),n=ve);if(n(r)<i)return r;var o,s=t.ellipsis||"…",a="rtl"===t.dir,u=0,l=r.length;if(i-=n(s),a){for(;u<l;)o=u+l>>>1,n(r.slice(o))>i?u=o+1:l=o;return s+r.slice(u)}for(;u<l;)o=1+(u+l>>>1),n(r.slice(0,o))<i?u=o:l=o-1;return r.slice(0,u)+s}(t,e):e+""}function ke(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function we(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+ye(t)+"px "+ke(t,e)}function Te(t){var e=t.baseline,n=ye(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}me(!0);var Ae={left:"start",center:"middle",right:"end"},Me=new s;function ze(t){var e,n=t.x||0,i=t.y||0,r=t.radius||0;return r&&(e=(t.theta||0)-A,n+=r*Math.cos(e),i+=r*Math.sin(e)),Me.x1=n,Me.y1=i,Me}function Ce(t,n,i){var r,o=fe.height(n),s=n.align,a=ze(n),u=a.x1,l=a.y1,h=n.dx||0,c=(n.dy||0)+Te(n)-Math.round(.8*o),f=xe(n);if(e.isArray(f)?(o+=_e(n)*(f.length-1),r=f.reduce((t,e)=>Math.max(t,fe.width(n,e)),0)):r=fe.width(n,f),"center"===s?h-=r/2:"right"===s&&(h-=r),t.set(h+=u,c+=l,h+r,c+o),n.angle&&!i)t.rotate(n.angle*T,u,l);else if(2===i)return t.rotatedPoints(n.angle*T,u,l);return t}var Re={arc:Vt,area:Gt,group:Ft,image:ee,line:ne,path:re,rect:se,rule:le,shape:he,symbol:ce,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,i=e.dx||0,r=(e.dy||0)+Te(e),o=ze(e),s=o.x1,a=o.y1,u=e.angle||0;t("text-anchor",Ae[e.align]||"start"),u?(n=Ot(s,a)+" "+Et(u),(i||r)&&(n+=" "+Ot(i,r))):n=Ot(s+i,a+r),t("transform",n)},bound:Ce,draw:function(t,n,i){zt(n,(function(n){var r,o,s,a,u,l,h,c=null==n.opacity?1:n.opacity;if(!(i&&!i.intersects(n.bounds)||0===c||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=we(n),t.textAlign=n.align||"left",o=(r=ze(n)).x1,s=r.y1,n.angle&&(t.save(),t.translate(o,s),t.rotate(n.angle*T),o=s=0),o+=n.dx||0,s+=(n.dy||0)+Te(n),l=xe(n),e.isArray(l))for(u=_e(n),a=0;a<l.length;++a)h=be(n,l[a]),n.fill&&kt(t,n,c)&&t.fillText(h,o,s),n.stroke&&Tt(t,n,c)&&t.strokeText(h,o,s),s+=u;else h=be(n,l),n.fill&&kt(t,n,c)&&t.fillText(h,o,s),n.stroke&&Tt(t,n,c)&&t.strokeText(h,o,s);n.angle&&t.restore()}}))},pick:St((function(t,e,n,i,r,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var s=ze(e),a=s.x1,u=s.y1,l=Ce(Me,e,1),h=-e.angle*T,c=Math.cos(h),f=Math.sin(h),d=c*r-f*o+(a-c*a+f*u),v=f*r+c*o+(u-f*a-c*u);return l.contains(d,v)})),isect:function(t,e){var n=Ce(Me,t,2);return _t(e,n[0],n[1],n[2],n[3])||_t(e,n[0],n[1],n[4],n[5])||_t(e,n[4],n[5],n[6],n[7])||_t(e,n[2],n[3],n[6],n[7])}},trail:Ht("trail",(function(t,e){return rt.context(t)(e)}),(function(t,e){for(var n,i,r=t.length;--r>=0;)if(!1!==t[r].defined&&(n=t[r].x-e[0])*n+(i=t[r].y-e[1])*i<(n=t[r].size||1)*n)return t[r];return null}))};function Pe(t,e,n){var i=Re[t.mark.marktype],r=e||i.bound;return i.nested&&(t=t.mark),r(t.bounds||(t.bounds=new s),t,n)}var Le={mark:null};function Se(t,e,n){var i,r,o,a,u=Re[t.marktype],l=u.bound,h=t.items,c=h&&h.length;if(u.nested)return c?o=h[0]:(Le.mark=t,o=Le),a=Pe(o,l,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new s,c)for(i=0,r=h.length;i<r;++i)e.union(Pe(h[i],l,n));return t.bounds=e}var Ne=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","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"];function qe(t,e){return JSON.stringify(t,Ne,e)}function Oe(t){return function t(e){var n,i,r,o=e.marktype,s=e.items;if(s)for(i=0,r=s.length;i<r;++i)n=o?"mark":"group",s[i][n]=e,s[i].zindex&&(s[i][n].zdirty=!0),"group"===(o||n)&&t(s[i]);o&&Se(e);return e}("string"==typeof t?JSON.parse(t):t)}function Ee(t){arguments.length?this.root=Oe(t):(this.root=Ie({marktype:"group",name:"root",role:"frame"}),this.root.items=[new v(this.root)])}var De=Ee.prototype;function Ie(t,e){return{bounds:new s,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Be(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function Ve(t,e){e=e.toLowerCase();for(var n=t.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===e)return n[i]}function He(t,e,n,i){var r,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=Be(t.ownerDocument,n,i),t.insertBefore(o,r)),o}function Ge(t,e){for(var n=t.childNodes,i=n.length;i>e;)t.removeChild(n[--i]);return t}function We(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Ue(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Xe(t,e){this._active=null,this._handlers={},this._loader=t||i.loader(),this._tooltip=e||je}function je(t,e,n,i){t.element().setAttribute("title",i||"")}De.toJSON=function(t){return qe(this.root,t||0)},De.mark=function(t,e,n){var i=Ie(t,e=e||this.root.items[0]);return e.items[n]=i,i.zindex&&(i.group.zdirty=!0),i};var Je=Xe.prototype;function Ye(t){this._el=null,this._bgcolor=null,this._loader=new g(t)}Je.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Je.element=function(){return this._el},Je.canvas=function(){return this._el&&this._el.firstChild},Je.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Je.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Je.on=function(){},Je.off=function(){},Je._handlerIndex=function(t,e,n){for(var i=t?t.length:0;--i>=0;)if(t[i].type===e&&(!n||t[i].handler===n))return i;return-1},Je.handlers=function(t){var e,n=this._handlers,i=[];if(t)i.push.apply(i,n[this.eventName(t)]);else for(e in n)i.push.apply(i,n[e]);return i},Je.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Je.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then((function(e){var n=new MouseEvent(t.type,t),i=Be(null,"a");for(var r in e)i.setAttribute(r,e[r]);i.dispatchEvent(n)})).catch((function(){}))},Je.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,i){var r,o,s=t&&t.mark;if(s&&(r=Re[s.marktype]).tip){for((o=Ue(e,n))[0]-=i[0],o[1]-=i[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=r.tip(s.items,o)}return t}(e,t,this.canvas(),this._origin);var i=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,i)}},Je.getItemBoundingClientRect=function(t){if(e=this.canvas()){for(var e,n=e.getBoundingClientRect(),i=this._origin,r=t.bounds,o=r.x1+i[0]+n.left,s=r.y1+i[1]+n.top,a=r.width(),u=r.height();t.mark&&(t=t.mark.group);)o+=t.x||0,s+=t.y||0;return{x:o,y:s,width:a,height:u,left:o,top:s,right:o+a,bottom:s+u}}};var Fe=Ye.prototype;Fe.initialize=function(t,e,n,i,r){return this._el=t,this.resize(e,n,i,r)},Fe.element=function(){return this._el},Fe.canvas=function(){return this._el&&this._el.firstChild},Fe.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},Fe.resize=function(t,e,n,i){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=i||1,this},Fe.dirty=function(){},Fe.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},Fe._render=function(){},Fe.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then((function(){return e})):Promise.resolve(e)},Fe._load=function(t,e){var n=this,i=n._loader[t](e);if(!n._ready){var r=n._call;n._ready=n._loader.ready().then((function(t){t&&r(),n._ready=null}))}return i},Fe.sanitizeURL=function(t){return this._load("sanitizeURL",t)},Fe.loadImage=function(t){return this._load("loadImage",t)};var Qe="mouseout";function Ze(t,e){Xe.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var $e=e.inherits(Ze,Xe);function Ke(t,e,n){return function(i){var r=this._active,o=this.pickEvent(i);o===r?this.fire(t,i):(r&&r.exit||this.fire(n,i),this._active=o,this.fire(e,i),this.fire(t,i))}}function tn(t){return function(e){this.fire(t,e),this._active=null}}$e.initialize=function(t,e,n){var i=this._canvas=t&&Ve(t,"canvas");if(i){var r=this;this.events.forEach((function(t){i.addEventListener(t,(function(e){$e[t]?$e[t].call(r,e):r.fire(t,e)}))}))}return Xe.prototype.initialize.call(this,t,e,n)},$e.canvas=function(){return this._canvas},$e.context=function(){return this._canvas.getContext("2d")},$e.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],$e.DOMMouseScroll=function(t){this.fire("mousewheel",t)},$e.mousemove=Ke("mousemove","mouseover","mouseout"),$e.dragover=Ke("dragover","dragenter","dragleave"),$e.mouseout=tn("mouseout"),$e.dragleave=tn("dragleave"),$e.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},$e.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},$e.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},$e.touchmove=function(t){this.fire("touchmove",t,!0)},$e.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},$e.fire=function(t,e,n){var i,r,o=n?this._touch:this._active,s=this._handlers[t];if(e.vegaType=t,"click"===t&&o&&o.href?this.handleHref(e,o,o.href):"mousemove"!==t&&t!==Qe||this.handleTooltip(e,o,t!==Qe),s)for(i=0,r=s.length;i<r;++i)s[i].handler.call(this._obj,e,o)},$e.on=function(t,e){var n=this.eventName(t),i=this._handlers;return this._handlerIndex(i[n],t,e)<0&&(i[n]||(i[n]=[])).push({type:t,handler:e}),this},$e.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&i.splice(r,1),this},$e.pickEvent=function(t){var e=Ue(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},$e.pick=function(t,e,n,i,r){var o=this.context();return Re[t.marktype].pick.call(this,o,t,e,n,i,r)};var en="undefined"!=typeof window&&window.devicePixelRatio||1;function nn(t){Ye.call(this,t),this._redraw=!1,this._dirty=new s}var rn=e.inherits(nn,Ye),on=Ye.prototype,sn=new s;function an(t,e,n){return sn.set(0,0,e,n).translate(-t[0],-t[1])}function un(t,e){Xe.call(this,t,e);var n=this;n._hrefHandler=hn(n,(function(t,e){e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=hn(n,(function(t,e){n.handleTooltip(t,e,t.type!==Qe)}))}rn.initialize=function(t,e,i,r,o,s){return this._options=s,this._canvas=n.canvas(1,1,s&&s.type),t&&(Ge(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),on.initialize.call(this,t,e,i,r,o)},rn.resize=function(t,e,n,i){return on.resize.call(this,t,e,n,i),function(t,e,n,i,r,o){var s,a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),l=a?en:r;for(s in t.width=e*l,t.height=n*l,o)u[s]=o[s];a&&1!==l&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=l,u.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},rn.canvas=function(){return this._canvas},rn.context=function(){return this._canvas?this._canvas.getContext("2d"):null},rn.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=sn.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},rn._render=function(t){var e=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty;return e.save(),this._redraw||o.empty()?(this._redraw=!1,o=an(n,i,r).expand(1)):o=function(t,e,n){return e.expand(1).round(),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,o.intersect(an(n,i,r)),n),this.clear(-n[0],-n[1],i,r),this.draw(e,t,o),e.restore(),this._dirty.clear(),this},rn.draw=function(t,n,i){var r=Re[n.marktype];n.clip&&function(t,n){var i=n.clip;t.save(),e.isFunction(i)?(t.beginPath(),i(t),t.clip()):Wt(t,n.group)}(t,n),r.draw.call(this,t,n,i),n.clip&&t.restore()},rn.clear=function(t,e,n,i){var r=this.context();r.clearRect(t,e,n,i),null!=this._bgcolor&&(r.fillStyle=this._bgcolor,r.fillRect(t,e,n,i))};var ln=e.inherits(un,Xe);function hn(t,e){return function(n){var i=n.target.__data__;n.vegaType=n.type,i=Array.isArray(i)?i[0]:i,e.call(t._obj,n,i)}}function cn(t,e,n){var i,r,o="<"+t;if(e)for(i in e)null!=(r=e[i])&&(o+=" "+i+'="'+r+'"');return n&&(o+=" "+n),o+">"}function fn(t){return"</"+t+">"}ln.initialize=function(t,e,n){var i=this._svg;return i&&(i.removeEventListener("click",this._hrefHandler),i.removeEventListener("mousemove",this._tooltipHandler),i.removeEventListener(Qe,this._tooltipHandler)),this._svg=i=t&&Ve(t,"svg"),i&&(i.addEventListener("click",this._hrefHandler),i.addEventListener("mousemove",this._tooltipHandler),i.addEventListener(Qe,this._tooltipHandler)),Xe.prototype.initialize.call(this,t,e,n)},ln.canvas=function(){return this._svg},ln.on=function(t,e){var n=this.eventName(t),i=this._handlers;if(this._handlerIndex(i[n],t,e)<0){var r={type:t,handler:e,listener:hn(this,e)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},ln.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this};var dn={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},vn={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"},gn=Object.keys(vn),pn=dn.xmlns;function yn(t){Ye.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var mn=e.inherits(yn,Ye),_n=Ye.prototype;function xn(t,e,n){var i,r,o;if("radial"===e.gradient){var s=He(t,n++,"pattern",pn);s.setAttribute("id",l+e.id),s.setAttribute("viewBox","0,0,1,1"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("preserveAspectRatio","xMidYMid slice"),(s=He(s,0,"rect",pn)).setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","url("+Rn()+"#"+e.id+")"),(t=He(t,n++,"radialGradient",pn)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=He(t,n++,"linearGradient",pn)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(i=0,r=e.stops.length;i<r;++i)(o=He(t,i,"stop",pn)).setAttribute("offset",e.stops[i].offset),o.setAttribute("stop-color",e.stops[i].color);return Ge(t,i),n}function bn(t,e,n){var i;return(t=He(t,n,"clipPath",pn)).setAttribute("id",e.id),e.path?(i=He(t,0,"path",pn)).setAttribute("d",e.path):((i=He(t,0,"rect",pn)).setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",e.width),i.setAttribute("height",e.height)),n+1}function kn(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function wn(t,e,n,i,r){var o,s=t._svg;if(!s&&(s=Be(o=e.ownerDocument,i,pn),t._svg=s,t.mark&&(s.__data__=t,s.__values__={fill:"default"},"g"===i))){var a=Be(o,"path",pn);a.setAttribute("class","background"),s.appendChild(a),a.__data__=t;var u=Be(o,"g",pn);s.appendChild(u),u.__data__=t}return(s.ownerSVGElement!==r||function(t,e){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=e}(s,n))&&e.insertBefore(s,n?n.nextSibling:e.firstChild),s}mn.initialize=function(t,e,n,i){return t&&(this._svg=He(t,0,"svg",pn),this._svg.setAttribute("class","marks"),Ge(t,1),this._root=He(this._svg,0,"g",pn),Ge(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),_n.initialize.call(this,t,e,n,i)},mn.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),_n.background.apply(this,arguments)},mn.resize=function(t,e,n,i){return _n.resize.call(this,t,e,n,i),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},mn.canvas=function(){return this._svg},mn.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in dn)t[e]=dn[e];var n=this._bgcolor?cn("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+fn("rect"):"";return cn("svg",t)+n+this._svg.innerHTML+fn("svg")},mn._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Ge(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},mn.updateDefs=function(){var t,e=this._svg,n=this._defs,i=n.el,r=0;for(t in n.gradient)i||(n.el=i=He(e,0,"defs",pn)),r=xn(i,n.gradient[t],r);for(t in n.clipping)i||(n.el=i=He(e,0,"defs",pn)),r=bn(i,n.clipping[t],r);i&&(0===r?(e.removeChild(i),n.el=null):Ge(i,r))},mn._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},mn.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},mn.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},mn._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var e,n,i,r,o,s,a,u=++this._dirtyID;for(o=0,s=t.length;o<s;++o)(n=(e=t[o]).mark).marktype!==i&&(i=n.marktype,r=Re[i]),n.zdirty&&n.dirty!==u&&(this._dirtyAll=!1,kn(e,u),n.items.forEach((function(t){t.dirty=u}))),n.zdirty||(e.exit?(r.nested&&n.items.length?(a=n.items[0])._svg&&this._update(r,a._svg,a):e._svg&&(a=e._svg.parentNode)&&a.removeChild(e._svg),e._svg=null):(e=r.nested?n.items[0]:e)._update!==u&&(e._svg&&e._svg.ownerSVGElement?this._update(r,e._svg,e):(this._dirtyAll=!1,kn(e,u)),e._update=u));return!this._dirtyAll},mn.draw=function(t,e,n){if(!this.isDirty(e))return e._svg;var i,r=this,o=this._svg,s=Re[e.marktype],a=!1===e.interactive?"none":null,u="g"===s.tag,l=null,h=0;function c(t){var e=r.isDirty(t),n=wn(t,i,l,s.tag,o);e&&(r._update(s,n,t),u&&function(t,e,n){e=e.lastChild;var i,r=0;zt(n,(function(n){i=t.draw(e,n,i),++r})),Ge(e,1+r)}(r,n,t)),l=n,++h}return(i=wn(e,t,n,"g",o)).setAttribute("class",We(e)),u||i.style.setProperty("pointer-events",a),e.clip?i.setAttribute("clip-path",Xt(r,e,e.group)):i.removeAttribute("clip-path"),s.nested?e.items.length&&c(e.items[0]):zt(e,c),Ge(i,h),i};var Tn=null,An=null,Mn={group:function(t,e,n){An=e.__values__,Tn=e.childNodes[1],t.foreground(Cn,n,this),Tn=e.childNodes[0],t.background(Cn,n,this);var i=!1===n.mark.interactive?"none":null;i!==An.events&&(Tn.style.setProperty("pointer-events",i),An.events=i)},image:function(t,e,n){!1===n.smooth?(zn(e,"image-rendering","optimizeSpeed"),zn(e,"image-rendering","pixelated")):zn(e,"image-rendering",null)},text:function(t,n,i){var r,o,s,a,u=xe(i);e.isArray(u)?(r=(o=u.map(t=>be(i,t))).join("\n"))!==An.text&&(Ge(n,0),s=n.ownerDocument,a=_e(i),o.forEach((t,e)=>{const r=Be(s,"tspan",pn);r.__data__=i,r.textContent=t,e&&(r.setAttribute("x",0),r.setAttribute("dy",a)),n.appendChild(r)}),An.text=r):(o=be(i,u))!==An.text&&(n.textContent=o,An.text=o),zn(n,"font-family",ke(i)),zn(n,"font-size",ye(i)+"px"),zn(n,"font-style",i.fontStyle),zn(n,"font-variant",i.fontVariant),zn(n,"font-weight",i.fontWeight)}};function zn(t,e,n){n!==An[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),An[e]=n)}function Cn(t,e,n){e!==An[t]&&(null!=e?n?Tn.setAttributeNS(n,t,e):Tn.setAttribute(t,e):n?Tn.removeAttributeNS(n,t):Tn.removeAttribute(t),An[t]=e)}function Rn(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function Pn(t){Ye.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}mn._update=function(t,e,n){Tn=e,An=e.__values__,t.attr(Cn,n,this);var i=Mn[t.type];i&&i.call(this,t,e,n),this.style(Tn,n)},mn.style=function(t,e){var n,i,r,o,s;if(null!=e)for(n=0,i=gn.length;n<i;++n)s=e[r=gn[n]],"font"===r&&(s=ke(e)),s!==An[r]&&(o=vn[r],null==s?"fill"===o?t.style.setProperty(o,"none"):t.style.removeProperty(o):(h(s)&&(s=c(s,this._defs.gradient,Rn())),t.style.setProperty(o,s+"")),An[r]=s)};var Ln,Sn=e.inherits(Pn,Ye),Nn=Ye.prototype;function qn(t,e,n,i){Ln[i||t]=e}function On(t,e,n,i){if(null==t)return"";var r,o,s,a,u,l="";for("bgrect"===n&&!1===e.interactive&&(l+="pointer-events: none; "),"image"===n&&!1===t.smooth&&(l+="image-rendering: optimizeSpeed; image-rendering: pixelated; "),"text"===n&&(l+="font-family: "+ke(t)+"; ",l+="font-size: "+ye(t)+"px; ",t.fontStyle&&(l+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(l+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(l+="font-weight: "+t.fontWeight+"; ")),r=0,o=gn.length;r<o;++r)s=gn[r],a=vn[s],null==(u=t[s])?"fill"===a&&(l+="fill: none; "):"transparent"!==u||"fill"!==a&&"stroke"!==a?(h(u)&&(u=c(u,i.gradient,"")),l+=a+": "+u+"; "):l+=a+": none; ";return l?'style="'+l.trim()+'"':null}function En(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Sn.resize=function(t,e,n,i){Nn.resize.call(this,t,e,n,i);var r=this._origin,o=this._text,s={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var a in dn)s[a]=dn[a];o.head=cn("svg",s);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),o.bg=u?cn("rect",{width:this._width,height:this._height,style:"fill: "+u+";"})+fn("rect"):"",o.root=cn("g",{transform:"translate("+r+")"}),o.foot=fn("g")+fn("svg"),this},Sn.background=function(){var t=Nn.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},Sn.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},Sn._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},Sn.buildDefs=function(){var t,e,n,i,r,o=this._defs,s="";for(e in o.gradient){for(r=(n=o.gradient[e]).stops,"radial"===n.gradient?(s+=cn(i="pattern",{id:l+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),s+=cn("rect",{width:"1",height:"1",fill:"url(#"+e+")"})+fn("rect"),s+=fn(i),s+=cn(i="radialGradient",{id:e,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):s+=cn(i="linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<r.length;++t)s+=cn("stop",{offset:r[t].offset,"stop-color":r[t].color})+fn("stop");s+=fn(i)}for(e in o.clipping)n=o.clipping[e],s+=cn("clipPath",{id:e}),n.path?s+=cn("path",{d:n.path})+fn("path"):s+=cn("rect",{x:0,y:0,width:n.width,height:n.height})+fn("rect"),s+=fn("clipPath");return s.length>0?cn("defs")+s+fn("defs"):""},Sn.attributes=function(t,e){return Ln={},t(qn,e,this),Ln},Sn.href=function(t){var e,n=this,i=t.href;if(i){if(e=n._hrefs&&n._hrefs[i])return e;n.sanitizeURL(i).then((function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[i]=t}))}return null},Sn.mark=function(t){var n,i=this,r=Re[t.marktype],o=r.tag,s=this._defs,a="";function u(u){var l=i.href(u);if(l&&(a+=cn("a",l)),n="g"!==o?On(u,t,o,s):null,a+=cn(o,i.attributes(r.attr,u),n),"text"===o){const t=xe(u);if(e.isArray(t)){const e={x:0,dy:_e(u)};for(let n=0;n<t.length;++n)a+=cn("tspan",n?e:null)+En(be(u,t[n]))+fn("tspan")}else a+=En(be(u,t))}else"g"===o&&(a+=cn("path",i.attributes(r.background,u),On(u,t,"bgrect",s))+fn("path"),a+=cn("g",i.attributes(r.foreground,u))+i.markGroup(u)+fn("g"));a+=fn(o),l&&(a+=fn("a"))}return"g"!==o&&!1===t.interactive&&(n='style="pointer-events: none;"'),a+=cn("g",{class:We(t),"clip-path":t.clip?Xt(i,t,t.group):null},n),r.nested?t.items&&t.items.length&&u(t.items[0]):zt(t,u),a+fn("g")},Sn.markGroup=function(t){var e=this,n="";return zt(t,(function(t){n+=e.mark(t)})),n};var Dn={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},In={};function Bn(t,e,n,i){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const r=t.items,o=t.marktype,s=r.length;let a=0;if("group"===o)for(;a<s;++a)Vn(r[a],e,n,i);else for(const t=Re[o].isect;a<s;++a){let n=r[a];Hn(n,e,t)&&i.push(n)}}return i}function Vn(t,e,n,i){n&&n(t.mark)&&Hn(t,e,Re.group.isect)&&i.push(t);const r=t.items,o=r&&r.length;if(o){const s=t.x||0,a=t.y||0;e.translate(-s,-a);for(let t=0;t<o;++t)Bn(r[t],e,n,i);e.translate(s,a)}return i}function Hn(t,e,n){const i=t.bounds;return e.encloses(i)||e.intersects(i)&&n(t,e)}In.canvas=In.png={renderer:nn,headless:nn,handler:Ze},In.svg={renderer:yn,headless:Pn,handler:un},In.none={};var Gn=new s;var Wn=1e-9;function Un(t,n,i){return t===n||("path"===i?Xn(t,n):t instanceof Date&&n instanceof Date?+t==+n:e.isNumber(t)&&e.isNumber(n)?Math.abs(t-n)<=Wn:t&&n&&(e.isObject(t)||e.isObject(n))?null!=t&&null!=n&&function(t,e){var n,i,r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(n=r[i],!Un(t[n],e[n],n))return!1;return typeof t==typeof e}(t,n):t==n)}function Xn(t,e){return Un(w(t),w(e))}t.Bounds=s,t.CanvasHandler=Ze,t.CanvasRenderer=nn,t.Gradient=function(t,e){var n,i=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:i,stop:function(t,e){return i.push({offset:t,color:e}),n}}},t.GroupItem=v,t.Handler=Xe,t.Item=d,t.Marks=Re,t.RenderType=Dn,t.Renderer=Ye,t.ResourceLoader=g,t.SVGHandler=un,t.SVGRenderer=yn,t.SVGStringRenderer=Pn,t.Scenegraph=Ee,t.boundClip=function(t){var n=t.clip;if(e.isFunction(n))n(ht(Gn.clear()));else{if(!n)return;Gn.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Gn)},t.boundContext=ht,t.boundItem=Pe,t.boundMark=Se,t.boundStroke=at,t.closeTag=fn,t.domChild=He,t.domClear=Ge,t.domCreate=Be,t.domFind=Ve,t.font=we,t.fontFamily=ke,t.fontSize=ye,t.intersect=function(t,n,i){const r=[],o=(new s).union(n),a=t.marktype;return a?Bn(t,o,i,r):"group"===a?Vn(t,o,i,r):e.error("Intersect scene must be mark node or group item.")},t.intersectBoxLine=_t,t.intersectPath=gt,t.intersectPoint=pt,t.intersectRule=mt,t.lineHeight=_e,t.multiLineOffset=function(t){const n=xe(t);return(e.isArray(n)?n.length-1:0)*_e(t)},t.openTag=cn,t.pathCurves=x,t.pathEqual=Xn,t.pathParse=w,t.pathRectangle=j,t.pathRender=q,t.pathSymbols=D,t.pathTrail=J,t.point=Ue,t.renderModule=function(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(In[t]=e,this):In[t]},t.resetSVGClipId=function(){Ut=1},t.sceneEqual=Un,t.sceneFromJSON=Oe,t.scenePickVisit=Ct,t.sceneToJSON=qe,t.sceneVisit=zt,t.sceneZOrder=Mt,t.textMetrics=fe,Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-canvas"),require("vega-loader"),require("d3-shape"),require("d3-path")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-canvas","vega-loader","d3-shape","d3-path"],e):e((t=t||self).vega={},t.vega,t.vega,t.vega,t.d3,t.d3)}(this,(function(t,e,n,i,r,o){"use strict";function s(t){this.clear(),t&&this.union(t)}var a=s.prototype;a.clone=function(){return new s(this)},a.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},a.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},a.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},a.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},a.add=function(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},a.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},a.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},a.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},a.rotate=function(t,e,n){const i=this.rotatedPoints(t,e,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},a.rotatedPoints=function(t,e,n){var{x1:i,y1:r,x2:o,y2:s}=this,a=Math.cos(t),u=Math.sin(t),l=e-e*a+n*u,h=n-e*u-n*a;return[a*i-u*r+l,u*i+a*r+h,a*i-u*s+l,u*i+a*s+h,a*o-u*r+l,u*o+a*r+h,a*o-u*s+l,u*o+a*s+h]},a.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},a.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},a.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},a.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},a.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},a.contains=function(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},a.width=function(){return this.x2-this.x1},a.height=function(){return this.y2-this.y1};var u=0;const l="p_";function h(t){return t&&t.gradient}function c(t,e,n){let i=t.id,r=t.gradient,o="radial"===r?l:"";return i||(i=t.id="gradient_"+u++,"radial"===r?(t.x1=f(t.x1,.5),t.y1=f(t.y1,.5),t.r1=f(t.r1,0),t.x2=f(t.x2,.5),t.y2=f(t.y2,.5),t.r2=f(t.r2,.5),o=l):(t.x1=f(t.x1,0),t.y1=f(t.y1,0),t.x2=f(t.x2,1),t.y2=f(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function f(t,e){return null!=t?t:e}function d(t){this.mark=t,this.bounds=this.bounds||new s}function v(t){d.call(this,t),this.items=this.items||[]}function g(t){this._pending=0,this._loader=t||i.loader()}e.inherits(v,d);var p=g.prototype;function y(t){t._pending+=1}function m(t){t._pending-=1}p.pending=function(){return this._pending},p.sanitizeURL=function(t){var e=this;return y(e),e._loader.sanitize(t,{context:"href"}).then((function(t){return m(e),t})).catch((function(){return m(e),null}))},p.loadImage=function(t){var e=this,i=n.image();return y(e),e._loader.sanitize(t,{context:"image"}).then((function(t){var n=t.href;if(!n||!i)throw{url:n};var r=new i;return r.onload=function(){m(e)},r.onerror=function(){m(e)},r.src=n,r})).catch((function(t){return m(e),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},p.ready=function(){var t=this;return new Promise((function(e){!function n(i){t.pending()?setTimeout((function(){n(!0)}),10):e(i)}(!1)}))};var _={basis:{curve:r.curveBasis},"basis-closed":{curve:r.curveBasisClosed},"basis-open":{curve:r.curveBasisOpen},bundle:{curve:r.curveBundle,tension:"beta",value:.85},cardinal:{curve:r.curveCardinal,tension:"tension",value:0},"cardinal-open":{curve:r.curveCardinalOpen,tension:"tension",value:0},"cardinal-closed":{curve:r.curveCardinalClosed,tension:"tension",value:0},"catmull-rom":{curve:r.curveCatmullRom,tension:"alpha",value:.5},"catmull-rom-closed":{curve:r.curveCatmullRomClosed,tension:"alpha",value:.5},"catmull-rom-open":{curve:r.curveCatmullRomOpen,tension:"alpha",value:.5},linear:{curve:r.curveLinear},"linear-closed":{curve:r.curveLinearClosed},monotone:{horizontal:r.curveMonotoneY,vertical:r.curveMonotoneX},natural:{curve:r.curveNatural},step:{curve:r.curveStep},"step-after":{curve:r.curveStepAfter},"step-before":{curve:r.curveStepBefore}};function x(t,n,i){var r=e.hasOwnProperty(_,t)&&_[t],o=null;return r&&(o=r.curve||r[n||"vertical"],r.tension&&null!=i&&(o=o[r.tension](i))),o}var b={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},k=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function w(t){var e,n,i,r,o,s,a,u,l,h,c,f=[];for(u=0,h=(e=t.slice().replace(k[0],"###$1").split(k[1]).slice(1)).length;u<h;++u){for(i=(n=e[u]).slice(1).trim().replace(k[2],"$1###$2").split(k[3]),r=[s=n.charAt(0)],l=0,c=i.length;l<c;++l)(o=+i[l])===o&&r.push(o);if(a=b[s.toLowerCase()],r.length-1>a)for(l=1,c=r.length;l<c;l+=a)f.push([s].concat(r.slice(l,l+a)));else f.push(r)}return f}const T=Math.PI/180,A=1e-14,M=Math.PI/2,z=2*Math.PI,C=Math.sqrt(3)/2;var R={},P={},L=[].join;function S(t){var e=L.call(t);if(P[e])return P[e];var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],a=t[5],u=t[6],l=t[7],h=l*s,c=-u*a,f=u*s,d=l*a,v=Math.cos(r),g=Math.sin(r),p=Math.cos(o),y=Math.sin(o),m=.5*(o-r),_=Math.sin(.5*m),x=8/3*_*_/Math.sin(m),b=n+v-x*g,k=i+g+x*v,w=n+p,T=i+y,A=w+x*y,M=T-x*p;return P[e]=[h*b+c*k,f*b+d*k,h*A+c*M,f*A+d*M,h*w+c*T,f*w+d*T]}var N=["l",0,0,0,0,0,0,0];function O(t,e,n){var i=N[0]=t[0];if("a"===i||"A"===i)N[1]=e*t[1],N[2]=n*t[2],N[3]=t[3],N[4]=t[4],N[5]=t[5],N[6]=e*t[6],N[7]=n*t[7];else if("h"===i||"H"===i)N[1]=e*t[1];else if("v"===i||"V"===i)N[1]=n*t[1];else for(var r=1,o=t.length;r<o;++r)N[r]=(r%2==1?e:n)*t[r];return N}function q(t,e,n,i,r,o){var s,a,u,l,h,c=null,f=0,d=0,v=0,g=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),null==o&&(o=r),t.beginPath&&t.beginPath();for(var p=0,y=e.length;p<y;++p){switch(s=e[p],1===r&&1===o||(s=O(s,r,o)),s[0]){case"l":f+=s[1],d+=s[2],t.lineTo(f+n,d+i);break;case"L":f=s[1],d=s[2],t.lineTo(f+n,d+i);break;case"h":f+=s[1],t.lineTo(f+n,d+i);break;case"H":f=s[1],t.lineTo(f+n,d+i);break;case"v":d+=s[1],t.lineTo(f+n,d+i);break;case"V":d=s[1],t.lineTo(f+n,d+i);break;case"m":f+=s[1],d+=s[2],t.moveTo(f+n,d+i);break;case"M":f=s[1],d=s[2],t.moveTo(f+n,d+i);break;case"c":a=f+s[5],u=d+s[6],v=f+s[3],g=d+s[4],t.bezierCurveTo(f+s[1]+n,d+s[2]+i,v+n,g+i,a+n,u+i),f=a,d=u;break;case"C":f=s[5],d=s[6],v=s[3],g=s[4],t.bezierCurveTo(s[1]+n,s[2]+i,v+n,g+i,f+n,d+i);break;case"s":a=f+s[3],u=d+s[4],v=2*f-v,g=2*d-g,t.bezierCurveTo(v+n,g+i,f+s[1]+n,d+s[2]+i,a+n,u+i),v=f+s[1],g=d+s[2],f=a,d=u;break;case"S":a=s[3],u=s[4],v=2*f-v,g=2*d-g,t.bezierCurveTo(v+n,g+i,s[1]+n,s[2]+i,a+n,u+i),f=a,d=u,v=s[1],g=s[2];break;case"q":a=f+s[3],u=d+s[4],v=f+s[1],g=d+s[2],t.quadraticCurveTo(v+n,g+i,a+n,u+i),f=a,d=u;break;case"Q":a=s[3],u=s[4],t.quadraticCurveTo(s[1]+n,s[2]+i,a+n,u+i),f=a,d=u,v=s[1],g=s[2];break;case"t":a=f+s[1],u=d+s[2],null===c[0].match(/[QqTt]/)?(v=f,g=d):"t"===c[0]?(v=2*f-l,g=2*d-h):"q"===c[0]&&(v=2*f-v,g=2*d-g),l=v,h=g,t.quadraticCurveTo(v+n,g+i,a+n,u+i),d=u,v=(f=a)+s[1],g=d+s[2];break;case"T":a=s[1],u=s[2],v=2*f-v,g=2*d-g,t.quadraticCurveTo(v+n,g+i,a+n,u+i),f=a,d=u;break;case"a":E(t,f+n,d+i,[s[1],s[2],s[3],s[4],s[5],s[6]+f+n,s[7]+d+i]),f+=s[6],d+=s[7];break;case"A":E(t,f+n,d+i,[s[1],s[2],s[3],s[4],s[5],s[6]+n,s[7]+i]),f=s[6],d=s[7];break;case"z":case"Z":t.closePath()}c=s}}function E(t,e,n,i){for(var r=function(t,e,n,i,r,o,s,a,u){var l=L.call(arguments);if(R[l])return R[l];var h=s*T,c=Math.sin(h),f=Math.cos(h),d=f*(a-t)*.5+c*(u-e)*.5,v=f*(u-e)*.5-c*(a-t)*.5,g=d*d/((n=Math.abs(n))*n)+v*v/((i=Math.abs(i))*i);g>1&&(n*=g=Math.sqrt(g),i*=g);var p=f/n,y=c/n,m=-c/i,_=f/i,x=p*a+y*u,b=m*a+_*u,k=p*t+y*e,w=m*t+_*e,A=1/((k-x)*(k-x)+(w-b)*(w-b))-.25;A<0&&(A=0);var C=Math.sqrt(A);o==r&&(C=-C);var P=.5*(x+k)-C*(w-b),S=.5*(b+w)+C*(k-x),N=Math.atan2(b-S,x-P),O=Math.atan2(w-S,k-P)-N;O<0&&1===o?O+=z:O>0&&0===o&&(O-=z);for(var q=Math.ceil(Math.abs(O/(M+.001))),E=[],D=0;D<q;++D){var I=N+D*O/q,B=N+(D+1)*O/q;E[D]=[P,S,I,B,n,i,c,f]}return R[l]=E}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,n),o=0;o<r.length;++o){var s=S(r[o]);t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}var D={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,z)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/2.5;t.moveTo(-n,-i),t.lineTo(-n,i),t.lineTo(-i,i),t.lineTo(-i,n),t.lineTo(i,n),t.lineTo(i,i),t.lineTo(n,i),t.lineTo(n,-i),t.lineTo(i,-i),t.lineTo(i,-n),t.lineTo(-i,-n),t.lineTo(-i,-i),t.closePath()}},diamond:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),i=-n/2;t.rect(i,i,n,n)}},arrow:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/7,r=n/2.5,o=n/8;t.moveTo(-i,n),t.lineTo(i,n),t.lineTo(i,-o),t.lineTo(r,-o),t.lineTo(0,-n),t.lineTo(-r,-o),t.lineTo(-i,-o),t.closePath()}},wedge:{draw:function(t,e){var n=Math.sqrt(e)/2,i=C*n,r=i-.5773502691896257*n,o=n/4;t.moveTo(0,-i-r),t.lineTo(-o,i-r),t.lineTo(o,i-r),t.closePath()}},triangle:{draw:function(t,e){var n=Math.sqrt(e)/2,i=C*n,r=i-.5773502691896257*n;t.moveTo(0,-i-r),t.lineTo(-n,i-r),t.lineTo(n,i-r),t.closePath()}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,i=C*n;t.moveTo(0,-i),t.lineTo(-n,i),t.lineTo(n,i),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,i=C*n;t.moveTo(0,i),t.lineTo(-n,-i),t.lineTo(n,-i),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,i=C*n;t.moveTo(i,0),t.lineTo(-i,-n),t.lineTo(-i,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,i=C*n;t.moveTo(-i,0),t.lineTo(i,-n),t.lineTo(i,n),t.closePath()}},stroke:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(n,0)}}};function I(t){return e.hasOwnProperty(D,t)?D[t]:function(t){if(!e.hasOwnProperty(B,t)){var n=w(t);B[t]={draw:function(t,e){q(t,n,0,0,Math.sqrt(e)/2)}}}return B[t]}(t)}var B={};const V=.448084975506;function H(t){return t.x}function W(t){return t.y}function G(t){return t.width}function U(t){return t.height}function X(t){return"function"==typeof t?t:()=>+t}function j(t,e,n){return Math.max(e,Math.min(t,n))}function F(){var t=H,e=W,n=G,i=U,r=X(0),s=r,a=r,u=r,l=null;function h(h,c,f){var d,v=null!=c?c:+t.call(this,h),g=null!=f?f:+e.call(this,h),p=+n.call(this,h),y=+i.call(this,h),m=Math.min(p,y)/2,_=j(+r.call(this,h),0,m),x=j(+s.call(this,h),0,m),b=j(+a.call(this,h),0,m),k=j(+u.call(this,h),0,m);if(l||(l=d=o.path()),_<=0&&x<=0&&b<=0&&k<=0)l.rect(v,g,p,y);else{var w=v+p,T=g+y;l.moveTo(v+_,g),l.lineTo(w-x,g),l.bezierCurveTo(w-V*x,g,w,g+V*x,w,g+x),l.lineTo(w,T-k),l.bezierCurveTo(w,T-V*k,w-V*k,T,w-k,T),l.lineTo(v+b,T),l.bezierCurveTo(v+V*b,T,v,T-V*b,v,T-b),l.lineTo(v,g+_),l.bezierCurveTo(v,g+V*_,v+V*_,g,v+_,g),l.closePath()}if(d)return l=null,d+""||null}return h.x=function(e){return arguments.length?(t=X(e),h):t},h.y=function(t){return arguments.length?(e=X(t),h):e},h.width=function(t){return arguments.length?(n=X(t),h):n},h.height=function(t){return arguments.length?(i=X(t),h):i},h.cornerRadius=function(t,e,n,i){return arguments.length?(r=X(t),s=null!=e?X(e):r,u=null!=n?X(n):r,a=null!=i?X(i):s,h):r},h.context=function(t){return arguments.length?(l=null==t?null:t,h):l},h}function J(){var t,e,n,i,r,s,a,u,l=null;function h(t,e,n){var i=n/2;if(r){var o=a-e,h=t-s;if(o||h){var c=Math.sqrt(o*o+h*h),f=(o/=c)*u,d=(h/=c)*u,v=Math.atan2(h,o);l.moveTo(s-f,a-d),l.lineTo(t-o*i,e-h*i),l.arc(t,e,i,v-Math.PI,v),l.lineTo(s+f,a+d),l.arc(s,a,u,v,v+Math.PI)}else l.arc(t,e,i,0,z);l.closePath()}else r=1;s=t,a=e,u=i}function c(s){var a,u,c,f=s.length,d=!1;for(null==l&&(l=c=o.path()),a=0;a<=f;++a)!(a<f&&i(u=s[a],a,s))===d&&(d=!d)&&(r=0),d&&h(+t(u,a,s),+e(u,a,s),+n(u,a,s));if(c)return l=null,c+""||null}return c.x=function(e){return arguments.length?(t=e,c):t},c.y=function(t){return arguments.length?(e=t,c):e},c.size=function(t){return arguments.length?(n=t,c):n},c.defined=function(t){return arguments.length?(i=t,c):i},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}function Y(t,e){return null!=t?t:e}const Q=t=>t.x||0,Z=t=>t.y||0,$=t=>!(!1===t.defined),K=r.arc().startAngle(t=>t.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),tt=r.area().x(Q).y1(Z).y0(t=>(t.y||0)+(t.height||0)).defined($),et=r.area().y(Z).x1(Q).x0(t=>(t.x||0)+(t.width||0)).defined($),nt=r.line().x(Q).y(Z).defined($),it=F().x(Q).y(Z).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>Y(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>Y(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>Y(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>Y(t.cornerRadiusBottomLeft,t.cornerRadius)||0),rt=r.symbol().type(t=>I(t.shape||"circle")).size(t=>Y(t.size,64)),ot=J().x(Q).y(Z).defined($).size(t=>t.size||1);function st(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function at(t,e,n,i){return it.context(t)(e,n,i)}function ut(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const i=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(i+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,i):0))}return t}var lt,ht,ct,ft=z-1e-8;function dt(t){return lt=t,dt}function vt(){}function gt(t,e){lt.add(t,e)}function pt(t,e){gt(ht=t,ct=e)}function yt(t){gt(t,lt.y1)}function mt(t){gt(lt.x1,t)}function _t(t,e,n,i){const r=(t-e)/(t+n-2*e);0<r&&r<1&&i(t+(e-t)*r)}function xt(t,e,n,i,r){const o=i-t+3*e-3*n,s=t+n-2*e,a=t-e;let u,l=0,h=0;Math.abs(o)>A?(u=s*s+a*o,u>=0&&(u=Math.sqrt(u),l=(-s+u)/o,h=(-s-u)/o)):l=.5*a/s,0<l&&l<1&&r(bt(l,t,e,n,i)),0<h&&h<1&&r(bt(h,t,e,n,i))}function bt(t,e,n,i,r){const o=1-t,s=o*o,a=t*t;return s*o*e+3*s*t*n+3*o*a*i+a*t*r}dt.beginPath=vt,dt.closePath=vt,dt.moveTo=pt,dt.lineTo=pt,dt.rect=function(t,e,n,i){gt(t+n,e+i),pt(t,e)},dt.quadraticCurveTo=function(t,e,n,i){_t(ht,t,n,yt),_t(ct,e,i,mt),pt(n,i)},dt.bezierCurveTo=function(t,e,n,i,r,o){xt(ht,t,n,r,yt),xt(ct,e,i,o,mt),pt(r,o)},dt.arc=function(t,e,n,i,r,o){if(ht=n*Math.cos(r)+t,ct=n*Math.sin(r)+e,Math.abs(r-i)>ft)gt(t-n,e-n),gt(t+n,e+n);else{const s=i=>gt(n*Math.cos(i)+t,n*Math.sin(i)+e);let a,u;if(s(i),s(r),r!==i)if((i%=z)<0&&(i+=z),(r%=z)<0&&(r+=z),r<i&&(o=!o,a=i,i=r,r=a),o)for(r-=z,a=i-i%M,u=0;u<4&&a>r;++u,a-=M)s(a);else for(a=i-i%M+M,u=0;u<4&&a<r;++u,a+=M)s(a)}};var kt=(kt=n.canvas(1,1))?kt.getContext("2d"):null;const wt=new s;function Tt(t){return function(e,n){if(!kt)return!0;t(kt,e),wt.clear().union(e.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:s}=wt;for(let t=r;t<=s;++t)for(let e=i;e<=o;++e)if(kt.isPointInPath(e,t))return!0;return!1}}function At(t,e){return e.contains(t.x||0,t.y||0)}function Mt(t,e){const n=t.x||0,i=t.y||0,r=t.width||0,o=t.height||0;return e.intersects(wt.set(n,i,n+r,i+o))}function zt(t,e){const n=t.x||0,i=t.y||0;return Ct(e,n,i,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i)}function Ct(t,e,n,i,r){const{x1:o,y1:s,x2:a,y2:u}=t,l=i-e,h=r-n;let c,f,d,v,g=0,p=1;for(v=0;v<4;++v){if(0===v&&(c=-l,f=-(o-e)),1===v&&(c=l,f=a-e),2===v&&(c=-h,f=-(s-n)),3===v&&(c=h,f=u-n),Math.abs(c)<1e-10&&f<0)return!1;if(d=f/c,c<0){if(d>p)return!1;d>g&&(g=d)}else if(c>0){if(d<g)return!1;d<p&&(p=d)}}return!0}function Rt(t,e){return null==t?e:t}function Pt(t,e,n){return h(n)?function(t,e,n){const i=n.width(),r=n.height(),o=e.stops,s=o.length,a="radial"===e.gradient?t.createRadialGradient(n.x1+Rt(e.x1,.5)*i,n.y1+Rt(e.y1,.5)*r,Math.max(i,r)*Rt(e.r1,0),n.x1+Rt(e.x2,.5)*i,n.y1+Rt(e.y2,.5)*r,Math.max(i,r)*Rt(e.r2,.5)):t.createLinearGradient(n.x1+Rt(e.x1,0)*i,n.y1+Rt(e.y1,0)*r,n.x1+Rt(e.x2,1)*i,n.y1+Rt(e.y2,0)*r);for(let t=0;t<s;++t)a.addColorStop(o[t].offset,o[t].color);return a}(t,n,e.bounds):n}function Lt(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=Pt(t,e,e.fill),!0)}var St=[];function Nt(t,e,n){var i=null!=(i=e.strokeWidth)?i:1;return!(i<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=Pt(t,e,e.stroke),t.lineWidth=i,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||St),t.lineDashOffset=e.strokeDashOffset||0),!0))}function Ot(t,e){return t.zindex-e.zindex||t.index-e.index}function qt(t){if(!t.zdirty)return t.zitems;var e,n,i,r=t.items,o=[];for(n=0,i=r.length;n<i;++n)(e=r[n]).index=n,e.zindex&&o.push(e);return t.zdirty=!1,t.zitems=o.sort(Ot)}function Et(t,e){var n,i,r=t.items;if(r&&r.length){var o=qt(t);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||e(r[n]);r=o}for(n=0,i=r.length;n<i;++n)e(r[n])}}function Dt(t,e){var n,i,r=t.items;if(!r||!r.length)return null;var o=qt(t);for(o&&o.length&&(r=o),i=r.length;--i>=0;)if(n=e(r[i]))return n;if(r===o)for(i=(r=t.items).length;--i>=0;)if(!r[i].zindex&&(n=e(r[i])))return n;return null}function It(t){return function(e,n,i){Et(n,(function(n){i&&!i.intersects(n.bounds)||Vt(t,e,n,n)}))}}function Bt(t){return function(e,n,i){!n.items.length||i&&!i.intersects(n.bounds)||Vt(t,e,n.items[0],n.items)}}function Vt(t,e,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(t(e,i)||(n.fill&&Lt(e,n,r)&&e.fill(),n.stroke&&Nt(e,n,r)&&e.stroke()))}function Ht(t){return t=t||e.truthy,function(e,n,i,r,o,s){return i*=e.pixelRatio,r*=e.pixelRatio,Dt(n,(function(n){var a=n.bounds;if((!a||a.contains(o,s))&&a)return t(e,n,i,r,o,s)?n:void 0}))}}function Wt(t,e){return function(n,i,r,o){var s,a,u=Array.isArray(i)?i[0]:i,l=null==e?u.fill:e,h=u.stroke&&n.isPointInStroke;return h&&(s=u.strokeWidth,a=u.strokeCap,n.lineWidth=null!=s?s:1,n.lineCap=null!=a?a:"butt"),!t(n,i)&&(l&&n.isPointInPath(r,o)||h&&n.isPointInStroke(r,o))}}function Gt(t){return Ht(Wt(t))}function Ut(t,e){return"translate("+t+","+e+")"}function Xt(t){return"rotate("+t+")"}function jt(t){return Ut(t.x||0,t.y||0)}function Ft(t){return Ut(t.x||0,t.y||0)+(t.angle?" "+Xt(t.angle):"")+(t.scaleX||t.scaleY?" "+(e=t.scaleX||1,n=t.scaleY||1,"scale("+e+","+n+")"):"");var e,n}function Jt(t,e,n){function i(t,n){var i=n.x||0,r=n.y||0,o=n.angle||0;t.translate(i,r),o&&t.rotate(o*=T),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-i,-r)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",Ft(n)),t("d",e(null,n))},bound:function(t,n){var i=n.x||0,r=n.y||0;return e(dt(t),n),ut(t,n).translate(i,r),n.angle&&t.rotate(n.angle*T,i,r),t},draw:It(i),pick:Gt(i),isect:n||Tt(i)}}var Yt=Jt("arc",(function(t,e){return K.context(t)(e)}));function Qt(t,e,n){function i(t,n){t.beginPath(),e(t,n)}var r=Wt(i);return{type:t,tag:"path",nested:!0,attr:function(t,n){var i=n.mark.items;i.length&&t("d",e(null,i))},bound:function(t,n){var i=n.items;return 0===i.length?t:(e(dt(t),i),ut(t,i[0]))},draw:Bt(i),pick:function(t,e,n,i,o,s){var a=e.items,u=e.bounds;return!a||!a.length||u&&!u.contains(o,s)?null:(n*=t.pixelRatio,i*=t.pixelRatio,r(t,a,n,i)?a[0]:null)},isect:At,tip:n}}var Zt=Qt("area",(function(t,e){var n=e[0],i=n.interpolate||"linear";return("horizontal"===n.orient?et:tt).curve(x(i,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,i,r="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",s=t.length,a=1/0;--s>=0;)!1!==t[s].defined&&(i=Math.abs(t[s][o]-r))<a&&(a=i,n=t[s]);return n}));function $t(t,e){t.beginPath(),st(e)?at(t,e,0,0):t.rect(0,0,e.width||0,e.height||0),t.clip()}var Kt=1;function te(t,n,i){var r=n.clip,o=t._defs,s=n.clip_id||(n.clip_id="clip"+Kt++),a=o.clipping[s]||(o.clipping[s]={id:s});return e.isFunction(r)?a.path=r(null):st(i)?a.path=at(null,i,0,0):(a.width=i.width||0,a.height=i.height||0),"url(#"+s+")"}function ee(t){var e=null!=(e=t.strokeWidth)?e:1;return null!=t.strokeOffset?t.strokeOffset:t.stroke&&e>.5&&e<1.5?.5-Math.abs(e-1):0}function ne(t,e){var n=ee(e);t("d",at(null,e,n,n))}function ie(t,e,n,i){var r=ee(e);t.beginPath(),at(t,e,(n||0)+r,(i||0)+r)}var re=Wt(ie),oe=Wt(ie,!1);var se={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",jt(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,i=0,r=n.length;i<r;++i)t.union(n[i].bounds);return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),ut(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var i=this;Et(e,(function(e){var r=e.x||0,o=e.y||0,s=e.strokeForeground,a=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&a&&(ie(t,e,r,o),e.fill&&Lt(t,e,a)&&t.fill(),e.stroke&&!s&&Nt(t,e,a)&&t.stroke()),t.save(),t.translate(r,o),e.clip&&$t(t,e),n&&n.translate(-r,-o),Et(e,(function(e){i.draw(t,e,n)})),n&&n.translate(r,o),t.restore(),s&&e.stroke&&a&&(ie(t,e,r,o),Nt(t,e,a)&&t.stroke())}))},pick:function(t,e,n,i,r,o){if(e.bounds&&!e.bounds.contains(r,o)||!e.items)return null;var s=this,a=n*t.pixelRatio,u=i*t.pixelRatio;return Dt(e,(function(l){var h,c,f,d,v,g,p,y,m;if((!(y=l.bounds)||y.contains(r,o))&&(d=l.x||0,v=l.y||0,g=d+(l.width||0),p=v+(l.height||0),!(m=l.clip)||!(r<d||r>g||o<d||o>p)))return t.save(),t.translate(d,v),d=r-d,v=o-v,m&&st(l)&&!re(t,l,a,u)?(t.restore(),null):(c=l.strokeForeground,(f=!1!==e.interactive)&&c&&l.stroke&&oe(t,l,a,u)?(t.restore(),l):(!(h=Dt(l,(function(t){return function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,d,v)?s.pick(t,n,i,d,v):null})))&&f&&(l.fill||!c&&l.stroke)&&re(t,l,a,u)&&(h=l),t.restore(),h||null))}))},isect:Mt,content:function(t,e,n){t("clip-path",e.clip?te(n,e,e):null)},background:function(t,e){t("class","background"),ne(t,e)},foreground:function(t,e){t("class","foreground"),e.strokeForeground?ne(t,e):t("d","")}};function ae(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then(e=>{t.image=e,t.image.url=t.url})),n}function ue(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function le(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function he(t,e){return"center"===t?e/2:"right"===t?e:0}function ce(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var fe={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var i=ae(e,n),r=e.x||0,o=e.y||0,s=ue(e,i),a=le(e,i),u=!1===e.aspect?"none":"xMidYMid";r-=he(e.align,s),o-=ce(e.baseline,a),!i.src&&i.toDataURL?t("href",i.toDataURL(),"http://www.w3.org/1999/xlink","xlink:href"):t("href",i.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Ut(r,o)),t("width",s),t("height",a),t("preserveAspectRatio",u)},bound:function(t,e){var n=e.image,i=e.x||0,r=e.y||0,o=ue(e,n),s=le(e,n);return i-=he(e.align,o),r-=ce(e.baseline,s),t.set(i,r,i+o,r+s)},draw:function(t,e,n){var i=this;Et(e,(function(e){if(!n||n.intersects(e.bounds)){var r,o,s,a,u=ae(e,i),l=e.x||0,h=e.y||0,c=ue(e,u),f=le(e,u);l-=he(e.align,c),h-=ce(e.baseline,f),!1!==e.aspect&&(o=u.width/u.height,s=e.width/e.height,o==o&&s==s&&o!==s&&(s<o?(h+=(f-(a=c/o))/2,f=a):(l+=(c-(a=f*o))/2,c=a))),(u.complete||u.toDataURL)&&(t.globalAlpha=null!=(r=e.opacity)?r:1,t.imageSmoothingEnabled=!1!==e.smooth,t.drawImage(u,l,h,c,f))}}))},pick:Ht(),isect:e.truthy,get:ae,xOffset:he,yOffset:ce},de=Qt("line",(function(t,e){var n=e[0],i=n.interpolate||"linear";return nt.curve(x(i,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,i,r=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(i=t[o].y-e[1])*i<r)return t[o];return null}));function ve(t,e){var n=e.path;if(null==n)return!0;var i=e.x||0,r=e.y||0,o=e.scaleX||1,s=e.scaleY||1,a=(e.angle||0)*T,u=e.pathCache;u&&u.path===n||((e.pathCache=u=w(n)).path=n),a&&t.rotate&&t.translate?(t.translate(i,r),t.rotate(a),q(t,u,0,0,o,s),t.rotate(-a),t.translate(-i,-r)):q(t,u,i,r,o,s)}var ge={type:"path",tag:"path",nested:!1,attr:function(t,e){var n=e.scaleX||1,i=e.scaleY||1;1===n&&1===i||t("vector-effect","non-scaling-stroke"),t("transform",Ft(e)),t("d",e.path)},bound:function(t,e){return ve(dt(t),e)?t.set(0,0,0,0):ut(t,e,!0),e.angle&&t.rotate(e.angle*T,e.x||0,e.y||0),t},draw:It(ve),pick:Gt(ve),isect:Tt(ve)};function pe(t,e){t.beginPath(),at(t,e)}var ye={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",at(null,e))},bound:function(t,e){var n,i;return ut(t.set(n=e.x||0,i=e.y||0,n+e.width||0,i+e.height||0),e)},draw:It(pe),pick:Gt(pe),isect:Mt};function me(t,e,n){var i,r,o,s;return!(!e.stroke||!Nt(t,e,n))&&(i=e.x||0,r=e.y||0,o=null!=e.x2?e.x2:i,s=null!=e.y2?e.y2:r,t.beginPath(),t.moveTo(i,r),t.lineTo(o,s),!0)}var _e,xe={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",jt(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,i;return ut(t.set(n=e.x||0,i=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i),e)},draw:function(t,e,n){Et(e,(function(e){if(!n||n.intersects(e.bounds)){var i=null==e.opacity?1:e.opacity;i&&me(t,e,i)&&t.stroke()}}))},pick:Ht((function(t,e,n,i){return!!t.isPointInStroke&&(me(t,e,1)&&t.isPointInStroke(n,i))})),isect:zt},be=Jt("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),ke=Jt("symbol",(function(t,e){return rt.context(t)(e)}),At),we={height:Ce,measureWidth:Me,estimateWidth:Te,width:Te,canvas:Re};function Te(t,e){return _e=Ce(t),Ae(Se(t,e))}function Ae(t){return~~(.8*t.length*_e)}function Me(t,e){return Ce(t)<=0?0:(kt.font=Oe(t),ze(Se(t,e)))}function ze(t){return kt.measureText(t).width}function Ce(t){return null!=t.fontSize?t.fontSize:11}function Re(t){we.width=t&&kt?Me:Te}function Pe(t){return null!=t.lineHeight?t.lineHeight:Ce(t)+2}function Le(t){return n=t.lineBreak&&t.text&&!e.isArray(t.text)?t.text.split(t.lineBreak):t.text,e.isArray(n)?n.length>1?n:n[0]:n;var n}function Se(t,e){return null==e?"":t.limit>0?function(t,e){var n,i=+t.limit,r=e+"";we.width===Me?(kt.font=Oe(t),n=ze):(_e=Ce(t),n=Ae);if(n(r)<i)return r;var o,s=t.ellipsis||"…",a="rtl"===t.dir,u=0,l=r.length;if(i-=n(s),a){for(;u<l;)o=u+l>>>1,n(r.slice(o))>i?u=o+1:l=o;return s+r.slice(u)}for(;u<l;)o=1+(u+l>>>1),n(r.slice(0,o))<i?u=o:l=o-1;return r.slice(0,u)+s}(t,e):e+""}function Ne(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function Oe(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+Ce(t)+"px "+Ne(t,e)}function qe(t){var e=t.baseline,n=Ce(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}Re(!0);var Ee={left:"start",center:"middle",right:"end"},De=new s;function Ie(t){var e,n=t.x||0,i=t.y||0,r=t.radius||0;return r&&(e=(t.theta||0)-M,n+=r*Math.cos(e),i+=r*Math.sin(e)),De.x1=n,De.y1=i,De}function Be(t,n,i){var r,o=we.height(n),s=n.align,a=Ie(n),u=a.x1,l=a.y1,h=n.dx||0,c=(n.dy||0)+qe(n)-Math.round(.8*o),f=Le(n);if(e.isArray(f)?(o+=Pe(n)*(f.length-1),r=f.reduce((t,e)=>Math.max(t,we.width(n,e)),0)):r=we.width(n,f),"center"===s?h-=r/2:"right"===s&&(h-=r),t.set(h+=u,c+=l,h+r,c+o),n.angle&&!i)t.rotate(n.angle*T,u,l);else if(2===i)return t.rotatedPoints(n.angle*T,u,l);return t}var Ve={arc:Yt,area:Zt,group:se,image:fe,line:de,path:ge,rect:ye,rule:xe,shape:be,symbol:ke,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,i=e.dx||0,r=(e.dy||0)+qe(e),o=Ie(e),s=o.x1,a=o.y1,u=e.angle||0;t("text-anchor",Ee[e.align]||"start"),u?(n=Ut(s,a)+" "+Xt(u),(i||r)&&(n+=" "+Ut(i,r))):n=Ut(s+i,a+r),t("transform",n)},bound:Be,draw:function(t,n,i){Et(n,(function(n){var r,o,s,a,u,l,h,c=null==n.opacity?1:n.opacity;if(!(i&&!i.intersects(n.bounds)||0===c||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=Oe(n),t.textAlign=n.align||"left",o=(r=Ie(n)).x1,s=r.y1,n.angle&&(t.save(),t.translate(o,s),t.rotate(n.angle*T),o=s=0),o+=n.dx||0,s+=(n.dy||0)+qe(n),l=Le(n),e.isArray(l))for(u=Pe(n),a=0;a<l.length;++a)h=Se(n,l[a]),n.fill&&Lt(t,n,c)&&t.fillText(h,o,s),n.stroke&&Nt(t,n,c)&&t.strokeText(h,o,s),s+=u;else h=Se(n,l),n.fill&&Lt(t,n,c)&&t.fillText(h,o,s),n.stroke&&Nt(t,n,c)&&t.strokeText(h,o,s);n.angle&&t.restore()}}))},pick:Ht((function(t,e,n,i,r,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var s=Ie(e),a=s.x1,u=s.y1,l=Be(De,e,1),h=-e.angle*T,c=Math.cos(h),f=Math.sin(h),d=c*r-f*o+(a-c*a+f*u),v=f*r+c*o+(u-f*a-c*u);return l.contains(d,v)})),isect:function(t,e){var n=Be(De,t,2);return Ct(e,n[0],n[1],n[2],n[3])||Ct(e,n[0],n[1],n[4],n[5])||Ct(e,n[4],n[5],n[6],n[7])||Ct(e,n[2],n[3],n[6],n[7])}},trail:Qt("trail",(function(t,e){return ot.context(t)(e)}),(function(t,e){for(var n,i,r=t.length;--r>=0;)if(!1!==t[r].defined&&(n=t[r].x-e[0])*n+(i=t[r].y-e[1])*i<(n=t[r].size||1)*n)return t[r];return null}))};function He(t,e,n){var i=Ve[t.mark.marktype],r=e||i.bound;return i.nested&&(t=t.mark),r(t.bounds||(t.bounds=new s),t,n)}var We={mark:null};function Ge(t,e,n){var i,r,o,a,u=Ve[t.marktype],l=u.bound,h=t.items,c=h&&h.length;if(u.nested)return c?o=h[0]:(We.mark=t,o=We),a=He(o,l,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new s,c)for(i=0,r=h.length;i<r;++i)e.union(He(h[i],l,n));return t.bounds=e}var Ue=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","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"];function Xe(t,e){return JSON.stringify(t,Ue,e)}function je(t){return function t(e){var n,i,r,o=e.marktype,s=e.items;if(s)for(i=0,r=s.length;i<r;++i)n=o?"mark":"group",s[i][n]=e,s[i].zindex&&(s[i][n].zdirty=!0),"group"===(o||n)&&t(s[i]);o&&Ge(e);return e}("string"==typeof t?JSON.parse(t):t)}function Fe(t){arguments.length?this.root=je(t):(this.root=Ye({marktype:"group",name:"root",role:"frame"}),this.root.items=[new v(this.root)])}var Je=Fe.prototype;function Ye(t,e){return{bounds:new s,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Qe(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function Ze(t,e){e=e.toLowerCase();for(var n=t.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===e)return n[i]}function $e(t,e,n,i){var r,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=Qe(t.ownerDocument,n,i),t.insertBefore(o,r)),o}function Ke(t,e){for(var n=t.childNodes,i=n.length;i>e;)t.removeChild(n[--i]);return t}function tn(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function en(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function nn(t,e){this._active=null,this._handlers={},this._loader=t||i.loader(),this._tooltip=e||rn}function rn(t,e,n,i){t.element().setAttribute("title",i||"")}Je.toJSON=function(t){return Xe(this.root,t||0)},Je.mark=function(t,e,n){var i=Ye(t,e=e||this.root.items[0]);return e.items[n]=i,i.zindex&&(i.group.zdirty=!0),i};var on=nn.prototype;function sn(t){this._el=null,this._bgcolor=null,this._loader=new g(t)}on.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},on.element=function(){return this._el},on.canvas=function(){return this._el&&this._el.firstChild},on.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},on.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},on.on=function(){},on.off=function(){},on._handlerIndex=function(t,e,n){for(var i=t?t.length:0;--i>=0;)if(t[i].type===e&&(!n||t[i].handler===n))return i;return-1},on.handlers=function(t){var e,n=this._handlers,i=[];if(t)i.push.apply(i,n[this.eventName(t)]);else for(e in n)i.push.apply(i,n[e]);return i},on.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},on.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then((function(e){var n=new MouseEvent(t.type,t),i=Qe(null,"a");for(var r in e)i.setAttribute(r,e[r]);i.dispatchEvent(n)})).catch((function(){}))},on.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,i){var r,o,s=t&&t.mark;if(s&&(r=Ve[s.marktype]).tip){for((o=en(e,n))[0]-=i[0],o[1]-=i[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=r.tip(s.items,o)}return t}(e,t,this.canvas(),this._origin);var i=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,i)}},on.getItemBoundingClientRect=function(t){if(e=this.canvas()){for(var e,n=e.getBoundingClientRect(),i=this._origin,r=t.bounds,o=r.x1+i[0]+n.left,s=r.y1+i[1]+n.top,a=r.width(),u=r.height();t.mark&&(t=t.mark.group);)o+=t.x||0,s+=t.y||0;return{x:o,y:s,width:a,height:u,left:o,top:s,right:o+a,bottom:s+u}}};var an=sn.prototype;an.initialize=function(t,e,n,i,r){return this._el=t,this.resize(e,n,i,r)},an.element=function(){return this._el},an.canvas=function(){return this._el&&this._el.firstChild},an.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},an.resize=function(t,e,n,i){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=i||1,this},an.dirty=function(){},an.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},an._render=function(){},an.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then((function(){return e})):Promise.resolve(e)},an._load=function(t,e){var n=this,i=n._loader[t](e);if(!n._ready){var r=n._call;n._ready=n._loader.ready().then((function(t){t&&r(),n._ready=null}))}return i},an.sanitizeURL=function(t){return this._load("sanitizeURL",t)},an.loadImage=function(t){return this._load("loadImage",t)};var un="mouseout";function ln(t,e){nn.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var hn=e.inherits(ln,nn);function cn(t,e,n){return function(i){var r=this._active,o=this.pickEvent(i);o===r?this.fire(t,i):(r&&r.exit||this.fire(n,i),this._active=o,this.fire(e,i),this.fire(t,i))}}function fn(t){return function(e){this.fire(t,e),this._active=null}}hn.initialize=function(t,e,n){var i=this._canvas=t&&Ze(t,"canvas");if(i){var r=this;this.events.forEach((function(t){i.addEventListener(t,(function(e){hn[t]?hn[t].call(r,e):r.fire(t,e)}))}))}return nn.prototype.initialize.call(this,t,e,n)},hn.canvas=function(){return this._canvas},hn.context=function(){return this._canvas.getContext("2d")},hn.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],hn.DOMMouseScroll=function(t){this.fire("mousewheel",t)},hn.mousemove=cn("mousemove","mouseover","mouseout"),hn.dragover=cn("dragover","dragenter","dragleave"),hn.mouseout=fn("mouseout"),hn.dragleave=fn("dragleave"),hn.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},hn.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},hn.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},hn.touchmove=function(t){this.fire("touchmove",t,!0)},hn.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},hn.fire=function(t,e,n){var i,r,o=n?this._touch:this._active,s=this._handlers[t];if(e.vegaType=t,"click"===t&&o&&o.href?this.handleHref(e,o,o.href):"mousemove"!==t&&t!==un||this.handleTooltip(e,o,t!==un),s)for(i=0,r=s.length;i<r;++i)s[i].handler.call(this._obj,e,o)},hn.on=function(t,e){var n=this.eventName(t),i=this._handlers;return this._handlerIndex(i[n],t,e)<0&&(i[n]||(i[n]=[])).push({type:t,handler:e}),this},hn.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&i.splice(r,1),this},hn.pickEvent=function(t){var e=en(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},hn.pick=function(t,e,n,i,r){var o=this.context();return Ve[t.marktype].pick.call(this,o,t,e,n,i,r)};var dn="undefined"!=typeof window&&window.devicePixelRatio||1;function vn(t){sn.call(this,t),this._redraw=!1,this._dirty=new s}var gn=e.inherits(vn,sn),pn=sn.prototype,yn=new s;function mn(t,e,n){return yn.set(0,0,e,n).translate(-t[0],-t[1])}function _n(t,e){nn.call(this,t,e);var n=this;n._hrefHandler=bn(n,(function(t,e){e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=bn(n,(function(t,e){n.handleTooltip(t,e,t.type!==un)}))}gn.initialize=function(t,e,i,r,o,s){return this._options=s,this._canvas=n.canvas(1,1,s&&s.type),t&&(Ke(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),pn.initialize.call(this,t,e,i,r,o)},gn.resize=function(t,e,n,i){return pn.resize.call(this,t,e,n,i),function(t,e,n,i,r,o){var s,a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),l=a?dn:r;for(s in t.width=e*l,t.height=n*l,o)u[s]=o[s];a&&1!==l&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=l,u.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},gn.canvas=function(){return this._canvas},gn.context=function(){return this._canvas?this._canvas.getContext("2d"):null},gn.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=yn.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},gn._render=function(t){var e=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty;return e.save(),this._redraw||o.empty()?(this._redraw=!1,o=mn(n,i,r).expand(1)):o=function(t,e,n){return e.expand(1).round(),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,o.intersect(mn(n,i,r)),n),this.clear(-n[0],-n[1],i,r),this.draw(e,t,o),e.restore(),this._dirty.clear(),this},gn.draw=function(t,n,i){var r=Ve[n.marktype];n.clip&&function(t,n){var i=n.clip;t.save(),e.isFunction(i)?(t.beginPath(),i(t),t.clip()):$t(t,n.group)}(t,n),r.draw.call(this,t,n,i),n.clip&&t.restore()},gn.clear=function(t,e,n,i){var r=this.context();r.clearRect(t,e,n,i),null!=this._bgcolor&&(r.fillStyle=this._bgcolor,r.fillRect(t,e,n,i))};var xn=e.inherits(_n,nn);function bn(t,e){return function(n){var i=n.target.__data__;n.vegaType=n.type,i=Array.isArray(i)?i[0]:i,e.call(t._obj,n,i)}}function kn(t,e,n){var i,r,o="<"+t;if(e)for(i in e)null!=(r=e[i])&&(o+=" "+i+'="'+r+'"');return n&&(o+=" "+n),o+">"}function wn(t){return"</"+t+">"}xn.initialize=function(t,e,n){var i=this._svg;return i&&(i.removeEventListener("click",this._hrefHandler),i.removeEventListener("mousemove",this._tooltipHandler),i.removeEventListener(un,this._tooltipHandler)),this._svg=i=t&&Ze(t,"svg"),i&&(i.addEventListener("click",this._hrefHandler),i.addEventListener("mousemove",this._tooltipHandler),i.addEventListener(un,this._tooltipHandler)),nn.prototype.initialize.call(this,t,e,n)},xn.canvas=function(){return this._svg},xn.on=function(t,e){var n=this.eventName(t),i=this._handlers;if(this._handlerIndex(i[n],t,e)<0){var r={type:t,handler:e,listener:bn(this,e)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},xn.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this};var Tn={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},An={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"},Mn=Object.keys(An),zn=Tn.xmlns;function Cn(t){sn.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var Rn=e.inherits(Cn,sn),Pn=sn.prototype;function Ln(t,e,n){var i,r,o;if("radial"===e.gradient){var s=$e(t,n++,"pattern",zn);s.setAttribute("id",l+e.id),s.setAttribute("viewBox","0,0,1,1"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("preserveAspectRatio","xMidYMid slice"),(s=$e(s,0,"rect",zn)).setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","url("+Vn()+"#"+e.id+")"),(t=$e(t,n++,"radialGradient",zn)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=$e(t,n++,"linearGradient",zn)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(i=0,r=e.stops.length;i<r;++i)(o=$e(t,i,"stop",zn)).setAttribute("offset",e.stops[i].offset),o.setAttribute("stop-color",e.stops[i].color);return Ke(t,i),n}function Sn(t,e,n){var i;return(t=$e(t,n,"clipPath",zn)).setAttribute("id",e.id),e.path?(i=$e(t,0,"path",zn)).setAttribute("d",e.path):((i=$e(t,0,"rect",zn)).setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",e.width),i.setAttribute("height",e.height)),Ke(t,1),n+1}function Nn(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function On(t,e,n,i,r){var o,s=t._svg;if(!s&&(s=Qe(o=e.ownerDocument,i,zn),t._svg=s,t.mark&&(s.__data__=t,s.__values__={fill:"default"},"g"===i))){var a=Qe(o,"path",zn);s.appendChild(a),a.__data__=t;var u=Qe(o,"g",zn);s.appendChild(u),u.__data__=t;var l=Qe(o,"path",zn);s.appendChild(l),l.__data__=t,l.__values__={fill:"default"}}return(s.ownerSVGElement!==r||function(t,e){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=e}(s,n))&&e.insertBefore(s,n?n.nextSibling:e.firstChild),s}Rn.initialize=function(t,e,n,i){return t&&(this._svg=$e(t,0,"svg",zn),this._svg.setAttribute("class","marks"),Ke(t,1),this._root=$e(this._svg,0,"g",zn),Ke(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),Pn.initialize.call(this,t,e,n,i)},Rn.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),Pn.background.apply(this,arguments)},Rn.resize=function(t,e,n,i){return Pn.resize.call(this,t,e,n,i),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},Rn.canvas=function(){return this._svg},Rn.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in Tn)t[e]=Tn[e];var n=this._bgcolor?kn("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+wn("rect"):"";return kn("svg",t)+n+this._svg.innerHTML+wn("svg")},Rn._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Ke(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},Rn.updateDefs=function(){var t,e=this._svg,n=this._defs,i=n.el,r=0;for(t in n.gradient)i||(n.el=i=$e(e,0,"defs",zn)),r=Ln(i,n.gradient[t],r);for(t in n.clipping)i||(n.el=i=$e(e,0,"defs",zn)),r=Sn(i,n.clipping[t],r);i&&(0===r?(e.removeChild(i),n.el=null):Ke(i,r))},Rn._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},Rn.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},Rn.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},Rn._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var e,n,i,r,o,s,a,u=++this._dirtyID;for(o=0,s=t.length;o<s;++o)(n=(e=t[o]).mark).marktype!==i&&(i=n.marktype,r=Ve[i]),n.zdirty&&n.dirty!==u&&(this._dirtyAll=!1,Nn(e,u),n.items.forEach((function(t){t.dirty=u}))),n.zdirty||(e.exit?(r.nested&&n.items.length?(a=n.items[0])._svg&&this._update(r,a._svg,a):e._svg&&(a=e._svg.parentNode)&&a.removeChild(e._svg),e._svg=null):(e=r.nested?n.items[0]:e)._update!==u&&(e._svg&&e._svg.ownerSVGElement?this._update(r,e._svg,e):(this._dirtyAll=!1,Nn(e,u)),e._update=u));return!this._dirtyAll},Rn.draw=function(t,e,n){if(!this.isDirty(e))return e._svg;var i,r=this,o=this._svg,s=Ve[e.marktype],a=!1===e.interactive?"none":null,u="g"===s.tag,l=null,h=0;function c(t){var e=r.isDirty(t),n=On(t,i,l,s.tag,o);e&&(r._update(s,n,t),u&&function(t,e,n){e=e.lastChild.previousSibling;var i,r=0;Et(n,(function(n){i=t.draw(e,n,i),++r})),Ke(e,1+r)}(r,n,t)),l=n,++h}return(i=On(e,t,n,"g",o)).setAttribute("class",tn(e)),u||i.style.setProperty("pointer-events",a),e.clip?i.setAttribute("clip-path",te(r,e,e.group)):i.removeAttribute("clip-path"),s.nested?e.items.length&&c(e.items[0]):Et(e,c),Ke(i,h),i};var qn=null,En=null,Dn={group:function(t,e,n){var i,r;qn=i=e.childNodes[2],En=i.__values__,t.foreground(Bn,n,this),En=e.__values__,qn=e.childNodes[1],t.content(Bn,n,this),qn=r=e.childNodes[0],t.background(Bn,n,this);var o=!1===n.mark.interactive?"none":null;if(o!==En.events&&(i.style.setProperty("pointer-events",o),r.style.setProperty("pointer-events",o),En.events=o),n.strokeForeground&&n.stroke){const t=n.fill;i.style.removeProperty("display"),this.style(r,n),r.style.removeProperty("stroke"),t&&(n.fill=null),En=i.__values__,this.style(i,n),t&&(n.fill=t),qn=null}else i.style.setProperty("display","none"),i.style.setProperty("fill","none")},image:function(t,e,n){!1===n.smooth?(In(e,"image-rendering","optimizeSpeed"),In(e,"image-rendering","pixelated")):In(e,"image-rendering",null)},text:function(t,n,i){var r,o,s,a,u=Le(i);e.isArray(u)?(r=(o=u.map(t=>Se(i,t))).join("\n"))!==En.text&&(Ke(n,0),s=n.ownerDocument,a=Pe(i),o.forEach((t,e)=>{const r=Qe(s,"tspan",zn);r.__data__=i,r.textContent=t,e&&(r.setAttribute("x",0),r.setAttribute("dy",a)),n.appendChild(r)}),En.text=r):(o=Se(i,u))!==En.text&&(n.textContent=o,En.text=o),In(n,"font-family",Ne(i)),In(n,"font-size",Ce(i)+"px"),In(n,"font-style",i.fontStyle),In(n,"font-variant",i.fontVariant),In(n,"font-weight",i.fontWeight)}};function In(t,e,n){n!==En[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),En[e]=n)}function Bn(t,e,n){e!==En[t]&&(null!=e?n?qn.setAttributeNS(n,t,e):qn.setAttribute(t,e):n?qn.removeAttributeNS(n,t):qn.removeAttribute(t),En[t]=e)}function Vn(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function Hn(t){sn.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}Rn._update=function(t,e,n){qn=e,En=e.__values__,t.attr(Bn,n,this);var i=Dn[t.type];i&&i.call(this,t,e,n),qn&&this.style(qn,n)},Rn.style=function(t,e){var n,i,r,o,s;if(null!=e)for(n=0,i=Mn.length;n<i;++n)s=e[r=Mn[n]],"font"===r&&(s=Ne(e)),s!==En[r]&&(o=An[r],null==s?"fill"===o?t.style.setProperty(o,"none"):t.style.removeProperty(o):(h(s)&&(s=c(s,this._defs.gradient,Vn())),t.style.setProperty(o,s+"")),En[r]=s)};var Wn,Gn=e.inherits(Hn,sn),Un=sn.prototype;function Xn(t,e,n,i){Wn[i||t]=e}function jn(t,e,n,i){if(null==t)return"";var r,o,s,a,u,l="";for("bgrect"===n&&!1===e.interactive&&(l+="pointer-events: none; "),"bgfore"===n&&(!1===e.interactive&&(l+="pointer-events: none; "),l+="display: none; "),"image"===n&&!1===t.smooth&&(l+="image-rendering: optimizeSpeed; image-rendering: pixelated; "),"text"===n&&(l+="font-family: "+Ne(t)+"; ",l+="font-size: "+Ce(t)+"px; ",t.fontStyle&&(l+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(l+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(l+="font-weight: "+t.fontWeight+"; ")),r=0,o=Mn.length;r<o;++r)s=Mn[r],a=An[s],null==(u=t[s])?"fill"===a&&(l+="fill: none; "):"transparent"!==u||"fill"!==a&&"stroke"!==a?(h(u)&&(u=c(u,i.gradient,"")),l+=a+": "+u+"; "):l+=a+": none; ";return l?'style="'+l.trim()+'"':null}function Fn(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}Gn.resize=function(t,e,n,i){Un.resize.call(this,t,e,n,i);var r=this._origin,o=this._text,s={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var a in Tn)s[a]=Tn[a];o.head=kn("svg",s);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),o.bg=u?kn("rect",{width:this._width,height:this._height,style:"fill: "+u+";"})+wn("rect"):"",o.root=kn("g",{transform:"translate("+r+")"}),o.foot=wn("g")+wn("svg"),this},Gn.background=function(){var t=Un.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},Gn.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},Gn._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},Gn.buildDefs=function(){var t,e,n,i,r,o=this._defs,s="";for(e in o.gradient){for(r=(n=o.gradient[e]).stops,"radial"===n.gradient?(s+=kn(i="pattern",{id:l+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),s+=kn("rect",{width:"1",height:"1",fill:"url(#"+e+")"})+wn("rect"),s+=wn(i),s+=kn(i="radialGradient",{id:e,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):s+=kn(i="linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<r.length;++t)s+=kn("stop",{offset:r[t].offset,"stop-color":r[t].color})+wn("stop");s+=wn(i)}for(e in o.clipping)n=o.clipping[e],s+=kn("clipPath",{id:e}),n.path?s+=kn("path",{d:n.path})+wn("path"):s+=kn("rect",{x:0,y:0,width:n.width,height:n.height})+wn("rect"),s+=wn("clipPath");return s.length>0?kn("defs")+s+wn("defs"):""},Gn.attributes=function(t,e){return Wn={},t(Xn,e,this),Wn},Gn.href=function(t){var e,n=this,i=t.href;if(i){if(e=n._hrefs&&n._hrefs[i])return e;n.sanitizeURL(i).then((function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[i]=t}))}return null},Gn.mark=function(t){var n,i=this,r=Ve[t.marktype],o=r.tag,s=this._defs,a="";function u(u){var l=i.href(u);if(l&&(a+=kn("a",l)),n="g"!==o?jn(u,t,o,s):null,a+=kn(o,i.attributes(r.attr,u),n),"text"===o){const t=Le(u);if(e.isArray(t)){const e={x:0,dy:Pe(u)};for(let n=0;n<t.length;++n)a+=kn("tspan",n?e:null)+Fn(Se(u,t[n]))+wn("tspan")}else a+=Fn(Se(u,t))}else if("g"===o){const e=u.strokeForeground,n=u.fill,o=u.stroke;e&&o&&(u.stroke=null),a+=kn("path",i.attributes(r.background,u),jn(u,t,"bgrect",s))+wn("path"),a+=kn("g",i.attributes(r.content,u))+i.markGroup(u)+wn("g"),e&&o?(n&&(u.fill=null),u.stroke=o,a+=kn("path",i.attributes(r.foreground,u),jn(u,t,"bgrect",s))+wn("path"),n&&(u.fill=n)):a+=kn("path",i.attributes(r.foreground,u),jn({},t,"bgfore",s))+wn("path")}a+=wn(o),l&&(a+=wn("a"))}return"g"!==o&&!1===t.interactive&&(n='style="pointer-events: none;"'),a+=kn("g",{class:tn(t),"clip-path":t.clip?te(i,t,t.group):null},n),r.nested?t.items&&t.items.length&&u(t.items[0]):Et(t,u),a+wn("g")},Gn.markGroup=function(t){var e=this,n="";return Et(t,(function(t){n+=e.mark(t)})),n};var Jn={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},Yn={};function Qn(t,e,n,i){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const r=t.items,o=t.marktype,s=r.length;let a=0;if("group"===o)for(;a<s;++a)Zn(r[a],e,n,i);else for(const t=Ve[o].isect;a<s;++a){let n=r[a];$n(n,e,t)&&i.push(n)}}return i}function Zn(t,e,n,i){n&&n(t.mark)&&$n(t,e,Ve.group.isect)&&i.push(t);const r=t.items,o=r&&r.length;if(o){const s=t.x||0,a=t.y||0;e.translate(-s,-a);for(let t=0;t<o;++t)Qn(r[t],e,n,i);e.translate(s,a)}return i}function $n(t,e,n){const i=t.bounds;return e.encloses(i)||e.intersects(i)&&n(t,e)}Yn.canvas=Yn.png={renderer:vn,headless:vn,handler:ln},Yn.svg={renderer:Cn,headless:Hn,handler:_n},Yn.none={};var Kn=new s;var ti=1e-9;function ei(t,n,i){return t===n||("path"===i?ni(t,n):t instanceof Date&&n instanceof Date?+t==+n:e.isNumber(t)&&e.isNumber(n)?Math.abs(t-n)<=ti:t&&n&&(e.isObject(t)||e.isObject(n))?null!=t&&null!=n&&function(t,e){var n,i,r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(n=r[i],!ei(t[n],e[n],n))return!1;return typeof t==typeof e}(t,n):t==n)}function ni(t,e){return ei(w(t),w(e))}t.Bounds=s,t.CanvasHandler=ln,t.CanvasRenderer=vn,t.Gradient=function(t,e){var n,i=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:i,stop:function(t,e){return i.push({offset:t,color:e}),n}}},t.GroupItem=v,t.Handler=nn,t.Item=d,t.Marks=Ve,t.RenderType=Jn,t.Renderer=sn,t.ResourceLoader=g,t.SVGHandler=_n,t.SVGRenderer=Cn,t.SVGStringRenderer=Hn,t.Scenegraph=Fe,t.boundClip=function(t){var n=t.clip;if(e.isFunction(n))n(dt(Kn.clear()));else{if(!n)return;Kn.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Kn)},t.boundContext=dt,t.boundItem=He,t.boundMark=Ge,t.boundStroke=ut,t.closeTag=wn,t.domChild=$e,t.domClear=Ke,t.domCreate=Qe,t.domFind=Ze,t.font=Oe,t.fontFamily=Ne,t.fontSize=Ce,t.intersect=function(t,n,i){const r=[],o=(new s).union(n),a=t.marktype;return a?Qn(t,o,i,r):"group"===a?Zn(t,o,i,r):e.error("Intersect scene must be mark node or group item.")},t.intersectBoxLine=Ct,t.intersectPath=Tt,t.intersectPoint=At,t.intersectRule=zt,t.lineHeight=Pe,t.multiLineOffset=function(t){const n=Le(t);return(e.isArray(n)?n.length-1:0)*Pe(t)},t.openTag=kn,t.pathCurves=x,t.pathEqual=ni,t.pathParse=w,t.pathRectangle=F,t.pathRender=q,t.pathSymbols=I,t.pathTrail=J,t.point=en,t.renderModule=function(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(Yn[t]=e,this):Yn[t]},t.resetSVGClipId=function(){Kt=1},t.sceneEqual=ei,t.sceneFromJSON=je,t.scenePickVisit=Dt,t.sceneToJSON=Xe,t.sceneVisit=Et,t.sceneZOrder=qt,t.textMetrics=we,Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "vega-scenegraph",
"version": "4.4.1",
"version": "4.5.0",
"description": "Vega scenegraph and renderers.",

@@ -26,5 +26,5 @@ "license": "BSD-3-Clause",

"vega-loader": "^4.1.3",
"vega-util": "^1.12.0"
"vega-util": "^1.12.1"
},
"gitHead": "b460f55b7bdf668e855ed2f00d9c88f4e836dcb9"
"gitHead": "b690910bacfcb2580511e262400e496d9b14b04f"
}

@@ -243,3 +243,5 @@ function duplicate(_) {

"cornerRadiusBottomLeft": { "type": "number" },
"items": { "type": "array", "items": { "$ref": "#/refs/mark" } }
"items": { "type": "array", "items": { "$ref": "#/refs/mark" } },
"strokeForeground": { "type": "boolean" },
"strokeOffset": { "type": "number" }
}

@@ -246,0 +248,0 @@ },

@@ -1,4 +0,4 @@

import {HalfPi, Tau} from '../util/constants';
import {Epsilon, HalfPi, Tau} from '../util/constants';
var bounds,
var bounds, lx, ly,
circleThreshold = Tau - 1e-8;

@@ -15,2 +15,8 @@

function addL(x, y) { add(lx = x, ly = y); }
function addX(x) { add(x, bounds.y1); }
function addY(y) { add(bounds.x1, y); }
context.beginPath = noop;

@@ -20,67 +26,96 @@

context.moveTo = add;
context.moveTo = addL;
context.lineTo = add;
context.lineTo = addL;
context.rect = function(x, y, w, h) {
add(x, y);
add(x + w, y + h);
addL(x, y);
};
context.quadraticCurveTo = function(x1, y1, x2, y2) {
add(x1, y1);
add(x2, y2);
quadExtrema(lx, x1, x2, addX);
quadExtrema(ly, y1, y2, addY);
addL(x2, y2);
};
function quadExtrema(x0, x1, x2, cb) {
const t = (x0 - x1) / (x0 + x2 - 2 * x1);
if (0 < t && t < 1) cb(x0 + (x1 - x0) * t);
}
context.bezierCurveTo = function(x1, y1, x2, y2, x3, y3) {
add(x1, y1);
add(x2, y2);
add(x3, y3);
cubicExtrema(lx, x1, x2, x3, addX);
cubicExtrema(ly, y1, y2, y3, addY);
addL(x3, y3);
};
function cubicExtrema(x0, x1, x2, x3, cb) {
const a = x3 - x0 + 3 * x1 - 3 * x2,
b = x0 + x2 - 2 * x1,
c = x0 - x1;
let t0 = 0, t1 = 0, r;
// solve for parameter t
if (Math.abs(a) > Epsilon) {
// quadratic equation
r = b * b + c * a;
if (r >= 0) {
r = Math.sqrt(r);
t0 = (-b + r) / a;
t1 = (-b - r) / a;
}
} else {
// linear equation
t0 = 0.5 * c / b;
}
// calculate position
if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3));
if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3));
}
function cubic(t, x0, x1, x2, x3) {
const s = 1 - t, s2 = s * s, t2 = t * t;
return (s2 * s * x0) + (3 * s2 * t * x1) + (3 * s * t2 * x2) + (t2 * t * x3);
}
context.arc = function(cx, cy, r, sa, ea, ccw) {
// store last point on path
lx = r * Math.cos(ea) + cx;
ly = r * Math.sin(ea) + cy;
if (Math.abs(ea - sa) > circleThreshold) {
// treat as full circle
add(cx - r, cy - r);
add(cx + r, cy + r);
return;
}
} else {
const update = a => add(r * Math.cos(a) + cx, r * Math.sin(a) + cy);
let s, i;
var xmin = Infinity, xmax = -Infinity,
ymin = Infinity, ymax = -Infinity,
s, i, x, y;
// sample end points
update(sa);
update(ea);
function update(a) {
x = r * Math.cos(a);
y = r * Math.sin(a);
if (x < xmin) xmin = x;
if (x > xmax) xmax = x;
if (y < ymin) ymin = y;
if (y > ymax) ymax = y;
}
// sample interior points aligned with 90 degrees
if (ea !== sa) {
sa = sa % Tau; if (sa < 0) sa += Tau;
ea = ea % Tau; if (ea < 0) ea += Tau;
// Sample end points and interior points aligned with 90 degrees
update(sa);
update(ea);
if (ea < sa) {
ccw = !ccw; // flip direction
s = sa; sa = ea; ea = s; // swap end-points
}
if (ea !== sa) {
sa = sa % Tau; if (sa < 0) sa += Tau;
ea = ea % Tau; if (ea < 0) ea += Tau;
if (ea < sa) {
ccw = !ccw; // flip direction
s = sa; sa = ea; ea = s; // swap end-points
if (ccw) {
ea -= Tau;
s = sa - (sa % HalfPi);
for (i=0; i<4 && s>ea; ++i, s-=HalfPi) update(s);
} else {
s = sa - (sa % HalfPi) + HalfPi;
for (i=0; i<4 && s<ea; ++i, s=s+HalfPi) update(s);
}
}
if (ccw) {
ea -= Tau;
s = sa - (sa % HalfPi);
for (i=0; i<4 && s>ea; ++i, s-=HalfPi) update(s);
} else {
s = sa - (sa % HalfPi) + HalfPi;
for (i=0; i<4 && s<ea; ++i, s=s+HalfPi) update(s);
}
}
add(cx + xmin, cy + ymin);
add(cx + xmax, cy + ymax);
};

@@ -12,3 +12,8 @@ import {hasCornerRadius, rectangle} from '../path/shapes';

var StrokeOffset = 0.5;
function offset(item) {
var sw = (sw = item.strokeWidth) != null ? sw : 1;
return item.strokeOffset != null ? item.strokeOffset
: item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1)
: 0;
}

@@ -19,9 +24,22 @@ function attr(emit, item) {

function emitRectangle(emit, item) {
var off = offset(item);
emit('d', rectangle(null, item, off, off));
}
function background(emit, item) {
var offset = item.stroke ? StrokeOffset : 0;
emit('class', 'background');
emit('d', rectangle(null, item, offset, offset));
emitRectangle(emit, item);
}
function foreground(emit, item, renderer) {
function foreground(emit, item) {
emit('class', 'foreground');
if (item.strokeForeground) {
emitRectangle(emit, item);
} else {
emit('d', '');
}
}
function content(emit, item, renderer) {
var url = item.clip ? clip(renderer, item, item) : null;

@@ -48,9 +66,10 @@ emit('clip-path', url);

function backgroundPath(context, group) {
var offset = group.stroke ? StrokeOffset : 0;
function rectanglePath(context, group, x, y) {
var off = offset(group);
context.beginPath();
rectangle(context, group, offset, offset);
rectangle(context, group, (x || 0) + off, (y || 0) + off);
}
var hitBackground = hitPath(backgroundPath);
var hitBackground = hitPath(rectanglePath);
var hitForeground = hitPath(rectanglePath, false);

@@ -63,23 +82,19 @@ function draw(context, scene, bounds) {

gy = group.y || 0,
opacity;
fore = group.strokeForeground,
opacity = group.opacity == null ? 1 : group.opacity;
// setup graphics context
context.save();
context.translate(gx, gy);
// draw group background
if (group.stroke || group.fill) {
opacity = group.opacity == null ? 1 : group.opacity;
if (opacity > 0) {
backgroundPath(context, group);
if (group.fill && fill(context, group, opacity)) {
context.fill();
}
if (group.stroke && stroke(context, group, opacity)) {
context.stroke();
}
if ((group.stroke || group.fill) && opacity) {
rectanglePath(context, group, gx, gy);
if (group.fill && fill(context, group, opacity)) {
context.fill();
}
if (group.stroke && !fore && stroke(context, group, opacity)) {
context.stroke();
}
}
// set clip and bounds
// setup graphics context, set clip and bounds
context.save();
context.translate(gx, gy);
if (group.clip) clipGroup(context, group);

@@ -96,2 +111,10 @@ if (bounds) bounds.translate(-gx, -gy);

context.restore();
// draw group foreground
if (fore && group.stroke && opacity) {
rectanglePath(context, group, gx, gy);
if (stroke(context, group, opacity)) {
context.stroke();
}
}
});

@@ -110,3 +133,3 @@ }

return pickVisit(scene, function(group) {
var hit, dx, dy, dw, dh, b, c;
var hit, fore, ix, dx, dy, dw, dh, b, c;

@@ -134,5 +157,15 @@ // first hit test bounding box

context.restore();
return;
return null;
}
fore = group.strokeForeground;
ix = scene.interactive !== false;
// hit test against group foreground
if (ix && fore && group.stroke
&& hitForeground(context, group, cx, cy)) {
context.restore();
return group;
}
// hit test against contained marks

@@ -146,4 +179,3 @@ hit = pickVisit(group, function(mark) {

// hit test against group background
if (!hit && scene.interactive !== false
&& (group.fill || group.stroke)
if (!hit && ix && (group.fill || (!fore && group.stroke))
&& hitBackground(context, group, cx, cy)) {

@@ -173,4 +205,5 @@ hit = group;

isect: intersectRect,
content: content,
background: background,
foreground: foreground
};

@@ -209,2 +209,3 @@ import Renderer from './Renderer';

}
domClear(el, 1);

@@ -352,3 +353,3 @@ return index + 1;

function recurse(renderer, el, group) {
el = el.lastChild;
el = el.lastChild.previousSibling;
var prev, idx = 0;

@@ -380,12 +381,16 @@

// if group, create background and foreground elements
// if group, create background, content, and foreground elements
if (tag === 'g') {
var bg = domCreate(doc, 'path', ns);
bg.setAttribute('class', 'background');
node.appendChild(bg);
bg.__data__ = item;
var fg = domCreate(doc, 'g', ns);
var cg = domCreate(doc, 'g', ns);
node.appendChild(cg);
cg.__data__ = item;
var fg = domCreate(doc, 'path', ns);
node.appendChild(fg);
fg.__data__ = item;
fg.__values__ = {fill: 'default'};
}

@@ -418,8 +423,13 @@ }

group: function(mdef, el, item) {
values = el.__values__; // use parent's values hash
var fg, bg;
element = el.childNodes[1];
element = fg = el.childNodes[2];
values = fg.__values__;
mdef.foreground(emit, item, this);
element = el.childNodes[0];
values = el.__values__; // use parent's values hash
element = el.childNodes[1];
mdef.content(emit, item, this);
element = bg = el.childNodes[0];
mdef.background(emit, item, this);

@@ -429,5 +439,28 @@

if (value !== values.events) {
element.style.setProperty('pointer-events', value);
fg.style.setProperty('pointer-events', value);
bg.style.setProperty('pointer-events', value);
values.events = value;
}
if (item.strokeForeground && item.stroke) {
const fill = item.fill;
fg.style.removeProperty('display');
// set style of background
this.style(bg, item);
bg.style.removeProperty('stroke');
// set style of foreground
if (fill) item.fill = null;
values = fg.__values__;
this.style(fg, item);
if (fill) item.fill = fill;
// leave element null to prevent downstream styling
element = null;
} else {
// ensure foreground is ignored
fg.style.setProperty('display', 'none');
fg.style.setProperty('fill', 'none');
}
},

@@ -510,3 +543,3 @@ image: function(mdef, el, item) {

// note: element may be modified by 'extra' method
this.style(element, item);
if (element) this.style(element, item);
};

@@ -513,0 +546,0 @@

@@ -250,8 +250,29 @@ import Renderer from './Renderer';

} else if (tag === 'g') {
const fore = item.strokeForeground,
fill = item.fill,
stroke = item.stroke;
if (fore && stroke) {
item.stroke = null;
}
str += openTag('path', renderer.attributes(mdef.background, item),
applyStyles(item, scene, 'bgrect', defs)) + closeTag('path');
str += openTag('g', renderer.attributes(mdef.foreground, item))
str += openTag('g', renderer.attributes(mdef.content, item))
+ renderer.markGroup(item)
+ closeTag('g');
if (fore && stroke) {
if (fill) item.fill = null;
item.stroke = stroke;
str += openTag('path', renderer.attributes(mdef.foreground, item),
applyStyles(item, scene, 'bgrect', defs)) + closeTag('path');
if (fill) item.fill = fill;
} else {
str += openTag('path', renderer.attributes(mdef.foreground, item),
applyStyles({}, scene, 'bgfore', defs)) + closeTag('path');
}
}

@@ -292,2 +313,9 @@

if (tag === 'bgfore') {
if (mark.interactive === false) {
s += 'pointer-events: none; ';
}
s += 'display: none; ';
}
if (tag === 'image') {

@@ -294,0 +322,0 @@ if (o.smooth === false) {

@@ -1,4 +0,5 @@

export var DegToRad = Math.PI / 180;
export var HalfPi = Math.PI / 2;
export var Tau = Math.PI * 2;
export var HalfSqrt3 = Math.sqrt(3) / 2;
export const DegToRad = Math.PI / 180;
export const Epsilon = 1e-14;
export const HalfPi = Math.PI / 2;
export const Tau = Math.PI * 2;
export const HalfSqrt3 = Math.sqrt(3) / 2;

@@ -9,2 +9,3 @@ import boundMark from '../bound/boundMark';

'strokeDash', 'strokeDashOffset', // stroke dash
'strokeForeground', 'strokeOffset', // group
'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc

@@ -11,0 +12,0 @@ 'cornerRadius', 'padAngle', // arc, rect

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc