dc
Version:
A multi-dimensional charting library built to work natively with crossfilter and rendered using d3.js
20 lines (19 loc) • 142 kB
JavaScript
/*!
* dc 4.2.7
* http://dc-js.github.io/dc.js/
* Copyright 2012-2021 Nick Zhu & the dc.js Developers
* https://github.com/dc-js/dc.js/blob/master/AUTHORS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3"),require("d3")):"function"==typeof define&&define.amd?define(["exports","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3","d3"],e):e((t=t||self).dc={},t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(this,(function(t,e,i,s,r,n,a,h,l,o,c,d,_,u,g,p,y,m,x,f){"use strict";class b extends Error{}const A={CHART_CLASS:"dc-chart",DEBUG_GROUP_CLASS:"debug",STACK_CLASS:"stack",DESELECTED_CLASS:"deselected",SELECTED_CLASS:"selected",NODE_INDEX_NAME:"__index__",GROUP_INDEX_NAME:"__group_index__",DEFAULT_CHART_GROUP:"__default_chart_group__",EVENT_DELAY:40,NEGLIGIBLE_NUMBER:1e-10};class v{constructor(){this.enableDebugLog=!1,this._alreadyWarned={}}warn(t){return console&&(console.warn?console.warn(t):console.log&&console.log(t)),this}warnOnce(t){return this._alreadyWarned[t]||(this._alreadyWarned[t]=!0,C.warn(t)),this}debug(t){return this.enableDebugLog&&console&&(console.debug?console.debug(t):console.log&&console.log(t)),this}}const C=new v;class k{constructor(){this._defaultColors=k._schemeCategory20c,this.dateFormat=e.timeFormat("%m/%d/%Y"),this._renderlet=null,this.disableTransitions=!1}defaultColors(t){return arguments.length?(this._defaultColors=t,this):(this._defaultColors===k._schemeCategory20c&&C.warnOnce("You are using d3.schemeCategory20c, which has been removed in D3v5. See the explanation at https://github.com/d3/d3/blob/master/CHANGES.md#changes-in-d3-50. DC is using it for backward compatibility, however it will be changed in DCv3.1. You can change it by calling dc.config.defaultColors(newScheme). See https://github.com/d3/d3-scale-chromatic for some alternatives."),this._defaultColors)}}k._schemeCategory20c=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];const S=new k,w={eventHandler:t=>function(e,i){console.warn("No d3.js compatbility event handler registered, defaulting to v6 behavior."),t.call(this,i,e)},nester:({key:t,sortKeys:e,sortValues:i,entries:s})=>{throw new Error("No d3.js compatbility nester registered, load v5 or v6 compability layer.")},pointer:()=>{throw new Error("No d3.js compatbility pointer registered, load v5 or v6 compability layer.")}};const L=new class{constructor(){this._chartMap={}}_initializeChartGroup(t){return t||(t=A.DEFAULT_CHART_GROUP),this._chartMap[t]||(this._chartMap[t]=[]),t}has(t){for(const e in this._chartMap)if(this._chartMap[e].indexOf(t)>=0)return!0;return!1}register(t,e){this._chartMap[e=this._initializeChartGroup(e)].push(t)}deregister(t,e){e=this._initializeChartGroup(e);for(let i=0;i<this._chartMap[e].length;i++)if(this._chartMap[e][i].anchorName()===t.anchorName()){this._chartMap[e].splice(i,1);break}}clear(t){t?delete this._chartMap[t]:this._chartMap={}}list(t){return t=this._initializeChartGroup(t),this._chartMap[t]}},R=function(t,e){L.register(t,e)},D=function(t,e){L.deregister(t,e)},O=function(t){const e=L.list(t);for(let t=0;t<e.length;++t)e[t].render();null!==S._renderlet&&S._renderlet(t)},B=function(t){const e=L.list(t);for(let t=0;t<e.length;++t)e[t].redraw();null!==S._renderlet&&S._renderlet(t)},F=function(t,e,i,s){if(S.disableTransitions||e<=0)return t;let r=t.transition(s);return(e>=0||void 0!==e)&&(r=r.duration(e)),(i>=0||void 0!==i)&&(r=r.delay(i)),r},P=function(t,e,i,s){return t?function(t){return F(t,e,i,s)}:function(t){return t}},H=function(t){return t instanceof Object&&t.__dcFlag__&&!0},T={current:null,trigger:function(t,e){e?(T.current=t,setTimeout((()=>{t===T.current&&t()}),e)):t()}},E={RangedFilter:function(t,e){const i=new Array(t,e);return i.isFiltered=function(t){return t>=this[0]&&t<this[1]},i.filterType="RangedFilter",i},TwoDimensionalFilter:function(t){if(null===t)return null;const e=t;return e.isFiltered=function(t){return t.length&&t.length===e.length&&t[0]===e[0]&&t[1]===e[1]},e.filterType="TwoDimensionalFilter",e},RangedTwoDimensionalFilter:function(t){if(null===t)return null;const e=t;let i;return i=e[0]instanceof Array?[[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1])],[Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]]:[[t[0],-1/0],[t[1],1/0]],e.isFiltered=function(t){let e,s;return t instanceof Array?(e=t[0],s=t[1]):(e=t,s=i[0][1]),e>=i[0][0]&&e<i[1][0]&&s>=i[0][1]&&s<i[1][1]},e.filterType="RangedTwoDimensionalFilter",e},HierarchyFilter:function(t){if(null===t)return null;const e=t.slice(0);return e.isFiltered=function(t){if(!(e.length&&t&&t.length&&t.length>=e.length))return!1;for(let i=0;i<e.length;i++)if(t[i]!==e[i])return!1;return!0},e}};class z extends Error{}const M=function(t,e){return e?function(i,s){return e.call(i,i[t],s)}:function(e){return e[t]}},N={printSingleValue:function(t){let e=""+t;return t instanceof Date?e=S.dateFormat(t):"string"==typeof t?e=t:N.isFloat(t)?e=N.printSingleValue.fformat(t):N.isInteger(t)&&(e=Math.round(t)),e}};N.printSingleValue.fformat=s.format(".2f"),N._toTimeFunc=function(t){return{second:i.timeSecond,minute:i.timeMinute,hour:i.timeHour,day:i.timeDay,week:i.timeWeek,month:i.timeMonth,year:i.timeYear}[t]},N.add=function(t,e,s){if("string"==typeof e&&(e=e.replace("%","")),t instanceof Date)return"string"==typeof e&&(e=+e),"millis"===s?new Date(t.getTime()+e):("function"!=typeof(s=s||i.timeDay)&&(s=N._toTimeFunc(s)),s.offset(t,e));if("string"==typeof e){const i=+e/100;return t>0?t*(1+i):t*(1-i)}return t+e},N.subtract=function(t,e,s){if("string"==typeof e&&(e=e.replace("%","")),t instanceof Date)return"string"==typeof e&&(e=+e),"millis"===s?new Date(t.getTime()-e):("function"!=typeof(s=s||i.timeDay)&&(s=N._toTimeFunc(s)),s.offset(t,-e));if("string"==typeof e){const i=+e/100;return t<0?t*(1+i):t*(1-i)}return t-e},N.isNumber=function(t){return t===+t},N.isFloat=function(t){return t===+t&&t!==(0|t)},N.isInteger=function(t){return t===+t&&t===(0|t)},N.isNegligible=function(t){return!N.isNumber(t)||t<A.NEGLIGIBLE_NUMBER&&t>-A.NEGLIGIBLE_NUMBER},N.clamp=function(t,e,i){return t<e?e:t>i?i:t},N.constant=function(t){return function(){return t}};let G=0;function $(t,e){for(let i=0;i<t.length;i++)if(t[i].key===e)return t[i]}N.uniqueId=function(){return++G},N.nameToId=function(t){return t.toLowerCase().replace(/[\s]/g,"_").replace(/[\.']/g,"")},N.appendOrSelect=function(t,e,i){i=i||e;let s=t.select(e);return s.empty()&&(s=t.append(i)),s},N.safeNumber=function(t){return N.isNumber(+t)?+t:0},N.arraysEqual=function(t,e){return!t&&!e||!(!t||!e)&&(t.length===e.length&&t.every(((t,i)=>t.valueOf()===e[i].valueOf())))},N.allChildren=function(t){let e=[];if(e.push(t.path),console.log("currentNode",t),t.children)for(let i=0;i<t.children.length;i++)e=e.concat(N.allChildren(t.children[i]));return e},N.toHierarchy=function(t,e){const i={key:"root",children:[]};for(let s=0;s<t.length;s++){const r=t[s],n=r.key,a=e(r);let h=i;for(let t=0;t<n.length;t++){const e=n.slice(0,t+1),i=h.children,s=n[t];let l;t+1<n.length?(l=$(i,s),void 0===l&&(l={key:s,children:[],path:e},i.push(l)),h=l):(l={key:s,value:a,data:r,path:e},i.push(l))}}return i},N.getAncestors=function(t){const e=[];let i=t;for(;i.parent;)e.unshift(i.name),i=i.parent;return e},N.arraysIdentical=function(t,e){let i=t.length;if(i!==e.length)return!1;for(;i--;)if(t[i]!==e[i])return!1;return!0};const Y={filters:function(t){let e="";for(let i=0;i<t.length;++i)i>0&&(e+=", "),e+=Y.filter(t[i]);return e},filter:function(t){let e="";return null!=t&&(t instanceof Array?t.length>=2?e=`[${t.map((t=>N.printSingleValue(t))).join(" -> ")}]`:t.length>=1&&(e=N.printSingleValue(t[0])):e=N.printSingleValue(t)),e}},V={integers:function(t,e){return Math.abs(e-t)},ordinal:function(){throw new Error("dc.units.ordinal should not be called - it is a placeholder")},fp:{}};V.fp.precision=function(t){const e=function(t,i){const s=Math.abs((i-t)/e.resolution);return N.isNegligible(s-Math.floor(s))?Math.floor(s):Math.ceil(s)};return e.resolution=t,e};const I=(t,e)=>(0===e.length?t.filter(null):1!==e.length||e[0].isFiltered?1===e.length&&"RangedFilter"===e[0].filterType?t.filterRange(e[0]):t.filterFunction((t=>{for(let i=0;i<e.length;i++){const s=e[i];if(s.isFiltered){if(s.isFiltered(t))return!0}else if(s<=t&&s>=t)return!0}return!1})):t.filterExact(e[0]),e),W=(t,e)=>null==e?t.length>0:t.some((t=>e<=t&&e>=t)),U=(t,e)=>{for(let i=0;i<t.length;i++)if(t[i]<=e&&t[i]>=e){t.splice(i,1);break}return t},X=(t,e)=>(t.push(e),t),q=t=>[];class j{constructor(){this.__dcFlag__=N.uniqueId(),this._svgDescription=null,this._keyboardAccessible=!1,this._dimension=void 0,this._group=void 0,this._anchor=void 0,this._root=void 0,this._svg=void 0,this._isChild=void 0,this._minWidth=200,this._defaultWidthCalc=t=>{const e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().width;return e&&e>this._minWidth?e:this._minWidth},this._widthCalc=this._defaultWidthCalc,this._minHeight=200,this._defaultHeightCalc=t=>{const e=t&&t.getBoundingClientRect&&t.getBoundingClientRect().height;return e&&e>this._minHeight?e:this._minHeight},this._heightCalc=this._defaultHeightCalc,this._width=void 0,this._height=void 0,this._useViewBoxResizing=!1,this._keyAccessor=M("key"),this._valueAccessor=M("value"),this._label=M("key"),this._ordering=M("key"),this._renderLabel=!1,this._title=t=>`${this.keyAccessor()(t)}: ${this.valueAccessor()(t)}`,this._renderTitle=!0,this._controlsUseVisibility=!1,this._transitionDuration=750,this._transitionDelay=0,this._filterPrinter=Y.filters,this._mandatoryAttributesList=["dimension","group"],this._chartGroup=A.DEFAULT_CHART_GROUP,this._listeners=n.dispatch("preRender","postRender","preRedraw","postRedraw","filtered","zoomed","renderlet","pretransition"),this._legend=void 0,this._commitHandler=void 0,this._defaultData=t=>t.all(),this._data=this._defaultData,this._filters=[],this._filterHandler=I,this._hasFilterHandler=W,this._removeFilterHandler=U,this._addFilterHandler=X,this._resetFilterHandler=q}height(t){return arguments.length?(this._heightCalc=t?"function"==typeof t?t:N.constant(t):this._defaultHeightCalc,this._height=void 0,this):(N.isNumber(this._height)||(this._height=this._heightCalc(this._root.node())),this._height)}width(t){return arguments.length?(this._widthCalc=t?"function"==typeof t?t:N.constant(t):this._defaultWidthCalc,this._width=void 0,this):(N.isNumber(this._width)||(this._width=this._widthCalc(this._root.node())),this._width)}minWidth(t){return arguments.length?(this._minWidth=t,this):this._minWidth}minHeight(t){return arguments.length?(this._minHeight=t,this):this._minHeight}useViewBoxResizing(t){return arguments.length?(this._useViewBoxResizing=t,this):this._useViewBoxResizing}dimension(t){return arguments.length?(this._dimension=t,this.expireCache(),this):this._dimension}data(t){return arguments.length?(this._data="function"==typeof t?t:N.constant(t),this.expireCache(),this):this._data(this._group)}group(t,e){return arguments.length?(this._group=t,this._groupName=e,this.expireCache(),this):this._group}ordering(t){return arguments.length?(this._ordering=t,this.expireCache(),this):this._ordering}_computeOrderedGroups(t){return Array.from(t).sort(((t,e)=>a.ascending(this._ordering(t),this._ordering(e))))}filterAll(){return this.filter(null)}select(t){return this._root.select(t)}selectAll(t){return this._root?this._root.selectAll(t):null}anchor(t,e){if(!arguments.length)return this._anchor;if(H(t))this._anchor=t.anchor(),this._anchor.children&&(this._anchor="#"+t.anchorName()),this._root=t.root(),this._isChild=!0;else{if(!t)throw new b("parent must be defined");t.select&&t.classed?this._anchor=t.node():this._anchor=t,this._root=r.select(this._anchor),this._root.classed(A.CHART_CLASS,!0),R(this,e),this._isChild=!1}return this._chartGroup=e,this}anchorName(){const t=this.anchor();return t&&t.id?t.id:t&&t.replace?t.replace("#",""):"dc-chart"+this.chartID()}root(t){return arguments.length?(this._root=t,this):this._root}svg(t){return arguments.length?(this._svg=t,this):this._svg}resetSvg(){return this.select("svg").remove(),this.generateSvg()}sizeSvg(){this._svg&&(this._useViewBoxResizing?this._svg.attr("viewBox")||this._svg.attr("viewBox",`0 0 ${this.width()} ${this.height()}`):this._svg.attr("width",this.width()).attr("height",this.height()))}generateSvg(){return this._svg=this.root().append("svg"),(this._svgDescription||this._keyboardAccessible)&&(this._svg.append("desc").attr("id","desc-id-"+this.__dcFlag__).html(""+this.svgDescription()),this._svg.attr("tabindex","0").attr("role","img").attr("aria-labelledby","desc-id-"+this.__dcFlag__)),this.sizeSvg(),this._svg}svgDescription(t){return arguments.length?(this._svgDescription=t,this):this._svgDescription||this.constructor.name}keyboardAccessible(t){return arguments.length?(this._keyboardAccessible=t,this):this._keyboardAccessible}filterPrinter(t){return arguments.length?(this._filterPrinter=t,this):this._filterPrinter}controlsUseVisibility(t){return arguments.length?(this._controlsUseVisibility=t,this):this._controlsUseVisibility}turnOnControls(){if(this._root){const t=this.controlsUseVisibility()?"visibility":"display";this.selectAll(".reset").style(t,null),this.selectAll(".filter").text(this._filterPrinter(this.filters())).style(t,null)}return this}turnOffControls(){if(this._root){const t=this.controlsUseVisibility()?"visibility":"display",e=this.controlsUseVisibility()?"hidden":"none";this.selectAll(".reset").style(t,e),this.selectAll(".filter").style(t,e).text(this.filter())}return this}transitionDuration(t){return arguments.length?(this._transitionDuration=t,this):this._transitionDuration}transitionDelay(t){return arguments.length?(this._transitionDelay=t,this):this._transitionDelay}_mandatoryAttributes(t){return arguments.length?(this._mandatoryAttributesList=t,this):this._mandatoryAttributesList}checkForMandatoryAttributes(t){if(!this[t]||!this[t]())throw new z(`Mandatory attribute chart.${t} is missing on chart[#${this.anchorName()}]`)}render(){this._height=this._width=void 0,this._listeners.call("preRender",this,this),this._mandatoryAttributesList&&this._mandatoryAttributesList.forEach((t=>this.checkForMandatoryAttributes(t)));const t=this._doRender();return this._legend&&this._legend.render(),this._activateRenderlets("postRender"),t}_makeKeyboardAccessible(t,...e){const i=this._svg.selectAll(".dc-tabbable").attr("tabindex",0);t&&i.on("keydown",w.eventHandler(((i,s)=>{13===s.keyCode&&"object"==typeof i&&t.call(this,i,...e),32===s.keyCode&&"object"==typeof i&&(t.call(this,i,...e),s.preventDefault())})))}_activateRenderlets(t){this._listeners.call("pretransition",this,this),this.transitionDuration()>0&&this._svg?this._svg.transition().duration(this.transitionDuration()).delay(this.transitionDelay()).on("end",(()=>{this._listeners.call("renderlet",this,this),t&&this._listeners.call(t,this,this)})):(this._listeners.call("renderlet",this,this),t&&this._listeners.call(t,this,this))}redraw(){this.sizeSvg(),this._listeners.call("preRedraw",this,this);const t=this._doRedraw();return this._legend&&this._legend.render(),this._activateRenderlets("postRedraw"),t}commitHandler(t){return arguments.length?(this._commitHandler=t,this):this._commitHandler}redrawGroup(){return this._commitHandler?this._commitHandler(!1,((t,e)=>{t?console.log(t):B(this.chartGroup())})):B(this.chartGroup()),this}renderGroup(){return this._commitHandler?this._commitHandler(!1,((t,e)=>{t?console.log(t):O(this.chartGroup())})):O(this.chartGroup()),this}_invokeFilteredListener(t){void 0!==t&&this._listeners.call("filtered",this,this,t)}_invokeZoomedListener(){this._listeners.call("zoomed",this,this)}hasFilterHandler(t){return arguments.length?(this._hasFilterHandler=t,this):this._hasFilterHandler}hasFilter(t){return this._hasFilterHandler(this._filters,t)}removeFilterHandler(t){return arguments.length?(this._removeFilterHandler=t,this):this._removeFilterHandler}addFilterHandler(t){return arguments.length?(this._addFilterHandler=t,this):this._addFilterHandler}resetFilterHandler(t){return arguments.length?(this._resetFilterHandler=t,this):this._resetFilterHandler}applyFilters(t){if(this.dimension()&&this.dimension().filter){const e=this._filterHandler(this.dimension(),t);e&&(t=e)}return t}replaceFilter(t){return this._filters=this._resetFilterHandler(this._filters),this.filter(t),this}filter(t){if(!arguments.length)return this._filters.length>0?this._filters[0]:null;let e=this._filters;return t instanceof Array&&t[0]instanceof Array&&!t.isFiltered?t[0].forEach((t=>{e=this._hasFilterHandler(e,t)?this._removeFilterHandler(e,t):this._addFilterHandler(e,t)})):e=null===t?this._resetFilterHandler(e):this._hasFilterHandler(e,t)?this._removeFilterHandler(e,t):this._addFilterHandler(e,t),this._filters=this.applyFilters(e),this._invokeFilteredListener(t),null!==this._root&&this.hasFilter()?this.turnOnControls():this.turnOffControls(),this}filters(){return this._filters}highlightSelected(t){r.select(t).classed(A.SELECTED_CLASS,!0),r.select(t).classed(A.DESELECTED_CLASS,!1)}fadeDeselected(t){r.select(t).classed(A.SELECTED_CLASS,!1),r.select(t).classed(A.DESELECTED_CLASS,!0)}resetHighlight(t){r.select(t).classed(A.SELECTED_CLASS,!1),r.select(t).classed(A.DESELECTED_CLASS,!1)}onClick(t){const e=this.keyAccessor()(t);T.trigger((()=>{this.filter(e),this.redrawGroup()}))}filterHandler(t){return arguments.length?(this._filterHandler=t,this):this._filterHandler}_doRender(){return this}_doRedraw(){return this}legendables(){return[]}legendHighlight(){}legendReset(){}legendToggle(){}isLegendableHidden(){return!1}keyAccessor(t){return arguments.length?(this._keyAccessor=t,this):this._keyAccessor}valueAccessor(t){return arguments.length?(this._valueAccessor=t,this):this._valueAccessor}label(t,e){return arguments.length?(this._label=t,(void 0===e||e)&&(this._renderLabel=!0),this):this._label}renderLabel(t){return arguments.length?(this._renderLabel=t,this):this._renderLabel}title(t){return arguments.length?(this._title=t,this):this._title}renderTitle(t){return arguments.length?(this._renderTitle=t,this):this._renderTitle}chartGroup(t){return arguments.length?(this._isChild||D(this,this._chartGroup),this._chartGroup=t,this._isChild||R(this,this._chartGroup),this):this._chartGroup}expireCache(){return this}legend(t){return arguments.length?(this._legend=t,this._legend.parent(this),this):this._legend}chartID(){return this.__dcFlag__}options(t){const e=["anchor","group","xAxisLabel","yAxisLabel","stack","title","point","getColor","overlayGeoJson"];for(const i in t)"function"==typeof this[i]?t[i]instanceof Array&&-1!==e.indexOf(i)?this[i].apply(this,t[i]):this[i].call(this,t[i]):C.debug("Not a valid option setter name: "+i);return this}on(t,e){return this._listeners.on(t,e),this}renderlet(t){return C.warnOnce('chart.renderlet has been deprecated. Please use chart.on("renderlet.<renderletKey>", renderletFunction)'),this.on("renderlet."+N.uniqueId(),t),this}}const K=t=>class extends t{constructor(){super(),this._colors=h.scaleOrdinal(S.defaultColors()),this._colorAccessor=t=>this.keyAccessor()(t),this._colorCalculator=void 0;{const t=this;t.getColor=function(e,i){return t._colorCalculator?t._colorCalculator.call(this,e,i):t._colors(t._colorAccessor.call(this,e,i))}}}calculateColorDomain(){const t=[a.min(this.data(),this.colorAccessor()),a.max(this.data(),this.colorAccessor())];return this._colors.domain(t),this}colors(t){return arguments.length?(this._colors=t instanceof Array?h.scaleQuantize().range(t):"function"==typeof t?t:N.constant(t),this):this._colors}ordinalColors(t){return this.colors(h.scaleOrdinal().range(t))}linearColors(t){return this.colors(h.scaleLinear().range(t).interpolate(l.interpolateHcl))}colorAccessor(t){return arguments.length?(this._colorAccessor=t,this):this._colorAccessor}colorDomain(t){return arguments.length?(this._colors.domain(t),this):this._colors.domain()}colorCalculator(t){return arguments.length?(this._colorCalculator=t,this):this._colorCalculator||this.getColor}},Z=t=>class extends(K(t)){constructor(){super(),this._maxBubbleRelativeSize=.3,this._minRadiusWithLabel=10,this._sortBubbleSize=!1,this._elasticRadius=!1,this._excludeElasticZero=!0,this.BUBBLE_NODE_CLASS="node",this.BUBBLE_CLASS="bubble",this.MIN_RADIUS=10,this.renderLabel(!0),this.data((t=>{const e=t.all();if(this._keyboardAccessible&&e.sort(((t,e)=>a.ascending(this.keyAccessor()(t),this.keyAccessor()(e)))),this._sortBubbleSize){const t=this.radiusValueAccessor();e.sort(((e,i)=>a.descending(t(e),t(i))))}return e})),this._r=h.scaleLinear().domain([0,100])}_rValueAccessor(t){return t.r}r(t){return arguments.length?(this._r=t,this):this._r}elasticRadius(t){return arguments.length?(this._elasticRadius=t,this):this._elasticRadius}calculateRadiusDomain(){this._elasticRadius&&this.r().domain([this.rMin(),this.rMax()])}radiusValueAccessor(t){return arguments.length?(this._rValueAccessor=t,this):this._rValueAccessor}rMin(){let t=this.data().map(this.radiusValueAccessor());return this._excludeElasticZero&&(t=t.filter((t=>t>0))),a.min(t)}rMax(){return a.max(this.data(),(t=>this.radiusValueAccessor()(t)))}bubbleR(t){const e=this.radiusValueAccessor()(t);let i=this.r()(e);return(isNaN(i)||e<=0)&&(i=0),i}_labelFunction(t){return this.label()(t)}_shouldLabel(t){return this.bubbleR(t)>this._minRadiusWithLabel}_labelOpacity(t){return this._shouldLabel(t)?1:0}_labelPointerEvent(t){return this._shouldLabel(t)?"all":"none"}_doRenderLabel(t){if(this.renderLabel()){let e=t.select("text");e.empty()&&(e=t.append("text").attr("text-anchor","middle").attr("dy",".3em").on("click",w.eventHandler((t=>this.onClick(t))))),e.attr("opacity",0).attr("pointer-events",(t=>this._labelPointerEvent(t))).text((t=>this._labelFunction(t))),F(e,this.transitionDuration(),this.transitionDelay()).attr("opacity",(t=>this._labelOpacity(t)))}}doUpdateLabels(t){if(this.renderLabel()){const e=t.select("text").attr("pointer-events",(t=>this._labelPointerEvent(t))).text((t=>this._labelFunction(t)));F(e,this.transitionDuration(),this.transitionDelay()).attr("opacity",(t=>this._labelOpacity(t)))}}_titleFunction(t){return this.title()(t)}_doRenderTitles(t){if(this.renderTitle()){t.select("title").empty()&&t.append("title").text((t=>this._titleFunction(t)))}}doUpdateTitles(t){this.renderTitle()&&t.select("title").text((t=>this._titleFunction(t)))}sortBubbleSize(t){return arguments.length?(this._sortBubbleSize=t,this):this._sortBubbleSize}minRadius(t){return arguments.length?(this.MIN_RADIUS=t,this):this.MIN_RADIUS}minRadiusWithLabel(t){return arguments.length?(this._minRadiusWithLabel=t,this):this._minRadiusWithLabel}maxBubbleRelativeSize(t){return arguments.length?(this._maxBubbleRelativeSize=t,this):this._maxBubbleRelativeSize}excludeElasticZero(t){return arguments.length?(this._excludeElasticZero=t,this):this._excludeElasticZero}fadeDeselectedArea(t){if(this.hasFilter()){const t=this;this.selectAll("g."+t.BUBBLE_NODE_CLASS).each((function(e){t.isSelectedNode(e)?t.highlightSelected(this):t.fadeDeselected(this)}))}else{const t=this;this.selectAll("g."+t.BUBBLE_NODE_CLASS).each((function(){t.resetHighlight(this)}))}}isSelectedNode(t){return this.hasFilter(t.key)}onClick(t){const e=t.key;T.trigger((()=>{this.filter(e),this.redrawGroup()}))}},J=t=>class extends t{constructor(){super(),this._cap=1/0,this._takeFront=!0,this._othersLabel="Others",this._othersGrouper=(t,e)=>{const i=a.sum(e,this.valueAccessor()),s=e.map(this.keyAccessor());return i>0?t.concat([{others:s,key:this.othersLabel(),value:i}]):t},this.ordering((t=>-t.value)),this.data((t=>{if(this._cap===1/0)return this._computeOrderedGroups(t.all());{let e,i=t.all();if(i=this._computeOrderedGroups(i),this._cap)if(this._takeFront)e=i.slice(this._cap),i=i.slice(0,this._cap);else{const t=Math.max(0,i.length-this._cap);e=i.slice(0,t),i=i.slice(t)}return this._othersGrouper?this._othersGrouper(i,e):i}}))}cappedKeyAccessor(t,e){return t.others?t.key:this.keyAccessor()(t,e)}cappedValueAccessor(t,e){return t.others?t.value:this.valueAccessor()(t,e)}cap(t){return arguments.length?(this._cap=t,this):this._cap}takeFront(t){return arguments.length?(this._takeFront=t,this):this._takeFront}othersLabel(t){return arguments.length?(this._othersLabel=t,this):this._othersLabel}othersGrouper(t){return arguments.length?(this._othersGrouper=t,this):this._othersGrouper}onClick(t){t.others&&this.filter([t.others]),super.onClick(t)}};class Q extends j{constructor(){super(),this._margin={top:10,right:50,bottom:30,left:30}}margins(t){return arguments.length?(this._margin=t,this):this._margin}effectiveWidth(){return this.width()-this.margins().left-this.margins().right}effectiveHeight(){return this.height()-this.margins().top-this.margins().bottom}}const tt="x-axis-label",et="custom-brush-handle";class it extends(K(Q)){constructor(){super(),this.colors(h.scaleOrdinal(o.schemeCategory10)),this._mandatoryAttributes().push("x"),this._parent=void 0,this._g=void 0,this._chartBodyG=void 0,this._x=void 0,this._origX=void 0,this._xOriginalDomain=void 0,this._xAxis=null,this._xUnits=V.integers,this._xAxisPadding=0,this._xAxisPaddingUnit=i.timeDay,this._xElasticity=!1,this._xAxisLabel=void 0,this._xAxisLabelPadding=0,this._lastXDomain=void 0,this._y=void 0,this._yAxis=null,this._yAxisPadding=0,this._yElasticity=!1,this._yAxisLabel=void 0,this._yAxisLabelPadding=0,this._brush=_.brushX(),this._gBrush=void 0,this._brushOn=!0,this._parentBrushOn=!1,this._round=void 0,this._ignoreBrushEvents=!1,this._renderHorizontalGridLine=!1,this._renderVerticalGridLine=!1,this._resizing=!1,this._unitCount=void 0,this._zoomScale=[1,1/0],this._zoomOutRestrict=!0,this._zoom=d.zoom().on("zoom",w.eventHandler(((t,e)=>this._onZoom(e)))),this._nullZoom=d.zoom().on("zoom",null),this._hasBeenMouseZoomable=!1,this._ignoreZoomEvents=!1,this._rangeChart=void 0,this._focusChart=void 0,this._mouseZoomable=!1,this._clipPadding=0,this._fOuterRangeBandPadding=.5,this._fRangeBandPadding=0,this._useRightYAxis=!1,this._useTopXAxis=!1}rescale(){return this._unitCount=void 0,this._resizing=!0,this}resizing(t){return arguments.length?(this._resizing=t,this):this._resizing}rangeChart(t){return arguments.length?(this._rangeChart=t,this._rangeChart.focusChart(this),this):this._rangeChart}zoomScale(t){return arguments.length?(this._zoomScale=t,this):this._zoomScale}zoomOutRestrict(t){return arguments.length?(this._zoomOutRestrict=t,this):this._zoomOutRestrict}_generateG(t){this._parent=void 0===t?this.svg():t;const e=window.location.href.split("#")[0];return this._g=this._parent.append("g"),this._chartBodyG=this._g.append("g").attr("class","chart-body").attr("transform",`translate(${this.margins().left}, ${this.margins().top})`).attr("clip-path",`url(${e}#${this._getClipPathId()})`),this._g}g(t){return arguments.length?(this._g=t,this):this._g}mouseZoomable(t){return arguments.length?(this._mouseZoomable=t,this):this._mouseZoomable}chartBodyG(t){return arguments.length?(this._chartBodyG=t,this):this._chartBodyG}x(t){return arguments.length?(this._x=t,this._xOriginalDomain=this._x.domain(),this.rescale(),this):this._x}xOriginalDomain(){return this._xOriginalDomain}xUnits(t){return arguments.length?(this._xUnits=t,this):this._xUnits}xAxis(t){return arguments.length?(this._xAxis=t,this):(this._xAxis||(this._xAxis=this._createXAxis()),this._xAxis)}elasticX(t){return arguments.length?(this._xElasticity=t,this):this._xElasticity}xAxisPadding(t){return arguments.length?(this._xAxisPadding=t,this):this._xAxisPadding}xAxisPaddingUnit(t){return arguments.length?(this._xAxisPaddingUnit=t,this):this._xAxisPaddingUnit}xUnitCount(){return void 0===this._unitCount&&(this.isOrdinal()?this._unitCount=this.x().domain().length:(this._unitCount=this.xUnits()(this.x().domain()[0],this.x().domain()[1]),this._unitCount instanceof Array&&(this._unitCount=this._unitCount.length))),this._unitCount}useRightYAxis(t){return arguments.length?(this._useRightYAxis!==t&&this._yAxis&&C.warn("Value of useRightYAxis has been altered, after yAxis was created. You might get unexpected yAxis behavior. Make calls to useRightYAxis sooner in your chart creation process."),this._useRightYAxis=t,this):this._useRightYAxis}useTopXAxis(t){return arguments.length?(this._useTopXAxis!==t&&this._xAxis&&C.warn("Value of useTopXAxis has been altered, after xAxis was created. You might get unexpected yAxis behavior. Make calls to useTopXAxis sooner in your chart creation process."),this._useTopXAxis=t,this):this._useTopXAxis}isOrdinal(){return this.xUnits()===V.ordinal}_useOuterPadding(){return!0}_ordinalXDomain(){return this._computeOrderedGroups(this.data()).map(this.keyAccessor())}_createXAxis(){return this._useTopXAxis?c.axisTop():c.axisBottom()}_prepareXAxis(t,e){this.isOrdinal()?(this._x.bandwidth||(C.warn("For compatibility with d3v4+, dc.js d3.0 ordinal bar/line/bubble charts need d3.scaleBand() for the x scale, instead of d3.scaleOrdinal(). Replacing .x() with a d3.scaleBand with the same domain - make the same change in your code to avoid this warning!"),this._x=h.scaleBand().domain(this._x.domain())),(this.elasticX()||0===this._x.domain().length)&&this._x.domain(this._ordinalXDomain())):this.elasticX()&&this._x.domain([this.xAxisMin(),this.xAxisMax()]);const i=this._x.domain();!e&&N.arraysEqual(this._lastXDomain,i)||this.rescale(),this._lastXDomain=i,this.isOrdinal()?this._x.range([0,this.xAxisLength()]).paddingInner(this._fRangeBandPadding).paddingOuter(this._useOuterPadding()?this._fOuterRangeBandPadding:0):this._x.range([0,this.xAxisLength()]),this._xAxis||(this._xAxis=this._createXAxis()),this._xAxis=this._xAxis.scale(this.x()),this._renderVerticalGridLines(t)}renderXAxis(t){let e=t.select("g.x");e.empty()&&(e=t.append("g").attr("class","axis x").attr("transform",`translate(${this.margins().left},${this._xAxisY()})`));let i=t.select("text.x-axis-label");const s=this._useTopXAxis?this._xAxisLabelPadding:this.height()-this._xAxisLabelPadding;i.empty()&&this.xAxisLabel()&&(i=t.append("text").attr("class",tt).attr("transform",`translate(${this.margins().left+this.xAxisLength()/2},${s})`).attr("text-anchor","middle")),this.xAxisLabel()&&i.text()!==this.xAxisLabel()&&i.text(this.xAxisLabel()),F(e,this.transitionDuration(),this.transitionDelay()).attr("transform",`translate(${this.margins().left},${this._xAxisY()})`).call(this._xAxis),F(i,this.transitionDuration(),this.transitionDelay()).attr("transform",`translate(${this.margins().left+this.xAxisLength()/2},${s})`)}_renderVerticalGridLines(t){let e=t.select("g.vertical");if(this._renderVerticalGridLine){e.empty()&&(e=t.insert("g",":first-child").attr("class","grid-line vertical").attr("transform",`translate(${this.margins().left},${this.margins().top})`));const i=this._xAxis.tickValues()?this._xAxis.tickValues():"function"==typeof this._x.ticks?this._x.ticks.apply(this._x,this._xAxis.tickArguments()):this._x.domain(),s=e.selectAll("line").data(i),r=s.enter().append("line").attr("x1",(t=>this._x(t))).attr("y1",this._xAxisY()-this.margins().top).attr("x2",(t=>this._x(t))).attr("y2",0).attr("opacity",0);F(r,this.transitionDuration(),this.transitionDelay()).attr("opacity",.5),F(s,this.transitionDuration(),this.transitionDelay()).attr("x1",(t=>this._x(t))).attr("y1",this._xAxisY()-this.margins().top).attr("x2",(t=>this._x(t))).attr("y2",0),s.exit().remove()}else e.selectAll("line").remove()}_xAxisY(){return this._useTopXAxis?this.margins().top:this.height()-this.margins().bottom}xAxisLength(){return this.effectiveWidth()}xAxisLabel(t,e){return arguments.length?(this._xAxisLabel=t,this.margins().bottom-=this._xAxisLabelPadding,this._xAxisLabelPadding=void 0===e?12:e,this.margins().bottom+=this._xAxisLabelPadding,this):this._xAxisLabel}_createYAxis(){return this._useRightYAxis?c.axisRight():c.axisLeft()}_prepareYAxis(t){if(void 0===this._y||this.elasticY()){void 0===this._y&&(this._y=h.scaleLinear());const t=this.yAxisMin()||0,e=this.yAxisMax()||0;this._y.domain([t,e]).rangeRound([this.yAxisHeight(),0])}this._y.range([this.yAxisHeight(),0]),this._yAxis||(this._yAxis=this._createYAxis()),this._yAxis.scale(this._y),this._renderHorizontalGridLinesForAxis(t,this._y,this._yAxis)}renderYAxisLabel(t,e,i,s){s=s||this._yAxisLabelPadding;let r=this.g().select(`text.y-axis-label.${t}-label`);const n=this.margins().top+this.yAxisHeight()/2;r.empty()&&e&&(r=this.g().append("text").attr("transform",`translate(${s},${n}),rotate(${i})`).attr("class",`y-axis-label ${t}-label`).attr("text-anchor","middle").text(e)),e&&r.text()!==e&&r.text(e),F(r,this.transitionDuration(),this.transitionDelay()).attr("transform",`translate(${s},${n}),rotate(${i})`)}renderYAxisAt(t,e,i){let s=this.g().select("g."+t);s.empty()&&(s=this.g().append("g").attr("class","axis "+t).attr("transform",`translate(${i},${this.margins().top})`)),F(s,this.transitionDuration(),this.transitionDelay()).attr("transform",`translate(${i},${this.margins().top})`).call(e)}renderYAxis(){const t=this._useRightYAxis?this.width()-this.margins().right:this._yAxisX();this.renderYAxisAt("y",this._yAxis,t);const e=this._useRightYAxis?this.width()-this._yAxisLabelPadding:this._yAxisLabelPadding,i=this._useRightYAxis?90:-90;this.renderYAxisLabel("y",this.yAxisLabel(),i,e)}_renderHorizontalGridLinesForAxis(t,e,i){let s=t.select("g.horizontal");if(this._renderHorizontalGridLine){const r=i.tickValues()?i.tickValues():e.ticks?e.ticks.apply(e,i.tickArguments()):e.domain();s.empty()&&(s=t.insert("g",":first-child").attr("class","grid-line horizontal").attr("transform",`translate(${this.margins().left},${this.margins().top})`));const n=s.selectAll("line").data(r),a=n.enter().append("line").attr("x1",1).attr("y1",(t=>e(t))).attr("x2",this.xAxisLength()).attr("y2",(t=>e(t))).attr("opacity",0);F(a,this.transitionDuration(),this.transitionDelay()).attr("opacity",.5),F(n,this.transitionDuration(),this.transitionDelay()).attr("x1",1).attr("y1",(t=>e(t))).attr("x2",this.xAxisLength()).attr("y2",(t=>e(t))),n.exit().remove()}else s.selectAll("line").remove()}_yAxisX(){return this.useRightYAxis()?this.width()-this.margins().right:this.margins().left}yAxisLabel(t,e){return arguments.length?(this._yAxisLabel=t,this.margins().left-=this._yAxisLabelPadding,this._yAxisLabelPadding=void 0===e?12:e,this.margins().left+=this._yAxisLabelPadding,this):this._yAxisLabel}y(t){return arguments.length?(this._y=t,this.rescale(),this):this._y}yAxis(t){return arguments.length?(this._yAxis=t,this):(this._yAxis||(this._yAxis=this._createYAxis()),this._yAxis)}elasticY(t){return arguments.length?(this._yElasticity=t,this):this._yElasticity}renderHorizontalGridLines(t){return arguments.length?(this._renderHorizontalGridLine=t,this):this._renderHorizontalGridLine}renderVerticalGridLines(t){return arguments.length?(this._renderVerticalGridLine=t,this):this._renderVerticalGridLine}xAxisMin(){const t=a.min(this.data(),(t=>this.keyAccessor()(t)));return N.subtract(t,this._xAxisPadding,this._xAxisPaddingUnit)}xAxisMax(){const t=a.max(this.data(),(t=>this.keyAccessor()(t)));return N.add(t,this._xAxisPadding,this._xAxisPaddingUnit)}yAxisMin(){const t=a.min(this.data(),(t=>this.valueAccessor()(t)));return N.subtract(t,this._yAxisPadding)}yAxisMax(){const t=a.max(this.data(),(t=>this.valueAccessor()(t)));return N.add(t,this._yAxisPadding)}yAxisPadding(t){return arguments.length?(this._yAxisPadding=t,this):this._yAxisPadding}yAxisHeight(){return this.effectiveHeight()}round(t){return arguments.length?(this._round=t,this):this._round}_rangeBandPadding(t){return arguments.length?(this._fRangeBandPadding=t,this):this._fRangeBandPadding}_outerRangeBandPadding(t){return arguments.length?(this._fOuterRangeBandPadding=t,this):this._fOuterRangeBandPadding}filter(t){return arguments.length?(super.filter(t),this.redrawBrush(t,!1),this):super.filter()}brush(t){return arguments.length?(this._brush=t,this):this._brush}renderBrush(t,e){this._brushOn&&(this._brush.on("start brush end",w.eventHandler(((t,e)=>this._brushing(e)))),this._gBrush=t.append("g").attr("class","brush").attr("transform",`translate(${this.margins().left},${this.margins().top})`),this.setBrushExtents(),this.createBrushHandlePaths(this._gBrush,e),this.redrawBrush(this.filter(),e))}createBrushHandlePaths(t){let e=t.selectAll("path.custom-brush-handle").data([{type:"w"},{type:"e"}]);e=e.enter().append("path").attr("class",et).merge(e),e.attr("d",(t=>this.resizeHandlePath(t)))}extendBrush(t){return t&&this.round()&&(t[0]=this.round()(t[0]),t[1]=this.round()(t[1])),t}brushIsEmpty(t){return!t||t[1]<=t[0]}_brushing(t){if(this._ignoreBrushEvents)return;let e=t.selection;e&&(e=e.map(this.x().invert)),e=this.extendBrush(e),this.redrawBrush(e,!1);const i=this.brushIsEmpty(e)?null:E.RangedFilter(e[0],e[1]);T.trigger((()=>{this.applyBrushSelection(i)}),A.EVENT_DELAY)}applyBrushSelection(t){this.replaceFilter(t),this.redrawGroup()}_withoutBrushEvents(t){const e=this._ignoreBrushEvents;this._ignoreBrushEvents=!0;try{t()}finally{this._ignoreBrushEvents=e}}setBrushExtents(t){this._withoutBrushEvents((()=>{this._brush.extent([[0,0],[this.effectiveWidth(),this.effectiveHeight()]])})),this._gBrush.call(this._brush)}redrawBrush(t,e){if(this._brushOn&&this._gBrush)if(this._resizing&&this.setBrushExtents(e),t){const i=[this._x(t[0]),this._x(t[1])],s=P(e,this.transitionDuration(),this.transitionDelay())(this._gBrush);this._withoutBrushEvents((()=>{s.call(this._brush.move,i)})),s.selectAll("path.custom-brush-handle").attr("display",null).attr("transform",((e,i)=>`translate(${this._x(t[i])}, 0)`)).attr("d",(t=>this.resizeHandlePath(t)))}else this._withoutBrushEvents((()=>{this._gBrush.call(this._brush.move,null)})),this._gBrush.selectAll("path.custom-brush-handle").attr("display","none");this.fadeDeselectedArea(t)}fadeDeselectedArea(t){}resizeHandlePath(t){const e=+("e"===(t=t.type)),i=e?1:-1,s=this.effectiveHeight()/3;return`M${.5*i},${s}A6,6 0 0 ${e} ${6.5*i},${s+6}V${2*s-6}A6,6 0 0 ${e} ${.5*i},${2*s}ZM${2.5*i},${s+8}V${2*s-8}M${4.5*i},${s+8}V${2*s-8}`}_getClipPathId(){return this.anchorName().replace(/[ .#=\[\]"]/g,"-")+"-clip"}clipPadding(t){return arguments.length?(this._clipPadding=t,this):this._clipPadding}_generateClipPath(){const t=N.appendOrSelect(this._parent,"defs"),e=this._getClipPathId(),i=N.appendOrSelect(t,"#"+e,"clipPath").attr("id",e),s=2*this._clipPadding;N.appendOrSelect(i,"rect").attr("width",this.xAxisLength()+s).attr("height",this.yAxisHeight()+s).attr("transform",`translate(-${this._clipPadding}, -${this._clipPadding})`)}_preprocessData(){}_doRender(){return this.resetSvg(),this._preprocessData(),this._generateG(),this._generateClipPath(),this._drawChart(!0),this._configureMouseZoom(),this}_doRedraw(){return this._preprocessData(),this._drawChart(!1),this._generateClipPath(),this}_drawChart(t){this.isOrdinal()&&(this._brushOn=!1),this._prepareXAxis(this.g(),t),this._prepareYAxis(this.g()),this.plotData(),(this.elasticX()||this._resizing||t)&&this.renderXAxis(this.g()),(this.elasticY()||this._resizing||t)&&this.renderYAxis(this.g()),t?this.renderBrush(this.g(),!1):this.redrawBrush(this.filter(),this._resizing),this.fadeDeselectedArea(this.filter()),this.resizing(!1)}_configureMouseZoom(){this._origX=this._x.copy(),this._mouseZoomable?this._enableMouseZoom():this._hasBeenMouseZoomable&&this._disableMouseZoom()}_enableMouseZoom(){this._hasBeenMouseZoomable=!0;const t=[[0,0],[this.effectiveWidth(),this.effectiveHeight()]];if(this._zoom.scaleExtent(this._zoomScale).extent(t).duration(this.transitionDuration()),this._zoomOutRestrict){const e=Math.max(this._zoomScale[0],1);this._zoom.translateExtent(t).scaleExtent([e,this._zoomScale[1]])}this.root().call(this._zoom),this._updateD3zoomTransform()}_disableMouseZoom(){this.root().call(this._nullZoom)}_zoomHandler(t,e){let i;this._hasRangeSelected(t)?(this.x().domain(t),i=E.RangedFilter(t[0],t[1])):(this.x().domain(this._xOriginalDomain),i=null),this.replaceFilter(i),this.rescale(),this.redraw(),e||(this._rangeChart&&!N.arraysEqual(this.filter(),this._rangeChart.filter())&&T.trigger((()=>{this._rangeChart.replaceFilter(i),this._rangeChart.redraw()})),this._invokeZoomedListener(),T.trigger((()=>{this.redrawGroup()}),A.EVENT_DELAY))}_domainToZoomTransform(t,e,i){const s=(e[1]-e[0])/(t[1]-t[0]),r=-1*i(t[0]);return d.zoomIdentity.scale(s).translate(r,0)}_updateD3zoomTransform(){this._zoom&&this._withoutZoomEvents((()=>{this._zoom.transform(this.root(),this._domainToZoomTransform(this.x().domain(),this._xOriginalDomain,this._origX))}))}_withoutZoomEvents(t){const e=this._ignoreZoomEvents;this._ignoreZoomEvents=!0;try{t()}finally{this._ignoreZoomEvents=e}}_onZoom(t){if(this._ignoreZoomEvents)return;const e=t.transform.rescaleX(this._origX).domain();this.focus(e,!1)}_checkExtents(t,e){return t&&2===t.length&&e&&2===e.length?((t[0]>e[1]||t[1]<e[0])&&console.warn("Could not intersect extents, will reset"),[t[0]>e[0]?t[0]:e[0],t[1]<e[1]?t[1]:e[1]]):t}focus(t,e){this._zoomOutRestrict&&(t=this._checkExtents(t,this._xOriginalDomain),this._rangeChart&&(t=this._checkExtents(t,this._rangeChart.x().domain()))),this._zoomHandler(t,e),this._updateD3zoomTransform()}refocused(){return!N.arraysEqual(this.x().domain(),this._xOriginalDomain)}focusChart(t){return arguments.length?(this._focusChart=t,this.on("filtered.dcjs-range-chart",(t=>{t.filter()?N.arraysEqual(t.filter(),this._focusChart.filter())||T.trigger((()=>{this._focusChart.focus(t.filter(),!0)})):T.trigger((()=>{this._focusChart.x().domain(this._focusChart.xOriginalDomain(),!0)}))})),this):this._focusChart}brushOn(t){return arguments.length?(this._brushOn=t,this):this._brushOn}parentBrushOn(t){return arguments.length?(this._parentBrushOn=t,this):this._parentBrushOn}gBrush(){return this._gBrush}_hasRangeSelected(t){return t instanceof Array&&t.length>1}}const st=function(){let t=1,e=1,i=0;let s=null,n=Number,l=rt,o=nt,c=null,d=!1;let _=.3,g=.8,p=!1,y=!0,m=!1;function x(x){x.each((function(u,x){u=u.map(n).sort(a.ascending);const f=r.select(this),b=u.length;let A,v;if(0===b)return;const C=u.quartiles=o(u),k=l&&l.call(this,u,x),S=k&&k.map((t=>u[t])),w=k?a.range(0,k[0]).concat(a.range(k[1]+1,b)):a.range(b);y?(A=u[0],v=u[b-1]):(A=u[k[0]],v=u[k[1]]);const L=a.range(k[0],k[1]+1),R=h.scaleLinear().domain(s&&s.call(this,u,x)||[A,v]).range([e,0]),D=this.__chart__||h.scaleLinear().domain([0,1/0]).range(R.range());this.__chart__=R;const O=f.selectAll("line.center").data(S?[S]:[]);O.enter().insert("line","rect").attr("class","center").attr("x1",t/2).attr("y1",(t=>D(t[0]))).attr("x2",t/2).attr("y2",(t=>D(t[1]))).style("opacity",1e-6).transition().duration(i).delay(0).style("opacity",1).attr("y1",(t=>R(t[0]))).attr("y2",(t=>R(t[1]))),O.transition().duration(i).delay(0).style("opacity",1).attr("x1",t/2).attr("x2",t/2).attr("y1",(t=>R(t[0]))).attr("y2",(t=>R(t[1]))),O.exit().transition().duration(i).delay(0).style("opacity",1e-6).attr("y1",(t=>R(t[0]))).attr("y2",(t=>R(t[1]))).remove();const B=f.selectAll("rect.box").data([C]);B.enter().append("rect").attr("class","box").attr("x",0).attr("y",(t=>D(t[2]))).attr("width",t).attr("height",(t=>D(t[0])-D(t[2]))).style("fill-opacity",d?.1:1).transition().duration(i).delay(0).attr("y",(t=>R(t[2]))).attr("height",(t=>R(t[0])-R(t[2]))),B.transition().duration(i).delay(0).attr("width",t).attr("y",(t=>R(t[2]))).attr("height",(t=>R(t[0])-R(t[2])));const F=f.selectAll("line.median").data([C[1]]);F.enter().append("line").attr("class","median").attr("x1",0).attr("y1",D).attr("x2",t).attr("y2",D).transition().duration(i).delay(0).attr("y1",R).attr("y2",R),F.transition().duration(i).delay(0).attr("x1",0).attr("x2",t).attr("y1",R).attr("y2",R);const P=f.selectAll("line.whisker").data(S||[]);if(P.enter().insert("line","circle, text").attr("class","whisker").attr("x1",0).attr("y1",D).attr("x2",t).attr("y2",D).style("opacity",1e-6).transition().duration(i).delay(0).attr("y1",R).attr("y2",R).style("opacity",1),P.transition().duration(i).delay(0).attr("x1",0).attr("x2",t).attr("y1",R).attr("y2",R).style("opacity",1),P.exit().transition().duration(i).delay(0).attr("y1",R).attr("y2",R).style("opacity",1e-6).remove(),y){const e=m?"outlierBold":"outlier",s=m?3:5,r=m?function(){return Math.floor(Math.random()*(t*g)+1+(t-t*g)/2)}:function(){return t/2},n=f.selectAll("circle."+e).data(w,Number);n.enter().insert("circle","text").attr("class",e).attr("r",s).attr("cx",r).attr("cy",(t=>D(u[t]))).style("opacity",1e-6).transition().duration(i).delay(0).attr("cy",(t=>R(u[t]))).style("opacity",.6),p&&(n.selectAll("title").remove(),n.append("title").text((t=>u[t]))),n.transition().duration(i).delay(0).attr("cx",r).attr("cy",(t=>R(u[t]))).style("opacity",.6),n.exit().transition().duration(i).delay(0).attr("cy",0).style("opacity",1e-6).remove()}if(d){const e=f.selectAll("circle.data").data(L);e.enter().insert("circle","text").attr("class","data").attr("r",3).attr("cx",(()=>Math.floor(Math.random()*(t*g)+1+(t-t*g)/2))).attr("cy",(t=>D(u[t]))).style("opacity",1e-6).transition().duration(i).delay(0).attr("cy",(t=>R(u[t]))).style("opacity",_),p&&(e.selectAll("title").remove(),e.append("title").text((t=>u[t]))),e.transition().duration(i).delay(0).attr("cx",(()=>Math.floor(Math.random()*(t*g)+1+(t-t*g)/2))).attr("cy",(t=>R(u[t]))).style("opacity",_),e.exit().transition().duration(i).delay(0).attr("cy",0).style("opacity",1e-6).remove()}const H=c||R.tickFormat(8),T=f.selectAll("text.box").data(C);T.enter().append("text").attr("class","box").attr("dy",".3em").attr("dx",((t,e)=>1&e?6:-6)).attr("x",((e,i)=>1&i?t:0)).attr("y",D).attr("text-anchor",((t,e)=>1&e?"start":"end")).text(H).transition().duration(i).delay(0).attr("y",R),T.transition().duration(i).delay(0).text(H).attr("x",((e,i)=>1&i?t:0)).attr("y",R);const E=f.selectAll("text.whisker").data(S||[]);E.enter().append("text").attr("class","whisker").attr("dy",".3em").attr("dx",6).attr("x",t).attr("y",D).text(H).style("opacity",1e-6).transition().duration(i).delay(0).attr("y",R).style("opacity",1),E.transition().duration(i).delay(0).text(H).attr("x",t).attr("y",R).style("opacity",1),E.exit().transition().duration(i).delay(0).attr("y",R).style("opacity",1e-6).remove(),delete u.quartiles})),u.timerFlush()}return x.width=function(e){return arguments.length?(t=e,x):t},x.height=function(t){return arguments.length?(e=t,x):e},x.tickFormat=function(t){return arguments.length?(c=t,x):c},x.showOutliers=function(t){return arguments.length?(y=t,x):y},x.boldOutlier=function(t){return arguments.length?(m=t,x):m},x.renderDataPoints=function(t){return arguments.length?(d=t,x):d},x.renderTitle=function(t){return arguments.length?(p=t,x):p},x.dataOpacity=function(t){return arguments.length?(_=t,x):_},x.dataWidthPortion=function(t){return arguments.length?(g=t,x):g},x.duration=function(t){return arguments.length?(i=t,x):i},x.domain=function(t){return arguments.length?(s=null===t||"function"==typeof t?t:N.constant(t),x):s},x.value=function(t){return arguments.length?(n=t,x):n},x.whiskers=function(t){return arguments.length?(l=t,x):l},x.quartiles=function(t){return arguments.length?(o=t,x):o},x};function rt(t){return[0,t.length-1]}function nt(t){return[a.quantile(t,.25),a.quantile(t,.5),a.quantile(t,.75)]}class at extends it{constructor(){super(),this._stackLayout=g.stack(),this._stack=[],this._titles={},this._hidableStacks=!1,this._evadeDomainFilter=!1,this.data((()=>{const t=this._stack.filter(this._visibility);if(!t.length)return[];t.forEach(((t,e)=>this._prepareValues(t,e)));const e=t[0].values.map(((e,i)=>{const s={x:e.x};return t.forEach((t=>{s[t.name]=t.values[i].y})),s})),i=t.map((t=>t.name));return this.stackLayout().keys(i)(e).forEach(((e,i)=>{e.forEach(((e,s)=>{t[i].values[s].y0=e[0],t[i].values[s].y1=e[1]}))})),t})),this.colorAccessor((function(t){return this.layer||this.name||t.name||t.layer}))}_prepareValues(t,e){const i=t.accessor||this.valueAccessor();t.name=String(t.name||e);const s=t.group.all().map(((e,s)=>({x:this.keyAccessor()(e,s),y:t.hidden?null:i(e,s),data:e,layer:t.name,hidden:t.hidden})));t.domainValues=s.filter((t=>this._domainFilter()(t))),t.values=this.evadeDomainFilter()?s:t.domainValues}_domainFilter(){if(!this.x())return N.constant(!0);const t=this.x().domain();return this.isOrdinal()||this.elasticX()?()=>!0:e=>e.x>=t[0]&&e.x<=t[t.length-1]}stack(t,e,i){if(!arguments.length)return this._stack;arguments.length<=2&&(i=e);const s={group:t};return"string"==typeof e&&(s.name=e),"function"==typeof i&&(s.accessor=i),this._stack.push(s),this}group(t,e,i){return arguments.length?(this._stack=[],this._titles={},this.stack(t,e),i&&this.valueAccessor(i),super.group(t,e)):super.group()}hidableStacks(t){return arguments.length?(this._hidableStacks=t,this):this._hidableStacks}_findLayerByName(t){const e=this._stack.map(M("name")).indexOf(t);return this._stack[e]}hideStack(t){const e=this._findLayerByName(t);return e&&(e.hidden=!0),this}showStack(t){const e=this._findLayerByName(t);return e&&(e.hidden=!1),this}getValueAccessorByIndex(t){return this._stack[t].accessor||this.valueAccessor()}yAxisMin(){const t=a.min(this._flattenStack(),(t=>t.y<0?t.y+t.y0:t.y0));return N.subtract(t,t