!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.c3=e()}(this,function(){"use strict";function r(t,e){var n=this;n.component=t,n.params=e||{},n.d3=t.d3,n.scale=n.d3.scale.linear(),n.range,n.orient="bottom",n.innerTickSize=6,n.outerTickSize=this.params.withOuterTick?6:0,n.tickPadding=3,n.tickValues=null,n.tickFormat,n.tickArguments,n.tickOffset=0,n.tickCulling=!0,n.tickCentered,n.tickTextCharSize,n.tickTextRotate=n.params.tickTextRotate,n.tickLength,n.axis=n.generateAxis()}function e(t){var e=this.internal=new n(this);e.loadConfig(t),e.beforeInit(t),e.init(),e.afterInit(t),function e(n,i,r){Object.keys(n).forEach(function(t){i[t]=n[t].bind(r),0/g,">"):t},v=function(t){var e=t.getBoundingClientRect(),n=[t.pathSegList.getItem(0),t.pathSegList.getItem(1)];return{x:n[0].x,y:Math.min(n[0].y,n[1].y),width:e.width,height:e.height}};(o=r.prototype).axisX=function(t,e,n){t.attr("transform",function(t){return"translate("+Math.ceil(e(t)+n)+", 0)"})},o.axisY=function(t,e){t.attr("transform",function(t){return"translate(0,"+Math.ceil(e(t))+")"})},o.scaleExtent=function(t){var e=t[0],n=t[t.length-1];return ee.getTotalLength())break;n--}while(0=this.numberOfItems)throw"INDEX_SIZE_ERR"},window.SVGPathSegList.prototype.getItem=function(t){return this._checkPathSynchronizedToList(),this._checkValidIndex(t),this._list[t]},window.SVGPathSegList.prototype.insertItemBefore=function(t,e){return this._checkPathSynchronizedToList(),e>this.numberOfItems&&(e=this.numberOfItems),t._owningPathSegList&&(t=t.clone()),this._list.splice(e,0,t),(t._owningPathSegList=this)._writeListToPath(),t},window.SVGPathSegList.prototype.replaceItem=function(t,e){return this._checkPathSynchronizedToList(),t._owningPathSegList&&(t=t.clone()),this._checkValidIndex(e),((this._list[e]=t)._owningPathSegList=this)._writeListToPath(),t},window.SVGPathSegList.prototype.removeItem=function(t){this._checkPathSynchronizedToList(),this._checkValidIndex(t);var e=this._list[t];return this._list.splice(t,1),this._writeListToPath(),e},window.SVGPathSegList.prototype.appendItem=function(t){return this._checkPathSynchronizedToList(),t._owningPathSegList&&(t=t.clone()),this._list.push(t),(t._owningPathSegList=this)._writeListToPath(),t},window.SVGPathSegList._pathSegArrayAsString=function(t){var e="",n=!0;return t.forEach(function(t){n?(n=!1,e+=t._asPathString()):e+=" "+t._asPathString()}),e},window.SVGPathSegList.prototype._parsePath=function(t){if(!t||0==t.length)return[];var i=this,e=function(){this.pathSegList=[]};e.prototype.appendSegment=function(t){this.pathSegList.push(t)};var n=function(t){this._string=t,this._currentIndex=0,this._endIndex=this._string.length,this._previousCommand=window.SVGPathSeg.PATHSEG_UNKNOWN,this._skipOptionalSpaces()};n.prototype._isCurrentSpace=function(){var t=this._string[this._currentIndex];return t<=" "&&(" "==t||"\n"==t||"\t"==t||"\r"==t||"\f"==t)},n.prototype._skipOptionalSpaces=function(){for(;this._currentIndex=this._endIndex||this._string.charAt(this._currentIndex)<"0"||"9"=this._endIndex||this._string.charAt(this._currentIndex)<"0"||"9"=this._endIndex)){var t=!1,e=this._string.charAt(this._currentIndex++);if("0"==e)t=!1;else{if("1"!=e)return;t=!0}return this._skipOptionalSpacesOrDelimiter(),t}},n.prototype.parseSegment=function(){var t=this._string[this._currentIndex],e=this._pathSegTypeFromChar(t);if(e==window.SVGPathSeg.PATHSEG_UNKNOWN){if(this._previousCommand==window.SVGPathSeg.PATHSEG_UNKNOWN)return null;if((e=this._nextCommandHelper(t,this._previousCommand))==window.SVGPathSeg.PATHSEG_UNKNOWN)return null}else this._currentIndex++;switch(this._previousCommand=e){case window.SVGPathSeg.PATHSEG_MOVETO_REL:return new window.SVGPathSegMovetoRel(i,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_MOVETO_ABS:return new window.SVGPathSegMovetoAbs(i,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_REL:return new window.SVGPathSegLinetoRel(i,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_ABS:return new window.SVGPathSegLinetoAbs(i,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:return new window.SVGPathSegLinetoHorizontalRel(i,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:return new window.SVGPathSegLinetoHorizontalAbs(i,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:return new window.SVGPathSegLinetoVerticalRel(i,this._parseNumber());case window.SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:return new window.SVGPathSegLinetoVerticalAbs(i,this._parseNumber());case window.SVGPathSeg.PATHSEG_CLOSEPATH:return this._skipOptionalSpaces(),new window.SVGPathSegClosePath(i);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:return n={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicRel(i,n.x,n.y,n.x1,n.y1,n.x2,n.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:return n={x1:this._parseNumber(),y1:this._parseNumber(),x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicAbs(i,n.x,n.y,n.x1,n.y1,n.x2,n.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:return n={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothRel(i,n.x,n.y,n.x2,n.y2);case window.SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:return n={x2:this._parseNumber(),y2:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoCubicSmoothAbs(i,n.x,n.y,n.x2,n.y2);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:return n={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticRel(i,n.x,n.y,n.x1,n.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:return n={x1:this._parseNumber(),y1:this._parseNumber(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegCurvetoQuadraticAbs(i,n.x,n.y,n.x1,n.y1);case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL:return new window.SVGPathSegCurvetoQuadraticSmoothRel(i,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS:return new window.SVGPathSegCurvetoQuadraticSmoothAbs(i,this._parseNumber(),this._parseNumber());case window.SVGPathSeg.PATHSEG_ARC_REL:return n={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()},new window.SVGPathSegArcRel(i,n.x,n.y,n.x1,n.y1,n.arcAngle,n.arcLarge,n.arcSweep);case window.SVGPathSeg.PATHSEG_ARC_ABS:var n={x1:this._parseNumber(),y1:this._parseNumber(),arcAngle:this._parseNumber(),arcLarge:this._parseArcFlag(),arcSweep:this._parseArcFlag(),x:this._parseNumber(),y:this._parseNumber()};return new window.SVGPathSegArcAbs(i,n.x,n.y,n.x1,n.y1,n.arcAngle,n.arcLarge,n.arcSweep);default:throw"Unknown path seg type."}};var r=new e,a=new n(t);if(!a.initialCommandIsMoveTo())return[];for(;a.hasMoreData();){var o=a.parseSegment();if(!o)return[];r.appendSegment(o)}return r.pathSegList}),y.axis=function(){},y.axis.labels=function(e){var n=this.internal;arguments.length&&(Object.keys(e).forEach(function(t){n.axis.setLabelText(t,e[t])}),n.axis.updateLabels())},y.axis.max=function(t){var e=this.internal,n=e.config;if(!arguments.length)return{x:n.axis_x_max,y:n.axis_y_max,y2:n.axis_y2_max};"object"===(void 0===t?"undefined":s(t))?(P(t.x)&&(n.axis_x_max=t.x),P(t.y)&&(n.axis_y_max=t.y),P(t.y2)&&(n.axis_y2_max=t.y2)):n.axis_y_max=n.axis_y2_max=t,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},y.axis.min=function(t){var e=this.internal,n=e.config;if(!arguments.length)return{x:n.axis_x_min,y:n.axis_y_min,y2:n.axis_y2_min};"object"===(void 0===t?"undefined":s(t))?(P(t.x)&&(n.axis_x_min=t.x),P(t.y)&&(n.axis_y_min=t.y),P(t.y2)&&(n.axis_y2_min=t.y2)):n.axis_y_min=n.axis_y2_min=t,e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})},y.axis.range=function(t){if(!arguments.length)return{max:this.axis.max(),min:this.axis.min()};void 0!==t.max&&this.axis.max(t.max),void 0!==t.min&&this.axis.min(t.min)},y.category=function(t,e){var n=this.internal,i=n.config;return 1=(this.hasType("donut")?e.donut_label_threshold:e.pie_label_threshold)},m.getArcLabelFormat=function(){var t=this.config,e=t.pie_label_format;return this.hasType("gauge")?e=t.gauge_label_format:this.hasType("donut")&&(e=t.donut_label_format),e},m.getGaugeLabelExtents=function(){return this.config.gauge_label_extents},m.getArcTitle=function(){return this.hasType("donut")?this.config.donut_title:""},m.updateTargetsForArc=function(t){var e,n=this,i=n.main,r=n.classChartArc.bind(n),a=n.classArcs.bind(n),o=n.classFocus.bind(n);(e=i.select("."+X.chartArcs).selectAll("."+X.chartArc).data(n.pie(t)).attr("class",function(t){return r(t)+o(t.data)}).enter().append("g").attr("class",r)).append("g").attr("class",a),e.append("text").attr("dy",n.hasType("gauge")?"-.1em":".35em").style("opacity",0).style("text-anchor","middle").style("pointer-events","none")},m.initArc=function(){var t=this;t.arcs=t.main.select("."+X.chart).append("g").attr("class",X.chartArcs).attr("transform",t.getTranslate("arc")),t.arcs.append("text").attr("class",X.chartArcsTitle).style("text-anchor","middle").text(t.getArcTitle())},m.redrawArc=function(t,e,n){var i,r=this,a=r.d3,o=r.config,s=r.main;(i=s.selectAll("."+X.arcs).selectAll("."+X.arc).data(r.arcData.bind(r))).enter().append("path").attr("class",r.classArc.bind(r)).style("fill",function(t){return r.color(t.data)}).style("cursor",function(t){return o.interaction_enabled&&o.data_selection_isselectable(t)?"pointer":null}).each(function(t){r.isGaugeType(t.data)&&(t.startAngle=t.endAngle=o.gauge_startingAngle),this._current=t}),i.attr("transform",function(t){return!r.isGaugeType(t.data)&&n?"scale(0)":""}).on("mouseover",o.interaction_enabled?function(t){var e,n;r.transiting||(e=r.updateAngle(t))&&(n=r.convertToArcData(e),r.expandArc(e.data.id),r.api.focus(e.data.id),r.toggleFocusLegend(e.data.id,!0),r.config.data_onmouseover(n,this))}:null).on("mousemove",o.interaction_enabled?function(t){var e,n=r.updateAngle(t);n&&(e=[r.convertToArcData(n)],r.showTooltip(e,this))}:null).on("mouseout",o.interaction_enabled?function(t){var e,n;r.transiting||(e=r.updateAngle(t))&&(n=r.convertToArcData(e),r.unexpandArc(e.data.id),r.api.revert(),r.revertLegend(),r.hideTooltip(),r.config.data_onmouseout(n,this))}:null).on("click",o.interaction_enabled?function(t,e){var n,i=r.updateAngle(t);i&&(n=r.convertToArcData(i),r.toggleShape&&r.toggleShape(this,n,e),r.config.data_onclick.call(r.api,n,this))}:null).each(function(){r.transiting=!0}).transition().duration(t).attrTween("d",function(n){var i,t=r.updateAngle(n);return t?(isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle),i=a.interpolate(this._current,t),this._current=i(0),function(t){var e=i(t);return e.data=n.data,r.getArc(e,!0)}):function(){return"M 0 0"}}).attr("transform",n?"scale(1)":"").style("fill",function(t){return r.levelColor?r.levelColor(t.data.values[0].value):r.color(t.data.id)}).call(r.endall,function(){r.transiting=!1}),i.exit().transition().duration(e).style("opacity",0).remove(),s.selectAll("."+X.chartArc).select("text").style("opacity",0).attr("class",function(t){return r.isGaugeType(t.data)?X.gaugeValue:""}).text(r.textForArcLabel.bind(r)).attr("transform",r.transformForArcLabel.bind(r)).style("font-size",function(t){return r.isGaugeType(t.data)?Math.round(r.radius/5)+"px":""}).transition().duration(t).style("opacity",function(t){return r.isTargetToShow(t.data.id)&&r.isArcType(t.data)?1:0}),s.select("."+X.chartArcsTitle).style("opacity",r.hasType("donut")||r.hasType("gauge")?1:0),r.hasType("gauge")&&(r.arcs.select("."+X.chartArcsBackground).attr("d",function(){var t={data:[{value:o.gauge_max}],startAngle:o.gauge_startingAngle,endAngle:-1*o.gauge_startingAngle};return r.getArc(t,!0,!0)}),r.arcs.select("."+X.chartArcsGaugeUnit).attr("dy",".75em").text(o.gauge_label_show?o.gauge_units:""),r.arcs.select("."+X.chartArcsGaugeMin).attr("dx",-1*(r.innerRadius+(r.radius-r.innerRadius)/(o.gauge_fullCircle?1:2))+"px").attr("dy","1.2em").text(o.gauge_label_show?r.textForGaugeMinMax(o.gauge_min,!1):""),r.arcs.select("."+X.chartArcsGaugeMax).attr("dx",r.innerRadius+(r.radius-r.innerRadius)/(o.gauge_fullCircle?1:2)+"px").attr("dy","1.2em").text(o.gauge_label_show?r.textForGaugeMinMax(o.gauge_max,!0):""))},m.initGauge=function(){var t=this.arcs;this.hasType("gauge")&&(t.append("path").attr("class",X.chartArcsBackground),t.append("text").attr("class",X.chartArcsGaugeUnit).style("text-anchor","middle").style("pointer-events","none"),t.append("text").attr("class",X.chartArcsGaugeMin).style("text-anchor","middle").style("pointer-events","none"),t.append("text").attr("class",X.chartArcsGaugeMax).style("text-anchor","middle").style("pointer-events","none"))},m.getGaugeLabelHeight=function(){return this.config.gauge_label_show?20:0},m.hasCaches=function(t){for(var e=0;e'":;\[\]\/|~`{}\\]/g,"-"):""},m.selectorTarget=function(t,e){return(e||"")+"."+X.target+this.getTargetSelectorSuffix(t)},m.selectorTargets=function(t,e){var n=this;return(t=t||[]).length?t.map(function(t){return n.selectorTarget(t,e)}):null},m.selectorLegend=function(t){return"."+X.legendItem+this.getTargetSelectorSuffix(t)},m.selectorLegends=function(t){var e=this;return t&&t.length?t.map(function(t){return e.selectorLegend(t)}):null},m.getClipPath=function(t){return"url("+(0<=window.navigator.appVersion.toLowerCase().indexOf("msie 9.")?"":document.URL.split("#")[0])+"#"+t+")"},m.appendClip=function(t,e){return t.append("clipPath").attr("id",e).append("rect")},m.getAxisClipX=function(t){var e=Math.max(30,this.margin.left);return t?-(1+e):-(e-1)},m.getAxisClipY=function(t){return t?-20:-this.margin.top},m.getXAxisClipX=function(){return this.getAxisClipX(!this.config.axis_rotated)},m.getXAxisClipY=function(){return this.getAxisClipY(!this.config.axis_rotated)},m.getYAxisClipX=function(){return this.config.axis_y_inner?-1:this.getAxisClipX(this.config.axis_rotated)},m.getYAxisClipY=function(){return this.getAxisClipY(this.config.axis_rotated)},m.getAxisClipWidth=function(t){var e=Math.max(30,this.margin.left),n=Math.max(30,this.margin.right);return t?this.width+2+e+n:this.margin.left+20},m.getAxisClipHeight=function(t){return(t?this.margin.bottom:this.margin.top+this.height)+20},m.getXAxisClipWidth=function(){return this.getAxisClipWidth(!this.config.axis_rotated)},m.getXAxisClipHeight=function(){return this.getAxisClipHeight(!this.config.axis_rotated)},m.getYAxisClipWidth=function(){return this.getAxisClipWidth(this.config.axis_rotated)+(this.config.axis_y_inner?20:0)},m.getYAxisClipHeight=function(){return this.getAxisClipHeight(this.config.axis_rotated)},m.generateColor=function(){var t=this.config,e=this.d3,i=t.data_colors,r=C(t.color_pattern)?t.color_pattern:e.scale.category10().range(),a=t.data_color,o=[];return function(t){var e,n=t.id||t.data&&t.data.id||t;return i[n]instanceof Function?e=i[n](t):i[n]?e=i[n]:(o.indexOf(n)<0&&o.push(n),e=r[o.indexOf(n)%r.length],i[n]=e),a instanceof Function?a(e,t):e}},m.generateLevelColor=function(){var t=this.config,i=t.color_pattern,e=t.color_threshold,r="value"===e.unit,a=e.values&&e.values.length?e.values:[],o=e.max||100;return C(t.color_threshold)?function(t){var e,n=i[i.length-1];for(e=0;ei&&(i=(e=t).values.length)}):e=n?t[0]:null,e},m.getEdgeX=function(t){return t.length?[this.d3.min(t,function(t){return t.values[0].x}),this.d3.max(t,function(t){return t.values[t.values.length-1].x})]:[0,0]},m.mapToIds=function(t){return t.map(function(t){return t.id})},m.mapToTargetIds=function(t){return t?[].concat(t):this.mapToIds(this.data.targets)},m.hasTarget=function(t,e){var n,i=this.mapToIds(t);for(n=0;ns&&(o=o.filter(function(t){return(""+t).indexOf(".")<0}));return o},m.getGridFilterToRemove=function(t){return t?function(e){var n=!1;return[].concat(t).forEach(function(t){("value"in t&&e.value===t.value||"class"in t&&e.class===t.class)&&(n=!0)}),n}:function(){return!0}},m.removeGridLines=function(t,e){var n=this.config,i=this.getGridFilterToRemove(t),r=function(t){return!i(t)},a=e?X.xgridLines:X.ygridLines,o=e?X.xgridLine:X.ygridLine;this.main.select("."+a).selectAll("."+o).filter(i).transition().duration(n.transition_duration).style("opacity",0).remove(),e?n.grid_x_lines=n.grid_x_lines.filter(r):n.grid_y_lines=n.grid_y_lines.filter(r)},m.initEventRect=function(){this.main.select("."+X.chart).append("g").attr("class",X.eventRects).style("fill-opacity",0)},m.redrawEventRect=function(){var t,e,n=this,i=n.config,r=n.isMultipleX(),a=n.main.select("."+X.eventRects).style("cursor",i.zoom_enabled?i.axis_rotated?"ns-resize":"ew-resize":null).classed(X.eventRectsMultiple,r).classed(X.eventRectsSingle,!r);a.selectAll("."+X.eventRect).remove(),n.eventRect=a.selectAll("."+X.eventRect),r?(t=n.eventRect.data([0]),n.generateEventRectsForMultipleXs(t.enter()),n.updateEventRect(t)):(e=n.getMaxDataCountTarget(n.data.targets),a.datum(e?e.values:[]),n.eventRect=a.selectAll("."+X.eventRect),t=n.eventRect.data(function(t){return t}),n.generateEventRectsForSingleX(t.enter()),n.updateEventRect(t),t.exit().remove())},m.updateEventRect=function(t){var e,n,i,r,a,o,s=this,u=s.config;t=t||s.eventRect.data(function(t){return t}),r=s.isMultipleX()?(n=e=0,i=s.width,s.height):(o=!s.isCustomX()&&!s.isTimeSeries()||s.isCategorized()?(a=s.getEventRectWidth(),function(t){return s.x(t.x)-a/2}):(s.updateXs(),a=function(t){var e=s.getPrevX(t.index),n=s.getNextX(t.index);return null===e&&null===n?u.axis_rotated?s.height:s.width:(null===e&&(e=s.x.domain()[0]),null===n&&(n=s.x.domain()[1]),Math.max(0,(s.x(n)-s.x(e))/2))},function(t){var e=s.getPrevX(t.index),n=s.getNextX(t.index),i=s.data.xs[t.id][t.index];return null===e&&null===n?0:(null===e&&(e=s.x.domain()[0]),(s.x(i)+s.x(e))/2)}),e=u.axis_rotated?0:o,n=u.axis_rotated?o:0,i=u.axis_rotated?s.width:a,u.axis_rotated?a:s.height),t.attr("class",s.classEvent.bind(s)).attr("x",e).attr("y",n).attr("width",i).attr("height",r)},m.generateEventRectsForSingleX=function(t){var r=this,a=r.d3,o=r.config;t.append("rect").attr("class",r.classEvent.bind(r)).style("cursor",o.data_selection_enabled&&o.data_selection_grouped?"pointer":null).on("mouseover",function(t){var e=t.index;r.dragging||r.flowing||r.hasArcType()||(o.point_focus_expand_enabled&&r.expandCircles(e,null,!0),r.expandBars(e,null,!0),r.main.selectAll("."+X.shape+"-"+e).each(function(t){o.data_onmouseover.call(r.api,t)}))}).on("mouseout",function(t){var e=t.index;r.config&&(r.hasArcType()||(r.hideXGridFocus(),r.hideTooltip(),r.unexpandCircles(),r.unexpandBars(),r.main.selectAll("."+X.shape+"-"+e).each(function(t){o.data_onmouseout.call(r.api,t)})))}).on("mousemove",function(t){var e,n=t.index,i=r.svg.select("."+X.eventRect+"-"+n);r.dragging||r.flowing||r.hasArcType()||(r.isStepType(t)&&"step-after"===r.config.line_step_type&&a.mouse(this)[0]n.bar_width_max?n.bar_width_max:i},m.getBars=function(t,e){return(e?this.main.selectAll("."+X.bars+this.getTargetSelectorSuffix(e)):this.main).selectAll("."+X.bar+(P(t)?"-"+t:""))},m.expandBars=function(t,e,n){n&&this.unexpandBars(),this.getBars(t,e).classed(X.EXPANDED,!0)},m.unexpandBars=function(t){this.getBars(t).classed(X.EXPANDED,!1)},m.generateDrawBar=function(t,e){var a=this.config,o=this.generateGetBarPoints(t,e);return function(t,e){var n=o(t,e),i=a.axis_rotated?1:0,r=a.axis_rotated?0:1;return"M "+n[0][i]+","+n[0][r]+" L"+n[1][i]+","+n[1][r]+" L"+n[2][i]+","+n[2][r]+" L"+n[3][i]+","+n[3][r]+" z"}},m.generateGetBarPoints=function(t,e){var o=this,n=e?o.subXAxis:o.xAxis,i=t.__max__+1,s=o.getBarW(n,i),u=o.getShapeX(s,i,t,!!e),c=o.getShapeY(!!e),l=o.getShapeOffset(o.isBarType,t,!!e),h=s*(o.config.bar_space/2),d=e?o.getSubYScale:o.getYScale;return function(t,e){var n=d.call(o,t.id)(0),i=l(t,e)||n,r=u(t),a=c(t);return o.config.axis_rotated&&(0a.width?i=a.width-o.width:i<0&&(i=4)),i},m.getYForText=function(t,e,n){var i,r=this,a=n.getBoundingClientRect();return r.config.axis_rotated?i=(t[0][0]+t[2][0]+.6*a.height)/2:(i=t[2][1],e.value<0||0===e.value&&!r.hasPositiveValue?(i+=a.height,r.isBarType(e)&&r.isSafari()?i-=3:!r.isBarType(e)&&r.isChrome()&&(i+=3)):i+=r.isBarType(e)?-3:-6),null!==e.value||r.config.axis_rotated||(ithis.height&&(i=this.height-4)),i},m.initTitle=function(){this.title=this.svg.append("text").text(this.config.title_text).attr("class",this.CLASS.title)},m.redrawTitle=function(){var t=this;t.title.attr("x",t.xForTitle.bind(t)).attr("y",t.yForTitle.bind(t))},m.xForTitle=function(){var t=this,e=t.config,n=e.title_position||"left";return 0<=n.indexOf("right")?t.currentWidth-t.getTextRect(t.title.node().textContent,t.CLASS.title,t.title.node()).width-e.title_padding.right:0<=n.indexOf("center")?(t.currentWidth-t.getTextRect(t.title.node().textContent,t.CLASS.title,t.title.node()).width)/2:e.title_padding.left},m.yForTitle=function(){var t=this;return t.config.title_padding.top+t.getTextRect(t.title.node().textContent,t.CLASS.title,t.title.node()).height},m.getTitlePadding=function(){return this.yForTitle()+this.config.title_padding.bottom},m.initTooltip=function(){var t,e=this,n=e.config;if(e.tooltip=e.selectChart.style("position","relative").append("div").attr("class",X.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none"),n.tooltip_init_show){if(e.isTimeSeries()&&c(n.tooltip_init_x)){for(n.tooltip_init_x=e.parseDate(n.tooltip_init_x),t=0;t"+(o||0===o?"| "+o+" |
":"")),void 0!==(s=x(g(t[a].value,t[a].ratio,t[a].id,t[a].index,t))))){if(null===t[a].name)continue;u=x(f(t[a].name,t[a].ratio,t[a].id,t[a].index)),c=l.levelColor?l.levelColor(t[a].value):i(t[a].id),r+="",r+="| "+u+" | ",r+=""+s+" | ",r+="
"}return r+""},m.tooltipPosition=function(t,e,n,i){var r,a,o,s,u,c=this,l=c.config,h=c.d3,d=c.hasArcType(),f=h.mouse(i);return d?(a=(c.width-(c.isLegendRight?c.getLegendWidth():0))/2+f[0],s=c.height/2+f[1]+20):(r=c.getSvgLeft(!0),s=l.axis_rotated?(o=(a=r+f[0]+100)+e,u=c.currentWidth-c.getCurrentPaddingRight(),c.x(t[0].x)+20):(o=(a=r+c.getCurrentPaddingLeft(!0)+c.x(t[0].x)+20)+e,u=r+c.currentWidth-c.getCurrentPaddingRight(),f[1]+15),uc.currentHeight&&(s-=n+30)),s<0&&(s=0),{top:s,left:a}},m.showTooltip=function(t,e){var n,i,r,a=this,o=a.config,s=a.hasArcType(),u=t.filter(function(t){return t&&P(t.value)}),c=o.tooltip_position||m.tooltipPosition;0!==u.length&&o.tooltip_show&&(a.tooltip.html(o.tooltip_contents.call(a,t,a.axis.getXAxisTickFormat(),a.getYFormat(s),a.color)).style("display","block"),n=a.tooltip.property("offsetWidth"),i=a.tooltip.property("offsetHeight"),r=c.call(this,u,n,i,e),a.tooltip.style("top",r.top+"px").style("left",r.left+"px"))},m.hideTooltip=function(){this.tooltip.style("display","none")},m.setTargetType=function(t,e){var n=this,i=n.config;n.mapToTargetIds(t).forEach(function(t){n.withoutFadeIn[t]=e===i.data_types[t],i.data_types[t]=e}),t||(i.data_type=e)},m.hasType=function(n,t){var i=this.config.data_types,r=!1;return(t=t||this.data.targets)&&t.length?t.forEach(function(t){var e=i[t.id];(e&&0<=e.indexOf(n)||!e&&"line"===n)&&(r=!0)}):Object.keys(i).length?Object.keys(i).forEach(function(t){i[t]===n&&(r=!0)}):r=this.config.data_type===n,r},m.hasArcType=function(t){return this.hasType("pie",t)||this.hasType("donut",t)||this.hasType("gauge",t)},m.isLineType=function(t){var e=this.config,n=c(t)?t:t.id;return!e.data_types[n]||0<=["line","spline","area","area-spline","step","area-step"].indexOf(e.data_types[n])},m.isStepType=function(t){var e=c(t)?t:t.id;return 0<=["step","area-step"].indexOf(this.config.data_types[e])},m.isSplineType=function(t){var e=c(t)?t:t.id;return 0<=["spline","area-spline"].indexOf(this.config.data_types[e])},m.isAreaType=function(t){var e=c(t)?t:t.id;return 0<=["area","area-spline","area-step"].indexOf(this.config.data_types[e])},m.isBarType=function(t){var e=c(t)?t:t.id;return"bar"===this.config.data_types[e]},m.isScatterType=function(t){var e=c(t)?t:t.id;return"scatter"===this.config.data_types[e]},m.isPieType=function(t){var e=c(t)?t:t.id;return"pie"===this.config.data_types[e]},m.isGaugeType=function(t){var e=c(t)?t:t.id;return"gauge"===this.config.data_types[e]},m.isDonutType=function(t){var e=c(t)?t:t.id;return"donut"===this.config.data_types[e]},m.isArcType=function(t){return this.isPieType(t)||this.isDonutType(t)||this.isGaugeType(t)},m.lineData=function(t){return this.isLineType(t)?[t]:[]},m.arcData=function(t){return this.isArcType(t.data)?[t]:[]},m.barData=function(t){return this.isBarType(t)?t.values:[]},m.lineOrScatterData=function(t){return this.isLineType(t)||this.isScatterType(t)?t.values:[]},m.barOrLineData=function(t){return this.isBarType(t)||this.isLineType(t)?t.values:[]},m.isInterpolationType=function(t){return 0<=["linear","linear-closed","basis","basis-open","basis-closed","bundle","cardinal","cardinal-open","cardinal-closed","monotone"].indexOf(t)},m.isSafari=function(){var t=window.navigator.userAgent;return 0<=t.indexOf("Safari")&&t.indexOf("Chrome")<0},m.isChrome=function(){return 0<=window.navigator.userAgent.indexOf("Chrome")},m.initZoom=function(){var e,n=this,i=n.d3,r=n.config;n.zoom=i.behavior.zoom().on("zoomstart",function(){e=i.event.sourceEvent,n.zoom.altDomain=i.event.sourceEvent.altKey?n.x.orgDomain():null,r.zoom_onzoomstart.call(n.api,i.event.sourceEvent)}).on("zoom",function(){n.redrawForZoom.call(n)}).on("zoomend",function(){var t=i.event.sourceEvent;t&&e.clientX===t.clientX&&e.clientY===t.clientY||(n.redrawEventRect(),n.updateZoom(),r.zoom_onzoomend.call(n.api,n.x.orgDomain()))}),n.zoom.scale=function(t){return r.axis_rotated?this.y(t):this.x(t)},n.zoom.orgScaleExtent=function(){var t=r.zoom_extent?r.zoom_extent:[1,10];return[t[0],Math.max(n.getMaxDataCount()/t[1],t[1])]},n.zoom.updateScaleExtent=function(){var t=O(n.x.orgDomain())/O(n.getZoomDomain()),e=this.orgScaleExtent();return this.scaleExtent([e[0]*t,e[1]*t]),this}},m.getZoomDomain=function(){var t=this.config,e=this.d3;return[e.min([this.orgXDomain[0],t.zoom_x_min]),e.max([this.orgXDomain[1],t.zoom_x_max])]},m.updateZoom=function(){var t=this.config.zoom_enabled?this.zoom:function(){};this.main.select("."+X.zoomRect).call(t).on("dblclick.zoom",null),this.main.selectAll("."+X.eventRect).call(t).on("dblclick.zoom",null)},m.redrawForZoom=function(){var t=this,e=t.d3,n=t.config,i=t.zoom,r=t.x;if(n.zoom_enabled&&0!==t.filterTargetsToShow(t.data.targets).length){if("mousemove"===e.event.sourceEvent.type&&i.altDomain)return r.domain(i.altDomain),void i.scale(r).updateScaleExtent();t.isCategorized()&&r.orgDomain()[0]===t.orgXDomain[0]&&r.domain([t.orgXDomain[0]-1e-10,r.orgDomain()[1]]),t.redraw({withTransition:!1,withY:n.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),"mousemove"===e.event.sourceEvent.type&&(t.cancelClick=!0),n.zoom_onzoom.call(t.api,r.orgDomain())}},w}),function(){function s(t){return t&&(t.ownerDocument||t.document||t).documentElement}function k(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function o(t,e){return t>>1;a(t[r],e)<0?n=r+1:i=r}return n},right:function(t,e,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=t.length);n>>1;0>16,t>>8&255,255&t)}function gt(t){return ft(t)+""}function pt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function xt(t,e,n){var i,r,a,o=0,s=0,u=0;if(i=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(r=i[2].split(","),i[1]){case"hsl":return n(parseFloat(r[0]),parseFloat(r[1])/100,parseFloat(r[2])/100);case"rgb":return e(mt(r[0]),mt(r[1]),mt(r[2]))}return(a=za.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,u=15&a,u|=u<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,u=255&a)),e(o,s,u))}function _t(t,e,n){var i,r,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,u=(o+a)/2;return s?(r=u<.5?s/(o+a):s/(2-o-a),i=t==o?(e-n)/s+(e=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ct(){for(var t,e=Xa,n=1/0;e;)e=e.c?(e.ti&&0P}function g(t,e,n){var i=[1,0,0],r=oe(re(t),re(e)),a=ae(r,r),o=r[0],s=a-o*o;if(!s)return!n&&t;var u=P*a/s,c=-P*o/s,l=oe(i,r),h=ue(i,u);se(h,ue(r,c));var d=l,f=ae(h,d),g=ae(d,d),p=f*f-g*(ae(h,h)-1);if(!(p<0)){var x=Math.sqrt(p),_=ue(d,(-f-x)/g);if(se(_,h),_=le(_),!n)return _;var v,y=t[0],m=e[0],w=t[1],S=e[1];mma;return Se(f,function(s){var u,c,l,h,d;return{lineStart:function(){h=l=!1,d=1},point:function(t,e){var n,i=[t,e],r=f(t,e),a=x?r?0:p(t,e):r?p(t+(t<0?Sa:-Sa),e):0;if(!u&&(h=l=r)&&s.lineStart(),r!==l&&(n=g(u,i),(he(u,n)||he(i,n))&&(i[0]+=ma,i[1]+=ma,r=f(i[0],i[1]))),r!==l)d=0,r?(s.lineStart(),n=g(i,u),s.point(n[0],n[1])):(n=g(u,i),s.point(n[0],n[1]),s.lineEnd()),u=n;else if(_&&u&&x^r){var o;a&c||!(o=g(i,u,!0))||(d=0,x?(s.lineStart(),s.point(o[0][0],o[0][1]),s.point(o[1][0],o[1][1]),s.lineEnd()):(s.point(o[1][0],o[1][1]),s.lineEnd(),s.lineStart(),s.point(o[0][0],o[0][1])))}!r||u&&he(u,i)||s.point(i[0],i[1]),u=i,l=r,c=a},lineEnd:function(){l&&s.lineEnd(),u=null},clean:function(){return d|(h&&l)<<1}}},Ze(r,6*Pa),x?[0,-r]:[-Sa,r-Sa])}((S=+t)*Pa),r()):S},e.clipExtent=function(t){return arguments.length?(w=(b=t)?Ce(t[0][0],t[0][1],t[1][0],t[1][1]):R,r()):b},e.scale=function(t){return arguments.length?(d=+t,i()):d},e.translate=function(t){return arguments.length?(f=+t[0],g=+t[1],i()):[f,g]},e.center=function(t){return arguments.length?(p=t[0]%360*Pa,x=t[1]%360*Pa,i()):[p*Ca,x*Ca]},e.rotate=function(t){return arguments.length?(_=t[0]%360*Pa,v=t[1]%360*Pa,y=2=c)return}else a={x:x,y:u};n={x:x,y:c}}else{if(a){if(a.y=c)return}else a={x:(u-r)/i,y:u};n={x:(c-r)/i,y:c}}else{if(a){if(a.y=s)return}else a={x:o,y:i*o+r};n={x:s,y:i*s+r}}else{if(a){if(a.xma||ia(r-n)>ma)&&(s.splice(o,0,new Gn((_=a.site,v=l,y=ia(i-h)a&&(r=i.slice(a,r),s[o]?s[o]+=r:s[++o]=r),(e=e[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,u.push({i:o,x:Bn(e,n)})),a=Qo.lastIndex;return ar&&(i=n,r=e);return i}function Ei(t){return t.reduce(Vi,0)}function Vi(t,e){return t+e[1]}function Gi(t,e){return ki(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function ki(t,e){for(var n=-1,i=+t[0],r=(t[1]-i)/e,a=[];++n<=e;)a[n]=r*n+i;return a}function Ri(t){return[qr.min(t),qr.max(t)]}function Oi(t,e){return t.value-e.value}function Ii(t,e){var n=t._pack_next;(t._pack_next=e)._pack_prev=t,(e._pack_next=n)._pack_prev=e}function Di(t,e){(t._pack_next=e)._pack_prev=t}function Ni(t,e){var n=e.x-t.x,i=e.y-t.y,r=t.r+e.r;return n*n+i*i<.999*r*r}function Fi(t){function e(t){l=Math.min(t.x-t.r,l),h=Math.max(t.x+t.r,h),d=Math.min(t.y-t.r,d),f=Math.max(t.y+t.r,f)}if((n=t.children)&&(c=n.length)){var n,i,r,a,o,s,u,c,l=1/0,h=-1/0,d=1/0,f=-1/0;if(n.forEach(zi),(i=n[0]).x=-i.r,i.y=0,e(i),1e;)r.push(i/a);else for(;(i=t+n*++o)=p.length)return f?f.call(g,t):d?t.sort(d):t;for(var e,r,a,o,s=-1,u=t.length,c=p[i++],l=new v;++s=p.length)return t;var r=[],a=e[i++];return t.forEach(function(t,e){r.push({key:t,values:n(e,i)})}),a?r.sort(function(t,e){return a(t.key,e.key)}):r}(h(qr.map,t,0),0)},g.key=function(t){return p.push(t),g},g.sortKeys=function(t){return e[p.length-1]=t,g},g.sortValues=function(t){return d=t,g},g.rollup=function(t){return f=t,g},g},qr.set=function(t){var e=new g;if(t)for(var n=0,i=t.length;n=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Wa=qr.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=qr.round(t,Lt(t,e))).toFixed(Math.max(0,Math.min(20,Lt(t*(1+1e-15),e))))}}),Qa=qr.time={},Za=Date;Et.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Ka.setUTCDate.apply(this._,arguments)},setDay:function(){Ka.setUTCDay.apply(this._,arguments)},setFullYear:function(){Ka.setUTCFullYear.apply(this._,arguments)},setHours:function(){Ka.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Ka.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Ka.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Ka.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Ka.setUTCSeconds.apply(this._,arguments)},setTime:function(){Ka.setTime.apply(this._,arguments)}};var Ka=Date.prototype;Qa.year=Vt(function(t){return(t=Qa.day(t)).setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),Qa.years=Qa.year.range,Qa.years.utc=Qa.year.utc.range,Qa.day=Vt(function(t){var e=new Za(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),Qa.days=Qa.day.range,Qa.days.utc=Qa.day.utc.range,Qa.dayOfYear=function(t){var e=Qa.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,n){n=7-n;var e=Qa[t]=Vt(function(t){return(t=Qa.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var e=Qa.year(t).getDay();return Math.floor((Qa.dayOfYear(t)+(e+n)%7)/7)-(e!==n)});Qa[t+"s"]=e.range,Qa[t+"s"].utc=e.utc.range,Qa[t+"OfYear"]=function(t){var e=Qa.year(t).getDay();return Math.floor((Qa.dayOfYear(t)+(e+n)%7)/7)}}),Qa.week=Qa.sunday,Qa.weeks=Qa.sunday.range,Qa.weeks.utc=Qa.sunday.utc.range,Qa.weekOfYear=Qa.sundayOfYear;var $a={"-":"",_:" ",0:"0"},Ja=/^\s*\d+/,to=/^%/;qr.locale=function(t){return{numberFormat:(e=t,A=e.decimal,s=e.thousands,u=e.grouping,i=e.currency,T=u&&s?function(t,e){for(var n=t.length,i=[],r=0,a=u[0],o=0;0e));)a=u[r=(r+1)%u.length];return i.reverse().join(s)}:R,function(t){var e=qa.exec(t),l=e[1]||" ",h=e[2]||">",d=e[3]||"-",n=e[4]||"",f=e[5],g=+e[6],p=e[7],x=e[8],_=e[9],v=1,y="",m="",w=!1,S=!0;switch(x&&(x=+x.substring(1)),(f||"0"===l&&"="===h)&&(f=l="0",h="="),_){case"n":p=!0,_="g";break;case"%":v=100,m="%",_="f";break;case"p":v=100,m="%",_="r";break;case"b":case"o":case"x":case"X":"#"===n&&(y="0"+_.toLowerCase());case"c":S=!1;case"d":w=!0,x=0;break;case"s":v=-1,_="r"}"$"===n&&(y=i[0],m=i[1]),"r"!=_||x||(_="g"),null!=x&&("g"==_?x=Math.max(1,Math.min(21,x)):"e"!=_&&"f"!=_||(x=Math.max(0,Math.min(20,x)))),_=Wa.get(_)||Mt;var b=f&&p;return function(t){var e=m;if(w&&t%1)return"";var n=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===d?"":d;if(v<0){var i=qr.formatPrefix(t,x);t=i.scale(t),e=i.symbol+m}else t*=v;var r,a,o=(t=_(t,x)).lastIndexOf(".");if(o<0){var s=S?t.lastIndexOf("e"):-1;a=s<0?(r=t,""):(r=t.substring(0,s),t.substring(s))}else r=t.substring(0,o),a=A+t.substring(o+1);!f&&p&&(r=T(r,1/0));var u=y.length+r.length+a.length+(b?0:n.length),c=u"===h?c+n+t:"^"===h?c.substring(0,u>>=1)+n+t+c.substring(u):n+(b?t:c+t))+e}}),timeFormat:function(t){function i(s){function t(t){for(var e,n,i,r=[],a=-1,o=0;++ah(d,g)&&(g=t):h(t,g)>h(d,g)&&(d=t):d<=g?(th(d,g)&&(g=t):h(t,g)>h(d,g)&&(d=t)}else l(t,e);_=n,x=t}function t(){w.point=i}function e(){m[0]=d,m[1]=g,w.point=l,_=null}function n(t,e){if(_){var n=t-x;v+=180ma&&(d=-(g=180)),m[0]=d,m[1]=g,_=null}function h(t,e){return(e-=t)<0?e+360:e}function u(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:th(s[0],s[1])&&(s[1]=r[1]),h(r[0],s[1])>h(s[0],s[1])&&(s[0]=r[0])):n.push(s=r);for(var i,r,a,o=-1/0,s=(e=0,n[a=n.length-1]);e<=a;s=r,++e)r=n[e],(i=h(s[1],r[0]))>o&&(o=i,d=r[0],g=s[1])}return y=m=null,d===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[d,f],[g,p]]}}(),qr.geo.centroid=function(t){uo=co=lo=ho=fo=go=po=xo=_o=vo=yo=0,qr.geo.stream(t,mo);var e=_o,n=vo,i=yo,r=e*e+n*n+i*i;return rma?Math.atan((Math.sin(i)*(s=Math.cos(a))*Math.sin(r)-Math.sin(a)*(o=Math.cos(i))*Math.sin(n))/(o*s*u)):(i+a)/2,h.point(p,g),h.lineEnd(),h.lineStart(),h.point(c,g),d=0),h.point(f=t,g=e),p=c},lineEnd:function(){h.lineEnd(),f=g=NaN},clean:function(){return 2-d}}},function(t,e,n,i){var r;if(null==t)r=n*Ta,i.point(-Sa,r),i.point(0,r),i.point(Sa,r),i.point(Sa,0),i.point(Sa,-r),i.point(0,-r),i.point(-Sa,-r),i.point(-Sa,0),i.point(-Sa,r);else if(ia(t[0]-e[0])>ma){var a=t[0]ma}).map(l)).concat(qr.range(Math.ceil(s/p)*p,o,p).filter(function(t){return ia(t%_)>ma}).map(h))}var n,i,r,a,o,s,u,c,l,h,d,f,g=10,p=g,x=90,_=360,v=2.5;return e.lines=function(){return t().map(function(t){return{type:"LineString",coordinates:t}})},e.outline=function(){return{type:"Polygon",coordinates:[d(a).concat(f(u).slice(1),d(r).reverse().slice(1),f(c).reverse().slice(1))]}},e.extent=function(t){return arguments.length?e.majorExtent(t).minorExtent(t):e.minorExtent()},e.majorExtent=function(t){return arguments.length?(a=+t[0][0],r=+t[1][0],c=+t[0][1],u=+t[1][1],r=o&&i.x<=u&&i.y>=s&&i.y<=c?[[o,c],[u,c],[u,s],[o,s]]:[]).point=r[e]}),a}function n(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/ma)*ma,y:Math.round(o(t,e)/ma)*ma,i:e}})}var i=cn,r=ln,a=i,o=r,l=qo;return t?e(t):(e.links=function(e){return Nn(n(e)).edges.filter(function(t){return t.l&&t.r}).map(function(t){return{source:e[t.l.i],target:e[t.r.i]}})},e.triangles=function(d){var f=[];return Nn(n(d)).cells.forEach(function(t,e){for(var n,i=t.site,r=t.edges.sort(An),a=-1,o=r.length,s=r[o-1].edge,u=s.l===i?s.r:s.l;++au&&(u=e.x),e.y>c&&(c=e.y),n.push(e.x),i.push(e.y);else for(r=0;r=o[0]&&i<=o[1]&&((n=r[qr.bisect(s,i,1,c)-1]).y+=l,n.push(t[e]));return r}var h=!0,d=Number,f=Ri,g=Gi;return n.value=function(t){return arguments.length?(d=t,n):d},n.range=function(t){return arguments.length?(f=wt(t),n):f},n.bins=function(e){return arguments.length?(g="number"==typeof e?function(t){return ki(t,e)}:wt(e),n):g},n.frequency=function(t){return arguments.length?(h=!!t,n):h},n},qr.layout.pack=function(){function e(t,e){var n=c.call(this,t,e),i=n[0],r=h[0],a=h[1],o=null==u?Math.sqrt:"function"==typeof u?u:function(){return u};if(i.x=i.y=0,yi(i,function(t){t.r=+o(t.value)}),yi(i,Fi),l){var s=l*(u?1:Math.max(2*i.r/r,2*i.r/a))/2;yi(i,function(t){t.r+=s}),yi(i,Fi),yi(i,function(t){t.r-=s})}return function t(e,n,i,r){var a=e.children;if(e.x=n+=r*e.x,e.y=i+=r*e.y,e.r*=r,a)for(var o=-1,s=a.length;++oo.x&&(o=t),t.depth>s.depth&&(s=t)});var u=y(a,o)/2-a.x,c=p[0]/(o.x+y(o,a)/2+u),l=p[1]/(s.depth||1);vi(i,function(t){t.x=(t.x+u)*c,t.y=t.depth*l})}return n}function h(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){for(var e,n=0,i=0,r=t.children,a=r.length;0<=--a;)(e=r[a]).z+=n,e.m+=n,n+=e.s+(i+=e.c)}(t);var r=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+y(t._,i._),t.m=t.z-r):t.z=r}else i&&(t.z=i.z+y(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,r=t,a=t,o=e,s=r.parent.children[0],u=r.m,c=a.m,l=o.m,h=s.m;o=ji(o),r=Bi(r),o&&r;)s=Bi(s),(a=ji(a)).a=t,0<(i=o.z+l-r.z-u+y(o._,r._))&&(_=t,v=n,d=(x=o).a.parent===_.parent?x.a:v,void 0,p=(g=i)/((f=t).i-d.i),f.c-=p,f.s+=g,d.c+=p,f.z+=g,f.m+=g,u+=i,c+=i),l+=o.m,u+=r.m,h+=s.m,c+=a.m;o&&!ji(a)&&(a.t=o,a.m+=l-c),r&&!Bi(s)&&(s.t=r,s.m+=u-h,n=t)}var d,f,g,p;var x,_,v;return n}(t,i,t.parent.A||n[0])}function d(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function f(t){t.x*=p[0],t.y=t.depth*p[1]}var g=qr.layout.hierarchy().sort(null).value(null),y=Yi,p=[1,1],x=null;return e.separation=function(t){return arguments.length?(y=t,e):y},e.size=function(t){return arguments.length?(x=null==(p=t)?f:null,e):x?null:p},e.nodeSize=function(t){return arguments.length?(x=null==(p=t)?null:f,e):x?p:null},_i(e,g)},qr.layout.cluster=function(){function e(t,e){var r,n=l.call(this,t,e),i=n[0],a=0;yi(i,function(t){var e,n,i=t.children;i&&i.length?(t.x=(n=i).reduce(function(t,e){return t+e.x},0)/n.length,t.y=(e=i,1+qr.max(e,function(t){return t.y}))):(t.x=r?a+=h(t,r):0,t.y=0,r=t)});var o=function t(e){var n=e.children;return n&&n.length?t(n[0]):e}(i),s=function t(e){var n,i=e.children;return i&&(n=i.length)?t(i[n-1]):e}(i),u=o.x-h(o,s)/2,c=s.x+h(s,o)/2;return yi(i,f?function(t){t.x=(t.x-i.x)*d[0],t.y=(i.y-t.y)*d[1]}:function(t){t.x=(t.x-u)/(c-u)*d[0],t.y=(1-(i.y?t.y/i.y:1))*d[1]}),n}var l=qr.layout.hierarchy().sort(null).value(null),h=Yi,d=[1,1],f=!1;return e.separation=function(t){return arguments.length?(h=t,e):h},e.size=function(t){return arguments.length?(f=null==(d=t),e):f?null:d},e.nodeSize=function(t){return arguments.length?(f=null!=(d=t),e):f?d:null},_i(e,l)},qr.layout.treemap=function(){function l(t,e){for(var n,i,r=-1,a=t.length;++rn.dy)&&(c=n.dy);++an.dx)&&(c=n.dx);++ai;a--);e=e.slice(r,a)}return e},r.tickFormat=function(t,n){if(!arguments.length)return us;arguments.length<2?n=us:"function"!=typeof n&&(n=qr.format(n));var i=Math.max(1,u*t/r.ticks().length);return function(t){var e=t/d(Math.round(h(t)));return e*urect,.s>rect").attr("width",C[1]-C[0])}function w(t){t.select(".extent").attr("y",L[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",L[1]-L[0])}function o(){function t(){var t=qr.mouse(r),e=!1;i&&(t[0]+=i[0],t[1]+=i[1]),d||(qr.event.altKey?(h||(h=[(C[0]+C[1])/2,(L[0]+L[1])/2]),g[0]=C[+(t[0]