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.0.2 to 4.1.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.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;function l(t){this.mark=t,this.bounds=this.bounds||new s}function h(t){l.call(this,t),this.items=this.items||[]}function c(t){this._pending=0,this._loader=t||i.loader()}e.inherits(h,l);var f=c.prototype;function d(t){t._pending+=1}function v(t){t._pending-=1}f.pending=function(){return this._pending},f.sanitizeURL=function(t){var e=this;return d(e),e._loader.sanitize(t,{context:"href"}).then(function(t){return v(e),t}).catch(function(){return v(e),null})},f.loadImage=function(t){var e=this,i=n.image();return d(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(){v(e),r.loaded=!0},r.onerror=function(){v(e),r.loaded=!1},r.src=n,r}).catch(function(t){return v(e),{loaded:!1,width:0,height:0,src:t&&t.url||""}})},f.ready=function(){var t=this;return new Promise(function(e){!function n(i){t.pending()?setTimeout(function(){n(!0)},10):e(i)}(!1)})};var g={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 p(t,e,n){var i=g.hasOwnProperty(t)&&g[t],r=null;return i&&(r=i.curve||i[e||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}var y={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},_=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function m(t){var e,n,i,r,o,s,a,u,l,h,c,f=[];for(u=0,h=(e=t.slice().replace(_[0],"###$1").split(_[1]).slice(1)).length;u<h;++u){for(i=(n=e[u]).slice(1).trim().replace(_[2],"$1###$2").split(_[3]),r=[s=n.charAt(0)],l=0,c=i.length;l<c;++l)(o=+i[l])===o&&r.push(o);if(a=y[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 x=Math.PI/180,b=Math.PI/2,k=2*Math.PI,w=Math.sqrt(3)/2,T={},M={},A=[].join;function z(t){var e=A.call(t);if(M[e])return M[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),_=.5*(o-r),m=Math.sin(.5*_),x=8/3*m*m/Math.sin(_),b=n+v-x*g,k=i+g+x*v,w=n+p,T=i+y,z=w+x*y,C=T-x*p;return M[e]=[h*b+c*k,f*b+d*k,h*z+c*C,f*z+d*C,h*w+c*T,f*w+d*T]}var C=["l",0,0,0,0,0,0,0];function P(t,e){var n=C[0]=t[0];if("a"===n||"A"===n)C[1]=e*t[1],C[2]=e*t[2],C[3]=t[3],C[4]=t[4],C[5]=t[5],C[6]=e*t[6],C[7]=e*t[7];else for(var i=1,r=t.length;i<r;++i)C[i]=e*t[i];return C}function S(t,e,n,i,r){var o,s,a,u,l,h=null,c=0,f=0,d=0,v=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),t.beginPath&&t.beginPath();for(var g=0,p=e.length;g<p;++g){switch(o=e[g],1!==r&&(o=P(o,r)),o[0]){case"l":c+=o[1],f+=o[2],t.lineTo(c+n,f+i);break;case"L":c=o[1],f=o[2],t.lineTo(c+n,f+i);break;case"h":c+=o[1],t.lineTo(c+n,f+i);break;case"H":c=o[1],t.lineTo(c+n,f+i);break;case"v":f+=o[1],t.lineTo(c+n,f+i);break;case"V":f=o[1],t.lineTo(c+n,f+i);break;case"m":c+=o[1],f+=o[2],t.moveTo(c+n,f+i);break;case"M":c=o[1],f=o[2],t.moveTo(c+n,f+i);break;case"c":s=c+o[5],a=f+o[6],d=c+o[3],v=f+o[4],t.bezierCurveTo(c+o[1]+n,f+o[2]+i,d+n,v+i,s+n,a+i),c=s,f=a;break;case"C":c=o[5],f=o[6],d=o[3],v=o[4],t.bezierCurveTo(o[1]+n,o[2]+i,d+n,v+i,c+n,f+i);break;case"s":s=c+o[3],a=f+o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,c+o[1]+n,f+o[2]+i,s+n,a+i),d=c+o[1],v=f+o[2],c=s,f=a;break;case"S":s=o[3],a=o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"q":s=c+o[3],a=f+o[4],d=c+o[1],v=f+o[2],t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"Q":s=o[3],a=o[4],t.quadraticCurveTo(o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"t":s=c+o[1],a=f+o[2],null===h[0].match(/[QqTt]/)?(d=c,v=f):"t"===h[0]?(d=2*c-u,v=2*f-l):"q"===h[0]&&(d=2*c-d,v=2*f-v),u=d,l=v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),f=a,d=(c=s)+o[1],v=f+o[2];break;case"T":s=o[1],a=o[2],d=2*c-d,v=2*f-v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"a":L(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+c+n,o[7]+f+i]),c+=o[6],f+=o[7];break;case"A":L(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+i]),c=o[6],f=o[7];break;case"z":case"Z":t.closePath()}h=o}}function L(t,e,n,i){for(var r=function(t,e,n,i,r,o,s,a,u){var l=A.call(arguments);if(T[l])return T[l];var h=s*x,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,_=-c/i,m=f/i,w=p*a+y*u,M=_*a+m*u,z=p*t+y*e,C=_*t+m*e,P=1/((z-w)*(z-w)+(C-M)*(C-M))-.25;P<0&&(P=0);var S=Math.sqrt(P);o==r&&(S=-S);var L=.5*(w+z)-S*(C-M),R=.5*(M+C)+S*(z-w),q=Math.atan2(M-R,w-L),N=Math.atan2(C-R,z-L)-q;N<0&&1===o?N+=k:N>0&&0===o&&(N-=k);for(var O=Math.ceil(Math.abs(N/(b+.001))),E=[],I=0;I<O;++I){var D=q+I*N/O,V=q+(I+1)*N/O;E[I]=[L,R,D,V,n,i,c,f]}return T[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=z(r[o]);t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}var R={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,k)}},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=w*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=w*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=w*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=w*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=w*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=w*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 q(t){return R.hasOwnProperty(t)?R[t]:function(t){if(!N.hasOwnProperty(t)){var e=m(t);N[t]={draw:function(t,n){S(t,e,0,0,Math.sqrt(n)/2)}}}return N[t]}(t)}var N={};function O(t){return t.x}function E(t){return t.y}function I(t){return t.width}function D(t){return t.height}function V(t){return function(){return t}}function H(){var t=O,e=E,n=I,i=D,r=V(0),s=null;function a(a,u,l){var h,c=null!=u?u:+t.call(this,a),f=null!=l?l:+e.call(this,a),d=+n.call(this,a),v=+i.call(this,a),g=+r.call(this,a);if(s||(s=h=o.path()),g<=0)s.rect(c,f,d,v);else{var p=c+d,y=f+v;s.moveTo(c+g,f),s.lineTo(p-g,f),s.quadraticCurveTo(p,f,p,f+g),s.lineTo(p,y-g),s.quadraticCurveTo(p,y,p-g,y),s.lineTo(c+g,y),s.quadraticCurveTo(c,y,c,y-g),s.lineTo(c,f+g),s.quadraticCurveTo(c,f,c+g,f),s.closePath()}if(h)return s=null,h+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:V(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:V(+t),a):e},a.width=function(t){return arguments.length?(n="function"==typeof t?t:V(+t),a):n},a.height=function(t){return arguments.length?(i="function"==typeof t?t:V(+t),a):i},a.cornerRadius=function(t){return arguments.length?(r="function"==typeof t?t:V(+t),a):r},a.context=function(t){return arguments.length?(s=null==t?null:t,a):s},a}function W(){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,k);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 B(t){return t.x||0}function G(t){return t.y||0}function j(t){return t.cornerRadius||0}function U(t){return!(!1===t.defined)}var X=r.arc().startAngle(function(t){return t.startAngle||0}).endAngle(function(t){return t.endAngle||0}).padAngle(function(t){return t.padAngle||0}).innerRadius(function(t){return t.innerRadius||0}).outerRadius(function(t){return t.outerRadius||0}).cornerRadius(j),J=r.area().x(B).y1(G).y0(function(t){return(t.y||0)+(t.height||0)}).defined(U),F=r.area().y(G).x1(B).x0(function(t){return(t.x||0)+(t.width||0)}).defined(U),Q=r.line().x(B).y(G).defined(U),Y=H().x(B).y(G).width(function(t){return t.width||0}).height(function(t){return t.height||0}).cornerRadius(j),Z=r.symbol().type(function(t){return q(t.shape||"circle")}).size(function(t){return null==t.size?64:t.size}),$=W().x(B).y(G).defined(U).size(function(t){return t.size||1});function K(t,e,n,i){return Y.context(t)(e,n,i)}function tt(t,e){return e.stroke&&0!==e.opacity&&0!==e.strokeOpacity&&t.expand(null!=e.strokeWidth?+e.strokeWidth:1),t}var et,nt=k-1e-8;function it(t){return et=t,it}function rt(){}function ot(t,e){et.add(t,e)}it.beginPath=rt,it.closePath=rt,it.moveTo=ot,it.lineTo=ot,it.rect=function(t,e,n,i){ot(t,e),ot(t+n,e+i)},it.quadraticCurveTo=function(t,e,n,i){ot(t,e),ot(n,i)},it.bezierCurveTo=function(t,e,n,i,r,o){ot(t,e),ot(n,i),ot(r,o)},it.arc=function(t,e,n,i,r,o){if(Math.abs(r-i)>nt)return ot(t-n,e-n),void ot(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%=k)<0&&(i+=k),(r%=k)<0&&(r+=k),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=k,s=i-i%b,a=0;a<4&&s>r;++a,s-=b)v(s);else for(s=i-i%b+b,a=0;a<4&&s<r;++a,s+=b)v(s);ot(t+h,e+f),ot(t+c,e+d)};var st=(st=n.canvas(1,1))?st.getContext("2d"):null;const at=new s;function ut(t){return function(e,n){if(!st)return!0;t(st,e),at.clear().union(e.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:s}=at;for(let t=r;t<=s;++t)for(let e=i;e<=o;++e)if(st.isPointInPath(e,t))return!0;return!1}}function lt(t,e){return e.contains(t.x||0,t.y||0)}function ht(t,e){const n=t.x||0,i=t.y||0,r=t.width||0,o=t.height||0;return e.intersects(at.set(n,i,n+r,i+o))}function ct(t,e){const n=t.x||0,i=t.y||0;return ft(e,n,i,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i)}function ft(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 dt(t,e,n){return n.id?function(t,e,n){for(var i=n.width(),r=n.height(),o=n.x1+e.x1*i,s=n.y1+e.y1*r,a=n.x1+e.x2*i,u=n.y1+e.y2*r,l=e.stops,h=0,c=l.length,f=t.createLinearGradient(o,s,a,u);h<c;++h)f.addColorStop(l[h].offset,l[h].color);return f}(t,n,e.bounds):n}function vt(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=dt(t,e,e.fill),!0)}var gt=[];function pt(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=dt(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||gt),t.lineDashOffset=e.strokeDashOffset||0),!0))}function yt(t,e){return t.zindex-e.zindex||t.index-e.index}function _t(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(yt)}function mt(t,e){var n,i,r=t.items;if(r&&r.length){var o=_t(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 xt(t,e){var n,i,r=t.items;if(!r||!r.length)return null;var o=_t(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 bt(t){return function(e,n,i){mt(n,function(n){i&&!i.intersects(n.bounds)||kt(t,e,n,n)})}}function kt(t,e,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(t(e,i)||(n.fill&&vt(e,n,r)&&e.fill(),n.stroke&&pt(e,n,r)&&e.stroke()))}function wt(t){return t=t||e.truthy,function(e,n,i,r,o,s){return i*=e.pixelRatio,r*=e.pixelRatio,xt(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 Tt(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 Mt(t){return wt(Tt(t))}function At(t,e){return"translate("+t+","+e+")"}function zt(t){return"rotate("+t+")"}function Ct(t){return At(t.x||0,t.y||0)}function Pt(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*=x),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",function(t){return At(t.x||0,t.y||0)+(t.angle?" "+zt(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){var i=n.x||0,r=n.y||0;return e(it(t),n),tt(t,n).translate(i,r),n.angle&&t.rotate(n.angle*x,i,r),t},draw:bt(i),pick:Mt(i),isect:n||ut(i)}}var St=Pt("arc",function(t,e){return X.context(t)(e)});function Lt(t,e,n){function i(t,n){t.beginPath(),e(t,n)}var r,o=Tt(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(it(t),i),tt(t,i[0]))},draw:(r=i,function(t,e,n){!e.items.length||n&&!n.intersects(e.bounds)||kt(r,t,e.items[0],e.items)}),pick:function(t,e,n,i,r,s){var a=e.items,u=e.bounds;return!a||!a.length||u&&!u.contains(r,s)?null:(n*=t.pixelRatio,i*=t.pixelRatio,o(t,a,n,i)?a[0]:null)},isect:lt,tip:n}}var Rt=Lt("area",function(t,e){var n=e[0],i=n.interpolate||"linear";return("horizontal"===n.orient?F:J).curve(p(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}),qt=1;function Nt(t,n,i){var r=n.clip,o=t._defs,s=n.clip_id||(n.clip_id="clip"+qt++),a=o.clipping[s]||(o.clipping[s]={id:s});return e.isFunction(r)?a.path=r(null):(a.width=i.width||0,a.height=i.height||0),"url(#"+s+")"}var Ot=.5;function Et(t,e){var n=e.stroke?Ot:0;t.beginPath(),K(t,e,n,n)}var It=Tt(Et);var Dt={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Ct(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),tt(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var i=this;mt(e,function(e){var r,o=e.x||0,s=e.y||0,a=e.width||0,u=e.height||0;t.save(),t.translate(o,s),(e.stroke||e.fill)&&(r=null==e.opacity?1:e.opacity)>0&&(Et(t,e),e.fill&&vt(t,e,r)&&t.fill(),e.stroke&&pt(t,e,r)&&t.stroke()),e.clip&&(t.beginPath(),t.rect(0,0,a,u),t.clip()),n&&n.translate(-o,-s),mt(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 xt(e,function(l){var h,c,f,d;if(!(d=l.bounds)||d.contains(r,o))return c=l.x||0,f=l.y||0,t.save(),t.translate(c,f),c=r-c,f=o-f,!(h=xt(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)&&It(t,l,a,u)&&(h=l),t.restore(),h||null})},isect:ht,background:function(t,e){var n=e.stroke?Ot:0;t("class","background"),t("d",K(null,e,n,n))},foreground:function(t,e,n){t("clip-path",e.clip?Nt(n,e,e):null)}};function Vt(t,e){var n=t.image;return n&&n.url===t.url||(n={loaded:!1,width:0,height:0},e.loadImage(t.url).then(function(e){t.image=e,t.image.url=t.url})),n}function Ht(t,e){return"center"===t?e/2:"right"===t?e:0}function Wt(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var Bt={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var i=Vt(e,n),r=e.x||0,o=e.y||0,s=(null!=e.width?e.width:i.width)||0,a=(null!=e.height?e.height:i.height)||0,u=!1===e.aspect?"none":"xMidYMid";r-=Ht(e.align,s),o-=Wt(e.baseline,a),t("href",i.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",At(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=(null!=e.width?e.width:n&&n.width)||0,s=(null!=e.height?e.height:n&&n.height)||0;return i-=Ht(e.align,o),r-=Wt(e.baseline,s),t.set(i,r,i+o,r+s)},draw:function(t,e,n){var i=this;mt(e,function(e){if(!n||n.intersects(e.bounds)){var r,o,s,a,u=Vt(e,i),l=e.x||0,h=e.y||0,c=(null!=e.width?e.width:u.width)||0,f=(null!=e.height?e.height:u.height)||0;l-=Ht(e.align,c),h-=Wt(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.loaded&&(t.globalAlpha=null!=(r=e.opacity)?r:1,t.drawImage(u,l,h,c,f))}})},pick:wt(),isect:e.truthy,get:Vt,xOffset:Ht,yOffset:Wt},Gt=Lt("line",function(t,e){var n=e[0],i=n.interpolate||"linear";return Q.curve(p(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 jt(t,e){var n=e.path;if(null==n)return!0;var i=e.pathCache;i&&i.path===n||((e.pathCache=i=m(n)).path=n),S(t,i,e.x,e.y)}var Ut={type:"path",tag:"path",nested:!1,attr:function(t,e){t("transform",Ct(e)),t("d",e.path)},bound:function(t,e){return jt(it(t),e)?t.set(0,0,0,0):tt(t,e)},draw:bt(jt),pick:Mt(jt),isect:ut(jt)};function Xt(t,e){t.beginPath(),K(t,e)}var Jt={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",K(null,e))},bound:function(t,e){var n,i;return tt(t.set(n=e.x||0,i=e.y||0,n+e.width||0,i+e.height||0),e)},draw:bt(Xt),pick:Mt(Xt),isect:ht};function Ft(t,e,n){var i,r,o,s;return!(!e.stroke||!pt(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 Qt,Yt={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",Ct(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 tt(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){mt(e,function(e){if(!n||n.intersects(e.bounds)){var i=null==e.opacity?1:e.opacity;i&&Ft(t,e,i)&&t.stroke()}})},pick:wt(function(t,e,n,i){return!!t.isPointInStroke&&Ft(t,e,1)&&t.isPointInStroke(n,i)}),isect:ct},Zt=Pt("shape",function(t,e){return(e.mark.shape||e.shape).context(t)(e)}),$t=Pt("symbol",function(t,e){return Z.context(t)(e)},lt),Kt={height:re,measureWidth:ne,estimateWidth:te,width:te,canvas:oe};function te(t){return Qt=re(t),ee(se(t))}function ee(t){return~~(.8*t.length*Qt)}function ne(t){return re(t)<=0?0:(st.font=ue(t),ie(se(t)))}function ie(t){return st.measureText(t).width}function re(t){return null!=t.fontSize?t.fontSize:11}function oe(t){Kt.width=t&&st?ne:te}function se(t){var e=t.text;return null==e?"":t.limit>0?function(t){var e,n=+t.limit,i=t.text+"";Kt.width===ne?(st.font=ue(t),e=ie):(Qt=re(t),e=ee);if(e(i)<n)return i;var r,o=t.ellipsis||"…",s="rtl"===t.dir,a=0,u=i.length;if(n-=e(o),s){for(;a<u;)r=a+u>>>1,e(i.slice(r))>n?a=r+1:u=r;return o+i.slice(a)}for(;a<u;)r=1+(a+u>>>1),e(i.slice(0,r))<n?a=r:u=r-1;return i.slice(0,a)+o}(t):e+""}function ae(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function ue(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+re(t)+"px "+ae(t,e)}function le(t){var e=t.baseline,n=re(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}oe(!0);var he={left:"start",center:"middle",right:"end"},ce=new s;function fe(t){var e,n=t.x||0,i=t.y||0,r=t.radius||0;return r&&(e=(t.theta||0)-b,n+=r*Math.cos(e),i+=r*Math.sin(e)),ce.x1=n,ce.y1=i,ce}function de(t,e,n){var i,r=Kt.height(e),o=e.align,s=fe(e),a=s.x1,u=s.y1,l=e.dx||0,h=(e.dy||0)+le(e)-Math.round(.8*r);if(i=Kt.width(e),"center"===o?l-=i/2:"right"===o&&(l-=i),t.set(l+=a,h+=u,l+i,h+r),e.angle&&!n)t.rotate(e.angle*x,a,u);else if(2===n)return t.rotatedPoints(e.angle*x,a,u);return t}var ve={arc:St,area:Rt,group:Dt,image:Bt,line:Gt,path:Ut,rect:Jt,rule:Yt,shape:Zt,symbol:$t,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,i=e.dx||0,r=(e.dy||0)+le(e),o=fe(e),s=o.x1,a=o.y1,u=e.angle||0;t("text-anchor",he[e.align]||"start"),u?(n=At(s,a)+" "+zt(u),(i||r)&&(n+=" "+At(i,r))):n=At(s+i,a+r),t("transform",n)},bound:de,draw:function(t,e,n){mt(e,function(e){var i,r,o,s,a;n&&!n.intersects(e.bounds)||(a=se(e))&&(0===(i=null==e.opacity?1:e.opacity)||e.fontSize<=0||(t.font=ue(e),t.textAlign=e.align||"left",o=(r=fe(e)).x1,s=r.y1,e.angle&&(t.save(),t.translate(o,s),t.rotate(e.angle*x),o=s=0),o+=e.dx||0,s+=(e.dy||0)+le(e),e.fill&&vt(t,e,i)&&t.fillText(a,o,s),e.stroke&&pt(t,e,i)&&t.strokeText(a,o,s),e.angle&&t.restore()))})},pick:wt(function(t,e,n,i,r,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var s=fe(e),a=s.x1,u=s.y1,l=de(ce,e,1),h=-e.angle*x,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=de(ce,t,2);return ft(e,n[0],n[1],n[2],n[3])||ft(e,n[0],n[1],n[4],n[5])||ft(e,n[4],n[5],n[6],n[7])||ft(e,n[2],n[3],n[6],n[7])}},trail:Lt("trail",function(t,e){return $.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 ge(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 pe={mark:null};function ye(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]:(pe.mark=t,o=pe),a=ge(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(ge(h[i],l,n));return t.bounds=e}var _e=["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","interpolate","tension","orient","defined","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];function me(t,e){return JSON.stringify(t,_e,e)}function xe(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&&ye(e);return e}("string"==typeof t?JSON.parse(t):t)}function be(t){arguments.length?this.root=xe(t):(this.root=we({marktype:"group",name:"root",role:"frame"}),this.root.items=[new h(this.root)])}var ke=be.prototype;function we(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 Te(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function Me(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 Ae(t,e,n,i){var r,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=Te(t.ownerDocument,n,i),t.insertBefore(o,r)),o}function ze(t,e){for(var n=t.childNodes,i=n.length;i>e;)t.removeChild(n[--i]);return t}function Ce(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Pe(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Se(t,e){this._active=null,this._handlers={},this._loader=t||i.loader(),this._tooltip=e||Le}function Le(t,e,n,i){t.element().setAttribute("title",i||"")}ke.toJSON=function(t){return me(this.root,t||0)},ke.mark=function(t,e,n){var i=we(t,e=e||this.root.items[0]);return e.items[n]=i,i.zindex&&(i.group.zdirty=!0),i};var Re=Se.prototype;function qe(t){this._el=null,this._bgcolor=null,this._loader=new c(t)}Re.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Re.element=function(){return this._el},Re.canvas=function(){return this._el&&this._el.firstChild},Re.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Re.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Re.on=function(){},Re.off=function(){},Re._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},Re.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},Re.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Re.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(function(e){var n=new MouseEvent(t.type,t),i=Te(null,"a");for(var r in e)i.setAttribute(r,e[r]);i.dispatchEvent(n)}).catch(function(){})},Re.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=Pe(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)}},Re.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 Ne=qe.prototype;Ne.initialize=function(t,e,n,i,r){return this._el=t,this.resize(e,n,i,r)},Ne.element=function(){return this._el},Ne.canvas=function(){return this._el&&this._el.firstChild},Ne.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},Ne.resize=function(t,e,n,i){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=i||1,this},Ne.dirty=function(){},Ne.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},Ne._render=function(){},Ne.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then(function(){return e}):Promise.resolve(e)},Ne._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},Ne.sanitizeURL=function(t){return this._load("sanitizeURL",t)},Ne.loadImage=function(t){return this._load("loadImage",t)};var Oe="mouseout";function Ee(t,e){Se.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var Ie=e.inherits(Ee,Se);function De(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 Ve(t){return function(e){this.fire(t,e),this._active=null}}Ie.initialize=function(t,e,n){var i=this._canvas=t&&Me(t,"canvas");if(i){var r=this;this.events.forEach(function(t){i.addEventListener(t,function(e){Ie[t]?Ie[t].call(r,e):r.fire(t,e)})})}return Se.prototype.initialize.call(this,t,e,n)},Ie.canvas=function(){return this._canvas},Ie.context=function(){return this._canvas.getContext("2d")},Ie.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Ie.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Ie.mousemove=De("mousemove","mouseover","mouseout"),Ie.dragover=De("dragover","dragenter","dragleave"),Ie.mouseout=Ve("mouseout"),Ie.dragleave=Ve("dragleave"),Ie.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},Ie.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},Ie.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Ie.touchmove=function(t){this.fire("touchmove",t,!0)},Ie.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Ie.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!==Oe||this.handleTooltip(e,o,t!==Oe),s)for(i=0,r=s.length;i<r;++i)s[i].handler.call(this._obj,e,o)},Ie.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},Ie.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},Ie.pickEvent=function(t){var e=Pe(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},Ie.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 He="undefined"!=typeof window&&window.devicePixelRatio||1;function We(t){qe.call(this,t),this._redraw=!1,this._dirty=new s}var Be=e.inherits(We,qe),Ge=qe.prototype,je=new s;function Ue(t,e){Se.call(this,t,e);var n=this;n._hrefHandler=Je(n,function(t,e){e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=Je(n,function(t,e){n.handleTooltip(t,e,t.type!==Oe)})}Be.initialize=function(t,e,i,r,o,s){return this._options=s,this._canvas=n.canvas(1,1,s&&s.type),t&&(ze(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Ge.initialize.call(this,t,e,i,r,o)},Be.resize=function(t,e,n,i){return Ge.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?He: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},Be.canvas=function(){return this._canvas},Be.context=function(){return this._canvas?this._canvas.getContext("2d"):null},Be.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=je.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)},Be._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=null):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,n),this.clear(-n[0],-n[1],i,r),this.draw(e,t,o),e.restore(),this._dirty.clear(),this},Be.draw=function(t,n,i){var r=ve[n.marktype];n.clip&&function(t,n){var i=n.clip;if(t.save(),t.beginPath(),e.isFunction(i))i(t);else{var r=n.group;t.rect(0,0,r.width||0,r.height||0)}t.clip()}(t,n),r.draw.call(this,t,n,i),n.clip&&t.restore()},Be.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 Xe=e.inherits(Ue,Se);function Je(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 Fe(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 Qe(t){return"</"+t+">"}Xe.initialize=function(t,e,n){var i=this._svg;return i&&(i.removeEventListener("click",this._hrefHandler),i.removeEventListener("mousemove",this._tooltipHandler),i.removeEventListener(Oe,this._tooltipHandler)),this._svg=i=t&&Me(t,"svg"),i&&(i.addEventListener("click",this._hrefHandler),i.addEventListener("mousemove",this._tooltipHandler),i.addEventListener(Oe,this._tooltipHandler)),Se.prototype.initialize.call(this,t,e,n)},Xe.canvas=function(){return this._svg},Xe.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:Je(this,e)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},Xe.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 Ye={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},Ze={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"},$e=Object.keys(Ze),Ke=Ye.xmlns;function tn(t){qe.call(this,t),this._dirtyID=1,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var en=e.inherits(tn,qe),nn=qe.prototype;function rn(t,e,n){var i,r,o;for((t=Ae(t,n,"linearGradient",Ke)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2),i=0,r=e.stops.length;i<r;++i)(o=Ae(t,i,"stop",Ke)).setAttribute("offset",e.stops[i].offset),o.setAttribute("stop-color",e.stops[i].color);ze(t,i)}function on(t,e,n){var i;(t=Ae(t,n,"clipPath",Ke)).setAttribute("id",e.id),e.path?(i=Ae(t,0,"path",Ke)).setAttribute("d",e.path):((i=Ae(t,0,"rect",Ke)).setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",e.width),i.setAttribute("height",e.height))}function sn(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 an(t,e,n,i,r){var o,s=t._svg;if(!s&&(s=Te(o=e.ownerDocument,i,Ke),t._svg=s,t.mark&&(s.__data__=t,s.__values__={fill:"default"},"g"===i))){var a=Te(o,"path",Ke);a.setAttribute("class","background"),s.appendChild(a),a.__data__=t;var u=Te(o,"g",Ke);s.appendChild(u),u.__data__=t}return(s.ownerSVGElement!==r||function(t){var e=t.mark||t.group;return e&&e.items.length>1}(t)&&s.previousSibling!==n)&&e.insertBefore(s,n?n.nextSibling:e.firstChild),s}en.initialize=function(t,e,n,i){return t&&(this._svg=Ae(t,0,"svg",Ke),this._svg.setAttribute("class","marks"),ze(t,1),this._root=Ae(this._svg,0,"g",Ke),ze(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),nn.initialize.call(this,t,e,n,i)},en.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),nn.background.apply(this,arguments)},en.resize=function(t,e,n,i){return nn.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},en.canvas=function(){return this._svg},en.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 Ye)t[e]=Ye[e];var n=this._bgcolor?Fe("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+Qe("rect"):"";return Fe("svg",t)+n+this._svg.innerHTML+Qe("svg")},en._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),ze(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},en.updateDefs=function(){var t,e=this._svg,n=this._defs,i=n.el,r=0;for(t in n.gradient)i||(n.el=i=Ae(e,0,"defs",Ke)),rn(i,n.gradient[t],r++);for(t in n.clipping)i||(n.el=i=Ae(e,0,"defs",Ke)),on(i,n.clipping[t],r++);i&&(0===r?(e.removeChild(i),n.el=null):ze(i,r))},en._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},en.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},en.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},en._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length)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,sn(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,sn(e,u)),e._update=u));return!this._dirtyAll},en.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=an(t,i,l,s.tag,o);e&&(r._update(s,n,t),u&&function(t,e,n){e=e.lastChild;var i,r=0;mt(n,function(n){i=t.draw(e,n,i),++r}),ze(e,1+r)}(r,n,t)),l=n,++h}return(i=an(e,t,n,"g",o)).setAttribute("class",Ce(e)),u||i.style.setProperty("pointer-events",a),e.clip?i.setAttribute("clip-path",Nt(r,e,e.group)):i.removeAttribute("clip-path"),s.nested?e.items.length&&c(e.items[0]):mt(e,c),ze(i,h),i};var un=null,ln=null,hn={group:function(t,e,n){ln=e.__values__,un=e.childNodes[1],t.foreground(fn,n,this),un=e.childNodes[0],t.background(fn,n,this);var i=!1===n.mark.interactive?"none":null;i!==ln.events&&(un.style.setProperty("pointer-events",i),ln.events=i)},text:function(t,e,n){var i;(i=se(n))!==ln.text&&(e.textContent=i,ln.text=i),cn(e,"font-family",ae(n)),cn(e,"font-size",re(n)+"px"),cn(e,"font-style",n.fontStyle),cn(e,"font-variant",n.fontVariant),cn(e,"font-weight",n.fontWeight)}};function cn(t,e,n){n!==ln[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),ln[e]=n)}function fn(t,e,n){e!==ln[t]&&(null!=e?n?un.setAttributeNS(n,t,e):un.setAttribute(t,e):n?un.removeAttributeNS(n,t):un.removeAttribute(t),ln[t]=e)}function dn(t){qe.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}en._update=function(t,e,n){un=e,ln=e.__values__,t.attr(fn,n,this);var i=hn[t.type];i&&i.call(this,t,e,n),this.style(un,n)},en.style=function(t,e){var n,i,r,o,s,a;if(null!=e)for(n=0,i=$e.length;n<i;++n)s=e[r=$e[n]],"font"===r&&(s=ae(e)),s!==ln[r]&&(o=Ze[r],null==s?"fill"===o?t.style.setProperty(o,"none"):t.style.removeProperty(o):(s.id&&(this._defs.gradient[s.id]=s,s="url("+(a=void 0,"undefined"==typeof window?"":(a=window.location).hash?a.href.slice(0,-a.hash.length):a.href)+"#"+s.id+")"),t.style.setProperty(o,s+"")),ln[r]=s)};var vn,gn=e.inherits(dn,qe),pn=qe.prototype;function yn(t,e,n,i){vn[i||t]=e}function _n(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; "),"text"===n&&(l+="font-family: "+ae(t)+"; ",l+="font-size: "+re(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=$e.length;r<o;++r)s=$e[r],a=Ze[s],null==(u=t[s])?"fill"===a&&(l+="fill: none; "):"transparent"!==u||"fill"!==a&&"stroke"!==a?(u.id&&(i.gradient[u.id]=u,u="url(#"+u.id+")"),l+=a+": "+u+"; "):l+=a+": none; ";return l?'style="'+l.trim()+'"':null}gn.resize=function(t,e,n,i){pn.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 Ye)s[a]=Ye[a];o.head=Fe("svg",s);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),o.bg=u?Fe("rect",{width:this._width,height:this._height,style:"fill: "+u+";"})+Qe("rect"):"",o.root=Fe("g",{transform:"translate("+r+")"}),o.foot=Qe("g")+Qe("svg"),this},gn.background=function(){var t=pn.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=this._defs,o="";for(e in r.gradient){for(i=(n=r.gradient[e]).stops,o+=Fe("linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<i.length;++t)o+=Fe("stop",{offset:i[t].offset,"stop-color":i[t].color})+Qe("stop");o+=Qe("linearGradient")}for(e in r.clipping)n=r.clipping[e],o+=Fe("clipPath",{id:e}),n.path?o+=Fe("path",{d:n.path})+Qe("path"):o+=Fe("rect",{x:0,y:0,width:n.width,height:n.height})+Qe("rect"),o+=Qe("clipPath");return o.length>0?Fe("defs")+o+Qe("defs"):""},gn.attributes=function(t,e){return vn={},t(yn,e,this),vn},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 e,n=this,i=ve[t.marktype],r=i.tag,o=this._defs,s="";function a(a){var u=n.href(a);u&&(s+=Fe("a",u)),e="g"!==r?_n(a,t,r,o):null,s+=Fe(r,n.attributes(i.attr,a),e),"text"===r?s+=se(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"g"===r&&(s+=Fe("path",n.attributes(i.background,a),_n(a,t,"bgrect",o))+Qe("path"),s+=Fe("g",n.attributes(i.foreground,a))+n.markGroup(a)+Qe("g")),s+=Qe(r),u&&(s+=Qe("a"))}return"g"!==r&&!1===t.interactive&&(e='style="pointer-events: none;"'),s+=Fe("g",{class:Ce(t),"clip-path":t.clip?Nt(n,t,t.group):null},e),i.nested?t.items&&t.items.length&&a(t.items[0]):mt(t,a),s+Qe("g")},gn.markGroup=function(t){var e=this,n="";return mt(t,function(t){n+=e.mark(t)}),n};var mn={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},xn={};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)kn(r[a],e,n,i);else for(const t=ve[o].isect;a<s;++a){let n=r[a];wn(n,e,t)&&i.push(n)}}return i}function kn(t,e,n,i){n&&n(t.mark)&&wn(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)bn(r[t],e,n,i);e.translate(s,a)}return i}function wn(t,e,n){const i=t.bounds;return e.encloses(i)||e.intersects(i)&&n(t,e)}xn.canvas=xn.png={renderer:We,headless:We,handler:Ee},xn.svg={renderer:tn,headless:dn,handler:Ue},xn.none={};var Tn=new s;var Mn=1e-9;function An(t,n,i){return t===n||("path"===i?zn(t,n):t instanceof Date&&n instanceof Date?+t==+n:e.isNumber(t)&&e.isNumber(n)?Math.abs(t-n)<=Mn: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],!An(t[n],e[n],n))return!1;return typeof t==typeof e}(t,n):t==n)}function zn(t,e){return An(m(t),m(e))}t.Bounds=s,t.Gradient=function(t,e){var n,i=[];return n={id:"gradient_"+u++,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=h,t.ResourceLoader=c,t.Item=l,t.Scenegraph=be,t.Handler=Se,t.Renderer=qe,t.CanvasHandler=Ee,t.CanvasRenderer=We,t.SVGHandler=Ue,t.SVGRenderer=tn,t.SVGStringRenderer=dn,t.RenderType=mn,t.renderModule=function(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(xn[t]=e,this):xn[t]},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?kn(t,o,i,r):e.error("Intersect scene must be mark node or group item.")},t.Marks=ve,t.boundClip=function(t){var n=t.clip;if(e.isFunction(n))n(it(Tn.clear()));else{if(!n)return;Tn.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Tn)},t.boundContext=it,t.boundStroke=tt,t.boundItem=ge,t.boundMark=ye,t.pathCurves=p,t.pathSymbols=q,t.pathRectangle=H,t.pathTrail=W,t.pathParse=m,t.pathRender=S,t.point=Pe,t.domCreate=Te,t.domFind=Me,t.domChild=Ae,t.domClear=ze,t.openTag=Fe,t.closeTag=Qe,t.font=ue,t.fontFamily=ae,t.fontSize=re,t.textMetrics=Kt,t.resetSVGClipId=function(){qt=1},t.sceneEqual=An,t.pathEqual=zn,t.sceneToJSON=me,t.sceneFromJSON=xe,t.intersectPath=ut,t.intersectPoint=lt,t.intersectRule=ct,t.intersectBoxLine=ft,t.sceneZOrder=_t,t.sceneVisit=mt,t.scenePickVisit=xt,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;function l(t){this.mark=t,this.bounds=this.bounds||new s}function h(t){l.call(this,t),this.items=this.items||[]}function c(t){this._pending=0,this._loader=t||i.loader()}e.inherits(h,l);var f=c.prototype;function d(t){t._pending+=1}function v(t){t._pending-=1}f.pending=function(){return this._pending},f.sanitizeURL=function(t){var e=this;return d(e),e._loader.sanitize(t,{context:"href"}).then(function(t){return v(e),t}).catch(function(){return v(e),null})},f.loadImage=function(t){var e=this,i=n.image();return d(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(){v(e),r.loaded=!0},r.onerror=function(){v(e),r.loaded=!1},r.src=n,r}).catch(function(t){return v(e),{loaded:!1,width:0,height:0,src:t&&t.url||""}})},f.ready=function(){var t=this;return new Promise(function(e){!function n(i){t.pending()?setTimeout(function(){n(!0)},10):e(i)}(!1)})};var g={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 p(t,e,n){var i=g.hasOwnProperty(t)&&g[t],r=null;return i&&(r=i.curve||i[e||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}var y={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},_=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function m(t){var e,n,i,r,o,s,a,u,l,h,c,f=[];for(u=0,h=(e=t.slice().replace(_[0],"###$1").split(_[1]).slice(1)).length;u<h;++u){for(i=(n=e[u]).slice(1).trim().replace(_[2],"$1###$2").split(_[3]),r=[s=n.charAt(0)],l=0,c=i.length;l<c;++l)(o=+i[l])===o&&r.push(o);if(a=y[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 x=Math.PI/180,b=Math.PI/2,k=2*Math.PI,w=Math.sqrt(3)/2,T={},M={},A=[].join;function z(t){var e=A.call(t);if(M[e])return M[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),_=.5*(o-r),m=Math.sin(.5*_),x=8/3*m*m/Math.sin(_),b=n+v-x*g,k=i+g+x*v,w=n+p,T=i+y,z=w+x*y,C=T-x*p;return M[e]=[h*b+c*k,f*b+d*k,h*z+c*C,f*z+d*C,h*w+c*T,f*w+d*T]}var C=["l",0,0,0,0,0,0,0];function P(t,e){var n=C[0]=t[0];if("a"===n||"A"===n)C[1]=e*t[1],C[2]=e*t[2],C[3]=t[3],C[4]=t[4],C[5]=t[5],C[6]=e*t[6],C[7]=e*t[7];else for(var i=1,r=t.length;i<r;++i)C[i]=e*t[i];return C}function S(t,e,n,i,r){var o,s,a,u,l,h=null,c=0,f=0,d=0,v=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),t.beginPath&&t.beginPath();for(var g=0,p=e.length;g<p;++g){switch(o=e[g],1!==r&&(o=P(o,r)),o[0]){case"l":c+=o[1],f+=o[2],t.lineTo(c+n,f+i);break;case"L":c=o[1],f=o[2],t.lineTo(c+n,f+i);break;case"h":c+=o[1],t.lineTo(c+n,f+i);break;case"H":c=o[1],t.lineTo(c+n,f+i);break;case"v":f+=o[1],t.lineTo(c+n,f+i);break;case"V":f=o[1],t.lineTo(c+n,f+i);break;case"m":c+=o[1],f+=o[2],t.moveTo(c+n,f+i);break;case"M":c=o[1],f=o[2],t.moveTo(c+n,f+i);break;case"c":s=c+o[5],a=f+o[6],d=c+o[3],v=f+o[4],t.bezierCurveTo(c+o[1]+n,f+o[2]+i,d+n,v+i,s+n,a+i),c=s,f=a;break;case"C":c=o[5],f=o[6],d=o[3],v=o[4],t.bezierCurveTo(o[1]+n,o[2]+i,d+n,v+i,c+n,f+i);break;case"s":s=c+o[3],a=f+o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,c+o[1]+n,f+o[2]+i,s+n,a+i),d=c+o[1],v=f+o[2],c=s,f=a;break;case"S":s=o[3],a=o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"q":s=c+o[3],a=f+o[4],d=c+o[1],v=f+o[2],t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"Q":s=o[3],a=o[4],t.quadraticCurveTo(o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"t":s=c+o[1],a=f+o[2],null===h[0].match(/[QqTt]/)?(d=c,v=f):"t"===h[0]?(d=2*c-u,v=2*f-l):"q"===h[0]&&(d=2*c-d,v=2*f-v),u=d,l=v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),f=a,d=(c=s)+o[1],v=f+o[2];break;case"T":s=o[1],a=o[2],d=2*c-d,v=2*f-v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"a":L(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+c+n,o[7]+f+i]),c+=o[6],f+=o[7];break;case"A":L(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+i]),c=o[6],f=o[7];break;case"z":case"Z":t.closePath()}h=o}}function L(t,e,n,i){for(var r=function(t,e,n,i,r,o,s,a,u){var l=A.call(arguments);if(T[l])return T[l];var h=s*x,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,_=-c/i,m=f/i,w=p*a+y*u,M=_*a+m*u,z=p*t+y*e,C=_*t+m*e,P=1/((z-w)*(z-w)+(C-M)*(C-M))-.25;P<0&&(P=0);var S=Math.sqrt(P);o==r&&(S=-S);var L=.5*(w+z)-S*(C-M),R=.5*(M+C)+S*(z-w),q=Math.atan2(M-R,w-L),N=Math.atan2(C-R,z-L)-q;N<0&&1===o?N+=k:N>0&&0===o&&(N-=k);for(var O=Math.ceil(Math.abs(N/(b+.001))),E=[],I=0;I<O;++I){var D=q+I*N/O,V=q+(I+1)*N/O;E[I]=[L,R,D,V,n,i,c,f]}return T[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=z(r[o]);t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}var R={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,k)}},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=w*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=w*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=w*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=w*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=w*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=w*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 q(t){return R.hasOwnProperty(t)?R[t]:function(t){if(!N.hasOwnProperty(t)){var e=m(t);N[t]={draw:function(t,n){S(t,e,0,0,Math.sqrt(n)/2)}}}return N[t]}(t)}var N={};function O(t){return t.x}function E(t){return t.y}function I(t){return t.width}function D(t){return t.height}function V(t){return function(){return t}}function H(){var t=O,e=E,n=I,i=D,r=V(0),s=null;function a(a,u,l){var h,c=null!=u?u:+t.call(this,a),f=null!=l?l:+e.call(this,a),d=+n.call(this,a),v=+i.call(this,a),g=+r.call(this,a);if(s||(s=h=o.path()),g<=0)s.rect(c,f,d,v);else{var p=c+d,y=f+v;s.moveTo(c+g,f),s.lineTo(p-g,f),s.quadraticCurveTo(p,f,p,f+g),s.lineTo(p,y-g),s.quadraticCurveTo(p,y,p-g,y),s.lineTo(c+g,y),s.quadraticCurveTo(c,y,c,y-g),s.lineTo(c,f+g),s.quadraticCurveTo(c,f,c+g,f),s.closePath()}if(h)return s=null,h+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:V(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:V(+t),a):e},a.width=function(t){return arguments.length?(n="function"==typeof t?t:V(+t),a):n},a.height=function(t){return arguments.length?(i="function"==typeof t?t:V(+t),a):i},a.cornerRadius=function(t){return arguments.length?(r="function"==typeof t?t:V(+t),a):r},a.context=function(t){return arguments.length?(s=null==t?null:t,a):s},a}function W(){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,k);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 B(t){return t.x||0}function G(t){return t.y||0}function j(t){return t.cornerRadius||0}function U(t){return!(!1===t.defined)}var X=r.arc().startAngle(function(t){return t.startAngle||0}).endAngle(function(t){return t.endAngle||0}).padAngle(function(t){return t.padAngle||0}).innerRadius(function(t){return t.innerRadius||0}).outerRadius(function(t){return t.outerRadius||0}).cornerRadius(j),J=r.area().x(B).y1(G).y0(function(t){return(t.y||0)+(t.height||0)}).defined(U),F=r.area().y(G).x1(B).x0(function(t){return(t.x||0)+(t.width||0)}).defined(U),Q=r.line().x(B).y(G).defined(U),Y=H().x(B).y(G).width(function(t){return t.width||0}).height(function(t){return t.height||0}).cornerRadius(j),Z=r.symbol().type(function(t){return q(t.shape||"circle")}).size(function(t){return null==t.size?64:t.size}),$=W().x(B).y(G).defined(U).size(function(t){return t.size||1});function K(t,e,n,i){return Y.context(t)(e,n,i)}function tt(t,e){return e.stroke&&0!==e.opacity&&0!==e.strokeOpacity&&t.expand(null!=e.strokeWidth?+e.strokeWidth:1),t}var et,nt=k-1e-8;function it(t){return et=t,it}function rt(){}function ot(t,e){et.add(t,e)}it.beginPath=rt,it.closePath=rt,it.moveTo=ot,it.lineTo=ot,it.rect=function(t,e,n,i){ot(t,e),ot(t+n,e+i)},it.quadraticCurveTo=function(t,e,n,i){ot(t,e),ot(n,i)},it.bezierCurveTo=function(t,e,n,i,r,o){ot(t,e),ot(n,i),ot(r,o)},it.arc=function(t,e,n,i,r,o){if(Math.abs(r-i)>nt)return ot(t-n,e-n),void ot(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%=k)<0&&(i+=k),(r%=k)<0&&(r+=k),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=k,s=i-i%b,a=0;a<4&&s>r;++a,s-=b)v(s);else for(s=i-i%b+b,a=0;a<4&&s<r;++a,s+=b)v(s);ot(t+h,e+f),ot(t+c,e+d)};var st=(st=n.canvas(1,1))?st.getContext("2d"):null;const at=new s;function ut(t){return function(e,n){if(!st)return!0;t(st,e),at.clear().union(e.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:s}=at;for(let t=r;t<=s;++t)for(let e=i;e<=o;++e)if(st.isPointInPath(e,t))return!0;return!1}}function lt(t,e){return e.contains(t.x||0,t.y||0)}function ht(t,e){const n=t.x||0,i=t.y||0,r=t.width||0,o=t.height||0;return e.intersects(at.set(n,i,n+r,i+o))}function ct(t,e){const n=t.x||0,i=t.y||0;return ft(e,n,i,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i)}function ft(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 dt(t,e,n){return n.id?function(t,e,n){for(var i=n.width(),r=n.height(),o=n.x1+e.x1*i,s=n.y1+e.y1*r,a=n.x1+e.x2*i,u=n.y1+e.y2*r,l=e.stops,h=0,c=l.length,f=t.createLinearGradient(o,s,a,u);h<c;++h)f.addColorStop(l[h].offset,l[h].color);return f}(t,n,e.bounds):n}function vt(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=dt(t,e,e.fill),!0)}var gt=[];function pt(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=dt(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||gt),t.lineDashOffset=e.strokeDashOffset||0),!0))}function yt(t,e){return t.zindex-e.zindex||t.index-e.index}function _t(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(yt)}function mt(t,e){var n,i,r=t.items;if(r&&r.length){var o=_t(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 xt(t,e){var n,i,r=t.items;if(!r||!r.length)return null;var o=_t(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 bt(t){return function(e,n,i){mt(n,function(n){i&&!i.intersects(n.bounds)||kt(t,e,n,n)})}}function kt(t,e,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(t(e,i)||(n.fill&&vt(e,n,r)&&e.fill(),n.stroke&&pt(e,n,r)&&e.stroke()))}function wt(t){return t=t||e.truthy,function(e,n,i,r,o,s){return i*=e.pixelRatio,r*=e.pixelRatio,xt(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 Tt(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 Mt(t){return wt(Tt(t))}function At(t,e){return"translate("+t+","+e+")"}function zt(t){return"rotate("+t+")"}function Ct(t){return At(t.x||0,t.y||0)}function Pt(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*=x),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",function(t){return At(t.x||0,t.y||0)+(t.angle?" "+zt(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){var i=n.x||0,r=n.y||0;return e(it(t),n),tt(t,n).translate(i,r),n.angle&&t.rotate(n.angle*x,i,r),t},draw:bt(i),pick:Mt(i),isect:n||ut(i)}}var St=Pt("arc",function(t,e){return X.context(t)(e)});function Lt(t,e,n){function i(t,n){t.beginPath(),e(t,n)}var r,o=Tt(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(it(t),i),tt(t,i[0]))},draw:(r=i,function(t,e,n){!e.items.length||n&&!n.intersects(e.bounds)||kt(r,t,e.items[0],e.items)}),pick:function(t,e,n,i,r,s){var a=e.items,u=e.bounds;return!a||!a.length||u&&!u.contains(r,s)?null:(n*=t.pixelRatio,i*=t.pixelRatio,o(t,a,n,i)?a[0]:null)},isect:lt,tip:n}}var Rt=Lt("area",function(t,e){var n=e[0],i=n.interpolate||"linear";return("horizontal"===n.orient?F:J).curve(p(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}),qt=1;function Nt(t,n,i){var r=n.clip,o=t._defs,s=n.clip_id||(n.clip_id="clip"+qt++),a=o.clipping[s]||(o.clipping[s]={id:s});return e.isFunction(r)?a.path=r(null):(a.width=i.width||0,a.height=i.height||0),"url(#"+s+")"}var Ot=.5;function Et(t,e){var n=e.stroke?Ot:0;t.beginPath(),K(t,e,n,n)}var It=Tt(Et);var Dt={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Ct(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),tt(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var i=this;mt(e,function(e){var r,o=e.x||0,s=e.y||0,a=e.width||0,u=e.height||0;t.save(),t.translate(o,s),(e.stroke||e.fill)&&(r=null==e.opacity?1:e.opacity)>0&&(Et(t,e),e.fill&&vt(t,e,r)&&t.fill(),e.stroke&&pt(t,e,r)&&t.stroke()),e.clip&&(t.beginPath(),t.rect(0,0,a,u),t.clip()),n&&n.translate(-o,-s),mt(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 xt(e,function(l){var h,c,f,d;if(!(d=l.bounds)||d.contains(r,o))return c=l.x||0,f=l.y||0,t.save(),t.translate(c,f),c=r-c,f=o-f,!(h=xt(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)&&It(t,l,a,u)&&(h=l),t.restore(),h||null})},isect:ht,background:function(t,e){var n=e.stroke?Ot:0;t("class","background"),t("d",K(null,e,n,n))},foreground:function(t,e,n){t("clip-path",e.clip?Nt(n,e,e):null)}};function Vt(t,e){var n=t.image;return n&&n.url===t.url||(n={loaded:!1,width:0,height:0},e.loadImage(t.url).then(function(e){t.image=e,t.image.url=t.url})),n}function Ht(t,e){return"center"===t?e/2:"right"===t?e:0}function Wt(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var Bt={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var i=Vt(e,n),r=e.x||0,o=e.y||0,s=(null!=e.width?e.width:i.width)||0,a=(null!=e.height?e.height:i.height)||0,u=!1===e.aspect?"none":"xMidYMid";r-=Ht(e.align,s),o-=Wt(e.baseline,a),t("href",i.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",At(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=(null!=e.width?e.width:n&&n.width)||0,s=(null!=e.height?e.height:n&&n.height)||0;return i-=Ht(e.align,o),r-=Wt(e.baseline,s),t.set(i,r,i+o,r+s)},draw:function(t,e,n){var i=this;mt(e,function(e){if(!n||n.intersects(e.bounds)){var r,o,s,a,u=Vt(e,i),l=e.x||0,h=e.y||0,c=(null!=e.width?e.width:u.width)||0,f=(null!=e.height?e.height:u.height)||0;l-=Ht(e.align,c),h-=Wt(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.loaded&&(t.globalAlpha=null!=(r=e.opacity)?r:1,t.drawImage(u,l,h,c,f))}})},pick:wt(),isect:e.truthy,get:Vt,xOffset:Ht,yOffset:Wt},Gt=Lt("line",function(t,e){var n=e[0],i=n.interpolate||"linear";return Q.curve(p(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 jt(t,e){var n=e.path;if(null==n)return!0;var i=e.pathCache;i&&i.path===n||((e.pathCache=i=m(n)).path=n),S(t,i,e.x,e.y)}var Ut={type:"path",tag:"path",nested:!1,attr:function(t,e){t("transform",Ct(e)),t("d",e.path)},bound:function(t,e){return jt(it(t),e)?t.set(0,0,0,0):tt(t,e)},draw:bt(jt),pick:Mt(jt),isect:ut(jt)};function Xt(t,e){t.beginPath(),K(t,e)}var Jt={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",K(null,e))},bound:function(t,e){var n,i;return tt(t.set(n=e.x||0,i=e.y||0,n+e.width||0,i+e.height||0),e)},draw:bt(Xt),pick:Mt(Xt),isect:ht};function Ft(t,e,n){var i,r,o,s;return!(!e.stroke||!pt(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 Qt,Yt={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",Ct(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 tt(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){mt(e,function(e){if(!n||n.intersects(e.bounds)){var i=null==e.opacity?1:e.opacity;i&&Ft(t,e,i)&&t.stroke()}})},pick:wt(function(t,e,n,i){return!!t.isPointInStroke&&Ft(t,e,1)&&t.isPointInStroke(n,i)}),isect:ct},Zt=Pt("shape",function(t,e){return(e.mark.shape||e.shape).context(t)(e)}),$t=Pt("symbol",function(t,e){return Z.context(t)(e)},lt),Kt={height:re,measureWidth:ne,estimateWidth:te,width:te,canvas:oe};function te(t){return Qt=re(t),ee(se(t))}function ee(t){return~~(.8*t.length*Qt)}function ne(t){return re(t)<=0?0:(st.font=ue(t),ie(se(t)))}function ie(t){return st.measureText(t).width}function re(t){return null!=t.fontSize?t.fontSize:11}function oe(t){Kt.width=t&&st?ne:te}function se(t){var e=t.text;return null==e?"":t.limit>0?function(t){var e,n=+t.limit,i=t.text+"";Kt.width===ne?(st.font=ue(t),e=ie):(Qt=re(t),e=ee);if(e(i)<n)return i;var r,o=t.ellipsis||"…",s="rtl"===t.dir,a=0,u=i.length;if(n-=e(o),s){for(;a<u;)r=a+u>>>1,e(i.slice(r))>n?a=r+1:u=r;return o+i.slice(a)}for(;a<u;)r=1+(a+u>>>1),e(i.slice(0,r))<n?a=r:u=r-1;return i.slice(0,a)+o}(t):e+""}function ae(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function ue(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+re(t)+"px "+ae(t,e)}function le(t){var e=t.baseline,n=re(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}oe(!0);var he={left:"start",center:"middle",right:"end"},ce=new s;function fe(t){var e,n=t.x||0,i=t.y||0,r=t.radius||0;return r&&(e=(t.theta||0)-b,n+=r*Math.cos(e),i+=r*Math.sin(e)),ce.x1=n,ce.y1=i,ce}function de(t,e,n){var i,r=Kt.height(e),o=e.align,s=fe(e),a=s.x1,u=s.y1,l=e.dx||0,h=(e.dy||0)+le(e)-Math.round(.8*r);if(i=Kt.width(e),"center"===o?l-=i/2:"right"===o&&(l-=i),t.set(l+=a,h+=u,l+i,h+r),e.angle&&!n)t.rotate(e.angle*x,a,u);else if(2===n)return t.rotatedPoints(e.angle*x,a,u);return t}var ve={arc:St,area:Rt,group:Dt,image:Bt,line:Gt,path:Ut,rect:Jt,rule:Yt,shape:Zt,symbol:$t,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,i=e.dx||0,r=(e.dy||0)+le(e),o=fe(e),s=o.x1,a=o.y1,u=e.angle||0;t("text-anchor",he[e.align]||"start"),u?(n=At(s,a)+" "+zt(u),(i||r)&&(n+=" "+At(i,r))):n=At(s+i,a+r),t("transform",n)},bound:de,draw:function(t,e,n){mt(e,function(e){var i,r,o,s,a;n&&!n.intersects(e.bounds)||(a=se(e))&&(0===(i=null==e.opacity?1:e.opacity)||e.fontSize<=0||(t.font=ue(e),t.textAlign=e.align||"left",o=(r=fe(e)).x1,s=r.y1,e.angle&&(t.save(),t.translate(o,s),t.rotate(e.angle*x),o=s=0),o+=e.dx||0,s+=(e.dy||0)+le(e),e.fill&&vt(t,e,i)&&t.fillText(a,o,s),e.stroke&&pt(t,e,i)&&t.strokeText(a,o,s),e.angle&&t.restore()))})},pick:wt(function(t,e,n,i,r,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var s=fe(e),a=s.x1,u=s.y1,l=de(ce,e,1),h=-e.angle*x,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=de(ce,t,2);return ft(e,n[0],n[1],n[2],n[3])||ft(e,n[0],n[1],n[4],n[5])||ft(e,n[4],n[5],n[6],n[7])||ft(e,n[2],n[3],n[6],n[7])}},trail:Lt("trail",function(t,e){return $.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 ge(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 pe={mark:null};function ye(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]:(pe.mark=t,o=pe),a=ge(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(ge(h[i],l,n));return t.bounds=e}var _e=["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","interpolate","tension","orient","defined","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];function me(t,e){return JSON.stringify(t,_e,e)}function xe(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&&ye(e);return e}("string"==typeof t?JSON.parse(t):t)}function be(t){arguments.length?this.root=xe(t):(this.root=we({marktype:"group",name:"root",role:"frame"}),this.root.items=[new h(this.root)])}var ke=be.prototype;function we(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 Te(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function Me(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 Ae(t,e,n,i){var r,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=Te(t.ownerDocument,n,i),t.insertBefore(o,r)),o}function ze(t,e){for(var n=t.childNodes,i=n.length;i>e;)t.removeChild(n[--i]);return t}function Ce(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Pe(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Se(t,e){this._active=null,this._handlers={},this._loader=t||i.loader(),this._tooltip=e||Le}function Le(t,e,n,i){t.element().setAttribute("title",i||"")}ke.toJSON=function(t){return me(this.root,t||0)},ke.mark=function(t,e,n){var i=we(t,e=e||this.root.items[0]);return e.items[n]=i,i.zindex&&(i.group.zdirty=!0),i};var Re=Se.prototype;function qe(t){this._el=null,this._bgcolor=null,this._loader=new c(t)}Re.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Re.element=function(){return this._el},Re.canvas=function(){return this._el&&this._el.firstChild},Re.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Re.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Re.on=function(){},Re.off=function(){},Re._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},Re.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},Re.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Re.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(function(e){var n=new MouseEvent(t.type,t),i=Te(null,"a");for(var r in e)i.setAttribute(r,e[r]);i.dispatchEvent(n)}).catch(function(){})},Re.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=Pe(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)}},Re.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 Ne=qe.prototype;Ne.initialize=function(t,e,n,i,r){return this._el=t,this.resize(e,n,i,r)},Ne.element=function(){return this._el},Ne.canvas=function(){return this._el&&this._el.firstChild},Ne.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},Ne.resize=function(t,e,n,i){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=i||1,this},Ne.dirty=function(){},Ne.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},Ne._render=function(){},Ne.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then(function(){return e}):Promise.resolve(e)},Ne._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},Ne.sanitizeURL=function(t){return this._load("sanitizeURL",t)},Ne.loadImage=function(t){return this._load("loadImage",t)};var Oe="mouseout";function Ee(t,e){Se.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var Ie=e.inherits(Ee,Se);function De(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 Ve(t){return function(e){this.fire(t,e),this._active=null}}Ie.initialize=function(t,e,n){var i=this._canvas=t&&Me(t,"canvas");if(i){var r=this;this.events.forEach(function(t){i.addEventListener(t,function(e){Ie[t]?Ie[t].call(r,e):r.fire(t,e)})})}return Se.prototype.initialize.call(this,t,e,n)},Ie.canvas=function(){return this._canvas},Ie.context=function(){return this._canvas.getContext("2d")},Ie.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Ie.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Ie.mousemove=De("mousemove","mouseover","mouseout"),Ie.dragover=De("dragover","dragenter","dragleave"),Ie.mouseout=Ve("mouseout"),Ie.dragleave=Ve("dragleave"),Ie.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},Ie.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},Ie.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Ie.touchmove=function(t){this.fire("touchmove",t,!0)},Ie.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Ie.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!==Oe||this.handleTooltip(e,o,t!==Oe),s)for(i=0,r=s.length;i<r;++i)s[i].handler.call(this._obj,e,o)},Ie.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},Ie.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},Ie.pickEvent=function(t){var e=Pe(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},Ie.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 He="undefined"!=typeof window&&window.devicePixelRatio||1;function We(t){qe.call(this,t),this._redraw=!1,this._dirty=new s}var Be=e.inherits(We,qe),Ge=qe.prototype,je=new s;function Ue(t,e){Se.call(this,t,e);var n=this;n._hrefHandler=Je(n,function(t,e){e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=Je(n,function(t,e){n.handleTooltip(t,e,t.type!==Oe)})}Be.initialize=function(t,e,i,r,o,s){return this._options=s,this._canvas=n.canvas(1,1,s&&s.type),t&&(ze(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Ge.initialize.call(this,t,e,i,r,o)},Be.resize=function(t,e,n,i){return Ge.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?He: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},Be.canvas=function(){return this._canvas},Be.context=function(){return this._canvas?this._canvas.getContext("2d"):null},Be.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=je.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)},Be._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=null):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,n),this.clear(-n[0],-n[1],i,r),this.draw(e,t,o),e.restore(),this._dirty.clear(),this},Be.draw=function(t,n,i){var r=ve[n.marktype];n.clip&&function(t,n){var i=n.clip;if(t.save(),t.beginPath(),e.isFunction(i))i(t);else{var r=n.group;t.rect(0,0,r.width||0,r.height||0)}t.clip()}(t,n),r.draw.call(this,t,n,i),n.clip&&t.restore()},Be.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 Xe=e.inherits(Ue,Se);function Je(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 Fe(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 Qe(t){return"</"+t+">"}Xe.initialize=function(t,e,n){var i=this._svg;return i&&(i.removeEventListener("click",this._hrefHandler),i.removeEventListener("mousemove",this._tooltipHandler),i.removeEventListener(Oe,this._tooltipHandler)),this._svg=i=t&&Me(t,"svg"),i&&(i.addEventListener("click",this._hrefHandler),i.addEventListener("mousemove",this._tooltipHandler),i.addEventListener(Oe,this._tooltipHandler)),Se.prototype.initialize.call(this,t,e,n)},Xe.canvas=function(){return this._svg},Xe.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:Je(this,e)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},Xe.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 Ye={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},Ze={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"},$e=Object.keys(Ze),Ke=Ye.xmlns;function tn(t){qe.call(this,t),this._dirtyID=1,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var en=e.inherits(tn,qe),nn=qe.prototype;function rn(t,e,n){var i,r,o;for((t=Ae(t,n,"linearGradient",Ke)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2),i=0,r=e.stops.length;i<r;++i)(o=Ae(t,i,"stop",Ke)).setAttribute("offset",e.stops[i].offset),o.setAttribute("stop-color",e.stops[i].color);ze(t,i)}function on(t,e,n){var i;(t=Ae(t,n,"clipPath",Ke)).setAttribute("id",e.id),e.path?(i=Ae(t,0,"path",Ke)).setAttribute("d",e.path):((i=Ae(t,0,"rect",Ke)).setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",e.width),i.setAttribute("height",e.height))}function sn(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 an(t,e,n,i,r){var o,s=t._svg;if(!s&&(s=Te(o=e.ownerDocument,i,Ke),t._svg=s,t.mark&&(s.__data__=t,s.__values__={fill:"default"},"g"===i))){var a=Te(o,"path",Ke);a.setAttribute("class","background"),s.appendChild(a),a.__data__=t;var u=Te(o,"g",Ke);s.appendChild(u),u.__data__=t}return(s.ownerSVGElement!==r||function(t){var e=t.mark||t.group;return e&&e.items.length>1}(t)&&s.previousSibling!==n)&&e.insertBefore(s,n?n.nextSibling:e.firstChild),s}en.initialize=function(t,e,n,i){return t&&(this._svg=Ae(t,0,"svg",Ke),this._svg.setAttribute("class","marks"),ze(t,1),this._root=Ae(this._svg,0,"g",Ke),ze(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),nn.initialize.call(this,t,e,n,i)},en.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),nn.background.apply(this,arguments)},en.resize=function(t,e,n,i){return nn.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},en.canvas=function(){return this._svg},en.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 Ye)t[e]=Ye[e];var n=this._bgcolor?Fe("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+Qe("rect"):"";return Fe("svg",t)+n+this._svg.innerHTML+Qe("svg")},en._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),ze(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},en.updateDefs=function(){var t,e=this._svg,n=this._defs,i=n.el,r=0;for(t in n.gradient)i||(n.el=i=Ae(e,0,"defs",Ke)),rn(i,n.gradient[t],r++);for(t in n.clipping)i||(n.el=i=Ae(e,0,"defs",Ke)),on(i,n.clipping[t],r++);i&&(0===r?(e.removeChild(i),n.el=null):ze(i,r))},en._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},en.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},en.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},en._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length)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,sn(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,sn(e,u)),e._update=u));return!this._dirtyAll},en.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=an(t,i,l,s.tag,o);e&&(r._update(s,n,t),u&&function(t,e,n){e=e.lastChild;var i,r=0;mt(n,function(n){i=t.draw(e,n,i),++r}),ze(e,1+r)}(r,n,t)),l=n,++h}return(i=an(e,t,n,"g",o)).setAttribute("class",Ce(e)),u||i.style.setProperty("pointer-events",a),e.clip?i.setAttribute("clip-path",Nt(r,e,e.group)):i.removeAttribute("clip-path"),s.nested?e.items.length&&c(e.items[0]):mt(e,c),ze(i,h),i};var un=null,ln=null,hn={group:function(t,e,n){ln=e.__values__,un=e.childNodes[1],t.foreground(fn,n,this),un=e.childNodes[0],t.background(fn,n,this);var i=!1===n.mark.interactive?"none":null;i!==ln.events&&(un.style.setProperty("pointer-events",i),ln.events=i)},text:function(t,e,n){var i;(i=se(n))!==ln.text&&(e.textContent=i,ln.text=i),cn(e,"font-family",ae(n)),cn(e,"font-size",re(n)+"px"),cn(e,"font-style",n.fontStyle),cn(e,"font-variant",n.fontVariant),cn(e,"font-weight",n.fontWeight)}};function cn(t,e,n){n!==ln[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),ln[e]=n)}function fn(t,e,n){e!==ln[t]&&(null!=e?n?un.setAttributeNS(n,t,e):un.setAttribute(t,e):n?un.removeAttributeNS(n,t):un.removeAttribute(t),ln[t]=e)}function dn(t){qe.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}en._update=function(t,e,n){un=e,ln=e.__values__,t.attr(fn,n,this);var i=hn[t.type];i&&i.call(this,t,e,n),this.style(un,n)},en.style=function(t,e){var n,i,r,o,s,a;if(null!=e)for(n=0,i=$e.length;n<i;++n)s=e[r=$e[n]],"font"===r&&(s=ae(e)),s!==ln[r]&&(o=Ze[r],null==s?"fill"===o?t.style.setProperty(o,"none"):t.style.removeProperty(o):(s.id&&(this._defs.gradient[s.id]=s,s="url("+(a=void 0,"undefined"==typeof window?"":(a=window.location).hash?a.href.slice(0,-a.hash.length):a.href)+"#"+s.id+")"),t.style.setProperty(o,s+"")),ln[r]=s)};var vn,gn=e.inherits(dn,qe),pn=qe.prototype;function yn(t,e,n,i){vn[i||t]=e}function _n(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; "),"text"===n&&(l+="font-family: "+ae(t)+"; ",l+="font-size: "+re(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=$e.length;r<o;++r)s=$e[r],a=Ze[s],null==(u=t[s])?"fill"===a&&(l+="fill: none; "):"transparent"!==u||"fill"!==a&&"stroke"!==a?(u.id&&(i.gradient[u.id]=u,u="url(#"+u.id+")"),l+=a+": "+u+"; "):l+=a+": none; ";return l?'style="'+l.trim()+'"':null}gn.resize=function(t,e,n,i){pn.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 Ye)s[a]=Ye[a];o.head=Fe("svg",s);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),o.bg=u?Fe("rect",{width:this._width,height:this._height,style:"fill: "+u+";"})+Qe("rect"):"",o.root=Fe("g",{transform:"translate("+r+")"}),o.foot=Qe("g")+Qe("svg"),this},gn.background=function(){var t=pn.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=this._defs,o="";for(e in r.gradient){for(i=(n=r.gradient[e]).stops,o+=Fe("linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<i.length;++t)o+=Fe("stop",{offset:i[t].offset,"stop-color":i[t].color})+Qe("stop");o+=Qe("linearGradient")}for(e in r.clipping)n=r.clipping[e],o+=Fe("clipPath",{id:e}),n.path?o+=Fe("path",{d:n.path})+Qe("path"):o+=Fe("rect",{x:0,y:0,width:n.width,height:n.height})+Qe("rect"),o+=Qe("clipPath");return o.length>0?Fe("defs")+o+Qe("defs"):""},gn.attributes=function(t,e){return vn={},t(yn,e,this),vn},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 e,n=this,i=ve[t.marktype],r=i.tag,o=this._defs,s="";function a(a){var u=n.href(a);u&&(s+=Fe("a",u)),e="g"!==r?_n(a,t,r,o):null,s+=Fe(r,n.attributes(i.attr,a),e),"text"===r?s+=se(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"g"===r&&(s+=Fe("path",n.attributes(i.background,a),_n(a,t,"bgrect",o))+Qe("path"),s+=Fe("g",n.attributes(i.foreground,a))+n.markGroup(a)+Qe("g")),s+=Qe(r),u&&(s+=Qe("a"))}return"g"!==r&&!1===t.interactive&&(e='style="pointer-events: none;"'),s+=Fe("g",{class:Ce(t),"clip-path":t.clip?Nt(n,t,t.group):null},e),i.nested?t.items&&t.items.length&&a(t.items[0]):mt(t,a),s+Qe("g")},gn.markGroup=function(t){var e=this,n="";return mt(t,function(t){n+=e.mark(t)}),n};var mn={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},xn={};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)kn(r[a],e,n,i);else for(const t=ve[o].isect;a<s;++a){let n=r[a];wn(n,e,t)&&i.push(n)}}return i}function kn(t,e,n,i){n&&n(t.mark)&&wn(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)bn(r[t],e,n,i);e.translate(s,a)}return i}function wn(t,e,n){const i=t.bounds;return e.encloses(i)||e.intersects(i)&&n(t,e)}xn.canvas=xn.png={renderer:We,headless:We,handler:Ee},xn.svg={renderer:tn,headless:dn,handler:Ue},xn.none={};var Tn=new s;var Mn=1e-9;function An(t,n,i){return t===n||("path"===i?zn(t,n):t instanceof Date&&n instanceof Date?+t==+n:e.isNumber(t)&&e.isNumber(n)?Math.abs(t-n)<=Mn: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],!An(t[n],e[n],n))return!1;return typeof t==typeof e}(t,n):t==n)}function zn(t,e){return An(m(t),m(e))}t.Bounds=s,t.Gradient=function(t,e){var n,i=[];return n={id:"gradient_"+u++,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=h,t.ResourceLoader=c,t.Item=l,t.Scenegraph=be,t.Handler=Se,t.Renderer=qe,t.CanvasHandler=Ee,t.CanvasRenderer=We,t.SVGHandler=Ue,t.SVGRenderer=tn,t.SVGStringRenderer=dn,t.RenderType=mn,t.renderModule=function(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(xn[t]=e,this):xn[t]},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?kn(t,o,i,r):e.error("Intersect scene must be mark node or group item.")},t.Marks=ve,t.boundClip=function(t){var n=t.clip;if(e.isFunction(n))n(it(Tn.clear()));else{if(!n)return;Tn.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Tn)},t.boundContext=it,t.boundStroke=tt,t.boundItem=ge,t.boundMark=ye,t.pathCurves=p,t.pathSymbols=q,t.pathRectangle=H,t.pathTrail=W,t.pathParse=m,t.pathRender=S,t.point=Pe,t.domCreate=Te,t.domFind=Me,t.domChild=Ae,t.domClear=ze,t.openTag=Fe,t.closeTag=Qe,t.font=ue,t.fontFamily=ae,t.fontSize=re,t.textMetrics=Kt,t.resetSVGClipId=function(){qt=1},t.sceneEqual=An,t.pathEqual=zn,t.sceneToJSON=me,t.sceneFromJSON=xe,t.intersectPath=ut,t.intersectPoint=lt,t.intersectRule=ct,t.intersectBoxLine=ft,t.sceneZOrder=_t,t.sceneVisit=mt,t.scenePickVisit=xt,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "vega-scenegraph",
"version": "4.0.2",
"version": "4.1.0",
"description": "Vega scenegraph and renderers.",

@@ -28,3 +28,3 @@ "license": "BSD-3-Clause",

},
"gitHead": "0f0e009069ae0291458398a747f024c693c201d9"
"gitHead": "a34555f5474d42a4599dd958895b8e44d3fda0fe"
}

@@ -29,2 +29,11 @@ export default function Bounds(b) {

prototype.equals = function(b) {
return (
this.x1 === b.x1 &&
this.y1 === b.y1 &&
this.x2 === b.x2 &&
this.y2 === b.y2
);
};
prototype.set = function(x1, y1, x2, y2) {

@@ -31,0 +40,0 @@ if (x2 < x1) {

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