!function(a){"use strict";function b(a){return a||0===a}function c(a){return"undefined"==typeof a}function d(a){return"undefined"!=typeof a}function e(a,b){function c(a,b){a.attr("transform",function(a){return"translate("+Math.ceil(b(a)+s)+", 0)"})}function d(a,b){a.attr("transform",function(a){return"translate(0,"+Math.ceil(b(a))+")"})}function e(a){var b=a[0],c=a[a.length-1];return c>b?[b,c]:[c,b]}function f(a){var b,c,d=[];if(a.ticks)return a.ticks.apply(a,k);for(c=a.domain(),b=Math.ceil(c[0]);b0&&d[0]>0&&d.unshift(d[0]-(d[1]-d[0])),d}function g(){var a,c=m.copy();return b&&(a=m.domain(),c.domain([a[0],a[1]-1])),c}function h(a){var c=b&&adg&&(dg=0),0>fg&&(fg=0),eg=sh?ag.left-oj-pj:dg,gg=sh?fg:ig-bg.top-bg.bottom,0>eg&&(eg=0),0>gg&&(gg=0),mg=dg-(jj?b+10:0),ng=fg-(jj?0:10),r(),jj&&d&&(cg.left=mg/2+1.1*kg)}function q(){yj.select("line."+g.xgridFocus).attr("x1",sh?0:-10).attr("x2",sh?dg:-10).attr("y1",sh?-10:ag.top).attr("y2",sh?-10:fg)}function r(){kg=Math.min(mg,ng)/2,jg=.95*kg,lg=je(Lf.data.targets)?.6*jg:0}function s(){var a=sh?g.axisX:g.axisY,b=yj.select("."+a).node(),c=b?b.getBoundingClientRect():{right:0},d=Kf.select(Nf).node().getBoundingClientRect(),e=ke(Lf.data.targets),f=c.right-d.left-(e?0:v());return f>0?f:0}function t(){return Of?Of:z()}function u(){var a=Pf?Pf:A();return a>0?a:320}function v(){var a=1;return Qf?Qf:sh?th?x("x"):a:!Lh||Qh?a:x("y")}function w(){var a=1;return Rf?Rf:jj?R()+20+(Uh&&!sh?x("y2"):a):Uh?Zh||sh?a:x("y2"):a}function x(a){var b=mb(a);return b.isInner?20+Fb(a):40+Fb(a)}function y(a){return"x"!==a||th?"x"===a&&Ih?Ih:"y"!==a||Lh?"y2"!==a||Uh?(mb(a).isInner?30:40)+("y2"===a?-10:0):qj:mh&&!jj?10:1:0}function z(){return+Kf.select(Nf).style("width").replace("px","")}function A(){return+Kf.select(Nf).style("height").replace("px","")}function B(a){return a?-31:-(ag.left-1)}function C(a){return a?-20:-4}function D(){return B(!sh)}function E(){return C(!sh)}function F(){return B(sh)}function G(){return C(sh)}function H(a){return a?dg+2+30+30:ag.left+20}function I(a){return a?(Ih?Ih:0)+80:fg+8}function J(){return H(!sh)}function K(){return I(!sh)}function L(){return H(sh)}function M(){return I(sh)}function N(){var a,b,c,d,e,f=Cc(Lf.data.targets);return f?(a=f.values[0],b=f.values[f.values.length-1],c=Ag(b.x)-Ag(a.x),0===c?sh?fg:dg:(d=Bc(),e=ge(Lf.data.targets)?(d-(Si?.25:1))/d:1,d>1?c*e/(d-1):c)):0}function O(a){kj=a}function P(a){lj=a}function Q(a){mj=a}function R(){return mh?jj?lj*(kj+1):hg:0}function S(){return mh?jj?ig:mj*(kj+1):0}function T(){var a,b,c=!Ag;sg=sh?1:0,tg=sh?fg:dg,ug=sh?0:fg,vg=sh?dg:1,wg=sg,xg=tg,yg=sh?0:gg,zg=sh?eg:1,Ag=W(sg,tg,c?void 0:Ag.domain(),function(){return Gg.tickOffset()}),Bg=X(ug,vg,c?void 0:Bg.domain()),Cg=X(ug,vg,c?void 0:Cg.domain()),Dg=W(sg,tg,Dj,function(a){return a%1?0:Jg.tickOffset()}),Eg=X(yg,zg,c?void 0:Eg.domain()),Fg=X(yg,zg,c?void 0:Fg.domain()),a=bb(),b=Dh?Dh:c?void 0:Gg.tickValues(),Gg=$(Ag,ej,a,b),Jg=$(Dg,hj,a,b),Hg=_(Bg,fj,Rh,Th),Ig=_(Cg,gj,$h,ai),c||(rj.scale(Dg),Uf&&vj.scale(Ag)),U()}function U(){og=Ib(),pg=Jb(),qg=Jb(.98)}function V(a,b,c){return(c?Kf.time.scale():Kf.scale.linear()).range([a,b])}function W(a,b,c,d){var e,f=V(a,b,Ri),g=c?f.domain(c):f;Si?(d=d||function(){return 0},f=function(a,b){var c=g(a)+d(a);return b?c:Math.ceil(c)}):f=function(a,b){var c=g(a);return b?c:Math.ceil(c)};for(e in g)f[e]=g[e];return f.orgDomain=function(){var a=g.domain();return Dj&&Dj[0]===a[0]&&Dj[1]a?a.toFixed(0):a};return yh&&("function"==typeof yh?a=yh:Ri&&(a=function(a){return a?_i(yh)(a):""})),a}function cb(a){var b;return"y"===a?b=Ph:"y2"===a?b=Yh:"x"===a&&(b=Kh),b}function db(a){var b=cb(a);return"string"==typeof b?b:b?b.text:null}function eb(a,b){var c=cb(a);"string"==typeof c?"y"===a?Ph=b:"y2"===a?Yh=b:"x"===a&&(Kh=b):c&&(c.text=b)}function fb(a){return 10*Math.sin(Math.PI*(a/180))}function gb(a){return 11.5-2.5*(a/15)}function hb(a,b,c){a.selectAll(".tick text").style("text-anchor","start"),b.selectAll(".tick text").attr("y",gb(c)).attr("x",fb(c)).attr("transform","rotate("+c+")")}function ib(a,b){var c=cb(a),d=c&&"object"==typeof c&&c.position?c.position:b;return{isInner:d.indexOf("inner")>=0,isOuter:d.indexOf("outer")>=0,isLeft:d.indexOf("left")>=0,isCenter:d.indexOf("center")>=0,isRight:d.indexOf("right")>=0,isTop:d.indexOf("top")>=0,isMiddle:d.indexOf("middle")>=0,isBottom:d.indexOf("bottom")>=0}}function jb(){return ib("x",sh?"inner-top":"inner-right")}function kb(){return ib("y",sh?"inner-right":"inner-top")}function lb(){return ib("y2",sh?"inner-right":"inner-top")}function mb(a){return"y2"===a?lb():"y"===a?kb():jb()}function nb(){return db("x")}function ob(){return db("y")}function pb(){return db("y2")}function qb(a,b){return a?b.isLeft?0:b.isCenter?dg/2:dg:b.isBottom?-fg:b.isMiddle?-fg/2:0}function rb(a,b){return a?b.isLeft?"0.5em":b.isRight?"-0.5em":"0":b.isTop?"-0.5em":b.isBottom?"0.5em":"0"}function sb(a,b){return a?b.isLeft?"start":b.isCenter?"middle":"end":b.isBottom?"start":b.isMiddle?"middle":"end"}function tb(){return qb(!sh,jb())}function ub(){return qb(sh,kb())}function vb(){return qb(sh,lb())}function wb(){return rb(!sh,jb())}function xb(){return rb(sh,kb())}function yb(){return rb(sh,lb())}function zb(){var a=jb();return sh?a.isInner?"1.2em":-25-Fb("x"):a.isInner?"-0.5em":Ih?Ih-10:"3em"}function Ab(){var a=kb();return sh?a.isInner?"-0.5em":"3em":a.isInner?"1.2em":-20-Fb("y")}function Bb(){var a=lb();return sh?a.isInner?"1.2em":"-2.2em":a.isInner?"-0.5em":30+Fb("y2")}function Cb(){return sb(!sh,jb())}function Db(){return sb(sh,kb())}function Eb(){return sb(sh,lb())}function Fb(a){var b=0,c="x"===a?g.axisX:"y"===a?g.axisY:g.axisY2;return Kf.selectAll("."+c+" .tick text").each(function(){var a=this.getBoundingClientRect();bb?0:b}function Gb(a){var b=yj.select("."+g.axisX+" ."+g.axisXLabel),c=yj.select("."+g.axisY+" ."+g.axisYLabel),d=yj.select("."+g.axisY2+" ."+g.axisY2Label);(a?b.transition():b).attr("x",tb).attr("dx",wb).attr("dy",zb).text(nb),(a?c.transition():c).attr("x",ub).attr("dx",xb).attr("dy",Ab).attr("dy",Ab).text(ob),(a?d.transition():d).attr("x",vb).attr("dx",yb).attr("dy",Bb).text(pb)}function Hb(a){var b=!1;return rg(Kc(Lf.data.targets)).forEach(function(c){return b||c.data.id!==a.data.id?void 0:(b=!0,void(a=c))}),b?a:null}function Ib(){var a=Kf.svg.arc().outerRadius(jg).innerRadius(lg),b=function(b,c){var d;return c?a(b):(d=Hb(b),d?a(d):"M 0 0")};return b.centroid=a.centroid,b}function Jb(a){var b=Kf.svg.arc().outerRadius(kg*(a?a:1)).innerRadius(lg);return function(a){var c=Hb(a);return c?b(c):"M 0 0"}}function Kb(a,b){return re(a.data)?og(a,b):"M 0 0"}function Lb(a){var b,c,d,e,f=Hb(a),g="";return f&&(b=og.centroid(f),c=b[0],d=b[1],e=Math.sqrt(c*c+d*d),g="translate("+c/e*jg*.8+","+d/e*jg*.8+")"),g}function Mb(a){return a?(a.endAngle-a.startAngle)/(2*Math.PI):null}function Nb(a){return rc({id:a.data.id,value:a.value,ratio:Mb(a)})}function Ob(a){var b,c,d,e;return Rb()?(b=Hb(a),c=b?b.value:null,d=Mb(b),e=Sb(),e?e(c,d):Fd(c,d)):""}function Pb(a,b){var c=wj.selectAll("."+g.chartArc+rd(a)),d=wj.selectAll("."+g.arc).filter(function(b){return b.data.id!==a});xe(a)&&c.selectAll("path").transition().duration(50).attr("d",pg).transition().duration(100).attr("d",qg).each(function(a){qe(a.data)}),b||d.style("opacity",.3)}function Qb(a){var b=wj.selectAll("."+g.chartArc+rd(a));b.selectAll("path").transition().duration(50).attr("d",og),wj.selectAll("."+g.arc).style("opacity",1)}function Rb(){return je(Lf.data.targets)?wi:qi}function Sb(){return je(Lf.data.targets)?xi:ri}function Tb(){return je(Lf.data.targets)?zi:""}function Ub(){var a=je(Lf.data.targets)?Ai:ti;return"function"==typeof a?a:function(){}}function Vb(){var a=je(Lf.data.targets)?Bi:ui;return"function"==typeof a?a:function(){}}function Wb(){var a=je(Lf.data.targets)?Ci:vi;return"function"==typeof a?a:function(){}}function Xb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Qg.length>0)for(g=Tc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=0>a?a:0}),c=1;c0||(i[d][b]+=+a)});return Kf.min(Object.keys(i).map(function(a){return Kf.min(i[a])}))}function Yb(a){var b,c,d,e,f,g,h=Ec(a),i=Rc(a);if(Qg.length>0)for(g=Uc(a),b=0;b=0}),0!==e.length)for(d=e[0],g&&i[d]&&i[d].forEach(function(a,b){i[d][b]=a>0?a:0}),c=1;c+a||(i[d][b]+=+a)});return Kf.max(Object.keys(i).map(function(a){return Kf.max(i[a])}))}function Zb(a,c){var d,e,f,g,h,i,j,k,l=a.filter(function(a){return ab(a.id)===c}),m="y2"===c?Wh:Nh,n="y2"===c?Vh:Mh,o=b(m)?m:Xb(l),p=b(n)?n:Yb(l),q="y2"===c?Xh:Oh,r=zd()&&sh;return 0===l.length?"y2"===c?Cg.domain():Bg.domain():(o===p&&(0>o?p=0:o=0),d=Math.abs(p-o),e=f=g=r?0:.1*d,q&&(h=Math.max(Math.abs(o),Math.abs(p)),p=h-q,o=q-h),r&&(i=Ad(o,p),j=cc(Bg.range()),k=[i[0]/j,i[1]/j],f+=d*(k[1]/(1-k[0]-k[1])),g+=d*(k[0]/(1-k[0]-k[1]))),"y"===c&&Sh&&(f=b(Sh.top)?Sh.top:e,g=b(Sh.bottom)?Sh.bottom:e),"y2"===c&&_h&&(f=b(_h.top)?_h.top:e,g=b(_h.bottom)?_h.bottom:e),ge(l)&&!Tc(l)&&(g=o),[o-g,p+f])}function $b(a){return Gh?Ri?ze(Gh):Gh:Kf.min(a,function(a){return Kf.min(a.values,function(a){return a.x})})}function _b(a){return Fh?Ri?ze(Fh):Fh:Kf.max(a,function(a){return Kf.max(a.values,function(a){return a.x})})}function ac(a){var c,d,e,f,g=Dc(a),h=g[1]-g[0];return Si?d=0:ge(a)?(c=Bc(),d=c>1?h/(c-1)/2:.5):d=.01*h,"object"==typeof Hh&&Ee(Hh)?(e=b(Hh.left)?Hh.left:d,f=b(Hh.right)?Hh.right:d):e=f="number"==typeof Hh?Hh:d,{left:e,right:f}}function bc(a){var b=[$b(a),_b(a)],c=b[0],d=b[1],e=ac(a),f=0,g=0;return c-d!==0||Si||(c=Ri?new Date(.5*c.getTime()):-.5,d=Ri?new Date(1.5*d.getTime()):.5),(c||0===c)&&(f=Ri?new Date(c.getTime()-e.left):c-e.left),(d||0===d)&&(g=Ri?new Date(d.getTime()+e.right):d+e.right),[f,g]}function cc(a){return a[1]-a[0]}function dc(a){for(var b=0;bb?0:b-c}function jc(a){var b,c=hc(a),d="y"===a.axis?Bg:Cg;return b="y"===a.axis||"y2"===a.axis?sh?fg:"start"in a?d(a.start):fg:sh?"end"in a?Ag(Ri?ze(a.end):a.end):fg:fg,c>b?0:b-c}function kc(a){return Kg&&a===Kg||Ee(Lg)&&Fe(Lg,a)}function lc(a){return!kc(a)}function mc(a){return Kg?Kg:Ee(Lg)?Lg[a]:null}function nc(a,b){var c,d=b&&Ee(b)?Ec(b):[];return d.forEach(function(b){mc(b)===a&&(c=Lf.data.xs[b])}),c}function oc(a,b){return a in Lf.data.xs&&Lf.data.xs[a]&&Lf.data.xs[a][b]?Lf.data.xs[a][b]:b}function pc(a){Object.keys(a).forEach(function(b){Lg[b]=a[b]})}function qc(a){return 1===Kf.set(Object.keys(a).map(function(b){return a[b]})).size()}function rc(a){var b;return a&&(b=Og[a.id],a.name=b?b:a.id),a}function sc(a,b){a.forEach(function(a){a.values.forEach(function(c,d){c.x=uc(b[d],a.id,d)}),Lf.data.xs[a.id]=b})}function tc(a,b){a.forEach(function(a){b[a.id]&&sc([a],b[a.id])})}function uc(a,c,d){var e;return e=Ri?a?a instanceof Date?a:ze(a):ze(oc(c,d)):Ti&&!Si?b(a)?+a:oc(c,d):d}function vc(a){var b,c,d=a[0],e={},f=[];for(b=1;b=0?Lf.data.xs[c]=a.map(function(a){return a[f]}).filter(b):Kg?(d=Object.keys(Lf.data.xs),Lf.data.xs[c]=d.length>0?Lf.data.xs[d[0]]:void 0):Ee(Lg)&&(Lf.data.xs[c]=nc(f,Lf.data.targets)):Lf.data.xs[c]=a.map(function(a,b){return b})}),d.forEach(function(a){if(!Lf.data.xs[a])throw new Error('x is not defined for id = "'+a+'".')}),c=d.map(function(b,c){var d=Ng(b);return{id:d,id_org:b,values:a.map(function(a,e){var f=mc(b),g=a[f],h=uc(g,b,e);return Ti&&Si&&0===c&&g&&(0===e&&(wh=[]),wh.push(g)),("undefined"==typeof a[b]||Lf.data.xs[b].length<=e)&&(h=void 0),{x:h,value:null===a[b]||isNaN(a[b])?null:+a[b],id:d}}).filter(function(a){return"undefined"!=typeof a.x})}}),c.forEach(function(a){var b;a.values=a.values.sort(function(a,b){var c=a.x||0===a.x?a.x:1/0,d=b.x||0===b.x?b.x:1/0;return c-d}),b=0,a.values.forEach(function(a){a.index=b++})}),Sg&&ee(Ec(c).filter(function(a){return!(a in Tg)}),Sg),c.forEach(function(a){ec(a.id_org,a)}),c}function yc(a){return{id:a.id,id_org:a.id_org,values:a.values.map(function(a){return{x:a.x,value:a.value,id:a.id}})}}function zc(a){return a>0&&Lf.data.targets[0].values[a-1]?Lf.data.targets[0].values[a-1].x:void 0}function Ac(a){return a1?a.forEach(function(a){a.values.length>d&&(b=a,d=a.values.length)}):b=c?a[0]:null,b}function Dc(a){var b,c,d=Cc(a);return d?(b=d.values[0],c=d.values[d.values.length-1],[b.x,c.x]):[0,0]}function Ec(a){return a.map(function(a){return a.id})}function Fc(a){return a?"string"==typeof a?[a]:a:Ec(Lf.data.targets)}function Gc(a,b){var c,d=Ec(a);for(c=0;c2){for(f=c-2,d=a[0],e=a[a.length-1],g=(e-d)/(f+1),j=[d],h=0;f>h;h++)i=+d+g*(h+1),j.push(Ri?new Date(i):i);j.push(e)}return Ri||(j=j.sort(function(a,b){return a-b})),j}function Nc(a){bj=bj.concat(a)}function Oc(a){bj=bj.filter(function(b){return a.indexOf(b)<0})}function Pc(a){cj=cj.concat(a)}function Qc(a){cj=cj.filter(function(b){return a.indexOf(b)<0})}function Rc(a){var b={};return a.forEach(function(a){b[a.id]=[],a.values.forEach(function(c){b[a.id].push(c.value)})}),b}function Sc(a,b){var c,d,e,f=Object.keys(a);for(c=0;ca})}function Uc(a){return Sc(a,function(a){return a>0})}function Vc(a){return a=0&&d===a[c].x;c--)e.push(a[c]);for(c=b;c0?g=h:f=h,g-f===1||0===f&&0===g?(e=[],(a[f].x||0===a[f].x)&&(e=e.concat(Ld(a,f))),(a[g].x||0===a[g].x)&&(e=e.concat(Ld(a,g))),Od(e,b)):Md(a,b,f,g)}function Nd(a,b){var c;return c=a.map(function(a){return Md(a.values,b)}),Od(c,b)}function Od(a,b){var c,d;return a.forEach(function(a){var e=Ge(a,b);(c>e||!c)&&(c=e,d=a)}),d}function Pd(a,b){return Kf.merge(a.map(function(a){return a.values})).filter(function(a){return a.x-b===0})}function Qd(a){var b=a.getBoundingClientRect(),c=[a.pathSegList.getItem(0),a.pathSegList.getItem(1)],d=c[0].x,e=Math.min(c[0].y,c[1].y);return{x:d,y:e,width:b.width,height:b.height}}function Rd(){return Vg&&"desc"===Vg.toLowerCase()}function Sd(){return Vg&&"asc"===Vg.toLowerCase()}function Td(a){var b=Sd(),c=Rd();return b||c?a.sort(function(a,c){var d=function(a,b){return a+Math.abs(b.value)},e=a.values.reduce(d,0),f=c.values.reduce(d,0);return b?f-e:e-f}):"function"==typeof Vg&&a.sort(Vg),a}function Ud(a,c){var d,e,f,g,h,i,j,k=ke(Lf.data.targets),l=a.filter(function(a){return a&&b(a.value)});0!==l.length&&Ei&&(Bj.html(Hi(a,bb(),Bd(k),$i)).style("display","block"),d=Bj.property("offsetWidth"),e=Bj.property("offsetHeight"),k?(g=dg/2+c[0],i=fg/2+c[1]+20):(sh?(f=s(),g=f+c[0]+100,h=g+d,j=t()-w(),i=Ag(l[0].x)+20):(f=s(),g=f+v()+Ag(l[0].x)+20,h=g+d,j=f+t()-w(),i=c[1]+15),h>j&&(g-=d+60),i+e>u()&&(i-=e+30)),Bj.style("top",i+"px").style("left",g+"px"))}function Vd(){Bj.style("display","none")}function Wd(a){var c=a.filter(function(a){return a&&b(a.value)});if(Ei&&!he(Lf.data.targets)&&!ke(Lf.data.targets)){var d=yj.selectAll("line."+g.xgridFocus);d.style("visibility","visible").data([c[0]]).attr(sh?"y1":"x1",Hd).attr(sh?"y2":"x2",Hd),nf(d,"grid")}}function Xd(){yj.select("line."+g.xgridFocus).style("visibility","hidden")}function Yd(a,b){var c,d,e,f,h=[],i=yj.select("."+g.axisX).selectAll(".tick").size();if("year"===a)for(c=bc(),d=c[0].getFullYear(),e=c[1].getFullYear(),f=d;e>=f;f++)h.push(new Date(f+"-01-01 00:00:00"));else h=b.ticks(10);return h.slice(0,i)}function Zd(a){return a.x||0===a.x?Ag(a.x):null}function $d(a){return Y(a.id)(a.value)}function _d(){var a,b,d={},e=0;return Kc(Hc(ne)).forEach(function(f){for(a=0;a0&&(i+=g(b.values[f].value)-h)}),i}}function de(a,b){return"number"==typeof oi?oi:b?2*a.tickOffset()*pi/b:0}function ee(a,b){Fc(a).forEach(function(a){Fj[a]=b===Tg[a],Tg[a]=b})}function fe(a,b){var c=!1;return a.forEach(function(a){Tg[a.id]===b&&(c=!0),a.id in Tg||"line"!==b||(c=!0)}),c}function ge(a){return fe(a,"bar")}function he(a){return fe(a,"scatter")}function ie(a){return fe(a,"pie")}function je(a){return fe(a,"donut")}function ke(a){return ie(a)||je(a)}function le(a){var b="string"==typeof a?a:a.id;return!(b in Tg)||"line"===Tg[b]||"spline"===Tg[b]||"area"===Tg[b]||"area-spline"===Tg[b]}function me(a){var b="string"==typeof a?a:a.id;return"spline"===Tg[b]||"area-spline"===Tg[b]}function ne(a){var b="string"==typeof a?a:a.id;return"bar"===Tg[b]}function oe(a){var b="string"==typeof a?a:a.id;return"scatter"===Tg[b]}function pe(a){var b="string"==typeof a?a:a.id;return"pie"===Tg[b]}function qe(a){var b="string"==typeof a?a:a.id;return"donut"===Tg[b]}function re(a){return pe(a)||qe(a)}function se(a){return le(a)?[a]:[]}function te(a){return re(a.data)?[a]:[]}function ue(a){return ne(a)?a.values:[]}function ve(a){return le(a)||oe(a)?a.values:[]}function we(a){return ne(a)||le(a)?a.values:[]}function xe(a){return qe(a)&&yi||pe(a)&&si}function ye(a,b,c){var d=[];return function(e){var f,g=e.id||e;return a[g]instanceof Function?f=a[g](e):a[g]?f=a[g]:(d.indexOf(g)<0&&d.push(g),f=b[d.indexOf(g)%b.length]),c instanceof Function?c(f,e):f}}function ze(b){var c;try{c=Mg?Kf.time.format(Mg).parse(b):new Date(b)}catch(d){a.console.error("Failed to parse x '"+b+"' to Date with format "+Mg)}return c}function Ae(a,b){var c=Kf.mouse(a),d=Kf.select(a),e=1*d.attr("cx"),f=1*d.attr("cy");return Math.sqrt(Math.pow(e-c[0],2)+Math.pow(f-c[1],2))0}function Fe(a,b){var c=!1;return Object.keys(a).forEach(function(d){a[d]===b&&(c=!0)}),c}function Ge(a,b){var c="y"===ab(a.id)?Bg:Cg,d=sh?1:0,e=sh?0:1;return Math.pow(Ag(a.x)-b[d],2)+Math.pow(c(a.value)-b[e],2)}function He(a,b){var c=0;a.each(function(){++c}).each("end",function(){--c||b.apply(this,arguments)})}function Ie(a,b,c){return d(a[b])?a[b]:c}function Je(a,b,c){fh(b,a.node()),yj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).data([b]).enter().append("circle").attr("class",function(){return Wc(g.selectedCircle,c)}).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d).attr("stroke",function(){return $i(b)}).attr("r",1.4*Ue(b)).transition().duration(100).attr("r",Ue)}function Ke(a,b,c){gh(b,a.node()),yj.select("."+g.selectedCircles+qd(b.id)).selectAll("."+g.selectedCircle+"-"+c).transition().duration(100).attr("r",0).remove()}function Le(a,b,c,d){a?Je(b,c,d):Ke(b,c,d)}function Me(a,b){fh(b,a.node()),a.transition().duration(100).style("fill",function(){return Kf.rgb($i(b)).brighter(.75)})}function Ne(a,b){gh(b,a.node()),a.transition().duration(100).style("fill",function(){return $i(b)})}function Oe(a,b,c,d){a?Me(b,c,d):Ne(b,c,d)}function Pe(a,b,c,d){Oe(a,b,c.data,d)}function Qe(a){return"circle"===a.nodeName?Le:Kf.select(a).classed(g.bar)?Oe:Pe}function Re(a){return a.filter(function(a){return b(a.value)})}function Se(a){return hi?"function"==typeof ii?ii(a):ii:0}function Te(a){return ki?li?li:1.75*Se(a):Se(a)}function Ue(a){return mi?mi:4*Se(a)}function Ve(a,c){return(c?yj.selectAll("."+g.circles+qd(c)):yj).selectAll("."+g.circle+(b(a)?"-"+a:""))}function We(a,b){Ve(a,b).classed(g.EXPANDED,!0).attr("r",Te)}function Xe(a){Ve(a).filter(function(){return Kf.select(this).classed(g.EXPANDED)}).classed(g.EXPANDED,!1).attr("r",Se)}function Ye(a){return yj.selectAll("."+g.bar+(b(a)?"-"+a:""))}function Ze(a){Ye(a).classed(g.EXPANDED,!0)}function $e(a){Ye(a).classed(g.EXPANDED,!1)}function _e(a,b){var c=df(a,b);return function(a,b){var d=c(a,b),e=sh?1:0,f=sh?0:1,g="M "+d[0][e]+","+d[0][f]+" L"+d[1][e]+","+d[1][f]+" L"+d[2][e]+","+d[2][f]+" L"+d[3][e]+","+d[3][f]+" z";return g}}function af(a,b){var c=df(a,!1),d=b?bf:cf;return function(a,b){return d(c(a,b),a,this)}}function bf(a,b){var c;return sh?(c=ne(b)?4:6,a[2][1]+c*(b.value<0?-1:1)):a[0][0]+(a[2][0]-a[0][0])/2}function cf(a,b,c){var d=c.getBoundingClientRect();return sh?(a[0][0]+a[2][0]+.6*d.height)/2:a[2][1]+(b.value<0?d.height:ne(b)?-3:-6)}function df(a,b){var c=a.__max__+1,d=de(Gg,c),e=ae(d,c,a,!!b),f=be(!!b),g=ce(a,!!b),h=b?Z:Y;return function(a,b){var c=h(a.id)(0),i=g(a,b)||c,j=e(a),k=f(a);return sh&&(0k||a.value<0&&k>c)&&(k=c),[[j,i],[j,k-(c-i)],[j+d,k-(c-i)],[j+d,i]]}}function ef(a,b,e,f){var g,h,i,j,k,l,m,n,o,p,q,r,s=-1,t="M",u=[];if(d(f))for(g=0;g=h;h+=p)t+=i(a[g-1],a[g],h,o);s=a[g].x}return t}function ff(b){var c,d,e;if(Cj=Kf.select(Nf),Cj.empty())throw new Error('Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');if(Cj.html("").classed("c3",!0),Lf.data.xs={},Lf.data.targets=xc(b),Zg&&Nc(Zg===!0?Ec(Lf.data.targets):Zg),p(),T(),Ag.domain(Kf.extent(bc(Lf.data.targets))),Bg.domain(Zb(Lf.data.targets,"y")),Cg.domain(Zb(Lf.data.targets,"y2")),Dg.domain(Ag.domain()),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Dj=Ag.domain(),rj.scale(Dg),Uf&&vj.scale(Ag),wj=Cj.append("svg").on("mouseenter",Xf).on("mouseleave",Yf),xj=wj.append("defs"),xj.append("clipPath").attr("id",Li).append("rect"),xj.append("clipPath").attr("id",Mi).append("rect"),xj.append("clipPath").attr("id",Ni).append("rect"),sf(),yj=wj.append("g").attr("transform",ij.main),zj=wj.append("g").attr("transform",ij.context),Aj=wj.append("g").attr("transform",ij.legend),jh||zj.style("visibility","hidden"),mh||(Aj.style("visibility","hidden"),cj=Ec(Lf.data.targets)),Bj=Kf.select(Nf).style("position","relative").append("div").style("position","absolute").style("pointer-events","none").style("z-index","10").style("display","none"),Ff(Ec(Lf.data.targets),{withTransform:!1,withTransitionForTransform:!1}),d=yj.append("g").attr("clip-path",Oi).attr("class",g.grid),bi&&d.append("g").attr("class",g.xgrids),Ee(di)&&d.append("g").attr("class",g.xgridLines),ji&&d.append("g").attr("class",g.xgridFocus).append("line").attr("class",g.xgridFocus),ei&&d.append("g").attr("class",g.ygrids),Ee(fi)&&d.append("g").attr("class",g.ygridLines),yj.append("g").attr("clip-path",Oi).attr("class",g.regions),yj.append("g").attr("clip-path",Oi).attr("class",g.chart),c=yj.select("."+g.chart).append("g").attr("class",g.eventRects).style("fill-opacity",0).style("cursor",Uf?sh?"ns-resize":"ew-resize":null),yj.select("."+g.chart).append("g").attr("class",g.chartBars),yj.select("."+g.chart).append("g").attr("class",g.chartLines),yj.select("."+g.chart).append("g").attr("class",g.chartArcs).attr("transform",ij.arc).append("text").attr("class",g.chartArcsTitle).style("text-anchor","middle").text(Tb()),yj.select("."+g.chart).append("g").attr("class",g.chartTexts),Uf&&yj.insert("rect",Wf?null:"g."+g.grid).attr("class",g.zoomRect).attr("width",dg).attr("height",fg).style("opacity",0).style("cursor",sh?"ns-resize":"ew-resize").call(vj).on("dblclick.zoom",null),Jh&&rj.extent("function"!=typeof Jh?Jh:Jh(bc())),dj.x=yj.append("g").attr("class",g.axisX).attr("clip-path",Pi).attr("transform",ij.x).style("visibility",th?"visible":"hidden"),dj.x.append("text").attr("class",g.axisXLabel).attr("transform",sh?"rotate(-90)":"").style("text-anchor",Cb),dj.y=yj.append("g").attr("class",g.axisY).attr("clip-path",Qi).attr("transform",ij.y).style("visibility",Lh?"visible":"hidden"),dj.y.append("text").attr("class",g.axisYLabel).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Db),dj.y2=yj.append("g").attr("class",g.axisY2).attr("transform",ij.y2).style("visibility",Uh?"visible":"hidden"),dj.y2.append("text").attr("class",g.axisY2Label).attr("transform",sh?"":"rotate(-90)").style("text-anchor",Eb),zj.append("g").attr("clip-path",Oi).attr("class",g.chart),zj.select("."+g.chart).append("g").attr("class",g.chartBars),zj.select("."+g.chart).append("g").attr("class",g.chartLines),zj.append("g").attr("clip-path",Oi).attr("class",g.brush).call(rj).selectAll("rect").attr(sh?"width":"height",sh?eg:gg),dj.subx=zj.append("g").attr("class",g.axisX).attr("transform",ij.subx).attr("clip-path",sh?"":Pi),vf(Lf.data.targets),sh?yj.select("."+g.axisX).style("opacity",0).call(Gg):(yj.select("."+g.axisY).style("opacity",0).call(Hg),yj.select("."+g.axisY2).style("opacity",0).call(Ig)),p(),T(),sf(),o(!1),of({withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1}),Ii){if(Ri&&"string"==typeof Ji){for(Ji=ze(Ji),e=0;e0){d=[];for(var f in Og)for(c=0;cf&&h>c&&d>i&&j>d):"path"===this.nodeName&&(m=Qd(this),c=m.x,d=m.y,e=m.width,k=m.height,l=Oe,q=!(c>h||f>c+e||d>j||i>d+k)),q^p&&(n.classed(g.INCLUDED,!p),n.classed(g.SELECTED,!o),l(!o,n,a,b))}))}function lf(a){ke(Lf.data.targets)||$g&&(Ui=a,yj.select("."+g.chart).append("rect").attr("class",g.dragarea).style("opacity",.1),Vi=!0,hh())}function mf(){ke(Lf.data.targets)||$g&&(yj.select("."+g.dragarea).transition().duration(100).style("opacity",0).remove(),yj.selectAll("."+g.shape).classed(g.INCLUDED,!1),Vi=!1,ih())}function nf(a,b){"grid"===b&&a.each(function(){var a=Kf.select(this),b=a.attr("x1"),c=a.attr("x2"),d=a.attr("y1"),e=a.attr("y2");a.attr({x1:Math.ceil(b),x2:Math.ceil(c),y1:Math.ceil(d),y2:Math.ceil(e)})})}function of(a,c){var d,e,f,h,i,j,k,l,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W=_d(),X=ke(Lf.data.targets),Y=Kc(Lf.data.targets);if(a=a||{},C=Ie(a,"withY",!0),D=Ie(a,"withSubchart",!0),E=Ie(a,"withTransition",!0),H=Ie(a,"withTransform",!1),I=Ie(a,"withUpdateXDomain",!1),J=Ie(a,"withUpdateOrgXDomain",!1),K=Ie(a,"withLegend",!1),F=Ie(a,"withTransitionForExit",E),G=Ie(a,"withTransitionForAxis",E),Q=E?_f:0,R=F?Q:0,S=G?Q:0,c=c||tf(S),K&&mh&&Ff(Ec(Lf.data.targets),a,c),Si&&0===Y.length&&Ag.domain([0,dj.x.selectAll(".tick").size()]),Y.length&&(J&&(Ag.domain(Kf.extent(bc(Y))),Dj=Ag.domain(),Uf&&vj.scale(Ag).updateScaleExtent(),Dg.domain(Ag.domain()),rj.scale(Dg)),I&&(Ag.domain(rj.empty()?Dj:rj.extent()),Uf&&vj.scale(Ag).updateScaleExtent()),Dh||!Ch&&!Bh||(T=Mc(Lc(Y),Bh),Gg.tickValues(T),Jg.tickValues(T))),Bg.domain(Zb(Y,"y")),Cg.domain(Zb(Y,"y2")),dj.x.style("opacity",X?0:1),dj.y.style("opacity",X?0:1),dj.y2.style("opacity",X?0:1),dj.subx.style("opacity",X?0:1),c.axisX.call(Gg),c.axisY.call(Hg),c.axisY2.call(Ig),c.axisSubX.call(Jg),Gb(E),I&&Y.length)if(zh&&T){for(U=1;U=0&&Kf.select(this).style("display",b%V?"none":"block")})}else wj.selectAll("."+g.axisX+" .tick text").style("display","block");!sh&&Eh&&hb(dj.x,c.axisX,Eh),L=_e(W),O=af(W,!0),P=af(W,!1),Eg.domain(Bg.domain()),Fg.domain(Cg.domain()),Bj.style("display","none"),q(),yj.select("line."+g.xgridFocus).style("visibility","hidden"),bi&&(f=Yd(ci,Ag),z=Si?Gg.tickOffset():0,e=sh?{x1:0,x2:dg,y1:function(a){return Ag(a)-z},y2:function(a){return Ag(a)-z}}:{x1:function(a){return Ag(a)+z},x2:function(a){return Ag(a)+z},y1:ag.top,y2:fg},d=yj.select("."+g.xgrids).selectAll("."+g.xgrid).data(f),d.enter().append("line").attr("class",g.xgrid),d.attr(e).style("opacity",function(){return+Kf.select(this).attr(sh?"y1":"x1")===(sh?fg:0)?0:1}),d.exit().remove()),Ee(di)&&(h=yj.select("."+g.xgridLines).selectAll("."+g.xgridLine).data(di),i=h.enter().append("g").attr("class",function(a){return g.xgridLine+(a.class?a.class:"")}),i.append("line").style("opacity",0),i.append("text").attr("text-anchor","end").attr("transform",sh?"":"rotate(-90)").attr("dx",sh?0:-ag.top).attr("dy",-5).style("opacity",0),h.select("line").transition().duration(Q).attr("x1",sh?0:Id).attr("x2",sh?dg:Id).attr("y1",sh?Id:ag.top).attr("y2",sh?Id:fg).style("opacity",1),h.select("text").transition().duration(Q).attr("x",sh?dg:0).attr("y",Id).text(function(a){return a.text}).style("opacity",1),h.exit().transition().duration(Q).style("opacity",0).remove()),C&&ei&&(j=yj.select("."+g.ygrids).selectAll("."+g.ygrid).data(Bg.ticks(gi)),j.enter().append("line").attr("class",g.ygrid),j.attr("x1",sh?Bg:0).attr("x2",sh?Bg:dg).attr("y1",sh?0:Bg).attr("y2",sh?fg:Bg),j.exit().remove(),nf(j,"grid")),C&&Ee(fi)&&(k=yj.select("."+g.ygridLines).selectAll("."+g.ygridLine).data(fi),l=k.enter().append("g").attr("class",function(a){return g.ygridLine+(a.class?a.class:"")}),l.append("line").style("opacity",0),l.append("text").attr("text-anchor","end").attr("transform",sh?"rotate(-90)":"").attr("dx",sh?0:-ag.top).attr("dy",-5).style("opacity",0),k.select("line").transition().duration(Q).attr("x1",sh?Jd:0).attr("x2",sh?Jd:dg).attr("y1",sh?0:Jd).attr("y2",sh?fg:Jd).style("opacity",1),k.select("text").transition().duration(Q).attr("x",sh?0:dg).attr("y",Jd).text(function(a){return a.text}).style("opacity",1),k.exit().transition().duration(Q).style("opacity",0).remove()),s=yj.select("."+g.regions).selectAll("."+g.region).data(Di),s.enter().append("g").attr("class",jd).append("rect").style("fill-opacity",0),s.selectAll("rect").transition().duration(Q).attr("x",gc).attr("y",hc).attr("width",ic).attr("height",jc).style("fill-opacity",function(a){return b(a.opacity)?a.opacity:.1}),s.exit().transition().duration(Q).style("fill-opacity",0).remove(),p=yj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),p.enter().append("path").attr("class",dd).style("stroke","none").style("fill",$i),p.style("opacity",vd).transition().duration(Q).attr("d",L).style("fill",$i).style("opacity",1),p.exit().transition().duration(R).style("opacity",0).remove(),m=yj.selectAll("."+g.lines).selectAll("."+g.line).data(se),m.enter().append("path").attr("class",_c).style("stroke",$i),m.style("opacity",vd).transition().duration(Q).attr("d",sj).style("stroke",$i).style("opacity",1),m.exit().transition().duration(R).style("opacity",0).remove(),n=yj.selectAll("."+g.areas).selectAll("."+g.area).data(se),n.enter().append("path").attr("class",hd).style("fill",$i).style("opacity",function(){return Ej=+Kf.select(this).style("opacity"),0}),n.style("opacity",0).transition().duration(Q).attr("d",tj).style("fill",$i).style("opacity",Ej),n.exit().transition().duration(R).style("opacity",0).remove(),o=yj.selectAll("."+g.circles).selectAll("."+g.circle).data(ve),o.enter().append("circle").attr("class",bd).attr("r",Se).style("fill",$i),o.style("opacity",vd).transition().duration(Q).style("opacity",xd).style("fill",$i).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d),o.exit().remove(),t=yj.selectAll("."+g.texts).selectAll("."+g.text).data(we),t.enter().append("text").attr("class",Xc).attr("text-anchor",function(a){return sh?a.value<0?"end":"start":"middle"}).style("stroke","none").style("fill",$i).style("fill-opacity",0),t.text(function(a){return Gd(a.id)(a.value,a.id)}).style("fill-opacity",wd).transition().duration(Q).attr("x",O).attr("y",P).style("fill",$i).style("fill-opacity",yd),t.exit().transition().duration(R).style("fill-opacity",0).remove(),r=yj.selectAll("."+g.arcs).selectAll("."+g.arc).data(te),r.enter().append("path").attr("class",fd).style("fill",function(a){return $i(a.data)}).style("cursor",function(a){return ah(a)?"pointer":null}).style("opacity",0).each(function(a){this._current=a}).on("mouseover",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Vb(),Pb(c.data.id),Bf(c.data.id,!0),e(d,b))}).on("mousemove",function(a){var b=Hb(a),c=Nb(b),d=[c];Ud(d,Kf.mouse(this))}).on("mouseout",function(a,b){var c,d,e;Yi||(c=Hb(a),d=Nb(c),e=Wb(),Qb(c.data.id),Cf(),Vd(),e(d,b))}).on("click",function(a,b){var c=Hb(a),d=Nb(c),e=Ub();jf(this,a,b),e(d,b)}),r.attr("transform",H?"scale(0)":"").style("opacity",function(a){return a===this._current?0:1}).each(function(){Yi=!0}).transition().duration(Q).attrTween("d",function(a){var b,c=Hb(a);return c?(b=Kf.interpolate(this._current,c),this._current=b(0),function(a){return Kb(b(a),!0)}):function(){return"M 0 0"}}).attr("transform",H?"scale(1)":"").style("fill",function(a){return $i(a.data)}).style("opacity",1).call(He,function(){Yi=!1}),r.exit().transition().duration(R).style("opacity",0).remove(),yj.selectAll("."+g.chartArc).select("text").attr("transform",Lb).style("opacity",0).transition().duration(Q).text(Ob).style("opacity",function(a){return Ic(a.data.id)&&re(a.data)?1:0}),yj.select("."+g.chartArcsTitle).style("opacity",je(Lf.data.targets)?1:0),jh&&(Kf.event&&"zoom"===Kf.event.type&&rj.extent(Ag.orgDomain()).update(),D&&(!sh&&Eh&&hb(dj.subx,c.axisSubX,Eh),rj.empty()||rj.extent(Ag.orgDomain()).update(),M=_e(W,!0),v=zj.selectAll("."+g.bars).selectAll("."+g.bar).data(ue),v.enter().append("path").attr("class",dd).style("stroke","none").style("fill",$i),v.style("opacity",vd).transition().duration(Q).attr("d",M).style("opacity",1),v.exit().transition().duration(Q).style("opacity",0).remove(),u=zj.selectAll("."+g.lines).selectAll("."+g.line).data(se),u.enter().append("path").attr("class",_c).style("stroke",$i),u.style("opacity",vd).transition().duration(Q).attr("d",uj).style("opacity",1),u.exit().transition().duration(Q).style("opacity",0).remove())),yj.selectAll("."+g.selectedCircles).filter(function(a){return ne(a)}).selectAll("circle").remove(),yj.selectAll("."+g.selectedCircle).transition().duration(Q).attr("cx",sh?$d:Zd).attr("cy",sh?Zd:$d),w=yj.select("."+g.eventRects),Ee(Lg)&&!qc(Lg)?(w.classed(g.eventRectsMultiple)||w.classed(g.eventRectsMultiple,!0).classed(g.eventRectsSingle,!1).selectAll("."+g.eventRect).remove(),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data([0]),hf(x.enter()),x.attr("x",0).attr("y",0).attr("width",dg).attr("height",fg)):(w.classed(g.eventRectsSingle)||w.classed(g.eventRectsMultiple,!1).classed(g.eventRectsSingle,!0).selectAll("."+g.eventRect).remove(),Ti&&!Si?(B=function(a,b){var c=zc(b),d=Ac(b),e=Lf.data.xs[a.id][b];return(Ag(d?d:e+50)-Ag(c?c:e-50))/2},A=function(a,b){var c=zc(b),d=Lf.data.xs[a.id][b];return(Ag(d)+Ag(c?c:d-50))/2}):(B=N(),A=function(a){return Ag(a.x)-B/2}),y=Cc(Lf.data.targets),yj.select("."+g.eventRects).datum(y?y.values:[]),x=yj.select("."+g.eventRects).selectAll("."+g.eventRect).data(function(a){return a}),gf(x.enter()),x.attr("class",kd).attr("x",sh?0:A).attr("y",sh?A:0).attr("width",sh?dg:B).attr("height",sh?B:fg),x.exit().remove()),Ec(Lf.data.targets).forEach(function(a){Fj[a]=!0})}function pf(){of({withTransition:!1,withY:!1,withSubchart:!1,withUpdateXDomain:!0})}function qf(){if(0!==Kc(Lf.data.targets).length){if("mousemove"===Kf.event.sourceEvent.type&&vj.altDomain)return Ag.domain(vj.altDomain),void vj.scale(Ag).updateScaleExtent();Si&&Ag.orgDomain()[0]===Dj[0]&&Ag.domain([Dj[0]-1e-10,Ag.orgDomain()[1]]),of({withTransition:!1,withY:!1,withSubchart:!1}),"mousemove"===Kf.event.sourceEvent.type&&(Wi=!0)}}function rf(){function a(){b.forEach(function(a){a()})}var b=[];return a.add=function(a){b.push(a)},a}function sf(){wj.attr("width",hg).attr("height",ig),wj.select("#"+Li).select("rect").attr("width",dg).attr("height",fg),wj.select("#"+Mi).select("rect").attr("x",D).attr("y",E).attr("width",J).attr("height",K),wj.select("#"+Ni).select("rect").attr("x",F).attr("y",G).attr("width",L).attr("height",M),wj.select("."+g.zoomRect).attr("width",dg).attr("height",fg),Cj.style("max-height",ig+"px")}function tf(a){return{axisX:a?dj.x.transition().duration(a):dj.x,axisY:a?dj.y.transition().duration(a):dj.y,axisY2:a?dj.y2.transition().duration(a):dj.y2,axisSubX:a?dj.subx.transition().duration(a):dj.subx}}function uf(a){var b;a=a||{},a.withTransition=Ie(a,"withTransition",!0),a.withTransform=Ie(a,"withTransform",!1),a.withLegend=Ie(a,"withLegend",!1),a.withUpdateXDomain=!0,a.withUpdateOrgXDomain=!0,a.withTransitionForExit=!1,a.withLegend&&mh||(b=tf(a.withTransition?_f:0),p(),T(),sf(),o(a.withTransition,b)),of(a,b)}function vf(a){var b,c,d,e,f,h,i,j,k,l,m,n;i=yj.select("."+g.chartTexts).selectAll("."+g.chartText).data(a).attr("class",md),j=i.enter().append("g").attr("class",md).style("opacity",0).style("pointer-events","none"),j.append("g").attr("class",Yc),e=yj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),d=e.enter().append("g").attr("class",od).style("opacity",0).style("pointer-events","none"),d.append("g").attr("class",ed).style("cursor",function(a){return ah(a)?"pointer":null}),c=yj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),b=c.enter().append("g").attr("class",nd).style("opacity",0).style("pointer-events","none"),b.append("g").attr("class",ad),b.append("g").attr("class",id),b.append("g").attr("class",function(a){return Wc(g.selectedCircles,a.id)}),b.append("g").attr("class",cd).style("cursor",function(a){return ah(a)?"pointer":null}),a.forEach(function(a){yj.selectAll("."+g.selectedCircles+qd(a.id)).selectAll("."+g.selectedCircle).each(function(b,c){b.value=a.values[c].value})}),h=yj.select("."+g.chartArcs).selectAll("."+g.chartArc).data(rg(a)).attr("class",pd),f=h.enter().append("g").attr("class",pd),f.append("g").attr("class",gd),f.append("text").attr("dy",".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none"),jh&&(n=zj.select("."+g.chartBars).selectAll("."+g.chartBar).data(a).attr("class",od),m=n.enter().append("g").style("opacity",0).attr("class",od),m.append("g").attr("class",ed),l=zj.select("."+g.chartLines).selectAll("."+g.chartLine).data(a).attr("class",nd),k=l.enter().append("g").style("opacity",0).attr("class",nd),k.append("g").attr("class",ad)),wj.selectAll("."+g.target).filter(function(a){return Ic(a.id)}).transition().duration(_f).style("opacity",1)}function wf(a,b){(b.type||b.types)&&a.forEach(function(a){b.types?ee(a.id,b.types[a.id]):ee(a.id,b.type)}),Lf.data.targets.forEach(function(b){for(var c=0;cf&&(f=(l-k)/2,z=0,F++)),E[a]=F,D[F]=f,A[a]=z,z+=k}var f,g,h=b.getBoundingClientRect(),i=10*Math.ceil((h.width+v)/10),j=10*Math.ceil((h.height+u)/10),k=jj?j:i,l=jj?S():R();return d&&(z=0,F=0,w=0,x=0),mh&&!Jc(c)?void(B[c]=C[c]=E[c]=A[c]=0):(B[c]=i,C[c]=j,(!w||i>=w)&&(w=i),(!x||j>=x)&&(x=j),g=jj?x:w,void(rh?(Object.keys(B).forEach(function(a){B[a]=w}),Object.keys(C).forEach(function(a){C[a]=x}),f=(l-g*a.length)/2,y>f?(z=0,F=0,a.forEach(function(a){e(a)})):e(c,!0)):e(c)))}var f,h,i,j,k,l,m,n,q,r,s,t,u=4,v=26,w=0,x=0,y=10,z=0,A={},B={},C={},D=[0],E={},F=0,G=Aj.selectAll("."+g.legendItemFocused).size();b=b||{},n=Ie(b,"withTransition",!0),q=Ie(b,"withTransitionForTransform",!0),jj?(f=function(a){return w*E[a]},j=function(a){return D[E[a]]+A[a]}):(f=function(a){return D[E[a]]+A[a]},j=function(a){return x*E[a]}),h=function(a,b){return f(a,b)+14},k=function(a,b){return j(a,b)+9},i=function(a,b){return f(a,b)-4},l=function(a,b){return j(a,b)-7},m=Aj.selectAll("."+g.legendItem).data(a).enter().append("g").attr("class",function(a){return Wc(g.legendItem,a)}).style("visibility",function(a){return Jc(a)?"visible":"hidden"}).style("cursor","pointer").on("click",function(a){"function"==typeof oh?oh(a):Lf.toggle(a)}).on("mouseover",function(a){Kf.select(this).classed(g.legendItemFocused,!0),Yi||Lf.focus(a),"function"==typeof ph&&ph(a)}).on("mouseout",function(a){Kf.select(this).classed(g.legendItemFocused,!1),Yi||Lf.revert(),"function"==typeof qh&&qh(a)}),m.append("text").text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}).style("pointer-events","none").attr("x",jj?h:-200).attr("y",jj?-200:k),m.append("rect").attr("class",g.legendItemEvent).style("fill-opacity",0).attr("x",jj?i:-200).attr("y",jj?-200:l),m.append("rect").attr("class",g.legendItemTile).style("pointer-events","none").style("fill",$i).attr("x",jj?h:-200).attr("y",jj?-200:j).attr("width",10).attr("height",10),r=Aj.selectAll("text").data(a).text(function(a){return d(Og[a])?Og[a]:a}).each(function(a,b){e(this,a,0===b)}),(n?r.transition():r).attr("x",h).attr("y",k),s=Aj.selectAll("rect."+g.legendItemEvent).data(a),(n?s.transition():s).attr("width",function(a){return B[a]}).attr("height",function(a){return C[a]}).attr("x",i).attr("y",l),t=Aj.selectAll("rect."+g.legendItemTile).data(a),(n?t.transition():t).style("fill",$i).attr("x",f).attr("y",j),Aj.selectAll("."+g.legendItem).classed(g.legendItemHidden,function(a){return!Ic(a)}).transition().style("opacity",function(a){var b=Kf.select(this);return Ic(a)?!G||b.classed(g.legendItemFocused)?zf(b):Af(b):nj}),P(w),Q(x),O(F),p(),T(),sf(),o(q,c)}function Gf(a){return Gc(Lf.data.targets,a.id)}function Hf(a){return"data"in a&&Gc(Lf.data.targets,a.data.id)}function If(a){var b=a&&a.value?a.value:null,c=a&&a["class"]?a["class"]:null;return b?function(a){return a.value!==b}:c?function(a){return a["class"]!==c}:function(){return!0}}function Jf(a,b,c){var d=!ke(Lf.data.targets);Yi=!1,ee(a,b),uf(c||{withTransitionForAxis:d})}var Kf=a.d3?a.d3:a.require?a.require("d3"):void 0,Lf={data:{},axis:{},legend:{}},Mf={},Nf=i(["bindto"],"#chart"),Of=i(["size","width"]),Pf=i(["size","height"]),Qf=i(["padding","left"],50),Rf=i(["padding","right"],0),Sf=i(["padding","top"],0),Tf=i(["padding","bottom"],0),Uf=i(["zoom","enabled"],!1),Vf=i(["zoom","extent"]),Wf=i(["zoom","privileged"],!1),Xf=i(["onenter"],function(){}),Yf=i(["onleave"],function(){}),Zf=i(["onresize"],function(){}),$f=i(["onresized"],function(){}),_f=i(["transition","duration"],350);h("data","data is required in config");var ag,bg,cg,dg,eg,fg,gg,hg,ig,jg,kg,lg,mg,ng,og,pg,qg,rg,sg,tg,ug,vg,wg,xg,yg,zg,Ag,Bg,Cg,Dg,Eg,Fg,Gg,Hg,Ig,Jg,Kg=i(["data","x"]),Lg=i(["data","xs"],{}),Mg=i(["data","x_format"]),Ng=i(["data","id_converter"],function(a){return a}),Og=i(["data","names"],{}),Pg=i(["data","classes"],{}),Qg=i(["data","groups"],[]),Rg=i(["data","axes"],{}),Sg=i(["data","type"]),Tg=i(["data","types"],{}),Ug=i(["data","labels"],{}),Vg=i(["data","order"]),Wg=i(["data","regions"],{}),Xg=i(["data","color"]),Yg=i(["data","colors"],{}),Zg=i(["data","hide"],!1),$g=i(["data","selection","enabled"],!1),_g=i(["data","selection","grouped"],!1),ah=i(["data","selection","isselectable"],function(){return!0}),bh=i(["data","selection","multiple"],!0),ch=i(["data","onclick"],function(){}),dh=i(["data","onenter"],function(){}),eh=i(["data","onleave"],function(){}),fh=i(["data","onselected"],function(){}),gh=i(["data","onunselected"],function(){}),hh=i(["data","ondragstart"],function(){}),ih=i(["data","ondragend"],function(){}),jh=i(["subchart","show"],!1),kh=i(["subchart","size","height"],60),lh=i(["color","pattern"],[]),mh=i(["legend","show"],!0),nh=i(["legend","position"],"bottom"),oh=i(["legend","item","onclick"]),ph=i(["legend","item","onmouseover"]),qh=i(["legend","item","onmouseout"]),rh=i(["legend","equally"],!1),sh=i(["axis","rotated"],!1),th=i(["axis","x","show"],!0),uh=i(["axis","x","type"],"indexed"),vh=i(["axis","x","localtime"],!0),wh=i(["axis","x","categories"],[]),xh=i(["axis","x","tick","centered"],!1),yh=i(["axis","x","tick","format"]),zh=i(["axis","x","tick","culling"],{}),Ah=i(["axis","x","tick","culling","max"],10),Bh=i(["axis","x","tick","count"]),Ch=i(["axis","x","tick","fit"],!0),Dh=i(["axis","x","tick","values"],null),Eh=i(["axis","x","tick","rotate"]),Fh=i(["axis","x","max"],null),Gh=i(["axis","x","min"],null),Hh=i(["axis","x","padding"],{}),Ih=i(["axis","x","height"]),Jh=i(["axis","x","default"]),Kh=i(["axis","x","label"],{}),Lh=i(["axis","y","show"],!0),Mh=i(["axis","y","max"]),Nh=i(["axis","y","min"]),Oh=i(["axis","y","center"]),Ph=i(["axis","y","label"],{}),Qh=i(["axis","y","inner"],!1),Rh=i(["axis","y","tick","format"]),Sh=i(["axis","y","padding"]),Th=i(["axis","y","ticks"],10),Uh=i(["axis","y2","show"],!1),Vh=i(["axis","y2","max"]),Wh=i(["axis","y2","min"]),Xh=i(["axis","y2","center"]),Yh=i(["axis","y2","label"],{}),Zh=i(["axis","y2","inner"],!1),$h=i(["axis","y2","tick","format"]),_h=i(["axis","y2","padding"]),ai=i(["axis","y2","ticks"],10),bi=i(["grid","x","show"],!1),ci=i(["grid","x","type"],"tick"),di=i(["grid","x","lines"],[]),ei=i(["grid","y","show"],!1),fi=i(["grid","y","lines"],[]),gi=i(["grid","y","ticks"],10),hi=i(["point","show"],!0),ii=i(["point","r"],2.5),ji=i(["point","focus","line","enabled"],!0),ki=i(["point","focus","expand","enabled"],!0),li=i(["point","focus","expand","r"]),mi=i(["point","focus","select","r"]),ni=i(["line","connect_null"],!1),oi=i(["bar","width"]),pi=i(["bar","width","ratio"],.6),qi=i(["pie","label","show"],!0),ri=i(["pie","label","format"]),si=i(["pie","expand"],!0),ti=i(["pie","onclick"],function(){}),ui=i(["pie","onmouseover"],function(){}),vi=i(["pie","onmouseout"],function(){}),wi=i(["donut","label","show"],!0),xi=i(["donut","label","format"]),yi=i(["donut","expand"],!0),zi=i(["donut","title"],""),Ai=i(["donut","onclick"],function(){}),Bi=i(["donut","onmouseover"],function(){}),Ci=i(["donut","onmouseout"],function(){}),Di=i(["regions"],[]),Ei=i(["tooltip","show"],!0),Fi=i(["tooltip","format","title"]),Gi=i(["tooltip","format","value"]),Hi=i(["tooltip","contents"],function(a,b,c,d){var e,f,h,i,j,k=Fi?Fi:b,l=Gi?Gi:c;for(f=0;f"+(h||0===h?""+h+"":"")),j=a[f].name,i=l(a[f].value,a[f].ratio,a[f].id,a[f].index),e+="",e+=""+j+"",e+=""+i+"",e+="");return e+""}),Ii=i(["tooltip","init","show"],!1),Ji=i(["tooltip","init","x"],0),Ki=i(["tooltip","init","position"],{top:"0px",left:"50px"}),Li=("string"==typeof Nf?Nf.replace("#",""):Nf.id)+"-clip",Mi=Li+"-xaxis",Ni=Li+"-yaxis",Oi=j(Li),Pi=j(Mi),Qi=j(Ni),Ri="timeseries"===uh,Si="categorized"===uh,Ti=!Ri&&(Kg||Ee(Lg)),Ui=null,Vi=!1,Wi=!1,Xi=!1,Yi=!1,Zi=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],$i=ye(Yg,Ee(lh)?lh:Zi,Xg),_i=vh?Kf.time.format:Kf.time.format.utc,aj=_i.multi([[".%L",function(a){return a.getMilliseconds()}],[":%S",function(a){return a.getSeconds()}],["%I:%M",function(a){return a.getMinutes()}],["%I %p",function(a){return a.getHours()}],["%-m/%-d",function(a){return a.getDay()&&1!==a.getDate()}],["%-m/%-d",function(a){return 1!==a.getDate()}],["%-m/%-d",function(a){return a.getMonth()}],["%Y/%-m/%-d",function(){return!0}]]),bj=[],cj=[],dj={},ej=sh?"left":"bottom",fj=sh?Qh?"top":"bottom":Qh?"right":"left",gj=sh?Zh?"bottom":"top":Zh?"left":"right",hj=sh?"left":"bottom",ij={main:function(){return"translate("+k(ag.left)+","+k(ag.top)+")"},context:function(){return"translate("+k(bg.left)+","+k(bg.top)+")"},legend:function(){return"translate("+cg.left+","+cg.top+")"},x:function(){return"translate(0,"+(sh?0:fg)+")"},y:function(){return"translate(0,"+(sh?fg:0)+")"},y2:function(){return"translate("+(sh?0:dg)+","+(sh?1:0)+")"},subx:function(){return"translate(0,"+(sh?0:gg)+")"},arc:function(){return"translate("+mg/2+","+ng/2+")" }},jj="right"===nh,kj=0,lj=0,mj=0,nj=.15,oj=30,pj=sh&&!th?0:30,qj=5;rg=Kf.layout.pie().value(function(a){return a.values.reduce(function(a,b){return a+b.value},0)});var rj,sj=function(){var a=Kf.svg.line().x(sh?function(a){return Y(a.id)(a.value)}:Hd).y(sh?Hd:function(a){return Y(a.id)(a.value)});return ni||(a=a.defined(function(a){return null!=a.value})),function(b){var c,d,e=ni?Re(b.values):b.values;return le(b)?(a.interpolate(me(b)?"cardinal":"linear"),Wg[b.id]?ef(e,Ag,Y(b.id),Wg[b.id]):a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),tj=function(){var a;return a=sh?Kf.svg.area().x0(function(a){return Y(a.id)(0)}).x1(function(a){return Y(a.id)(a.value)}).y(Hd):Kf.svg.area().x(Hd).y0(function(a){return Y(a.id)(0)}).y1(function(a){return Y(a.id)(a.value)}),function(b){var c,d,e=Re(b.values);return fe([b],"area")||fe([b],"area-spline")?(a.interpolate(me(b)?"cardinal":"linear"),a(e)):(c=e[0]?Ag(e[0].x):0,d=e[0]?Y(b.id)(e[0].value):0,sh?"M "+d+" "+c:"M "+c+" "+d)}}(),uj=function(){var a=Kf.svg.line().x(sh?function(a){return Z(a.id)(a.value)}:Kd).y(sh?Kd:function(a){return Z(a.id)(a.value)});return function(b){var c=Re(b.values);return le(b)?a(c):"M "+Dg(c[0].x)+" "+Z(b.id)(c[0].value)}}(),vj=function(){};rj=Kf.svg.brush().on("brush",pf),rj.update=function(){return zj&&zj.select("."+g.brush).call(this),this},rj.scale=function(a){return sh?this.y(a):this.x(a)},Uf&&(vj=Kf.behavior.zoom().on("zoomstart",function(){vj.altDomain=Kf.event.sourceEvent.altKey?Ag.orgDomain():null}).on("zoom",Uf?qf:null),vj.scale=function(a){return sh?this.y(a):this.x(a)},vj.orgScaleExtent=function(){var a=Vf?Vf:[1,10];return[a[0],Math.max(Bc()/a[1],a[1])]},vj.updateScaleExtent=function(){var a=cc(Ag.orgDomain())/cc(Dj),b=this.orgScaleExtent();return this.scaleExtent([b[0]*a,b[1]*a]),this});var wj,xj,yj,zj,Aj,Bj,Cj,Dj,Ej,Fj={};if(Lf.focus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);Lf.revert(),Lf.defocus(),b(d.classed(g.focused,!0)),b(e),ke(Lf.data.targets)&&Pb(a,!0),Bf(a,!0)},Lf.defocus=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",.3)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);Lf.revert(),b(d.classed(g.focused,!1)),b(e),ke(Lf.data.targets)&&Qb(a),Bf(a,!1)},Lf.revert=function(a){function b(a){Kc(a).transition().duration(100).style("opacity",1)}var c=wj.selectAll(rd(a)),d=c.filter(Gf),e=c.filter(Hf);b(d.classed(g.focused,!1)),b(e),ke(Lf.data.targets)&&Qb(a),Cf()},Lf.show=function(a,b){a=Fc(a),b=b||{},Oc(a),wj.selectAll(sd(a)).transition().style("opacity",1),b.withLegend&&Df(a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Lf.hide=function(a,b){a=Fc(a),b=b||{},Nc(a),wj.selectAll(sd(a)).transition().style("opacity",0),b.withLegend&&Ef(a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0})},Lf.toggle=function(a){Ic(a)?Lf.hide(a):Lf.show(a)},Lf.unzoom=function(){rj.clear().update(),of({withUpdateXDomain:!0})},Lf.load=function(a){return a.xs&&pc(a.xs),"classes"in a&&Object.keys(a.classes).forEach(function(b){Pg[b]=a.classes[b]}),"categories"in a&&Si&&(wh=a.categories,Gg.categories(wh)),"cacheIds"in a&&dc(a.cacheIds)?void wf(fc(a.cacheIds),a.done):void("unload"in a?yf(Fc("boolean"==typeof a.unload&&a.unload?null:a.unload),function(){xf(a)}):xf(a))},Lf.unload=function(a,b){yf(Fc(a),function(){of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),"function"==typeof b&&b()})},Lf.selected=function(a){return Kf.merge(yj.selectAll("."+g.shapes+qd(a)).selectAll("."+g.shape).filter(function(){return Kf.select(this).classed(g.SELECTED)}).map(function(a){return a.map(function(a){var b=a.__data__;return b.data?b.data:b})}))},Lf.select=function(a,b,c){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(e,f){var h=Kf.select(this),i=e.data?e.data.id:e.id,j=Qe(this),k=_g||!a||a.indexOf(i)>=0,l=!b||b.indexOf(f)>=0,m=h.classed(g.SELECTED);"path"!==this.nodeName&&(k&&l?ah(e)&&!m&&j(!0,h.classed(g.SELECTED,!0),e,f):d(c)&&c&&m&&j(!1,h.classed(g.SELECTED,!1),e,f))})},Lf.unselect=function(a,b){$g&&yj.selectAll("."+g.shapes).selectAll("."+g.shape).each(function(c,d){var e=Kf.select(this),f=c.data?c.data.id:c.id,h=Qe(this),i=_g||!a||a.indexOf(f)>=0,j=!b||b.indexOf(d)>=0,k=e.classed(g.SELECTED);"path"!==this.nodeName&&i&&j&&ah(c)&&k&&h(!1,e.classed(g.SELECTED,!1),c,d)})},Lf.toLine=function(a){Jf(a,"line")},Lf.toSpline=function(a){Jf(a,"spline")},Lf.toBar=function(a){Jf(a,"bar")},Lf.toScatter=function(a){Jf(a,"scatter")},Lf.toArea=function(a){Jf(a,"area")},Lf.toAreaSpline=function(a){Jf(a,"area-spline")},Lf.toPie=function(a){Jf(a,"pie",{withTransform:!0})},Lf.toDonut=function(a){Jf(a,"donut",{withTransform:!0})},Lf.groups=function(a){return c(a)?Qg:(Qg=a,of(),Qg)},Lf.xgrids=function(a){return a?(di=a,of(),di):di},Lf.xgrids.add=function(a){return a?Lf.xgrids(di.concat(a)):void 0},Lf.xgrids.remove=function(a){var b=If(a);return Lf.xgrids(di.filter(b))},Lf.ygrids=function(a){return a?(fi=a,of(),fi):fi},Lf.ygrids.add=function(a){return a?Lf.ygrids(fi.concat(a)):void 0},Lf.ygrids.remove=function(a){var b=If(a);return Lf.ygrids(fi.filter(b))},Lf.regions=function(a){return c(a)?Di:(Di=a,of(),Di)},Lf.regions.add=function(a){return c(a)?Di:(Di=Di.concat(a),of(),Di)},Lf.regions.remove=function(a,c){var e=[].concat(a);return c=d(c)?c:{},e.forEach(function(a){var d=b(c.duration)?c.duration:0;wj.selectAll("."+a).transition().duration(d).style("fill-opacity",0).remove(),Di=Di.filter(function(b){return b.classes.indexOf(a)<0})}),Di},Lf.data.get=function(a){var b=Lf.data.getAsTarget(a);return d(b)?b.values.map(function(a){return a.value}):void 0},Lf.data.getAsTarget=function(a){var b=Hc(function(b){return b.id===a});return b.length>0?b[0]:void 0},Lf.data.names=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Og[b]=a[b]}),of({withLegend:!0}),Og):Og},Lf.data.colors=function(a){return arguments.length?(Object.keys(a).forEach(function(b){Yg[b]=a[b]}),of({withLegend:!0}),Yg):Yg},Lf.x=function(a){return arguments.length&&(sc(Lf.data.targets,a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Lf.data.xs},Lf.xs=function(a){return arguments.length&&(tc(Lf.data.targets,a),of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),Lf.data.xs},Lf.axis.labels=function(a){arguments.length&&(Object.keys(a).forEach(function(b){eb(b,a[b])}),Gb())},Lf.axis.max=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Fh=+a.x),b(a.y)&&(Mh=+a.y),b(a.y2)&&(Vh=+a.y2)):Mh=Vh=+a,of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Lf.axis.min=function(a){arguments.length&&("object"==typeof a?(b(a.x)&&(Gh=+a.x),b(a.y)&&(Nh=+a.y),b(a.y2)&&(Wh=+a.y2)):Nh=Wh=+a,of({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))},Lf.axis.range=function(a){arguments.length&&("undefined"!=typeof a.max&&Lf.axis.max(a.max),"undefined"!=typeof a.min&&Lf.axis.min(a.min))},Lf.legend.show=function(a){Df(Fc(a)),of({withLegend:!0})},Lf.legend.hide=function(a){Ef(Fc(a)),of({withLegend:!0})},Lf.resize=function(a){Of=a?a.width:null,Pf=a?a.height:null,uf({withLegend:!0,withTransition:!1,withTransitionForTransform:!1})},Lf.destroy=function(){Lf.data.targets=void 0,Lf.data.xs={},Cj.html(""),a.onresize=null},"url"in f.data)Kf.xhr(f.data.url,function(a,b){var c,d=Kf.csv.parseRows(b.response);1===d.length?(c=[{}],d[0].forEach(function(a){c[0][a]=null})):c=Kf.csv.parse(b.response),ff(c)});else if("rows"in f.data)ff(vc(f.data.rows));else{if(!("columns"in f.data))throw Error("url or rows or columns is required.");ff(wc(f.data.columns))}return Lf},"function"==typeof a.define&&a.define.amd?a.define("c3",["d3"],f):a.c3=f}(window);