diff --git a/dist/colorbrewer.css b/dist/colorbrewer.css index 9c4ded53e..abb85873d 100644 --- a/dist/colorbrewer.css +++ b/dist/colorbrewer.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/annotations.css b/dist/plugins/annotations.css index e04bc5dc5..bdec42e09 100644 --- a/dist/plugins/annotations.css +++ b/dist/plugins/annotations.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/annotations.dark.css b/dist/plugins/annotations.dark.css index e04bc5dc5..bdec42e09 100644 --- a/dist/plugins/annotations.dark.css +++ b/dist/plugins/annotations.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/annotations.js b/dist/plugins/annotations.js index 059674358..20fbf6a63 100644 --- a/dist/plugins/annotations.js +++ b/dist/plugins/annotations.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"),require("d3-color"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-color"],e);else{var a="object"==typeof exports?e(require("taucharts"),require("d3-color")):e(t.Taucharts,t.d3);for(var n in a)("object"==typeof exports?exports:t)[n]=a[n]}}(window,function(t,e){return function(t){var e={};function a(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,a),r.l=!0,r.exports}return a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)a.d(n,r,function(e){return t[e]}.bind(null,r));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=14)}({0:function(e,a){e.exports=t},14:function(t,e,a){"use strict";a.r(e);var n=a(0),r=a.n(n),i=a(5);function o(t,e){return t.replace(/\{\{\s*(.+?)\s*\}\}/g,function(t,a){return e.hasOwnProperty(a)?e[a]:""})}var s=r.a.api.utils,u=r.a.api.pluginsSDK,c=function(t,e,a){"front"===a?t.push(e):t.unshift(e)},l=function(t){return function(e){var a={},n=[{dim:e.scaleX.dim,scale:e.scaleY,method:"yi"},{dim:e.scaleY.dim,scale:e.scaleX,method:"xi"},{dim:null,scale:null,method:null,k:null}].find(function(e){return Array.isArray(t.dim)?t.dim.indexOf(e.dim)>=0:e.dim===t.dim});if(null===n.method)return a;var i={l:-.5,r:.5},o=n.method,s=n.scale;return a[o]=function(t){var a=i[t.__pos__]||0;if(s.discrete)return e[o](t)+s.stepSize(t[s.dim])*a;if(s.period){for(var n=r.a.api.tickPeriod.get(s.period,{utc:s.utcTime}),u=s.domain(),c=n.cast(u[0]);c=0?r[t].map(function(t){return new Date(t)}):r[t];i.series=s.unique(o.concat(u))}})})},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},_useSavedDataRefs:function(t,e){var a=this._dataRefs;return this._usedDataRefsKeys.add(e),e in a?(a[e].forEach(function(e,a){return Object.assign(e,t[a])}),a[e]):(a[e]=t,t)},_startWatchingDataRefs:function(){var t=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(t)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs:function(){var t=this._dataRefs,e=this._initialDataRefsKeys,a=this._usedDataRefsKeys;Array.from(e).filter(function(t){return!a.has(t)}).forEach(function(e){return delete t[e]}),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems:function(t){var e=function(t,e){return t.reduce(function(t,a,n){return t[a]=e[n],t},{})};return t.reduce(function(t,a){return Array.isArray(a.dim)?Array.isArray(a.val)&&a.val.every(Array.isArray)&&a.val.forEach(function(n){t.push(e(a.dim,n))}):Array.isArray(a.val)?a.val.forEach(function(n){t.push(e([a.dim],[n]))}):t.push(e([a.dim],[a.val])),t},[])},_getAnnotatedDimValues:function(t){var e={};return this._getDataRowsFromItems(t).forEach(function(t){Object.keys(t).forEach(function(a){e[a]=e[a]||[],e[a].push(t[a])})}),e}}}r.a.api.plugins.add("annotations",f),e.default=f},5:function(t,a){t.exports=e}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"),require("d3-color"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-color"],e);else{var n="object"==typeof exports?e(require("taucharts"),require("d3-color")):e(t.Taucharts,t.d3);for(var a in n)("object"==typeof exports?exports:t)[a]=n[a]}}(window,function(t,e){return function(t){var e={};function n(a){if(e[a])return e[a].exports;var r=e[a]={i:a,l:!1,exports:{}};return t[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(a,r,function(e){return t[e]}.bind(null,r));return a},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=14)}({0:function(e,n){e.exports=t},14:function(t,e,n){"use strict";n.r(e);var a=n(0),r=n.n(a),i=n(5);function o(t,e){return t.replace(/\{\{\s*(.+?)\s*\}\}/g,function(t,n){return e.hasOwnProperty(n)?e[n]:""})}var s=r.a.api.utils,u=r.a.api.pluginsSDK,c=function(t,e,n){"front"===n?t.push(e):t.unshift(e)},l=function(t){return function(e){var n={},a=[{dim:e.scaleX.dim,scale:e.scaleY,method:"yi"},{dim:e.scaleY.dim,scale:e.scaleX,method:"xi"},{dim:null,scale:null,method:null,k:null}].find(function(e){return Array.isArray(t.dim)?t.dim.indexOf(e.dim)>=0:e.dim===t.dim});if(null===a.method)return n;var i={l:-.5,r:.5},o=a.method,s=a.scale;return n[o]=function(t){var n=i[t.__pos__]||0;if(s.discrete)return e[o](t)+s.stepSize(t[s.dim])*n;if(s.period){for(var a=r.a.api.tickPeriod.get(s.period,{utc:s.utcTime}),u=s.domain(),c=a.cast(u[0]);c=0?r[t].map(function(t){return new Date(t)}):r[t];i.series=s.unique(o.concat(u))}})})},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},_useSavedDataRefs:function(t,e){var n=this._dataRefs;return this._usedDataRefsKeys.add(e),e in n?(n[e].forEach(function(e,n){return Object.assign(e,t[n])}),n[e]):(n[e]=t,t)},_startWatchingDataRefs:function(){var t=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(t)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs:function(){var t=this._dataRefs,e=this._initialDataRefsKeys,n=this._usedDataRefsKeys;Array.from(e).filter(function(t){return!n.has(t)}).forEach(function(e){return delete t[e]}),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems:function(t){var e=function(t,e){return t.reduce(function(t,n,a){return t[n]=e[a],t},{})};return t.reduce(function(t,n){return Array.isArray(n.dim)?Array.isArray(n.val)&&n.val.every(Array.isArray)&&n.val.forEach(function(a){t.push(e(n.dim,a))}):Array.isArray(n.val)?n.val.forEach(function(a){t.push(e([n.dim],[a]))}):t.push(e([n.dim],[n.val])),t},[])},_getAnnotatedDimValues:function(t){var e={};return this._getDataRowsFromItems(t).forEach(function(t){Object.keys(t).forEach(function(n){e[n]=e[n]||[],e[n].push(t[n])})}),e}}}r.a.api.plugins.add("annotations",f),e.default=f},5:function(t,n){t.exports=e}})}); \ No newline at end of file diff --git a/dist/plugins/bar-as-span.js b/dist/plugins/bar-as-span.js index 3ed1321f0..70442ee04 100644 --- a/dist/plugins/bar-as-span.js +++ b/dist/plugins/bar-as-span.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/box-whiskers.js b/dist/plugins/box-whiskers.js index f237f4195..bc36d174c 100644 --- a/dist/plugins/box-whiskers.js +++ b/dist/plugins/box-whiskers.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/category-filter.css b/dist/plugins/category-filter.css index ae5e98414..0400b2b00 100644 --- a/dist/plugins/category-filter.css +++ b/dist/plugins/category-filter.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/category-filter.dark.css b/dist/plugins/category-filter.dark.css index 47422b108..b2bd1d349 100644 --- a/dist/plugins/category-filter.dark.css +++ b/dist/plugins/category-filter.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/category-filter.js b/dist/plugins/category-filter.js index b45ffb364..d061fee05 100644 --- a/dist/plugins/category-filter.js +++ b/dist/plugins/category-filter.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/color-brewer.js b/dist/plugins/color-brewer.js index 6ea900d73..d098cc557 100644 --- a/dist/plugins/color-brewer.js +++ b/dist/plugins/color-brewer.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/crosshair.css b/dist/plugins/crosshair.css index 2bc4b22e8..e152cd2fc 100644 --- a/dist/plugins/crosshair.css +++ b/dist/plugins/crosshair.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/crosshair.dark.css b/dist/plugins/crosshair.dark.css index 4f0b7fbe4..450b7bd1f 100644 --- a/dist/plugins/crosshair.dark.css +++ b/dist/plugins/crosshair.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/crosshair.js b/dist/plugins/crosshair.js index 03376e3bb..4f4d0a271 100644 --- a/dist/plugins/crosshair.js +++ b/dist/plugins/crosshair.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/diff-tooltip.css b/dist/plugins/diff-tooltip.css index 60a2858dc..bc068c363 100644 --- a/dist/plugins/diff-tooltip.css +++ b/dist/plugins/diff-tooltip.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/diff-tooltip.dark.css b/dist/plugins/diff-tooltip.dark.css index 3a3c204c7..fbe2f9006 100644 --- a/dist/plugins/diff-tooltip.dark.css +++ b/dist/plugins/diff-tooltip.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/diff-tooltip.js b/dist/plugins/diff-tooltip.js index 95fa562c9..6f89b8dd9 100644 --- a/dist/plugins/diff-tooltip.js +++ b/dist/plugins/diff-tooltip.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/export-to.css b/dist/plugins/export-to.css index 3337e3258..c0558eadd 100644 --- a/dist/plugins/export-to.css +++ b/dist/plugins/export-to.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/export-to.dark.css b/dist/plugins/export-to.dark.css index 3337e3258..c0558eadd 100644 --- a/dist/plugins/export-to.dark.css +++ b/dist/plugins/export-to.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/export-to.js b/dist/plugins/export-to.js index a4281490b..b9b9b0554 100644 --- a/dist/plugins/export-to.js +++ b/dist/plugins/export-to.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/floating-axes.js b/dist/plugins/floating-axes.js index 2d513a5ad..2884ef972 100644 --- a/dist/plugins/floating-axes.js +++ b/dist/plugins/floating-axes.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/geomap-legend.js b/dist/plugins/geomap-legend.js index 60528b490..45faa5a0f 100644 --- a/dist/plugins/geomap-legend.js +++ b/dist/plugins/geomap-legend.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/geomap-tooltip.js b/dist/plugins/geomap-tooltip.js index 83df17c97..d2777728c 100644 --- a/dist/plugins/geomap-tooltip.js +++ b/dist/plugins/geomap-tooltip.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/layers.js b/dist/plugins/layers.js index 5d31d3e1e..566ff4325 100644 --- a/dist/plugins/layers.js +++ b/dist/plugins/layers.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/legend.css b/dist/plugins/legend.css index 2e3c557bf..5989e7ce8 100644 --- a/dist/plugins/legend.css +++ b/dist/plugins/legend.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/legend.dark.css b/dist/plugins/legend.dark.css index 2d5f1da14..93b876fd8 100644 --- a/dist/plugins/legend.dark.css +++ b/dist/plugins/legend.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/legend.js b/dist/plugins/legend.js index a1e274470..f60cf145a 100644 --- a/dist/plugins/legend.js +++ b/dist/plugins/legend.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/parallel-brushing.js b/dist/plugins/parallel-brushing.js index 4b1faf51f..0388655c4 100644 --- a/dist/plugins/parallel-brushing.js +++ b/dist/plugins/parallel-brushing.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/parallel-tooltip.js b/dist/plugins/parallel-tooltip.js index 557f0f219..fc38563c0 100644 --- a/dist/plugins/parallel-tooltip.js +++ b/dist/plugins/parallel-tooltip.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/quick-filter.css b/dist/plugins/quick-filter.css index 15ab50126..984d4ec34 100644 --- a/dist/plugins/quick-filter.css +++ b/dist/plugins/quick-filter.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/quick-filter.dark.css b/dist/plugins/quick-filter.dark.css index 15ab50126..984d4ec34 100644 --- a/dist/plugins/quick-filter.dark.css +++ b/dist/plugins/quick-filter.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/quick-filter.js b/dist/plugins/quick-filter.js index fd30d7459..1e5624aa2 100644 --- a/dist/plugins/quick-filter.js +++ b/dist/plugins/quick-filter.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index c7c97dd97..89a6bae24 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/tooltip.css b/dist/plugins/tooltip.css index 9e83fdfb4..e6bd6c37b 100644 --- a/dist/plugins/tooltip.css +++ b/dist/plugins/tooltip.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/tooltip.dark.css b/dist/plugins/tooltip.dark.css index 782a5b9b9..78f3604dc 100644 --- a/dist/plugins/tooltip.dark.css +++ b/dist/plugins/tooltip.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/tooltip.js b/dist/plugins/tooltip.js index c9bc03903..35dc926d1 100644 --- a/dist/plugins/tooltip.js +++ b/dist/plugins/tooltip.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/trendline.css b/dist/plugins/trendline.css index 050d720c1..be3bc8947 100644 --- a/dist/plugins/trendline.css +++ b/dist/plugins/trendline.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/trendline.dark.css b/dist/plugins/trendline.dark.css index 59673bfa4..41da2571d 100644 --- a/dist/plugins/trendline.dark.css +++ b/dist/plugins/trendline.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/plugins/trendline.js b/dist/plugins/trendline.js index 24f84f954..8008f5877 100644 --- a/dist/plugins/trendline.js +++ b/dist/plugins/trendline.js @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/taucharts.css b/dist/taucharts.css index 6adc9b535..c13d70aa1 100644 --- a/dist/taucharts.css +++ b/dist/taucharts.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/taucharts.dark.css b/dist/taucharts.dark.css index c7328080e..6115e66a0 100644 --- a/dist/taucharts.dark.css +++ b/dist/taucharts.dark.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/taucharts.dark.min.css b/dist/taucharts.dark.min.css index 08288723f..b9d4c1c38 100644 --- a/dist/taucharts.dark.min.css +++ b/dist/taucharts.dark.min.css @@ -1,7 +1,7 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * diff --git a/dist/taucharts.js b/dist/taucharts.js index 0af42c18c..1d70ad840 100644 --- a/dist/taucharts.js +++ b/dist/taucharts.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.4 (2018-12-27) - * Copyright 2018 Targetprocess, Inc. + * taucharts@2.6.5 (2019-02-08) + * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):"function"==typeof define&&define.amd?define(["d3-selection","d3-array","d3-scale","topojson-client","d3-transition","d3-format","d3-time-format","d3-brush","d3-color","d3-axis","d3-geo","d3-quadtree","d3-shape","d3-time"],e):"object"==typeof exports?exports.Taucharts=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):t.Taucharts=e(t.d3,t.d3,t.d3,t.topojson,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(window,function(t,e,n,r,i,o,a,u,c,s,l,f,d,h){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=20)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"traverseJSON",function(){return gt}),n.d(r,"traverseSpec",function(){return mt}),n.d(r,"clone",function(){return kt}),n.d(r,"isDate",function(){return Et}),n.d(r,"isObject",function(){return Tt}),n.d(r,"niceZeroBased",function(){return Ct}),n.d(r,"niceTimeDomain",function(){return Nt}),n.d(r,"generateHash",function(){return Pt}),n.d(r,"generateRatioFunction",function(){return Ft}),n.d(r,"isSpecRectCoordsOnly",function(){return zt}),n.d(r,"throttleLastEvent",function(){return Rt}),n.d(r,"splitEvenly",function(){return Dt}),n.d(r,"extRGBColor",function(){return It}),n.d(r,"extCSSClass",function(){return Bt}),n.d(r,"toRadian",function(){return Wt}),n.d(r,"normalizeAngle",function(){return Ht}),n.d(r,"range",function(){return Ut}),n.d(r,"hasXOverflow",function(){return Gt}),n.d(r,"hasYOverflow",function(){return qt}),n.d(r,"flatten",function(){return Xt}),n.d(r,"unique",function(){return Yt}),n.d(r,"groupBy",function(){return Vt}),n.d(r,"union",function(){return $t}),n.d(r,"intersection",function(){return Jt}),n.d(r,"defaults",function(){return Kt}),n.d(r,"omit",function(){return Zt}),n.d(r,"memoize",function(){return Qt}),n.d(r,"createMultiSorter",function(){return te}),n.d(r,"pick",function(){return ee}),n.d(r,"escape",function(){return ne}),n.d(r,"template",function(){return re}),n.d(r,"escapeHtml",function(){return ie}),n.d(r,"xml",function(){return ce}),n.d(r,"take",function(){return se}),n.d(r,"isChartElement",function(){return fe}),n.d(r,"isFacetUnit",function(){return de});var i={};n.r(i),n.d(i,"appendTo",function(){return ge}),n.d(i,"getScrollbarSize",function(){return me}),n.d(i,"setScrollPadding",function(){return ye}),n.d(i,"getStyle",function(){return ve}),n.d(i,"getStyleAsNum",function(){return be}),n.d(i,"getContainerSize",function(){return xe}),n.d(i,"getAxisTickLabelSize",function(){return we}),n.d(i,"getLabelSize",function(){return _e}),n.d(i,"getCharSize",function(){return Se}),n.d(i,"selectOrAppend",function(){return Me}),n.d(i,"selectImmediate",function(){return Oe}),n.d(i,"selectAllImmediate",function(){return Ae}),n.d(i,"sortChildren",function(){return ke}),n.d(i,"classes",function(){return Ee}),n.d(i,"dispatchMouseEvent",function(){return Te});var o={};n.r(o),n.d(o,"translate",function(){return Ce}),n.d(o,"rotate",function(){return Ne}),n.d(o,"getOrientation",function(){return Le}),n.d(o,"parseTransformTranslate",function(){return je}),n.d(o,"isIntersect",function(){return Pe}),n.d(o,"getDeepTransformTranslate",function(){return Fe}),n.d(o,"raiseElements",function(){return ze});var a=n(0),u=n(2),c=n(3),s={},l={};function f(t){var e=l[t];return e||(e=function(){for(var e,n,r=this,i=0,o=[];r=r.handler;){if("function"==typeof(n=r.callbacks[t])){if(!e)for(e=[this],i=0;i=0?t.positive:t.negative,u=a[i]||0,c=u+o;return a[i]=c,{nextStack:c,prevStack:u}}},o=i({positive:{},negative:{}}),a=i({positive:{},negative:{}}),u=function(e){return Qt(e,t.id)},c=Number.MAX_VALUE,s=Number.MIN_VALUE,l=function(t){return c=ts?t:s,r.value(t)},f=u(function(t){return l(o(t).nextStack)}),d=u(function(t){return l(a(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=Vt(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxc)&&(e.min=c),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a=t.data(),u=function(t,e){return t-e},c=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,s=a.map(function(e){return t.xi(e)}).sort(u),l=s[0],f=s.slice(1).map(function(t){var e=t-l;return l=t,e}).filter(function(t){return t>0}).sort(u).concat(Number.MAX_VALUE)[0],d=Math.min(f,c),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(o,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:o};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=a.minSize,e.maxSize=a.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a=function(t,e){return t-e},u=t.data().map(function(e){return t.xi(e)}).sort(a),c=u[0],s=u.slice(1).map(function(t){var e=t-c;return c=t,e}).filter(function(t){return t>0}).sort(a).concat(Number.MAX_VALUE)[0],l=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,f=Math.min(s,l),d="number"==typeof n?n:i,h="number"==typeof r?r:o,p={minSize:d,maxSize:Math.max(d,Math.min(h,function(t){var e=(d+h)/2,n=h,r=d;return Math.round(e+(n-e)/(1+Math.exp(-(t-r)/.5)))}(f)))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,o=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},a=o(t.scaleX,"x"),u=o(t.scaleY,"y");if(a&&u)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var c=t.data().reduce(function(e,i){var o,c,s=t.size(i),l=(s>=n?s:n+s*(r-n))/2;return a||(o=t.xi(i),e.left=Math.min(e.left,o-l),e.right=Math.max(e.right,o+l)),u||(c=t.yi(i),e.top=Math.min(e.top,c-l),e.bottom=Math.max(e.bottom,c+l)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),s=function(e,n,r,i){var o=e.domain(),a=Math.abs(e.value(o[1])-e.value(o[0])),u=(o[1]-o[0])/a;if(0===a)return 1;var c=Math.max(0,-n),s=Math.max(0,r-a),l=t.flip?s:c,f=t.flip?c:s,d=Number(o[0])-(i?f:l)*u,h=Number(o[1])+(i?l:f)*u;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),o=i[0],a=i[1];(o>n||a=0?1:-1},d=function(e,n,r){var i=Vt(n,function(t){return t[u]}),o=n[0];return e.reduce(function(e,n){return e.concat(i[n]||function(e,n,r){var i,o=[e,t.id(n),r].join(" ");return(i={})[u]=e,i[c]=1e-10*r,i[l]=n[l],i[s]=n[s],i[O]=!0,i[O+"id"]=o,i}(n,o,r))},[])},h=function(t,e){return t-e},p=function(){return Yt(a.reduce(function(t,e){return t.concat(e.map(function(t){return t[u]}))},[])).sort(h)},g=r?function(){var e=p(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),o=t.scaleX.domain(),a=b.generate(o[0],o[1],r,{utc:i}).filter(function(t){return t>=o[0]&&t<=o[1]}),u=0,c=[],s=b.get(r,{utc:i});return a.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=u;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,E(1/3,i,r),E(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var o=t.filter(function(t,e){return e%3==0}),a=e.filter(function(t,e){return e%3==0}),u=o.map(function(t){return t.id}),c=a.map(function(t){return t.id}),s=u.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),l=c.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=u.filter(function(t){return c.indexOf(t)>=0}),d=o.filter(function(t){return!t.positionIsBeingChanged}),h=a.filter(function(t){return!t.positionIsBeingChanged}),p=W(d,h),g=W(h,d),m=[];f.forEach(function(n,r){var i=s[n],o=l[n];if(0===r&&(i>0||o>0)&&m.push(N({polylineFrom:t.slice(0,i+1),polylineTo:e.slice(0,o+1),toOppositeScale:0===o?p:g,isCubic:!0})),r>0){var a=s[f[r-1]],u=l[f[r-1]];i-a>3||o-u>3?m.push(L({polylineFrom:t.slice(a,i+1),polylineTo:e.slice(u,o+1),isCubic:!0})):m.push(function(t){var e=t.polylineFrom,n=t.polylineTo;return function(t){return D(e.slice(1,3),n.slice(1,3),t)}}({polylineFrom:t.slice(a,i+1),polylineTo:e.slice(u,o+1)}))}m.push(j({pointFrom:t[i],pointTo:e[o]})),r===f.length-1&&(t.length-i-1>0||e.length-o-1>0)&&m.push(N({polylineFrom:t.slice(i),polylineTo:e.slice(o),toOppositeScale:e.length-o==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(P({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);F(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),o=t.filter(function(t){return!t.positionIsBeingChanged}),a=e.filter(function(t){return!t.positionIsBeingChanged}),u=W(o,a),c=W(a,o),s=[];i.forEach(function(o,a){var l=n.indexOf(o),f=r.indexOf(o);if(0===a&&(l>0||f>0)&&s.push(N({isCubic:!1,polylineFrom:t.slice(0,l+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?u:c})),a>0){var d=n.indexOf(i[a-1]),h=r.indexOf(i[a-1]);(l-d>1||f-h>1)&&s.push(L({isCubic:!1,polylineFrom:t.slice(d,l+1),polylineTo:e.slice(h,f+1)}))}s.push(j({pointFrom:t[l],pointTo:e[f]})),a===i.length-1&&(t.length-l-1>0||e.length-f-1>0)&&s.push(N({isCubic:!1,polylineFrom:t.slice(l),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?u:c}))}),0===s.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&s.push(P({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return s.forEach(function(n){var r=n(t);F(e,r)}),e}})(t,e)),r(i))}}function N(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,o=e.length>n.length?e:n,a=1===n.length,u=e[0].id!==n[0].id,c=Boolean(u!==a);return function(t){var e=(r?B:I)({t:t,polyline:o,decreasing:a,rightToLeft:c});a===c?e.shift():e.pop();var n=D(e.map(i),e,a?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function L(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,o=n.length;if(o!==i){var a=o2){var i=function(t,e){for(var n,r,i=[e[0]],o=0;o0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function F(t,e){return Array.prototype.push.apply(t,e)}function z(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function R(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=z(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function D(t,e,n){return t.map(function(t,r){return R(t,e[r],n)})}function I(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,o=Boolean(r)!==Boolean(i),a=function(t,e){var n=0;if(t>0){for(var r,i,o,a,u=[0],c=0,s=1;s0){for(var i,o,a,u,c,s,l,f,d=[0],h=0,p=1;p0;o--)if((e=a[o][t])!==r)return n=u[o][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function H(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function U(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=T(t,n,r,i,o);return[a[1],a[2],a[4],a[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(o).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(a[3][e]=z(n[e],o[e],t))}),a}function G(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:q(t[0].x,t[1].x,1/3),y:q(t[0].y,t[1].y,1/3)},{x:q(t[0].x,t[1].x,2/3),y:q(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,o,a,u,c,s,l,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=E(1/3,t[v-1],t[v]),m[3*v-1]=E(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:q(m[0].x,m[3].x,1/3),y:q(m[0].y,q(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:q(m[y].x,m[y-3].x,1/3),y:q(m[y].y,q(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==c>i.y&&(p=q(p*(g=(i.y-r.y)/(c-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==a0?[t,e].join(" "):e,c=n(i.text(u));if(cu;if(l&&i){var f=Math.floor(u/s*c.length);t[t.length-1]=c.substr(0,f-4)+"...",p=!0}return l&&!i&&t.push(e),l||(t[t.length-1]=c),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return a(c,t,1.1,l,f,d,e)}),h.remove()})};var et=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=nt),t.onTransitionEnd=function(t){return ot(this,t),this},t},nt=function(t,e){var n,r,i=this,o=K.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var a="__transitionAttrs__",u="__lastTransitions__",c=it();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[a]=Object.assign(this[a]||{},e),this[a][u]||Object.defineProperty(this[a],u,{value:{}}),Object.keys(e).forEach(function(e){return t[a][u][e]=c})});var s=function(){var t=this;this[a]&&(Object.keys(r).filter(function(e){return t[a][u][e]===c}).forEach(function(e){return delete t[a][e]}),0===Object.keys(this[a]).length&&delete this[a])};return this.on("interrupt."+c,function(){return i.each(s)}),this.on("end."+c,function(){return i.each(s)}),o},rt=0,it=function(){return++rt},ot=function(t,e){if(K.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},at=function(t,e,n,r){var i=r||function(t){return t},o=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(st(Kt(e,n)))),i=(i=et(i,t)).call(st(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(o)}):i.each(o),i}},ut=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},ct=function(t,e,n,r,i){void 0===i&&(i="linear");var o="__pathPoints__";return function(t){var a=this;this[o]||(this[o]=n.map(function(){return[]}));var u=n.map(function(e,n){var u=Yt(t,r).map(e),c=(V(i)||V("linear"))(u),s=a[o][n];return{pointsFrom:s,pointsTo:c,interpolate:C(s,c,$(i))}});return function(t){if(0===t){var n=u.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=u.map(function(t){return t.pointsTo});return a[o]=r,e.apply(void 0,r)}var i=u.map(function(e){return e.interpolate(t)});return a[o]=i,e.apply(void 0,i)}}},st=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},lt=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dt=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Kt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,o=[e.flip&&M.get("flip"),r&&M.get("stack"),i&&M.get("positioningByColor")];return n.decorators=(n.config.transformRules||o).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return ft(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),o=this.getScale("size"),a=this.getScale("label"),u=this.getScale("color"),c=this.getScale("split"),s=this.getScale("identity"),l=i.domain(),f=i.discrete?l[0]:Math.max(0,Math.min.apply(Math,l)),d=i.value(f)+.5*i.stepSize(f),h=u.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:o,scaleLabel:a,scaleColor:u,scaleSplit:c,scaleIdentity:s,color:function(t){return u.value(t[u.dim])},label:function(t){return a.value(t[a.dim])},group:function(t){return t[u.dim]+"(@taucharts@)"+t[c.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return o.value(t[o.dim])},id:function(t){return s.value(t[s.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=Vt(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return function(t,e){var n=Math.pow(10,e);return Math.round(n*t)/n}(t.screenModel.size(e)/2,4)},r=at,i=function(e,n,i){var o=t.config.guide.animationSpeed,u=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);u.exit().call(r(o,null,{width:0},function(t){return a.select(t).remove()})),u.call(r(o,null,i)),u.enter().append("rect").style("stroke-width",0).call(r(o,{width:0},i))},o=this.config.flip,u=o?"y":"x",c=o?"x":"y",s=o?"x0":"y0",l=o?"height":"width",f=o?"width":"height",d=function(e){var r,o,a;i(e,"lvl-top",((r={})[l]=function(t){return n(t)},r[f]=1,r[u]=function(e){return t.screenModel[u](e)-n(e)/2},r[c]=function(e){return t.screenModel[c](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((o={})[l]=function(t){return n(t)},o[f]=1,o[u]=function(e){return t.screenModel[u](e)-n(e)/2},o[c]=function(e){return t.screenModel[s](e)},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-btm "+t.screenModel.class(e)},o)),i(e,"lvl-link",((a={})[l]=.5,a[f]=function(e){return Math.abs(t.screenModel[c](e)-t.screenModel[s](e))},a[u]=function(e){return t.screenModel[u](e)-.25},a[c]=function(e){return Math.min(t.screenModel[c](e),t.screenModel[s](e))},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-link "+t.screenModel.class(e)},a))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=Vt(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(g),ht=function(){return(ht=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?function(t){return"object"==typeof t?JSON.parse(JSON.stringify(t)):t}(t.constructor.prototype):{}},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},wt={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},_t=/\\|'|\r|\n|\u2028|\u2029/g,St="(?:"+Object.keys(xt).join("|")+")",Mt=RegExp(St),Ot=RegExp(St,"g"),At={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function kt(t){return yt(t)}function Et(t){return t instanceof Date&&!isNaN(Number(t))}function Tt(t){return null!=t&&"object"==typeof t}function Ct(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],o=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),a=10/i*o,u=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],c=-1;a>u[++c][0];);o*=u[c][1],r[0]=Math.floor(r[0]/o)*o,r[1]=Math.ceil(r[1]/o)*o;var s=e-r[0],l=r[1]-n,f=o/2;if(e<0){var d=s>=f?-s:0;r[0]=r[0]-d}if(n>0){var h=l>=f?-l:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Nt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=pt.extent(t),o=i[0],a=i[1],u=+a-+o,c=r?pt.scaleUtc:pt.scaleTime;if(0===u){return o=new Date(o.getTime()-864e5),a=new Date(a.getTime()+864e5),c().domain([o,a]).nice(e).domain()}var s=c().domain([o,a]).nice(e);if(e)return s.domain();var l=c().domain([o,a]).nice(e).domain(),f=l[0],d=l[1],h=s.ticks(),p=h.length-1;return(+o-+f)/(+h[1]-+f)<.5&&(o=f),(+d-+a)/(+d-+h[p-1])<.5&&(a=d),[o,a]}var Lt=0,jt={};function Pt(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return jt.hasOwnProperty(e)||(jt[e]="H"+ ++Lt),jt[e]}function Ft(t,e,n){var r=0,i=null,o=Qt(function(t,e){return Yt(t.map(function(t){return e.reduce(function(e,n){return e.concat(function(t){return Et(t)?t.getTime():t}(t[n]))},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,a){var u=a.length,c=n.getSpec(),s=c.sources["/"].data,l=c.unit.units[0].guide||{};l.padding=l.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=l.padding.l+l.padding.r:"y"===t&&(f=l.padding.t+l.padding.b);var d=(i-u*f)/function(t){var e=o(s,t);return Object.keys(e).reduce(function(t,n){return t+e[n]},0)}(e);return(function(t,e){return o(s,t)[e]}(e,r)*d+f)/i}}function zt(t){var e=!0;try{mt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function Rt(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],o=0;o=r&&n.apply(this,i),t.e=a.e,t.ts=a.ts}}function Dt(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),o=e>=2?Ut(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(o,[r])}function It(t){return vt(t)?t:""}function Bt(t){return vt(t)?"":t}function Wt(t){return t/180*Math.PI}function Ht(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Ut(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function qt(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function Xt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return Xt(t)})):t}function Yt(t,e){for(var n={},r=[],i=t.length,o=e||function(t){return String(t)},a=0;a/g,">").replace(/"/g,""").replace(/'/g,"'")}var oe=" ",ae=32,ue=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function ce(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=Xt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],o=ue[t];if(o&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var a="<"+t,u=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");u.length>ae&&(u=Object.keys(n).map(function(t){return"\n"+oe+t+'="'+n[t]+'"'}).join(""));var c=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+oe+t}).join("\n")}).join("\n")+"\n";return""+a+u+(o?"/>":">"+c+"")}function se(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var le=[dt];function fe(t){return le.some(function(e){return t instanceof e})}function de(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var he=document.createElement("div"),pe=new WeakMap;function ge(t,e){var n;return t instanceof Node?n=t:(he.insertAdjacentHTML("afterbegin",t),n=he.childNodes[0]),e.appendChild(n),n}function me(t){if(pe.has(t))return pe.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,pe.set(t,n),n}function ye(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=me(t),o=r?i.width+"px":"0",a=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+o+" "+a+" 0";var u=t.scrollWidth>t.clientWidth,c=t.scrollHeight>t.clientHeight,s=r&&!c?i.width+"px":"0",l=n&&!u?i.height+"px":"0";return t.style.padding="0 "+s+" "+l+" 0",t.style.overflow="",t.style.overflowX=u?"scroll":"hidden",t.style.overflowY=c?"scroll":"hidden",i}function ve(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function be(t,e){return parseInt(ve(t,e)||"0",10)}function xe(t){var e=be(t,"padding-left"),n=be(t,"padding-right"),r=be(t,"padding-bottom"),i=be(t,"padding-top"),o=be(t,"border-top-width")+be(t,"border-left-width")+be(t,"border-right-width")+be(t,"border-bottom-width"),a=t.getBoundingClientRect();return{width:a.width-e-n-2*o,height:a.height-r-i-2*o}}function we(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var o=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*o,document.body.removeChild(e),r}function _e(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o="string"==typeof n?n:n+"px",a=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Se(t.charAt(e),{fontSize:o,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],u=t.length,c=parseInt(o);return{width:a,height:c*u+.39*c*u}}var Se=Qt(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=document.createElement("div");o.style.position="absolute",o.style.visibility="hidden",o.style.border="0px",o.style.top="0",o.style.fontSize=n,o.style.fontFamily=r,o.style.fontWeight=i,document.body.appendChild(o),o.innerHTML=" "===t?" ":t;var a={width:0,height:0},u=o.getBoundingClientRect();return a.width=u.right-u.left,a.height=u.bottom-u.top,document.body.removeChild(o),a},function(t,e){return t+"_"+JSON.stringify(e)});function Me(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,o=t instanceof Element,u=o?a.select(t):t,c=function(t){return o?t.node():t},s=u.selectAll(e).filter(function(){return this.parentNode===u.node()}).filter(function(t,e){return 0===e});if(!s.empty())return c(s);for(var l,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(l=e.substring(f+1,h),f<0?i=u.append(l):n[d].call(null,l,i),d=e[h],f=h);return c(i)}function Oe(t,e){return Ae(t,e)[0]||null}function Ae(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function ke(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),o=i.slice().sort(e),a=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),u=o.reduce(function(t,e,i){var u=a.get(e),c=i-u;return c!==r&&(n&&t.push(n),r=c,n={from:u,to:i,elements:[]}),n.elements.push(e),i===o.length-1&&t.push(n),t},[]),c=u.slice().sort(function(t,e){return t.from-e.from}),s=c.reduce(function(t,e,n){return t.set(e,n),t},new Map),l=function(t){for(var e,n,r,i=u.map(function(t,e){return{elements:t.elements,from:s.get(t),to:e}}).sort(te(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),o=0;on.to)for(e=o+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=l(!0),d=l(!1),h=f.length=0?"h":"v"}function je(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Pe(t,e,n,r,i,o,a,u){var c,s,l,f,d,h;return h=((l=a-i)*(e-o)-(f=u-o)*(t-i))/(-l*(s=r-e)+(c=n-t)*f),(d=(-s*(t-i)+c*(e-o))/(-l*s+c*f))>=0&&d<=1&&h>=0&&h<=1}function Fe(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=je(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function ze(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=a.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),o=i[i.length-1];if(o){var u=Array.prototype.indexOf.call(o.parentNode.childNodes,o),c=o.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>u||this.parentNode.insertBefore(this,c)})}}}var Re=function(t){return Et(t)?t.getTime():t},De={cross:function(t,e,n){var r=t(),i=Yt(r.map(function(t){return t[e]}),Re),o=Yt(r.map(function(t){return t[n]}),Re),a=0===i.length?[null]:i;return(0===o.length?[null]:o).reduce(function(t,r){return t.concat(a.map(function(t){var i={};return e&&(i[e]=Re(t)),n&&(i[n]=Re(r)),i}))},[])},cross_period:function(t,e,n,r,i,o){var a=t(),u=!!o&&o.utcTime,c=Yt(a.map(function(t){return t[e]}),Re),s=Yt(a.map(function(t){return t[n]}),Re),l=0===c.length?[null]:c,f=0===s.length?[null]:s;return r&&(l=b.generate(Math.min.apply(Math,c),Math.max.apply(Math,c),r,{utc:u})),i&&(f=b.generate(Math.min.apply(Math,s),Math.max.apply(Math,s),i,{utc:u})),f.reduce(function(t,r){return t.concat(l.map(function(t){var i={};return e&&(i[e]=Re(t)),n&&(i[n]=Re(r)),i}))},[])},groupBy:function(t,e){return Yt(t().map(function(t){return t[e]}),Re).map(function(t){var n;return(n={})[e]=Re(t),n})},none:function(){return[null]}},Ie=function(){function t(t,e,n){var r=t.key,i=t.pipe,o=t.source,a=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=o,this.units=a,this._frame={key:r,source:o,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Pt([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),Be=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),We=function(t){return Et(t)?t.getTime():t},He=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},Ue=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return function(t,e){return void 0===e&&(e={}),Object.assign(new He(t),e)}(t,e(t,{}))},e)},Ge=function(t){function e(e,n,r,i){var o=t.call(this)||this;return Kt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},o.config=e,o.sources=e.sources,o.scales=e.scales,o.unitSet=r,o.grammarRules=i,o.scalesHub=n,o.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return We(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),o}return Be(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var o=[],a=function(t,e,n,r,i){o.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return a(i,e,n,t,r)})}),o.push(function(){return n(t,r,i)})};return a(t.unit,e,n,r,i),o},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),c=new He(u.defineGrammarModel(a)),s=Ue(u.getGrammarRules(),c,n);return Ue(u.getAdjustScalesRules(),s,n),u.node().screenModel=u.createScreenModel(s),u}),i=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),c=new He(u.defineGrammarModel(a)),s=Ue(u.getGrammarRules(),c,n);return u.node().screenModel=u.createScreenModel(s),u.parentUnit=t,u.addInteraction(),u});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],o=[t],a=e.traverseSpec({unit:this.root},function(t,e,a){t.uid=function(){var n=Pt((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(a.pipe));return r.hasOwnProperty(n)?n+="-"+ ++r[n]:r[n]=0,n}(),t.guide=kt(t.guide);var u=n(o[0],t,a);i.push(u),0===t.type.indexOf("COORDS.")&&function(t){o.unshift(t)}(u)},function(t){0===t.type.indexOf("COORDS.")&&o.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return a.push(function(){return i}),a},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var o=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:o,source:i.source,units:t.units?t.units.map(function(t){var e=kt(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var o=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[o],t).create("function"==typeof i?i(e.scales[o]):i)}},e.prototype._datify=function(t){return new Ie(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",o=t.source,a=!1!==t.inherit,u=t.params,c={source:o,pipe:a?e:[]},s=De[i];if(!s)throw new Error(i+" operator is not supported");return{source:o,inherit:a,func:s,args:u,exec:function(){return s.apply(void 0,[function(){return r._datify(c).part()}].concat(u||[],[n]))}}},e}(d),qe="tau-chart__",Xe=n(10),Ye=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Xe.Tooltip.defaults.baseClass=qe+"tooltip";var Ve=["top","bottom"];var $e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ye(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e=function(t,e){return{top:e.top+t,right:e.right-t,bottom:e.bottom-t,left:e.left+t,width:e.width-2*t,height:e.height-2*t}}(0|this.options.winBound,function(){var t=window,e=document.documentElement,n=(t.pageYOffset||e.scrollTop)-e.clientTop,r=(t.pageXOffset||e.scrollLeft)-e.clientTop,i=t.innerWidth||e.clientWidth,o=t.innerHeight||e.clientHeight;return{top:n,right:r+i,bottom:n+o,left:r,width:i,height:o}}()),n=this.options.place.split("-"),r=this.spacing;if(-1!==Ve.indexOf(n[0]))switch(t.top-this.height-r<=e.top?n[0]="bottom":t.bottom+this.height+r>=e.bottom&&(n[0]="top"),n[1]){case"left":t.right-this.width<=e.left&&(n[1]="right");break;case"right":t.left+this.width>=e.right&&(n[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?n[1]="left":t.right-t.width/2-this.width/2<=e.left&&(n[1]="right")}else switch(t.left-this.width-r<=e.left?n[0]="right":t.right+this.width+r>=e.right&&(n[0]="left"),n[1]){case"top":t.bottom-this.height<=e.top&&(n[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(n[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?n[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(n[1]="bottom")}return n.join("-")},e}(Xe.Tooltip),Je=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),Ke={},Ze={},Qe={reg:function(t,e,n){return n?(Ze[t]=n,Ke[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},Ke[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):Ke[t]=e,this},get:function(t){if(!Ke.hasOwnProperty(t))throw new w("Unknown unit type: "+t,_.UNKNOWN_UNIT_TYPE);return Ke[t]},create:function(t,e){var n,r=this.get(t);Ze[t]?n=new r(e,this.get(Ze[t])):n=new r(e);return n}},tn={},en={},nn={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),tn[t]=e,en[t]=n,nn},get:function(t){return tn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(nn.get(e))(n,(0,en[e])(r,t))}}}},rn=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,o=this.sources[r].data,a=e||new Ie({source:r},o);return t.dimType=i,this.registry.create(t.type,a,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),on=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var o=function(t,e){var n=r[e],i=Tt(n)?JSON.stringify(n):n;return t.push(i),t},a=e.reduce(o,[]).join("/"),u=n.reduce(o,[]).join("/");if(t.hasOwnProperty(a)){var c=t[a];if(c!==u)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:a,errY:[c,u]},new Error("RelationIsNotAFunction")}else t[a]=u;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},an=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},un=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],o=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:o,scale:i.scale||e[o],value:i.value})}),n},cn=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var o=function(t,e){var n=e;return Et(t)?(n.type="measure",n.scale="time"):Tt(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,kt(e)),a=o.type,u=o.scale,c=null!==t[r].type&&t[r].type!==a;t[r].type=c?e.type:a,t[r].scale=c?e.scale:u}}),t},{})},sn=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},o=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(te(function(t,n){return i(t[e])-i(n[e])},function(t,e){return o.get(t)-o.get(e)}));else if(n.order){var a=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),u=n.order.length,c="(___"+e+"___)";r=t.map(function(t){var n=a[t[e]];return n=n>=0?n:u,t[c]=n,t}).sort(te(function(t,e){return t[c]-e[c]},function(t,e){return o.get(t)-o.get(e)})).map(function(t){return delete t[c],t})}return r},ln=function(t,e){var n=document.createElement("div");return n.classList.add(qe+t),e&&e.appendChild(n),n},fn=function(){var t=ln("layout"),e=ln("layout__header",t),n=ln("layout__container",t),r=ln("layout__sidebar",n),i=ln("layout__content",n),o=ln("layout__content__wrap",i),a=ln("layout__sidebar-right",n);return{layout:t,header:e,content:o,contentContainer:i,leftSidebar:r,rightSidebar:ln("layout__sidebar-right__wrap",a),rightSidebarContainer:a,footer:ln("layout__footer",t)}},dn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Kt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Kt(t,{x:n.x,y:n.y});var r=kt(n.guide)||{};t.guide.x=Kt(t.guide.x||{},r.x),t.guide.y=Kt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return Tt(n)&&!Et(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=kt(Zt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(o){t.hasOwnProperty(o)&&(e[o]=r.scalesPool(o,t[o],i[o]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var o=this.spec.spec.dimensions,a={};if("color"===t&&null!==e&&(a={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(a.brewer=n.brewer),o[e]&&o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("nice")&&(a.nice=n.nice)),"size"===t&&null!==e&&(a={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(a.func=n.func),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("minSize")&&(a.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(a.maxSize=n.maxSize)),"label"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(a={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),o.hasOwnProperty(e)&&("x"===t||"y"===t)){if(a={type:o[e].scale,source:"/",dim:this.ruleInferDim(e,n)},o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("autoScale")?a.autoScale=n.autoScale:a.autoScale=!0,n.hasOwnProperty("nice")?a.nice=n.nice:a.nice=a.autoScale,n.hasOwnProperty("niceInterval")?a.niceInterval=n.niceInterval:a.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(a.period=n.tickPeriod,a.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){a.period=n.timeInterval,a.type="time";var u=b.get(a.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(a.min=u.cast(new Date(n.min))),n.hasOwnProperty("max")&&(a.max=u.cast(new Date(n.max)))}a.fitToFrameByDims=n.fitToFrameByDims,a.ratio=n.ratio}return this.dist.scales[i]=a,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},o=this.getScaleConfig("x",t.x),a=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=o.period||a.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),o.period,a.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),hn=n(6),pn=n(7),gn=function(){return(gn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(o))},Tn=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),o=[n,r].join(":");return e[i]||e[o]||e[n]||null},Cn=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Nn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Ln=function(t,e){var n=t.width,r=t.height,i=Math.abs(Wt(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},jn=function(t,e){void 0===e&&(e="x");var n=Ht(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]];return r[r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=Pn(l,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=Pn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),o&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=Pn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=c?0:1,g=s?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Ln(d,t.x.rotate),w=Ln(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=Sn([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=Sn([g*(e.yTickWidth+w.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),o&&(y.padding=0,y.paddingNoTicks=0);var _=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:Sn([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:Sn([t.y.padding,o?0:g*(e.yTickWidth+w.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:Sn([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:Sn([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*Cn(e,"xDensityPadding",n.dimType),tickFontHeight:l.height,$minimalDomain:a.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:w.height+2*Cn(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:u.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var zn=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,o=t.allowYVertical,a=t.inlineLabels,u=n.dimension(e.x),c=n.dimension(e.y),s=n.scaleMeta(e.x,e.guide.x),l=n.scaleMeta(e.y,e.guide.y),f=s.isEmpty,d=l.isEmpty;e.guide.x.tickFormat=Nn(e.guide.x.tickFormat||Tn(u,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Nn(e.guide.y.tickFormat||Tn(c,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===u.dimType),p=!!o&&!("measure"===c.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=jn(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=jn(e.guide.y.rotate,"y"),e.guide=Fn(e.guide,r,s,l,a,de(e)),a){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},Rn={NONE:function(t,e,n){var r=kt(t);return Dn(kt(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=kt(t),r=[],i=[],o=null,a=null;gt(n.unit,"units",kn,function(t,n){if(t.isLeaf)return n;!o&&n.x&&(o=n),!a&&n.y&&(a=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=Tt(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=Tt(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var u=n.guide.x.label.text;u&&(r.push(u),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+u,n.guide.x.label.text="",n.guide.x.label._original_text=u);var c=n.guide.y.label.text;return c&&(i.push(c),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+c,n.guide.y.label.text="",n.guide.y.label._original_text=c),n});return o&&(o.guide.x.label.text=o.guide.x.label.hide?"":r.join(" → ")),a&&(a.guide.y.label.text=a.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=kt(t);return Dn(kt(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,o=e.scaleMeta(r.x,r.guide.x),a=e.scaleMeta(r.y,r.guide.y),u=!i&&Boolean(o.dimType)&&"measure"!==o.dimType;return r.guide.x.rotate=r.guide.x.rotate||(u?-90:0),r.guide.x.textAnchor=jn(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||Tn(o,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||Tn(a,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Fn(r.guide,Kt({distToXAxisLabel:o.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:a.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),o,a,null,de(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=kt(t);return Dn(kt(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?zn({unit:r,meta:e,settings:Kt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,zn({unit:r,meta:e,settings:Kt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return Rn[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return Rn[r](t,e,n)},t)}},Dn=function(t,e,n){var r=function(t){return t.options=t.options||{},t.guide=t.guide||{},t.guide.padding=Kt(t.guide.padding||{},{l:0,b:0,r:0,t:0}),t.guide.x=On(t.guide,"x"),t.guide.x=An(t.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),t.guide.y=On(t.guide,"y",{rotate:-90}),t.guide.y=An(t.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),t.guide.size=On(t.guide,"size"),t.guide.color=On(t.guide,"color"),t}(e);r=n(kn(r),r);var i=Zt(r=Mn(r,t),"units");return(r.units||[]).forEach(function(t){return Dn(kt(t),function(t,e){return t.guide=t.guide||{},t.guide.padding=t.guide.padding||{l:0,t:0,r:0,b:0},t.hasOwnProperty("units")||((t=Kt(t,e)).guide=Kt(t.guide,kt(e.guide)),t.guide.x=Kt(t.guide.x,kt(e.guide.x)),t.guide.y=Kt(t.guide.y,kt(e.guide.y))),t}(t,i),n)}),r},In=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],o=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:o.type,scaleType:i.type,values:e,isEmpty:null==o.type}}},o=(Rn[t]||Rn.NONE)({unit:kt(n.unit)},i,e);return n.unit=o.unit,n},Bn=function(){function t(t){this.spec=t,this.isApplicable=zt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return In(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Wn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){de(t)&&"y"===n||(i[n].hideTicks=!0);var o=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=o?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(de(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),Hn=function(t){return t.$maxTickTextW},Un=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},Gn=function(t){return t.density},qn=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),o=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==o&&n.push(o),t.units.forEach(r)}};r(t.unit);var i={},o={},a=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(o.hasOwnProperty(r)||(o[r]=[]),o[r].indexOf(t.key[r])<0&&o[r].push(t.key[r]))}),t.units&&t.units.forEach(a))})};return a(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(o).reduce(function(t,e){return t*o[e].length},1)}},Xn={"entire-view":function(t,e,n,r){var i=n.unit.guide,o=qn(n),a=o.xFacetCount,u=o.yFacetCount;u>0&&Wn.facetsLabelsAtTop(n.unit,n.settings);var c=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,s=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,l=i.paddingNoTicks&&t.height-st.height||a*n.settings.minFacetWidth+c>t.width,f=i.paddingNoTicks&&t.width-ct.height||a*n.settings.minFacetWidth+c>t.width;l&&Wn.hideAxisTicks(n.unit,n.settings,"x"),f&&Wn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,Hn)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Un);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,Gn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,Gn));return!l&&d>t.width&&Wn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Wn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,Gn),newH:e("y",n.unit,Gn)}},normal:function(t,e,n,r){qn(n).yFacetCount>0&&Wn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var u=Math.max(t.width,e("x",n.unit,Gn));o=Math.min(a,u)}}return{newW:o,newH:Math.max(t.height,e("y",n.unit,Gn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,o=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-ot.width)&&Wn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,Hn)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,Gn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Wn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,Gn),newH:t.height}}},Yn=function(){function t(t){this.spec=t,this.isApplicable=zt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},o=function(e,n,a,u){void 0===u&&(u=null);var c="x"===e?n.x:n.y,s="x"===e?n.y:n.x,l=n.guide,f=a("x"===e?l.x:l.y),d=n.units[0],h="x"===e?l.padding.l+l.padding.r:l.padding.b+l.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,u).isEmpty()){var p,g=2*(l.label&&l.label.fontSize?l.label.fontSize:10),m=t.getScaleInfo(c,u);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,u);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=Yt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),o=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,o)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var w=t.getScaleInfo(c,u);return h+i(w,f)}var _=function(t,e){return t.reduce(function(t,n){var r=(n.key||{})[e];return t[r]=t[r]||[],t[r].push(n),t},{})}(n.frames,r[s].dim),S=Object.keys(_).map(function(t){return _[t].map(function(t){return o(e,t.units[0],a,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,S)},a=e.settings.size,u=a.width,c=a.height,s=Xn[n];if(s){var l=s(a,o,e,Wn.optimizeXAxisLabel);u=l.newW,c=l.newH}return e.settings.size=function(n,r,i){var o=e.settings.getScrollbarSize(t.getLayout().contentContainer),a=r.width>n.width&&r.width<=n.width*i?n.width:r.width,u=r.height>n.height&&r.height<=n.height*i?n.height:r.height,c=n.width-a,s=n.height-u>=0?0:o.width;return{height:u-(c>=0?0:o.height),width:a-s}}(a,{width:u,height:c},e.settings.avoidScrollAtRatio),e},t}(),Vn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&zt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],o=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),o.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var a=function(e){return t.scales[e]},u=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},c=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},s=i.map(a).filter(u),l=o.map(a).filter(u);if([s.length,l.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(c).length&&(n.forEach(d),n[0].ratio=Ft(t,n.map(f),e))};h("x",s),h("y",l)}},t}(),$n=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&zt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},o=[],a=[];mt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var u=t.guide,c=u.padding||{l:0,r:0,t:0,b:0},s=u.paddingNoTicks||{l:0,b:0};return r.l+=c.l,r.r+=c.r,r.t+=c.t,r.b+=c.b,i.l+=s.l,i.b+=s.b,o.push(Object.assign({},r)),a.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=o.pop(),u=a.pop(),c=t.guide||{};c.x=c.x||{},c.x.padding=c.x.padding||0,c.x.paddingNoTicks=c.x.paddingNoTicks||0,c.y=c.y||{},c.y.padding=c.y.padding||0,c.y.paddingNoTicks=c.y.paddingNoTicks||0,c.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},c.paddingNoTicks={l:0,b:0},c.autoLayout="extract-axes",c.x.padding+=r.b-e.b,c.y.padding+=r.l-e.l,c.x.paddingNoTicks+=i.b-u.b,c.y.paddingNoTicks+=i.l-u.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Jn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,o=void 0===i?Number.MAX_SAFE_INTEGER:i,a=e.syncInterval,u=void 0===a?Number.MAX_SAFE_INTEGER:a,c=e.callbacks,s=void 0===c?{}:c,l=this;this.setTimeoutDuration(o),this.setSyncInterval(u),this.setCallbacks(s),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(l._running&&l._requestedFrameId){var t=l._getCancelFrameFunction(),e=l._getRequestFrameFunction();t(l._requestedFrameId),l._requestedFrameId=e(l._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,o=0,a=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=o>a)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,o+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t.runnersInProgress=0,t}(),Kn=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zn=function(){return(Zn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var l=s.findIndex(function(t){return t.closest.distance!==s[0].closest.distance||t.closest.secondaryDistance!==s[0].closest.secondaryDistance}),f=l<0?s:s.slice(0,l);if(1===f.length)o=f[0].closest.data,a=f[0].closest.node,u=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;o=m.data,a=m.node,u=f[g].unit}}c.forEach(function(e){return e.unit.fire(i,{event:t,data:o,node:a,unit:u})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=Qn.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(a.event)}}:function(e){return function(){var n=a.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new Jn({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=Qn.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=me(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ye(this._layout.rightSidebarContainer,"vertical");var o=Object.assign({},e)||{};if(!o.width||!o.height){var a=r.parentElement,u=a.scrollLeft,c=a.scrollTop;r.style.display="none",o=Kt(o,xe(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=u,r.parentElement.scrollTop=c,o.height||(o.height=xe(this._layout.layout).height)}this.configGPL.settings.size=o},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=kt(Zt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new Ge(t,this.getScaleFactory(),Qe,M),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=Qn.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=Qn.select(this._layout.content),o=n[0].config.uid,a=tr(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));a.attr("class")||a.attr("class",qe+"svg"),this._svg=a.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var u=a.selectAll("g.frame-root").data([o],function(t){return t});u.enter().append("g").classed(qe+"cell cell frame-root uid_"+o,!0).merge(u).call(function(t){t.classed("tau-active",!0),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),u.exit().call(function(t){t.classed("tau-active",!1),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ye(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ye(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=Qn.select(this._layout.header),e=tr(t,"div."+qe+"progress");e.select("div."+qe+"progress__value").remove();var n=e.append("div").classed(qe+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(qe+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(qe+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(qe+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new rn(nn.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=Xt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var o=n[i],a=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:o.dims,data:o.data.filter(a)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,o=Math.round(100/3/1.5),a=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+qe+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+qe+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=er(this._layout.content,"."+qe+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(d),rr={},ir={},or=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(rr).join(", ")+"."),new w(e,_.NOT_SUPPORTED_TYPE_CHART)},ar={validate:function(t,e){return ir.hasOwnProperty(t)||or(t),ir[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=rr[t];return"function"!=typeof e&&or(t),e},add:function(t,e,n){return void 0===n&&(n=[]),rr[t]=e,ir[t]=n,ar},getAllRegisteredTypes:function(){return rr}},ur=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),cr=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return ur(e,t),e.prototype.applyConfig=function(e){var n=ar.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=ar.get(e.type);(e=Kt(e,{autoResize:!0})).settings=nr.setupSettings(e.settings),e.dimensions=nr.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(nr);function sr(t){return t}cr.winAware=[],cr.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=cr.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=l?b.filter(function(t){return 0==t}):[]);var w=null==u?n.tickFormat?n.tickFormat(a):sr:u,_=Math.max(c,0)+s,S=n.range(),M=S[0]+.5,O=S[S.length-1]+.5,A=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:sr)(n);if(r.facetAxis){var k=A;A=function(t){return k(t)-n.stepSize(t)/2}}var E=o.selection?o:null,T=E?E.selection():o,C=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(T).getBoundingClientRect();function N(t){var n=Ht(r.rotate);if(t.attr("transform",Ne(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,o=h?.5:-2,a=e===hr.top||e===hr.left?-1:1,u=o*(e===hr.top||e===hr.bottom?a<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:u+"em").attr("dy",u+"em")}}function L(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?tt(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):Q(t,i)}function j(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,o=[];t.each(function(){var t=K.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),a=t.select("text"),u=a.node().getBBox().width/2,c=n-u,s=n+u;o.push({c:n,s:c,e:s,l:0,textRef:a,tickRef:t})}),function(t,e){t.map(function(t,n,r){return e(r[n-1]||{e:-1/0,s:-1/0,l:0},t,r[n+1]||{e:1/0,s:1/0,l:0})})}(o.sort(function(t,e){return t.c-e.c}),function(t,r,i){var o=t.e>r.s,a=i.s1&&(c=c.replace(/([\.]*$)/gi,"")+"...");var s=11*r.l,l=e?parseFloat(r.textRef.attr("y"))+s:0,f=e?0:s,d=e?s:0,h=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?c:""}).attr("transform","translate("+f+","+d+") rotate("+h+")");var p={x1:0,x2:0,y1:l+(e?-1:5),y2:n};e||(p.transform="rotate(-90)"),Me(r.tickRef,"line.label-ref").call(st(p))}else r.tickRef.selectAll("line.label-ref").remove();return r})}(t,h)}T.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===hr.right?"start":e===hr.left?"end":"middle"),l||function(){var t=r.hideTicks||r.hide?[]:[null];se(T.selectAll(".domain").data(t)).then(function(t){return E&&t.exit().transition(E).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr("d",e===hr.left||e==hr.right?"M"+p*c+","+M+"H0.5V"+O+"H"+p*c:"M"+M+","+p*c+"V0.5H"+O+"V"+p*c)})}();var P=se(T.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,o=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&o})}return t}).result();!function(t){se(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return E?(e.attr("opacity",lr).attr("transform",function(t){var e=A(t);return y(e)}),{tick:r.transition(E),tickExit:n.transition(E).attr("opacity",lr).attr("transform",function(t){var e=A(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(A(t))})})}(P),r.facetAxis||function(t){var e=p*c,r=d?function(t){return v*n.stepSize(t)/2}:null;se(t).then(function(t){var n=t.tick,i=t.tickEnter,o=n.select("line"),a=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&a.attr(g+"1",r).attr(g+"2",r),o.merge(a)}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(P),d&&l&&d&&b&&b.length&&se(T.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr(g+"1",M).attr(g+"2",M).attr(m+"1",0).attr(m+"2",p*c)}),l||(function(i){var o=r.textAnchor,a=p*_,u=e===hr.top?"0em":e===hr.bottom?"0.71em":"0.32em";function c(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}se(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,a).attr("dy",u);return N(i),c(i),r.merge(i)}).then(function(t){if(t.text(w).attr("text-anchor",o),!1===h&&!0===r.facetAxis){var e=je(T.node().parentNode.getAttribute("transform"));L(t,C.width-Math.abs(e.x))}else L(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",o=i.length;o>e&&(e=o,n=r)});var i=A(b[1])-A(b[0]),o=!1;if(n>=0){var a=r[n].getBoundingClientRect();o=i-a.width<8}T.classed(qe+"time-axis-overflow",o)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=T.append("line").attr("x1",A(e)).attr("x2",A(e)).attr("y1",0).attr("y2",1),i=T.append("line").attr("x1",A(n)).attr("x2",A(n)).attr("y1",0).attr("y2",1),o={left:r.node().getBoundingClientRect().left-C.left,right:C.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var a=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",a=(A(n),o[i]),u=Math.ceil(r.width/2-a+1);t.setAttribute("dx",String(u>0?-e*u:0))},u=t.filter(function(t){return t===e}).node(),c=t.filter(function(t){return t===n}).node();t.attr("dx",null),a(u,-1,e),a(c,1,n)}}(t),t}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr(m,a),N(t),c(t),d&&r.avoidCollisions&&!r.facetAxis&&(E?E.on("end.fixTickTextCollision",function(){return j(i.tick)}):j(i.tick))})}(P),i.hide||function(){var t=i,e=Me(T,"text.label").attr("class",Ee("label",t.cssClass)).attr("transform",Ne(t.rotate)).attr("text-anchor",t.textAnchor);se(e).then(function(t){return E?t.transition(E):t}).then(function(e){var n=v*t.padding,r=Math.abs(O-M),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function gr(t){return pr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var mr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yr=Me,vr=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},br=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Kt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Kt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Kt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Kt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Kt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var o=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(o)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var a=n.config.options,u=n.config.guide.padding;return n.L=a.left+u.l,n.T=a.top+u.t,n.W=a.width-(u.l+u.r),n.H=a.height-(u.t+u.b),n}return mr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?et(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Ce(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var o="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,o,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var a="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,a,i)}var u=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),c=this._drawGrid(n.container,e,r,i,n),s=ut(c,".cell").data(u,function(t){return t});s.enter().append("g").attr("class",function(t){return qe+"cell cell uid_"+t}).merge(s).classed("tau-active",!0),et(s,this.config.guide.animationSpeed).attr("opacity",1),et(s.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=_n.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),a=function(t){return pr(t)}({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?vr(r/e.guide.density):null,tickFormat:i||null,position:n}),u=this.config.guide.animationSpeed;yr(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=et(t,u,"axisTransition"),r=t.attr("transform");Ce.apply(o,n)!==r&&(r?e:t).attr("transform",Ce.apply(o,n)),e.call(a),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=ut(t,this._getAxisSelector(e)).classed("tau-active",!1);et(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===Le(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return yr(t,"g.grid").attr("transform",Ce(0,0)).call(function(t){var o=t,a=i.config.guide.animationSpeed,u=(e.guide.showGridLines||"").toLowerCase();if(u.length>0){var c=yr(o,"g.grid-lines");if(u.indexOf("x")>-1){var s=e.x,l=_n.get(s.guide.tickFormat),f=gr({scale:s.scaleObj,scaleGuide:s.guide,tickSize:r,ticksCount:l?vr(n/s.guide.density):null}),d=yr(c,"g.grid-lines-x");et(d,a).call(f)}if(u.indexOf("y")>-1){var h=e.y,p=(l=_n.get(h.guide.tickFormat),gr({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:l?vr(r/h.guide.density):null})),g=yr(c,"g.grid-lines-y");et(g,a).call(p)}}})},e}(g),xr=n(11),wr=n(8),_r=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Sr=function(){return(Sr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var o=n[t].map(r[t].invert);e=[o[0],o[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",u)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=Mr.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",u).on("brush",s).on("end",c),Mr.select(this).classed("brush-"+Pt(t),!0).call(i[t]),o=!1,i[t].move(Mr.select(this),e),o=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],o=[];if(n[r].discrete){var a=i.map(n[r]).filter(function(t){return t>=0}),u=n[r].stepSize()/2;o=[Math.min.apply(Math,a)-u,Math.max.apply(Math,a)+u]}else o=[i[0],i[1]];var c=Pt(r);e[r](Mr.select(".brush-"+c)),e[r].move(Mr.select(".brush-"+c),o.map(n[r]))})},e}(g),Ar=n(12);var kr=n(4),Er=function(){var t,e=[],n=[],r=1,i=1,o={},a=!1,u=function(t){var r=e.length,i=0,o=e[t].x-n[t].x,a=n[t].y-e[t].y,u=Math.sqrt(o*o+a*a);u>0&&(i+=.2*u),a/=u,i+=(o/=u)>0&&a>0?0:o<0&&a>0?3:o<0&&a<0?6:9;for(var c,s,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[s].x=l),e[s].x<0&&(e[s].x=l),e[s].y>i&&(e[s].y=f),e[s].y<0&&(e[s].y=f);var d=(a?t(s,e,n):u(s))-c;Math.random()r&&(e[s].x=l),e[s].x<0&&(e[s].x=l),e[s].y>i&&(e[s].y=f),e[s].y<0&&(e[s].y=f);var y=(a?t(s,e,n):u(s))-c;Math.random()1||s<0||s>1)},f=function(t,e,n){return t-e/n};return o.start=function(t){for(var n=e.length,r=1,i=0;i=200&&n.status<300){var t=n.responseText;try{e(null,JSON.parse(t))}catch(t){e(t,null)}}else e(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){e(t.error,null)},n.open("GET",t,!0),n.send(null)}(n.sourcemap,function(n,r){if(n)throw n;e._drawMap(t,r)}):this._drawMap(t,n.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,o={};return e.forEach(function(e){var a=(kr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},o=n.centroid(t),a=n.bounds(t),u=o[0],c=o[1],s=a[1][0]-a[0][0],l=i.name||"",f=i.abbr||l,d=s<5.5*l.length?f:l,h=s<13.75,p=h?r-u-16.5:0;return{id:e+"-"+t.id,sx:u,sy:c,x:u+p,y:c,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),u=a.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Er().label(a).anchor(u).width(r).height(i).start(10),a.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},o);var c=a.filter(function(t){return t.isRef});c.length<6&&c.reduce(function(t,e){return t[e.id]=e,t},o)}),o},e.prototype._drawMap=function(t,e){var n,r,i=this,o=this,u=this.config.guide,c=this.config.options,s=this.config.options.container,l=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=Lr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,l.dim&&f.dim){var b=Nr.extent(l.domain()),x=Nr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var w=this._createProjection(e,v[0],r),_=Nr.geoPath().projection(w),S=s.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});S.exit().remove();var M=S.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(u.showNames&&(r=o._calcLabels(e,i,_)),i.forEach(function(t,i){var o=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(kr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",_),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=o(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=o(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=o(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=o(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=o(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=o(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var a=kr.feature(e,e.objects.places),c=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),s=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Er().label(c).anchor(s).width(m).height(y).start(100),n.selectAll(".place").data(s).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(c).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(S);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var O=this._resolveFeature.bind(this);if(M.selectAll(".map-contour-"+n).data(kr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=O(t);return null===e?u.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:O(t),event:a.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:O(t),event:a.event})}).on("click",function(t){return i.fire("area-click",{data:O(t),event:a.event})}),!l.dim||!f.dim)return[];var A=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+w([e[f.dim],e[l.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return o.fire("point-mouseover",{data:e,event:a.event})}).on("mouseout",function(t){var e=t.data;return o.fire("point-mouseout",{data:e,event:a.event})}).on("click",function(t){var e=t.data;return o.fire("point-click",{data:e,event:a.event})})},k=M.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return k.exit().remove(),k.enter().append("g").merge(k).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:c.uid}})});e.exit().remove(),e.call(A),e.enter().append("circle").call(A)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var o=r[i[0]].toLowerCase();e=n[o]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,o=this.config.guide,a=100,u=[r/2,i/2],c=n||t.center,s=o.projection||t.projection||"mercator",l=this._createD3Projection(s,c,a,u),f=Nr.geoPath().projection(l).bounds(kr.feature(t,t.objects[e])),d=a*r/(f[1][0]-f[0][0]),h=a*i/(f[1][1]-f[0][1]);return a=d=0},Wr=function(t,e){return!t.discrete&&e[t.dim]<0},Hr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/Ir(t,e))},Ur=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/Ir(t,e))},Gr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dx(n);if("-"===t[2]&&!Wr(r,n))return e.dx(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*o*e.model.size(n)/2+i*Hr(e,n)}}}},qr=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dy(n);if("-"===t[2]&&!Wr(r,n))return e.dy(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*o*e.model.size(n)/2+i*Ur(e,n)}}}};Rr.regRule("l",Gr(["l",-1,null])).regRule("L",Gr(["L",-1,null])).regRule("l+",Gr(["l",-1,"+"])).regRule("l-",Gr(["l",-1,"-"])).regRule("L+",Gr(["L",-1,"+"])).regRule("L-",Gr(["L",-1,"-"])).regRule("r",Gr(["r",1,null])).regRule("R",Gr(["R",1,null])).regRule("r+",Gr(["r",1,"+"])).regRule("r-",Gr(["r",1,"-"])).regRule("R+",Gr(["R",1,"+"])).regRule("R-",Gr(["R",1,"-"])).regRule("t",qr(["t",-1,null])).regRule("T",qr(["T",-1,null])).regRule("t+",qr(["t",-1,"+"])).regRule("t-",qr(["t",-1,"-"])).regRule("T+",qr(["T",-1,"+"])).regRule("T-",qr(["T",-1,"-"])).regRule("b",qr(["b",1,null])).regRule("B",qr(["B",1,null])).regRule("b+",qr(["b",1,"+"])).regRule("b-",qr(["b",1,"-"])).regRule("B+",qr(["B",1,"+"])).regRule("B-",qr(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var o=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*o-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Rr.getRule("from-beginning"),Rr.getRule("towards"),Rr.getRule("cut-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Rr.getRule("to-end"),Rr.getRule("towards"),Rr.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Rr.getRule("from-beginning"),Rr.getRule("towards"),Rr.getRule("cut-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Rr.getRule("to-end"),Rr.getRule("towards"),Rr.getRule("cut-outer-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+u;var c=a-n;return c>0?r-c:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,o=t.h(e),a=i+o/2;if(0-(i-o/2)>0)return 0;var u=a-r;return u>0?n-u:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),o=t.x(e)+t.dx(e),a=t.y(e)+t.dy(e);return!(!Gt(o,t.w(e),i,n)&&!qt(a,t.h(e),i,r))||t.hide(e)}}});var Xr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),o=i-r,a=o<0?1:Math.exp(-o/t);Math.random()>=a?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(l,d):l;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});l.text=l.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(l.text,c):l.text,l.text=l.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(l.text,c):l.text,l.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(l.text,l.edges):l.text,l.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(l.text):l.text,l.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(l.text):l.text;var p=l.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),w=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=a.select(this),r=v(t,e);n.text(null),x(t,e).split(o).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var o=e.getLabelRect(t),a=e.getLabelRect(i),u=Number(!t.hide&&!i.hide);if(u*Math.max(0,Math.min(a.x1,o.x1)-Math.max(o.x0,a.x0))*(u*Math.max(0,Math.min(a.y1,o.y1)-Math.max(o.y0,a.y0)))>0){var c=[t,i];c.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[c[0].extr+"/"+c[1].extr](c[0],c[1])<0?c[0]:c[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+c||ur.bottom+c)return null;var s=(i.find(a,u)||[]).map(function(t){var e=Math.sqrt(Math.pow(a-t.x,2)+Math.pow(u-t.y,2));if(e>c)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):ci(t.size>e.size?t:e)}function li(t,e,n,r){var i=function(t,e,n,r){var i=hi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var o=function(i){var o=i?[r,n,e,t]:[t,e,n,r],a=gi.apply(void 0,[1/12*2].concat(o)),u=gi.apply(void 0,[.5].concat(a.slice(0,4))),c=u[3],s=u[6],l=yi(o[0],c),f=yi(c,s),d=[l.left[0],E(.5,l.left[1],f.left[0]),f.left[1]],h=[l.right[0],E(.5,l.right[1],f.right[0]),f.right[1]],p=mi.apply(void 0,d)[1],g=mi.apply(void 0,h)[1],m=E(4,l.left[0],p),y=E(4,l.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},a=o(!1),u=o(!0);return{left:a.left.concat(u.left),right:a.right.concat(u.right)}}(t,e,n,r);if(!i)return si(t,r);var o=di(fi(t,i.right[0]),fi(t,i.left[0])),a=di(fi(r,i.right[1]),fi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(o>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(a>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function fi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function di(t,e){return e1?[t]:[]},d);l.exit().remove(),l.call(u(n.animationSpeed,o.pathAttributesUpdateInit,o.pathAttributesUpdateDone,o.afterPathUpdate));l.enter().append(o.pathElement).call(u(n.animationSpeed,o.pathAttributesEnterInit,o.pathAttributesEnterDone,o.afterPathUpdate)).merge(l).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(0)}),et(t,e.guide.animationSpeed,"pathTransition").attrTween(o.pathTween.attr,o.pathTween.fn)):t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(1)})});if(t.subscribe(s),"never"!==n.showAnchors){var f=function(t,e,n){var r=e.anchorShape,i=t.config.guide,o=t.screenModel,a=vi({},bi[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return o.color(t)},class:"i-data-anchor"}),u=n.selectAll(".i-data-anchor").data(function(t){return t.filter(ii)},o.id);return u.exit().remove(),u.call(at(i.animationSpeed,null,a)),u.enter().append(bi[e.anchorShape].element).call(at(i.animationSpeed,{r:0},a)).merge(u)}(t,o,r);t.subscribe(f)}},s=i.toFibers(),l=s.map(function(t){return t.filter(ii)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,o=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var a,u=t.map(function(t){return i.id(t)}),c=(Array.from(n.entries()).find(function(t){var e=t[1];return u.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return a=c?e.get(c):++o,r.set(t,a),a}}();this._getDataSetId=d;var h=f.data(s,d);h.exit().remove(),h.call(c),h.enter().append("g").attr("data-id",d).call(c),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new Kr(i.model,e.flip,e.guide.label,r).draw(l))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=a.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Yt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.y===e}:function(e){return t.x===e});u[e].push(t)});var c=function(t){if(1===t.length)return u[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:c(t.slice(0,e)),greater:c(t.slice(e))}};return{bounds:i,tree:c(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=Fe(o.node()),c=this.node().config.guide.maxHighlightDistance;if(tr.right+u.x+c||er.bottom+u.y+c)return null;var s=a?e-u.y:t-u.x,l=function t(e){return Array.isArray(e)?e:t(s>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),c=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:c,x:r,y:i}});return xi(t,e,l)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",o="tau-chart__dimmed",a=r.selectAll(".i-role-path"),u=a.data().filter(function(e){return e.filter(ii).some(t)}),c=u.length>0;a.call(lt(((e={})[i]=function(t){return c&&u.indexOf(t)>=0},e[o]=function(t){return c&&u.indexOf(t)<0},e)));var s=((n={})[i]=function(e){return!0===t(e)},n[o]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(lt(s)),r.selectAll(".i-role-label").call(lt(s)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,o="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(st(bi[r].getHighlightAttrs(t,e,n))).attr("opacity",o?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Ee("i-data-anchor",i.class(t))}).classed(qe+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,o=n.filter(t),a=r.select(".cursor-line");if(o.empty())a.remove();else{a.empty()&&(a=r.append("line"));var u=e.screenModel.model,c=u.xi(o.data()[0]),s=u.xi(o.data()[0]),l=u.scaleY.domain(),f=u.scaleY(l[0]),d=u.scaleY(l[1]);a.attr("class","cursor-line").attr("x1",i?f:c).attr("y1",i?c:f).attr("x2",i?d:s).attr("y2",i?s:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(ii).some(t))});var o=te(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),a={line:0,g:1,text:2};ke(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?o(t,e):a[t.tagName]-a[e.tagName]})}},Si=[1,2,3,4,5],Mi=Si.map(function(t){return qe+"line-opacity-"+t}),Oi=Si.map(function(t){return qe+"line-width-"+t});function Ai(t){return Mi[t-1]||Mi[4]}function ki(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Ei(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var Ti=function(){return(Ti=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Ci.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=o,e.pathAttributesUpdateDone=o;var a="polyline"===$(n.interpolate);return e.pathElement=a?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:a?"points":"d",fn:ct(0,a?ki:Ei,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=Ci.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n),y0:e.y0(n),group:e.group(n)}}),i=r.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Yt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),a=o.reduce(function(t,e){return t[e]=[],t},{});if(r.forEach(function(t){var e=o.find(n?function(e){return t.y===e}:function(e){return t.x===e});a[e].push(t)}),function(){var t=Object.keys(r.reduce(function(t,e){return t[e.group]=!0,t},{})),e=t.reduce(function(t,e,n){return t[e]=n,t},{});o.forEach(function(n){var r=a[n];if(r.sort(function(t,n){return e[t.group]-e[n.group]}),r.lengthr.right+u.x+c||er.bottom+u.y+c)return null;var s=a?e-u.y:t-u.x,l=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(s1&&(f=1);var d=function(){var t=l.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{});return l.items.end.forEach(function(e){void 0!==t[e.group]?t[e.group].end=e:delete t[e.group]}),Object.keys(t).forEach(function(e){var n=t[e];n.end?(n.y=n.start.y+f*(n.end.y-n.start.y),n.y0=n.start.y0+f*(n.end.y0-n.start.y0)):delete t[e]}),Object.keys(t).map(function(e){return t[e]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})}(),h=e-u.y,p=d.filter(function(t){return h>=t.y&&h<=t.y0}),g=(p.length>0?p:d).map(function(t){return t.el}).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),c=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:c,x:r,y:i}});return xi(t,e,g)}},Li={draw:_i.draw,getClosestElement:_i.getClosestElement,highlight:_i.highlight,highlightDataPoints:_i.highlightDataPoints,addInteraction:_i.addInteraction,_getBoundsInfo:_i._getBoundsInfo,_sortElements:_i._sortElements,init:function(t){var e=_i.init(t);return e.transformRules=[e.flip&&M.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Kt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),o=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return M.get("adjustStaticSizeScale")(t,o)}],e},buildModel:function(t){var e=_i.baseModel(t),n=this.node().config.guide,r=Ai(t.model.scaleColor.domain().length),i=qe+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var o={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=o,e.pathAttributesUpdateDone=o,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:ct(0,function(t,e){return function(n){return n.map(function(n){return[t(n),e(n)].join(",")}).join(" ")}}(function(t){return t.x},function(t){return t.y}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function ji(t){if(t.length<2)return"";for(var e="",n=0;n=160&&t<320?e=1:t>=320&&t<480?e=2:t>=480&&t<640?e=3:t>=640&&(e=4),Oi[e]}(r.width):"",a=Ai(t.model.scaleColor.domain().length),u=i?"line":"area",c=""+qe+u+" "+u+" i-role-path "+o+" "+a+" "+n.cssClass+" ",s=i?{stroke:function(t){return f.color(t[0])},class:"i-role-datum"}:{fill:function(t){return f.color(t[0])}},l="cubic"===$(n.interpolate)?i?Pi:ui:i?ji:ai,f=_i.baseModel(t),d=i?function(e){return{id:t.id(e),x:f.x(e),y:f.y(e)}}:function(e){return{id:t.id(e),x:f.x(e),y:f.y(e),size:f.size(e)}};return f.groupAttributes={class:function(t){return c+" "+f.class(t[0])+" frame"}},f.pathElement="path",f.anchorShape="circle",f.pathAttributesEnterInit=s,f.pathAttributesUpdateDone=s,f.pathTween={attr:"d",fn:ct(0,l,[d],t.id,n.interpolate)},f}},zi=function(t){return a.select(t).data()[0]},Ri={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Kt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Kt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Kt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&M.get("flip"),e.guide.obsoleteVerticalStackOrder&&M.get("obsoleteVerticalStackOrder"),e.stack&&M.get("stack"),r&&M.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Kt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return M.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return M.get("avoidScalesOverflow")(t,n)},e.stack&&M.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight(function(t,e){return function(n){return n===t||e}}(n.data,null))})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var o=r.guide.prettify,u="i-role-element i-role-datum bar "+qe+"bar",c=n.screenModel,s=this.buildModel(c,{prettify:o,minBarH:1,minBarW:1,baseCssClass:u}),l=at,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=c.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=s.class,v=Zt(s,"class"),b=i.container.selectAll(".bar").data(m,c.id);b.exit().classed("tau-removing",!0).call(l(r.guide.animationSpeed,null,((t={})[f]=function(){var t=a.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=a.select(t);e.classed("tau-removing")&&e.remove()})),b.call(l(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(l(r.guide.animationSpeed,(e={},e[d]=c[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",c[d+"0"]);n.subscribe(new Kr(c.model,c.model.flip,r.guide.label,i).draw(g));var w=function(){var t=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map);return function(e,n){return(t.get(zi(e))||-1)-(t.get(zi(n))||-1)}}();this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=zi(t),r=zi(e),i=s.width(n),o=s.width(r);if(i===o){var a=s.y(n),u=s.y(r);return a===u?w(t,e):a-u}return o-i}:function(t,e){var n=zi(t),r=zi(e),i=s.height(n),o=s.height(r);if(i===o){var a=s.x(n),u=s.x(r);return a===u?w(t,e):a-u}return o-i}:w;var _={rect:0,text:1};this._typeSorter=function(t,e){return _[t.tagName]-_[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,o=e.minBarW,a=e.baseCssClass,u=function(e){var n=t.size(e);return r&&(n=Math.max(o,n)),n},c=function(e){return e[t.model.scaleY.dim]};if(t.flip){var s=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*u(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var o=s(e),a=c(e),u=0;return 0===a&&(u=0),a>0&&(u=o),a<0&&(u=0-i),o0?n-i:n);return n},width:function(t){return u(t)},height:function(t){var e=l(t);return r&&(e=0===c(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return a+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;eu}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Yt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});u[e].push(t)});var c=function(t){if(1===t.length)return u[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:c(t.slice(0,e)),greater:c(t.slice(e))}};return{bounds:i,tree:c(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=Fe(o.node()),c=t-u.x,s=e-u.y,l=this.node().config.guide.maxHighlightDistance;if(cr.right+l||sr.bottom+l)return null;var f=a?s:c,d=a?c:s;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e=a?t.box.left:t.box.top,n=a?t.box.right:t.box.bottom,r=function(t,e,n){return t>=e&&t<=n}(d,e,n);if(!r&&Math.abs(d-e)>l&&Math.abs(d-n)>l)return null;var i=Math.abs(d-(t.invert!==a?n:e));return Object.assign(t,{distToValue:i,cursorInside:r})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(a?s-n:c-e),i=Math.abs(a?c-e:s-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(lt(r)),n.selectAll(".i-role-label").call(lt(r)),this._sortElements(function(e,n){return t(zi(e))-t(zi(n))},this._typeSorter,this._barsSorter)}},Di=n(14),Ii=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Kt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return Ii(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,o=this.color,a=Di.line(),u=function(t){t.attr("d",function(t){return a(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},c=function(t){t.attr("stroke",function(t){return o.toColor(o(t[o.dim]))}),t.attr("class",function(t){return qe+"__line line "+o.toClass(o(t[o.dim]))+" foreground"})},s=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(u),e.enter().append("path").attr("class","background line").call(u);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){u(t),c(t)}),n.enter().append("path").call(function(t){u(t),c(t)})},l=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});l.exit().remove(),l.call(s),l.enter().append("g").attr("class","lines-frame").call(s),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(g),Wi=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=$t(Jt(e.order,i),i)),this.vars=i;var o=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",o.every(Number.isInteger)).addField("originalSeries",function(){return o}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return function(t,e){return Pt([t,e].map(function(t){return JSON.stringify}).join(""))}(n.vars,e)},r.value=r,r},t.prototype.getVarSet=function(t,e){return Yt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),function(t){return"date"===t?function(t){return new Date(t).getTime()}:function(t){return t}}(e.dimType))},t}(),Hi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ui=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Hi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(Wi),Gi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qi=function(){return(qi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,u.map(Math.abs));u=[-h,h]}r.vars=u}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",o).addField("toColor",It).addField("toClass",Bt),r}return Gi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Xi.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Ut(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!Tt(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Xi.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Xi.scaleLinear().domain(Dt(t.map(function(t){return t-0}),e.length)).range(e)},e}(Wi),Vi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},Ji=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,o=u.extent(r.vars),a=Number.isFinite(i.min)?i.min:o[0],c=Number.isFinite(i.max)?i.max:o[1];return r.vars=[Math.min.apply(Math,[a,o[0]].filter(Number.isFinite)),Math.max.apply(Math,[c,o[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Vi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Kt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,o=r.minSize,a=r.maxSize,u=$i[i],c=n.filter(function(t){return Number.isFinite(Number(t))});if(0===c.length)t=function(){return a};else{var s,l,f=Math.min.apply(Math,c),d=Math.max.apply(Math,c),h=u(Math.max(Math.abs(f),Math.abs(d),d-f));l=f<0?f:0,s=0===h?1:(a-o)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?o+u(e-l)*s:a}}return this.toBaseScale(t)},e}(Wi),Ki=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return Ki(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=c.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),o=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},a=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*o(e)},i*o(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return a[t]=r[t]}),a.stepSize=function(t){return o(t)*i},this.toBaseScale(a,t)},e}(Wi),Qi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),to=function(){return(to=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,o=eo.scalePoint().domain(n).range(t).padding(.5),a=eo.scalePoint().domain(r.map(String)).range(t).padding(.5),u=Math.max.apply(Math,t),c=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,u,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},s=function(t){var n=new Date(t),o=(e?e.cast(n):n).getTime();return i.ratio?u-r.slice(r.indexOf(o)+1).reduce(function(t,e){return t+u*c(e)},u*c(t)*.5):a(String(o))};return Object.keys(o).forEach(function(t){return s[t]=o[t]}),s.stepSize=function(t){return c(t)*u},this.toBaseScale(s,t)},e}(Wi),ro=n(15),io=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oo=function(){return(oo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,o=(r?ao.scaleUtc:ao.scaleTime)().domain(n).range(t),a=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=o});return function(t,e,n){void 0===n&&(n=10);var r,i,o=Number(t[0]),a=Number(t[1]),u=Math.abs(a-o)/n,c=ao.bisector(function(t){return t.duration}).right(lo,u);if(c===lo.length)r=e?ao.utcYear:ao.timeYear,i=ao.tickStep(o/so.year.duration,a/so.year.duration,n);else if(c){var s=u/lo[c-1].duration,l=lo[c].duration/u,f=lo[sl&&(e=l),o(e)}}return Object.keys(o).forEach(function(t){return a[t]=o[t]}),a.stepSize=function(){return 0},this.toBaseScale(a,t)},e}(Wi);function co(t){return ao["time"+t[0].toUpperCase()+t.slice(1)]}var so={second:{duration:1e3,interval:ao.timeSecond,utc:ao.utcSecond},minute:{duration:6e4,interval:ao.timeMinute,utc:ao.utcMinute},hour:{duration:36e5,interval:ao.timeHour,utc:ao.utcHour},day:{duration:864e5,interval:ao.timeDay,utc:ao.utcDay},week:{duration:6048e5,interval:ao.timeWeek,utc:ao.utcWeek},month:{duration:2592e6,interval:ao.timeMonth,utc:ao.utcMonth},year:{duration:31536e6,interval:ao.timeYear,utc:ao.utcYear}},lo=function(){var t=function(t,e){return{time:t,step:e,duration:e*t.duration}};return[t(so.second,1),t(so.second,5),t(so.second,15),t(so.second,30),t(so.minute,1),t(so.minute,5),t(so.minute,15),t(so.minute,30),t(so.hour,1),t(so.hour,3),t(so.hour,6),t(so.hour,12),t(so.day,1),t(so.day,2),t(so.week,1),t(so.month,1),t(so.month,3),t(so.year,1)]}();var fo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ho=function(){return(ho=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(po.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(Wi),mo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yo=function(){return(yo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),o=r.toExponential().split("e"),a=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),u=parseFloat(Math.ceil(Number(o[0]))+"e"+o[1]);return e?[a,u]:[-u,-a]}(o)),r.vars=o,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return mo(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;wo(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=vo.extent(e.domain()),i=Math.floor(xo(r[0])),o=Math.ceil(xo(r[1])),a=Math.ceil(10*(o-i)/(10*Math.ceil(t/10))),u=i;u<=o;u+=a)for(var c=1;c<=10;c++){var s=Math.pow(c,a)*Math.pow(10,u);(s=parseFloat(s.toExponential(0)))>=r[0]&&s<=r[1]&&n.push(s)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(vo.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(Wi);function xo(t){return Math.log(t)/Math.LN10}function wo(t){if(t[0]*t[1]<=0)throw new w("Logarithmic scale domain cannot cross zero.",_.INVALID_LOG_DOMAIN)}var _o,So=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mo=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return So(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(Wi),Oo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ao=function(){return(Ao=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Ut(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),o=ko.scaleThreshold().domain(i).range(e);return this.toBaseScale(o)},e}(Wi),To=function(t){return t||null},Co=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},No=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Lo={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},jo=((_o={})[Lo.SUCCESS]=function(t){return t},_o[Lo.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},_o[Lo.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],o=t[i],a=t.filter(function(t){return t!==o});a.push(o);var u=n[i][r]||{},c=n[n.length-1][r]||{};return n[n.length-1][r]=u,n[i][r]=c,a},_o);function Po(t,e,n){return e.reduce(function(e,r,i){var o=t[r];return o?e.status!=Lo.FAIL&&("measure"===o.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==o.type&&1===e.countMeasureAxis?e.status=Lo.WARNING:e.countMeasureAxis>1&&(e.status=Lo.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Lo.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Lo.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function Fo(t){for(var e=Co(t.x),n=Co(t.y),r=Math.max(e.length,n.length),i=Co(t.guide||{},{}),o=r-i.length,a=0;a0;l--){var f=u.pop(),d=c.pop(),h=s.pop()||{};l===o?(a.x=f,a.y=d,a.unit.push(No(t,{x:To(f),y:To(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),a.guide=Kt(h,{x:{label:f},y:{label:d}})):a={type:"COORDS.RECT",x:To(f),y:To(d),unit:[a],guide:Kt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:a},e}var Ro=function(t){var e=Fo(t);return zo("ELEMENT.INTERVAL",e=function(t){var e=(t.flip?t.y:t.x).indexOf(t.color)>=0,n=t.guide[t.guide.length-1];return e&&!n.hasOwnProperty("enableColorToBarPosition")&&(n.enableColorToBarPosition=!1),t}(e))},Do=function(t){var e=Fo(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,o=t.y,a=i[i.length-1],u=i.slice(0,i.length-1),c=o[o.length-1],s=o.slice(0,o.length-1),l=t.color,f=u.concat(s).concat([l]).filter(function(t){return null!==t}),d=-1,h=[[[a].concat(f),c],[[c].concat(f),a]],p=null;return h.some(function(t,e){var i=t[0],o=t[1],a=on(n,i,[o]);return a.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+a.error.keyY+" values (e.g. "+a.error.errY.join(",")+")","for ("+a.error.keyX+" = "+a.error.valX+")."].join(" ")),a.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=sn(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),zo("ELEMENT.AREA",e)},Io=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),Bo=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new Io(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Wo={},Ho=function(){function t(){}return t.unit=function(t){return new Io(t)},t.spec=function(t){return new Bo(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Yo="2.6.4";e.default={GPL:Ge,Plot:nr,Chart:cr,api:qo,version:"2.6.4"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=o},function(t,e){t.exports=a},function(t,e){t.exports=u},function(t,e){t.exports=c},function(t,e,n){var r,i,o;!function(n,a){i=[],void 0===(o="function"==typeof(r=a)?r.apply(e,i):r)||(t.exports=o)}(0,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,o=i.documentElement,a=["top","bottom"];function u(t,e){for(var n in e)t[n]=e[n];return t}function c(t){var e=r.pageYOffset||o.scrollTop,n=r.pageXOffset||o.scrollLeft,i={left:0,right:0,top:0,bottom:0,width:0,height:0};if(function(t){return t&&null!=t.setInterval}(t))i.width=r.innerWidth||o.clientWidth,i.height=r.innerHeight||o.clientHeight;else{if(!o.contains(t)||null==t.getBoundingClientRect)return i;u(i,t.getBoundingClientRect()),i.width=i.right-i.left,i.height=i.bottom-i.top}return i.top=i.top+e-o.clientTop,i.left=i.left+n-o.clientLeft,i.right=i.left+i.width,i.bottom=i.top+i.height,i}var s=function(t,e){return r.getComputedStyle(t)[e]};function l(t){var e=String(s(t,l.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}l.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-o<=e.left?i[0]="right":t.right+this.width+o>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:c(t),o=this.spacing,a=this._pickPlace(i);switch(a!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(a),this.curPlace=a),this.curPlace){case"top":n=i.top-this.height-o,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-o,r=i.right-this.width;break;case"top-right":n=i.top-this.height-o,r=i.left;break;case"bottom":n=i.bottom+o,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+o,r=i.right-this.width;break;case"bottom-right":n=i.bottom+o,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-o;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-o;break;case"left-bottom":n=i.top,r=i.left-this.width-o;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+o;break;case"right-top":n=i.bottom-this.height,r=i.right+o;break;case"right-bottom":n=i.top,r=i.right+o}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=l(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],o=0;o>>0,i=arguments[1],o=0;o0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),n)};return function(t){var n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var i,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!e(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(i=arguments[2])}for(var a,u=r(n.length),c=e(this)?Object(new this(u)):new Array(u),s=0;s=0?t.positive:t.negative,u=a[i]||0,c=u+o;return a[i]=c,{nextStack:c,prevStack:u}}},o=i({positive:{},negative:{}}),a=i({positive:{},negative:{}}),u=function(e){return Qt(e,t.id)},c=Number.MAX_VALUE,s=Number.MIN_VALUE,l=function(t){return c=ts?t:s,r.value(t)},f=u(function(t){return l(o(t).nextStack)}),d=u(function(t){return l(a(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=Vt(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxc)&&(e.min=c),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a=t.data(),u=function(t,e){return t-e},c=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,s=a.map(function(e){return t.xi(e)}).sort(u),l=s[0],f=s.slice(1).map(function(t){var e=t-l;return l=t,e}).filter(function(t){return t>0}).sort(u).concat(Number.MAX_VALUE)[0],d=Math.min(f,c),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(o,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:o};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=a.minSize,e.maxSize=a.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,o=e.defMax,a=function(t,e){return t-e},u=t.data().map(function(e){return t.xi(e)}).sort(a),c=u[0],s=u.slice(1).map(function(t){var e=t-c;return c=t,e}).filter(function(t){return t>0}).sort(a).concat(Number.MAX_VALUE)[0],l=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,f=Math.min(s,l),d="number"==typeof n?n:i,h="number"==typeof r?r:o,p={minSize:d,maxSize:Math.max(d,Math.min(h,function(t){var e=(d+h)/2,n=h,r=d;return Math.round(e+(n-e)/(1+Math.exp(-(t-r)/.5)))}(f)))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,o=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},a=o(t.scaleX,"x"),u=o(t.scaleY,"y");if(a&&u)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var c=t.data().reduce(function(e,i){var o,c,s=t.size(i),l=(s>=n?s:n+s*(r-n))/2;return a||(o=t.xi(i),e.left=Math.min(e.left,o-l),e.right=Math.max(e.right,o+l)),u||(c=t.yi(i),e.top=Math.min(e.top,c-l),e.bottom=Math.max(e.bottom,c+l)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),s=function(e,n,r,i){var o=e.domain(),a=Math.abs(e.value(o[1])-e.value(o[0])),u=(o[1]-o[0])/a;if(0===a)return 1;var c=Math.max(0,-n),s=Math.max(0,r-a),l=t.flip?s:c,f=t.flip?c:s,d=Number(o[0])-(i?f:l)*u,h=Number(o[1])+(i?l:f)*u;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),o=i[0],a=i[1];(o>n||a=0?1:-1},d=function(e,n,r){var i=Vt(n,function(t){return t[u]}),o=n[0];return e.reduce(function(e,n){return e.concat(i[n]||function(e,n,r){var i,o=[e,t.id(n),r].join(" ");return(i={})[u]=e,i[c]=1e-10*r,i[l]=n[l],i[s]=n[s],i[O]=!0,i[O+"id"]=o,i}(n,o,r))},[])},h=function(t,e){return t-e},p=function(){return Yt(a.reduce(function(t,e){return t.concat(e.map(function(t){return t[u]}))},[])).sort(h)},g=r?function(){var e=p(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),o=t.scaleX.domain(),a=b.generate(o[0],o[1],r,{utc:i}).filter(function(t){return t>=o[0]&&t<=o[1]}),u=0,c=[],s=b.get(r,{utc:i});return a.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=u;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,E(1/3,i,r),E(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var o=t.filter(function(t,e){return e%3==0}),a=e.filter(function(t,e){return e%3==0}),u=o.map(function(t){return t.id}),c=a.map(function(t){return t.id}),s=u.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),l=c.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=u.filter(function(t){return c.indexOf(t)>=0}),d=o.filter(function(t){return!t.positionIsBeingChanged}),h=a.filter(function(t){return!t.positionIsBeingChanged}),p=W(d,h),g=W(h,d),m=[];f.forEach(function(n,r){var i=s[n],o=l[n];if(0===r&&(i>0||o>0)&&m.push(N({polylineFrom:t.slice(0,i+1),polylineTo:e.slice(0,o+1),toOppositeScale:0===o?p:g,isCubic:!0})),r>0){var a=s[f[r-1]],u=l[f[r-1]];i-a>3||o-u>3?m.push(L({polylineFrom:t.slice(a,i+1),polylineTo:e.slice(u,o+1),isCubic:!0})):m.push(function(t){var e=t.polylineFrom,n=t.polylineTo;return function(t){return D(e.slice(1,3),n.slice(1,3),t)}}({polylineFrom:t.slice(a,i+1),polylineTo:e.slice(u,o+1)}))}m.push(j({pointFrom:t[i],pointTo:e[o]})),r===f.length-1&&(t.length-i-1>0||e.length-o-1>0)&&m.push(N({polylineFrom:t.slice(i),polylineTo:e.slice(o),toOppositeScale:e.length-o==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(P({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);F(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),o=t.filter(function(t){return!t.positionIsBeingChanged}),a=e.filter(function(t){return!t.positionIsBeingChanged}),u=W(o,a),c=W(a,o),s=[];i.forEach(function(o,a){var l=n.indexOf(o),f=r.indexOf(o);if(0===a&&(l>0||f>0)&&s.push(N({isCubic:!1,polylineFrom:t.slice(0,l+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?u:c})),a>0){var d=n.indexOf(i[a-1]),h=r.indexOf(i[a-1]);(l-d>1||f-h>1)&&s.push(L({isCubic:!1,polylineFrom:t.slice(d,l+1),polylineTo:e.slice(h,f+1)}))}s.push(j({pointFrom:t[l],pointTo:e[f]})),a===i.length-1&&(t.length-l-1>0||e.length-f-1>0)&&s.push(N({isCubic:!1,polylineFrom:t.slice(l),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?u:c}))}),0===s.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&s.push(P({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return s.forEach(function(n){var r=n(t);F(e,r)}),e}})(t,e)),r(i))}}function N(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,o=e.length>n.length?e:n,a=1===n.length,u=e[0].id!==n[0].id,c=Boolean(u!==a);return function(t){var e=(r?B:I)({t:t,polyline:o,decreasing:a,rightToLeft:c});a===c?e.shift():e.pop();var n=D(e.map(i),e,a?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function L(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,o=n.length;if(o!==i){var a=o2){var i=function(t,e){for(var n,r,i=[e[0]],o=0;o0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function F(t,e){return Array.prototype.push.apply(t,e)}function z(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function R(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=z(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function D(t,e,n){return t.map(function(t,r){return R(t,e[r],n)})}function I(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,o=Boolean(r)!==Boolean(i),a=function(t,e){var n=0;if(t>0){for(var r,i,o,a,u=[0],c=0,s=1;s0){for(var i,o,a,u,c,s,l,f,d=[0],h=0,p=1;p0;o--)if((e=a[o][t])!==r)return n=u[o][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function H(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function U(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=T(t,n,r,i,o);return[a[1],a[2],a[4],a[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(o).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(a[3][e]=z(n[e],o[e],t))}),a}function G(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:q(t[0].x,t[1].x,1/3),y:q(t[0].y,t[1].y,1/3)},{x:q(t[0].x,t[1].x,2/3),y:q(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,o,a,u,c,s,l,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=E(1/3,t[v-1],t[v]),m[3*v-1]=E(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:q(m[0].x,m[3].x,1/3),y:q(m[0].y,q(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:q(m[y].x,m[y-3].x,1/3),y:q(m[y].y,q(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==c>i.y&&(p=q(p*(g=(i.y-r.y)/(c-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==a0?[t,e].join(" "):e,c=n(i.text(u));if(cu;if(l&&i){var f=Math.floor(u/s*c.length);t[t.length-1]=c.substr(0,f-4)+"...",p=!0}return l&&!i&&t.push(e),l||(t[t.length-1]=c),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return a(c,t,1.1,l,f,d,e)}),h.remove()})};var et=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=nt),t.onTransitionEnd=function(t){return ot(this,t),this},t},nt=function(t,e){var n,r,i=this,o=K.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var a="__transitionAttrs__",u="__lastTransitions__",c=it();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[a]=Object.assign(this[a]||{},e),this[a][u]||Object.defineProperty(this[a],u,{value:{}}),Object.keys(e).forEach(function(e){return t[a][u][e]=c})});var s=function(){var t=this;this[a]&&(Object.keys(r).filter(function(e){return t[a][u][e]===c}).forEach(function(e){return delete t[a][e]}),0===Object.keys(this[a]).length&&delete this[a])};return this.on("interrupt."+c,function(){return i.each(s)}),this.on("end."+c,function(){return i.each(s)}),o},rt=0,it=function(){return++rt},ot=function(t,e){if(K.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},at=function(t,e,n,r){var i=r||function(t){return t},o=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(st(Kt(e,n)))),i=(i=et(i,t)).call(st(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(o)}):i.each(o),i}},ut=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},ct=function(t,e,n,r,i){void 0===i&&(i="linear");var o="__pathPoints__";return function(t){var a=this;this[o]||(this[o]=n.map(function(){return[]}));var u=n.map(function(e,n){var u=Yt(t,r).map(e),c=(V(i)||V("linear"))(u),s=a[o][n];return{pointsFrom:s,pointsTo:c,interpolate:C(s,c,$(i))}});return function(t){if(0===t){var n=u.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=u.map(function(t){return t.pointsTo});return a[o]=r,e.apply(void 0,r)}var i=u.map(function(e){return e.interpolate(t)});return a[o]=i,e.apply(void 0,i)}}},st=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},lt=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dt=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Kt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,o=[e.flip&&M.get("flip"),r&&M.get("stack"),i&&M.get("positioningByColor")];return n.decorators=(n.config.transformRules||o).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return ft(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),o=this.getScale("size"),a=this.getScale("label"),u=this.getScale("color"),c=this.getScale("split"),s=this.getScale("identity"),l=i.domain(),f=i.discrete?l[0]:Math.max(0,Math.min.apply(Math,l)),d=i.value(f)+.5*i.stepSize(f),h=u.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:o,scaleLabel:a,scaleColor:u,scaleSplit:c,scaleIdentity:s,color:function(t){return u.value(t[u.dim])},label:function(t){return a.value(t[a.dim])},group:function(t){return t[u.dim]+"(@taucharts@)"+t[c.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return o.value(t[o.dim])},id:function(t){return s.value(t[s.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=Vt(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return function(t,e){var n=Math.pow(10,e);return Math.round(n*t)/n}(t.screenModel.size(e)/2,4)},r=at,i=function(e,n,i){var o=t.config.guide.animationSpeed,u=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);u.exit().call(r(o,null,{width:0},function(t){return a.select(t).remove()})),u.call(r(o,null,i)),u.enter().append("rect").style("stroke-width",0).call(r(o,{width:0},i))},o=this.config.flip,u=o?"y":"x",c=o?"x":"y",s=o?"x0":"y0",l=o?"height":"width",f=o?"width":"height",d=function(e){var r,o,a;i(e,"lvl-top",((r={})[l]=function(t){return n(t)},r[f]=1,r[u]=function(e){return t.screenModel[u](e)-n(e)/2},r[c]=function(e){return t.screenModel[c](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((o={})[l]=function(t){return n(t)},o[f]=1,o[u]=function(e){return t.screenModel[u](e)-n(e)/2},o[c]=function(e){return t.screenModel[s](e)},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-btm "+t.screenModel.class(e)},o)),i(e,"lvl-link",((a={})[l]=.5,a[f]=function(e){return Math.abs(t.screenModel[c](e)-t.screenModel[s](e))},a[u]=function(e){return t.screenModel[u](e)-.25},a[c]=function(e){return Math.min(t.screenModel[c](e),t.screenModel[s](e))},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-link "+t.screenModel.class(e)},a))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=Vt(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(g),ht=function(){return(ht=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?function(t){return"object"==typeof t?JSON.parse(JSON.stringify(t)):t}(t.constructor.prototype):{}},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},wt={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},_t=/\\|'|\r|\n|\u2028|\u2029/g,St="(?:"+Object.keys(xt).join("|")+")",Mt=RegExp(St),Ot=RegExp(St,"g"),At={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function kt(t){return yt(t)}function Et(t){return t instanceof Date&&!isNaN(Number(t))}function Tt(t){return null!=t&&"object"==typeof t}function Ct(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],o=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),a=10/i*o,u=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],c=-1;a>u[++c][0];);o*=u[c][1],r[0]=Math.floor(r[0]/o)*o,r[1]=Math.ceil(r[1]/o)*o;var s=e-r[0],l=r[1]-n,f=o/2;if(e<0){var d=s>=f?-s:0;r[0]=r[0]-d}if(n>0){var h=l>=f?-l:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Nt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=pt.extent(t),o=i[0],a=i[1],u=+a-+o,c=r?pt.scaleUtc:pt.scaleTime;if(0===u){return o=new Date(o.getTime()-864e5),a=new Date(a.getTime()+864e5),c().domain([o,a]).nice(e).domain()}var s=c().domain([o,a]).nice(e);if(e)return s.domain();var l=c().domain([o,a]).nice(e).domain(),f=l[0],d=l[1],h=s.ticks(),p=h.length-1;return(+o-+f)/(+h[1]-+f)<.5&&(o=f),(+d-+a)/(+d-+h[p-1])<.5&&(a=d),[o,a]}var Lt=0,jt={};function Pt(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return jt.hasOwnProperty(e)||(jt[e]="H"+ ++Lt),jt[e]}function Ft(t,e,n){var r=0,i=null,o=Qt(function(t,e){return Yt(t.map(function(t){return e.reduce(function(e,n){return e.concat(function(t){return Et(t)?t.getTime():t}(t[n]))},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,a){var u=a.length,c=n.getSpec(),s=c.sources["/"].data,l=c.unit.units[0].guide||{};l.padding=l.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=l.padding.l+l.padding.r:"y"===t&&(f=l.padding.t+l.padding.b);var d=(i-u*f)/function(t){var e=o(s,t);return Object.keys(e).reduce(function(t,n){return t+e[n]},0)}(e);return(function(t,e){return o(s,t)[e]}(e,r)*d+f)/i}}function zt(t){var e=!0;try{mt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function Rt(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],o=0;o=r&&n.apply(this,i),t.e=a.e,t.ts=a.ts}}function Dt(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),o=e>=2?Ut(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(o,[r])}function It(t){return vt(t)?t:""}function Bt(t){return vt(t)?"":t}function Wt(t){return t/180*Math.PI}function Ht(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Ut(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function qt(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function Xt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return Xt(t)})):t}function Yt(t,e){for(var n={},r=[],i=t.length,o=e||function(t){return String(t)},a=0;a/g,">").replace(/"/g,""").replace(/'/g,"'")}var oe=" ",ae=32,ue=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function ce(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=Xt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],o=ue[t];if(o&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var a="<"+t,u=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");u.length>ae&&(u=Object.keys(n).map(function(t){return"\n"+oe+t+'="'+n[t]+'"'}).join(""));var c=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+oe+t}).join("\n")}).join("\n")+"\n";return""+a+u+(o?"/>":">"+c+"")}function se(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var le=[dt];function fe(t){return le.some(function(e){return t instanceof e})}function de(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var he=document.createElement("div"),pe=new WeakMap;function ge(t,e){var n;return t instanceof Node?n=t:(he.insertAdjacentHTML("afterbegin",t),n=he.childNodes[0]),e.appendChild(n),n}function me(t){if(pe.has(t))return pe.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,pe.set(t,n),n}function ye(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=me(t),o=r?i.width+"px":"0",a=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+o+" "+a+" 0";var u=t.scrollWidth>t.clientWidth,c=t.scrollHeight>t.clientHeight,s=r&&!c?i.width+"px":"0",l=n&&!u?i.height+"px":"0";return t.style.padding="0 "+s+" "+l+" 0",t.style.overflow="",t.style.overflowX=u?"scroll":"hidden",t.style.overflowY=c?"scroll":"hidden",i}function ve(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function be(t,e){return parseInt(ve(t,e)||"0",10)}function xe(t){var e=be(t,"padding-left"),n=be(t,"padding-right"),r=be(t,"padding-bottom"),i=be(t,"padding-top"),o=be(t,"border-top-width")+be(t,"border-left-width")+be(t,"border-right-width")+be(t,"border-bottom-width"),a=t.getBoundingClientRect();return{width:a.width-e-n-2*o,height:a.height-r-i-2*o}}function we(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var o=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*o,document.body.removeChild(e),r}function _e(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o="string"==typeof n?n:n+"px",a=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Se(t.charAt(e),{fontSize:o,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],u=t.length,c=parseInt(o);return{width:a,height:c*u+.39*c*u}}var Se=Qt(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=document.createElement("div");o.style.position="absolute",o.style.visibility="hidden",o.style.border="0px",o.style.top="0",o.style.fontSize=n,o.style.fontFamily=r,o.style.fontWeight=i,document.body.appendChild(o),o.innerHTML=" "===t?" ":t;var a={width:0,height:0},u=o.getBoundingClientRect();return a.width=u.right-u.left,a.height=u.bottom-u.top,document.body.removeChild(o),a},function(t,e){return t+"_"+JSON.stringify(e)});function Me(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,o=t instanceof Element,u=o?a.select(t):t,c=function(t){return o?t.node():t},s=u.selectAll(e).filter(function(){return this.parentNode===u.node()}).filter(function(t,e){return 0===e});if(!s.empty())return c(s);for(var l,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(l=e.substring(f+1,h),f<0?i=u.append(l):n[d].call(null,l,i),d=e[h],f=h);return c(i)}function Oe(t,e){return Ae(t,e)[0]||null}function Ae(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function ke(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),o=i.slice().sort(e),a=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),u=o.reduce(function(t,e,i){var u=a.get(e),c=i-u;return c!==r&&(n&&t.push(n),r=c,n={from:u,to:i,elements:[]}),n.elements.push(e),i===o.length-1&&t.push(n),t},[]),c=u.slice().sort(function(t,e){return t.from-e.from}),s=c.reduce(function(t,e,n){return t.set(e,n),t},new Map),l=function(t){for(var e,n,r,i=u.map(function(t,e){return{elements:t.elements,from:s.get(t),to:e}}).sort(te(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),o=0;on.to)for(e=o+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=l(!0),d=l(!1),h=f.length=0?"h":"v"}function je(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Pe(t,e,n,r,i,o,a,u){var c,s,l,f,d,h;return h=((l=a-i)*(e-o)-(f=u-o)*(t-i))/(-l*(s=r-e)+(c=n-t)*f),(d=(-s*(t-i)+c*(e-o))/(-l*s+c*f))>=0&&d<=1&&h>=0&&h<=1}function Fe(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=je(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function ze(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=a.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),o=i[i.length-1];if(o){var u=Array.prototype.indexOf.call(o.parentNode.childNodes,o),c=o.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>u||this.parentNode.insertBefore(this,c)})}}}var Re=function(t){return Et(t)?t.getTime():t},De={cross:function(t,e,n){var r=t(),i=Yt(r.map(function(t){return t[e]}),Re),o=Yt(r.map(function(t){return t[n]}),Re),a=0===i.length?[null]:i;return(0===o.length?[null]:o).reduce(function(t,r){return t.concat(a.map(function(t){var i={};return e&&(i[e]=Re(t)),n&&(i[n]=Re(r)),i}))},[])},cross_period:function(t,e,n,r,i,o){var a=t(),u=!!o&&o.utcTime,c=Yt(a.map(function(t){return t[e]}),Re),s=Yt(a.map(function(t){return t[n]}),Re),l=0===c.length?[null]:c,f=0===s.length?[null]:s;return r&&(l=b.generate(Math.min.apply(Math,c),Math.max.apply(Math,c),r,{utc:u})),i&&(f=b.generate(Math.min.apply(Math,s),Math.max.apply(Math,s),i,{utc:u})),f.reduce(function(t,r){return t.concat(l.map(function(t){var i={};return e&&(i[e]=Re(t)),n&&(i[n]=Re(r)),i}))},[])},groupBy:function(t,e){return Yt(t().map(function(t){return t[e]}),Re).map(function(t){var n;return(n={})[e]=Re(t),n})},none:function(){return[null]}},Ie=function(){function t(t,e,n){var r=t.key,i=t.pipe,o=t.source,a=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=o,this.units=a,this._frame={key:r,source:o,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Pt([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),Be=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),We=function(t){return Et(t)?t.getTime():t},He=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},Ue=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return function(t,e){return void 0===e&&(e={}),Object.assign(new He(t),e)}(t,e(t,{}))},e)},Ge=function(t){function e(e,n,r,i){var o=t.call(this)||this;return Kt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},o.config=e,o.sources=e.sources,o.scales=e.scales,o.unitSet=r,o.grammarRules=i,o.scalesHub=n,o.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return We(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),o}return Be(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var o=[],a=function(t,e,n,r,i){o.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return a(i,e,n,t,r)})}),o.push(function(){return n(t,r,i)})};return a(t.unit,e,n,r,i),o},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),c=new He(u.defineGrammarModel(a)),s=Ue(u.getGrammarRules(),c,n);return Ue(u.getAdjustScalesRules(),s,n),u.node().screenModel=u.createScreenModel(s),u}),i=this._flattenDrawScenario(t,function(t,r,i){var o=!1===r.expression.inherit?null:i,a=e._createFrameScalesFactoryMethod(o),u=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),c=new He(u.defineGrammarModel(a)),s=Ue(u.getGrammarRules(),c,n);return u.node().screenModel=u.createScreenModel(s),u.parentUnit=t,u.addInteraction(),u});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],o=[t],a=e.traverseSpec({unit:this.root},function(t,e,a){t.uid=function(){var n=Pt((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(a.pipe));return r.hasOwnProperty(n)?n+="-"+ ++r[n]:r[n]=0,n}(),t.guide=kt(t.guide);var u=n(o[0],t,a);i.push(u),0===t.type.indexOf("COORDS.")&&function(t){o.unshift(t)}(u)},function(t){0===t.type.indexOf("COORDS.")&&o.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return a.push(function(){return i}),a},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var o=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:o,source:i.source,units:t.units?t.units.map(function(t){var e=kt(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var o=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[o],t).create("function"==typeof i?i(e.scales[o]):i)}},e.prototype._datify=function(t){return new Ie(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",o=t.source,a=!1!==t.inherit,u=t.params,c={source:o,pipe:a?e:[]},s=De[i];if(!s)throw new Error(i+" operator is not supported");return{source:o,inherit:a,func:s,args:u,exec:function(){return s.apply(void 0,[function(){return r._datify(c).part()}].concat(u||[],[n]))}}},e}(d),qe="tau-chart__",Xe=n(10),Ye=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Xe.Tooltip.defaults.baseClass=qe+"tooltip";var Ve=["top","bottom"];var $e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ye(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e=function(t,e){return{top:e.top+t,right:e.right-t,bottom:e.bottom-t,left:e.left+t,width:e.width-2*t,height:e.height-2*t}}(0|this.options.winBound,function(){var t=window,e=document.documentElement,n=(t.pageYOffset||e.scrollTop)-e.clientTop,r=(t.pageXOffset||e.scrollLeft)-e.clientTop,i=t.innerWidth||e.clientWidth,o=t.innerHeight||e.clientHeight;return{top:n,right:r+i,bottom:n+o,left:r,width:i,height:o}}()),n=this.options.place.split("-"),r=this.spacing;if(-1!==Ve.indexOf(n[0]))switch(t.top-this.height-r<=e.top?n[0]="bottom":t.bottom+this.height+r>=e.bottom&&(n[0]="top"),n[1]){case"left":t.right-this.width<=e.left&&(n[1]="right");break;case"right":t.left+this.width>=e.right&&(n[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?n[1]="left":t.right-t.width/2-this.width/2<=e.left&&(n[1]="right")}else switch(t.left-this.width-r<=e.left?n[0]="right":t.right+this.width+r>=e.right&&(n[0]="left"),n[1]){case"top":t.bottom-this.height<=e.top&&(n[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(n[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?n[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(n[1]="bottom")}return n.join("-")},e}(Xe.Tooltip),Je=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),Ke={},Ze={},Qe={reg:function(t,e,n){return n?(Ze[t]=n,Ke[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},Ke[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):Ke[t]=e,this},get:function(t){if(!Ke.hasOwnProperty(t))throw new w("Unknown unit type: "+t,_.UNKNOWN_UNIT_TYPE);return Ke[t]},create:function(t,e){var n,r=this.get(t);Ze[t]?n=new r(e,this.get(Ze[t])):n=new r(e);return n}},tn={},en={},nn={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),tn[t]=e,en[t]=n,nn},get:function(t){return tn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(nn.get(e))(n,(0,en[e])(r,t))}}}},rn=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,o=this.sources[r].data,a=e||new Ie({source:r},o);return t.dimType=i,this.registry.create(t.type,a,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),on=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var o=function(t,e){var n=r[e],i=Tt(n)?JSON.stringify(n):n;return t.push(i),t},a=e.reduce(o,[]).join("/"),u=n.reduce(o,[]).join("/");if(t.hasOwnProperty(a)){var c=t[a];if(c!==u)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:a,errY:[c,u]},new Error("RelationIsNotAFunction")}else t[a]=u;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},an=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},un=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],o=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:o,scale:i.scale||e[o],value:i.value})}),n},cn=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var o=function(t,e){var n=e;return Et(t)?(n.type="measure",n.scale="time"):Tt(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,kt(e)),a=o.type,u=o.scale,c=null!==t[r].type&&t[r].type!==a;t[r].type=c?e.type:a,t[r].scale=c?e.scale:u}}),t},{})},sn=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},o=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(te(function(t,n){return i(t[e])-i(n[e])},function(t,e){return o.get(t)-o.get(e)}));else if(n.order){var a=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),u=n.order.length,c="(___"+e+"___)";r=t.map(function(t){var n=a[t[e]];return n=n>=0?n:u,t[c]=n,t}).sort(te(function(t,e){return t[c]-e[c]},function(t,e){return o.get(t)-o.get(e)})).map(function(t){return delete t[c],t})}return r},ln=function(t,e){var n=document.createElement("div");return n.classList.add(qe+t),e&&e.appendChild(n),n},fn=function(){var t=ln("layout"),e=ln("layout__header",t),n=ln("layout__container",t),r=ln("layout__sidebar",n),i=ln("layout__content",n),o=ln("layout__content__wrap",i),a=ln("layout__sidebar-right",n);return{layout:t,header:e,content:o,contentContainer:i,leftSidebar:r,rightSidebar:ln("layout__sidebar-right__wrap",a),rightSidebarContainer:a,footer:ln("layout__footer",t)}},dn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Kt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Kt(t,{x:n.x,y:n.y});var r=kt(n.guide)||{};t.guide.x=Kt(t.guide.x||{},r.x),t.guide.y=Kt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return Tt(n)&&!Et(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=kt(Zt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(o){t.hasOwnProperty(o)&&(e[o]=r.scalesPool(o,t[o],i[o]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var o=this.spec.spec.dimensions,a={};if("color"===t&&null!==e&&(a={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(a.brewer=n.brewer),o[e]&&o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("nice")&&(a.nice=n.nice)),"size"===t&&null!==e&&(a={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(a.func=n.func),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("minSize")&&(a.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(a.maxSize=n.maxSize)),"label"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(a={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(a={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),o.hasOwnProperty(e)&&("x"===t||"y"===t)){if(a={type:o[e].scale,source:"/",dim:this.ruleInferDim(e,n)},o[e].hasOwnProperty("order")&&(a.order=o[e].order),n.hasOwnProperty("min")&&(a.min=n.min),n.hasOwnProperty("max")&&(a.max=n.max),n.hasOwnProperty("autoScale")?a.autoScale=n.autoScale:a.autoScale=!0,n.hasOwnProperty("nice")?a.nice=n.nice:a.nice=a.autoScale,n.hasOwnProperty("niceInterval")?a.niceInterval=n.niceInterval:a.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(a.period=n.tickPeriod,a.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){a.period=n.timeInterval,a.type="time";var u=b.get(a.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(a.min=u.cast(new Date(n.min))),n.hasOwnProperty("max")&&(a.max=u.cast(new Date(n.max)))}a.fitToFrameByDims=n.fitToFrameByDims,a.ratio=n.ratio}return this.dist.scales[i]=a,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},o=this.getScaleConfig("x",t.x),a=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=o.period||a.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),o.period,a.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),hn=n(6),pn=n(7),gn=function(){return(gn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(o))},Tn=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),o=[n,r].join(":");return e[i]||e[o]||e[n]||null},Cn=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Nn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Ln=function(t,e){var n=t.width,r=t.height,i=Math.abs(Wt(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},jn=function(t,e){void 0===e&&(e="x");var n=Ht(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]];return r[r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=Pn(l,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=Pn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),o&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=Pn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=c?0:1,g=s?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Ln(d,t.x.rotate),w=Ln(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=Sn([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=Sn([g*(e.yTickWidth+w.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),o&&(y.padding=0,y.paddingNoTicks=0);var _=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:Sn([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:Sn([t.y.padding,o?0:g*(e.yTickWidth+w.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:Sn([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+_)]),l:t.y.hide?0:Sn([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*Cn(e,"xDensityPadding",n.dimType),tickFontHeight:l.height,$minimalDomain:a.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:w.height+2*Cn(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:u.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var zn=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,o=t.allowYVertical,a=t.inlineLabels,u=n.dimension(e.x),c=n.dimension(e.y),s=n.scaleMeta(e.x,e.guide.x),l=n.scaleMeta(e.y,e.guide.y),f=s.isEmpty,d=l.isEmpty;e.guide.x.tickFormat=Nn(e.guide.x.tickFormat||Tn(u,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Nn(e.guide.y.tickFormat||Tn(c,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===u.dimType),p=!!o&&!("measure"===c.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=jn(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=jn(e.guide.y.rotate,"y"),e.guide=Fn(e.guide,r,s,l,a,de(e)),a){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},Rn={NONE:function(t,e,n){var r=kt(t);return Dn(kt(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=kt(t),r=[],i=[],o=null,a=null;gt(n.unit,"units",kn,function(t,n){if(t.isLeaf)return n;!o&&n.x&&(o=n),!a&&n.y&&(a=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=Tt(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=Tt(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var u=n.guide.x.label.text;u&&(r.push(u),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+u,n.guide.x.label.text="",n.guide.x.label._original_text=u);var c=n.guide.y.label.text;return c&&(i.push(c),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+c,n.guide.y.label.text="",n.guide.y.label._original_text=c),n});return o&&(o.guide.x.label.text=o.guide.x.label.hide?"":r.join(" → ")),a&&(a.guide.y.label.text=a.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=kt(t);return Dn(kt(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,o=e.scaleMeta(r.x,r.guide.x),a=e.scaleMeta(r.y,r.guide.y),u=!i&&Boolean(o.dimType)&&"measure"!==o.dimType;return r.guide.x.rotate=r.guide.x.rotate||(u?-90:0),r.guide.x.textAnchor=jn(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||Tn(o,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||Tn(a,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Fn(r.guide,Kt({distToXAxisLabel:o.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:a.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),o,a,null,de(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=kt(t);return Dn(kt(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?zn({unit:r,meta:e,settings:Kt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,zn({unit:r,meta:e,settings:Kt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return Rn[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return Rn[r](t,e,n)},t)}},Dn=function(t,e,n){var r=function(t){return t.options=t.options||{},t.guide=t.guide||{},t.guide.padding=Kt(t.guide.padding||{},{l:0,b:0,r:0,t:0}),t.guide.x=On(t.guide,"x"),t.guide.x=An(t.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),t.guide.y=On(t.guide,"y",{rotate:-90}),t.guide.y=An(t.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),t.guide.size=On(t.guide,"size"),t.guide.color=On(t.guide,"color"),t}(e);r=n(kn(r),r);var i=Zt(r=Mn(r,t),"units");return(r.units||[]).forEach(function(t){return Dn(kt(t),function(t,e){return t.guide=t.guide||{},t.guide.padding=t.guide.padding||{l:0,t:0,r:0,b:0},t.hasOwnProperty("units")||((t=Kt(t,e)).guide=Kt(t.guide,kt(e.guide)),t.guide.x=Kt(t.guide.x,kt(e.guide.x)),t.guide.y=Kt(t.guide.y,kt(e.guide.y))),t}(t,i),n)}),r},In=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],o=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:o.type,scaleType:i.type,values:e,isEmpty:null==o.type}}},o=(Rn[t]||Rn.NONE)({unit:kt(n.unit)},i,e);return n.unit=o.unit,n},Bn=function(){function t(t){this.spec=t,this.isApplicable=zt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return In(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Wn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){de(t)&&"y"===n||(i[n].hideTicks=!0);var o=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=o?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(de(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),Hn=function(t){return t.$maxTickTextW},Un=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},Gn=function(t){return t.density},qn=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),o=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==o&&n.push(o),t.units.forEach(r)}};r(t.unit);var i={},o={},a=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(o.hasOwnProperty(r)||(o[r]=[]),o[r].indexOf(t.key[r])<0&&o[r].push(t.key[r]))}),t.units&&t.units.forEach(a))})};return a(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(o).reduce(function(t,e){return t*o[e].length},1)}},Xn={"entire-view":function(t,e,n,r){var i=n.unit.guide,o=qn(n),a=o.xFacetCount,u=o.yFacetCount;u>0&&Wn.facetsLabelsAtTop(n.unit,n.settings);var c=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,s=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,l=i.paddingNoTicks&&t.height-st.height||a*n.settings.minFacetWidth+c>t.width,f=i.paddingNoTicks&&t.width-ct.height||a*n.settings.minFacetWidth+c>t.width;l&&Wn.hideAxisTicks(n.unit,n.settings,"x"),f&&Wn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,Hn)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Un);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,Gn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,Gn));return!l&&d>t.width&&Wn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Wn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,Gn),newH:e("y",n.unit,Gn)}},normal:function(t,e,n,r){qn(n).yFacetCount>0&&Wn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var u=Math.max(t.width,e("x",n.unit,Gn));o=Math.min(a,u)}}return{newW:o,newH:Math.max(t.height,e("y",n.unit,Gn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,o=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-ot.width)&&Wn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,Hn)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,Gn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Wn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,Gn),newH:t.height}}},Yn=function(){function t(t){this.spec=t,this.isApplicable=zt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},o=function(e,n,a,u){void 0===u&&(u=null);var c="x"===e?n.x:n.y,s="x"===e?n.y:n.x,l=n.guide,f=a("x"===e?l.x:l.y),d=n.units[0],h="x"===e?l.padding.l+l.padding.r:l.padding.b+l.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,u).isEmpty()){var p,g=2*(l.label&&l.label.fontSize?l.label.fontSize:10),m=t.getScaleInfo(c,u);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,u);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=Yt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),o=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,o)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var w=t.getScaleInfo(c,u);return h+i(w,f)}var _=function(t,e){return t.reduce(function(t,n){var r=(n.key||{})[e];return t[r]=t[r]||[],t[r].push(n),t},{})}(n.frames,r[s].dim),S=Object.keys(_).map(function(t){return _[t].map(function(t){return o(e,t.units[0],a,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,S)},a=e.settings.size,u=a.width,c=a.height,s=Xn[n];if(s){var l=s(a,o,e,Wn.optimizeXAxisLabel);u=l.newW,c=l.newH}return e.settings.size=function(n,r,i){var o=e.settings.getScrollbarSize(t.getLayout().contentContainer),a=r.width>n.width&&r.width<=n.width*i?n.width:r.width,u=r.height>n.height&&r.height<=n.height*i?n.height:r.height,c=n.width-a,s=n.height-u>=0?0:o.width;return{height:u-(c>=0?0:o.height),width:a-s}}(a,{width:u,height:c},e.settings.avoidScrollAtRatio),e},t}(),Vn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&zt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],o=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),o.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var a=function(e){return t.scales[e]},u=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},c=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},s=i.map(a).filter(u),l=o.map(a).filter(u);if([s.length,l.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(c).length&&(n.forEach(d),n[0].ratio=Ft(t,n.map(f),e))};h("x",s),h("y",l)}},t}(),$n=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&zt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},o=[],a=[];mt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var u=t.guide,c=u.padding||{l:0,r:0,t:0,b:0},s=u.paddingNoTicks||{l:0,b:0};return r.l+=c.l,r.r+=c.r,r.t+=c.t,r.b+=c.b,i.l+=s.l,i.b+=s.b,o.push(Object.assign({},r)),a.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=o.pop(),u=a.pop(),c=t.guide||{};c.x=c.x||{},c.x.padding=c.x.padding||0,c.x.paddingNoTicks=c.x.paddingNoTicks||0,c.y=c.y||{},c.y.padding=c.y.padding||0,c.y.paddingNoTicks=c.y.paddingNoTicks||0,c.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},c.paddingNoTicks={l:0,b:0},c.autoLayout="extract-axes",c.x.padding+=r.b-e.b,c.y.padding+=r.l-e.l,c.x.paddingNoTicks+=i.b-u.b,c.y.paddingNoTicks+=i.l-u.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Jn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,o=void 0===i?Number.MAX_SAFE_INTEGER:i,a=e.syncInterval,u=void 0===a?Number.MAX_SAFE_INTEGER:a,c=e.callbacks,s=void 0===c?{}:c,l=this;this.setTimeoutDuration(o),this.setSyncInterval(u),this.setCallbacks(s),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(l._running&&l._requestedFrameId){var t=l._getCancelFrameFunction(),e=l._getRequestFrameFunction();t(l._requestedFrameId),l._requestedFrameId=e(l._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,o=0,a=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=o>a)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,o+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t.runnersInProgress=0,t}(),Kn=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zn=function(){return(Zn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var l=s.findIndex(function(t){return t.closest.distance!==s[0].closest.distance||t.closest.secondaryDistance!==s[0].closest.secondaryDistance}),f=l<0?s:s.slice(0,l);if(1===f.length)o=f[0].closest.data,a=f[0].closest.node,u=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;o=m.data,a=m.node,u=f[g].unit}}c.forEach(function(e){return e.unit.fire(i,{event:t,data:o,node:a,unit:u})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=Qn.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(a.event)}}:function(e){return function(){var n=a.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new Jn({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=Qn.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=me(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ye(this._layout.rightSidebarContainer,"vertical");var o=Object.assign({},e)||{};if(!o.width||!o.height){var a=r.parentElement,u=a.scrollLeft,c=a.scrollTop;r.style.display="none",o=Kt(o,xe(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=u,r.parentElement.scrollTop=c,o.height||(o.height=xe(this._layout.layout).height)}this.configGPL.settings.size=o},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=kt(Zt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new Ge(t,this.getScaleFactory(),Qe,M),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=Qn.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=Qn.select(this._layout.content),o=n[0].config.uid,a=tr(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));a.attr("class")||a.attr("class",qe+"svg"),this._svg=a.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var u=a.selectAll("g.frame-root").data([o],function(t){return t});u.enter().append("g").classed(qe+"cell cell frame-root uid_"+o,!0).merge(u).call(function(t){t.classed("tau-active",!0),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),u.exit().call(function(t){t.classed("tau-active",!1),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ye(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ye(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=Qn.select(this._layout.header),e=tr(t,"div."+qe+"progress");e.select("div."+qe+"progress__value").remove();var n=e.append("div").classed(qe+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(qe+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(qe+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(qe+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new rn(nn.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=Xt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var o=n[i],a=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:o.dims,data:o.data.filter(a)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,o=Math.round(100/3/1.5),a=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+qe+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+qe+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=er(this._layout.content,"."+qe+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(d),rr={},ir={},or=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(rr).join(", ")+"."),new w(e,_.NOT_SUPPORTED_TYPE_CHART)},ar={validate:function(t,e){return ir.hasOwnProperty(t)||or(t),ir[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=rr[t];return"function"!=typeof e&&or(t),e},add:function(t,e,n){return void 0===n&&(n=[]),rr[t]=e,ir[t]=n,ar},getAllRegisteredTypes:function(){return rr}},ur=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),cr=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return ur(e,t),e.prototype.applyConfig=function(e){var n=ar.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=ar.get(e.type);(e=Kt(e,{autoResize:!0})).settings=nr.setupSettings(e.settings),e.dimensions=nr.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(nr);function sr(t){return t}cr.winAware=[],cr.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=cr.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=l?b.filter(function(t){return 0==t}):[]);var w=null==u?n.tickFormat?n.tickFormat(a):sr:u,_=Math.max(c,0)+s,S=n.range(),M=S[0]+.5,O=S[S.length-1]+.5,A=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:sr)(n);if(r.facetAxis){var k=A;A=function(t){return k(t)-n.stepSize(t)/2}}var E=o.selection?o:null,T=E?E.selection():o,C=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(T).getBoundingClientRect();function N(t){var n=Ht(r.rotate);if(t.attr("transform",Ne(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,o=h?.5:-2,a=e===hr.top||e===hr.left?-1:1,u=o*(e===hr.top||e===hr.bottom?a<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:u+"em").attr("dy",u+"em")}}function L(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?tt(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):Q(t,i)}function j(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,o=[];t.each(function(){var t=K.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),a=t.select("text"),u=a.node().getBBox().width/2,c=n-u,s=n+u;o.push({c:n,s:c,e:s,l:0,textRef:a,tickRef:t})}),function(t,e){t.map(function(t,n,r){return e(r[n-1]||{e:-1/0,s:-1/0,l:0},t,r[n+1]||{e:1/0,s:1/0,l:0})})}(o.sort(function(t,e){return t.c-e.c}),function(t,r,i){var o=t.e>r.s,a=i.s1&&(c=c.replace(/([\.]*$)/gi,"")+"...");var s=11*r.l,l=e?parseFloat(r.textRef.attr("y"))+s:0,f=e?0:s,d=e?s:0,h=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?c:""}).attr("transform","translate("+f+","+d+") rotate("+h+")");var p={x1:0,x2:0,y1:l+(e?-1:5),y2:n};e||(p.transform="rotate(-90)"),Me(r.tickRef,"line.label-ref").call(st(p))}else r.tickRef.selectAll("line.label-ref").remove();return r})}(t,h)}T.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===hr.right?"start":e===hr.left?"end":"middle"),l||function(){var t=r.hideTicks||r.hide?[]:[null];se(T.selectAll(".domain").data(t)).then(function(t){return E&&t.exit().transition(E).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr("d",e===hr.left||e==hr.right?"M"+p*c+","+M+"H0.5V"+O+"H"+p*c:"M"+M+","+p*c+"V0.5H"+O+"V"+p*c)})}();var P=se(T.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,o=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&o})}return t}).result();!function(t){se(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return E?(e.attr("opacity",lr).attr("transform",function(t){var e=A(t);return y(e)}),{tick:r.transition(E),tickExit:n.transition(E).attr("opacity",lr).attr("transform",function(t){var e=A(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(A(t))})})}(P),r.facetAxis||function(t){var e=p*c,r=d?function(t){return v*n.stepSize(t)/2}:null;se(t).then(function(t){var n=t.tick,i=t.tickEnter,o=n.select("line"),a=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&a.attr(g+"1",r).attr(g+"2",r),o.merge(a)}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(P),d&&l&&d&&b&&b.length&&se(T.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr(g+"1",M).attr(g+"2",M).attr(m+"1",0).attr(m+"2",p*c)}),l||(function(i){var o=r.textAnchor,a=p*_,u=e===hr.top?"0em":e===hr.bottom?"0.71em":"0.32em";function c(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}se(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,a).attr("dy",u);return N(i),c(i),r.merge(i)}).then(function(t){if(t.text(w).attr("text-anchor",o),!1===h&&!0===r.facetAxis){var e=je(T.node().parentNode.getAttribute("transform"));L(t,C.width-Math.abs(e.x))}else L(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",o=i.length;o>e&&(e=o,n=r)});var i=A(b[1])-A(b[0]),o=!1;if(n>=0){var a=r[n].getBoundingClientRect();o=i-a.width<8}T.classed(qe+"time-axis-overflow",o)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=T.append("line").attr("x1",A(e)).attr("x2",A(e)).attr("y1",0).attr("y2",1),i=T.append("line").attr("x1",A(n)).attr("x2",A(n)).attr("y1",0).attr("y2",1),o={left:r.node().getBoundingClientRect().left-C.left,right:C.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var a=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",a=(A(n),o[i]),u=Math.ceil(r.width/2-a+1);t.setAttribute("dx",String(u>0?-e*u:0))},u=t.filter(function(t){return t===e}).node(),c=t.filter(function(t){return t===n}).node();t.attr("dx",null),a(u,-1,e),a(c,1,n)}}(t),t}).then(function(t){return E?t.transition(E):t}).then(function(t){t.attr(m,a),N(t),c(t),d&&r.avoidCollisions&&!r.facetAxis&&(E?E.on("end.fixTickTextCollision",function(){return j(i.tick)}):j(i.tick))})}(P),i.hide||function(){var t=i,e=Me(T,"text.label").attr("class",Ee("label",t.cssClass)).attr("transform",Ne(t.rotate)).attr("text-anchor",t.textAnchor);se(e).then(function(t){return E?t.transition(E):t}).then(function(e){var n=v*t.padding,r=Math.abs(O-M),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function gr(t){return pr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var mr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yr=Me,vr=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},br=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Kt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Kt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Kt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Kt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Kt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var o=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(o)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var a=n.config.options,u=n.config.guide.padding;return n.L=a.left+u.l,n.T=a.top+u.t,n.W=a.width-(u.l+u.r),n.H=a.height-(u.t+u.b),n}return mr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?et(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Ce(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var o="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,o,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var a="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,a,i)}var u=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),c=this._drawGrid(n.container,e,r,i,n),s=ut(c,".cell").data(u,function(t){return t});s.enter().append("g").attr("class",function(t){return qe+"cell cell uid_"+t}).merge(s).classed("tau-active",!0),et(s,this.config.guide.animationSpeed).attr("opacity",1),et(s.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=_n.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),a=function(t){return pr(t)}({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?vr(r/e.guide.density):null,tickFormat:i||null,position:n}),u=this.config.guide.animationSpeed;yr(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=et(t,u,"axisTransition"),r=t.attr("transform");Ce.apply(o,n)!==r&&(r?e:t).attr("transform",Ce.apply(o,n)),e.call(a),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=ut(t,this._getAxisSelector(e)).classed("tau-active",!1);et(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===Le(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return yr(t,"g.grid").attr("transform",Ce(0,0)).call(function(t){var o=t,a=i.config.guide.animationSpeed,u=(e.guide.showGridLines||"").toLowerCase();if(u.length>0){var c=yr(o,"g.grid-lines");if(u.indexOf("x")>-1){var s=e.x,l=_n.get(s.guide.tickFormat),f=gr({scale:s.scaleObj,scaleGuide:s.guide,tickSize:r,ticksCount:l?vr(n/s.guide.density):null}),d=yr(c,"g.grid-lines-x");et(d,a).call(f)}if(u.indexOf("y")>-1){var h=e.y,p=(l=_n.get(h.guide.tickFormat),gr({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:l?vr(r/h.guide.density):null})),g=yr(c,"g.grid-lines-y");et(g,a).call(p)}}})},e}(g),xr=n(11),wr=n(8),_r=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Sr=function(){return(Sr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var o=n[t].map(r[t].invert);e=[o[0],o[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",u)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=Mr.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",u).on("brush",s).on("end",c),Mr.select(this).classed("brush-"+Pt(t),!0).call(i[t]),o=!1,i[t].move(Mr.select(this),e),o=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],o=[];if(n[r].discrete){var a=i.map(n[r]).filter(function(t){return t>=0}),u=n[r].stepSize()/2;o=[Math.min.apply(Math,a)-u,Math.max.apply(Math,a)+u]}else o=[i[0],i[1]];var c=Pt(r);e[r](Mr.select(".brush-"+c)),e[r].move(Mr.select(".brush-"+c),o.map(n[r]))})},e}(g),Ar=n(12);var kr=n(4),Er=function(){var t,e=[],n=[],r=1,i=1,o={},a=!1,u=function(t){var r=e.length,i=0,o=e[t].x-n[t].x,a=n[t].y-e[t].y,u=Math.sqrt(o*o+a*a);u>0&&(i+=.2*u),a/=u,i+=(o/=u)>0&&a>0?0:o<0&&a>0?3:o<0&&a<0?6:9;for(var c,s,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[s].x=l),e[s].x<0&&(e[s].x=l),e[s].y>i&&(e[s].y=f),e[s].y<0&&(e[s].y=f);var d=(a?t(s,e,n):u(s))-c;Math.random()r&&(e[s].x=l),e[s].x<0&&(e[s].x=l),e[s].y>i&&(e[s].y=f),e[s].y<0&&(e[s].y=f);var y=(a?t(s,e,n):u(s))-c;Math.random()1||s<0||s>1)},f=function(t,e,n){return t-e/n};return o.start=function(t){for(var n=e.length,r=1,i=0;i=200&&n.status<300){var t=n.responseText;try{e(null,JSON.parse(t))}catch(t){e(t,null)}}else e(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){e(t.error,null)},n.open("GET",t,!0),n.send(null)}(n.sourcemap,function(n,r){if(n)throw n;e._drawMap(t,r)}):this._drawMap(t,n.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,o={};return e.forEach(function(e){var a=(kr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},o=n.centroid(t),a=n.bounds(t),u=o[0],c=o[1],s=a[1][0]-a[0][0],l=i.name||"",f=i.abbr||l,d=s<5.5*l.length?f:l,h=s<13.75,p=h?r-u-16.5:0;return{id:e+"-"+t.id,sx:u,sy:c,x:u+p,y:c,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),u=a.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Er().label(a).anchor(u).width(r).height(i).start(10),a.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},o);var c=a.filter(function(t){return t.isRef});c.length<6&&c.reduce(function(t,e){return t[e.id]=e,t},o)}),o},e.prototype._drawMap=function(t,e){var n,r,i=this,o=this,u=this.config.guide,c=this.config.options,s=this.config.options.container,l=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=Lr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,l.dim&&f.dim){var b=Nr.extent(l.domain()),x=Nr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var w=this._createProjection(e,v[0],r),_=Nr.geoPath().projection(w),S=s.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});S.exit().remove();var M=S.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(u.showNames&&(r=o._calcLabels(e,i,_)),i.forEach(function(t,i){var o=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(kr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",_),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=o(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=o(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=o(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=o(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=o(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=o(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var a=kr.feature(e,e.objects.places),c=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),s=a.features.map(function(t){var e=w(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Er().label(c).anchor(s).width(m).height(y).start(100),n.selectAll(".place").data(s).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(c).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(S);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var O=this._resolveFeature.bind(this);if(M.selectAll(".map-contour-"+n).data(kr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=O(t);return null===e?u.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:O(t),event:a.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:O(t),event:a.event})}).on("click",function(t){return i.fire("area-click",{data:O(t),event:a.event})}),!l.dim||!f.dim)return[];var A=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+w([e[f.dim],e[l.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return o.fire("point-mouseover",{data:e,event:a.event})}).on("mouseout",function(t){var e=t.data;return o.fire("point-mouseout",{data:e,event:a.event})}).on("click",function(t){var e=t.data;return o.fire("point-click",{data:e,event:a.event})})},k=M.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return k.exit().remove(),k.enter().append("g").merge(k).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:c.uid}})});e.exit().remove(),e.call(A),e.enter().append("circle").call(A)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var o=r[i[0]].toLowerCase();e=n[o]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,o=this.config.guide,a=100,u=[r/2,i/2],c=n||t.center,s=o.projection||t.projection||"mercator",l=this._createD3Projection(s,c,a,u),f=Nr.geoPath().projection(l).bounds(kr.feature(t,t.objects[e])),d=a*r/(f[1][0]-f[0][0]),h=a*i/(f[1][1]-f[0][1]);return a=d=0},Wr=function(t,e){return!t.discrete&&e[t.dim]<0},Hr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/Ir(t,e))},Ur=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/Ir(t,e))},Gr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dx(n);if("-"===t[2]&&!Wr(r,n))return e.dx(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*o*e.model.size(n)/2+i*Hr(e,n)}}}},qr=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dy(n);if("-"===t[2]&&!Wr(r,n))return e.dy(n);var i=t[1],o=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*o*e.model.size(n)/2+i*Ur(e,n)}}}};Rr.regRule("l",Gr(["l",-1,null])).regRule("L",Gr(["L",-1,null])).regRule("l+",Gr(["l",-1,"+"])).regRule("l-",Gr(["l",-1,"-"])).regRule("L+",Gr(["L",-1,"+"])).regRule("L-",Gr(["L",-1,"-"])).regRule("r",Gr(["r",1,null])).regRule("R",Gr(["R",1,null])).regRule("r+",Gr(["r",1,"+"])).regRule("r-",Gr(["r",1,"-"])).regRule("R+",Gr(["R",1,"+"])).regRule("R-",Gr(["R",1,"-"])).regRule("t",qr(["t",-1,null])).regRule("T",qr(["T",-1,null])).regRule("t+",qr(["t",-1,"+"])).regRule("t-",qr(["t",-1,"-"])).regRule("T+",qr(["T",-1,"+"])).regRule("T-",qr(["T",-1,"-"])).regRule("b",qr(["b",1,null])).regRule("B",qr(["B",1,null])).regRule("b+",qr(["b",1,"+"])).regRule("b-",qr(["b",1,"-"])).regRule("B+",qr(["B",1,"+"])).regRule("B-",qr(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var o=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*o-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Rr.getRule("from-beginning"),Rr.getRule("towards"),Rr.getRule("cut-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Rr.getRule("to-end"),Rr.getRule("towards"),Rr.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Rr.getRule("from-beginning"),Rr.getRule("towards"),Rr.getRule("cut-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Rr.getRule("to-end"),Rr.getRule("towards"),Rr.getRule("cut-outer-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Rr.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+u;var c=a-n;return c>0?r-c:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,o=t.h(e),a=i+o/2;if(0-(i-o/2)>0)return 0;var u=a-r;return u>0?n-u:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),o=t.x(e)+t.dx(e),a=t.y(e)+t.dy(e);return!(!Gt(o,t.w(e),i,n)&&!qt(a,t.h(e),i,r))||t.hide(e)}}});var Xr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),o=i-r,a=o<0?1:Math.exp(-o/t);Math.random()>=a?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(l,d):l;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});l.text=l.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(l.text,c):l.text,l.text=l.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(l.text,c):l.text,l.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(l.text,l.edges):l.text,l.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(l.text):l.text,l.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(l.text):l.text;var p=l.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),w=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=a.select(this),r=v(t,e);n.text(null),x(t,e).split(o).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var o=e.getLabelRect(t),a=e.getLabelRect(i),u=Number(!t.hide&&!i.hide);if(u*Math.max(0,Math.min(a.x1,o.x1)-Math.max(o.x0,a.x0))*(u*Math.max(0,Math.min(a.y1,o.y1)-Math.max(o.y0,a.y0)))>0){var c=[t,i];c.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[c[0].extr+"/"+c[1].extr](c[0],c[1])<0?c[0]:c[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+c||ur.bottom+c)return null;var s=(i.find(a,u)||[]).map(function(t){var e=Math.sqrt(Math.pow(a-t.x,2)+Math.pow(u-t.y,2));if(e>c)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):ci(t.size>e.size?t:e)}function li(t,e,n,r){var i=function(t,e,n,r){var i=hi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var o=function(i){var o=i?[r,n,e,t]:[t,e,n,r],a=gi.apply(void 0,[1/12*2].concat(o)),u=gi.apply(void 0,[.5].concat(a.slice(0,4))),c=u[3],s=u[6],l=yi(o[0],c),f=yi(c,s),d=[l.left[0],E(.5,l.left[1],f.left[0]),f.left[1]],h=[l.right[0],E(.5,l.right[1],f.right[0]),f.right[1]],p=mi.apply(void 0,d)[1],g=mi.apply(void 0,h)[1],m=E(4,l.left[0],p),y=E(4,l.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},a=o(!1),u=o(!0);return{left:a.left.concat(u.left),right:a.right.concat(u.right)}}(t,e,n,r);if(!i)return si(t,r);var o=di(fi(t,i.right[0]),fi(t,i.left[0])),a=di(fi(r,i.right[1]),fi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(o>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(a>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function fi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function di(t,e){return e1?[t]:[]},d);l.exit().remove(),l.call(u(n.animationSpeed,o.pathAttributesUpdateInit,o.pathAttributesUpdateDone,o.afterPathUpdate));l.enter().append(o.pathElement).call(u(n.animationSpeed,o.pathAttributesEnterInit,o.pathAttributesEnterDone,o.afterPathUpdate)).merge(l).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(0)}),et(t,e.guide.animationSpeed,"pathTransition").attrTween(o.pathTween.attr,o.pathTween.fn)):t.attr(o.pathTween.attr,function(t){return o.pathTween.fn.call(this,t)(1)})});if(t.subscribe(s),"never"!==n.showAnchors){var f=function(t,e,n){var r=e.anchorShape,i=t.config.guide,o=t.screenModel,a=vi({},bi[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return o.color(t)},class:"i-data-anchor"}),u=n.selectAll(".i-data-anchor").data(function(t){return t.filter(ii)},o.id);return u.exit().remove(),u.call(at(i.animationSpeed,null,a)),u.enter().append(bi[e.anchorShape].element).call(at(i.animationSpeed,{r:0},a)).merge(u)}(t,o,r);t.subscribe(f)}},s=i.toFibers(),l=s.map(function(t){return t.filter(ii)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,o=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var a,u=t.map(function(t){return i.id(t)}),c=(Array.from(n.entries()).find(function(t){var e=t[1];return u.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return a=c?e.get(c):++o,r.set(t,a),a}}();this._getDataSetId=d;var h=f.data(s,d);h.exit().remove(),h.call(c),h.enter().append("g").attr("data-id",d).call(c),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new Kr(i.model,e.flip,e.guide.label,r).draw(l))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=a.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Yt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.y===e}:function(e){return t.x===e});u[e].push(t)});var c=function(t){if(1===t.length)return u[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:c(t.slice(0,e)),greater:c(t.slice(e))}};return{bounds:i,tree:c(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=Fe(o.node()),c=this.node().config.guide.maxHighlightDistance;if(tr.right+u.x+c||er.bottom+u.y+c)return null;var s=a?e-u.y:t-u.x,l=function t(e){return Array.isArray(e)?e:t(s>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),c=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:c,x:r,y:i}});return xi(t,e,l)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",o="tau-chart__dimmed",a=r.selectAll(".i-role-path"),u=a.data().filter(function(e){return e.filter(ii).some(t)}),c=u.length>0;a.call(lt(((e={})[i]=function(t){return c&&u.indexOf(t)>=0},e[o]=function(t){return c&&u.indexOf(t)<0},e)));var s=((n={})[i]=function(e){return!0===t(e)},n[o]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(lt(s)),r.selectAll(".i-role-label").call(lt(s)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,o="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(st(bi[r].getHighlightAttrs(t,e,n))).attr("opacity",o?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Ee("i-data-anchor",i.class(t))}).classed(qe+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,o=n.filter(t),a=r.select(".cursor-line");if(o.empty())a.remove();else{a.empty()&&(a=r.append("line"));var u=e.screenModel.model,c=u.xi(o.data()[0]),s=u.xi(o.data()[0]),l=u.scaleY.domain(),f=u.scaleY(l[0]),d=u.scaleY(l[1]);a.attr("class","cursor-line").attr("x1",i?f:c).attr("y1",i?c:f).attr("x2",i?d:s).attr("y2",i?s:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(ii).some(t))});var o=te(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),a={line:0,g:1,text:2};ke(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?o(t,e):a[t.tagName]-a[e.tagName]})}},Si=[1,2,3,4,5],Mi=Si.map(function(t){return qe+"line-opacity-"+t}),Oi=Si.map(function(t){return qe+"line-width-"+t});function Ai(t){return Mi[t-1]||Mi[4]}function ki(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Ei(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var Ti=function(){return(Ti=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Ci.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=o,e.pathAttributesUpdateDone=o;var a="polyline"===$(n.interpolate);return e.pathElement=a?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:a?"points":"d",fn:ct(0,a?ki:Ei,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=Ci.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n),y0:e.y0(n),group:e.group(n)}}),i=r.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Yt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),a=o.reduce(function(t,e){return t[e]=[],t},{});if(r.forEach(function(t){var e=o.find(n?function(e){return t.y===e}:function(e){return t.x===e});a[e].push(t)}),function(){var t=Object.keys(r.reduce(function(t,e){return t[e.group]=!0,t},{})),e=t.reduce(function(t,e,n){return t[e]=n,t},{});o.forEach(function(n){var r=a[n];if(r.sort(function(t,n){return e[t.group]-e[n.group]}),r.lengthr.right+u.x+c||er.bottom+u.y+c)return null;var s=a?e-u.y:t-u.x,l=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(s1&&(f=1);var d=function(){var t=l.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{});return l.items.end.forEach(function(e){void 0!==t[e.group]?t[e.group].end=e:delete t[e.group]}),Object.keys(t).forEach(function(e){var n=t[e];n.end?(n.y=n.start.y+f*(n.end.y-n.start.y),n.y0=n.start.y0+f*(n.end.y0-n.start.y0)):delete t[e]}),Object.keys(t).map(function(e){return t[e]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})}(),h=e-u.y,p=d.filter(function(t){return h>=t.y&&h<=t.y0}),g=(p.length>0?p:d).map(function(t){return t.el}).map(function(n){var r=n.x+u.x,i=n.y+u.y,o=Math.abs(a?e-i:t-r),c=Math.abs(a?t-r:e-i);return{node:n.node,data:n.data,distance:o,secondaryDistance:c,x:r,y:i}});return xi(t,e,g)}},Li={draw:_i.draw,getClosestElement:_i.getClosestElement,highlight:_i.highlight,highlightDataPoints:_i.highlightDataPoints,addInteraction:_i.addInteraction,_getBoundsInfo:_i._getBoundsInfo,_sortElements:_i._sortElements,init:function(t){var e=_i.init(t);return e.transformRules=[e.flip&&M.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Kt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),o=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return M.get("adjustStaticSizeScale")(t,o)}],e},buildModel:function(t){var e=_i.baseModel(t),n=this.node().config.guide,r=Ai(t.model.scaleColor.domain().length),i=qe+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var o={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=o,e.pathAttributesUpdateDone=o,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:ct(0,function(t,e){return function(n){return n.map(function(n){return[t(n),e(n)].join(",")}).join(" ")}}(function(t){return t.x},function(t){return t.y}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function ji(t){if(t.length<2)return"";for(var e="",n=0;n=160&&t<320?e=1:t>=320&&t<480?e=2:t>=480&&t<640?e=3:t>=640&&(e=4),Oi[e]}(r.width):"",a=Ai(t.model.scaleColor.domain().length),u=i?"line":"area",c=""+qe+u+" "+u+" i-role-path "+o+" "+a+" "+n.cssClass+" ",s=i?{stroke:function(t){return f.color(t[0])},class:"i-role-datum"}:{fill:function(t){return f.color(t[0])}},l="cubic"===$(n.interpolate)?i?Pi:ui:i?ji:ai,f=_i.baseModel(t),d=i?function(e){return{id:t.id(e),x:f.x(e),y:f.y(e)}}:function(e){return{id:t.id(e),x:f.x(e),y:f.y(e),size:f.size(e)}};return f.groupAttributes={class:function(t){return c+" "+f.class(t[0])+" frame"}},f.pathElement="path",f.anchorShape="circle",f.pathAttributesEnterInit=s,f.pathAttributesUpdateDone=s,f.pathTween={attr:"d",fn:ct(0,l,[d],t.id,n.interpolate)},f}},zi=function(t){return a.select(t).data()[0]},Ri={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Kt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Kt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Kt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&M.get("flip"),e.guide.obsoleteVerticalStackOrder&&M.get("obsoleteVerticalStackOrder"),e.stack&&M.get("stack"),r&&M.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Kt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return M.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return M.get("avoidScalesOverflow")(t,n)},e.stack&&M.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight(function(t,e){return function(n){return n===t||e}}(n.data,null))})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var o=r.guide.prettify,u="i-role-element i-role-datum bar "+qe+"bar",c=n.screenModel,s=this.buildModel(c,{prettify:o,minBarH:1,minBarW:1,baseCssClass:u}),l=at,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=c.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=s.class,v=Zt(s,"class"),b=i.container.selectAll(".bar").data(m,c.id);b.exit().classed("tau-removing",!0).call(l(r.guide.animationSpeed,null,((t={})[f]=function(){var t=a.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=a.select(t);e.classed("tau-removing")&&e.remove()})),b.call(l(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(l(r.guide.animationSpeed,(e={},e[d]=c[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",c[d+"0"]);n.subscribe(new Kr(c.model,c.model.flip,r.guide.label,i).draw(g));var w=function(){var t=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map);return function(e,n){return(t.get(zi(e))||-1)-(t.get(zi(n))||-1)}}();this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=zi(t),r=zi(e),i=s.width(n),o=s.width(r);if(i===o){var a=s.y(n),u=s.y(r);return a===u?w(t,e):a-u}return o-i}:function(t,e){var n=zi(t),r=zi(e),i=s.height(n),o=s.height(r);if(i===o){var a=s.x(n),u=s.x(r);return a===u?w(t,e):a-u}return o-i}:w;var _={rect:0,text:1};this._typeSorter=function(t,e){return _[t.tagName]-_[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,o=e.minBarW,a=e.baseCssClass,u=function(e){var n=t.size(e);return r&&(n=Math.max(o,n)),n},c=function(e){return e[t.model.scaleY.dim]};if(t.flip){var s=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*u(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var o=s(e),a=c(e),u=0;return 0===a&&(u=0),a>0&&(u=o),a<0&&(u=0-i),o0?n-i:n);return n},width:function(t){return u(t)},height:function(t){var e=l(t);return r&&(e=0===c(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return a+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;eu}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),o=Yt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),u=o.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=o.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});u[e].push(t)});var c=function(t){if(1===t.length)return u[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:c(t.slice(0,e)),greater:c(t.slice(e))}};return{bounds:i,tree:c(o)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,o=this.node().config.options.container,a=this.node().config.flip,u=Fe(o.node()),c=t-u.x,s=e-u.y,l=this.node().config.guide.maxHighlightDistance;if(cr.right+l||sr.bottom+l)return null;var f=a?s:c,d=a?c:s;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e=a?t.box.left:t.box.top,n=a?t.box.right:t.box.bottom,r=function(t,e,n){return t>=e&&t<=n}(d,e,n);if(!r&&Math.abs(d-e)>l&&Math.abs(d-n)>l)return null;var i=Math.abs(d-(t.invert!==a?n:e));return Object.assign(t,{distToValue:i,cursorInside:r})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(a?s-n:c-e),i=Math.abs(a?c-e:s-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(lt(r)),n.selectAll(".i-role-label").call(lt(r)),this._sortElements(function(e,n){return t(zi(e))-t(zi(n))},this._typeSorter,this._barsSorter)}},Di=n(14),Ii=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Kt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return Ii(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,o=this.color,a=Di.line(),u=function(t){t.attr("d",function(t){return a(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},c=function(t){t.attr("stroke",function(t){return o.toColor(o(t[o.dim]))}),t.attr("class",function(t){return qe+"__line line "+o.toClass(o(t[o.dim]))+" foreground"})},s=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(u),e.enter().append("path").attr("class","background line").call(u);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){u(t),c(t)}),n.enter().append("path").call(function(t){u(t),c(t)})},l=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});l.exit().remove(),l.call(s),l.enter().append("g").attr("class","lines-frame").call(s),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(g),Wi=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=$t(Jt(e.order,i),i)),this.vars=i;var o=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",o.every(Number.isInteger)).addField("originalSeries",function(){return o}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return function(t,e){return Pt([t,e].map(function(t){return JSON.stringify}).join(""))}(n.vars,e)},r.value=r,r},t.prototype.getVarSet=function(t,e){return Yt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),function(t){return"date"===t?function(t){return new Date(t).getTime()}:function(t){return t}}(e.dimType))},t}(),Hi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ui=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Hi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(Wi),Gi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qi=function(){return(qi=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,u.map(Math.abs));u=[-h,h]}r.vars=u}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",o).addField("toColor",It).addField("toClass",Bt),r}return Gi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Xi.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Ut(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!Tt(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Xi.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Xi.scaleLinear().domain(Dt(t.map(function(t){return t-0}),e.length)).range(e)},e}(Wi),Vi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},Ji=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,o=u.extent(r.vars),a=Number.isFinite(i.min)?i.min:o[0],c=Number.isFinite(i.max)?i.max:o[1];return r.vars=[Math.min.apply(Math,[a,o[0]].filter(Number.isFinite)),Math.max.apply(Math,[c,o[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Vi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Kt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,o=r.minSize,a=r.maxSize,u=$i[i],c=n.filter(function(t){return Number.isFinite(Number(t))});if(0===c.length)t=function(){return a};else{var s,l,f=Math.min.apply(Math,c),d=Math.max.apply(Math,c),h=u(Math.max(Math.abs(f),Math.abs(d),d-f));l=f<0?f:0,s=0===h?1:(a-o)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?o+u(e-l)*s:a}}return this.toBaseScale(t)},e}(Wi),Ki=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return Ki(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=c.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),o=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},a=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*o(e)},i*o(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return a[t]=r[t]}),a.stepSize=function(t){return o(t)*i},this.toBaseScale(a,t)},e}(Wi),Qi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),to=function(){return(to=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,o=eo.scalePoint().domain(n).range(t).padding(.5),a=eo.scalePoint().domain(r.map(String)).range(t).padding(.5),u=Math.max.apply(Math,t),c=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,u,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},s=function(t){var n=new Date(t),o=(e?e.cast(n):n).getTime();return i.ratio?u-r.slice(r.indexOf(o)+1).reduce(function(t,e){return t+u*c(e)},u*c(t)*.5):a(String(o))};return Object.keys(o).forEach(function(t){return s[t]=o[t]}),s.stepSize=function(t){return c(t)*u},this.toBaseScale(s,t)},e}(Wi),ro=n(15),io=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),oo=function(){return(oo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,o=(r?ao.scaleUtc:ao.scaleTime)().domain(n).range(t),a=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=o});return function(t,e,n){void 0===n&&(n=10);var r,i,o=Number(t[0]),a=Number(t[1]),u=Math.abs(a-o)/n,c=ao.bisector(function(t){return t.duration}).right(lo,u);if(c===lo.length)r=e?ao.utcYear:ao.timeYear,i=ao.tickStep(o/so.year.duration,a/so.year.duration,n);else if(c){var s=u/lo[c-1].duration,l=lo[c].duration/u,f=lo[sl&&(e=l),o(e)}}return Object.keys(o).forEach(function(t){return a[t]=o[t]}),a.stepSize=function(){return 0},this.toBaseScale(a,t)},e}(Wi);function co(t){return ao["time"+t[0].toUpperCase()+t.slice(1)]}var so={second:{duration:1e3,interval:ao.timeSecond,utc:ao.utcSecond},minute:{duration:6e4,interval:ao.timeMinute,utc:ao.utcMinute},hour:{duration:36e5,interval:ao.timeHour,utc:ao.utcHour},day:{duration:864e5,interval:ao.timeDay,utc:ao.utcDay},week:{duration:6048e5,interval:ao.timeWeek,utc:ao.utcWeek},month:{duration:2592e6,interval:ao.timeMonth,utc:ao.utcMonth},year:{duration:31536e6,interval:ao.timeYear,utc:ao.utcYear}},lo=function(){var t=function(t,e){return{time:t,step:e,duration:e*t.duration}};return[t(so.second,1),t(so.second,5),t(so.second,15),t(so.second,30),t(so.minute,1),t(so.minute,5),t(so.minute,15),t(so.minute,30),t(so.hour,1),t(so.hour,3),t(so.hour,6),t(so.hour,12),t(so.day,1),t(so.day,2),t(so.week,1),t(so.month,1),t(so.month,3),t(so.year,1)]}();var fo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ho=function(){return(ho=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(po.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(Wi),mo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yo=function(){return(yo=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),o=r.toExponential().split("e"),a=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),u=parseFloat(Math.ceil(Number(o[0]))+"e"+o[1]);return e?[a,u]:[-u,-a]}(o)),r.vars=o,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return mo(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;wo(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=vo.extent(e.domain()),i=Math.floor(xo(r[0])),o=Math.ceil(xo(r[1])),a=Math.ceil(10*(o-i)/(10*Math.ceil(t/10))),u=i;u<=o;u+=a)for(var c=1;c<=10;c++){var s=Math.pow(c,a)*Math.pow(10,u);(s=parseFloat(s.toExponential(0)))>=r[0]&&s<=r[1]&&n.push(s)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(vo.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(Wi);function xo(t){return Math.log(t)/Math.LN10}function wo(t){if(t[0]*t[1]<=0)throw new w("Logarithmic scale domain cannot cross zero.",_.INVALID_LOG_DOMAIN)}var _o,So=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mo=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return So(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(Wi),Oo=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ao=function(){return(Ao=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Ut(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),o=ko.scaleThreshold().domain(i).range(e);return this.toBaseScale(o)},e}(Wi),To=function(t){return t||null},Co=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},No=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Lo={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},jo=((_o={})[Lo.SUCCESS]=function(t){return t},_o[Lo.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},_o[Lo.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],o=t[i],a=t.filter(function(t){return t!==o});a.push(o);var u=n[i][r]||{},c=n[n.length-1][r]||{};return n[n.length-1][r]=u,n[i][r]=c,a},_o);function Po(t,e,n){return e.reduce(function(e,r,i){var o=t[r];return o?e.status!=Lo.FAIL&&("measure"===o.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==o.type&&1===e.countMeasureAxis?e.status=Lo.WARNING:e.countMeasureAxis>1&&(e.status=Lo.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Lo.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Lo.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function Fo(t){for(var e=Co(t.x),n=Co(t.y),r=Math.max(e.length,n.length),i=Co(t.guide||{},{}),o=r-i.length,a=0;a0;l--){var f=u.pop(),d=c.pop(),h=s.pop()||{};l===o?(a.x=f,a.y=d,a.unit.push(No(t,{x:To(f),y:To(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),a.guide=Kt(h,{x:{label:f},y:{label:d}})):a={type:"COORDS.RECT",x:To(f),y:To(d),unit:[a],guide:Kt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:a},e}var Ro=function(t){var e=Fo(t);return zo("ELEMENT.INTERVAL",e=function(t){var e=(t.flip?t.y:t.x).indexOf(t.color)>=0,n=t.guide[t.guide.length-1];return e&&!n.hasOwnProperty("enableColorToBarPosition")&&(n.enableColorToBarPosition=!1),t}(e))},Do=function(t){var e=Fo(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,o=t.y,a=i[i.length-1],u=i.slice(0,i.length-1),c=o[o.length-1],s=o.slice(0,o.length-1),l=t.color,f=u.concat(s).concat([l]).filter(function(t){return null!==t}),d=-1,h=[[[a].concat(f),c],[[c].concat(f),a]],p=null;return h.some(function(t,e){var i=t[0],o=t[1],a=on(n,i,[o]);return a.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+a.error.keyY+" values (e.g. "+a.error.errY.join(",")+")","for ("+a.error.keyX+" = "+a.error.valX+")."].join(" ")),a.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=sn(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),zo("ELEMENT.AREA",e)},Io=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),Bo=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new Io(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Wo={},Ho=function(){function t(){}return t.unit=function(t){return new Io(t)},t.spec=function(t){return new Bo(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Yo="2.6.5";e.default={GPL:Ge,Plot:nr,Chart:cr,api:qo,version:"2.6.5"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=o},function(t,e){t.exports=a},function(t,e){t.exports=u},function(t,e){t.exports=c},function(t,e,n){var r,i,o;!function(n,a){i=[],void 0===(o="function"==typeof(r=a)?r.apply(e,i):r)||(t.exports=o)}(0,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,o=i.documentElement,a=["top","bottom"];function u(t,e){for(var n in e)t[n]=e[n];return t}function c(t){var e=r.pageYOffset||o.scrollTop,n=r.pageXOffset||o.scrollLeft,i={left:0,right:0,top:0,bottom:0,width:0,height:0};if(function(t){return t&&null!=t.setInterval}(t))i.width=r.innerWidth||o.clientWidth,i.height=r.innerHeight||o.clientHeight;else{if(!o.contains(t)||null==t.getBoundingClientRect)return i;u(i,t.getBoundingClientRect()),i.width=i.right-i.left,i.height=i.bottom-i.top}return i.top=i.top+e-o.clientTop,i.left=i.left+n-o.clientLeft,i.right=i.left+i.width,i.bottom=i.top+i.height,i}var s=function(t,e){return r.getComputedStyle(t)[e]};function l(t){var e=String(s(t,l.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}l.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-o<=e.left?i[0]="right":t.right+this.width+o>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:c(t),o=this.spacing,a=this._pickPlace(i);switch(a!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(a),this.curPlace=a),this.curPlace){case"top":n=i.top-this.height-o,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-o,r=i.right-this.width;break;case"top-right":n=i.top-this.height-o,r=i.left;break;case"bottom":n=i.bottom+o,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+o,r=i.right-this.width;break;case"bottom-right":n=i.bottom+o,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-o;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-o;break;case"left-bottom":n=i.top,r=i.left-this.width-o;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+o;break;case"right-top":n=i.bottom-this.height,r=i.right+o;break;case"right-bottom":n=i.top,r=i.right+o}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=l(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],o=0;o>>0,i=arguments[1],o=0;o0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),n)};return function(t){var n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var i,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!e(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(i=arguments[2])}for(var a,u=r(n.length),c=e(this)?Object(new this(u)):new Array(u),s=0;s=0?t.positive:t.negative,s=o[i]||0,u=s+a;return o[i]=u,{nextStack:u,prevStack:s}}},a=i({positive:{},negative:{}}),o=i({positive:{},negative:{}}),s=function(e){return Zt(e,t.id)},u=Number.MAX_VALUE,l=Number.MIN_VALUE,c=function(t){return u=tl?t:l,r.value(t)},f=s(function(t){return c(a(t).nextStack)}),d=s(function(t){return c(o(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=Yt(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxu)&&(e.min=u),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o=t.data(),s=function(t,e){return t-e},u=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,l=o.map(function(e){return t.xi(e)}).sort(s),c=l[0],f=l.slice(1).map(function(t){var e=t-c;return c=t,e}).filter(function(t){return t>0}).sort(s).concat(Number.MAX_VALUE)[0],d=Math.min(f,u),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(a,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:a};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=o.minSize,e.maxSize=o.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o=function(t,e){return t-e},s=t.data().map(function(e){return t.xi(e)}).sort(o),u=s[0],l=s.slice(1).map(function(t){var e=t-u;return u=t,e}).filter(function(t){return t>0}).sort(o).concat(Number.MAX_VALUE)[0],c=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,f=Math.min(l,c),d="number"==typeof n?n:i,h="number"==typeof r?r:a,p={minSize:d,maxSize:Math.max(d,Math.min(h,function(t){var e=(d+h)/2,n=h,r=d;return Math.round(e+(n-e)/(1+Math.exp(-(t-r)/.5)))}(f)))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,a=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},o=a(t.scaleX,"x"),s=a(t.scaleY,"y");if(o&&s)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var u=t.data().reduce(function(e,i){var a,u,l=t.size(i),c=(l>=n?l:n+l*(r-n))/2;return o||(a=t.xi(i),e.left=Math.min(e.left,a-c),e.right=Math.max(e.right,a+c)),s||(u=t.yi(i),e.top=Math.min(e.top,u-c),e.bottom=Math.max(e.bottom,u+c)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),l=function(e,n,r,i){var a=e.domain(),o=Math.abs(e.value(a[1])-e.value(a[0])),s=(a[1]-a[0])/o;if(0===o)return 1;var u=Math.max(0,-n),l=Math.max(0,r-o),c=t.flip?l:u,f=t.flip?u:l,d=Number(a[0])-(i?f:c)*s,h=Number(a[1])+(i?c:f)*s;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),a=i[0],o=i[1];(a>n||o=0?1:-1},d=function(e,n,r){var i=Yt(n,function(t){return t[s]}),a=n[0];return e.reduce(function(e,n){return e.concat(i[n]||function(e,n,r){var i,a=[e,t.id(n),r].join(" ");return(i={})[s]=e,i[u]=1e-10*r,i[c]=n[c],i[l]=n[l],i[M]=!0,i[M+"id"]=a,i}(n,a,r))},[])},h=function(t,e){return t-e},p=function(){return qt(o.reduce(function(t,e){return t.concat(e.map(function(t){return t[s]}))},[])).sort(h)},g=r?function(){var e=p(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),a=t.scaleX.domain(),o=b.generate(a[0],a[1],r,{utc:i}).filter(function(t){return t>=a[0]&&t<=a[1]}),s=0,u=[],l=b.get(r,{utc:i});return o.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=s;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,A(1/3,i,r),A(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var a=t.filter(function(t,e){return e%3==0}),o=e.filter(function(t,e){return e%3==0}),s=a.map(function(t){return t.id}),u=o.map(function(t){return t.id}),l=s.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),c=u.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=s.filter(function(t){return u.indexOf(t)>=0}),d=a.filter(function(t){return!t.positionIsBeingChanged}),h=o.filter(function(t){return!t.positionIsBeingChanged}),p=V(d,h),g=V(h,d),m=[];f.forEach(function(n,r){var i=l[n],a=c[n];if(0===r&&(i>0||a>0)&&m.push(P({polylineFrom:t.slice(0,i+1),polylineTo:e.slice(0,a+1),toOppositeScale:0===a?p:g,isCubic:!0})),r>0){var o=l[f[r-1]],s=c[f[r-1]];i-o>3||a-s>3?m.push(N({polylineFrom:t.slice(o,i+1),polylineTo:e.slice(s,a+1),isCubic:!0})):m.push(function(t){var e=t.polylineFrom,n=t.polylineTo;return function(t){return j(e.slice(1,3),n.slice(1,3),t)}}({polylineFrom:t.slice(o,i+1),polylineTo:e.slice(s,a+1)}))}m.push(L({pointFrom:t[i],pointTo:e[a]})),r===f.length-1&&(t.length-i-1>0||e.length-a-1>0)&&m.push(P({polylineFrom:t.slice(i),polylineTo:e.slice(a),toOppositeScale:e.length-a==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(R({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);F(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),a=t.filter(function(t){return!t.positionIsBeingChanged}),o=e.filter(function(t){return!t.positionIsBeingChanged}),s=V(a,o),u=V(o,a),l=[];i.forEach(function(a,o){var c=n.indexOf(a),f=r.indexOf(a);if(0===o&&(c>0||f>0)&&l.push(P({isCubic:!1,polylineFrom:t.slice(0,c+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?s:u})),o>0){var d=n.indexOf(i[o-1]),h=r.indexOf(i[o-1]);(c-d>1||f-h>1)&&l.push(N({isCubic:!1,polylineFrom:t.slice(d,c+1),polylineTo:e.slice(h,f+1)}))}l.push(L({pointFrom:t[c],pointTo:e[f]})),o===i.length-1&&(t.length-c-1>0||e.length-f-1>0)&&l.push(P({isCubic:!1,polylineFrom:t.slice(c),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?s:u}))}),0===l.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&l.push(R({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return l.forEach(function(n){var r=n(t);F(e,r)}),e}})(t,e)),r(i))}}function P(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,a=e.length>n.length?e:n,o=1===n.length,s=e[0].id!==n[0].id,u=Boolean(s!==o);return function(t){var e=(r?B:z)({t:t,polyline:a,decreasing:o,rightToLeft:u});o===u?e.shift():e.pop();var n=j(e.map(i),e,o?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function N(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,a=n.length;if(a!==i){var o=a2){var i=function(t,e){for(var n,r,i=[e[0]],a=0;a0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function F(t,e){return Array.prototype.push.apply(t,e)}function D(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function I(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=D(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function j(t,e,n){return t.map(function(t,r){return I(t,e[r],n)})}function z(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,a=Boolean(r)!==Boolean(i),o=function(t,e){var n=0;if(t>0){for(var r,i,a,o,s=[0],u=0,l=1;l0){for(var i,a,o,s,u,l,c,f,d=[0],h=0,p=1;p0;a--)if((e=o[a][t])!==r)return n=s[a][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function H(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function W(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=k(t,n,r,i,a);return[o[1],o[2],o[4],o[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(a).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(o[3][e]=D(n[e],a[e],t))}),o}function G(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:U(t[0].x,t[1].x,1/3),y:U(t[0].y,t[1].y,1/3)},{x:U(t[0].x,t[1].x,2/3),y:U(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,a,o,s,u,l,c,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=A(1/3,t[v-1],t[v]),m[3*v-1]=A(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:U(m[0].x,m[3].x,1/3),y:U(m[0].y,U(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:U(m[y].x,m[y-3].x,1/3),y:U(m[y].y,U(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==u>i.y&&(p=U(p*(g=(i.y-r.y)/(u-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==o0?[t,e].join(" "):e,u=n(i.text(s));if(us;if(c&&i){var f=Math.floor(s/l*u.length);t[t.length-1]=u.substr(0,f-4)+"...",p=!0}return c&&!i&&t.push(e),c||(t[t.length-1]=u),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return o(u,t,1.1,c,f,d,e)}),h.remove()})};var et=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=nt),t.onTransitionEnd=function(t){return at(this,t),this},t},nt=function(t,e){var n,r,i=this,a=J.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var o="__transitionAttrs__",s="__lastTransitions__",u=it();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[o]=Object.assign(this[o]||{},e),this[o][s]||Object.defineProperty(this[o],s,{value:{}}),Object.keys(e).forEach(function(e){return t[o][s][e]=u})});var l=function(){var t=this;this[o]&&(Object.keys(r).filter(function(e){return t[o][s][e]===u}).forEach(function(e){return delete t[o][e]}),0===Object.keys(this[o]).length&&delete this[o])};return this.on("interrupt."+u,function(){return i.each(l)}),this.on("end."+u,function(){return i.each(l)}),a},rt=0,it=function(){return++rt},at=function(t,e){if(J.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},ot=function(t,e,n,r){var i=r||function(t){return t},a=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(lt(Jt(e,n)))),i=(i=et(i,t)).call(lt(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(a)}):i.each(a),i}},st=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},ut=function(t,e,n,r,i){void 0===i&&(i="linear");var a="__pathPoints__";return function(t){var o=this;this[a]||(this[a]=n.map(function(){return[]}));var s=n.map(function(e,n){var s=qt(t,r).map(e),u=(Y(i)||Y("linear"))(s),l=o[a][n];return{pointsFrom:l,pointsTo:u,interpolate:O(l,u,$(i))}});return function(t){if(0===t){var n=s.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=s.map(function(t){return t.pointsTo});return o[a]=r,e.apply(void 0,r)}var i=s.map(function(e){return e.interpolate(t)});return o[a]=i,e.apply(void 0,i)}}},lt=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},ct=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dt=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Jt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,a=[e.flip&&S.get("flip"),r&&S.get("stack"),i&&S.get("positioningByColor")];return n.decorators=(n.config.transformRules||a).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return ft(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),a=this.getScale("size"),o=this.getScale("label"),s=this.getScale("color"),u=this.getScale("split"),l=this.getScale("identity"),c=i.domain(),f=i.discrete?c[0]:Math.max(0,Math.min.apply(Math,c)),d=i.value(f)+.5*i.stepSize(f),h=s.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:a,scaleLabel:o,scaleColor:s,scaleSplit:u,scaleIdentity:l,color:function(t){return s.value(t[s.dim])},label:function(t){return o.value(t[o.dim])},group:function(t){return t[s.dim]+"(@taucharts@)"+t[u.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return a.value(t[a.dim])},id:function(t){return l.value(t[l.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=Yt(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return function(t,e){var n=Math.pow(10,e);return Math.round(n*t)/n}(t.screenModel.size(e)/2,4)},r=ot,i=function(e,n,i){var a=t.config.guide.animationSpeed,s=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);s.exit().call(r(a,null,{width:0},function(t){return o.select(t).remove()})),s.call(r(a,null,i)),s.enter().append("rect").style("stroke-width",0).call(r(a,{width:0},i))},a=this.config.flip,s=a?"y":"x",u=a?"x":"y",l=a?"x0":"y0",c=a?"height":"width",f=a?"width":"height",d=function(e){var r,a,o;i(e,"lvl-top",((r={})[c]=function(t){return n(t)},r[f]=1,r[s]=function(e){return t.screenModel[s](e)-n(e)/2},r[u]=function(e){return t.screenModel[u](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((a={})[c]=function(t){return n(t)},a[f]=1,a[s]=function(e){return t.screenModel[s](e)-n(e)/2},a[u]=function(e){return t.screenModel[l](e)},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-btm "+t.screenModel.class(e)},a)),i(e,"lvl-link",((o={})[c]=.5,o[f]=function(e){return Math.abs(t.screenModel[u](e)-t.screenModel[l](e))},o[s]=function(e){return t.screenModel[s](e)-.25},o[u]=function(e){return Math.min(t.screenModel[u](e),t.screenModel[l](e))},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-link "+t.screenModel.class(e)},o))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=Yt(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(g),ht=function(){return(ht=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?function(t){return"object"==typeof t?JSON.parse(JSON.stringify(t)):t}(t.constructor.prototype):{}},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},_t={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},wt=/\\|'|\r|\n|\u2028|\u2029/g,Et="(?:"+Object.keys(xt).join("|")+")",St=RegExp(Et),Mt=RegExp(Et,"g"),Tt={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function Ct(t){return yt(t)}function At(t){return t instanceof Date&&!isNaN(Number(t))}function kt(t){return null!=t&&"object"==typeof t}function Ot(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),o=10/i*a,s=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],u=-1;o>s[++u][0];);a*=s[u][1],r[0]=Math.floor(r[0]/a)*a,r[1]=Math.ceil(r[1]/a)*a;var l=e-r[0],c=r[1]-n,f=a/2;if(e<0){var d=l>=f?-l:0;r[0]=r[0]-d}if(n>0){var h=c>=f?-c:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Pt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=pt.extent(t),a=i[0],o=i[1],s=+o-+a,u=r?pt.scaleUtc:pt.scaleTime;if(0===s){return a=new Date(a.getTime()-864e5),o=new Date(o.getTime()+864e5),u().domain([a,o]).nice(e).domain()}var l=u().domain([a,o]).nice(e);if(e)return l.domain();var c=u().domain([a,o]).nice(e).domain(),f=c[0],d=c[1],h=l.ticks(),p=h.length-1;return(+a-+f)/(+h[1]-+f)<.5&&(a=f),(+d-+o)/(+d-+h[p-1])<.5&&(o=d),[a,o]}var Nt=0,Lt={};function Rt(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return Lt.hasOwnProperty(e)||(Lt[e]="H"+ ++Nt),Lt[e]}function Ft(t,e,n){var r=0,i=null,a=Zt(function(t,e){return qt(t.map(function(t){return e.reduce(function(e,n){return e.concat(function(t){return At(t)?t.getTime():t}(t[n]))},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,o){var s=o.length,u=n.getSpec(),l=u.sources["/"].data,c=u.unit.units[0].guide||{};c.padding=c.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=c.padding.l+c.padding.r:"y"===t&&(f=c.padding.t+c.padding.b);var d=(i-s*f)/function(t){var e=a(l,t);return Object.keys(e).reduce(function(t,n){return t+e[n]},0)}(e);return(function(t,e){return a(l,t)[e]}(e,r)*d+f)/i}}function Dt(t){var e=!0;try{mt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function It(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],a=0;a=r&&n.apply(this,i),t.e=o.e,t.ts=o.ts}}function jt(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=e>=2?Wt(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(a,[r])}function zt(t){return vt(t)?t:""}function Bt(t){return vt(t)?"":t}function Vt(t){return t/180*Math.PI}function Ht(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Wt(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function Ut(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function Xt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return Xt(t)})):t}function qt(t,e){for(var n={},r=[],i=t.length,a=e||function(t){return String(t)},o=0;o/g,">").replace(/"/g,""").replace(/'/g,"'")}var ae=" ",oe=32,se=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function ue(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=Xt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],a=se[t];if(a&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var o="<"+t,s=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");s.length>oe&&(s=Object.keys(n).map(function(t){return"\n"+ae+t+'="'+n[t]+'"'}).join(""));var u=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+ae+t}).join("\n")}).join("\n")+"\n";return""+o+s+(a?"/>":">"+u+"")}function le(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var ce=[dt];function fe(t){return ce.some(function(e){return t instanceof e})}function de(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var he=document.createElement("div"),pe=new WeakMap;function ge(t,e){var n;return t instanceof Node?n=t:(he.insertAdjacentHTML("afterbegin",t),n=he.childNodes[0]),e.appendChild(n),n}function me(t){if(pe.has(t))return pe.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,pe.set(t,n),n}function ye(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=me(t),a=r?i.width+"px":"0",o=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+a+" "+o+" 0";var s=t.scrollWidth>t.clientWidth,u=t.scrollHeight>t.clientHeight,l=r&&!u?i.width+"px":"0",c=n&&!s?i.height+"px":"0";return t.style.padding="0 "+l+" "+c+" 0",t.style.overflow="",t.style.overflowX=s?"scroll":"hidden",t.style.overflowY=u?"scroll":"hidden",i}function ve(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function be(t,e){return parseInt(ve(t,e)||"0",10)}function xe(t){var e=be(t,"padding-left"),n=be(t,"padding-right"),r=be(t,"padding-bottom"),i=be(t,"padding-top"),a=be(t,"border-top-width")+be(t,"border-left-width")+be(t,"border-right-width")+be(t,"border-bottom-width"),o=t.getBoundingClientRect();return{width:o.width-e-n-2*a,height:o.height-r-i-2*a}}function _e(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var a=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*a,document.body.removeChild(e),r}function we(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a="string"==typeof n?n:n+"px",o=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Ee(t.charAt(e),{fontSize:a,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],s=t.length,u=parseInt(a);return{width:o,height:u*s+.39*u*s}}var Ee=Zt(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a=document.createElement("div");a.style.position="absolute",a.style.visibility="hidden",a.style.border="0px",a.style.top="0",a.style.fontSize=n,a.style.fontFamily=r,a.style.fontWeight=i,document.body.appendChild(a),a.innerHTML=" "===t?" ":t;var o={width:0,height:0},s=a.getBoundingClientRect();return o.width=s.right-s.left,o.height=s.bottom-s.top,document.body.removeChild(a),o},function(t,e){return t+"_"+JSON.stringify(e)});function Se(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,a=t instanceof Element,s=a?o.select(t):t,u=function(t){return a?t.node():t},l=s.selectAll(e).filter(function(){return this.parentNode===s.node()}).filter(function(t,e){return 0===e});if(!l.empty())return u(l);for(var c,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(c=e.substring(f+1,h),f<0?i=s.append(c):n[d].call(null,c,i),d=e[h],f=h);return u(i)}function Me(t,e){return Te(t,e)[0]||null}function Te(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function Ce(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),a=i.slice().sort(e),o=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),s=a.reduce(function(t,e,i){var s=o.get(e),u=i-s;return u!==r&&(n&&t.push(n),r=u,n={from:s,to:i,elements:[]}),n.elements.push(e),i===a.length-1&&t.push(n),t},[]),u=s.slice().sort(function(t,e){return t.from-e.from}),l=u.reduce(function(t,e,n){return t.set(e,n),t},new Map),c=function(t){for(var e,n,r,i=s.map(function(t,e){return{elements:t.elements,from:l.get(t),to:e}}).sort(te(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),a=0;an.to)for(e=a+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=c(!0),d=c(!1),h=f.length=0?"h":"v"}function Le(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Re(t,e,n,r,i,a,o,s){var u,l,c,f,d,h;return h=((c=o-i)*(e-a)-(f=s-a)*(t-i))/(-c*(l=r-e)+(u=n-t)*f),(d=(-l*(t-i)+u*(e-a))/(-c*l+u*f))>=0&&d<=1&&h>=0&&h<=1}function Fe(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=Le(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function De(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=o.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),a=i[i.length-1];if(a){var s=Array.prototype.indexOf.call(a.parentNode.childNodes,a),u=a.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>s||this.parentNode.insertBefore(this,u)})}}}var Ie=function(t){return At(t)?t.getTime():t},je={cross:function(t,e,n){var r=t(),i=qt(r.map(function(t){return t[e]}),Ie),a=qt(r.map(function(t){return t[n]}),Ie),o=0===i.length?[null]:i;return(0===a.length?[null]:a).reduce(function(t,r){return t.concat(o.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},cross_period:function(t,e,n,r,i,a){var o=t(),s=!!a&&a.utcTime,u=qt(o.map(function(t){return t[e]}),Ie),l=qt(o.map(function(t){return t[n]}),Ie),c=0===u.length?[null]:u,f=0===l.length?[null]:l;return r&&(c=b.generate(Math.min.apply(Math,u),Math.max.apply(Math,u),r,{utc:s})),i&&(f=b.generate(Math.min.apply(Math,l),Math.max.apply(Math,l),i,{utc:s})),f.reduce(function(t,r){return t.concat(c.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},groupBy:function(t,e){return qt(t().map(function(t){return t[e]}),Ie).map(function(t){var n;return(n={})[e]=Ie(t),n})},none:function(){return[null]}},ze=function(){function t(t,e,n){var r=t.key,i=t.pipe,a=t.source,o=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=a,this.units=o,this._frame={key:r,source:a,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Rt([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),Be=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ve=function(t){return At(t)?t.getTime():t},He=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},We=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return function(t,e){return void 0===e&&(e={}),Object.assign(new He(t),e)}(t,e(t,{}))},e)},Ge=function(t){function e(e,n,r,i){var a=t.call(this)||this;return Jt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},a.config=e,a.sources=e.sources,a.scales=e.scales,a.unitSet=r,a.grammarRules=i,a.scalesHub=n,a.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return Ve(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),a}return Be(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var a=[],o=function(t,e,n,r,i){a.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return o(i,e,n,t,r)})}),a.push(function(){return n(t,r,i)})};return o(t.unit,e,n,r,i),a},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new He(s.defineGrammarModel(o)),l=We(s.getGrammarRules(),u,n);return We(s.getAdjustScalesRules(),l,n),s.node().screenModel=s.createScreenModel(l),s}),i=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new He(s.defineGrammarModel(o)),l=We(s.getGrammarRules(),u,n);return s.node().screenModel=s.createScreenModel(l),s.parentUnit=t,s.addInteraction(),s});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],a=[t],o=e.traverseSpec({unit:this.root},function(t,e,o){t.uid=function(){var n=Rt((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(o.pipe));return r.hasOwnProperty(n)?n+="-"+ ++r[n]:r[n]=0,n}(),t.guide=Ct(t.guide);var s=n(a[0],t,o);i.push(s),0===t.type.indexOf("COORDS.")&&function(t){a.unshift(t)}(s)},function(t){0===t.type.indexOf("COORDS.")&&a.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return o.push(function(){return i}),o},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var a=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:a,source:i.source,units:t.units?t.units.map(function(t){var e=Ct(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var a=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[a],t).create("function"==typeof i?i(e.scales[a]):i)}},e.prototype._datify=function(t){return new ze(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",a=t.source,o=!1!==t.inherit,s=t.params,u={source:a,pipe:o?e:[]},l=je[i];if(!l)throw new Error(i+" operator is not supported");return{source:a,inherit:o,func:l,args:s,exec:function(){return l.apply(void 0,[function(){return r._datify(u).part()}].concat(s||[],[n]))}}},e}(d),Ue="tau-chart__",Xe=n(10),qe=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Xe.Tooltip.defaults.baseClass=Ue+"tooltip";var Ye=["top","bottom"];var $e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return qe(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e=function(t,e){return{top:e.top+t,right:e.right-t,bottom:e.bottom-t,left:e.left+t,width:e.width-2*t,height:e.height-2*t}}(0|this.options.winBound,function(){var t=window,e=document.documentElement,n=(t.pageYOffset||e.scrollTop)-e.clientTop,r=(t.pageXOffset||e.scrollLeft)-e.clientTop,i=t.innerWidth||e.clientWidth,a=t.innerHeight||e.clientHeight;return{top:n,right:r+i,bottom:n+a,left:r,width:i,height:a}}()),n=this.options.place.split("-"),r=this.spacing;if(-1!==Ye.indexOf(n[0]))switch(t.top-this.height-r<=e.top?n[0]="bottom":t.bottom+this.height+r>=e.bottom&&(n[0]="top"),n[1]){case"left":t.right-this.width<=e.left&&(n[1]="right");break;case"right":t.left+this.width>=e.right&&(n[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?n[1]="left":t.right-t.width/2-this.width/2<=e.left&&(n[1]="right")}else switch(t.left-this.width-r<=e.left?n[0]="right":t.right+this.width+r>=e.right&&(n[0]="left"),n[1]){case"top":t.bottom-this.height<=e.top&&(n[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(n[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?n[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(n[1]="bottom")}return n.join("-")},e}(Xe.Tooltip),Ke=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),Je={},Qe={},Ze={reg:function(t,e,n){return n?(Qe[t]=n,Je[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},Je[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):Je[t]=e,this},get:function(t){if(!Je.hasOwnProperty(t))throw new _("Unknown unit type: "+t,w.UNKNOWN_UNIT_TYPE);return Je[t]},create:function(t,e){var n,r=this.get(t);Qe[t]?n=new r(e,this.get(Qe[t])):n=new r(e);return n}},tn={},en={},nn={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),tn[t]=e,en[t]=n,nn},get:function(t){return tn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(nn.get(e))(n,(0,en[e])(r,t))}}}},rn=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,a=this.sources[r].data,o=e||new ze({source:r},a);return t.dimType=i,this.registry.create(t.type,o,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),an=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var a=function(t,e){var n=r[e],i=kt(n)?JSON.stringify(n):n;return t.push(i),t},o=e.reduce(a,[]).join("/"),s=n.reduce(a,[]).join("/");if(t.hasOwnProperty(o)){var u=t[o];if(u!==s)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:o,errY:[u,s]},new Error("RelationIsNotAFunction")}else t[o]=s;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},on=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},sn=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],a=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:a,scale:i.scale||e[a],value:i.value})}),n},un=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var a=function(t,e){var n=e;return At(t)?(n.type="measure",n.scale="time"):kt(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,Ct(e)),o=a.type,s=a.scale,u=null!==t[r].type&&t[r].type!==o;t[r].type=u?e.type:o,t[r].scale=u?e.scale:s}}),t},{})},ln=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},a=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(te(function(t,n){return i(t[e])-i(n[e])},function(t,e){return a.get(t)-a.get(e)}));else if(n.order){var o=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),s=n.order.length,u="(___"+e+"___)";r=t.map(function(t){var n=o[t[e]];return n=n>=0?n:s,t[u]=n,t}).sort(te(function(t,e){return t[u]-e[u]},function(t,e){return a.get(t)-a.get(e)})).map(function(t){return delete t[u],t})}return r},cn=function(t,e){var n=document.createElement("div");return n.classList.add(Ue+t),e&&e.appendChild(n),n},fn=function(){var t=cn("layout"),e=cn("layout__header",t),n=cn("layout__container",t),r=cn("layout__sidebar",n),i=cn("layout__content",n),a=cn("layout__content__wrap",i),o=cn("layout__sidebar-right",n);return{layout:t,header:e,content:a,contentContainer:i,leftSidebar:r,rightSidebar:cn("layout__sidebar-right__wrap",o),rightSidebarContainer:o,footer:cn("layout__footer",t)}},dn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Jt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Jt(t,{x:n.x,y:n.y});var r=Ct(n.guide)||{};t.guide.x=Jt(t.guide.x||{},r.x),t.guide.y=Jt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return kt(n)&&!At(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=Ct(Qt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(a){t.hasOwnProperty(a)&&(e[a]=r.scalesPool(a,t[a],i[a]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var a=this.spec.spec.dimensions,o={};if("color"===t&&null!==e&&(o={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(o.brewer=n.brewer),a[e]&&a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("nice")&&(o.nice=n.nice)),"size"===t&&null!==e&&(o={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(o.func=n.func),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("minSize")&&(o.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(o.maxSize=n.maxSize)),"label"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(o={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),a.hasOwnProperty(e)&&("x"===t||"y"===t)){if(o={type:a[e].scale,source:"/",dim:this.ruleInferDim(e,n)},a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("autoScale")?o.autoScale=n.autoScale:o.autoScale=!0,n.hasOwnProperty("nice")?o.nice=n.nice:o.nice=o.autoScale,n.hasOwnProperty("niceInterval")?o.niceInterval=n.niceInterval:o.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(o.period=n.tickPeriod,o.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){o.period=n.timeInterval,o.type="time";var s=b.get(o.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(o.min=s.cast(new Date(n.min))),n.hasOwnProperty("max")&&(o.max=s.cast(new Date(n.max)))}o.fitToFrameByDims=n.fitToFrameByDims,o.ratio=n.ratio}return this.dist.scales[i]=o,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},a=this.getScaleConfig("x",t.x),o=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=a.period||o.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),a.period,o.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),hn=n(6),pn=n(7),gn=function(){return(gn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(a))},kn=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),a=[n,r].join(":");return e[i]||e[a]||e[n]||null},On=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Pn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Nn=function(t,e){var n=t.width,r=t.height,i=Math.abs(Vt(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},Ln=function(t,e){void 0===e&&(e="x");var n=Ht(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]];return r[r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=Rn(c,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=Rn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),a&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=Rn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=u?0:1,g=l?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Nn(d,t.x.rotate),_=Nn(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=En([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=En([g*(e.yTickWidth+_.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),a&&(y.padding=0,y.paddingNoTicks=0);var w=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:En([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:En([t.y.padding,a?0:g*(e.yTickWidth+_.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:En([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:En([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*On(e,"xDensityPadding",n.dimType),tickFontHeight:c.height,$minimalDomain:o.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:_.height+2*On(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:s.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var Dn=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,a=t.allowYVertical,o=t.inlineLabels,s=n.dimension(e.x),u=n.dimension(e.y),l=n.scaleMeta(e.x,e.guide.x),c=n.scaleMeta(e.y,e.guide.y),f=l.isEmpty,d=c.isEmpty;e.guide.x.tickFormat=Pn(e.guide.x.tickFormat||kn(s,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Pn(e.guide.y.tickFormat||kn(u,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===s.dimType),p=!!a&&!("measure"===u.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=Ln(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=Ln(e.guide.y.rotate,"y"),e.guide=Fn(e.guide,r,l,c,o,de(e)),o){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},In={NONE:function(t,e,n){var r=Ct(t);return jn(Ct(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=Ct(t),r=[],i=[],a=null,o=null;gt(n.unit,"units",Cn,function(t,n){if(t.isLeaf)return n;!a&&n.x&&(a=n),!o&&n.y&&(o=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=kt(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=kt(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var s=n.guide.x.label.text;s&&(r.push(s),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+s,n.guide.x.label.text="",n.guide.x.label._original_text=s);var u=n.guide.y.label.text;return u&&(i.push(u),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+u,n.guide.y.label.text="",n.guide.y.label._original_text=u),n});return a&&(a.guide.x.label.text=a.guide.x.label.hide?"":r.join(" → ")),o&&(o.guide.y.label.text=o.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=Ct(t);return jn(Ct(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,a=e.scaleMeta(r.x,r.guide.x),o=e.scaleMeta(r.y,r.guide.y),s=!i&&Boolean(a.dimType)&&"measure"!==a.dimType;return r.guide.x.rotate=r.guide.x.rotate||(s?-90:0),r.guide.x.textAnchor=Ln(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||kn(a,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||kn(o,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Fn(r.guide,Jt({distToXAxisLabel:a.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:o.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),a,o,null,de(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=Ct(t);return jn(Ct(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?Dn({unit:r,meta:e,settings:Jt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,Dn({unit:r,meta:e,settings:Jt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return In[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return In[r](t,e,n)},t)}},jn=function(t,e,n){var r=function(t){return t.options=t.options||{},t.guide=t.guide||{},t.guide.padding=Jt(t.guide.padding||{},{l:0,b:0,r:0,t:0}),t.guide.x=Mn(t.guide,"x"),t.guide.x=Tn(t.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),t.guide.y=Mn(t.guide,"y",{rotate:-90}),t.guide.y=Tn(t.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),t.guide.size=Mn(t.guide,"size"),t.guide.color=Mn(t.guide,"color"),t}(e);r=n(Cn(r),r);var i=Qt(r=Sn(r,t),"units");return(r.units||[]).forEach(function(t){return jn(Ct(t),function(t,e){return t.guide=t.guide||{},t.guide.padding=t.guide.padding||{l:0,t:0,r:0,b:0},t.hasOwnProperty("units")||((t=Jt(t,e)).guide=Jt(t.guide,Ct(e.guide)),t.guide.x=Jt(t.guide.x,Ct(e.guide.x)),t.guide.y=Jt(t.guide.y,Ct(e.guide.y))),t}(t,i),n)}),r},zn=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],a=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:a.type,scaleType:i.type,values:e,isEmpty:null==a.type}}},a=(In[t]||In.NONE)({unit:Ct(n.unit)},i,e);return n.unit=a.unit,n},Bn=function(){function t(t){this.spec=t,this.isApplicable=Dt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return zn(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Vn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){de(t)&&"y"===n||(i[n].hideTicks=!0);var a=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=a?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(de(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),Hn=function(t){return t.$maxTickTextW},Wn=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},Gn=function(t){return t.density},Un=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),a=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==a&&n.push(a),t.units.forEach(r)}};r(t.unit);var i={},a={},o=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(a.hasOwnProperty(r)||(a[r]=[]),a[r].indexOf(t.key[r])<0&&a[r].push(t.key[r]))}),t.units&&t.units.forEach(o))})};return o(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(a).reduce(function(t,e){return t*a[e].length},1)}},Xn={"entire-view":function(t,e,n,r){var i=n.unit.guide,a=Un(n),o=a.xFacetCount,s=a.yFacetCount;s>0&&Vn.facetsLabelsAtTop(n.unit,n.settings);var u=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,l=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,c=i.paddingNoTicks&&t.height-lt.height||o*n.settings.minFacetWidth+u>t.width,f=i.paddingNoTicks&&t.width-ut.height||o*n.settings.minFacetWidth+u>t.width;c&&Vn.hideAxisTicks(n.unit,n.settings,"x"),f&&Vn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,Hn)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Wn);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,Gn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,Gn));return!c&&d>t.width&&Vn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Vn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,Gn),newH:e("y",n.unit,Gn)}},normal:function(t,e,n,r){Un(n).yFacetCount>0&&Vn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var s=Math.max(t.width,e("x",n.unit,Gn));a=Math.min(o,s)}}return{newW:a,newH:Math.max(t.height,e("y",n.unit,Gn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,a=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-at.width)&&Vn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,Hn)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,Gn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Vn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,Gn),newH:t.height}}},qn=function(){function t(t){this.spec=t,this.isApplicable=Dt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},a=function(e,n,o,s){void 0===s&&(s=null);var u="x"===e?n.x:n.y,l="x"===e?n.y:n.x,c=n.guide,f=o("x"===e?c.x:c.y),d=n.units[0],h="x"===e?c.padding.l+c.padding.r:c.padding.b+c.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,s).isEmpty()){var p,g=2*(c.label&&c.label.fontSize?c.label.fontSize:10),m=t.getScaleInfo(u,s);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,s);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=qt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),a=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,a)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var _=t.getScaleInfo(u,s);return h+i(_,f)}var w=function(t,e){return t.reduce(function(t,n){var r=(n.key||{})[e];return t[r]=t[r]||[],t[r].push(n),t},{})}(n.frames,r[l].dim),E=Object.keys(w).map(function(t){return w[t].map(function(t){return a(e,t.units[0],o,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,E)},o=e.settings.size,s=o.width,u=o.height,l=Xn[n];if(l){var c=l(o,a,e,Vn.optimizeXAxisLabel);s=c.newW,u=c.newH}return e.settings.size=function(n,r,i){var a=e.settings.getScrollbarSize(t.getLayout().contentContainer),o=r.width>n.width&&r.width<=n.width*i?n.width:r.width,s=r.height>n.height&&r.height<=n.height*i?n.height:r.height,u=n.width-o,l=n.height-s>=0?0:a.width;return{height:s-(u>=0?0:a.height),width:o-l}}(o,{width:s,height:u},e.settings.avoidScrollAtRatio),e},t}(),Yn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&Dt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],a=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),a.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var o=function(e){return t.scales[e]},s=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},u=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},l=i.map(o).filter(s),c=a.map(o).filter(s);if([l.length,c.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(u).length&&(n.forEach(d),n[0].ratio=Ft(t,n.map(f),e))};h("x",l),h("y",c)}},t}(),$n=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&Dt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},a=[],o=[];mt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var s=t.guide,u=s.padding||{l:0,r:0,t:0,b:0},l=s.paddingNoTicks||{l:0,b:0};return r.l+=u.l,r.r+=u.r,r.t+=u.t,r.b+=u.b,i.l+=l.l,i.b+=l.b,a.push(Object.assign({},r)),o.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=a.pop(),s=o.pop(),u=t.guide||{};u.x=u.x||{},u.x.padding=u.x.padding||0,u.x.paddingNoTicks=u.x.paddingNoTicks||0,u.y=u.y||{},u.y.padding=u.y.padding||0,u.y.paddingNoTicks=u.y.paddingNoTicks||0,u.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},u.paddingNoTicks={l:0,b:0},u.autoLayout="extract-axes",u.x.padding+=r.b-e.b,u.y.padding+=r.l-e.l,u.x.paddingNoTicks+=i.b-s.b,u.y.paddingNoTicks+=i.l-s.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Kn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,a=void 0===i?Number.MAX_SAFE_INTEGER:i,o=e.syncInterval,s=void 0===o?Number.MAX_SAFE_INTEGER:o,u=e.callbacks,l=void 0===u?{}:u,c=this;this.setTimeoutDuration(a),this.setSyncInterval(s),this.setCallbacks(l),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(c._running&&c._requestedFrameId){var t=c._getCancelFrameFunction(),e=c._getRequestFrameFunction();t(c._requestedFrameId),c._requestedFrameId=e(c._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,a=0,o=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=a>o)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,a+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t.runnersInProgress=0,t}(),Jn=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qn=function(){return(Qn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var c=l.findIndex(function(t){return t.closest.distance!==l[0].closest.distance||t.closest.secondaryDistance!==l[0].closest.secondaryDistance}),f=c<0?l:l.slice(0,c);if(1===f.length)a=f[0].closest.data,o=f[0].closest.node,s=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;a=m.data,o=m.node,s=f[g].unit}}u.forEach(function(e){return e.unit.fire(i,{event:t,data:a,node:o,unit:s})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=Zn.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(o.event)}}:function(e){return function(){var n=o.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new Kn({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=Zn.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=me(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ye(this._layout.rightSidebarContainer,"vertical");var a=Object.assign({},e)||{};if(!a.width||!a.height){var o=r.parentElement,s=o.scrollLeft,u=o.scrollTop;r.style.display="none",a=Jt(a,xe(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=s,r.parentElement.scrollTop=u,a.height||(a.height=xe(this._layout.layout).height)}this.configGPL.settings.size=a},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=Ct(Qt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new Ge(t,this.getScaleFactory(),Ze,S),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=Zn.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=Zn.select(this._layout.content),a=n[0].config.uid,o=tr(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));o.attr("class")||o.attr("class",Ue+"svg"),this._svg=o.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var s=o.selectAll("g.frame-root").data([a],function(t){return t});s.enter().append("g").classed(Ue+"cell cell frame-root uid_"+a,!0).merge(s).call(function(t){t.classed("tau-active",!0),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),s.exit().call(function(t){t.classed("tau-active",!1),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ye(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ye(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=Zn.select(this._layout.header),e=tr(t,"div."+Ue+"progress");e.select("div."+Ue+"progress__value").remove();var n=e.append("div").classed(Ue+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(Ue+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(Ue+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(Ue+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new rn(nn.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=Xt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var a=n[i],o=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:a.dims,data:a.data.filter(o)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,a=Math.round(100/3/1.5),o=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+Ue+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+Ue+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=er(this._layout.content,"."+Ue+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(d),rr={},ir={},ar=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(rr).join(", ")+"."),new _(e,w.NOT_SUPPORTED_TYPE_CHART)},or={validate:function(t,e){return ir.hasOwnProperty(t)||ar(t),ir[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=rr[t];return"function"!=typeof e&&ar(t),e},add:function(t,e,n){return void 0===n&&(n=[]),rr[t]=e,ir[t]=n,or},getAllRegisteredTypes:function(){return rr}},sr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ur=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return sr(e,t),e.prototype.applyConfig=function(e){var n=or.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=or.get(e.type);(e=Jt(e,{autoResize:!0})).settings=nr.setupSettings(e.settings),e.dimensions=nr.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(nr);function lr(t){return t}ur.winAware=[],ur.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=ur.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=c?b.filter(function(t){return 0==t}):[]);var _=null==s?n.tickFormat?n.tickFormat(o):lr:s,w=Math.max(u,0)+l,E=n.range(),S=E[0]+.5,M=E[E.length-1]+.5,T=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:lr)(n);if(r.facetAxis){var C=T;T=function(t){return C(t)-n.stepSize(t)/2}}var A=a.selection?a:null,k=A?A.selection():a,O=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(k).getBoundingClientRect();function P(t){var n=Ht(r.rotate);if(t.attr("transform",Pe(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,a=h?.5:-2,o=e===hr.top||e===hr.left?-1:1,s=a*(e===hr.top||e===hr.bottom?o<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:s+"em").attr("dy",s+"em")}}function N(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?tt(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):Z(t,i)}function L(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,a=[];t.each(function(){var t=J.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),o=t.select("text"),s=o.node().getBBox().width/2,u=n-s,l=n+s;a.push({c:n,s:u,e:l,l:0,textRef:o,tickRef:t})}),function(t,e){t.map(function(t,n,r){return e(r[n-1]||{e:-1/0,s:-1/0,l:0},t,r[n+1]||{e:1/0,s:1/0,l:0})})}(a.sort(function(t,e){return t.c-e.c}),function(t,r,i){var a=t.e>r.s,o=i.s1&&(u=u.replace(/([\.]*$)/gi,"")+"...");var l=11*r.l,c=e?parseFloat(r.textRef.attr("y"))+l:0,f=e?0:l,d=e?l:0,h=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?u:""}).attr("transform","translate("+f+","+d+") rotate("+h+")");var p={x1:0,x2:0,y1:c+(e?-1:5),y2:n};e||(p.transform="rotate(-90)"),Se(r.tickRef,"line.label-ref").call(lt(p))}else r.tickRef.selectAll("line.label-ref").remove();return r})}(t,h)}k.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===hr.right?"start":e===hr.left?"end":"middle"),c||function(){var t=r.hideTicks||r.hide?[]:[null];le(k.selectAll(".domain").data(t)).then(function(t){return A&&t.exit().transition(A).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr("d",e===hr.left||e==hr.right?"M"+p*u+","+S+"H0.5V"+M+"H"+p*u:"M"+S+","+p*u+"V0.5H"+M+"V"+p*u)})}();var R=le(k.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,a=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&a})}return t}).result();!function(t){le(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return A?(e.attr("opacity",cr).attr("transform",function(t){var e=T(t);return y(e)}),{tick:r.transition(A),tickExit:n.transition(A).attr("opacity",cr).attr("transform",function(t){var e=T(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(T(t))})})}(R),r.facetAxis||function(t){var e=p*u,r=d?function(t){return v*n.stepSize(t)/2}:null;le(t).then(function(t){var n=t.tick,i=t.tickEnter,a=n.select("line"),o=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&o.attr(g+"1",r).attr(g+"2",r),a.merge(o)}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(R),d&&c&&d&&b&&b.length&&le(k.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(g+"1",S).attr(g+"2",S).attr(m+"1",0).attr(m+"2",p*u)}),c||(function(i){var a=r.textAnchor,o=p*w,s=e===hr.top?"0em":e===hr.bottom?"0.71em":"0.32em";function u(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}le(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,o).attr("dy",s);return P(i),u(i),r.merge(i)}).then(function(t){if(t.text(_).attr("text-anchor",a),!1===h&&!0===r.facetAxis){var e=Le(k.node().parentNode.getAttribute("transform"));N(t,O.width-Math.abs(e.x))}else N(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",a=i.length;a>e&&(e=a,n=r)});var i=T(b[1])-T(b[0]),a=!1;if(n>=0){var o=r[n].getBoundingClientRect();a=i-o.width<8}k.classed(Ue+"time-axis-overflow",a)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=k.append("line").attr("x1",T(e)).attr("x2",T(e)).attr("y1",0).attr("y2",1),i=k.append("line").attr("x1",T(n)).attr("x2",T(n)).attr("y1",0).attr("y2",1),a={left:r.node().getBoundingClientRect().left-O.left,right:O.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var o=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",o=(T(n),a[i]),s=Math.ceil(r.width/2-o+1);t.setAttribute("dx",String(s>0?-e*s:0))},s=t.filter(function(t){return t===e}).node(),u=t.filter(function(t){return t===n}).node();t.attr("dx",null),o(s,-1,e),o(u,1,n)}}(t),t}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m,o),P(t),u(t),d&&r.avoidCollisions&&!r.facetAxis&&(A?A.on("end.fixTickTextCollision",function(){return L(i.tick)}):L(i.tick))})}(R),i.hide||function(){var t=i,e=Se(k,"text.label").attr("class",Ae("label",t.cssClass)).attr("transform",Pe(t.rotate)).attr("text-anchor",t.textAnchor);le(e).then(function(t){return A?t.transition(A):t}).then(function(e){var n=v*t.padding,r=Math.abs(M-S),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function gr(t){return pr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var mr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yr=Se,vr=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},br=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Jt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Jt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Jt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Jt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Jt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var a=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(a)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var o=n.config.options,s=n.config.guide.padding;return n.L=o.left+s.l,n.T=o.top+s.t,n.W=o.width-(s.l+s.r),n.H=o.height-(s.t+s.b),n}return mr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?et(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Oe(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var a="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,a,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var o="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,o,i)}var s=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),u=this._drawGrid(n.container,e,r,i,n),l=st(u,".cell").data(s,function(t){return t});l.enter().append("g").attr("class",function(t){return Ue+"cell cell uid_"+t}).merge(l).classed("tau-active",!0),et(l,this.config.guide.animationSpeed).attr("opacity",1),et(l.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=wn.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),o=function(t){return pr(t)}({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?vr(r/e.guide.density):null,tickFormat:i||null,position:n}),s=this.config.guide.animationSpeed;yr(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=et(t,s,"axisTransition"),r=t.attr("transform");Oe.apply(a,n)!==r&&(r?e:t).attr("transform",Oe.apply(a,n)),e.call(o),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=st(t,this._getAxisSelector(e)).classed("tau-active",!1);et(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===Ne(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return yr(t,"g.grid").attr("transform",Oe(0,0)).call(function(t){var a=t,o=i.config.guide.animationSpeed,s=(e.guide.showGridLines||"").toLowerCase();if(s.length>0){var u=yr(a,"g.grid-lines");if(s.indexOf("x")>-1){var l=e.x,c=wn.get(l.guide.tickFormat),f=gr({scale:l.scaleObj,scaleGuide:l.guide,tickSize:r,ticksCount:c?vr(n/l.guide.density):null}),d=yr(u,"g.grid-lines-x");et(d,o).call(f)}if(s.indexOf("y")>-1){var h=e.y,p=(c=wn.get(h.guide.tickFormat),gr({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:c?vr(r/h.guide.density):null})),g=yr(u,"g.grid-lines-y");et(g,o).call(p)}}})},e}(g),xr=n(11),_r=n(8),wr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Er=function(){return(Er=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var a=n[t].map(r[t].invert);e=[a[0],a[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",s)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=Sr.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",s).on("brush",l).on("end",u),Sr.select(this).classed("brush-"+Rt(t),!0).call(i[t]),a=!1,i[t].move(Sr.select(this),e),a=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],a=[];if(n[r].discrete){var o=i.map(n[r]).filter(function(t){return t>=0}),s=n[r].stepSize()/2;a=[Math.min.apply(Math,o)-s,Math.max.apply(Math,o)+s]}else a=[i[0],i[1]];var u=Rt(r);e[r](Sr.select(".brush-"+u)),e[r].move(Sr.select(".brush-"+u),a.map(n[r]))})},e}(g),Tr=n(12);var Cr=n(4),Ar=function(){var t,e=[],n=[],r=1,i=1,a={},o=!1,s=function(t){var r=e.length,i=0,a=e[t].x-n[t].x,o=n[t].y-e[t].y,s=Math.sqrt(a*a+o*o);s>0&&(i+=.2*s),o/=s,i+=(a/=s)>0&&o>0?0:a<0&&o>0?3:a<0&&o<0?6:9;for(var u,l,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var d=(o?t(l,e,n):s(l))-u;Math.random()r&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var y=(o?t(l,e,n):s(l))-u;Math.random()1||l<0||l>1)},f=function(t,e,n){return t-e/n};return a.start=function(t){for(var n=e.length,r=1,i=0;i=200&&n.status<300){var t=n.responseText;try{e(null,JSON.parse(t))}catch(t){e(t,null)}}else e(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){e(t.error,null)},n.open("GET",t,!0),n.send(null)}(n.sourcemap,function(n,r){if(n)throw n;e._drawMap(t,r)}):this._drawMap(t,n.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,a={};return e.forEach(function(e){var o=(Cr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},a=n.centroid(t),o=n.bounds(t),s=a[0],u=a[1],l=o[1][0]-o[0][0],c=i.name||"",f=i.abbr||c,d=l<5.5*c.length?f:c,h=l<13.75,p=h?r-s-16.5:0;return{id:e+"-"+t.id,sx:s,sy:u,x:s+p,y:u,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),s=o.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Ar().label(o).anchor(s).width(r).height(i).start(10),o.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},a);var u=o.filter(function(t){return t.isRef});u.length<6&&u.reduce(function(t,e){return t[e.id]=e,t},a)}),a},e.prototype._drawMap=function(t,e){var n,r,i=this,a=this,s=this.config.guide,u=this.config.options,l=this.config.options.container,c=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=Nr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,c.dim&&f.dim){var b=Pr.extent(c.domain()),x=Pr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var _=this._createProjection(e,v[0],r),w=Pr.geoPath().projection(_),E=l.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});E.exit().remove();var S=E.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(s.showNames&&(r=a._calcLabels(e,i,w)),i.forEach(function(t,i){var a=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(Cr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",w),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=a(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=a(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=a(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=a(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=a(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=a(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var o=Cr.feature(e,e.objects.places),u=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),l=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Ar().label(u).anchor(l).width(m).height(y).start(100),n.selectAll(".place").data(l).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(u).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(E);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var M=this._resolveFeature.bind(this);if(S.selectAll(".map-contour-"+n).data(Cr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=M(t);return null===e?s.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:M(t),event:o.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:M(t),event:o.event})}).on("click",function(t){return i.fire("area-click",{data:M(t),event:o.event})}),!c.dim||!f.dim)return[];var T=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+_([e[f.dim],e[c.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return a.fire("point-mouseover",{data:e,event:o.event})}).on("mouseout",function(t){var e=t.data;return a.fire("point-mouseout",{data:e,event:o.event})}).on("click",function(t){var e=t.data;return a.fire("point-click",{data:e,event:o.event})})},C=S.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return C.exit().remove(),C.enter().append("g").merge(C).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:u.uid}})});e.exit().remove(),e.call(T),e.enter().append("circle").call(T)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var a=r[i[0]].toLowerCase();e=n[a]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,a=this.config.guide,o=100,s=[r/2,i/2],u=n||t.center,l=a.projection||t.projection||"mercator",c=this._createD3Projection(l,u,o,s),f=Pr.geoPath().projection(c).bounds(Cr.feature(t,t.objects[e])),d=o*r/(f[1][0]-f[0][0]),h=o*i/(f[1][1]-f[0][1]);return o=d=0},Vr=function(t,e){return!t.discrete&&e[t.dim]<0},Hr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/zr(t,e))},Wr=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/zr(t,e))},Gr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dx(n);if("-"===t[2]&&!Vr(r,n))return e.dx(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*a*e.model.size(n)/2+i*Hr(e,n)}}}},Ur=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dy(n);if("-"===t[2]&&!Vr(r,n))return e.dy(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*a*e.model.size(n)/2+i*Wr(e,n)}}}};Ir.regRule("l",Gr(["l",-1,null])).regRule("L",Gr(["L",-1,null])).regRule("l+",Gr(["l",-1,"+"])).regRule("l-",Gr(["l",-1,"-"])).regRule("L+",Gr(["L",-1,"+"])).regRule("L-",Gr(["L",-1,"-"])).regRule("r",Gr(["r",1,null])).regRule("R",Gr(["R",1,null])).regRule("r+",Gr(["r",1,"+"])).regRule("r-",Gr(["r",1,"-"])).regRule("R+",Gr(["R",1,"+"])).regRule("R-",Gr(["R",1,"-"])).regRule("t",Ur(["t",-1,null])).regRule("T",Ur(["T",-1,null])).regRule("t+",Ur(["t",-1,"+"])).regRule("t-",Ur(["t",-1,"-"])).regRule("T+",Ur(["T",-1,"+"])).regRule("T-",Ur(["T",-1,"-"])).regRule("b",Ur(["b",1,null])).regRule("B",Ur(["B",1,null])).regRule("b+",Ur(["b",1,"+"])).regRule("b-",Ur(["b",1,"-"])).regRule("B+",Ur(["B",1,"+"])).regRule("B-",Ur(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var a=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*a-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Ir.getRule("from-beginning"),Ir.getRule("towards"),Ir.getRule("cut-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Ir.getRule("to-end"),Ir.getRule("towards"),Ir.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Ir.getRule("from-beginning"),Ir.getRule("towards"),Ir.getRule("cut-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Ir.getRule("to-end"),Ir.getRule("towards"),Ir.getRule("cut-outer-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+s;var u=o-n;return u>0?r-u:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,a=t.h(e),o=i+a/2;if(0-(i-a/2)>0)return 0;var s=o-r;return s>0?n-s:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),a=t.x(e)+t.dx(e),o=t.y(e)+t.dy(e);return!(!Gt(a,t.w(e),i,n)&&!Ut(o,t.h(e),i,r))||t.hide(e)}}});var Xr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),a=i-r,o=a<0?1:Math.exp(-a/t);Math.random()>=o?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(c,d):c;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});c.text=c.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(c.text,u):c.text,c.text=c.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(c.text,u):c.text,c.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(c.text,c.edges):c.text,c.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(c.text):c.text,c.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(c.text):c.text;var p=c.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),_=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=o.select(this),r=v(t,e);n.text(null),x(t,e).split(a).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var a=e.getLabelRect(t),o=e.getLabelRect(i),s=Number(!t.hide&&!i.hide);if(s*Math.max(0,Math.min(o.x1,a.x1)-Math.max(a.x0,o.x0))*(s*Math.max(0,Math.min(o.y1,a.y1)-Math.max(a.y0,o.y0)))>0){var u=[t,i];u.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[u[0].extr+"/"+u[1].extr](u[0],u[1])<0?u[0]:u[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+u||sr.bottom+u)return null;var l=(i.find(o,s)||[]).map(function(t){var e=Math.sqrt(Math.pow(o-t.x,2)+Math.pow(s-t.y,2));if(e>u)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):ui(t.size>e.size?t:e)}function ci(t,e,n,r){var i=function(t,e,n,r){var i=hi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var a=function(i){var a=i?[r,n,e,t]:[t,e,n,r],o=gi.apply(void 0,[1/12*2].concat(a)),s=gi.apply(void 0,[.5].concat(o.slice(0,4))),u=s[3],l=s[6],c=yi(a[0],u),f=yi(u,l),d=[c.left[0],A(.5,c.left[1],f.left[0]),f.left[1]],h=[c.right[0],A(.5,c.right[1],f.right[0]),f.right[1]],p=mi.apply(void 0,d)[1],g=mi.apply(void 0,h)[1],m=A(4,c.left[0],p),y=A(4,c.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},o=a(!1),s=a(!0);return{left:o.left.concat(s.left),right:o.right.concat(s.right)}}(t,e,n,r);if(!i)return li(t,r);var a=di(fi(t,i.right[0]),fi(t,i.left[0])),o=di(fi(r,i.right[1]),fi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(a>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(o>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function fi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function di(t,e){return e1?[t]:[]},d);c.exit().remove(),c.call(s(n.animationSpeed,a.pathAttributesUpdateInit,a.pathAttributesUpdateDone,a.afterPathUpdate));c.enter().append(a.pathElement).call(s(n.animationSpeed,a.pathAttributesEnterInit,a.pathAttributesEnterDone,a.afterPathUpdate)).merge(c).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(0)}),et(t,e.guide.animationSpeed,"pathTransition").attrTween(a.pathTween.attr,a.pathTween.fn)):t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(1)})});if(t.subscribe(l),"never"!==n.showAnchors){var f=function(t,e,n){var r=e.anchorShape,i=t.config.guide,a=t.screenModel,o=vi({},bi[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return a.color(t)},class:"i-data-anchor"}),s=n.selectAll(".i-data-anchor").data(function(t){return t.filter(ii)},a.id);return s.exit().remove(),s.call(ot(i.animationSpeed,null,o)),s.enter().append(bi[e.anchorShape].element).call(ot(i.animationSpeed,{r:0},o)).merge(s)}(t,a,r);t.subscribe(f)}},l=i.toFibers(),c=l.map(function(t){return t.filter(ii)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,a=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var o,s=t.map(function(t){return i.id(t)}),u=(Array.from(n.entries()).find(function(t){var e=t[1];return s.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return o=u?e.get(u):++a,r.set(t,o),o}}();this._getDataSetId=d;var h=f.data(l,d);h.exit().remove(),h.call(u),h.enter().append("g").attr("data-id",d).call(u),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new Jr(i.model,e.flip,e.guide.label,r).draw(c))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=o.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=qt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.y===e}:function(e){return t.x===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=Fe(a.node()),u=this.node().config.guide.maxHighlightDistance;if(tr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){return Array.isArray(e)?e:t(l>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return xi(t,e,c)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",a="tau-chart__dimmed",o=r.selectAll(".i-role-path"),s=o.data().filter(function(e){return e.filter(ii).some(t)}),u=s.length>0;o.call(ct(((e={})[i]=function(t){return u&&s.indexOf(t)>=0},e[a]=function(t){return u&&s.indexOf(t)<0},e)));var l=((n={})[i]=function(e){return!0===t(e)},n[a]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(ct(l)),r.selectAll(".i-role-label").call(ct(l)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,a="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(lt(bi[r].getHighlightAttrs(t,e,n))).attr("opacity",a?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Ae("i-data-anchor",i.class(t))}).classed(Ue+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,a=n.filter(t),o=r.select(".cursor-line");if(a.empty())o.remove();else{o.empty()&&(o=r.append("line"));var s=e.screenModel.model,u=s.xi(a.data()[0]),l=s.xi(a.data()[0]),c=s.scaleY.domain(),f=s.scaleY(c[0]),d=s.scaleY(c[1]);o.attr("class","cursor-line").attr("x1",i?f:u).attr("y1",i?u:f).attr("x2",i?d:l).attr("y2",i?l:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(ii).some(t))});var a=te(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),o={line:0,g:1,text:2};Ce(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?a(t,e):o[t.tagName]-o[e.tagName]})}},Ei=[1,2,3,4,5],Si=Ei.map(function(t){return Ue+"line-opacity-"+t}),Mi=Ei.map(function(t){return Ue+"line-width-"+t});function Ti(t){return Si[t-1]||Si[4]}function Ci(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Ai(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var ki=function(){return(ki=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Oi.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=a,e.pathAttributesUpdateDone=a;var o="polyline"===$(n.interpolate);return e.pathElement=o?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:o?"points":"d",fn:ut(0,o?Ci:Ai,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=Oi.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n),y0:e.y0(n),group:e.group(n)}}),i=r.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=qt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),o=a.reduce(function(t,e){return t[e]=[],t},{});if(r.forEach(function(t){var e=a.find(n?function(e){return t.y===e}:function(e){return t.x===e});o[e].push(t)}),function(){var t=Object.keys(r.reduce(function(t,e){return t[e.group]=!0,t},{})),e=t.reduce(function(t,e,n){return t[e]=n,t},{});a.forEach(function(n){var r=o[n];if(r.sort(function(t,n){return e[t.group]-e[n.group]}),r.lengthr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(l1&&(f=1);var d=function(){var t=c.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{});return c.items.end.forEach(function(e){void 0!==t[e.group]?t[e.group].end=e:delete t[e.group]}),Object.keys(t).forEach(function(e){var n=t[e];n.end?(n.y=n.start.y+f*(n.end.y-n.start.y),n.y0=n.start.y0+f*(n.end.y0-n.start.y0)):delete t[e]}),Object.keys(t).map(function(e){return t[e]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})}(),h=e-s.y,p=d.filter(function(t){return h>=t.y&&h<=t.y0}),g=(p.length>0?p:d).map(function(t){return t.el}).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return xi(t,e,g)}},Ni={draw:wi.draw,getClosestElement:wi.getClosestElement,highlight:wi.highlight,highlightDataPoints:wi.highlightDataPoints,addInteraction:wi.addInteraction,_getBoundsInfo:wi._getBoundsInfo,_sortElements:wi._sortElements,init:function(t){var e=wi.init(t);return e.transformRules=[e.flip&&S.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Jt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return S.get("adjustStaticSizeScale")(t,a)}],e},buildModel:function(t){var e=wi.baseModel(t),n=this.node().config.guide,r=Ti(t.model.scaleColor.domain().length),i=Ue+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var a={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=a,e.pathAttributesUpdateDone=a,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:ut(0,function(t,e){return function(n){return n.map(function(n){return[t(n),e(n)].join(",")}).join(" ")}}(function(t){return t.x},function(t){return t.y}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function Li(t){if(t.length<2)return"";for(var e="",n=0;n=160&&t<320?e=1:t>=320&&t<480?e=2:t>=480&&t<640?e=3:t>=640&&(e=4),Mi[e]}(r.width):"",o=Ti(t.model.scaleColor.domain().length),s=i?"line":"area",u=""+Ue+s+" "+s+" i-role-path "+a+" "+o+" "+n.cssClass+" ",l=i?{stroke:function(t){return f.color(t[0])},class:"i-role-datum"}:{fill:function(t){return f.color(t[0])}},c="cubic"===$(n.interpolate)?i?Ri:si:i?Li:oi,f=wi.baseModel(t),d=i?function(e){return{id:t.id(e),x:f.x(e),y:f.y(e)}}:function(e){return{id:t.id(e),x:f.x(e),y:f.y(e),size:f.size(e)}};return f.groupAttributes={class:function(t){return u+" "+f.class(t[0])+" frame"}},f.pathElement="path",f.anchorShape="circle",f.pathAttributesEnterInit=l,f.pathAttributesUpdateDone=l,f.pathTween={attr:"d",fn:ut(0,c,[d],t.id,n.interpolate)},f}},Di=function(t){return o.select(t).data()[0]},Ii={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Jt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Jt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Jt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&S.get("flip"),e.guide.obsoleteVerticalStackOrder&&S.get("obsoleteVerticalStackOrder"),e.stack&&S.get("stack"),r&&S.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Jt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return S.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return S.get("avoidScalesOverflow")(t,n)},e.stack&&S.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight(function(t,e){return function(n){return n===t||e}}(n.data,null))})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var a=r.guide.prettify,s="i-role-element i-role-datum bar "+Ue+"bar",u=n.screenModel,l=this.buildModel(u,{prettify:a,minBarH:1,minBarW:1,baseCssClass:s}),c=ot,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=u.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=l.class,v=Qt(l,"class"),b=i.container.selectAll(".bar").data(m,u.id);b.exit().classed("tau-removing",!0).call(c(r.guide.animationSpeed,null,((t={})[f]=function(){var t=o.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=o.select(t);e.classed("tau-removing")&&e.remove()})),b.call(c(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(c(r.guide.animationSpeed,(e={},e[d]=u[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",u[d+"0"]);n.subscribe(new Jr(u.model,u.model.flip,r.guide.label,i).draw(g));var _=function(){var t=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map);return function(e,n){return(t.get(Di(e))||-1)-(t.get(Di(n))||-1)}}();this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=Di(t),r=Di(e),i=l.width(n),a=l.width(r);if(i===a){var o=l.y(n),s=l.y(r);return o===s?_(t,e):o-s}return a-i}:function(t,e){var n=Di(t),r=Di(e),i=l.height(n),a=l.height(r);if(i===a){var o=l.x(n),s=l.x(r);return o===s?_(t,e):o-s}return a-i}:_;var w={rect:0,text:1};this._typeSorter=function(t,e){return w[t.tagName]-w[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,a=e.minBarW,o=e.baseCssClass,s=function(e){var n=t.size(e);return r&&(n=Math.max(a,n)),n},u=function(e){return e[t.model.scaleY.dim]};if(t.flip){var l=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*s(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var a=l(e),o=u(e),s=0;return 0===o&&(s=0),o>0&&(s=a),o<0&&(s=0-i),a0?n-i:n);return n},width:function(t){return s(t)},height:function(t){var e=c(t);return r&&(e=0===u(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return o+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;es}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=qt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=Fe(a.node()),u=t-s.x,l=e-s.y,c=this.node().config.guide.maxHighlightDistance;if(ur.right+c||lr.bottom+c)return null;var f=o?l:u,d=o?u:l;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e=o?t.box.left:t.box.top,n=o?t.box.right:t.box.bottom,r=function(t,e,n){return t>=e&&t<=n}(d,e,n);if(!r&&Math.abs(d-e)>c&&Math.abs(d-n)>c)return null;var i=Math.abs(d-(t.invert!==o?n:e));return Object.assign(t,{distToValue:i,cursorInside:r})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(o?l-n:u-e),i=Math.abs(o?u-e:l-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(ct(r)),n.selectAll(".i-role-label").call(ct(r)),this._sortElements(function(e,n){return t(Di(e))-t(Di(n))},this._typeSorter,this._barsSorter)}},ji=n(14),zi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Jt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return zi(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,a=this.color,o=ji.line(),s=function(t){t.attr("d",function(t){return o(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},u=function(t){t.attr("stroke",function(t){return a.toColor(a(t[a.dim]))}),t.attr("class",function(t){return Ue+"__line line "+a.toClass(a(t[a.dim]))+" foreground"})},l=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(s),e.enter().append("path").attr("class","background line").call(s);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){s(t),u(t)}),n.enter().append("path").call(function(t){s(t),u(t)})},c=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});c.exit().remove(),c.call(l),c.enter().append("g").attr("class","lines-frame").call(l),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(g),Vi=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=$t(Kt(e.order,i),i)),this.vars=i;var a=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",a.every(Number.isInteger)).addField("originalSeries",function(){return a}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return function(t,e){return Rt([t,e].map(function(t){return JSON.stringify}).join(""))}(n.vars,e)},r.value=r,r},t.prototype.getVarSet=function(t,e){return qt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),function(t){return"date"===t?function(t){return new Date(t).getTime()}:function(t){return t}}(e.dimType))},t}(),Hi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Wi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Hi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(Vi),Gi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ui=function(){return(Ui=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,s.map(Math.abs));s=[-h,h]}r.vars=s}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",a).addField("toColor",zt).addField("toClass",Bt),r}return Gi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Xi.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Wt(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!kt(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Xi.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Xi.scaleLinear().domain(jt(t.map(function(t){return t-0}),e.length)).range(e)},e}(Vi),Yi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},Ki=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,a=s.extent(r.vars),o=Number.isFinite(i.min)?i.min:a[0],u=Number.isFinite(i.max)?i.max:a[1];return r.vars=[Math.min.apply(Math,[o,a[0]].filter(Number.isFinite)),Math.max.apply(Math,[u,a[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Yi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Jt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,a=r.minSize,o=r.maxSize,s=$i[i],u=n.filter(function(t){return Number.isFinite(Number(t))});if(0===u.length)t=function(){return o};else{var l,c,f=Math.min.apply(Math,u),d=Math.max.apply(Math,u),h=s(Math.max(Math.abs(f),Math.abs(d),d-f));c=f<0?f:0,l=0===h?1:(o-a)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?a+s(e-c)*l:o}}return this.toBaseScale(t)},e}(Vi),Ji=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return Ji(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=u.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),a=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},o=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*a(e)},i*a(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return o[t]=r[t]}),o.stepSize=function(t){return a(t)*i},this.toBaseScale(o,t)},e}(Vi),Zi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ta=function(){return(ta=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,a=ea.scalePoint().domain(n).range(t).padding(.5),o=ea.scalePoint().domain(r.map(String)).range(t).padding(.5),s=Math.max.apply(Math,t),u=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,s,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},l=function(t){var n=new Date(t),a=(e?e.cast(n):n).getTime();return i.ratio?s-r.slice(r.indexOf(a)+1).reduce(function(t,e){return t+s*u(e)},s*u(t)*.5):o(String(a))};return Object.keys(a).forEach(function(t){return l[t]=a[t]}),l.stepSize=function(t){return u(t)*s},this.toBaseScale(l,t)},e}(Vi),ra=n(15),ia=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),aa=function(){return(aa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,a=(r?oa.scaleUtc:oa.scaleTime)().domain(n).range(t),o=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=a});return function(t,e,n){void 0===n&&(n=10);var r,i,a=Number(t[0]),o=Number(t[1]),s=Math.abs(o-a)/n,u=oa.bisector(function(t){return t.duration}).right(ca,s);if(u===ca.length)r=e?oa.utcYear:oa.timeYear,i=oa.tickStep(a/la.year.duration,o/la.year.duration,n);else if(u){var l=s/ca[u-1].duration,c=ca[u].duration/s,f=ca[lc&&(e=c),a(e)}}return Object.keys(a).forEach(function(t){return o[t]=a[t]}),o.stepSize=function(){return 0},this.toBaseScale(o,t)},e}(Vi);function ua(t){return oa["time"+t[0].toUpperCase()+t.slice(1)]}var la={second:{duration:1e3,interval:oa.timeSecond,utc:oa.utcSecond},minute:{duration:6e4,interval:oa.timeMinute,utc:oa.utcMinute},hour:{duration:36e5,interval:oa.timeHour,utc:oa.utcHour},day:{duration:864e5,interval:oa.timeDay,utc:oa.utcDay},week:{duration:6048e5,interval:oa.timeWeek,utc:oa.utcWeek},month:{duration:2592e6,interval:oa.timeMonth,utc:oa.utcMonth},year:{duration:31536e6,interval:oa.timeYear,utc:oa.utcYear}},ca=function(){var t=function(t,e){return{time:t,step:e,duration:e*t.duration}};return[t(la.second,1),t(la.second,5),t(la.second,15),t(la.second,30),t(la.minute,1),t(la.minute,5),t(la.minute,15),t(la.minute,30),t(la.hour,1),t(la.hour,3),t(la.hour,6),t(la.hour,12),t(la.day,1),t(la.day,2),t(la.week,1),t(la.month,1),t(la.month,3),t(la.year,1)]}();var fa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),da=function(){return(da=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(ha.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(Vi),ga=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ma=function(){return(ma=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),a=r.toExponential().split("e"),o=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),s=parseFloat(Math.ceil(Number(a[0]))+"e"+a[1]);return e?[o,s]:[-s,-o]}(a)),r.vars=a,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return ga(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;xa(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=ya.extent(e.domain()),i=Math.floor(ba(r[0])),a=Math.ceil(ba(r[1])),o=Math.ceil(10*(a-i)/(10*Math.ceil(t/10))),s=i;s<=a;s+=o)for(var u=1;u<=10;u++){var l=Math.pow(u,o)*Math.pow(10,s);(l=parseFloat(l.toExponential(0)))>=r[0]&&l<=r[1]&&n.push(l)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(ya.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(Vi);function ba(t){return Math.log(t)/Math.LN10}function xa(t){if(t[0]*t[1]<=0)throw new _("Logarithmic scale domain cannot cross zero.",w.INVALID_LOG_DOMAIN)}var _a,wa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ea=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return wa(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(Vi),Sa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ma=function(){return(Ma=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Wt(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),a=Ta.scaleThreshold().domain(i).range(e);return this.toBaseScale(a)},e}(Vi),Aa=function(t){return t||null},ka=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},Oa=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Pa={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},Na=((_a={})[Pa.SUCCESS]=function(t){return t},_a[Pa.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},_a[Pa.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],a=t[i],o=t.filter(function(t){return t!==a});o.push(a);var s=n[i][r]||{},u=n[n.length-1][r]||{};return n[n.length-1][r]=s,n[i][r]=u,o},_a);function La(t,e,n){return e.reduce(function(e,r,i){var a=t[r];return a?e.status!=Pa.FAIL&&("measure"===a.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==a.type&&1===e.countMeasureAxis?e.status=Pa.WARNING:e.countMeasureAxis>1&&(e.status=Pa.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Pa.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Pa.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function Ra(t){for(var e=ka(t.x),n=ka(t.y),r=Math.max(e.length,n.length),i=ka(t.guide||{},{}),a=r-i.length,o=0;o0;c--){var f=s.pop(),d=u.pop(),h=l.pop()||{};c===a?(o.x=f,o.y=d,o.unit.push(Oa(t,{x:Aa(f),y:Aa(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),o.guide=Jt(h,{x:{label:f},y:{label:d}})):o={type:"COORDS.RECT",x:Aa(f),y:Aa(d),unit:[o],guide:Jt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:o},e}var Da=function(t){var e=Ra(t);return Fa("ELEMENT.INTERVAL",e=function(t){var e=(t.flip?t.y:t.x).indexOf(t.color)>=0,n=t.guide[t.guide.length-1];return e&&!n.hasOwnProperty("enableColorToBarPosition")&&(n.enableColorToBarPosition=!1),t}(e))},Ia=function(t){var e=Ra(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,a=t.y,o=i[i.length-1],s=i.slice(0,i.length-1),u=a[a.length-1],l=a.slice(0,a.length-1),c=t.color,f=s.concat(l).concat([c]).filter(function(t){return null!==t}),d=-1,h=[[[o].concat(f),u],[[u].concat(f),o]],p=null;return h.some(function(t,e){var i=t[0],a=t[1],o=an(n,i,[a]);return o.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+o.error.keyY+" values (e.g. "+o.error.errY.join(",")+")","for ("+o.error.keyX+" = "+o.error.valX+")."].join(" ")),o.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=ln(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),Fa("ELEMENT.AREA",e)},ja=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),za=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new ja(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Ba={},Va=function(){function t(){}return t.unit=function(t){return new ja(t)},t.spec=function(t){return new za(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Xa="2.6.4";e.default={GPL:Ge,Plot:nr,Chart:ur,api:Ga,version:"2.6.4"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=a},function(t,e){t.exports=o},function(t,e){t.exports=s},function(t,e){t.exports=u},function(t,e,n){var r,i,a;!function(n,o){i=[],void 0===(a="function"==typeof(r=o)?r.apply(e,i):r)||(t.exports=a)}(0,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,a=i.documentElement,o=["top","bottom"];function s(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e=r.pageYOffset||a.scrollTop,n=r.pageXOffset||a.scrollLeft,i={left:0,right:0,top:0,bottom:0,width:0,height:0};if(function(t){return t&&null!=t.setInterval}(t))i.width=r.innerWidth||a.clientWidth,i.height=r.innerHeight||a.clientHeight;else{if(!a.contains(t)||null==t.getBoundingClientRect)return i;s(i,t.getBoundingClientRect()),i.width=i.right-i.left,i.height=i.bottom-i.top}return i.top=i.top+e-a.clientTop,i.left=i.left+n-a.clientLeft,i.right=i.left+i.width,i.bottom=i.top+i.height,i}var l=function(t,e){return r.getComputedStyle(t)[e]};function c(t){var e=String(l(t,c.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}c.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-a<=e.left?i[0]="right":t.right+this.width+a>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:u(t),a=this.spacing,o=this._pickPlace(i);switch(o!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(o),this.curPlace=o),this.curPlace){case"top":n=i.top-this.height-a,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-a,r=i.right-this.width;break;case"top-right":n=i.top-this.height-a,r=i.left;break;case"bottom":n=i.bottom+a,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+a,r=i.right-this.width;break;case"bottom-right":n=i.bottom+a,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-a;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-a;break;case"left-bottom":n=i.top,r=i.left-this.width-a;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+a;break;case"right-top":n=i.bottom-this.height,r=i.right+a;break;case"right-bottom":n=i.top,r=i.right+a}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=c(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],a=0;a>>0,i=arguments[1],a=0;a0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),n)};return function(t){var n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var i,a=arguments.length>1?arguments[1]:void 0;if(void 0!==a){if(!e(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(i=arguments[2])}for(var o,s=r(n.length),u=e(this)?Object(new this(s)):new Array(s),l=0;l]*>/,"");var e=new ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}try{var a=new r.DOMParser(n.xmldom||{});return a.parseFromString(t,"image/svg+xml")}catch(e){return(a=new r.DOMParser(n.xmldom||{})).parseFromString(t,"text/xml")}},o.Property=function(t,e){this.name=t,this.value=e},o.Property.prototype.getValue=function(){return this.value},o.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},o.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},o.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},o.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},o.Property.prototype.addOpacity=function(e){var n=this.value;if(null!=e.value&&""!=e.value&&"string"==typeof this.value){var r=new t(this.value);r.ok&&(n="rgba("+r.r+", "+r.g+", "+r.b+", "+e.numValue()+")")}return new o.Property(this.name,n)},o.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t&&(t=t[1]),t||(t=this.value),o.Definitions[t]},o.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},o.Property.prototype.getFillStyleDefinition=function(t,e){var n=this.getDefinition();if(null!=n&&n.createGradient)return n.createGradient(o.ctx,t,e);if(null!=n&&n.createPattern){if(n.getHrefAttribute().hasValue()){var r=n.attribute("patternTransform");n=n.getHrefAttribute().getDefinition(),r.hasValue()&&(n.attribute("patternTransform",!0).value=r.value)}return n.createPattern(o.ctx,t)}return null},o.Property.prototype.getDPI=function(t){return 96},o.Property.prototype.getEM=function(t){var e=12,n=new o.Property("fontSize",o.Font.Parse(o.ctx.font).fontSize);return n.hasValue()&&(e=n.toPixels(t)),e},o.Property.prototype.getUnits=function(){var t=this.value+"";return t.replace(/[0-9\.\-]/g,"")},o.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var n=this.value+"";if(n.match(/em$/))return this.numValue()*this.getEM(t);if(n.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(n.match(/px$/))return this.numValue();if(n.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(n.match(/pc$/))return 15*this.numValue();if(n.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(n.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(n.match(/in$/))return this.numValue()*this.getDPI(t);if(n.match(/%$/))return this.numValue()*o.ViewPort.ComputeSize(t);var r=this.numValue();return e&&r<1?r*o.ViewPort.ComputeSize(t):r},o.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/s$/)?1e3*this.numValue():(t.match(/ms$/),this.numValue())},o.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/deg$/)?this.numValue()*(Math.PI/180):t.match(/grad$/)?this.numValue()*(Math.PI/200):t.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var s={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return o.Property.prototype.toTextBaseline=function(){return this.hasValue()?s[this.value]:null},o.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(t,e,n,r,i,a){var s=null!=a?this.Parse(a):this.CreateFont("","","","","",o.ctx.font);return{fontFamily:i=i||s.fontFamily,fontSize:r||s.fontSize,fontStyle:t||s.fontStyle,fontWeight:n||s.fontWeight,fontVariant:e||s.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var t=this;this.Parse=function(e){for(var n={},r=o.trim(o.compressSpaces(e||"")).split(" "),i={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},a="",s=0;sthis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))},this.addX=function(t){this.addPoint(t,null)},this.addY=function(t){this.addPoint(null,t)},this.addBoundingBox=function(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)},this.addQuadraticCurve=function(t,e,n,r,i,a){var o=t+2/3*(n-t),s=e+2/3*(r-e),u=o+1/3*(i-t),l=s+1/3*(a-e);this.addBezierCurve(t,e,o,u,s,l,i,a)},this.addBezierCurve=function(t,e,n,r,i,a,o,s){var u=[t,e],l=[n,r],c=[i,a],f=[o,s];this.addPoint(u[0],u[1]),this.addPoint(f[0],f[1]);for(var d=0;d<=1;d++){var h=function(t){return Math.pow(1-t,3)*u[d]+3*Math.pow(1-t,2)*t*l[d]+3*(1-t)*Math.pow(t,2)*c[d]+Math.pow(t,3)*f[d]},p=6*u[d]-12*l[d]+6*c[d],g=-3*u[d]+9*l[d]-9*c[d]+3*f[d],m=3*l[d]-3*u[d];if(0!=g){var y=Math.pow(p,2)-4*m*g;if(!(y<0)){var v=(-p+Math.sqrt(y))/(2*g);0=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var t=new o.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(t)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t},this.getAsCurrentPoint=function(){var t=this.getPoint();return this.current=t},this.getReflectedControlPoint=function(){return"c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase()?this.current:new o.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},this.addMarker=function(t,e,n){null!=n&&0this.maxDuration){if("indefinite"==this.attribute("repeatCount").value||"indefinite"==this.attribute("repeatDur").value)this.duration=0;else if("freeze"!=this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"==this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+t;var e=!1;if(this.begin~\.\[:]+)/g,l=/(\.[^\s\+>~\.\[:]+)/g,c=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,f=/(:[\w-]+\([^\)]*\))/gi,d=/(:[^\s\+>~\.\[:]+)/g,h=/([^\s\+>~\.\[:]+)/g;function p(t){var e=[0,0,0],n=function(n,r){var i=t.match(n);null!=i&&(e[r]+=i.length,t=t.replace(n," "))};return t=(t=t.replace(/:not\(([^\)]*)\)/g," $1 ")).replace(/{[\s\S]*/gm," "),n(s,1),n(u,0),n(l,1),n(c,2),n(f,1),n(d,1),t=(t=t.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),n(h,2),e.join("")}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,n,r,i,a){var s={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:n,scaleWidth:r,scaleHeight:i};for(var u in a)a.hasOwnProperty(u)&&(s[u]=a[u]);o(this.canvas,t,s)}),n.exports=o}(n={exports:{}}),n.exports}(n(22),n(23))},function(t,e,n){var r,i=i||function(t){"use strict";if(!(void 0===t||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var e=function(){return t.URL||t.webkitURL||t},n=t.document.createElementNS("http://www.w3.org/1999/xhtml","a"),r="download"in n,i=/constructor/i.test(t.HTMLElement)||t.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent),o=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},s=function(t){setTimeout(function(){"string"==typeof t?e().revokeObjectURL(t):t.remove()},4e4)},u=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},l=function(l,c,f){f||(l=u(l));var d,h=this,p="application/octet-stream"===l.type,g=function(){!function(t,e,n){for(var r=(e=[].concat(e)).length;r--;){var i=t["on"+e[r]];if("function"==typeof i)try{i.call(t,n||t)}catch(t){o(t)}}}(h,"writestart progress write writeend".split(" "))};if(h.readyState=h.INIT,r)return d=e().createObjectURL(l),void setTimeout(function(){n.href=d,n.download=c,function(t){var e=new MouseEvent("click");t.dispatchEvent(e)}(n),g(),s(d),h.readyState=h.DONE});!function(){if((a||p&&i)&&t.FileReader){var n=new FileReader;return n.onloadend=function(){var e=a?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");t.open(e,"_blank")||(t.location.href=e),e=void 0,h.readyState=h.DONE,g()},n.readAsDataURL(l),void(h.readyState=h.INIT)}d||(d=e().createObjectURL(l)),p?t.location.href=d:t.open(d,"_blank")||(t.location.href=d);h.readyState=h.DONE,g(),s(d)}()},c=l.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return e=e||t.name||"download",n||(t=u(t)),navigator.msSaveOrOpenBlob(t,e)}:(c.abort=function(){},c.readyState=c.INIT=0,c.WRITING=1,c.DONE=2,c.error=c.onwritestart=c.onprogress=c.onwrite=c.onabort=c.onerror=c.onwriteend=null,function(t,e,n){return new l(t,e||t.name||"download",n)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content); -/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */void 0!==t&&t.exports?t.exports.saveAs=i:null!==n(24)&&null!==n(25)&&(void 0===(r=function(){return i}.call(e,n,e,t))||(t.exports=r))},function(t,e,n){(t.exports=n(26)(!1)).push([t.i,"body > * {\n visibility: hidden;\n}\nbody {\n overflow: hidden;\n}\nbody * {\n visibility: hidden !important;\n}\n\n.tau-chart__print-block {\n position: absolute;\n top: 0;\n left: 0;\n visibility: visible !important;\n display: block !important;\n width: 100%;\n /*height: 100%;*/\n}\n",""])},,function(t,e,n){t.exports=n(27)},function(t,e){t.exports=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var n=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),n=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==n.length&&(n="0"+n),"#"+t+e+n},this.getHelpXML=function(){for(var t=new Array,r=0;r "+l.toRGB()+" -> "+l.toHex());u.appendChild(c),u.appendChild(f),s.appendChild(u)}catch(t){}return s}}},function(t,e){var n=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],r=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function i(t,e,n,r,i){if("string"==typeof t)t=document.getElementById(t);else if("undefined"!=typeof HTMLCanvasElement&&!t instanceof HTMLCanvasElement)return;var a,o=t.getContext("2d");try{try{a=o.getImageData(e,n,r,i)}catch(t){throw new Error("unable to access local image data: "+t)}}catch(t){throw new Error("unable to access image data: "+t)}return a}function a(t,e,n,r,a,s){if(!(isNaN(s)||s<1)){s|=0;var u=i(t,e,n,r,a);u=o(u,e,n,r,a,s),t.getContext("2d").putImageData(u,e,n)}}function o(t,e,i,a,o,s){var u,c,f,d,h,p,g,m,y,v,b,x,_,w,E,S,M,T,C,A,k,O,P,N,L=t.data,R=s+s+1,F=a-1,D=o-1,I=s+1,j=I*(I+1)/2,z=new l,B=z;for(f=1;f>U,0!=P?(P=255/P,L[p]=(m*G>>U)*P,L[p+1]=(y*G>>U)*P,L[p+2]=(v*G>>U)*P):L[p]=L[p+1]=L[p+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=g+((d=u+s+1)>U,P>0?(P=255/P,L[d]=(m*G>>U)*P,L[d+1]=(y*G>>U)*P,L[d+2]=(v*G>>U)*P):L[d]=L[d+1]=L[d+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=u+((d=c+I)>V,k[p+1]=y*B>>V,k[p+2]=v*B>>V,m-=b,y-=x,v-=_,b-=j.r,x-=j.g,_-=j.b,d=g+((d=u+s+1)>V,k[d+1]=y*B>>V,k[d+2]=v*B>>V,m-=b,y-=x,v-=_,b-=j.r,x-=j.g,_-=j.b,d=u+((d=c+L)=0:e.dim===t.dim});if(null===i.method)return n;var a={l:-.5,r:.5},o=i.method,s=i.scale;return n[o]=function(t){var n=a[t.__pos__]||0;if(s.discrete)return e[o](t)+s.stepSize(t[s.dim])*n;if(s.period){for(var i=r.default.api.tickPeriod.get(s.period,{utc:s.utcTime}),u=s.domain(),l=i.cast(u[0]);l=0?i[t].map(function(t){return new Date(t)}):i[t];a.series=o.unique(s.concat(u))}})})},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},_useSavedDataRefs:function(t,e){var n=this._dataRefs;return this._usedDataRefsKeys.add(e),e in n?(n[e].forEach(function(e,n){return Object.assign(e,t[n])}),n[e]):(n[e]=t,t)},_startWatchingDataRefs:function(){var t=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(t)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs:function(){var t=this._dataRefs,e=this._initialDataRefsKeys,n=this._usedDataRefsKeys;Array.from(e).filter(function(t){return!n.has(t)}).forEach(function(e){return delete t[e]}),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems:function(t){var e=function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})};return t.reduce(function(t,n){return Array.isArray(n.dim)?Array.isArray(n.val)&&n.val.every(Array.isArray)&&n.val.forEach(function(r){t.push(e(n.dim,r))}):Array.isArray(n.val)?n.val.forEach(function(r){t.push(e([n.dim],[r]))}):t.push(e([n.dim],[n.val])),t},[])},_getAnnotatedDimValues:function(t){var e={};return this._getDataRowsFromItems(t).forEach(function(t){Object.keys(t).forEach(function(n){e[n]=e[n]||[],e[n].push(t[n])})}),e}}}r.default.api.plugins.add("annotations",c);var f=r.default.api.utils;function d(t){var e=t.x0,n=t.y0,r=null==t.collapse||t.collapse,i=function(t){return{y0:function(n){return t.scaleY.value(n[e])}}},a=function(t){return{y0:function(e){return t.scaleY.value(e[n])}}},o=function(t){var r=t.data();if(0===r.length)return{};var i=t.scaleY,a=Number.MAX_VALUE,o=Number.MIN_VALUE,s=t.flip?e:n,u=i.dim;return r.forEach(function(t){var e=t[s],n=t[u],r=ee?n:e;a=ro?i:o}),i.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxa)&&(e.min=a),e}),{}},s={},u={},l=function(t){var i=t.data().slice(),a=t.scaleX,o=t.scaleY;if(0===i.length||!a.discrete)return{};var l=t.flip?e:n,c=o.dim;i.sort(f.createMultiSorter(function(t,e){return t[l]-e[l]},function(t,e){return t[c]-e[c]}));var d=a.dim,h=a.domain().reduce(function(t,e){return t[e]=[],t},{}),p=new Map;return i.forEach(r?function(t){var e=t[d],n=h[e],r=n.findIndex(function(e){return e[e.length-1][c]<=t[l]});r<0&&(r=n.length,n.push([])),n[r].push(t),p.set(t,r)}:function(t){var e=t[d],n=h[e],r=r=n.length;n.push([]),n[r].push(t),p.set(t,r)}),Object.keys(h).forEach(function(t){s[t]=h[t]}),a.fixup(function(t){var e={},n=a.domain().reduce(function(t,e){return t+s[e].length},0);return a.domain().forEach(function(t){u[t]=n}),e.ratio=function(t){return s[t].length/u[t]},e}),{xi:function(e){var n=e[d],r=a.stepSize(n);return t.xi(e)-r/2+r/s[n].length*(p.get(e)+.5)}}};return{onSpecReady:function(t,e){t.traverseSpec(e,function(t,e){"ELEMENT.INTERVAL"===t.type&&(t.transformModel=[t.flip?i:a,l],t.adjustScales=[o],t.guide.enableColorToBarPosition=!1,t.guide.label=t.guide.label||{},t.guide.label.position=t.guide.label.position||(t.flip?["inside-start-then-outside-end-horizontal","hide-by-label-height-horizontal"]:["inside-start-then-outside-end-vertical"]))})}}}r.default.api.plugins.add("bar-as-span",d);var h=n(0),p=r.default.api.utils,g="minimum",m="maximum",y={MIN:g,MAX:m,MEDIAN:"median",Q1:"Q1",Q3:"Q3"};function v(t,e){var n=t.length-1,r=e/100*n,i=Math.floor(r);if(0===i)return{pos:0,value:t[0]};if(i===n)return{pos:n,value:t[n]};var a=r-i;return a?{pos:r,value:t[i]+a*(t[i+1]-t[i])}:{pos:r,value:t[r]}}function b(t,e,n){for(var r=t.sort(function(t,e){return t-e}),i=v(r,25),a=v(r,50),o=v(r,75),s=o.value-i.value,u=i.value-1.5*s,l=o.value+1.5*s,c=r[0],f=r[r.length-1],d=0;d<=i.pos;d++){var h=r[d];if(h>u){c=h;break}}for(var p=r.length-1;p>=o.pos;p--){var g=r[p];if(go||t[r]\n
'+e+'
\n
\n '+C(n.map(function(t){return k(t)}))+"\n
\n\n"},k=function(t){var e=t.key,n=t.label,r=t.checked;return'\n
\n '+O()+'\n '+n+"\n
\n"},O=function(){return['','',""].join("")},P=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.matches(n)&&r(t,e),e=e.parentNode})},N=function(t,e){var n=function(t){return JSON.stringify(function(t){return null==t||""===t}(t)?null:t)},r=n(e);return function(e){var i=e[t],a=n(i);return r===a}},L=function(){function t(t){this.settings=_.defaults(t||{},{formatters:{},fields:null,skipColorDim:!0}),this._filters={},this.onRender=this._createRenderHandler()}return t.prototype.init=function(t){var e=this;this._chart=t;var n=function(e){var n=t.getSpec().scales;return Object.keys(n).map(function(t){return{name:t,config:n[t]}}).filter(e)},r=n(function(t){var e=t.config;t.name;return"ordinal"===e.type&&e.dim}),i=_.unique(r.map(function(t){return t.config.dim}));if(this.settings.fields&&(i=i.filter(function(t){return e.settings.fields.indexOf(t)>=0})),this.settings.skipColorDim){var a=n(function(t){var e=t.config;t.name;return"color"===e.type&&e.dim}).map(function(t){return t.config.dim});i=i.filter(function(t){return a.indexOf(t)<0})}r=r.filter(function(t){return i.indexOf(t.config.dim)>=0}),this._categoryScales=r,this._render()},t.prototype.destroy=function(){var t=this._filters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});!function(t){t&&t.parentElement&&t.parentElement.removeChild(t)}(this._node)},t.prototype._createRenderHandler=function(){return function(){if(this._lastClickedScrollInfo){var t=this._lastClickedScrollInfo.key,e=this._node.querySelector('[data-key="'+t+'"]');if(e){var n=this._lastClickedScrollInfo.top,r=e.getBoundingClientRect().top,i=this._getScrollContainer(),a=i.getBoundingClientRect().top;i.scrollTop=i.scrollTop-n-a+r}this._lastClickedScrollInfo=null}}},t.prototype._getContent=function(t){return function(t){var e=t.categories;return'\n
\n '+C(e.map(function(t){return A(t)}))+"\n
\n"}({categories:t})},t.prototype._getCategoriesInfo=function(){var t=this;return this._categoryScales.map(function(e){var n=e.name;return t._chart.getScaleInfo(n)}).map(function(e){var n=e.dim,r=t._getFieldLabel(n),i=t._getFieldFormat(n),a=t._chart.getDataSources({excludeFilter:["category-filter"]}),o=_.unique(a[e.source].data.map(function(t){return t[n]})).map(function(e){var r=i(e),a=t._getFilterKey(n,e);return{label:r,checked:!t._filters[a],key:a,value:e}});return{dim:n,label:r,values:o}})},t.prototype._render=function(){this._clear(),this._formatters=w.getFieldFormatters(this._chart.getSpec(),this.settings.formatters);var t=this._getCategoriesInfo(),e=function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstElementChild}(this._getContent(t));this._node=e,this._chart.insertToRightSidebar(e),this._subscribeToEvents(),this._filterKeys=t.reduce(function(t,e){var n=e.dim;return e.values.forEach(function(e){var r=e.key,i=e.value;t[r]={dim:n,value:i}}),t},{})},t.prototype._subscribeToEvents=function(){var t=this,e=this._node;P(e,"click","."+S,function(e,n){var r=n.getAttribute("data-key"),i=e.target.matches("."+T);t._toggleCategory(r,i?"toggle":"focus")}),P(e,"mouseover","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!0)}),P(e,"mouseout","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!1)})},t.prototype._isFilteredOut=function(t){return t in this._filters},t.prototype._toggleCategory=function(t,e){var n=this,r=Array.from(this._node.querySelectorAll("."+S)).reduce(function(t,e){return t[e.getAttribute("data-key")]=e,t},{}),i=Object.keys(this._filterKeys).map(function(t){var e=n._filterKeys[t],i=e.dim,a=e.value;return{node:r[t],key:t,dim:i,value:a,isChecked:!n._isFilteredOut(t)}}),a=i.reduce(function(t,e){return t[e.key]=e,t},{})[t],o=i.filter(function(t){return t.dim===a.dim}),s=function(t,e){e?t.classList.add(M):t.classList.remove(M)};switch(e){case"toggle":a.isChecked?(this._addFilter(t),s(a.node,!1)):(this._removeFilter(t),s(a.node,!0));break;case"focus":a.isChecked&&o.every(function(t){return t===a||!t.isChecked})?o.forEach(function(t){t.isChecked||(s(t.node,!0),n._removeFilter(t.key))}):(o.forEach(function(t){t!==a&&t.isChecked&&(s(t.node,!1),n._addFilter(t.key))}),a.isChecked||(s(a.node,!0),this._removeFilter(a.key)))}this._lastClickedScrollInfo={key:t,top:a.node.getBoundingClientRect().top-this._getScrollContainer().getBoundingClientRect().top},this._chart.refresh()},t.prototype._toggleHighlight=function(t,e){if(!this._isFilteredOut(t)){var n=this._filterKeys[t],r=n.dim,i=n.value,a=e?N(r,i):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){return t.fire("highlight",a)})}},t.prototype._clear=function(){var t=this._node;t&&t.parentElement&&t.parentElement.removeChild(t)},t.prototype._getScrollContainer=function(){return this._node.parentElement.parentElement},t.prototype._getFilterKey=function(t,e){return t+"__"+e},t.prototype._addFilter=function(t){var e=this._filterKeys[t],n=e.dim,r=e.value,i=N(n,r);this._filters[t]=this._chart.addFilter({tag:"category-filter",predicate:function(t){return!i(t)}})},t.prototype._removeFilter=function(t){var e=this._filters[t];delete this._filters[t],this._chart.removeFilter(e)},t.prototype._getFieldLabel=function(t){return this._formatters[t]?this._formatters[t].label:t},t.prototype._getFieldFormat=function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},t}();r.default.api.plugins.add("category-filter",function(t){return new L(t)});var R="http://www.w3.org/2000/svg",F=r.default.api.utils,D=r.default.api.svgUtils,I=r.default.api.pluginsSDK;function j(t){t=t||{};var e=document.createElementNS(R,"g"),n=h.select(e).attr("class","tau-crosshair__label");n.append("rect").attr("class","tau-crosshair__label__box"),n.append("text").attr("class","tau-crosshair__label__text-shadow"),n.append("text").attr("class","tau-crosshair__label__text");var r={options:function(e){return t=Object.assign(t,e),r},show:function(i){return t.container.appendChild(e),function(e){var r=e.x,i=e.y,a=e.text,o=e.color,s=e.colorCls;n.attr("class","tau-crosshair__label "+s);var u=t.halign,l=t.valign,c=t.hpad,f=t.vpad,d={left:"end",middle:"middle",right:"start"}[u],h={left:-c,middle:0,right:c}[u],p=n.select(".tau-crosshair__label__text").attr("fill",o),g=n.selectAll(".tau-crosshair__label__text, .tau-crosshair__label__text-shadow").attr("text-anchor",d).attr("x",r+h).attr("y",0).text(a),m=p.node().getBBox(),y={top:-f-m.height/2,middle:0,bottom:f+m.height/2}[l]-m.height/2-m.y;g.attr("y",i+y);var v=m.width+2*c,b=m.height+2*f,x={left:-v,middle:-v/2,right:0}[u],_={top:-b,middle:-b/2,bottom:0}[l];n.select(".tau-crosshair__label__box").attr("fill",o).attr("rx",t.boxCornerRadius).attr("ry",t.boxCornerRadius).attr("x",r+x).attr("y",i+_).attr("width",v).attr("height",b)}(i),function(){n.attr("transform","");var r=t.chart.getLayout().contentContainer.getBoundingClientRect(),i=t.chart.getSVG().getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(0,Math.max(r.left,i.left)-a.left)||Math.min(0,Math.min(r.right,i.right)-a.right),s=Math.max(0,Math.max(r.top,i.top)-a.top)||Math.min(0,Math.min(r.bottom,i.bottom)-a.bottom);n.attr("transform","translate("+o+","+s+")")}(),r},hide:function(){return e.parentNode&&e.parentNode.removeChild(e),r}};return r}function z(t){var e=F.defaults(t||{},{xAxis:!0,yAxis:!0,formatters:{},labelBoxHPadding:5,labelBoxVPadding:3,labelBoxCornerRadius:3,axisHPadding:22,axisVPadding:22});return{init:function(t){this._chart=t,this._formatters={},this._createNode()},_createNode:function(){var t=h.select(document.createElementNS(R,"g")).attr("class","tau-crosshair");this._labels={x:null,y:null};var n=function(n){var r=t.append("g").attr("class","tau-crosshair__group "+n);r.append("line").attr("class","tau-crosshair__line-shadow"),r.append("line").attr("class","tau-crosshair__line"),this._labels[n]=j({container:r.node(),chart:this._chart,halign:"x"===n?"middle":"left",valign:"x"===n?"bottom":"middle",boxCornerRadius:e.labelBoxCornerRadius,hpad:e.labelBoxHPadding,vpad:e.labelBoxVPadding})}.bind(this);e.xAxis&&n("x"),e.yAxis&&n("y"),this._element=t},_setValues:function(t,n,r){var i=function(t){var n=this._element.select(".tau-crosshair__group."+t.dir);n.select(".tau-crosshair__line").attr("class","tau-crosshair__line "+r.cls).attr("stroke",r.color),n.selectAll(".tau-crosshair__line, .tau-crosshair__line-shadow").attr("x1",t.startPt.x).attr("x2",t.valuePt.x).attr("y1",t.startPt.y).attr("y2",t.valuePt.y),("x"===t.dir&&e.xAxis||"y"===t.dir&&e.yAxis)&&this._labels[t.dir].options({halign:t.labelHAlign,valign:t.labelVAlign}).show({x:t.startPt.x,y:t.startPt.y,text:t.label,color:r.color,colorCls:r.cls})}.bind(this);i({dir:"x",startPt:{x:t.value,y:n.start+(t.minMode?0:e.axisVPadding)},valuePt:{x:t.value,y:n.value+n.crossPadding},label:t.label,labelHAlign:"middle",labelVAlign:"bottom"}),i({dir:"y",startPt:{x:t.start-(n.minMode?0:e.axisHPadding),y:n.value},valuePt:{x:t.value-t.crossPadding,y:n.value},label:n.label,labelHAlign:"left",labelVAlign:"middle"})},_showCrosshair:function(t,e,n){var r=this._chart.getSVG(),i=e.config.options.container.node(),a=D.getDeepTransformTranslate(i);this._element.attr("transform",D.translate(a.x,a.y)),r.appendChild(this._element.node());var o=e.getScale("x"),s=e.getScale("y"),u=e.getScale("color"),l=u(t.data[u.dim]),c=t.data[o.dim],f=t.data[s.dim],d=e.screenModel.x(t.data),h=e.screenModel.y(t.data);if(e.config.stack)if(e.config.flip){var p=e.data().filter(function(n){var r=n[s.dim];return n===t.data||(r===f||r-f==0)&&(e.screenModel.x(t.data)-e.screenModel.x(n))*n[o.dim]>0});d=(c<0?Math.min:Math.max).apply(null,p.map(function(t){return e.screenModel.x(t)},0)),c=p.reduce(function(t,e){return t+e[o.dim]},0)}else{var g=e.data().filter(function(n){var r=n[o.dim];return n===t.data||(r===c||r-c==0)&&(e.screenModel.y(n)-e.screenModel.y(t.data))*n[s.dim]>0});h=(f<0?Math.max:Math.min).apply(null,g.map(function(t){return e.screenModel.y(t)},0)),f=g.reduce(function(t,e){return t+e[s.dim]},0)}var m=t.node.getBBox(),y=["ELEMENT.AREA","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED"].indexOf(e.config.type)>=0?{x:m.width*(e.config.flip?c>0?1:0:.5),y:m.height*(e.config.flip?.5:f>0?1:0)}:{x:m.width/2,y:m.height/2};this._setValues({label:this._getFormat(o.dim)(c),start:0,value:d,crossPadding:y.x,minMode:n&&n.guide.x.hide},{label:this._getFormat(s.dim)(f),start:e.config.options.height,value:h,crossPadding:y.y,minMode:n&&n.guide.y.hide},{cls:u.toColor(l)?"":l,color:u.toColor(l)?l:""})},_hideCrosshair:function(){var t=this._element.node();t.parentNode&&t.parentNode.removeChild(t)},destroy:function(){this._hideCrosshair()},_subscribeToHover:function(){var t=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(e){return t.indexOf(e.config.type)>=0}).forEach(function(t){t.on("data-hover",function(t,e){if(e.data){if(t===e.unit){var n=I.getParentUnit(this._chart.getSpec(),t.config);this._showCrosshair(e,t,n)}}else this._hideCrosshair()}.bind(this))},this)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){this._formatters=I.getFieldFormatters(this._chart.getSpec(),e.formatters),this._subscribeToHover()}}}r.default.api.plugins.add("crosshair",z);var B="tau-chart__tooltip";function V(t,e){return{render:function(t){return this.args=t,t=Object.assign({},t,{fields:this.filterFields(t.fields)}),this.rootTemplate(t)},rootTemplate:function(t){return['
',this.buttonsTemplate(),"
",'
',this.contentTemplate(t),"
"].join("\n")},contentTemplate:function(t){return this.fieldsTemplate(t)},filterFields:function(t){return t},getLabel:function(e){return t.getFieldLabel(e)},getFormatter:function(e){return t.getFieldFormat(e)},fieldsTemplate:function(t){var e=this,n=t.data;return t.fields.map(function(t){return e.itemTemplate({data:n,field:t})}).join("\n")},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]);return['
','
'+r+"
",'
'+i+"
","
"].join("\n")},buttonsTemplate:function(){return[this.buttonTemplate({cls:"i-role-exclude",text:"Exclude",icon:function(){return''}})].join("\n")},buttonTemplate:function(t){var e=t.icon,n=t.text,r=t.cls;return['
','
'," "+(e?e()+" ":"")+n,"
","
"].join("\n")},didMount:function(){var e=t.getDomNode().querySelector(".i-role-exclude");e&&e.addEventListener("click",function(){t.excludeHighlightedElement(),t.setState({highlight:null,isStuck:!1})})}}}var H=r.default.api.utils,W=r.default.api.domUtils,G=r.default.api.pluginsSDK,U="tau-chart__tooltip",X=function(){function t(t){this.settings=H.defaults(t||{},{align:"bottom-right",clickable:!0,clsClickable:U+"__clickable",clsStuck:"stuck",clsTarget:U+"-target",escapeHtml:!0,fields:null,formatters:{},getTemplate:null,spacing:24,winBound:12}),this.onRender=this._getRenderHandler()}return t.prototype.init=function(t){this._chart=t,this._tooltip=this._chart.addBalloon({spacing:this.settings.spacing,winBound:this.settings.winBound,auto:!0,effectClass:"fade"}),this._initDomEvents(),this.state={highlight:null,isStuck:!1},this.setState(this.state),this._template=this._getTemplate()},t.prototype._getTemplate=function(){var t=V(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t},t.prototype._renderTemplate=function(t,e){return this._template.render({data:t,fields:e})},t.prototype._initDomEvents=function(){var t=this;this._scrollHandler=function(){t.setState({highlight:null,isStuck:!1})},window.addEventListener("scroll",this._scrollHandler,!0),this.settings.clickable&&(this._outerClickHandler=function(e){var n=Array.from(document.querySelectorAll("."+t.settings.clsClickable)).concat(t.getDomNode()).map(function(t){return t.getBoundingClientRect()}),r=Math.min.apply(Math,n.map(function(t){return t.top})),i=Math.min.apply(Math,n.map(function(t){return t.left})),a=Math.max.apply(Math,n.map(function(t){return t.right})),o=Math.max.apply(Math,n.map(function(t){return t.bottom}));(e.clientXa||e.clientYo)&&t.setState({highlight:null,isStuck:!1})})},t.prototype.getDomNode=function(){return this._tooltip.getElement()},t.prototype.setState=function(t){var e=this,n=this.settings,r=this.state,i=this.state=Object.assign({},r,t);r.highlight=r.highlight||{data:null,cursor:null,unit:null},i.highlight=i.highlight||{data:null,cursor:null,unit:null},i.isStuck&&r.highlight.data&&(i.highlight=r.highlight),i.highlight.data!==r.highlight.data&&(i.highlight.data?(this._hideTooltip(),this._showTooltip(i.highlight.data,i.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(function(){e._setTargetSvgClass(!0)})):i.isStuck||!r.highlight.data||i.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!i.highlight.data||r.highlight.cursor&&i.highlight.cursor.x===r.highlight.cursor.x&&i.highlight.cursor.y===r.highlight.cursor.y||(this._tooltip.position(i.highlight.cursor.x,i.highlight.cursor.y),this._tooltip.updateSize());var a=this.getDomNode();this.settings.clickable&&i.isStuck!==r.isStuck&&(i.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),a.classList.add(n.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(i.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),a.classList.remove(n.clsStuck),requestAnimationFrame(function(){e._setTargetEventsEnabled(!0);var t=e._chart.getSVG();t&&W.dispatchMouseEvent(t,"mouseleave")})))},t.prototype._showTooltip=function(t,e){var n=this.settings,r=n.fields||"function"==typeof n.getFields&&n.getFields(this._chart)||Object.keys(t),i=this._renderTemplate(t,r);this._tooltip.content(i).position(e.x,e.y).place(n.align).show().updateSize(),this._template.didMount&&this._template.didMount()},t.prototype._hideTooltip=function(){window.removeEventListener("click",this._outerClickHandler,!0),this._template.willUnmount&&this._template.willUnmount(),this._tooltip.hide()},t.prototype.destroy=function(){window.removeEventListener("scroll",this._scrollHandler,!0),this._setTargetSvgClass(!1),this.setState({highlight:null,isStuck:!1}),this._tooltip.destroy()},t.prototype._subscribeToHover=function(){var t=this,e=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(t){return e.indexOf(t.config.type)>=0}).forEach(function(e){e.on("data-hover",function(e,n){var r=document.body.getBoundingClientRect();t.setState({highlight:n.data?{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit}:null})}),t.settings.clickable&&e.on("data-click",function(e,n){var r=document.body.getBoundingClientRect();t.setState(n.data?{highlight:{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit},isStuck:!0}:{highlight:null,isStuck:null})})})},t.prototype.getFieldFormat=function(t){var e=this._formatters[t]?this._formatters[t].format:function(t){return String(t)};return this.settings.escapeHtml?function(t){return H.escapeHtml(e(t))}:e},t.prototype.getFieldLabel=function(t){var e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?H.escapeHtml(e):e},t.prototype._accentFocus=function(t){var e=function(e){return e===t};this._chart.select(function(){return!0}).forEach(function(t){t.fire("highlight",e)})},t.prototype._removeFocus=function(){var t=function(){return null};this._chart.select(function(){return!0}).forEach(function(e){e.fire("highlight",t),e.fire("highlight-data-points",t)})},t.prototype.excludeHighlightedElement=function(){var t=this.state.highlight.data;this._chart.addFilter({tag:"exclude",predicate:function(e){return e!==t}}),this._chart.refresh()},t.prototype._getRenderHandler=function(){return function(){this._formatters=G.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}},t.prototype._setTargetSvgClass=function(t){h.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)},t.prototype._setTargetEventsEnabled=function(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()},t}(),q="diff-tooltip",Y=q+"__item",$=q+"__header";var K=r.default.api.utils,J={draw:function(){var t=this.node().config;this._container=t.options.slot(t.uid)},addInteraction:function(){var t=this;this.node().on("interval-highlight",function(e,n){t._drawRange(n)})},_drawRange:function(t){var e=this.node(),n=e.config,r=e.screenModel.flip,i=this._container,a="interval-highlight",o=a+"__gradient",s=t?t[0]:null,u=t?t[1]:null,l=r?n.options.width:n.options.height;K.take(function(){var e=i.selectAll("."+a).data(t?[1]:[]);return e.exit().remove(),{g:e,gEnter:e.enter().append("g").attr("class",a).attr("pointer-events","none")}}()).then(function(e){!function(){for(var e=a+"__defs",s=a+"__gradient-start",u=a+"__gradient-end",l=i.node();"svg"!==(l=l.parentNode).tagName;);var c=e+"__"+n.uid,f=h.select(l).selectAll("#"+c).data(t?[1]:[]);f.exit().remove();var d=f.enter().append("defs").attr("class",e).attr("id",c).append("linearGradient").attr("id",o).attr("x1","0%").attr("y1",r?"100%":"0%").attr("x2",r?"0%":"100%").attr("y2","0%");d.append("stop").attr("class",s).attr("offset","0%"),d.append("stop").attr("class",u).attr("offset","100%")}(),function(t){var e=t.g,n=t.gEnter,i=a+"__range",c=e.select("."+i),f=n.append("rect").attr("class",i).attr("fill","url(#"+o+")"),d=r?{x:0,y:u,width:l,height:s-u}:{x:s,y:0,width:u-s,height:l},h=d.x,p=d.y,g=d.width,m=d.height;f.merge(c).attr("x",h).attr("y",p).attr("width",Math.abs(g)).attr("height",Math.abs(m))}(e),function(t){var e=t.g,n=t.gEnter,i=a+"__range-start",o=e.select("."+i),u=n.append("line").attr("class",i),c=r?{x1:0,y1:s,x2:l,y2:s}:{x1:s,y1:0,x2:s,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;u.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e),function(t){var e=t.g,n=t.gEnter,i=a+"__range-end",o=e.select("."+i),s=n.append("line").attr("class",i),c=r?{x1:0,y1:u,x2:l,y2:u}:{x1:u,y1:0,x2:u,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;s.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e)})}},Q=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Z=r.default.api.utils,tt=function(t){function e(e){var n=t.call(this,e)||this;return n.onSpecReady=n._getSpecReadyHandler(),n}return Q(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this._unitsGroupedData=new Map},e.prototype._getTemplate=function(){var t=function(t,e){var n=V(t);return Object.assign({},n,{hasColor:function(){return null!=this.args.colorField},contentTemplate:function(t){return[this.fieldsTemplate(t),this.tableTemplate(t)].join("\n")},filterFields:function(e){var r=t.state.highlight.unit.screenModel.model,i=r.scaleColor,a=r.scaleX,o=r.scaleY,s=e.filter(function(t){return t!==i.dim&&t!==a.dim&&t!==o.dim}),u=function(){return s.push(a.dim)};return this.shouldShowColorTable()?u():(u(),i.dim&&s.push(i.dim),s.push(o.dim)),n.filterFields.call(this,s)},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]),a=this.args.prev,o=(this.args.valueField,this.shouldShowDiff(n)),s=['',""+i,o?" "+this.fieldUpdownTemplate(this.getDiff({data:e,prev:a,field:n})):"",""].join("");return['
','
'+r+"
"," "+s,"
"].join("\n")},shouldShowDiff:function(t){return t===this.args.valueField},getDiff:function(t){var e=t.data,n=t.prev,r=t.field,i=this.getFormatter(r),a=(e?e[r]:0)-(n?n[r]:0);return{diff:i(a),sign:Math.sign(a)}},fieldUpdownTemplate:function(t){var e=t.diff,n=t.sign,r=q+"__field__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},shouldShowColorTable:function(){var t=this.args.groups;return this.hasColor()&&t.length>1},tableTemplate:function(t){return this.shouldShowColorTable()?['
',this.tableHeaderTemplate(t),this.tableBodyTemplate(t),"
"].join("\n"):""},tableHeaderTemplate:function(t){var e=t.colorField,n=t.valueField,r=this.getLabel(e),i=this.getLabel(n);return['
',' '+r+"",' '+i+"",' ▼▲',"
"].join("\n")},tableBodyTemplate:function(t){var e=this,n=t.data,r=t.groups,i=t.valueField,a=t.colorField,o=n,s=r.map(function(t){var e=t.data;return e?e[i]:0}),u=Math.min.apply(Math,s),l=Math.max.apply(Math,s);return['
','
',r.map(function(t){var n=t.data,r=t.prev;return e.tableRowTemplate({data:n,prev:r,highlighted:o,valueField:i,colorField:a,min:u,max:l})}).join("\n"),"
","
"].join("\n")},tableRowTemplate:function(t){var e=t.data,n=t.prev,r=t.highlighted,i=t.valueField,a=t.colorField,o=t.min,s=t.max,u=e?e[i]:0,l=this.getFormatter(a)((e||n)[a]),c=this.getFormatter(i)(u),f=e===r,d=this.getDiff({data:e,prev:n,field:i}),h=d.diff,p=d.sign,g=this.getColor(e||n),m=g.color,y=g.colorCls;return['
'," "+this.valueBarTemplate({min:o,max:s,v:u,color:m,colorCls:y}),' '+l+"",' '+c+""," "+this.updownTemplate({diff:h,sign:p}),"
"].join("\n")},valueBarTemplate:function(t){var e=t.min,n=t.max,r=t.v,i=t.color,a=t.colorCls;e=Math.min(e,0);var o=(n=Math.max(0,n))-e;return[""].join("\n")},getColor:function(e){var n=t.state.highlight.unit.screenModel;return{color:n.color(e),colorCls:n.class(e)}},updownTemplate:function(t){var e=t.diff,n=t.sign,r=Y+"__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},didMount:function(){n.didMount.call(this),this._scrollToHighlighted(),this._reserveSpaceForUpdown()},_scrollToHighlighted:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+q+"__body__content"),i=e.querySelector("."+Y+"_highlighted");if(n&&r&&i){var a=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.getBoundingClientRect(),u=0;if(s.bottom>a.bottom){var l=s.bottom-a.bottom+s.height,c=o.bottom-a.bottom;u=-Math.min(l,c),r.style.transform="translateY("+u+"px)"}o.top+ua.bottom&&n.classList.add(q+"__body_overflow-bottom")}},_reserveSpaceForUpdown:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+$);if(n&&r){var i="."+Y+"__updown:not(:empty)",a=Array.from(e.querySelectorAll(i)).map(function(t){return t.scrollWidth}),o=Math.max.apply(Math,a),s=Math.max(0,Math.ceil(o-15));n.style.paddingRight=s+"px",r.style.paddingRight=s+"px"}}})}(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t},e.prototype._renderTemplate=function(t,e){var n=this.state.highlight.unit,r=n.screenModel,i=r.model,a=i.scaleColor,o=(i.scaleX,i.scaleY),s=this._unitsGroupedData.get(n),u=this._getHighlightRange(t,n),l=u[0],c=u[1],f=function(t){var e=r.model.color(t);return isFinite(l)&&s[l][e]?s[l][e][0]:null},d=f(t),h=n.config.stack,p=!(!n.config.flip&&n.config.guide.obsoleteVerticalStackOrder&&n.config.stack),g=function(){var t=a.domain().slice().reduce(function(t,e,n){return t[e]=n,t},{});return p?function(e,n){return t[e[a.dim]]-t[n[a.dim]]}:function(e,n){return t[n[a.dim]]-t[e[a.dim]]}}(),m=p?function(t,e){return o(t[o.dim])-o(e[o.dim])}:function(t,e){return o(e[o.dim])-o(t[o.dim])},y=function(t){return Object.keys(s[t]).reduce(function(e,n){return e.concat(s[t][n])},[]).sort(h?g:m)},v=y(c).map(function(t){r.model.color(t);return{data:t,prev:f(t)}});if(isFinite(l)){var b=y(l),x=v.reduce(function(t,e){return t[r.model.color(e.data)]=!0,t},{});b.forEach(function(t){var e=r.model.color(t);x[e]||v.push({data:null,prev:t})}),h&&v.sort(function(t,e){return g(t.data||t.prev,e.data||e.prev)})}return this._template.render({data:t,prev:d,fields:e,groups:v,valueField:o.dim,colorField:a.dim})},e.prototype._getRenderHandler=function(){var e=t.prototype._getRenderHandler.call(this);return function(){var t=this;e.call(this);var n=this._chart,r=n.select(function(t){return"chart"===t.config.namespace&&0===t.config.type.indexOf("ELEMENT.")&&"ELEMENT.INTERVAL_HIGHLIGHT"!==t.config.type}),i=n.select(function(t){return"ELEMENT.INTERVAL_HIGHLIGHT"===t.config.type}).reduce(function(t,e,n){return t[n]=e,t},{});r.forEach(function(e,n){var r=e.data();t._unitsGroupedData.set(e,t._getGroupedData(r,e)),e.on("data-hover",function(r,a){var o=i[n],s=a.unit&&a.unit===e?t._getHighlightRange(a.data,a.unit):null;o.fire("interval-highlight",s)})})}},e.prototype._getSpecReadyHandler=function(){return function(t,e){t.traverseSpec(e,function(t,e){if(0===t.type.indexOf("ELEMENT.")){var n=JSON.parse(JSON.stringify(t));n.type="ELEMENT.INTERVAL_HIGHLIGHT",n.namespace="highlight";var r=e.units.indexOf(t);e.units.splice(r,0,n)}})}},e.prototype._getGroupedData=function(t,e){var n=e.screenModel.model.scaleX,i=Z.groupBy(t,function(t){return n(t[n.dim]).toString()}),a=e.config.guide.x.tickPeriod||e.config.guide.x.timeInterval;if(a){var o=n.domain(),s=e.config.guide.utcTime;r.default.api.tickPeriod.generate(o[0],o[1],a,{utc:s}).filter(function(t){return t>=o[0]&&t<=o[1]}).forEach(function(t){var e=n(t);i[e]||(i[e]=[])})}return Object.keys(i).reduce(function(t,n){return t[n]=Z.groupBy(i[n],function(t){return e.screenModel.model.color(t)}),t},{})},e.prototype._getHighlightRange=function(t,e){var n=e.screenModel.flip,r=e.screenModel.model.scaleX,i=r(t[r.dim]),a=this._unitsGroupedData.get(e),o=Object.keys(a).map(Number).sort(n?function(t,e){return e-t}:function(t,e){return t-e}),s=o.indexOf(i);return 0===s?[i,i]:[o[s-1],i]},e}(X);function et(t){return new tt(t)}r.default.api.unitsRegistry.reg("ELEMENT.INTERVAL_HIGHLIGHT",J,"ELEMENT.GENERIC.CARTESIAN"),r.default.api.plugins.add("diff-tooltip",et);var nt=n(17),rt=n.n(nt),it=n(18),at=n(19),ot=n.n(at),st="Taucharts Export Plug-in:",ut=r.default.api.utils,lt=r.default.api.pluginsSDK,ct=lt.tokens(),ft=function(t,e){return t.replace(new RegExp("^"+e+"+|"+e+"+$","g"),"")},dt=function(t){return(t=Math.round(t))%2?t+1:t},ht=function(t){return null===t||""===t||void 0===t};var pt,gt={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},mt=function(t,e){e=e||"all";var n=document.createElement("style");return n.setAttribute("media",e),n.innerHTML=t,n},yt=mt(ot.a,"print"),vt=function(){yt&&yt.parentNode&&yt.parentNode.removeChild(yt),pt&&pt.parentNode&&pt.parentNode.removeChild(pt)};/PhantomJS/.test(navigator.userAgent)||("onafterprint"in window?window.addEventListener("afterprint",vt):window.matchMedia("screen").addListener(function(t){t.matches&&vt()}));var bt=function(t,e,n){var r="data:"+e+";charset=UTF-8,%ef%bb%bf"+encodeURIComponent(n),i=document.createElement("a");i.setAttribute("href",r),i.setAttribute("download",t),i.setAttribute("target","_new"),document.body.appendChild(i),i.click(),document.body.removeChild(i),i=null},xt=function(t){return[].slice.call(t.querySelectorAll("text.label")).forEach(function(t){t.innerHTML=[].slice.call(t.querySelectorAll("tspan")).reduce(function(t,e){var n=e.value||e.text||e.textContent||"";return t+(n=n.charAt(0).toUpperCase()+n.substr(1))},"")}),t},_t=function(t,e,n){n=null==n?"":String(n);var r=(t||{})[e]||{};return(ut.isObject(r.label)?r.label.text:r.label)||n};function wt(t){return{onRender:function(){this._info=lt.extractFieldsFormatInfo(this._chart.getSpec())},_normalizeExportFields:function(t,e){var n=this._info;return t.map(function(t){var e=t,r=n[t]||{};return"string"==typeof t&&(e={field:t,title:r.label||t}),"function"!=typeof e.value&&(e.value=function(t){var e=t[this.field];return r.isComplexField?(e||{})[r.tickLabel]:e}),e}).filter(function(t){return!e.find(function(e){return t.field===e})})},_handleError:function(t){r.default.api.globalSettings.log([st,t],"error")},_createDataUrl:function(t,e){var n=this;(function(){for(var t=[],e=0;e=200&&n.status<300){var t=n.responseText;i[e]=t,a.splice(a.indexOf(n),1),0===a.length&&r(null,i)}else a.forEach(function(t){return t.abort()}),r(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){a.forEach(function(t){return t.abort()}),r(t.error,null)},n.open("GET",t,!0),n.send(null)})}).apply(void 0,this._cssPaths.concat([function(i,a){if(i)e(i,null);else try{var o=a.join(" ").replace(/&/g,""),s=mt(o),u=document.createElement("div");t.fire("beforeExportSVGNode");var l=t.getSVG().cloneNode(!0);t.fire("afterExportSVGNode"),u.appendChild(xt(l)),h.select(l).attr("version",1.1).attr("xmlns","http://www.w3.org/2000/svg"),l.insertBefore(s,l.firstChild),n._renderAdditionalInfo(l,t),n._addBackground(l,n._backgroundColor);var c=document.createElement("canvas");c.height=l.getAttribute("height"),c.width=l.getAttribute("width"),rt()(c,l.parentNode.innerHTML,{renderCallback:function(t){var n=(new XMLSerializer).serializeToString(t);"=0}))?'"'+a+'"':a}return t.concat(i)},[]).join(e))},[o.map(function(t){return t.title}).join(e)]).join("\r\n"),u=(this._fileName||"export")+".csv";bt(u,"text/csv",s)},_renderFillLegend:function(e,n,r,i){var a=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=ut.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},o=this._unit.getScale("color"),s=_t(e.guide,"color",o.dim).toUpperCase(),u="text-transform:uppercase;font-weight:600;font-size:"+t.fontSize+"px",l=o.domain().sort(function(t,e){return t-e}),c=o.brewer.length,f=t.fontSize,d=a(l,c).reverse().map(function(t,e){return''}),h=a(l,3).reverse().map(function(t,e,n){return''+t+""}),p=[''," ",' ',d.join("")," "," ",' '+s+"",' ',' '," ",h.join("")," "," Sorry, your browser does not support inline SVG.",""].join(""),g=(new DOMParser).parseFromString(p,"application/xml").documentElement;return document.body.appendChild(g),n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")").node().appendChild(g),{h:120,w:0}},_renderColorLegend:function(e,n,r,i){var a=this._unit.getScale("color"),o=_t(e.guide,"color",a.dim).toUpperCase(),s=this._getColorMap(r.getChartModelData({excludeFilter:["legend"]}),a,a.dim).values,u=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")");return u.append("text").text(o.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":t.fontSize+"px"}),u.selectAll("g").data(s).enter().append("g").call(function(e){e.attr("transform",function(t,e){return"translate(5,"+20*(e+1)+")"}),e.append("circle").attr("r",6).attr("fill",function(t){return a.toColor(t.color)}).attr("class",function(t){return a.toClass(t.color)}),e.append("text").attr("x",12).attr("y",5).text(function(t){return ut.escape(ht(t.label)?"No "+o:t.label)}).style({"font-size":t.fontSize+"px"})}),{h:20*s.length,w:0}},_renderSizeLegend:function(e,n,r,i,a){var o,s=this._unit.getScale("size"),u=_t(e.guide,"size",s.dim).toUpperCase(),l=r.getChartModelData().sort(function(t,e){return s(t[s.dim])-s(e[s.dim])}),c=l.length,f=l[0][s.dim],d=l[c-1][s.dim];if(d-f){var h=function(t){return Math.log(t)/Math.LN10}(d-f),p=4-h<0?0:Math.round(4-h),g=Math.pow(10,p),m=(d-f)/5;o=ut.unique([f,f+m,f+2*m,f+3*m,d].map(function(t){return t===d||t===f?t:Math.round(t*g)/g}))}else o=[f];var y=o.map(function(t){var n=s(t),r=n/2;return{diameter:dt(n+2),radius:r,value:t,className:e.color?"color-definite":""}}.bind(this)).reverse(),v=Math.max.apply(null,y.map(function(t){return t.diameter})),b=t.fontSize,x=0,_=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+(t.paddingTop+a.h+20)+")");_.append("text").text(u.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":b+"px"}),_.selectAll("g").data(y).enter().append("g").call(function(t){t.attr("transform",function(){var t="translate(5,"+(x+=v)+")";return x+=10,t}),t.append("circle").attr("r",function(t){return t.radius}).attr("class",function(t){return t.className}).style({opacity:.4}),t.append("g").attr("transform",function(){return"translate("+v+","+b/2+")"}).append("text").attr("x",0).attr("y",0).text(function(t){return t.value}).style({"font-size":b+"px"})})},_renderAdditionalInfo:function(t,e){var n=this._findUnit(e);if(n){var r={h:0,w:0};t=h.select(t);var i=parseInt(t.attr("width"),10);t.attr("height");t.attr("width",i+160);var a=e.getScaleInfo(n.color);if(a.dim&&!a.discrete){var o=this._renderFillLegend(n,t,e,i);r.h=o.h+20,r.w=o.w}if(a.dim&&a.discrete){var s=this._renderColorLegend(n,t,e,i);r.h=s.h+20,r.w=s.w}var u=e.getScaleInfo(n.size);u.dim&&!u.discrete&&this._renderSizeLegend(n,t,e,i,r)}},_addBackground:function(t,e){if(e&&"transparent"!==e){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("fill",e),n.setAttribute("x",0),n.setAttribute("y",0),n.setAttribute("width",t.getAttribute("width")),n.setAttribute("height",t.getAttribute("height")),t.insertBefore(n,t.firstChild)}},onUnitDraw:function(t,e){r.default.api.isChartElement(e)&&"chart"===e.config.namespace&&(this._unit=e)},_getColorMap:function(t,e,n){return ut.unique(t.map(function(t){var r=t[n];return{color:e(r),value:r,label:r}}),function(t){return t.value}).reduce(function(t,e){return t.brewer[e.value]=e.color,t.values.push(e),t},{brewer:{},values:[]})},_select:function(t,e){var n=this["_to"+(t=t||"").charAt(0).toUpperCase()+t.slice(1)];n&&n.call(this,e)},_handleMenu:function(t,e,n){t.addEventListener("click",function(t){if("a"===t.target.tagName.toLowerCase()){var r=t.target.getAttribute("data-value");this._select(r,e),n.hide()}}.bind(this)),t.addEventListener("mouseover",function(t){"a"===t.target.tagName.toLowerCase()&&t.target.focus()}.bind(this)),t.addEventListener("keydown",function(t){if(t.keyCode===gt.ESCAPE&&n.hide(),t.keyCode===gt.DOWN&&(t.target.parentNode.nextSibling?t.target.parentNode.nextSibling.childNodes[0].focus():t.target.parentNode.parentNode.firstChild.childNodes[0].focus()),t.keyCode===gt.UP&&(t.target.parentNode.previousSibling?t.target.parentNode.previousSibling.childNodes[0].focus():t.target.parentNode.parentNode.lastChild.childNodes[0].focus()),t.keyCode===gt.ENTER){var r=t.target.getAttribute("data-value");this._select(r,e)}t.preventDefault()}.bind(this));var r=null,i=function(){r=setTimeout(function(){n.hide()},100)},a=function(){clearTimeout(r)},o=function(){n.toggle(),n.hidden||t.querySelectorAll("a")[0].focus()};t.addEventListener("blur",i,!0),t.addEventListener("focus",a,!0),this._container.addEventListener("click",o),this._onDestroy(function(){t.removeEventListener("blur",i,!0),t.removeEventListener("focus",a,!0),this._container.removeEventListener("click",o),clearTimeout(r)})},init:function(e){t=t||{},t=ut.defaults(t,{backgroundColor:"white",visible:!0,fontSize:13,paddingTop:30}),this._chart=e,this._info={},this._cssPaths=t.cssPaths,this._fileName=t.fileName,this._backgroundColor=t.backgroundColor||"white",this._destroyListeners=[],this._csvSeparator=t.csvSeparator||",",this._exportFields=t.exportFields||[],this._appendFields=t.appendFields||[],this._excludeFields=t.excludeFields||[],this._cssPaths||(this._cssPaths=[],r.default.api.globalSettings.log('[export plugin]: the "cssPath" parameter should be specified for correct operation',"warn"));var n=t.visible?"":"display:none";this._container=e.insertToHeader('Export');var i=e.addBalloon({place:"bottom-left"});i.content(['"].join("")),i.attach(this._container);var a=i.getElement();a.setAttribute("tabindex","-1"),this._handleMenu(a,e,i);var o=e.on("export-to",function(t,e){var n=e.type,r=e.fileName;this._fileName=r||this._fileName,this._select(n,t)}.bind(this)),s=e.on("exportTo",function(t,e){r.default.api.globalSettings.log([st,"`exportTo` event is deprecated, use `export-to` instead."],"warn"),this._select(e,t)}.bind(this));this._onDestroy(function(){i.destroy(),e.removeHandler(o),e.removeHandler(s)})},_onDestroy:function(t){this._destroyListeners.push(t)},destroy:function(){this._destroyListeners.forEach(function(t){t.call(this)},this);!function(t){t&&t.parentElement&&t.parentElement.removeChild(t)}(this._container)}}}r.default.api.plugins.add("export-to",wt);var Et=function(){return(Et=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0&&e.x.push(t),n.indexOf("y")>=0&&e.y.push(t),this};var o=function(){var t=i.scrollLeft,o=i.scrollTop;a.forEach(function(e){e.call(null,t,o)});var u=function(i){var a="x"===i?t:o;a!==n[i]&&(clearTimeout(r[i]),s(e[i],function(t){t.transition("floatingAxes_scrollVisibility"),t.attr("opacity",1e-6)}),r[i]=setTimeout(function(){s(e[i],function(t){r[i]=null,t.transition("floatingAxes_scrollVisibility").duration(256).attr("opacity",1)})},128)),n[i]=a};u("x"),u("y")};function s(t,e,n){t.forEach(function(t){e.call(n,t)})}i.addEventListener("scroll",o),this.fireScroll=function(){o.call(null,i.scrollLeft,i.scrollTop)},this.destroy=function(){i.removeEventListener("scroll",o)}}(n),u=function(){var t=function(t){var e="> ."+t+".axis.tau-active";return[".frame-root.tau-active "+e,".frame-root.tau-active .cell.tau-active "+e].join(", ")};return{x:Array.from(i.querySelectorAll(t("x"))),y:Array.from(i.querySelectorAll(t("y")))}}(),l=function(){function t(t){return{axis:t,parentTransform:function(t){var e,n={translate0:{x:0,y:0},translate:{x:0,y:0}},r=t;for(;r&&"SVG"!==r.nodeName.toUpperCase();)e=Bt(r),n.translate0.x+=e.translate0.x,n.translate0.y+=e.translate0.y,n.translate.x+=e.translate.x,n.translate.y+=e.translate.y,r=r.parentNode;return n}(t.parentNode),axisTransform:Bt(t)}}return{x:u.x.map(t),y:u.y.map(t)}}(),c=function(t){return Math.max.apply(null,t)}(l.y.map(function(t){return t.axisTransform.translate.x+t.parentTransform.translate.x}))+1,f=function(t){return Math.min.apply(null,t)}(l.x.map(function(t){return t.axisTransform.translate.y+t.parentTransform.translate.y}))-1,d=r.default.api.globalSettings.getScrollbarSize(n);var p={scrollLeft:n.scrollLeft,scrollTop:n.scrollTop,visibleWidth:n.clientWidth,visibleHeight:n.clientHeight,scrollbarWidth:d.width,scrollbarHeight:d.height,svgWidth:Number(a.attr("width")),svgHeight:Number(a.attr("height")),minXAxesY:f,maxYAxesX:c},g=function(){var e=a.append("defs").attr("class","floating-axes floating-axes__defs"),n={ns:{x1:0,y1:0,x2:0,y2:1},ew:{x1:1,y1:0,x2:0,y2:0},sn:{x1:0,y1:1,x2:0,y2:0},we:{x1:0,y1:0,x2:1,y2:0}};return Object.keys(n).forEach(function(r){var i=n[r],a=e.append("linearGradient").attr("id","shadow-gradient-"+r+"-"+t).attr("x1",i.x1).attr("y1",i.y1).attr("x2",i.x2).attr("y2",i.y2);a.append("stop").attr("class","floating-axes__shadow-start").attr("offset","0%").attr("stop-color",At).attr("stop-opacity",Ot),a.append("stop").attr("class","floating-axes__shadow-end").attr("offset","100%").attr("stop-color",kt).attr("stop-opacity",Pt)}),e}();function m(t,e){e.forEach(function(e){e.axis[Lt]=e.axis.parentNode;var n=t.append("g");o?n.attr("transform",jt(e.parentTransform.translate0.x,e.parentTransform.translate0.y)).transition().duration(o).attr("transform",jt(e.parentTransform.translate.x,e.parentTransform.translate.y)):n.attr("transform",jt(e.parentTransform.translate.x,e.parentTransform.translate.y)),n.node().appendChild(e.axis),Array.prototype.forEach.call(e.axis.querySelectorAll(".label"),function(t){t[Rt]=t.getAttribute("transform")})})}var y=function(){var t=p.svgHeight-p.minXAxesY+1+p.scrollbarHeight,e=a.append("g").attr("class","floating-axes floating-axes__x").call(x,p.svgWidth,t,0,p.minXAxesY);m(e,l.x);var n=e.selectAll(".label");return s.handleVisibilityFor(e,"y").handleVisibilityFor(n,"x").onScroll(function(t,r){var i=Math.min(p.visibleHeight+r-p.svgHeight-p.scrollbarHeight,0);e.attr("transform",jt(0,i)),n.each(function(){var e=zt(this[Rt]),n=-p.svgWidth+p.visibleWidth+t-10;this.setAttribute("transform","translate("+(e.x+n)+","+e.y+") rotate("+e.r+")")})}),e}(),v=function(){var t=a.append("g").attr("class","floating-axes floating-axes__y").call(x,p.maxYAxesX,p.svgHeight);m(t,l.y);var e=t.selectAll(".label");return s.handleVisibilityFor(t,"x").handleVisibilityFor(e,"y").onScroll(function(n,r){var i=Math.max(n,0);t.attr("transform",jt(i,0)),e.each(function(){var t=zt(this[Rt]),e=r+10;this.setAttribute("transform","translate("+t.x+","+(t.y+e)+") rotate("+t.r+")")})}),t}(),b=function(){var t=p.svgHeight-p.minXAxesY+p.scrollbarHeight,e=a.append("g").attr("class","floating-axes floating-axes__corner").call(x,p.maxYAxesX,t);return s.handleVisibilityFor(e,"xy").onScroll(function(n,r){var i=Math.max(n,0),a=p.minXAxesY,o=Math.min(r+p.visibleHeight-t,a);e.attr("transform",jt(i,o))}),e}();function x(t,n,r,i,a){i=i||0,a=a||0,t.append("rect").attr("class","i-role-bg").attr("x",i-1).attr("y",a-1).attr("width",Math.max(0,n+2)).attr("height",Math.max(0,r+2)).attr("fill",e.bgcolor)}var _=function(){var e=p.maxYAxesX,n=p.svgHeight-p.minXAxesY+p.scrollbarHeight,r=a.append("g").attr("class","floating-axes floating-axes__shadows").attr("pointer-events","none"),i=function(e,n,i,a,o){return r.append("rect").attr("fill","url(#shadow-gradient-"+e+"-"+t+")").attr("x",n).attr("y",i).attr("width",Math.max(0,a)).attr("height",Math.max(0,o))},o=i("ns",0,0,e,Ct),u=i("ew",p.visibleWidth-Ct,p.visibleHeight-n,Ct,n),l=i("sn",0,p.visibleHeight-n-Ct,e,Ct),c=i("we",e,p.visibleHeight-n,Ct,n);s.handleVisibilityFor(o,"xy").handleVisibilityFor(u,"xy").handleVisibilityFor(l,"xy").handleVisibilityFor(c,"xy").onScroll(function(t,e){var n=t,i=e;r.attr("transform",jt(n,i));var a=function(t,e){t.style("visibility",e?"":"hidden")};a(o,e>0&&p.svgHeight>p.visibleHeight),a(u,t+p.visibleWidthp.visibleWidth),a(l,e+p.visibleHeightp.visibleHeight),a(c,t>0&&p.svgWidth>p.visibleWidth)})}(),w=y.node(),E=v.node(),S=b.node();s.onScroll(function(t){i.insertBefore(w,0===t?S.nextElementSibling:E)}),s.fireScroll(),this.floatingLayout={defs:g,xAxes:y,yAxes:v,shadows:_},a.selectAll(".floating-axes").on("mouseenter",function(){Mt.dispatchMouseEvent(i,"mouseleave")}).on("mousemove",function(){h.event.stopPropagation()}).on("click",function(){h.event.stopPropagation()})},removeFloatingLayout:function(){function t(t){t.selectAll(".axis").each(function(){this[Lt].appendChild(this),delete this[Lt],Array.prototype.forEach.call(this.querySelectorAll(".label"),function(t){t.setAttribute("transform",t[Rt]),delete t[Rt]})})}this.floatingLayout&&(this.floatingLayout.xAxes.call(t),this.floatingLayout.yAxes.call(t),this.scrollManager.destroy(),this.floatingLayout=null),St.select(this.chart.getSVG()).selectAll(".floating-axes").remove()},detectChartBackgroundColor:function(){var t,e=this.chart.getLayout().layout;do{if("none"!==(t=window.getComputedStyle(e)).backgroundImage)return null;if("transparent"!==t.backgroundColor&&"rgba(0, 0, 0, 0)"!==t.backgroundColor)return t.backgroundColor}while(e=e.parentElement);return null}}}function jt(t,e){return"translate("+t+","+e+")"}function zt(t){var e={x:0,y:0,r:0};if(!t)return e;var n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}var a=t.indexOf("rotate(");if(a>=0){var o=t.indexOf(")",a+7),s=t.substring(a+7,o);e.r=parseFloat(s.trim())}return e}function Bt(t){var e=t[Nt]&&t[Nt].transform,n=zt(t.getAttribute("transform"));return{translate0:n,translate:e?zt(t[Nt].transform):n}}r.default.api.plugins.add("floating-axes",It);var Vt=r.default.api.utils;function Ht(t){Vt.defaults(t||{},{});var e=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains(n)&&r(t,e),e=e.parentNode})};return{init:function(t){this._chart=t,this._currentFilters={},this._legendColorByScaleId={};var n=this._chart.getSpec(),r=function(t){return function(e,r){var i=n.scales[r];return i.type===t&&i.dim&&e.push(r),e}};this._color=Object.keys(n.scales).reduce(r("color"),[]),this._fill=Object.keys(n.scales).reduce(r("fill"),[]);var i=this._color.length>0,a=this._fill.length>0;(i||a)&&(this._container=this._chart.insertToRightSidebar(this._containerTemplate),i&&(e(this._container,"click","tau-chart__legend__item-color",function(t,e){this._toggleLegendItem(e)}.bind(this)),e(this._container,"mouseover","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!0)}.bind(this)),e(this._container,"mouseout","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!1)}.bind(this))))},onSpecReady:function(){this._assignStaticBrewersOrEx()},onRender:function(){this._clearPanel(),this._drawColorLegend(),this._drawFillLegend()},_containerTemplate:'
',_template:Vt.template('
<%=name%>
<%=items%>
'),_itemTemplate:Vt.template(["
\">",'
','
',"
","<%=label%>","
"].join("")),_itemFillTemplate:Vt.template(['
\' class="tau-chart__legend__item tau-chart__legend__item-color" style="padding: 6px 0px 10px 40px;margin-left:10px;">','
',' ',' <%=label%>',"
","
"].join("")),_clearPanel:function(){this._container&&(this._container.innerHTML="")},_drawColorLegend:function(){var t=this;t._color.forEach(function(e){var n=t._chart.select(function(t){return t.config.color===e})[0];if(n){var r=n.getScale("color"),i=t._chart.getDataSources({excludeFilter:["legend"]}),a=Vt.unique(i[r.source].data.map(function(t){return t[r.dim]})).map(function(n){var i=Vt.escape(n),a=r.dim+i;return{scaleId:e,dim:r.dim,color:r(n),disabled:t._currentFilters.hasOwnProperty(a),label:n,value:i}});t._legendColorByScaleId[e]=a,t._container.insertAdjacentHTML("beforeend",t._template({items:a.map(function(e){return t._itemTemplate({scaleId:e.scaleId,dim:e.dim,color:e.color,classDisabled:e.disabled?"disabled":"",label:e.label,value:e.value})}).join(""),name:(((n.guide||{}).color||{}).label||{}).text||r.dim}))}})},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n=t._chart.select(function(t){return"COORDS.MAP"===t.config.type&&t.config.fill===e});if(n.length>0){var r=n[0].getScale("fill"),i=r.brewer,a=r.domain(),o=(a[1]-a[0])/i.length,s=Vt.range(i.length).map(function(e){var n=a[0]+e*o,s="";return 0===e&&(s=a[0]),e===i.length-1&&(s=a[1]),t._itemFillTemplate({color:r(n),label:s,value:Vt.escape(n)})});t._container.insertAdjacentHTML("beforeend",t._template({items:s.join(""),name:(((n[0].guide||{}).fill||{}).label||{}).text||r.dim}))}})},_toggleLegendItem:function(t){var e=t.getAttribute("data-scale-id"),n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=n+r,a=this._legendColorByScaleId[e].filter(function(t){return!t.disabled});if(1!==a.length||e!==a[0].scaleId||r!==a[0].value){var o=this._currentFilters;if(o.hasOwnProperty(i)){var s=o[i];delete o[i],t.classList.remove("disabled"),this._chart.removeFilter(s)}else t.classList.add("disabled"),o[i]=this._chart.addFilter({tag:"legend",predicate:function(t){return t[n]!=r}});this._chart.refresh()}},_highlightToggle:function(t,e){var n=t.getAttribute("data-scale-id"),r=t.getAttribute("data-dim"),i=t.getAttribute("data-value");this._chart.select(function(t){return t.config.color===n}).forEach(function(t){t.fire("highlight",function(t){return!e||t[r]==i})})},_generateColorMap:function(t){var e=Vt.range(20).map(function(t){return"color20-"+(1+t)});return t.reduce(function(t,n,r){return t[n]=e[r%20],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();n.brewer||(n.brewer="measure"!==n.dimType?t._generateColorMap(i):["#e5f5e0","#a1d99b","#31a354"])})}}}r.default.api.plugins.add("geomap-legend",Ht);var Wt=r.default.api.utils;function Gt(t){Wt.defaults(t||{},{});var e=function(){return!1};return{init:function(t){this._currNode=null,this._currData=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&(n._exclude(),n._tooltip.hide(),n._blurSelection()),e=e.parentNode},!1);var e,n=this;this._showTooltip=function(t){clearTimeout(e),n._currData=t.data;var r="No data";null!==t.data&&(r=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join(""));var i=n._tooltip.getElement().querySelectorAll(".i-role-content");i[0]&&(i[0].innerHTML=r);var a=n._tooltip.getElement().querySelectorAll(".i-role-exclude");if(a[0]){var o=t.data&&n._chart.getChartModelData().length>1;a[0].style.visibility=o?"visible":"hidden"}n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this._hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},t?0:1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._hideTooltip(!0),n._blurSelection()},!1)},onRender:function(){var t=this;this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(e){t._subscribeToPoints(e),t._subscribeToArea(e)})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:Wt.template(['
','
<%=label%>
','
<%=value%>
',"
"].join("")),_exclude:function(){this._chart.addFilter({tag:"exclude",predicate:function(t){return function(e){return JSON.stringify(e)!==JSON.stringify(t)}}(this._currData)}),this._chart.refresh()},_blurSelection:function(){this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(t){t.fire("highlight-area",e)}),this._currNode=null,this._currData=null},_subscribeToPoints:function(t){var e=this;t.on("point-mouseover",function(t,n){e._showTooltip(n)}),t.on("point-mouseout",function(t,n){e._hideTooltip()})},_subscribeToArea:function(t){var e=this;!t.getScale("code").dim||t.on("area-click",function(n,r){e._currNode=n,r.data?e._currData===r.data?(e._hideTooltip(!0),e._blurSelection()):(t.fire("highlight-area",function(t){var e=JSON.stringify(t);return function(t){return JSON.stringify(t)===e}}(r.data)),e._showTooltip(r)):(e._showTooltip(r),e._hideTooltip(!1),e._blurSelection())})}}}r.default.api.plugins.add("geomap-tooltip",Gt);var Ut=n(2),Xt=r.default.api.utils,qt=r.default.api.pluginsSDK,Yt=qt.tokens();function $t(t){var e=Xt.defaults(t||{},{title:"Layers",label:"Layer Type",showPanel:!0,showLayers:!0,mode:"merge",axisWidth:45,layers:[]});e.layers.forEach(function(t){t.guide=Xt.defaults(t.guide||{},{scaleOrient:"left",textAnchor:"end",hide:!1})});var n=function(t){return function(e){return Object.assign(e,t)}},r={line:n({type:"ELEMENT.LINE"}),area:n({type:"ELEMENT.AREA"}),dots:n({type:"ELEMENT.POINT"}),scatterplot:n({type:"ELEMENT.POINT"}),bar:n({type:"ELEMENT.INTERVAL"}),"stacked-bar":n({type:"ELEMENT.INTERVAL",stack:!0})};return{init:function(t){this._chart=t;var n=qt.spec(this._chart.getSpec()),r=this.checkIfApplicable(n);if(this._isApplicable=0===r.length,n.addTransformation("defined-only",function(t,e){var n=e.key;return t.filter(function(t){return null!==t[n]&&void 0!==t[n]})}),this._isApplicable){this.isFacet=this.checkIsFacet(n),this.primaryY=this.findPrimaryLayer(n);var i=this.getLayersText(),a=this.getLayersGroup(),o=e.label;this.fieldColorScale=o,n.setSettings("excludeNull",!1).setSettings("fitModel",null).addScale(o,{type:"color",source:"/",dim:o,brewer:e.brewer}).addTransformation("slice-layer",function(t,e){var n=e.key,r=e.group;return r?t.filter(function(t){var e=t[r],n=t[e];return e&&null!==n&&void 0!==n}):t.filter(function(t){return t[o]===i[n]&&null!==t[n]&&void 0!==t[n]})});var s=[this.primaryY].concat(e.layers).reduce(function(t,e){return t.concat(e.y)},[]);t.setupChartSourceModel(function(t){var e={};e[o]={type:"category"};var n={"/":{dims:e,data:[]}};return n["/"].dims=Object.assign(e,t["/"].dims),n["/"].data=t["/"].data.reduce(function(t,e){return t.concat(s.map(function(t){var n={};n[o]=i[t];var r=a[t];return r&&(n[r]=e[t],n.subLayer=r),Object.assign(n,e)}))},[]),Object.assign(n,Xt.omit(t,"/"))}),e.showPanel&&(this._container=t.insertToRightSidebar(this.containerTemplate),this._container.classList.add("applicable-true"),this.uiChangeEventsDispatcher=function(t){var n=t.target,r=n.classList;r.contains("i-role-show-layers")&&(e.showLayers=n.checked),r.contains("i-role-change-mode")&&(e.mode=n.value),this._chart.refresh()}.bind(this),this._container.addEventListener("change",this.uiChangeEventsDispatcher,!1))}else{n.getSettings("log")("[layers plugin]: is not applicable. "+r.join(" / "))}},getLayersText:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){return(Array.isArray(e.y)?e.y:[e.y]).reduce(function(t,n){return t[n]=this.extractLabelForKey(e,n),t}.bind(this),t)}.bind(this),{})},getLayersGroup:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){var n=null;return Array.isArray(e.y)&&(n=e.y.join(", ")),Xt.flatten([e.y]).reduce(function(t,e){return t[e]=n,t},t)}.bind(this),{})},checkIsFacet:function(t){return t.unit().reduce(function(t,e,n){return t||(n&&"COORDS.RECT"===n.type&&"COORDS.RECT"===e.type?t=!0:t)},!1)},checkIfApplicable:function(t){return t.unit().reduce(function(e,n,r){if(r&&"COORDS.RECT"!==r.type)return e.concat("Chart specification contains non-rectangular coordinates");if(r&&"COORDS.RECT"===r.type&&"COORDS.RECT"!==n.type){var i=t.getScale(n.y);if("measure"!==t.getSourceDim(i.source,i.dim).type)return e.concat("Y scale is not a measure")}return e},[])},isLeafElement:function(t,e){return e&&"COORDS.RECT"===e.type&&"COORDS.RECT"!==t.type},isFirstCoordNode:function(t,e){return!e&&t&&"COORDS.RECT"===t.type},isFinalCoordNode:function(t,e){return t&&"COORDS.RECT"===t.type&&t.units.every(function(t){return"COORDS.RECT"!==t.type})},buildLayersLayout:function(t){return t.regSource("$",{dims:{x:{type:"category"},y:{type:"category"}},data:[{x:1,y:1}]}).addScale("xLayoutScale",{type:"ordinal",source:"$",dim:"x"}).addScale("yLayoutScale",{type:"ordinal",source:"$",dim:"y"}).unit({type:"COORDS.RECT",x:"xLayoutScale",y:"yLayoutScale",expression:{source:"$",inherit:!1,operator:!1},guide:{showGridLines:"",x:{cssClass:"facet-axis"},y:{cssClass:"facet-axis"}}})},findPrimaryLayer:function(t){var e=this,n=t.unit().reduce(function(n,r){return n.concat(e.isFinalCoordNode(r)?{y:t.getScale(r.y).dim,isPrimary:!0,guide:r.guide.y,scaleName:r.y}:[])},[]);return qt.cloneObject(n[0])},createPrimaryUnitReducer:function(t,n,r,i){var a=this;return function(o,s,u){var l=function(t){return!0!==t.guide.hide};if(a.isFacet&&a.isFirstCoordNode(s,u)){s.guide.y.label=s.guide.y.label||{};var c=s.guide.y.label._original_text||s.guide.y.label.text;s.guide.y.label.text=[c,n.filter(l).map(a.extractLayerLabel.bind(a)).join(", ")].join(t.getSettings("facetLabelDelimiter")),"dock"===e.mode&&(s.guide.y.label.padding-=15,s.guide.y.padding+=15,s.guide.y.rotate=-90,s.guide.y.textAnchor="middle")}return a.isLeafElement(s,u)&&(u.units=u.units.filter(function(t){return t!==s})),a.isFinalCoordNode(s)&&(s.guide.y.label=s.guide.y.label||{},"dock"===e.mode&&(s.guide.padding.l=r,s.guide.padding.r=i,s.guide.y.hide=!0),"merge"===e.mode&&(s.guide.y.label.text=a.isFacet?"":n.filter(l).map(a.extractLayerLabel.bind(a)).join(", "))),o}},createSecondaryUnitReducer:function(t,n,i,a,o,s,u,l){var c=this,f=c.getScaleName(n.scaleName||n.y),d=n.guide.scaleOrient,h=Array.isArray(n.y),p=n.isPrimary;return function(g,m,y){if(c.isFacet&&c.isFirstCoordNode(m,y)&&(m.guide.y.label.text="",m.guide.x.hide=!0,m.guide.y.hide=!0),c.isLeafElement(m,y)){(n.type?r[n.type]:function(t){return t})(m),m.y=f;var v=t.getScale(m.size).dim;if(p&&v);else{var b="size_null"+l;t.addScale(b,{type:"size",source:"?",mid:1}),m.size=b}var x=t.getScale(m.color).dim;p&&x||(m.color=c.fieldColorScale,m.expression.operator="groupBy",m.expression.params=h?["subLayer"]:[c.fieldColorScale]);var _=h?{group:"subLayer"}:{key:n.y};qt.unit(m).addTransformation("slice-layer",_)}if(c.isFinalCoordNode(m)){if(m.y=f,m.guide.y=Object.assign(m.guide.y,n.guide||{}),m.guide.y.label=m.guide.y.label||{},m.guide.y.label.text=c.extractLayerLabel(n),m.guide.x.hide=!0,"dock"===e.mode){m.guide.showGridLines="",m.guide.padding.l=i,m.guide.padding.r=a,m.guide.y.label.textAnchor="end",m.guide.y.label.dock="right",m.guide.y.label.padding="right"===d?1:-10,m.guide.y.label.cssClass="label inline";var w="right"===d?u:s;m.guide.y.padding+=o*w}"merge"===e.mode&&(m.guide.showGridLines="",m.guide.y.hide=!0)}return g}},getScaleName:function(t){return Array.isArray(t)?t.join(", "):t},extractLabelForKey:function(t,e){var n=t.guide||{};n.label="string"==typeof n.label?{text:n.label}:n.label;var r=n.label||{},i=r.byKeys||{};return Array.isArray(t.y)?i[e]||e:r.text||r._original_text||t.y},extractLayerLabel:function(t){var e=this;return(Array.isArray(t.y)?t.y:[t.y]).map(function(n){return e.extractLabelForKey(t,n)}).join(", ")},onSpecReady:function(t,n){var r=this,i=qt.spec(n);if(e.showLayers&&r._isApplicable){i=e.layers.reduce(function(t,e){var n=r.getScaleName(e.y);return t.addScale(n,Object.assign({type:"linear",source:"/",dim:n,autoScale:!0},Xt.pick(e.guide||{},"min","max","autoScale","nice","niceInterval")))},i);var a,o=[this.primaryY].concat(e.layers).sort(function(t,e){return(t.guide.zIndex||0)-(e.guide.zIndex||0)}),s=i.unit(),u=e.axisWidth,l=function(t){return function(e){var n=e.guide.scaleOrient||"left";return!0!==e.guide.hide&&n===t}},c=l("left"),f=l("right"),d=o.filter(c).length*u,h=o.filter(f).length*u,p=r.buildLayersLayout(i).addFrame({key:{x:1,y:1},units:[(a=qt.unit(s.clone())).reduce(r.createPrimaryUnitReducer(i,o,d,h),a).value()]}),g=-1,m=-1;o.reduce(function(t,e,n){return g=c(e)?g+1:g,m=f(e)?m+1:m,t.addFrame({key:{x:1,y:1},units:[(a=qt.unit(s.clone())).reduce(r.createSecondaryUnitReducer(i,e,d,h,u,g,m,n),a).value()]})},p)}else i.unit().traverse(function(t,e){r.isLeafElement(t,e)&&qt.unit(t).addTransformation("defined-only",{key:i.getScale(t.y).dim})})},onUnitsStructureExpanded:function(){var t=this;if(t._isApplicable&&"merge"===e.mode){var n=qt.spec(t._chart.getSpec()),r=t.primaryY.scaleName,i=e.layers.map(function(e){return t.getScaleName(e.y)}).filter(function(t){return n.getScale(t)}).concat(r),a=i.reduce(function(e,n){var r=t._chart.getScaleInfo(n);return e[n]=r.domain().filter(function(t){return Number.isFinite(t)}),e},{}),o=Ut.extent(Xt.flatten(Object.keys(a).map(function(t){return a[t]})));i.forEach(function(t){var e=n.getScale(t);e.min=o[0],e.max=o[1],e.nice=!1})}},containerTemplate:'
',template:Xt.template(['","
",'","
"].join("")),onRender:function(){this._isApplicable&&e.showPanel&&(this._container.innerHTML=this.template({title:e.title,mode:e.mode,showLayers:e.showLayers}))}}}r.default.api.plugins.add("layers",$t);var Kt=n(6),Jt=r.default.api.utils,Qt=r.default.api.pluginsSDK,Zt=".tau-chart__legend__reset",te=".tau-chart__legend__item-color",ee=".tau-chart__legend__guide--color__overlay",ne=4,re=13,ie=0,ae=function(){return++ie},oe=r.default.api.utils.xml,se=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=Jt.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},ue=function(t,e,n){if(t.length<3)return t.slice(0);if(e<3)return[t[0],t[t.length-1]];var r,i=t[0]<0?Math.abs(t[0]):0,a=function(t){return t},o="sqrt"===n?function(t){return Math.sqrt(t+i)}:a,s="sqrt"===n?function(t){return Math.pow(t,2)-i}:a,u=[(t=t.map(o))[0]],l=t[t.length-1]-t[0],c=.5*l/(e-1),f=Jt.range(1,e-1).map(function(t){var n=l*t/(e-1);return{min:n-c,mid:n,max:n+c,diff:Number.MAX_VALUE,closest:null}}),d=0,h=function(){if(d!==f.length){var t=r;(r=f[d++]).min=Math.max(r.min,(t&&null!==t.closest?t.closest:u[0])+c)}};return h(),t.forEach(function(t){if(!(tr.max&&h();var e=Math.abs(t-r.mid);e0?Math.abs(e-t):n,a=ce(i),o=Math.abs(r-a);return Math.abs(r)>3&&o<=3?he:function(t){var e=ce(n-t),r=Math.min((a<0?Math.abs(a):0)+(e0,s=this._fill.length>0,u=this._size.length>0;if(this._assignStaticBrewersOrEx(),a||s||u){switch(n.position){case"left":this._container=this._chart.insertToLeftSidebar(this._containerTemplate);break;case"right":this._container=this._chart.insertToRightSidebar(this._containerTemplate);break;case"top":this._container=this._chart.insertToHeader(this._containerTemplate);break;case"bottom":this._container=this._chart.insertToFooter(this._containerTemplate);break;default:this._container=this._chart.insertToRightSidebar(this._containerTemplate)}a&&(o(this._container,"click",Zt,function(t,n){e._toggleLegendItem(n,"reset")}),o(this._container,"click",te,function(t,n){var r=t.ctrlKey||t.target.matches(ee)?"leave-others":"focus-single";e._toggleLegendItem(n,r)}),o(this._container,"mouseover",te,function(t,n){e._highlightToggle(n,!0)}),o(this._container,"mouseout",te,function(t,n){e._highlightToggle(n,!1)}))}},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])}),this._container&&this._container.parentElement&&(this._clearPanel(),this._container.parentElement.removeChild(this._container))},onSpecReady:function(t,e){this._formatters=Qt.getFieldFormatters(e,n.formatters)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){var t=this;if(e&&n.selectedCategories&&0!==n.selectedCategories.length){var r=this._getLegendColorByScales();return Object.keys(r).forEach(function(e){r[e].legendColorItems.forEach(function(e){var r=e.value,i=e.dim;if(-1===n.selectedCategories.indexOf(JSON.parse(r))){var o=i+r,s=a(i,r);t._currentFilters[o]=t._chart.addFilter({tag:"legend",predicate:function(t){return!s(t)}})}})}),e=!1,void this._chart.refresh()}this._clearPanel(),this._drawColorLegend(),this._drawFillLegend(),this._drawSizeLegend()},_containerTemplate:'
',_template:Jt.template(['
',"<%=top%>",'
<%=name%>
',"<%=items%>","
"].join("")),_itemTemplate:Jt.template(["
\">",'
','
','
',"
","
","
",' <%=label%>',"
"].join("")),_resetTemplate:Jt.template(['
','
Reset
',"
"].join("")),_clearPanel:function(){this._container&&(clearTimeout(this._scrollTimeout),this._getScrollContainer().removeEventListener("scroll",this._scrollListener),this._container.innerHTML="")},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n=t._chart.select(function(t){return t.config.color===e})[0];if(n){var r=n.config.guide||{},a=n.getScale("color"),o=a.domain().sort(function(t,e){return t-e}),s=i(o),u=s?o.map(Number):o,l=pe(u[0],u[u.length-1]),c=function(){var e=t._chart.getSpec(),n=Qt.extractFieldsFormatInfo(e)[a.dim].format;return n||(n=function(t){return new Date(t)}),function(t){return String(n(t))}}(),f=s?c:l,d=a.brewer.length,h=((r.color||{}).label||{}).text||a.dim,p=function(t){return t.length*re*.618},g=a.isInteger?(u[1]-u[0])%3==0?4:(u[1]-u[0])%2==0?3:2:3,m=se(u,g),y=(s?m.map(function(t){return new Date(t)}):m).map(f);y[0]===y[y.length-1]&&(y=[y[0]]),t._container.insertAdjacentHTML("beforeend",t._template({name:Jt.escape(h),top:null,items:'
'}));var v=t._container.lastElementChild.querySelector(".tau-chart__legend__gradient-wrapper"),b=v.getBoundingClientRect().width,x=!1;y.reduce(function(t,e){return t+p(e)},0)>b&&(y.length>1&&p(y[0])+p(y[y.length-1])>b?x=!0:y=[y[0],y[y.length-1]]);var _=x?function(){var t=-.382*re/2;return{width:b,height:120,barX:0,barY:0,barWidth:20,barHeight:120,textAnchor:"start",textX:Jt.range(g).map(function(){return 25}),textY:1===y.length?60+.618*re:y.map(function(e,n){var r=(y.length-1-n)/(y.length-1);return re*(1-r)+120*r+t})}}():function(){var t=p(y[0])/2,e=p(y[y.length-1])/2;return{width:b,height:28+re,barX:0,barY:0,barWidth:b,barHeight:20,textAnchor:"middle",textX:1===y.length?[b/2]:y.map(function(n,r){var i=r/(y.length-1);return t*(1-i)+(b-e)*i}),textY:Jt.range(g).map(function(){return 28+re})}}(),w=se(u,d).map(function(t,e){return oe("stop",{offset:e/(d-1)*100+"%",style:"stop-color:"+a(t)+';stop-opacity:1"'})}),E="legend-gradient-"+t.instanceId,S=oe.apply(void 0,["svg",{class:"tau-chart__legend__gradient",width:_.width,height:_.height},oe("defs",oe.apply(void 0,["linearGradient",{id:E,x1:"0%",y1:x?"100%":"0%",x2:x?"0%":"100%",y2:"0%"}].concat(w))),oe("rect",{class:"tau-chart__legend__gradient__bar",x:_.barX,y:_.barY,width:_.barWidth,height:_.barHeight,fill:"url(#"+E+")"})].concat(y.map(function(t,e){return oe("text",{x:_.textX[e],y:_.textY[e],"text-anchor":_.textAnchor},t)})));v.insertAdjacentHTML("beforeend",S)}})},_drawSizeLegend:function(){var t=this;t._size.forEach(function(e){var n=t._chart.select(function(t){return t.config.size===e})[0];if(n){var r=n.config.guide||{},i=n.getScale("size"),a=i.domain().sort(function(t,e){return t-e});if(!Array.isArray(a)||!a.every(isFinite))return;var o=((r.size||{}).label||{}).text||i.dim,s=a[0],u=a[a.length-1],l=[s];if(u-s){var c=le(u-s),f=Math.round(4-c),d=Math.pow(10,f),h=Jt.unique(t._chart.getDataSources({excludeFilter:["legend"]})[i.source].data.map(function(t){return t[i.dim]}).filter(function(t){return t>=s&&t<=u})).sort(function(t,e){return t-e}),p=ue(h,ne,i.funcType);l=Jt.unique(p.map(function(t){return Math.round(t*d)/d}))}var g=pe(l[0],l[l.length-1]),m=function(t){return t.length*re*.618};l.reverse();var y=l.map(i),v=Math.max.apply(null,y),b=l.map(g);t._container.insertAdjacentHTML("beforeend",t._template({name:Jt.escape(o),top:null,items:'
'}));var x=t._container.lastElementChild.querySelector(".tau-chart__legend__size-wrapper"),_=x.getBoundingClientRect().width,w=!1;(Math.max.apply(null,b.map(m))>_/4||1===b.length)&&(w=!0);var E=w?function(){for(var t=re,e=y[0]/2,n=y[y.length-1]/2,r=[e],i=1,a=void 0,o=void 0;i0&&(t._updateResetButtonPosition(),t._scrollTimeout=null,t._scrollListener=function(){var e=t._container.querySelector(Zt);e.style.display="none",t._scrollTimeout&&clearTimeout(t._scrollTimeout),t._scrollTimeout=setTimeout(function(){t._updateResetButtonPosition(),e.style.display="",t._scrollTimeout=null},250)},t._getScrollContainer().addEventListener("scroll",t._scrollListener))},_toggleLegendItem:function(t,e){var r=this,i=this._currentFilters,o=t?Array.prototype.filter.call(t.parentNode.childNodes,function(t){return t.matches(te)}):null,s=function(t){var e=t.getAttribute("data-dim"),n=t.getAttribute("data-value");return{sid:t.getAttribute("data-scale-id"),dim:e,val:n,key:e+n}},u=function(t){return t in i},l=function(t,e){var n=s(t);if(u(n.key)===e)if(e){var o=i[n.key];delete i[n.key],t.classList.remove("disabled"),r._chart.removeFilter(o)}else{t.classList.add("disabled");var l=a(n.dim,n.val);i[n.key]=r._chart.addFilter({tag:"legend",predicate:function(t){return!l(t)}})}},c=function(e){return e===t},f=!!t&&u(s(t).key),d=function(t,e){t.querySelector(".tau-chart__legend__guide").style.backgroundColor=e?"":"transparent"};if("reset"===e)o.forEach(function(t){l(t,!0),d(t,!0)});else if("leave-others"===e)o.forEach(function(t){c(t)&&l(t,f)}),d(t,f);else if("focus-single"===e){var h=!f&&o.every(function(t){return c(t)||u(s(t).key)});o.forEach(function(t){var e=c(t)||h;l(t,e)}),f&&d(t,!0)}var p=o.filter(function(t){return!u(s(t).key)}).map(function(t){return JSON.parse(s(t).val)});n.onSelect({type:e,selectedCategories:p}),this._chart.refresh()},_highlightToggle:function(t,e){if(!t.matches(".disabled")){var n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=e?a(n,r):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){t.fire("highlight",i)})}},_getScrollContainer:function(){return this._container.parentNode.parentNode},_updateResetButtonPosition:function(){this._container.querySelector(Zt).style.top=this._getScrollContainer().scrollTop+"px"},_generateColorMap:function(t,e){var n=e.length;return t.reduce(function(t,r,i){return t[r]=e[i%n],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();if(!n.brewer||Array.isArray(n.brewer)){var a=n.brewer||Jt.range(20).map(function(t){return"color20-"+(1+t)});n.brewer=t._generateColorMap(i,a)}t._legendOrderState[e]=i.reduce(function(t,e,n){return t[e]=n,t},{})})}}}r.default.api.plugins.add("legend",ge);var me=r.default.api.utils;function ye(t){var e=me.defaults(t||{},{verbose:!1,forceBrush:{}}),n={init:function(t){e.verbose&&(this.panel=t.insertToRightSidebar(this.template())),t.traverseSpec(t.getSpec(),function(t){t&&"COORDS.PARALLEL"===t.type&&(t.guide=t.guide||{},t.guide.enableBrushing=!0)}),n.forceBrush=e.forceBrush||{}},onRender:function(t){var r=t.getSpec().scales,i=Object.keys(r).reduce(function(t,e){var i=r[e].dim;return n.forceBrush[i]&&(t[e]=n.forceBrush[i]),t},{}),a=t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type});a.forEach(function(t,r){t.parentUnit.on("brush",function(i,a){n.forceBrush={};var o=a.map(function(t){var e=t.dim,r=t.func,i=t.args;n.forceBrush[e]=i;var a=function(){return!0};return"between"===r&&(a=function(t){return t[e]>=i[0]&&i[1]>=t[e]}),"inset"===r&&(a=function(t){return i.indexOf(t[e])>=0}),a}),s=0;if(t.fire("highlight",function(t){var e=o.every(function(e){return e(t)});return s+=e?1:0,e}),e.verbose){var u=n.panel.getElementsByClassName("i-"+r);if(0===u.length){var l=document.createElement("div");l.className="i-"+r,n.panel.appendChild(l),u[0]=l}u[0].innerHTML=a.reduce(function(t,e){return t+"
"+e.dim+": ["+e.args.join(",")+"]
"},"
Matched: "+s+"
")}})}),a.forEach(function(t){t.parentUnit.fire("force-brush",i)})},template:me.template('
')};return n}r.default.api.plugins.add("parallel-brushing",ye);var ve=r.default.api.utils;function be(t){ve.defaults(t||{},{});return{init:function(t){this._cursor=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&n._exclude(),e=e.parentNode;n._tooltip.hide()},!1);var e,n=this;this.showTooltip=function(t){clearTimeout(e),n._cursor=t.data;var r=n._tooltip.getElement().querySelectorAll(".i-role-content");r[0]&&(r[0].innerHTML=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join("")),n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this.hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._tooltip.hide()},!1)},_exclude:function(){this._chart.addFilter({tag:"exclude",predicate:function(t){return function(e){return JSON.stringify(e)!==JSON.stringify(t)}}(this._cursor)}),this._chart.refresh()},onRender:function(t){var e=this;t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type}).forEach(function(t){t.on("mouseout",function(t,n){e.hideTooltip(n)}),t.on("mouseover",function(t,n){e.showTooltip(n)})})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:ve.template(['
','
<%=label%>
','
<%=value%>
',"
"].join(""))}}r.default.api.plugins.add("parallel-tooltip",be);var xe=n(8),_e=n(3),we=n(7),Ee=function(){return(Ee=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0?a:Object.keys(i.dims),this._fieldBounds=t.fieldBounds||{},this._applyImmediately=Boolean(t.applyImmediately);var o=n._chart.getChartModelData();this._filtersContainer=n._chart.insertToRightSidebar(n._filtersContainer),this._filtersContainer.style.maxHeight="0px",n._fields.filter(function(t){var e="measure"===i.dims[t].type;return e||r.settings.log("The ["+t+"] isn't measure so Quick Filter plugin skipped it"),e}).forEach(function(t){n._data[t]=o.map(function(e){return e[t]});var e=n._fieldBounds[t];n._bounds[t]=e?[e.min,e.max]:Se.extent(n._data[t]),n._filter[t]=n._bounds[t],n._filtersContainer.insertAdjacentHTML("beforeend",n._filterWrapper({name:t})),n._container[t]=n._filtersContainer.lastChild,n._drawFilter(t)})},onRender:function(){this._filtersContainer.style.maxHeight="none"},_filtersContainer:'
',_filterWrapper:Me.template('
<%=name%>
'),_drawFilter:function(t){var e=this._data[t],n=this._bounds[t],r=this._filter[t],i=Me.isDate(n[0])||Me.isDate(n[1]),a=this,o=0,s=24,u=21,l=12,c=180-l-s,f=41-o-u-8,d=Se.scaleLinear().domain(n).range([0,c]),p=Se.brushX().extent([[0,0],[c,20]]).on("start",function(){a._layout.style["overflow-y"]="hidden"}).on("brush",this._applyImmediately?E:w).on("end",function(){a._layout.style["overflow-y"]="",E()}),g=Se.select(this._container[t]).append("svg").attr("width",c+l+s).attr("height",f+o+u+4).append("g").attr("transform","translate("+l+","+o+")"),m=(g.append("g").selectAll("rect").data(e).enter().append("rect").attr("transform",function(t){return"translate("+d(t)+","+(o+4)+")"}).attr("height",f).attr("width",1),g.append("g").attr("class","brush").call(p));m.append("g").attr("class","resize e").attr("cursor","ew-resize").attr("pointer-events","none"),m.append("g").attr("class","resize w").attr("cursor","ew-resize").attr("pointer-events","none"),m.selectAll(".resize").append("line").attr("transform","translate(0, 0)").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",f+8),m.selectAll(".resize").append("text").attr("x",0).attr("y",2*(f+4)),m.selectAll("rect").attr("height",f+8);var y=g.append("text").attr("x",c/2).attr("y",2*(f+4)).attr("class","date-label"),v=function(t){return Math.log(t)/Math.LN10}(a._filter[t][1]-a._filter[t][0]),b=Math.round(3-v),x=Math.pow(10,b);if(i){var _=function(t){var e=t.findIndex(function(t){var e=Se.timeFormat(t);return e(new Date(n[0]))!==e(new Date(n[1]))});return e=e<0?t.length:e,{comm:t.slice(0,e),diff:t.slice(e)}}(["’%y"," %b","%d","%H",":%M",":%S"]);_.comm.length<3?(_.diff.splice(-3),_.diff.reverse(),_.comm.reverse()):(_.comm.length<5&&_.diff.pop(),_.diff=_.comm.splice(3,_.comm.length-3).concat(_.diff),_.comm.reverse())}function w(){var e=h.event;if(e&&Array.isArray(e.selection)){var n=e.selection.map(d.invert);r=n,a._filter[t]=n}else r=a._filter[t];var o=i?new Date(r[0]).getTime():r[0],s=i?new Date(r[1]).getTime():r[1],u=Math.round(parseFloat(o)*x)/x,l=Math.round(parseFloat(s)*x)/x;m.select(".handle--w"),m.select(".handle--e");m.select(".resize.w").attr("transform","translate("+d(r[0])+",0)"),m.select(".resize.e").attr("transform","translate("+d(r[1])+",0)");var c=m.selectAll(".w text"),f=m.selectAll(".e text");if(i){var p=Se.timeFormat(_.comm.join("")),g=Se.timeFormat(_.diff.join(""));y.html(g(new Date(u))+" .. "+g(new Date(l))+' '+p(new Date(l))+"")}else c.text(u),f.text(l)}function E(){w(),a._applyFilter(t)}E(),p.move(m,r.map(d))},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});!function(t){t&&t.parentElement&&t.parentElement.removeChild(t)}(this._filtersContainer)},_applyFilter:function(t){var e=this._currentFilters,n=function(t,e,n){return function(r){var i=r[t];return in}}(t,this._filter[t][0],this._filter[t][1]),r=e[t];delete e[t],this._chart.removeFilter(r),e[t]=this._chart.addFilter({tag:"quick-filter",predicate:function(t){return!n(t)}}),Te<0?this._chart.refresh():(this._refreshRequestId&&clearTimeout(this._refreshRequestId),this._refreshRequestId=setTimeout(function(){this._refreshRequestId=null,this._chart.refresh()}.bind(this),Te))}}}r.default.api.plugins.add("quick-filter",Ce);var Ae=r.default.api.utils;function ke(t){var e=Ae.defaults(t||{},{show:!0,modes:["normal","entire-view","fit-width","fit-height","minimal"]});return{init:function(t){e.show&&(e.selectedMode=t.getSpec().settings.fitModel,t.insertToHeader(this.template({modes:e.modes.map(function(t){return""})})).addEventListener("change",function(n){var r=n.target;r.classList.contains("i-role-fit-model")&&(e.selectedMode=r.value,t.getSpec().settings.fitModel=e.selectedMode,t.refresh())},!1))},template:Ae.template(['
',"
"," View Mode: ",' ","
","
"].join(""))}}r.default.api.plugins.add("settings",ke);function Oe(t){return new X(t)}r.default.api.plugins.add("tooltip",Oe);var Pe=function(){var t={linear:function(t){for(var e=[0,0,0,0,0],n=0,r=[];nMath.abs(t[n][a])&&(a=r);for(i=n;i=n;i--)t[i][r]-=t[i][n]*t[n][r]/t[n][n]}for(r=s-1;r>=0;r--){for(o=0,i=r+1;i=0;s--)m+=s>1?Math.round(100*h[s])/100+"x^"+s+" + ":1==s?Math.round(100*h[s])/100+"x + ":Math.round(100*h[s])/100;return{equation:h,points:i,string:m}},lastvalue:function(t){for(var e=[],n=null,r=0;r0&&ot[o]-t[s]?a:o;for(var c=Math.abs(1/(t[u]-l)),f=0,d=0,h=0,p=0,g=0,m=a;m<=o;){var y=t[m],v=e[m],b=r((m1&&(a||s)&&(d=[d[0],d[d.length-1]]),t.concat(d.length>1?d:[])},[])},t.traverseSpec(n,function(t,r){if(i.predicateIsApplicable(n,t,r)){var a=n.scales[t.x],o=n.scales[t.y],s=n.scales[t.color]||{},u=JSON.parse(JSON.stringify(t));u.type="ELEMENT.LINE",u.size="size_null",u.namespace="trendline",u.transformation=u.transformation||[],u.transformation.push({type:"regression",args:{type:e.type,x:a,y:o,g:s}});u.guide=Ne.defaults({},u.guide||{}),u.guide.interpolate="linear",u.guide.showAnchors="never",u.guide.cssClass="tau-chart__trendline",u.guide.widthCssClass="tau-chart__line-width-1",u.guide.x=u.guide.x||{},u.guide.x.fillGaps=!1,delete u.guide.label,delete u.label,r.units.push(u)}})}},containerTemplate:'
',template:Ne.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(t){if(this._container){this._container.innerHTML=this.template({title:"Trend line",error:this._error,showTrend:e.showTrend&&this._isApplicable?"checked":"",models:e.models.map(function(t){return""})});var n=function(t){return function(){h.select(this).classed({active:t,"tau-chart__line-width-1":!t,"tau-chart__line-width-3":t})}};h.select(t.getSVG()).selectAll(".tau-chart__trendline").on("mouseenter",n(!0)).on("mouseleave",n(!1))}}}}r.default.api.plugins.add("trendline",Le);var Re={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},Fe=function(t,e){return Re[t][e].map(function(n,r){return t+" q"+r+"-"+e})};r.default.api.colorBrewers.add("tauBrewer",Fe);n.d(e,"GPL",function(){return De}),n.d(e,"Plot",function(){return Ie}),n.d(e,"Chart",function(){return je}),n.d(e,"api",function(){return ze}),n.d(e,"version",function(){return Be});var De=r.default.GPL,Ie=r.default.Plot,je=r.default.Chart,ze=r.default.api,Be=r.default.version}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):"function"==typeof define&&define.amd?define(["d3-selection","d3-array","d3-scale","topojson-client","d3-transition","d3-format","d3-time-format","d3-brush","d3-color","d3-axis","d3-geo","d3-quadtree","d3-shape","d3-time"],e):"object"==typeof exports?exports.Taucharts=e(require("d3-selection"),require("d3-array"),require("d3-scale"),require("topojson-client"),require("d3-transition"),require("d3-format"),require("d3-time-format"),require("d3-brush"),require("d3-color"),require("d3-axis"),require("d3-geo"),require("d3-quadtree"),require("d3-shape"),require("d3-time")):t.Taucharts=e(t.d3,t.d3,t.d3,t.topojson,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3)}(window,function(t,e,n,r,i,a,o,s,u,l,c,f,d,h){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=21)}([function(e,n){e.exports=t},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"traverseJSON",function(){return gt}),n.d(r,"traverseSpec",function(){return mt}),n.d(r,"clone",function(){return Ct}),n.d(r,"isDate",function(){return At}),n.d(r,"isObject",function(){return kt}),n.d(r,"niceZeroBased",function(){return Ot}),n.d(r,"niceTimeDomain",function(){return Pt}),n.d(r,"generateHash",function(){return Rt}),n.d(r,"generateRatioFunction",function(){return Ft}),n.d(r,"isSpecRectCoordsOnly",function(){return Dt}),n.d(r,"throttleLastEvent",function(){return It}),n.d(r,"splitEvenly",function(){return jt}),n.d(r,"extRGBColor",function(){return zt}),n.d(r,"extCSSClass",function(){return Bt}),n.d(r,"toRadian",function(){return Vt}),n.d(r,"normalizeAngle",function(){return Ht}),n.d(r,"range",function(){return Wt}),n.d(r,"hasXOverflow",function(){return Gt}),n.d(r,"hasYOverflow",function(){return Ut}),n.d(r,"flatten",function(){return Xt}),n.d(r,"unique",function(){return qt}),n.d(r,"groupBy",function(){return Yt}),n.d(r,"union",function(){return $t}),n.d(r,"intersection",function(){return Kt}),n.d(r,"defaults",function(){return Jt}),n.d(r,"omit",function(){return Qt}),n.d(r,"memoize",function(){return Zt}),n.d(r,"createMultiSorter",function(){return te}),n.d(r,"pick",function(){return ee}),n.d(r,"escape",function(){return ne}),n.d(r,"template",function(){return re}),n.d(r,"escapeHtml",function(){return ie}),n.d(r,"xml",function(){return ue}),n.d(r,"take",function(){return le}),n.d(r,"isChartElement",function(){return fe}),n.d(r,"isFacetUnit",function(){return de});var i={};n.r(i),n.d(i,"appendTo",function(){return ge}),n.d(i,"getScrollbarSize",function(){return me}),n.d(i,"setScrollPadding",function(){return ye}),n.d(i,"getStyle",function(){return ve}),n.d(i,"getStyleAsNum",function(){return be}),n.d(i,"getContainerSize",function(){return xe}),n.d(i,"getAxisTickLabelSize",function(){return _e}),n.d(i,"getLabelSize",function(){return we}),n.d(i,"getCharSize",function(){return Ee}),n.d(i,"selectOrAppend",function(){return Se}),n.d(i,"selectImmediate",function(){return Me}),n.d(i,"selectAllImmediate",function(){return Te}),n.d(i,"sortChildren",function(){return Ce}),n.d(i,"classes",function(){return Ae}),n.d(i,"dispatchMouseEvent",function(){return ke});var a={};n.r(a),n.d(a,"translate",function(){return Oe}),n.d(a,"rotate",function(){return Pe}),n.d(a,"getOrientation",function(){return Ne}),n.d(a,"parseTransformTranslate",function(){return Le}),n.d(a,"isIntersect",function(){return Re}),n.d(a,"getDeepTransformTranslate",function(){return Fe}),n.d(a,"raiseElements",function(){return De});var o=n(0),s=n(2),u=n(3),l={},c={};function f(t){var e=c[t];return e||(e=function(){for(var e,n,r=this,i=0,a=[];r=r.handler;){if("function"==typeof(n=r.callbacks[t])){if(!e)for(e=[this],i=0;i=0?t.positive:t.negative,s=o[i]||0,u=s+a;return o[i]=u,{nextStack:u,prevStack:s}}},a=i({positive:{},negative:{}}),o=i({positive:{},negative:{}}),s=function(e){return Zt(e,t.id)},u=Number.MAX_VALUE,l=Number.MIN_VALUE,c=function(t){return u=tl?t:l,r.value(t)},f=s(function(t){return c(a(t).nextStack)}),d=s(function(t){return c(o(t).prevStack)}),h=function(e){return t.group(e)+"/"+(e[r.dim]>=0?1:-1)},p=Yt(e,h),g=Object.keys(p).sort(t.flip||!t.flip&&t.obsoleteVerticalStackOrder?function(e,n){return t.order(e)-t.order(n)}:function(e,n){return t.order(n)-t.order(e)}).reduce(function(t,e){return t.concat(p[e])},[]);return g.forEach(function(t){f(t),d(t)}),r.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxu)&&(e.min=u),e}),{group:h,data:function(){return g},yi:f,y0:d}}).reg("size_distribute_evenly",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o=t.data(),s=function(t,e){return t-e},u=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,l=o.map(function(e){return t.xi(e)}).sort(s),c=l[0],f=l.slice(1).map(function(t){var e=t-c;return c=t,e}).filter(function(t){return t>0}).sort(s).concat(Number.MAX_VALUE)[0],d=Math.min(f,u),h="number"==typeof n?n:i,p={minSize:h,maxSize:"number"==typeof r?r:Math.max(h,Math.min(a,d))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("adjustStaticSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o={minSize:"number"==typeof n?n:i,maxSize:"number"==typeof r?r:a};return t.scaleSize.fixup(function(t){var e={};return t.fixed||(e.fixed=!0,e.minSize=o.minSize,e.maxSize=o.maxSize),e}),{}}).reg("adjustSigmaSizeScale",function(t,e){var n=e.minLimit,r=e.maxLimit,i=e.defMin,a=e.defMax,o=function(t,e){return t-e},s=t.data().map(function(e){return t.xi(e)}).sort(o),u=s[0],l=s.slice(1).map(function(t){var e=t-u;return u=t,e}).filter(function(t){return t>0}).sort(o).concat(Number.MAX_VALUE)[0],c=t.scaleX.discrete?t.scaleX.stepSize()/2:Number.MAX_VALUE,f=Math.min(l,c),d="number"==typeof n?n:i,h="number"==typeof r?r:a,p={minSize:d,maxSize:Math.max(d,Math.min(h,function(t){var e=(d+h)/2,n=h,r=d;return Math.round(e+(n-e)/(1+Math.exp(-(t-r)/.5)))}(f)))};return t.scaleSize.fixup(function(t){var e={};return t.fixed?t.maxSize>p.maxSize&&(e.maxSize=p.maxSize):(e.fixed=!0,e.minSize=p.minSize,e.maxSize=p.maxSize),e}),{}}).reg("avoidScalesOverflow",function(t,e){var n,r,i=e.sizeDirection,a=function(t,e){return!t||t.discrete||"logarithmic"===t.scaleType||i.indexOf(e)<0},o=a(t.scaleX,"x"),s=a(t.scaleY,"y");if(o&&s)return{};t.scaleSize.fixup(function(t){return n=t.minSize,r=t.maxSize,t});var u=t.data().reduce(function(e,i){var a,u,l=t.size(i),c=(l>=n?l:n+l*(r-n))/2;return o||(a=t.xi(i),e.left=Math.min(e.left,a-c),e.right=Math.max(e.right,a+c)),s||(u=t.yi(i),e.top=Math.min(e.top,u-c),e.bottom=Math.max(e.bottom,u+c)),e},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE}),l=function(e,n,r,i){var a=e.domain(),o=Math.abs(e.value(a[1])-e.value(a[0])),s=(a[1]-a[0])/o;if(0===o)return 1;var u=Math.max(0,-n),l=Math.max(0,r-o),c=t.flip?l:u,f=t.flip?u:l,d=Number(a[0])-(i?f:c)*s,h=Number(a[1])+(i?c:f)*s;return e.fixup(function(t){var e={};if(t.fixedBorders){var i=t.fixedBorders.slice(),a=i[0],o=i[1];(a>n||o=0?1:-1},d=function(e,n,r){var i=Yt(n,function(t){return t[s]}),a=n[0];return e.reduce(function(e,n){return e.concat(i[n]||function(e,n,r){var i,a=[e,t.id(n),r].join(" ");return(i={})[s]=e,i[u]=1e-10*r,i[c]=n[c],i[l]=n[l],i[M]=!0,i[M+"id"]=a,i}(n,a,r))},[])},h=function(t,e){return t-e},p=function(){return qt(o.reduce(function(t,e){return t.concat(e.map(function(t){return t[s]}))},[])).sort(h)},g=r?function(){var e=p(),n=Math.max.apply(Math,e.map(function(t){return Number(t)})),a=t.scaleX.domain(),o=b.generate(a[0],a[1],r,{utc:i}).filter(function(t){return t>=a[0]&&t<=a[1]}),s=0,u=[],l=b.get(r,{utc:i});return o.forEach(function(t){var r=Number(t);if(!(r>=n)){for(var i=s;i=0;n--)i=t[n+1],(r=t[n]).isCubicControl||i.isCubicControl||(t.splice(n+1,0,A(1/3,i,r),A(2/3,i,r)),t[n+1].isCubicControl=!0,t[n+2].isCubicControl=!0);var a=t.filter(function(t,e){return e%3==0}),o=e.filter(function(t,e){return e%3==0}),s=a.map(function(t){return t.id}),u=o.map(function(t){return t.id}),l=s.reduce(function(e,n){return e[n]=t.findIndex(function(t){return t.id===n}),e},{}),c=u.reduce(function(t,n){return t[n]=e.findIndex(function(t){return t.id===n}),t},{}),f=s.filter(function(t){return u.indexOf(t)>=0}),d=a.filter(function(t){return!t.positionIsBeingChanged}),h=o.filter(function(t){return!t.positionIsBeingChanged}),p=V(d,h),g=V(h,d),m=[];f.forEach(function(n,r){var i=l[n],a=c[n];if(0===r&&(i>0||a>0)&&m.push(P({polylineFrom:t.slice(0,i+1),polylineTo:e.slice(0,a+1),toOppositeScale:0===a?p:g,isCubic:!0})),r>0){var o=l[f[r-1]],s=c[f[r-1]];i-o>3||a-s>3?m.push(N({polylineFrom:t.slice(o,i+1),polylineTo:e.slice(s,a+1),isCubic:!0})):m.push(function(t){var e=t.polylineFrom,n=t.polylineTo;return function(t){return j(e.slice(1,3),n.slice(1,3),t)}}({polylineFrom:t.slice(o,i+1),polylineTo:e.slice(s,a+1)}))}m.push(L({pointFrom:t[i],pointTo:e[a]})),r===f.length-1&&(t.length-i-1>0||e.length-a-1>0)&&m.push(P({polylineFrom:t.slice(i),polylineTo:e.slice(a),toOppositeScale:e.length-a==1?p:g,isCubic:!0}))}),0===m.length&&(e.length>0&&0===f.length||t.length>0&&0===f.length)&&m.push(R({polylineFrom:t.slice(0),polylineTo:e.slice(0),isCubic:!0}));return function(t){var e=[];return m.forEach(function(n){var r=n(t);F(e,r)}),e}}:function(t,e){var n=(t=t.filter(function(t){return!t.isInterpolated})).map(function(t){return t.id}),r=e.map(function(t){return t.id}),i=n.filter(function(t){return r.indexOf(t)>=0}),a=t.filter(function(t){return!t.positionIsBeingChanged}),o=e.filter(function(t){return!t.positionIsBeingChanged}),s=V(a,o),u=V(o,a),l=[];i.forEach(function(a,o){var c=n.indexOf(a),f=r.indexOf(a);if(0===o&&(c>0||f>0)&&l.push(P({isCubic:!1,polylineFrom:t.slice(0,c+1),polylineTo:e.slice(0,f+1),toOppositeScale:0===f?s:u})),o>0){var d=n.indexOf(i[o-1]),h=r.indexOf(i[o-1]);(c-d>1||f-h>1)&&l.push(N({isCubic:!1,polylineFrom:t.slice(d,c+1),polylineTo:e.slice(h,f+1)}))}l.push(L({pointFrom:t[c],pointTo:e[f]})),o===i.length-1&&(t.length-c-1>0||e.length-f-1>0)&&l.push(P({isCubic:!1,polylineFrom:t.slice(c),polylineTo:e.slice(f),toOppositeScale:e.length-f==1?s:u}))}),0===l.length&&(e.length>0&&0===i.length||t.length>0&&0===i.length)&&l.push(R({isCubic:!1,polylineFrom:t.slice(0),polylineTo:e.slice(0)}));return function(t){var e=[];return l.forEach(function(n){var r=n(t);F(e,r)}),e}})(t,e)),r(i))}}function P(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=t.toOppositeScale,a=e.length>n.length?e:n,o=1===n.length,s=e[0].id!==n[0].id,u=Boolean(s!==o);return function(t){var e=(r?B:z)({t:t,polyline:a,decreasing:o,rightToLeft:u});o===u?e.shift():e.pop();var n=j(e.map(i),e,o?1-t:t);return n.forEach(function(t){return t.positionIsBeingChanged=!0}),n}}function N(t){var e=t.polylineFrom,n=t.polylineTo,r=t.isCubic,i=e.length,a=n.length;if(a!==i){var o=a2){var i=function(t,e){for(var n,r,i=[e[0]],a=0;a0&&e0&&(t.positionIsBeingChanged=!0)}),e}}function F(t,e){return Array.prototype.push.apply(t,e)}function D(t,e,n){return void 0===e?t:"number"==typeof e?t+n*(e-t):e}function I(t,e,n){if(t===e)return e;var r={};return Object.keys(t).forEach(function(i){return r[i]=D(t[i],e[i],n)}),void 0!==e.id&&(r.id=e.id),r}function j(t,e,n){return t.map(function(t,r){return I(t,e[r],n)})}function z(t){var e=t.t,n=t.polyline,r=t.decreasing,i=t.rightToLeft,a=Boolean(r)!==Boolean(i),o=function(t,e){var n=0;if(t>0){for(var r,i,a,o,s=[0],u=0,l=1;l0){for(var i,a,o,s,u,l,c,f,d=[0],h=0,p=1;p0;a--)if((e=o[a][t])!==r)return n=s[a][t],void(d[t]=h(r,e,i,n));d[t]=function(t,e){return function(n){return n-t+e}}(r,i)}),function(t){var e=Object.assign({},t);return f.forEach(function(n){e[n]=d[n](t[n])}),e}}function H(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}function W(t,e){var n=e[0],r=e[1],i=e[2],a=e[3],o=k(t,n,r,i,a);return[o[1],o[2],o[4],o[5]].forEach(function(t){return t.isCubicControl=!0}),Object.keys(a).forEach(function(e){"x"!==e&&"y"!==e&&"id"!==e&&(o[3][e]=D(n[e],a[e],t))}),o}function G(t,e){if(t.length<2)return t.slice(0);if(2===t.length)return[t[0],{x:U(t[0].x,t[1].x,1/3),y:U(t[0].y,t[1].y,1/3)},{x:U(t[0].x,t[1].x,2/3),y:U(t[0].y,t[1].y,2/3)},t[1]];for(var n,r,i,a,o,s,u,l,c,f,d,h,p,g,m=new Array(3*(t.length-1)+1),y=m.length-1,v=0;v0&&(m[3*v-2]=A(1/3,t[v-1],t[v]),m[3*v-1]=A(2/3,t[v-1],t[v]));for(var b=m.slice(0),x=0;x<3;x++){for(m[1]={x:U(m[0].x,m[3].x,1/3),y:U(m[0].y,U(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:U(m[y].x,m[y-3].x,1/3),y:U(m[y].y,U(m[y-3].y,m[y-2].y,1.5),2/3)},e&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[y-1].y-m[y].y)*(m[y-3].y-m[y-2].y)<0&&(m[y-1]={x:m[y-1].x,y:m[y].y})),v=6;vn.y==u>i.y&&(p=U(p*(g=(i.y-r.y)/(u-r.y)),p,1/(1+Math.abs(g))),d=(i.y-r.y)/p),r.y>n.y==o0?[t,e].join(" "):e,u=n(i.text(s));if(us;if(c&&i){var f=Math.floor(s/l*u.length);t[t.length-1]=u.substr(0,f-4)+"...",p=!0}return c&&!i&&t.push(e),c||(t[t.length-1]=u),t},[""]).filter(function(t){return t.length>0});f=i?-1*(m.length-1)*Math.floor(.5*r):f,m.forEach(function(t,e){return o(u,t,1.1,c,f,d,e)}),h.remove()})};var et=function(t,e,n){return e>0&&!document.hidden&&((t=t.transition(n).duration(e)).attr=nt),t.onTransitionEnd=function(t){return at(this,t),this},t},nt=function(t,e){var n,r,i=this,a=J.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?r=t:arguments.length>1&&((n={})[t]=e,r=n);var o="__transitionAttrs__",s="__lastTransitions__",u=it();this.each(function(){var t=this,e={};for(var n in r)"function"==typeof r[n]?e[n]=r[n].apply(this,arguments):e[n]=r[n];this[o]=Object.assign(this[o]||{},e),this[o][s]||Object.defineProperty(this[o],s,{value:{}}),Object.keys(e).forEach(function(e){return t[o][s][e]=u})});var l=function(){var t=this;this[o]&&(Object.keys(r).filter(function(e){return t[o][s][e]===u}).forEach(function(e){return delete t[o][e]}),0===Object.keys(this[o]).length&&delete this[o])};return this.on("interrupt."+u,function(){return i.each(l)}),this.on("end."+u,function(){return i.each(l)}),a},rt=0,it=function(){return++rt},at=function(t,e){if(J.transition.prototype.isPrototypeOf(t)&&!t.empty()){var n=function(){return e.call(null,t)};return t.on("interrupt.d3_on_transition_end",n),t.on("end.d3_on_transition_end",n),t}e.call(null,t)},ot=function(t,e,n,r){var i=r||function(t){return t},a=function(){i(this)};return function(r){var i=r;return e&&(i=i.call(lt(Jt(e,n)))),i=(i=et(i,t)).call(lt(n)),t>0?i.on("end.d3_animationInterceptor",function(){return i.each(a)}):i.each(a),i}},st=function(t,e){var n=t.node();return t.selectAll(e).filter(function(){return this.parentNode===n})},ut=function(t,e,n,r,i){void 0===i&&(i="linear");var a="__pathPoints__";return function(t){var o=this;this[a]||(this[a]=n.map(function(){return[]}));var s=n.map(function(e,n){var s=qt(t,r).map(e),u=(Y(i)||Y("linear"))(s),l=o[a][n];return{pointsFrom:l,pointsTo:u,interpolate:O(l,u,$(i))}});return function(t){if(0===t){var n=s.map(function(t){return t.pointsFrom});return e.apply(void 0,n)}if(1===t){var r=s.map(function(t){return t.pointsTo});return o[a]=r,e.apply(void 0,r)}var i=s.map(function(e){return e.interpolate(t)});return o[a]=i,e.apply(void 0,i)}}},lt=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.attr(n,t[n])}),e}},ct=function(t){return function(e){return Object.keys(t).forEach(function(n){return e.classed(n,t[n])}),e}},ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dt=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Jt(n.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),n.config.guide.size=n.config.guide.size||{};var r=n.config.stack,i=n.config.guide.enableColorToBarPosition,a=[e.flip&&S.get("flip"),r&&S.get("stack"),i&&S.get("positioningByColor")];return n.decorators=(n.config.transformRules||a).concat(e.transformModel||[]),n.adjusters=(n.config.adjustRules||[]).concat(e.adjustScales||[]),n}return ft(e,t),e.prototype.defineGrammarModel=function(t){var e=this,n=this.config;this.regScale("x",t("pos",n.x,[0,n.options.width])).regScale("y",t("pos",n.y,[n.options.height,0])).regScale("y",t("pos",n.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n.options.height]:[n.options.height,0]})).regScale("size",t("size",n.size,{})).regScale("color",t("color",n.color,{})).regScale("split",t("split",n.split,{})).regScale("label",t("label",n.label,{})).regScale("identity",t("identity",n.identity,{}));var r=this.getScale("x"),i=this.getScale("y"),a=this.getScale("size"),o=this.getScale("label"),s=this.getScale("color"),u=this.getScale("split"),l=this.getScale("identity"),c=i.domain(),f=i.discrete?c[0]:Math.max(0,Math.min.apply(Math,c)),d=i.value(f)+.5*i.stepSize(f),h=s.domain(),p={data:function(){return e.data()},flip:!1,scaleX:r,scaleY:i,scaleSize:a,scaleLabel:o,scaleColor:s,scaleSplit:u,scaleIdentity:l,color:function(t){return s.value(t[s.dim])},label:function(t){return o.value(t[o.dim])},group:function(t){return t[s.dim]+"(@taucharts@)"+t[u.dim]},order:function(t){var e=t.split("(@taucharts@)")[0],n=h.indexOf(e);return n<0?Number.MAX_VALUE:n},size:function(t){return a.value(t[a.dim])},id:function(t){return l.value(t[l.dim],t)},xi:function(t){return r.value(t[r.dim])},yi:function(t){return i.value(t[i.dim])},y0:function(){return d}};return p.data().forEach(function(t){return p.id(t)}),p},e.prototype.getGrammarRules=function(){return this.decorators.filter(function(t){return t})},e.prototype.getAdjustScalesRules=function(){return(this.adjusters||[]).filter(function(t){return t})},e.prototype.createScreenModel=function(t){var e=t.flip,n=function(t,e,n){return t?e:n};return{flip:e,id:t.id,x:n(e,t.yi,t.xi),y:n(e,t.xi,t.yi),x0:n(e,t.y0,t.xi),y0:n(e,t.xi,t.y0),size:t.size,group:t.group,order:t.order,label:t.label,color:function(e){return t.scaleColor.toColor(t.color(e))},class:function(e){return t.scaleColor.toClass(t.color(e))},model:t,toFibers:function(){var e=Yt(t.data(),t.group);return Object.keys(e).sort(function(e,n){return t.order(e)-t.order(n)}).reduce(function(t,n){return t.concat([e[n]])},[])}}},e.prototype.drawFrames=function(){var t=this,e=this.config.options,n=function(e){return function(t,e){var n=Math.pow(10,e);return Math.round(n*t)/n}(t.screenModel.size(e)/2,4)},r=ot,i=function(e,n,i){var a=t.config.guide.animationSpeed,s=e.selectAll("."+n).data(function(t){return[t]},t.screenModel.id);s.exit().call(r(a,null,{width:0},function(t){return o.select(t).remove()})),s.call(r(a,null,i)),s.enter().append("rect").style("stroke-width",0).call(r(a,{width:0},i))},a=this.config.flip,s=a?"y":"x",u=a?"x":"y",l=a?"x0":"y0",c=a?"height":"width",f=a?"width":"height",d=function(e){var r,a,o;i(e,"lvl-top",((r={})[c]=function(t){return n(t)},r[f]=1,r[s]=function(e){return t.screenModel[s](e)-n(e)/2},r[u]=function(e){return t.screenModel[u](e)},r.fill=function(e){return t.screenModel.color(e)},r.class=function(e){return"lvl-top "+t.screenModel.class(e)},r)),i(e,"lvl-btm",((a={})[c]=function(t){return n(t)},a[f]=1,a[s]=function(e){return t.screenModel[s](e)-n(e)/2},a[u]=function(e){return t.screenModel[l](e)},a.fill=function(e){return t.screenModel.color(e)},a.class=function(e){return"lvl-btm "+t.screenModel.class(e)},a)),i(e,"lvl-link",((o={})[c]=.5,o[f]=function(e){return Math.abs(t.screenModel[u](e)-t.screenModel[l](e))},o[s]=function(e){return t.screenModel[s](e)-.25},o[u]=function(e){return Math.min(t.screenModel[u](e),t.screenModel[l](e))},o.fill=function(e){return t.screenModel.color(e)},o.class=function(e){return"lvl-link "+t.screenModel.class(e)},o))},h=function(e){e.attr("class","frame-id-"+t.config.uid).call(function(e){var n=e.selectAll(".generic").data(function(t){return t},t.screenModel.id);n.exit().remove(),n.call(d),n.enter().append("g").attr("class","generic").call(d)})},p=Yt(this.data(),t.screenModel.group),g=Object.keys(p).sort(function(e,n){return t.screenModel.order(e)-t.screenModel.order(n)}).reduce(function(t,e){return t.concat([p[e]])},[]),m=e.container.selectAll(".frame-id-"+t.config.uid).data(g);m.exit().remove(),m.call(h),m.enter().append("g").call(h)},e}(g),ht=function(){return(ht=Object.assign||function(t){for(var e,n=1,r=arguments.length;nthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return t.populate(this.recursiveDeepCopy,e,n),this.depth--,n}},r.DeepCopier=e,r.deepCopiers=t,r.register=function(n){n instanceof e||(n=new e(n)),t.unshift(n)},r.register({canCopy:function(){return!0},create:function(t){return t instanceof t.constructor?function(t){return"object"==typeof t?JSON.parse(JSON.stringify(t)):t}(t.constructor.prototype):{}},populate:function(t,e,n){for(var r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r]));return n}}),r.register({canCopy:function(t){return t instanceof Array},create:function(t){return new t.constructor},populate:function(t,e,n){for(var r=0;r":">",'"':""","'":"'","`":"`"},_t={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},wt=/\\|'|\r|\n|\u2028|\u2029/g,Et="(?:"+Object.keys(xt).join("|")+")",St=RegExp(Et),Mt=RegExp(Et,"g"),Tt={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function Ct(t){return yt(t)}function At(t){return t instanceof Date&&!isNaN(Number(t))}function kt(t){return null!=t&&"object"==typeof t}function Ot(t){var e=parseFloat(Math.min.apply(Math,t).toFixed(15)),n=parseFloat(Math.max.apply(Math,t).toFixed(15));e===n&&(n-=(n>=0?-1:1)*(n||1)/10);for(var r=[e=Math.min(0,e),n=Math.max(0,n)],i=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(i/10)/Math.LN10)),o=10/i*a,s=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],u=-1;o>s[++u][0];);a*=s[u][1],r[0]=Math.floor(r[0]/a)*a,r[1]=Math.ceil(r[1]/a)*a;var l=e-r[0],c=r[1]-n,f=a/2;if(e<0){var d=l>=f?-l:0;r[0]=r[0]-d}if(n>0){var h=c>=f?-c:0;r[1]=r[1]+h}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Pt(t,e,n){var r=(void 0===n?{utc:!1}:n).utc,i=pt.extent(t),a=i[0],o=i[1],s=+o-+a,u=r?pt.scaleUtc:pt.scaleTime;if(0===s){return a=new Date(a.getTime()-864e5),o=new Date(o.getTime()+864e5),u().domain([a,o]).nice(e).domain()}var l=u().domain([a,o]).nice(e);if(e)return l.domain();var c=u().domain([a,o]).nice(e).domain(),f=c[0],d=c[1],h=l.ticks(),p=h.length-1;return(+a-+f)/(+h[1]-+f)<.5&&(a=f),(+d-+o)/(+d-+h[p-1])<.5&&(o=d),[a,o]}var Nt=0,Lt={};function Rt(t){var e=btoa(encodeURIComponent(t)).replace(/=/g,"_");return Lt.hasOwnProperty(e)||(Lt[e]="H"+ ++Nt),Lt[e]}function Ft(t,e,n){var r=0,i=null,a=Zt(function(t,e){return qt(t.map(function(t){return e.reduce(function(e,n){return e.concat(function(t){return At(t)?t.getTime():t}(t[n]))},[])}),function(t){return JSON.stringify(t)}).reduce(function(t,e){var n=e[0];return t[n]=t[n]||0,t[n]+=1,t},{})},function(t,e){var n=i===t?r:++r;return i=t,e.join("")+"-"+n});return function(r,i,o){var s=o.length,u=n.getSpec(),l=u.sources["/"].data,c=u.unit.units[0].guide||{};c.padding=c.padding||{l:0,r:0,t:0,b:0};var f=0;"x"===t?f=c.padding.l+c.padding.r:"y"===t&&(f=c.padding.t+c.padding.b);var d=(i-s*f)/function(t){var e=a(l,t);return Object.keys(e).reduce(function(t,n){return t+e[n]},0)}(e);return(function(t,e){return a(l,t)[e]}(e,r)*d+f)/i}}function Dt(t){var e=!0;try{mt(t,function(t){if(0===t.type.indexOf("COORDS.")&&"COORDS.RECT"!==t.type)throw new Error("Not applicable")},function(t){return t})}catch(t){"Not applicable"===t.message&&(e=!1)}return e}function It(t,e,n,r){if(void 0===r&&(r=0),"requestAnimationFrame"===r){var i=!1;return function(){for(var r=[],a=0;a=r&&n.apply(this,i),t.e=o.e,t.ts=o.ts}}function jt(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=e>=2?Wt(e-2).map(function(t){return n+i*(t+1)}):[];return[n].concat(a,[r])}function zt(t){return vt(t)?t:""}function Bt(t){return vt(t)?"":t}function Vt(t){return t/180*Math.PI}function Ht(t){return Math.abs(t)>=360&&(t%=360),t<0&&(t=360+t),t}function Wt(t,e){1===arguments.length&&(e=t,t=0);for(var n=[],r=t;r100}function Ut(t,e,n,r){return t+e*(-90===n?-1:1)-r>20}function Xt(t){return Array.isArray(t)?[].concat.apply([],t.map(function(t){return Xt(t)})):t}function qt(t,e){for(var n={},r=[],i=t.length,a=e||function(t){return String(t)},o=0;o/g,">").replace(/"/g,""").replace(/'/g,"'")}var ae=" ",oe=32,se=["img","input","br","embed","link","meta","area","base","basefont","bgsound","col","command","frame","hr","image","isindex","keygen","menuitem","nextid","param","source","track","wbr","circle","ellipse","line","path","polygon","rect"].reduce(function(t,e){return t[e]=!0,t},{});function ue(t){var e=2,n=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(e=1,n={});var r=Xt(Array.prototype.slice.call(arguments,e)),i=1===r.length&&"<"!==r[0].trim()[0],a=se[t];if(a&&r.length>0)throw new Error('Tag "'+t+'" is void but content is assigned to it');var o="<"+t,s=Object.keys(n).map(function(t){return" "+t+'="'+n[t]+'"'}).join("");s.length>oe&&(s=Object.keys(n).map(function(t){return"\n"+ae+t+'="'+n[t]+'"'}).join(""));var u=i?r[0]:"\n"+r.map(function(t){return String(t).split("\n").map(function(t){return""+ae+t}).join("\n")}).join("\n")+"\n";return""+o+s+(a?"/>":">"+u+"")}function le(t){var e=t,n={then:function(t){return e=t(e),n},result:function(){return e}};return n}var ce=[dt];function fe(t){return ce.some(function(e){return t instanceof e})}function de(t){return(t.units||[]).some(function(t){return t.hasOwnProperty("units")})}var he=document.createElement("div"),pe=new WeakMap;function ge(t,e){var n;return t instanceof Node?n=t:(he.insertAdjacentHTML("afterbegin",t),n=he.childNodes[0]),e.appendChild(n),n}function me(t){if(pe.has(t))return pe.get(t);var e=t.style.overflow;t.style.overflow="scroll";var n={width:t.offsetWidth-t.clientWidth,height:t.offsetHeight-t.clientHeight};return t.style.overflow=e,pe.set(t,n),n}function ye(t,e){var n="horizontal"===(e=e||"both")||"both"===e,r="vertical"===e||"both"===e,i=me(t),a=r?i.width+"px":"0",o=n?i.height+"px":"0";t.style.overflow="hidden",t.style.padding="0 "+a+" "+o+" 0";var s=t.scrollWidth>t.clientWidth,u=t.scrollHeight>t.clientHeight,l=r&&!u?i.width+"px":"0",c=n&&!s?i.height+"px":"0";return t.style.padding="0 "+l+" "+c+" 0",t.style.overflow="",t.style.overflowX=s?"scroll":"hidden",t.style.overflowY=u?"scroll":"hidden",i}function ve(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function be(t,e){return parseInt(ve(t,e)||"0",10)}function xe(t){var e=be(t,"padding-left"),n=be(t,"padding-right"),r=be(t,"padding-bottom"),i=be(t,"padding-top"),a=be(t,"border-top-width")+be(t,"border-left-width")+be(t,"border-right-width")+be(t,"border-bottom-width"),o=t.getBoundingClientRect();return{width:o.width-e-n-2*a,height:o.height-r-i-2*a}}function _e(t){var e=document.createElement("div");e.style.position="absolute",e.style.visibility="hidden",e.style.width="100px",e.style.height="100px",e.style.border="1px solid green",e.style.top="0",document.body.appendChild(e),e.innerHTML='\n \n \n \n \n \n ';var n=e.querySelector(".x.axis .tick text");n.textContent=t;var r={width:0,height:0},i=n.getBoundingClientRect();r.width=i.right-i.left,r.height=i.bottom-i.top;var a=0!==t.length?r.width/t.length:0;return r.width=r.width+1.5*a,document.body.removeChild(e),r}function we(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a="string"==typeof n?n:n+"px",o=t.map(function(t){for(var e=0,n=0;e<=t.length-1;e++){n+=Ee(t.charAt(e),{fontSize:a,fontFamily:r,fontWeight:i}).width}return n}).sort(function(t,e){return e-t})[0],s=t.length,u=parseInt(a);return{width:o,height:u*s+.39*u*s}}var Ee=Zt(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,a=document.createElement("div");a.style.position="absolute",a.style.visibility="hidden",a.style.border="0px",a.style.top="0",a.style.fontSize=n,a.style.fontFamily=r,a.style.fontWeight=i,document.body.appendChild(a),a.innerHTML=" "===t?" ":t;var o={width:0,height:0},s=a.getBoundingClientRect();return o.width=s.right-s.left,o.height=s.bottom-s.top,document.body.removeChild(a),o},function(t,e){return t+"_"+JSON.stringify(e)});function Se(t,e){var n={".":function(t,e){return e.classed(t,!0)},"#":function(t,e){return e.attr("id",t)}},r=Object.keys(n).join("");if(e.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(e[0])>=0)throw new Error("Selector must have tag at the beginning.");var i,a=t instanceof Element,s=a?o.select(t):t,u=function(t){return a?t.node():t},l=s.selectAll(e).filter(function(){return this.parentNode===s.node()}).filter(function(t,e){return 0===e});if(!l.empty())return u(l);for(var c,f=-1,d=null,h=1,p=e.length;h<=p;h++)(h==p||r.indexOf(e[h])>=0)&&(c=e.substring(f+1,h),f<0?i=s.append(c):n[d].call(null,c,i),d=e[h],f=h);return u(i)}function Me(t,e){return Te(t,e)[0]||null}function Te(t,e){for(var n=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=t.firstElementChild;Boolean(i);i=i.nextElementSibling)r.call(i,e)&&n.push(i);return n}function Ce(t,e){if(t.childElementCount>0){var n,r,i=Array.prototype.filter.call(t.childNodes,function(t){return t.nodeType===Node.ELEMENT_NODE}),a=i.slice().sort(e),o=i.reduce(function(t,e,n){return t.set(e,n),t},new Map),s=a.reduce(function(t,e,i){var s=o.get(e),u=i-s;return u!==r&&(n&&t.push(n),r=u,n={from:s,to:i,elements:[]}),n.elements.push(e),i===a.length-1&&t.push(n),t},[]),u=s.slice().sort(function(t,e){return t.from-e.from}),l=u.reduce(function(t,e,n){return t.set(e,n),t},new Map),c=function(t){for(var e,n,r,i=s.map(function(t,e){return{elements:t.elements,from:l.get(t),to:e}}).sort(te(function(t,e){return t.elements.length-e.elements.length},t?function(t,e){return e.to-t.to}:function(t,e){return t.to-e.to})),a=0;an.to)for(e=a+1;e=n.to&&r.fromn.from&&r.from<=n.to&&r.from--}return i.filter(function(t){return t.from!==t.to})},f=c(!0),d=c(!1),h=f.length=0?"h":"v"}function Le(t){var e={x:0,y:0},n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}return e}function Re(t,e,n,r,i,a,o,s){var u,l,c,f,d,h;return h=((c=o-i)*(e-a)-(f=s-a)*(t-i))/(-c*(l=r-e)+(u=n-t)*f),(d=(-l*(t-i)+u*(e-a))/(-c*l+u*f))>=0&&d<=1&&h>=0&&h<=1}function Fe(t){for(var e,n,r={x:0,y:0},i=t;i&&"SVG"!==i.nodeName.toUpperCase();)(n=i.getAttribute("transform"))&&(e=Le(n),r.x+=e.x,r.y+=e.y),i=i.parentNode;return r}function De(t,e,n){var r=t.selectAll(e).filter(n);if(!r.empty()){var i=o.select(r.node().parentNode).selectAll(e).filter(function(t){return!n(t)}).nodes(),a=i[i.length-1];if(a){var s=Array.prototype.indexOf.call(a.parentNode.childNodes,a),u=a.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>s||this.parentNode.insertBefore(this,u)})}}}var Ie=function(t){return At(t)?t.getTime():t},je={cross:function(t,e,n){var r=t(),i=qt(r.map(function(t){return t[e]}),Ie),a=qt(r.map(function(t){return t[n]}),Ie),o=0===i.length?[null]:i;return(0===a.length?[null]:a).reduce(function(t,r){return t.concat(o.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},cross_period:function(t,e,n,r,i,a){var o=t(),s=!!a&&a.utcTime,u=qt(o.map(function(t){return t[e]}),Ie),l=qt(o.map(function(t){return t[n]}),Ie),c=0===u.length?[null]:u,f=0===l.length?[null]:l;return r&&(c=b.generate(Math.min.apply(Math,u),Math.max.apply(Math,u),r,{utc:s})),i&&(f=b.generate(Math.min.apply(Math,l),Math.max.apply(Math,l),i,{utc:s})),f.reduce(function(t,r){return t.concat(c.map(function(t){var i={};return e&&(i[e]=Ie(t)),n&&(i[n]=Ie(r)),i}))},[])},groupBy:function(t,e){return qt(t().map(function(t){return t[e]}),Ie).map(function(t){var n;return(n={})[e]=Ie(t),n})},none:function(){return[null]}},ze=function(){function t(t,e,n){var r=t.key,i=t.pipe,a=t.source,o=t.units;void 0===n&&(n={}),this.key=r,this.pipe=i||[],this.source=a,this.units=o,this._frame={key:r,source:a,pipe:this.pipe},this._data=e,this._pipeReducer=function(t,e){return n[e.type](t,e.args)}}return t.prototype.hash=function(){return Rt([this._frame.pipe,this._frame.key,this._frame.source].map(function(t){return JSON.stringify(t)}).join(""))},t.prototype.full=function(){return this._data},t.prototype.part=function(t){return void 0===t&&(t=function(t){return t}),this._frame.pipe.map(t).reduce(this._pipeReducer,this._data)},t}(),Be=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ve=function(t){return At(t)?t.getTime():t},He=function(t){var e=this;Object.keys(t).forEach(function(n){return e[n]=t[n]})},We=function(t,e,n){return t.map(function(t){return"string"==typeof t?n.get(t):t}).filter(function(t){return t}).reduce(function(t,e){return function(t,e){return void 0===e&&(e={}),Object.assign(new He(t),e)}(t,e(t,{}))},e)},Ge=function(t){function e(e,n,r,i){var a=t.call(this)||this;return Jt(e.scales,{size_null:{type:"size",source:"?"},split_null:{type:"value",source:"?"},label_null:{type:"value",source:"?"},color_null:{type:"color",source:"?"},identity_null:{type:"identity",source:"?"},"size:default":{type:"size",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"},"label:default":{type:"value",source:"?"},"identity:default":{type:"identity",source:"?"}}),e.settings=e.settings||{},a.config=e,a.sources=e.sources,a.scales=e.scales,a.unitSet=r,a.grammarRules=i,a.scalesHub=n,a.transformations=Object.assign(e.transformations||{},{where:function(t,e){var n=Object.keys(e||{}).map(function(t){return function(n){return Ve(n[t])===e[t]}});return t.filter(function(t){return n.every(function(e){return e(t)})})}}),a}return Be(e,t),e.traverseSpec=function(t,e,n,r,i){void 0===r&&(r=null),void 0===i&&(i=null);var a=[],o=function(t,e,n,r,i){a.push(function(){e(t,r,i)}),t.frames&&t.frames.forEach(function(r){(r.units||[]).map(function(i){return o(i,e,n,t,r)})}),a.push(function(){return n(t,r,i)})};return o(t.unit,e,n,r,i),a},e.prototype.unfoldStructure=function(){return this.root=this._expandUnitsStructure(this.config.unit),this.config},e.prototype.getDrawScenarioQueue=function(t){var e=this,n=this.grammarRules,r=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new He(s.defineGrammarModel(o)),l=We(s.getGrammarRules(),u,n);return We(s.getAdjustScalesRules(),l,n),s.node().screenModel=s.createScreenModel(l),s}),i=this._flattenDrawScenario(t,function(t,r,i){var a=!1===r.expression.inherit?null:i,o=e._createFrameScalesFactoryMethod(a),s=e.unitSet.create(r.type,Object.assign({},r,{options:t.allocateRect(i.key)})),u=new He(s.defineGrammarModel(o)),l=We(s.getGrammarRules(),u,n);return s.node().screenModel=s.createScreenModel(l),s.parentUnit=t,s.addInteraction(),s});return r.concat(function(){Object.keys(e.scales).forEach(function(t){return e.scalesHub.createScaleInfo(e.scales[t]).commit()})}).concat(i)},e.prototype._flattenDrawScenario=function(t,n){var r={},i=[],a=[t],o=e.traverseSpec({unit:this.root},function(t,e,o){t.uid=function(){var n=Rt((e?e.uid+"/":"")+JSON.stringify(Object.keys(t).filter(function(e){return"string"==typeof t[e]}).reduce(function(e,n){return e[n]=t[n],e},{}))+"-"+JSON.stringify(o.pipe));return r.hasOwnProperty(n)?n+="-"+ ++r[n]:r[n]=0,n}(),t.guide=Ct(t.guide);var s=n(a[0],t,o);i.push(s),0===t.type.indexOf("COORDS.")&&function(t){a.unshift(t)}(s)},function(t){0===t.type.indexOf("COORDS.")&&a.shift()},null,this._datify({source:this.root.expression.source,pipe:[]}));return o.push(function(){return i}),o},e.prototype._expandUnitsStructure=function(t,e){var n=this;void 0===e&&(e=[]);var r=this;if(!1===t.expression.operator)t.frames=t.frames.map(function(t){return r._datify(t)});else{var i=this._parseExpression(t.expression,e,t.guide);t.transformation=t.transformation||[],t.frames=i.exec().map(function(n){var a=(i.inherit?e:[]).concat([{type:"where",args:n}]).concat(t.transformation);return r._datify({key:n,pipe:a,source:i.source,units:t.units?t.units.map(function(t){var e=Ct(t);return e.guide=t.guide,e}):[]})})}return t.frames.forEach(function(t){return t.units.forEach(function(e){return n._expandUnitsStructure(e,t.pipe)})}),t},e.prototype._createFrameScalesFactoryMethod=function(t){var e=this;return function(n,r,i){var a=r||n+":default";return e.scalesHub.createScaleInfo(e.scales[a],t).create("function"==typeof i?i(e.scales[a]):i)}},e.prototype._datify=function(t){return new ze(t,this.sources[t.source].data,this.transformations)},e.prototype._parseExpression=function(t,e,n){var r=this,i=t.operator||"none",a=t.source,o=!1!==t.inherit,s=t.params,u={source:a,pipe:o?e:[]},l=je[i];if(!l)throw new Error(i+" operator is not supported");return{source:a,inherit:o,func:l,args:s,exec:function(){return l.apply(void 0,[function(){return r._datify(u).part()}].concat(s||[],[n]))}}},e}(d),Ue="tau-chart__",Xe=n(10),qe=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Xe.Tooltip.defaults.baseClass=Ue+"tooltip";var Ye=["top","bottom"];var $e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return qe(e,t),e.prototype._pickPlace=function(t){if(!this.options.auto)return this.options.place;var e=function(t,e){return{top:e.top+t,right:e.right-t,bottom:e.bottom-t,left:e.left+t,width:e.width-2*t,height:e.height-2*t}}(0|this.options.winBound,function(){var t=window,e=document.documentElement,n=(t.pageYOffset||e.scrollTop)-e.clientTop,r=(t.pageXOffset||e.scrollLeft)-e.clientTop,i=t.innerWidth||e.clientWidth,a=t.innerHeight||e.clientHeight;return{top:n,right:r+i,bottom:n+a,left:r,width:i,height:a}}()),n=this.options.place.split("-"),r=this.spacing;if(-1!==Ye.indexOf(n[0]))switch(t.top-this.height-r<=e.top?n[0]="bottom":t.bottom+this.height+r>=e.bottom&&(n[0]="top"),n[1]){case"left":t.right-this.width<=e.left&&(n[1]="right");break;case"right":t.left+this.width>=e.right&&(n[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?n[1]="left":t.right-t.width/2-this.width/2<=e.left&&(n[1]="right")}else switch(t.left-this.width-r<=e.left?n[0]="right":t.right+this.width+r>=e.right&&(n[0]="left"),n[1]){case"top":t.bottom-this.height<=e.top&&(n[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(n[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?n[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(n[1]="bottom")}return n.join("-")},e}(Xe.Tooltip),Ke=function(){function t(t,e){this.chart=e,this.handlers=new Map,this.plugins=t.map(this.initPlugin,this)}return t.prototype.initPlugin=function(t){var e=this;t.init&&t.init(this.chart);var n=[];this.handlers.set(t,n);var r=function(r,i){n.push(e.chart.on(r,i,t))};return t.destroy&&r("destroy",t.destroy.bind(t)),Object.keys(t).forEach(function(e){if(0===e.indexOf("on")){var n=e.substr(2).toLowerCase();r(n,t[e].bind(t))}}),t},t.prototype.destroyPlugin=function(t){var e=this;t.destroy&&t.destroy(),this.handlers.get(t).forEach(function(n){e.chart.removeHandler(n,t)})},t.prototype.destroy=function(){var t=this;this.plugins.forEach(function(e){return t.destroyPlugin(e)})},t}(),Je={},Qe={},Ze={reg:function(t,e,n){return n?(Qe[t]=n,Je[t]=function(t,e){this.___tauchartsseed___=new e(this.init(t))},Je[t].prototype=Object.assign({init:function(t){return t},defineGrammarModel:function(t){return this.node().defineGrammarModel(t)},getGrammarRules:function(t){return this.node().getGrammarRules(t)},getAdjustScalesRules:function(t){return this.node().getAdjustScalesRules(t)},createScreenModel:function(t){return this.node().createScreenModel(t)},addInteraction:function(){this.node().addInteraction()},node:function(){return this.___tauchartsseed___},draw:function(){this.node().draw()}},e)):Je[t]=e,this},get:function(t){if(!Je.hasOwnProperty(t))throw new _("Unknown unit type: "+t,w.UNKNOWN_UNIT_TYPE);return Je[t]},create:function(t,e){var n,r=this.get(t);Qe[t]?n=new r(e,this.get(Qe[t])):n=new r(e);return n}},tn={},en={},nn={reg:function(t,e,n){return void 0===n&&(n=function(t){return t}),tn[t]=e,en[t]=n,nn},get:function(t){return tn[t]},instance:function(t){return void 0===t&&(t={}),{create:function(e,n,r){return new(nn.get(e))(n,(0,en[e])(r,t))}}}},rn=function(){function t(t,e,n){this.registry=t,this.sources=e,this.scales=n}return t.prototype.createScaleInfo=function(t,e){void 0===e&&(e=null);var n=t.dim,r=t.source,i=(this.sources[r].dims[n]||{}).type,a=this.sources[r].data,o=e||new ze({source:r},a);return t.dimType=i,this.registry.create(t.type,o,t)},t.prototype.createScaleInfoByName=function(t,e){return void 0===e&&(e=null),this.createScaleInfo(this.scales[t],e)},t}(),an=function(t,e,n){var r=!0,i=null;try{t.reduce(function(t,r){var a=function(t,e){var n=r[e],i=kt(n)?JSON.stringify(n):n;return t.push(i),t},o=e.reduce(a,[]).join("/"),s=n.reduce(a,[]).join("/");if(t.hasOwnProperty(o)){var u=t[o];if(u!==s)throw i={type:"RelationIsNotAFunction",keyX:e.join("/"),keyY:n.join("/"),valX:o,errY:[u,s]},new Error("RelationIsNotAFunction")}else t[o]=s;return t},{})}catch(t){if("RelationIsNotAFunction"!==t.message)throw t;r=!1}return{result:r,error:i}},on=function(t,e){var n=Object.keys(t).reduce(function(e,n){var r=t[n];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||e.push(n),e},[]);return function(t){var r=!n.some(function(e){return!t.hasOwnProperty(e)||null===t[e]});return r||e(t),r}},sn=function(t){var e={category:"ordinal",order:"ordinal",measure:"linear"},n={};return Object.keys(t).forEach(function(r){var i=t[r],a=(i.type||"category").toLowerCase();n[r]=Object.assign({},i,{type:a,scale:i.scale||e[a],value:i.value})}),n},un=function(t){var e={type:"category",scale:"ordinal"};return t.reduce(function(t,n){return Object.keys(n).forEach(function(r){var i=n.hasOwnProperty(r)?n[r]:null;if(t[r]=t[r]||{type:null,hasNull:!1},null===i)t[r].hasNull=!0;else{var a=function(t,e){var n=e;return At(t)?(n.type="measure",n.scale="time"):kt(t)?(n.type="order",n.scale="ordinal"):Number.isFinite(t)&&(n.type="measure",n.scale="linear"),n}(i,Ct(e)),o=a.type,s=a.scale,u=null!==t[r].type&&t[r].type!==o;t[r].type=u?e.type:o,t[r].scale=u?e.scale:s}}),t},{})},ln=function(t,e,n){var r=t,i=["period","time"].indexOf(n.scale)>=0?function(t){return new Date(t)}:function(t){return t},a=t.reduce(function(t,e,n){return t.set(e,n),t},new Map);if("measure"===n.type||"period"===n.scale)r=t.slice().sort(te(function(t,n){return i(t[e])-i(n[e])},function(t,e){return a.get(t)-a.get(e)}));else if(n.order){var o=n.order.reduce(function(t,e,n){return t[e]=n,t},{}),s=n.order.length,u="(___"+e+"___)";r=t.map(function(t){var n=o[t[e]];return n=n>=0?n:s,t[u]=n,t}).sort(te(function(t,e){return t[u]-e[u]},function(t,e){return a.get(t)-a.get(e)})).map(function(t){return delete t[u],t})}return r},cn=function(t,e){var n=document.createElement("div");return n.classList.add(Ue+t),e&&e.appendChild(n),n},fn=function(){var t=cn("layout"),e=cn("layout__header",t),n=cn("layout__container",t),r=cn("layout__sidebar",n),i=cn("layout__content",n),a=cn("layout__content__wrap",i),o=cn("layout__sidebar-right",n);return{layout:t,header:e,content:a,contentContainer:i,leftSidebar:r,rightSidebar:cn("layout__sidebar-right__wrap",o),rightSidebarContainer:o,footer:cn("layout__footer",t)}},dn=function(){function t(t){this.spec=t,this.dist={sources:{"?":{dims:{},data:[{}]},"/":{dims:{},data:[]}},scales:{x_null:{type:"ordinal",source:"?"},y_null:{type:"ordinal",source:"?"},size_null:{type:"size",source:"?"},color_null:{type:"color",source:"?"},split_null:{type:"value",source:"?"},"pos:default":{type:"ordinal",source:"?"},"size:default":{type:"size",source:"?"},"label:default":{type:"value",source:"?"},"color:default":{type:"color",source:"?"},"split:default":{type:"value",source:"?"}},settings:t.settings}}return t.prototype.convert=function(){var t=this.spec,e=this.dist;return this.ruleAssignSourceDims(t,e),this.ruleAssignStructure(t,e),this.ruleAssignSourceData(t,e),this.ruleApplyDefaults(e),e},t.prototype.ruleApplyDefaults=function(t){var e=t.settings||{},n=function(t,e,r){e(t,r),(t.units||[]).map(function(r){return n(r,e,t)})};n(t.unit,function(t,n){if(t.namespace="chart",t.guide=Jt(t.guide||{},{animationSpeed:e.animationSpeed||0,utcTime:e.utcTime||!1}),n&&!t.hasOwnProperty("units")){t=Jt(t,{x:n.x,y:n.y});var r=Ct(n.guide)||{};t.guide.x=Jt(t.guide.x||{},r.x),t.guide.y=Jt(t.guide.y||{},r.y),t.expression.inherit=n.expression.inherit}return!n||t.guide&&t.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(t.guide=Object.assign(t.guide||{},{obsoleteVerticalStackOrder:(n.guide||{}).obsoleteVerticalStackOrder})),t},null)},t.prototype.ruleAssignSourceData=function(t,e){var n=t.spec.dimensions||{},r=e.sources["/"].dims,i=function(t,e){var n=t[e];return kt(n)&&!At(n)&&Object.keys(n).forEach(function(r){return t[e+"."+r]=n[r]}),t};e.sources["/"].data=t.data.map(function(t){var e=Object.keys(t).reduce(i,t);return Object.keys(r).reduce(function(t,e){return t.hasOwnProperty(e)||(t[e]=null),null!==t[e]&&n[e]&&["period","time"].indexOf(n[e].scale)>=0&&(t[e]=new Date(t[e])),t},e)})},t.prototype.ruleAssignSourceDims=function(t,e){var n=t.spec.dimensions;e.sources["/"].dims=Object.keys(n).reduce(function(t,e){return t[e]={type:n[e].type},t},{})},t.prototype.ruleAssignStructure=function(t,e){var n=this,r=function(t){var i=Ct(Qt(t,"unit"));return n.ruleCreateScales(t,i,e.settings),i.expression=n.ruleInferExpression(t),t.unit&&(i.units=t.unit.map(r)),i},i=r(t.spec.unit);i.expression.inherit=!1,e.unit=i},t.prototype.ruleCreateScales=function(t,e,n){var r=this,i=t.guide||{};["identity","color","size","label","x","y","split"].forEach(function(a){t.hasOwnProperty(a)&&(e[a]=r.scalesPool(a,t[a],i[a]||{},n))})},t.prototype.ruleInferDim=function(t,e){var n=t,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(n))return n;e.hasOwnProperty("tickLabel")?n=t+"."+e.tickLabel:r[t].value&&(n=t+"."+r[t].value);var i=this.dist.sources["/"].dims;return i.hasOwnProperty(n)||(i[n]={type:i[t].type},delete i[t]),n},t.prototype.scalesPool=function(t,e,n,r){var i=t+"_"+e;if(this.dist.scales.hasOwnProperty(i))return i;var a=this.spec.spec.dimensions,o={};if("color"===t&&null!==e&&(o={type:"color",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("brewer")&&(o.brewer=n.brewer),a[e]&&a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("nice")&&(o.nice=n.nice)),"size"===t&&null!==e&&(o={type:"size",source:"/",dim:this.ruleInferDim(e,n)},n.hasOwnProperty("func")&&(o.func=n.func),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("minSize")&&(o.minSize=n.minSize),n.hasOwnProperty("maxSize")&&(o.maxSize=n.maxSize)),"label"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"split"===t&&null!==e&&(o={type:"value",source:"/",dim:this.ruleInferDim(e,n)}),"identity"===t&&null!==e&&(o={type:"identity",source:"/",dim:this.ruleInferDim(e,n)}),a.hasOwnProperty(e)&&("x"===t||"y"===t)){if(o={type:a[e].scale,source:"/",dim:this.ruleInferDim(e,n)},a[e].hasOwnProperty("order")&&(o.order=a[e].order),n.hasOwnProperty("min")&&(o.min=n.min),n.hasOwnProperty("max")&&(o.max=n.max),n.hasOwnProperty("autoScale")?o.autoScale=n.autoScale:o.autoScale=!0,n.hasOwnProperty("nice")?o.nice=n.nice:o.nice=o.autoScale,n.hasOwnProperty("niceInterval")?o.niceInterval=n.niceInterval:o.niceInterval=null,n.hasOwnProperty("tickPeriod")&&(o.period=n.tickPeriod,o.type="period"),n.hasOwnProperty("tickPeriod")&&n.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(n.hasOwnProperty("timeInterval")){o.period=n.timeInterval,o.type="time";var s=b.get(o.period,{utc:r.utcTime});n.hasOwnProperty("min")&&(o.min=s.cast(new Date(n.min))),n.hasOwnProperty("max")&&(o.max=s.cast(new Date(n.max)))}o.fitToFrameByDims=n.fitToFrameByDims,o.ratio=n.ratio}return this.dist.scales[i]=o,i},t.prototype.getScaleConfig=function(t,e){var n=t+"_"+e;return this.dist.scales[n]},t.prototype.ruleInferExpression=function(t){var e={operator:"none",params:[]},n=t.guide||{},r=n.x||{},i=n.y||{},a=this.getScaleConfig("x",t.x),o=this.getScaleConfig("y",t.y);return 0===t.type.indexOf("ELEMENT.")?t.color&&(e={operator:"groupBy",params:[this.ruleInferDim(t.color,n.color||{})]}):"COORDS.RECT"===t.type&&1===t.unit.length&&"COORDS.RECT"===t.unit[0].type&&(e=a.period||o.period?{operator:"cross_period",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i),a.period,o.period]}:{operator:"cross",params:[this.ruleInferDim(t.x,r),this.ruleInferDim(t.y,i)]}),Object.assign({inherit:!0,source:"/"},e)},t}(),hn=n(6),pn=n(7),gn=function(){return(gn=Object.assign||function(t){for(var e,n=1,r=arguments.length;nt.computed?{value:n,computed:r}:t},{}).value;return n(e(a))},kn=function(t,e){var n=t.dimType,r=t.scaleType,i=[n,r,"*"].join(":"),a=[n,r].join(":");return e[i]||e[a]||e[n]||null},On=function(t,e,n){return t.hasOwnProperty(e+":"+n)?t[e+":"+n]:t[""+e]},Pn=function(t,e){return["day","week","month"].indexOf(t)>=0&&(t+="-short"+(e?"-utc":"")),t},Nn=function(t,e){var n=t.width,r=t.height,i=Math.abs(Vt(e));return{width:Math.max(Math.cos(i)*n,r),height:Math.max(Math.sin(i)*n,r)}},Ln=function(t,e){void 0===e&&(e="x");var n=Ht(t),r="x"===e?[[0,45,"middle"],[45,135,"start"],[135,225,"middle"],[225,315,"end"],[315,360,"middle"]]:[[0,90,"end"],[90,135,"middle"],[135,225,"start"],[225,315,"middle"],[315,360,"end"]];return r[r.findIndex(function(t){return n>=t[0]&&ne.xAxisTickLabelLimit&&(t.x.tickFormatWordWrap=!0,t.x.tickFormatWordWrapLines=e.xTickWordWrapLinesLimit,d=Rn(c,e.xAxisTickLabelLimit,e.xTickWordWrapLinesLimit)),f.width>e.yAxisTickLabelLimit&&(t.y.tickFormatWordWrap=!0,t.y.tickFormatWordWrapLines=e.yTickWordWrapLinesLimit,h=Rn(f,e.yAxisTickLabelLimit,e.yTickWordWrapLinesLimit)),a&&(t.y.tickFormatWordWrap=!1,t.y.tickFormatWordWrapLines=1,(h=Rn(f,2*e.yAxisTickLabelLimit,1)).width=20);var p=u?0:1,g=l?0:1,m=t.x.label,y=t.y.label,v=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,x=Nn(d,t.x.rotate),_=Nn(h,t.y.rotate);i?(m.padding=(-e.xAxisPadding-e.xFontLabelHeight)/2+e.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-e.yAxisPadding-e.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,v=0,b=0):(m.padding=En([p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight)]),m.paddingNoTicks=v*(e.distToXAxisLabel+e.xFontLabelHeight),y.padding=En([g*(e.yTickWidth+_.width),b*e.distToYAxisLabel]),y.paddingNoTicks=b*e.distToYAxisLabel),a&&(y.padding=0,y.paddingNoTicks=0);var w=e.xFontLabelDescenderLineHeight;return t.padding=Object.assign(t.padding,{b:t.x.hide?0:En([t.x.padding,p*(e.xTickWidth+x.height),v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:En([t.y.padding,a?0:g*(e.yTickWidth+_.width),b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.paddingNoTicks=Object.assign({},t.paddingNoTicks,{b:t.x.hide?0:En([t.x.padding,v*(e.distToXAxisLabel+e.xFontLabelHeight+w)]),l:t.y.hide?0:En([t.y.padding,b*(e.distToYAxisLabel+e.yFontLabelHeight)])}),t.x=Object.assign(t.x,{density:x.width+2*On(e,"xDensityPadding",n.dimType),tickFontHeight:c.height,$minimalDomain:o.length,$maxTickTextW:d.width,$maxTickTextH:d.height,tickFormatWordWrapLimit:e.xAxisTickLabelLimit}),t.y=Object.assign(t.y,{density:_.height+2*On(e,"yDensityPadding",r.dimType),tickFontHeight:f.height,$minimalDomain:s.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:e.yAxisTickLabelLimit}),t}var Dn=function(t){var e=t.unit,n=t.meta,r=t.settings,i=t.allowXVertical,a=t.allowYVertical,o=t.inlineLabels,s=n.dimension(e.x),u=n.dimension(e.y),l=n.scaleMeta(e.x,e.guide.x),c=n.scaleMeta(e.y,e.guide.y),f=l.isEmpty,d=c.isEmpty;e.guide.x.tickFormat=Pn(e.guide.x.tickFormat||kn(s,r.defaultFormats),r.utcTime),e.guide.y.tickFormat=Pn(e.guide.y.tickFormat||kn(u,r.defaultFormats),r.utcTime);var h=!!i&&!("measure"===s.dimType),p=!!a&&!("measure"===u.dimType);if(e.guide.x.padding=f?0:r.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:r.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=Ln(e.guide.x.rotate,"x"),e.guide.y.rotate=p?-90:0,e.guide.y.textAnchor=Ln(e.guide.y.rotate,"y"),e.guide=Fn(e.guide,r,l,c,o,de(e)),o){var g=e.guide.x.label,m=e.guide.y.label;g.cssClass+=" inline",g.dock="right",g.textAnchor="end",m.cssClass+=" inline",m.dock="right",m.textAnchor="end"}return e},In={NONE:function(t,e,n){var r=Ct(t);return jn(Ct(r.unit),r.unit,function(t,e){return e.guide.x.tickFontHeight=n.getAxisTickLabelSize("X").height,e.guide.y.tickFontHeight=n.getAxisTickLabelSize("Y").height,e.guide.x.tickFormatWordWrapLimit=n.xAxisTickLabelLimit,e.guide.y.tickFormatWordWrapLimit=n.yAxisTickLabelLimit,e}),r},"BUILD-LABELS":function(t,e){var n=Ct(t),r=[],i=[],a=null,o=null;gt(n.unit,"units",Cn,function(t,n){if(t.isLeaf)return n;!a&&n.x&&(a=n),!o&&n.y&&(o=n),n.guide=n.guide||{},n.guide.x=n.guide.x||{label:{text:""}},n.guide.y=n.guide.y||{label:{text:""}},n.guide.x.label=kt(n.guide.x.label)?n.guide.x.label:{text:n.guide.x.label&&n.guide.x.label.text?n.guide.x.label.text:""},n.guide.y.label=kt(n.guide.y.label)?n.guide.y.label:{text:n.guide.y.label&&n.guide.y.label.text?n.guide.y.label.text:""},n.x&&(n.guide.x.label.text=n.guide.x.label.text||e.dimension(n.x).dimName),n.y&&(n.guide.y.label.text=n.guide.y.label.text||e.dimension(n.y).dimName);var s=n.guide.x.label.text;s&&(r.push(s),n.guide.x.tickFormatNullAlias=n.guide.x.hasOwnProperty("tickFormatNullAlias")?n.guide.x.tickFormatNullAlias:"No "+s,n.guide.x.label.text="",n.guide.x.label._original_text=s);var u=n.guide.y.label.text;return u&&(i.push(u),n.guide.y.tickFormatNullAlias=n.guide.y.hasOwnProperty("tickFormatNullAlias")?n.guide.y.tickFormatNullAlias:"No "+u,n.guide.y.label.text="",n.guide.y.label._original_text=u),n});return a&&(a.guide.x.label.text=a.guide.x.label.hide?"":r.join(" → ")),o&&(o.guide.y.label.text=o.guide.y.label.hide?"":i.join(" → ")),n},"BUILD-GUIDE":function(t,e,n){var r=Ct(t);return jn(Ct(r.unit),r.unit,function(t,r){if(t.isLeaf)return r;var i=!t.isLeaf&&!t.isLeafParent,a=e.scaleMeta(r.x,r.guide.x),o=e.scaleMeta(r.y,r.guide.y),s=!i&&Boolean(a.dimType)&&"measure"!==a.dimType;return r.guide.x.rotate=r.guide.x.rotate||(s?-90:0),r.guide.x.textAnchor=Ln(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||kn(a,n.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||kn(o,n.defaultFormats),r.guide.x.padding=i?0:n.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=i?0:n.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Fn(r.guide,Jt({distToXAxisLabel:a.isEmpty?n.xTickWidth:n.distToXAxisLabel,distToYAxisLabel:o.isEmpty?n.yTickWidth:n.distToYAxisLabel},n),a,o,null,de(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:i?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!i||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:i?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!i&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:t.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":function(t,e,n){var r=Ct(t);return jn(Ct(r.unit),r.unit,function(t,r){return t.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=t.isLeafParent?"xy":""),t.isLeafParent?Dn({unit:r,meta:e,settings:Jt({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!0,allowYVertical:!1,inlineLabels:!0}):(r.guide.x.cssClass+=" facet-axis compact",r.guide.x.avoidCollisions=!0,r.guide.y.cssClass+=" facet-axis compact",r.guide.y.avoidCollisions=!0,Dn({unit:r,meta:e,settings:Jt({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},n),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))}),r},AUTO:function(t,e,n){return["BUILD-LABELS","BUILD-GUIDE"].reduce(function(t,r){return In[r](t,e,n)},t)},COMPACT:function(t,e,n){return["BUILD-LABELS","BUILD-COMPACT"].reduce(function(t,r){return In[r](t,e,n)},t)}},jn=function(t,e,n){var r=function(t){return t.options=t.options||{},t.guide=t.guide||{},t.guide.padding=Jt(t.guide.padding||{},{l:0,b:0,r:0,t:0}),t.guide.x=Mn(t.guide,"x"),t.guide.x=Tn(t.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),t.guide.y=Mn(t.guide,"y",{rotate:-90}),t.guide.y=Tn(t.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),t.guide.size=Mn(t.guide,"size"),t.guide.color=Mn(t.guide,"color"),t}(e);r=n(Cn(r),r);var i=Qt(r=Sn(r,t),"units");return(r.units||[]).forEach(function(t){return jn(Ct(t),function(t,e){return t.guide=t.guide||{},t.guide.padding=t.guide.padding||{l:0,t:0,r:0,b:0},t.hasOwnProperty("units")||((t=Jt(t,e)).guide=Jt(t.guide,Ct(e.guide)),t.guide.x=Jt(t.guide.x,Ct(e.guide.x)),t.guide.y=Jt(t.guide.y,Ct(e.guide.y))),t}(t,i),n)}),r},zn=function(t,e,n,r){var i={dimension:function(t){var e=n.scales[t],r=n.sources[e.source].dims[e.dim]||{};return{dimName:e.dim,dimType:r.type,scaleType:e.type}},scaleMeta:function(t){var e=r("pos",t).domain(),i=n.scales[t],a=n.sources[i.source].dims[i.dim]||{};return{dimName:i.dim,dimType:a.type,scaleType:i.type,values:e,isEmpty:null==a.type}}},a=(In[t]||In.NONE)({unit:Ct(n.unit)},i,e);return n.unit=a.unit,n},Bn=function(){function t(t){this.spec=t,this.isApplicable=Dt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.size,r=e.settings.specEngine.find(function(t){return n.width<=t.width||n.height<=t.height});return zn(r.name,e.settings,e,function(e,n){return t.getScaleInfo(n||e+":default")})},t}(),Vn=function(){function t(){}return t.optimizeXAxisLabel=function(t,e){var n=e.xAxisTickLabelLimit,r=function(t){if(!t.guide.x.hide&&!t.guide.x.hideTicks&&0!==t.guide.x.rotate){t.guide.x.rotate=0,t.guide.x.textAnchor="middle";var e=0-Math.min(n,t.guide.x.$maxTickTextW)+t.guide.x.$maxTickTextH;i(t,e)}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})},i=function(e,n){t!==e&&"extract-axes"===e.guide.autoLayout?(t.guide.x.padding+=n,t.guide.padding.b+=n):(e.guide.x.label.padding+=e.guide.x.label.padding>0?n:0,e.guide.padding.b+=e.guide.padding.b>0?n:0)};r(t)},t.hideAxisTicks=function(t,e,n){var r=function(t){var e="x"===n?"b":"l",i=t.guide;if(!i[n].hide&&!i[n].hideTicks){de(t)&&"y"===n||(i[n].hideTicks=!0);var a=i[n].label.text&&!i[n].label.hide;i.padding[e]=i.paddingNoTicks?i.paddingNoTicks[e]:0,i[n].padding=i[n].paddingNoTicks||0,i[n].label.padding=a?i[n].label.paddingNoTicks:0}(t.units||[]).filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return r(t)})};r(t)},t.facetsLabelsAtTop=function(t,e){var n=function(t){var e=t.units||[];if(de(t)){var r=t.guide;r.y.facetAxis=!0,r.y.rotate=0,r.y.textAnchor="start",e.forEach(function(t){t.guide.padding.t=20})}e.filter(function(t){return"COORDS.RECT"===t.type}).forEach(function(t){return n(t)})};n(t)},t}(),Hn=function(t){return t.$maxTickTextW},Wn=function(t){return 0==t.rotate?t.$maxTickTextW:t.$maxTickTextH},Gn=function(t){return t.density},Un=function(t){var e=[],n=[],r=function(t){if("COORDS.RECT"===t.type&&t.units&&t.units[0]&&"COORDS.RECT"===t.units[0].type){var i=t.x.replace(/^x_/,""),a=t.y.replace(/^y_/,"");"null"!==i&&e.push(i),"null"!==a&&n.push(a),t.units.forEach(r)}};r(t.unit);var i={},a={},o=function(t){"COORDS.RECT"===t.type&&t.frames.forEach(function(t){t.key&&(Object.keys(t.key).forEach(function(r){e.indexOf(r)>=0&&(i.hasOwnProperty(r)||(i[r]=[]),i[r].indexOf(t.key[r])<0&&i[r].push(t.key[r])),n.indexOf(r)>=0&&(a.hasOwnProperty(r)||(a[r]=[]),a[r].indexOf(t.key[r])<0&&a[r].push(t.key[r]))}),t.units&&t.units.forEach(o))})};return o(t.unit),{xFacetCount:Object.keys(i).reduce(function(t,e){return t*i[e].length},1),yFacetCount:Object.keys(a).reduce(function(t,e){return t*a[e].length},1)}},Xn={"entire-view":function(t,e,n,r){var i=n.unit.guide,a=Un(n),o=a.xFacetCount,s=a.yFacetCount;s>0&&Vn.facetsLabelsAtTop(n.unit,n.settings);var u=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0,l=i.paddingNoTicks?i.padding.b-i.paddingNoTicks.b:0,c=i.paddingNoTicks&&t.height-lt.height||o*n.settings.minFacetWidth+u>t.width,f=i.paddingNoTicks&&t.width-ut.height||o*n.settings.minFacetWidth+u>t.width;c&&Vn.hideAxisTicks(n.unit,n.settings,"x"),f&&Vn.hideAxisTicks(n.unit,n.settings,"y");var d=t.width;if(e("x",n.unit,Hn)<=t.width)r(n.unit,n.settings);else{var h=e("x",n.unit,Wn);if(h>t.width){var p=Math.max(t.width,e("x",n.unit,Gn));d=Math.min(h,p)}}var g=Math.max(t.height,e("y",n.unit,Gn));return!c&&d>t.width&&Vn.hideAxisTicks(n.unit,n.settings,"x"),!f&&g>t.height&&Vn.hideAxisTicks(n.unit,n.settings,"y"),{newW:t.width,newH:t.height}},minimal:function(t,e,n){return{newW:e("x",n.unit,Gn),newH:e("y",n.unit,Gn)}},normal:function(t,e,n,r){Un(n).yFacetCount>0&&Vn.facetsLabelsAtTop(n.unit,n.settings);var i=n.unit.guide;i.paddingNoTicks&&(t.width-i.padding.l+i.paddingNoTicks.lt.width){var s=Math.max(t.width,e("x",n.unit,Gn));a=Math.min(o,s)}}return{newW:a,newH:Math.max(t.height,e("y",n.unit,Gn))}},"fit-width":function(t,e,n,r){var i=n.unit.guide,a=i.paddingNoTicks?i.padding.l-i.paddingNoTicks.l:0;return(i.paddingNoTicks&&t.width-at.width)&&Vn.hideAxisTicks(n.unit,n.settings,"y"),e("x",n.unit,Hn)<=t.width&&r(n.unit,n.settings),{newW:t.width,newH:e("y",n.unit,Gn)}},"fit-height":function(t,e,n){var r=n.unit.guide,i=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&t.height-it.height)&&Vn.hideAxisTicks(n.unit,n.settings,"x"),{newW:e("x",n.unit,Gn),newH:t.height}}},qn=function(){function t(t){this.spec=t,this.isApplicable=Dt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;var n=e.settings.fitModel;if(!n)return e;var r=e.scales,i=function(t,e){return t.discrete?e*t.domain().length:4*e},a=function(e,n,o,s){void 0===s&&(s=null);var u="x"===e?n.x:n.y,l="x"===e?n.y:n.x,c=n.guide,f=o("x"===e?c.x:c.y),d=n.units[0],h="x"===e?c.padding.l+c.padding.r:c.padding.b+c.padding.t;if("ELEMENT.INTERVAL"===d.type&&"y"===e===Boolean(d.flip)&&d.label&&!t.getScaleInfo(d.label,s).isEmpty()){var p,g=2*(c.label&&c.label.fontSize?c.label.fontSize:10),m=t.getScaleInfo(u,s);if(m.discrete&&(null==d.guide.enableColorToBarPosition?!d.stack:d.guide.enableColorToBarPosition)){var y=d.color;if(y){var v=t.getScaleInfo(y,s);if(v.discrete){v.domain();p=v}}}var b=n.frames.reduce(function(t,e){return t+function(t){var e=t.part(),n=qt(e.map(function(t){return t[m.dim]})).length,r=1;if(p){var i=e.reduce(function(t,e){var n=e[m.dim],r=e[p.dim];return t[n]=t[n]||{},t[n][r]||(t[n][r]=!0),t},{}),a=Object.keys(i).map(function(t){return Object.keys(i[t]).length});r=Math.max.apply(Math,a)}return n*r*g}(e)},0),x=i(m,f);return h+Math.max(b,x)}if("COORDS.RECT"!==d.type){var _=t.getScaleInfo(u,s);return h+i(_,f)}var w=function(t,e){return t.reduce(function(t,n){var r=(n.key||{})[e];return t[r]=t[r]||[],t[r].push(n),t},{})}(n.frames,r[l].dim),E=Object.keys(w).map(function(t){return w[t].map(function(t){return a(e,t.units[0],o,t)}).reduce(function(t,e){return t+e},0)});return h+Math.max.apply(Math,E)},o=e.settings.size,s=o.width,u=o.height,l=Xn[n];if(l){var c=l(o,a,e,Vn.optimizeXAxisLabel);s=c.newW,u=c.newH}return e.settings.size=function(n,r,i){var a=e.settings.getScrollbarSize(t.getLayout().contentContainer),o=r.width>n.width&&r.width<=n.width*i?n.width:r.width,s=r.height>n.height&&r.height<=n.height*i?n.height:r.height,u=n.width-o,l=n.height-s>=0?0:a.width;return{height:s-(u>=0?0:a.height),width:o-l}}(o,{width:s,height:u},e.settings.avoidScrollAtRatio),e},t}(),Yn=function(){function t(t){this.spec=t,this.isApplicable=t.settings.autoRatio&&Dt(t.unit)}return t.prototype.transform=function(t){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleApplyRatio(e,t)}catch(t){if("Not applicable"!==t.message)throw t}return e},t.prototype.ruleApplyRatio=function(t,e){var n=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},r=function(t,e,n,i){void 0===i&&(i=0),e(t,i)&&(t.units||[]).map(function(t){return r(t,e,n,i+1)}),n(t,i)},i=[],a=[];r(t.unit,function(t,e){if(e>1||!n(t))throw new Error("Not applicable");return i.push(t.x),a.push(t.y),1===(t.units||[]).map(function(t){if(!n(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(n).length},function(){return 0});var o=function(e){return t.scales[e]},s=function(t){return"/"===t.source&&!t.ratio&&!t.fitToFrameByDims},u=function(t){return"ordinal"===t.type||"period"===t.type&&!t.period},l=i.map(o).filter(s),c=a.map(o).filter(s);if([l.length,c.length].some(function(t){return 2===t})){var f=function(t){return t.dim},d=function(t,e,n){t.fitToFrameByDims=n.slice(0,e).map(f)},h=function(t,n){2===n.filter(u).length&&(n.forEach(d),n[0].ratio=Ft(t,n.map(f),e))};h("x",l),h("y",c)}},t}(),$n=function(){function t(t){this.spec=t,this.isApplicable="EXTRACT"===t.settings.layoutEngine&&Dt(t.unit)}return t.prototype.transform=function(){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleExtractAxes(t)}catch(t){if("Not applicable"!==t.message)throw t;console.log("[TauCharts]: can't extract axes for the given chart specification")}return t},t.prototype.ruleExtractAxes=function(t){var e=function(t){return"COORDS.RECT"===t.type||"RECT"===t.type},n=function(t){return t?10:0},r={l:0,r:10,t:10,b:0},i={l:0,b:0},a=[],o=[];mt(t.unit,function(t,n){if(n>1||!e(t))throw new Error("Not applicable");t.guide=t.guide||{};var s=t.guide,u=s.padding||{l:0,r:0,t:0,b:0},l=s.paddingNoTicks||{l:0,b:0};return r.l+=u.l,r.r+=u.r,r.t+=u.t,r.b+=u.b,i.l+=l.l,i.b+=l.b,a.push(Object.assign({},r)),o.push(Object.assign({},i)),1===(t.units||[]).map(function(t){if(!e(t)&&!function(t){return 0===t.type.indexOf("ELEMENT.")}(t))throw new Error("Not applicable");return t}).filter(e).length},function(t){var e=a.pop(),s=o.pop(),u=t.guide||{};u.x=u.x||{},u.x.padding=u.x.padding||0,u.x.paddingNoTicks=u.x.paddingNoTicks||0,u.y=u.y||{},u.y.padding=u.y.padding||0,u.y.paddingNoTicks=u.y.paddingNoTicks||0,u.padding={l:n(t.y),r:n(1),t:n(1),b:n(t.x)},u.paddingNoTicks={l:0,b:0},u.autoLayout="extract-axes",u.x.padding+=r.b-e.b,u.y.padding+=r.l-e.l,u.x.paddingNoTicks+=i.b-s.b,u.y.paddingNoTicks+=i.l-s.l}),t.unit.guide.padding=r,t.unit.guide.paddingNoTicks=i},t}(),Kn=function(){function t(t){var e=void 0===t?{}:t,n=e.src,r=void 0===n?null:n,i=e.timeout,a=void 0===i?Number.MAX_SAFE_INTEGER:i,o=e.syncInterval,s=void 0===o?Number.MAX_SAFE_INTEGER:o,u=e.callbacks,l=void 0===u?{}:u,c=this;this.setTimeoutDuration(a),this.setSyncInterval(s),this.setCallbacks(l),this._running=!1,this._queue=[],this._result=r,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=function(){if(c._running&&c._requestedFrameId){var t=c._getCancelFrameFunction(),e=c._getRequestFrameFunction();t(c._requestedFrameId),c._requestedFrameId=e(c._requestedFrameCallback)}},this._tasksCount=0,this._finishedTasksCount=0}return t.prototype.setTimeoutDuration=function(e){t.checkType(e,"number","timeout"),this._timeout=e},t.prototype.setSyncInterval=function(e){t.checkType(e,"number","syncInterval"),this._syncInterval=e},t.prototype.setCallbacks=function(e){t.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)},t.prototype.addTask=function(t){return this._queue.push(t),this._tasksCount++,this},t.prototype.run=function(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,t.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()},t.prototype.isRunning=function(){return this._running},t.prototype._loopTasks=function(){for(var e,n,r,i,a=0,o=this._syncInterval/t.runnersInProgress;this._running&&!(r=this._asyncDuration>this._timeout)&&!(i=a>o)&&(e=this._queue.shift());){if(null===(n=this._runTask(e)))return;this._syncDuration+=n,this._asyncDuration+=n,a+=n}r&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!r&&i&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))},t.prototype._runTask=function(t){var e=performance.now();if(this._callbacks.error)try{this._result=t.call(null,this._result,this)}catch(t){return this.stop(),this._callbacks.error.call(null,t,this),null}else this._result=t.call(null,this._result,this);var n=performance.now()-e;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),n},t.prototype._requestFrame=function(){var t=this,e=performance.now(),n=function(){t._requestedFrameId=null;var n=performance.now();t._asyncDuration+=n-e,t._loopTasks()},r=this._getRequestFrameFunction();this._requestedFrameCallback=n,this._requestedFrameId=r(n)},t.prototype._getRequestFrameFunction=function(){var t=this;return document.hidden?function(e){return t._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})}:function(e){return t._requestedFrameType="animation",requestAnimationFrame(e)}},t.prototype._getCancelFrameFunction=function(){switch(this._requestedFrameType){case"animation":return function(t){return cancelAnimationFrame(t)};case"idle":return function(t){return window.cancelIdleCallback(t)}}},t.prototype.stop=function(){if(!this._running)throw new Error("Task Runner is already stopped");(this._running=!1,t.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId)&&(this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null)},t.checkType=function(t,e,n){if(typeof t!==e)throw new Error('Task Runner "'+n+'" property is not "'+e+'"')},t.runnersInProgress=0,t}(),Jn=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qn=function(){return(Qn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var c=l.findIndex(function(t){return t.closest.distance!==l[0].closest.distance||t.closest.secondaryDistance!==l[0].closest.secondaryDistance}),f=c<0?l:l.slice(0,c);if(1===f.length)a=f[0].closest.data,o=f[0].closest.node,s=f[0].unit;else{var d=f.reduce(function(t,e){return t+e.closest.x},0)/f.length,h=f.reduce(function(t,e){return t+e.closest.y},0)/f.length,p=Math.atan2(h-r,d-n)+Math.PI,g=Math.round((f.length-1)*p/2/Math.PI),m=f[g].closest;a=m.data,o=m.node,s=f[g].unit}}u.forEach(function(e){return e.unit.fire(i,{event:t,data:a,node:o,unit:s})})},e.prototype._initPointerEvents=function(){var t=this;this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);var e=Zn.select(this._svg),n=this._liveSpec.settings.syncPointerEvents?function(t){return function(){return t(o.event)}}:function(e){return function(){var n=o.event;t._pointerAnimationFrameId&&"mousemove"!==n.type&&t._cancelPointerAnimationFrame(),t._pointerAnimationFrameId||(t._pointerAnimationFrameId=requestAnimationFrame(function(){t._pointerAnimationFrameId=null,e(n)}))}},r=function(e){return t._handlePointerEvent(e)};e.on("mousemove",n(r)),e.on("click",n(r)),e.on("mouseleave",n(function(e){"none"!==window.getComputedStyle(t._svg).pointerEvents&&t.select(function(){return!0}).forEach(function(t){return t.fire("data-hover",{event:e,data:null,node:null,unit:null})})}))},e.prototype._cancelPointerAnimationFrame=function(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null},e.prototype._setupTaskRunner=function(t){var e=this;return this._resetTaskRunner(),this._taskRunner=new Kn({timeout:t.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:t.settings.asyncRendering?t.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:function(){e._completeRendering(),e._renderingPhase=null},timeout:function(t,n){e._displayTimeoutWarning({timeout:t,proceed:function(){e.disablePointerEvents(),n.setTimeoutDuration(Number.MAX_SAFE_INTEGER),n.run()},cancel:function(){e._cancelRendering()}}),e.enablePointerEvents(),e.fire("renderingtimeout",t)},progress:function(t){var n={spec:0,draw:1}[e._renderingPhase]/2+t/2;e._reportProgress(n)},error:t.settings.handleRenderingErrors?function(n){e._cancelRendering(),e._displayRenderingError(n),e.fire("renderingerror",n),t.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',"Error message: "+n.message].join(" "),"ERROR")}:null}}),this._taskRunner},e.prototype._resetTaskRunner=function(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)},e.prototype.renderTo=function(t,e){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(t,e);var n=this._createLiveSpec();if(!n)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(n),i=this._setupTaskRunner(n);this._scheduleDrawScenario(i,r),this._scheduleDrawing(i,r),i.run()},e.prototype._insertLayout=function(t,e){this._target=t,this._defaultSize=Object.assign({},e);var n=Zn.select(t).node();if(null===n)throw new Error("Target element not found");this._layout.layout.parentNode!==n&&n.appendChild(this._layout.layout);var r=this._layout.content,i=me(this._layout.contentContainer);this._layout.contentContainer.style.padding="0 "+i.width+"px "+i.height+"px 0",ye(this._layout.rightSidebarContainer,"vertical");var a=Object.assign({},e)||{};if(!a.width||!a.height){var o=r.parentElement,s=o.scrollLeft,u=o.scrollTop;r.style.display="none",a=Jt(a,xe(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=s,r.parentElement.scrollTop=u,a.height||(a.height=xe(this._layout.layout).height)}this.configGPL.settings.size=a},e.prototype._createLiveSpec=function(){var t=this;return this._liveSpec=Ct(Qt(this.configGPL,"plugins")),this._liveSpec.sources=this.getDataSources(),this._liveSpec.settings=this.configGPL.settings,this._experimentalSetupAnimationSpeed(this._liveSpec),this.isEmptySources(this._liveSpec.sources)?null:(this._liveSpec=this.transformers.reduce(function(e,n){return new n(e).transform(t)},this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)},e.prototype._experimentalSetupAnimationSpeed=function(t){t.settings.initialAnimationSpeed=t.settings.initialAnimationSpeed||t.settings.animationSpeed;var e=t.settings.experimentalShouldAnimate(t)?t.settings.initialAnimationSpeed:0;t.settings.animationSpeed=e;var n=function(t){t.guide=t.guide||{},t.guide.animationSpeed=e,t.units&&t.units.forEach(n)};n(t.unit)},e.prototype._createGPL=function(t){var e=new Ge(t,this.getScaleFactory(),Ze,S),n=e.unfoldStructure();return this.onUnitsStructureExpanded(n),e},e.prototype._scheduleDrawScenario=function(t,e){var n=this,r=Zn.select(this._layout.content),i=e.config.settings.size;t.addTask(function(){return n._renderingPhase="spec"}),e.getDrawScenarioQueue({allocateRect:function(){return{slot:function(t){return r.selectAll(".uid_"+t)},frameId:"root",left:0,top:0,width:i.width,containerWidth:i.width,height:i.height,containerHeight:i.height}}}).forEach(function(e){return t.addTask(e)})},e.prototype._scheduleDrawing=function(t,e){var n=this,r=e.config.settings.size;t.addTask(function(t){n._renderingPhase="draw",n._renderRoot({scenario:t,newSize:r}),n._cancelPointerAnimationFrame(),n._scheduleRenderScenario(t)})},e.prototype._resetProgressLayout=function(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()},e.prototype._renderRoot=function(t){var e=this,n=t.scenario,r=t.newSize,i=Zn.select(this._layout.content),a=n[0].config.uid,o=tr(i,"svg").attr("width",Math.floor(r.width)).attr("height",Math.floor(r.height));o.attr("class")||o.attr("class",Ue+"svg"),this._svg=o.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var s=o.selectAll("g.frame-root").data([a],function(t){return t});s.enter().append("g").classed(Ue+"cell cell frame-root uid_"+a,!0).merge(s).call(function(t){t.classed("tau-active",!0),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),s.exit().call(function(t){t.classed("tau-active",!1),et(t,e.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})},e.prototype._scheduleRenderScenario=function(t){var e=this;t.forEach(function(t){e._taskRunner.addTask(function(){t.draw(),e.onUnitDraw(t.node()),e._renderedItems.push(t)})})},e.prototype._completeRendering=function(){ye(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=this._liveSpec.settings.size.height+"px",this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),ye(this._layout.rightSidebarContainer,"vertical")},e.prototype._cancelRendering=function(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()},e.prototype._createProgressBar=function(){var t=Zn.select(this._layout.header),e=tr(t,"div."+Ue+"progress");e.select("div."+Ue+"progress__value").remove();var n=e.append("div").classed(Ue+"progress__value",!0).style("width",0);this._reportProgress=function(t){requestAnimationFrame(function(){e.classed(Ue+"progress_active",t<1),n.style("width",100*t+"%")})}},e.prototype._displayRenderingError=function(t){this._layout.layout.classList.add(Ue+"layout_rendering-error")},e.prototype._clearRenderingError=function(){this._layout.layout.classList.remove(Ue+"layout_rendering-error")},e.prototype.getScaleFactory=function(t){return void 0===t&&(t=null),new rn(nn.instance(this._liveSpec.settings),t||this._liveSpec.sources,this._liveSpec.scales)},e.prototype.getScaleInfo=function(t,e){return void 0===e&&(e=null),this.getScaleFactory().createScaleInfoByName(t,e)},e.prototype.getSourceFiltersIterator=function(t){var e=this,n=Xt(Object.keys(this._filtersStore.filters).map(function(t){return e._filtersStore.filters[t]})).filter(function(e){return!t(e)}).map(function(t){return t.predicate});return function(t){return n.reduce(function(e,n){return e&&n(t)},!0)}},e.prototype.getDataSources=function(t){var e=this;void 0===t&&(t={});var n=this._chartDataModel(this._originData);return Object.keys(n).filter(function(t){return"?"!==t}).reduce(function(r,i){var a=n[i],o=e.getSourceFiltersIterator(function(e){return function(n){return t.excludeFilter&&-1!==t.excludeFilter.indexOf(n.tag)||n.src!==e}}(i));return r[i]={dims:a.dims,data:a.data.filter(o)},r},{"?":n["?"]})},e.prototype.isEmptySources=function(t){return!Object.keys(t).filter(function(t){return"?"!==t}).filter(function(e){return t[e].data.length>0}).length},e.prototype.getChartModelData=function(t,e){return void 0===t&&(t={}),void 0===e&&(e="/"),this.getDataSources(t)[e].data},e.prototype.getDataDims=function(t){return void 0===t&&(t="/"),this._originData[t].dims},e.prototype.getData=function(t){return void 0===t&&(t="/"),this._originData[t].data},e.prototype.setData=function(t,e){void 0===e&&(e="/"),this._originData[e].data=t,this.refresh()},e.prototype.getSVG=function(){return this._svg},e.prototype.addFilter=function(t){t.src=t.src||"/";var e=t.tag,n=this._filtersStore.filters[e]=this._filtersStore.filters[e]||[],r=this._filtersStore.tick++;return t.id=r,n.push(t),r},e.prototype.removeFilter=function(t){var e=this;return Object.keys(this._filtersStore.filters).map(function(n){e._filtersStore.filters[n]=e._filtersStore.filters[n].filter(function(e){return e.id!==t})}),this},e.prototype.refresh=function(){this._target&&this.renderTo(this._target,this._defaultSize)},e.prototype.resize=function(t){void 0===t&&(t={}),this.renderTo(this._target,t)},e.prototype.select=function(t){return this._nodes.filter(t)},e.prototype.traverseSpec=function(t,e){var n=function(t,e,r,i){e(t,r,i),t.frames?t.frames.forEach(function(r){(r.units||[]).map(function(i){return n(i,e,t,r)})}):(t.units||[]).map(function(r){return n(r,e,t,null)})};n(t.unit,e,null,null)},e.prototype.getSpec=function(){return this._liveSpec},e.prototype.getLayout=function(){return this._layout},e.prototype._displayTimeoutWarning=function(t){var e=this,n=t.proceed,r=t.cancel,i=t.timeout,a=Math.round(100/3/1.5),o=function(t){return Math.round(100/3/1.5*t)};this._layout.content.style.height="100%",this._layout.content.insertAdjacentHTML("beforeend",'\n
\n \n \n Rendering took more than '+Math.round(i)/1e3+'s\n Would you like to continue?\n \n \n Continue\n \n \n Cancel\n \n \n
\n '),this._layout.content.querySelector("."+Ue+"rendering-timeout-continue-btn").addEventListener("click",function(){e._clearTimeoutWarning(),n.call(e)}),this._layout.content.querySelector("."+Ue+"rendering-timeout-cancel-btn").addEventListener("click",function(){e._clearTimeoutWarning(),r.call(e)})},e.prototype._clearTimeoutWarning=function(){var t=er(this._layout.content,"."+Ue+"rendering-timeout-warning");t&&(this._layout.content.removeChild(t),this._layout.content.style.height="")},e}(d),rr={},ir={},ar=function(t){var e="Chart type "+t+" is not supported.";throw console.log(e),console.log("Use one of "+Object.keys(rr).join(", ")+"."),new _(e,w.NOT_SUPPORTED_TYPE_CHART)},or={validate:function(t,e){return ir.hasOwnProperty(t)||ar(t),ir[t].reduce(function(t,n){return t.concat(n(e)||[])},[])},get:function(t){var e=rr[t];return"function"!=typeof e&&ar(t),e},add:function(t,e,n){return void 0===n&&(n=[]),rr[t]=e,ir[t]=n,or},getAllRegisteredTypes:function(){return rr}},sr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ur=function(t){function e(n){var r=t.call(this,n)||this;return n.autoResize&&e.winAware.push(r),r}return sr(e,t),e.prototype.applyConfig=function(e){var n=or.validate(e.type,e);if(n.length>0)throw new Error(n[0]);var r=or.get(e.type);(e=Jt(e,{autoResize:!0})).settings=nr.setupSettings(e.settings),e.dimensions=nr.setupMetaInfo(e.dimensions,e.data),t.prototype.applyConfig.call(this,r(e))},e.prototype.destroy=function(){var n=e.winAware.indexOf(this);-1!==n&&e.winAware.splice(n,1),t.prototype.destroy.call(this)},e}(nr);function lr(t){return t}ur.winAware=[],ur.resizeOnWindowEvent=function(){var t;function e(){t=0;for(var e=0,n=ur.winAware.length;ex&&x>2&&b.length>2;)b=n.ticks(--x)}else b=n.domain();r.hideTicks&&(b=c?b.filter(function(t){return 0==t}):[]);var _=null==s?n.tickFormat?n.tickFormat(o):lr:s,w=Math.max(u,0)+l,E=n.range(),S=E[0]+.5,M=E[E.length-1]+.5,T=(n.bandwidth?function(t){var e=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(e=Math.round(e)),function(n){return t(n)+e}}:lr)(n);if(r.facetAxis){var C=T;T=function(t){return C(t)-n.stepSize(t)/2}}var A=a.selection?a:null,k=A?A.selection():a,O=function(t){for(var e=t.node();e&&"svg"!==e.tagName;)e=e.parentNode;return e}(k).getBoundingClientRect();function P(t){var n=Ht(r.rotate);if(t.attr("transform",Pe(n)),Math.abs(n/90)%2>0){var i=n<180?1:-1,a=h?.5:-2,o=e===hr.top||e===hr.left?-1:1,s=a*(e===hr.top||e===hr.bottom?o<0?0:.71:.32);t.attr("x",9*i).attr("y",0).attr("dx",h?null:s+"em").attr("dy",s+"em")}}function N(t,e){void 0===e&&(e=0);var i=function(t){return Math.max(n.stepSize(t),r.tickFormatWordWrapLimit,e)};r.tickFormatWordWrap?tt(t,i,r.tickFormatWordWrapLines,r.tickFontHeight,!h):Z(t,i)}function L(t){!function(t,e){var n=e?-10:20,r=e?0:1,i=e?1:-1,a=[];t.each(function(){var t=J.select(this),e=t.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],n=i*parseFloat(e),o=t.select("text"),s=o.node().getBBox().width/2,u=n-s,l=n+s;a.push({c:n,s:u,e:l,l:0,textRef:o,tickRef:t})}),function(t,e){t.map(function(t,n,r){return e(r[n-1]||{e:-1/0,s:-1/0,l:0},t,r[n+1]||{e:1/0,s:1/0,l:0})})}(a.sort(function(t,e){return t.c-e.c}),function(t,r,i){var a=t.e>r.s,o=i.s1&&(u=u.replace(/([\.]*$)/gi,"")+"...");var l=11*r.l,c=e?parseFloat(r.textRef.attr("y"))+l:0,f=e?0:l,d=e?l:0,h=function(t){var e=0;if(!t)return e;var n=t.indexOf("rotate(");if(n>=0){var r=t.indexOf(")",n+7),i=t.substring(n+7,r);e=parseFloat(i.trim())}return e}(r.textRef.attr("transform"));r.textRef.text(function(t,e){return 0===e?u:""}).attr("transform","translate("+f+","+d+") rotate("+h+")");var p={x1:0,x2:0,y1:c+(e?-1:5),y2:n};e||(p.transform="rotate(-90)"),Se(r.tickRef,"line.label-ref").call(lt(p))}else r.tickRef.selectAll("line.label-ref").remove();return r})}(t,h)}k.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===hr.right?"start":e===hr.left?"end":"middle"),c||function(){var t=r.hideTicks||r.hide?[]:[null];le(k.selectAll(".domain").data(t)).then(function(t){return A&&t.exit().transition(A).attr("opacity",0).remove(),t.merge(t.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr("d",e===hr.left||e==hr.right?"M"+p*u+","+S+"H0.5V"+M+"H"+p*u:"M"+S+","+p*u+"V0.5H"+M+"V"+p*u)})}();var R=le(k.selectAll(".tick").data(b,function(t){return String(n(t))}).order()).then(function(t){var e=t.exit(),n=t.enter().append("g").attr("class","tick");return{tickExit:e,tickEnter:n,tick:t.merge(n)}}).then(function(t){if(f){var e=n.ticks(),r=n.domain(),i=b.length-1,a=e.length>1&&r[0]*r[1]<0&&-r[0]>(e[1]-e[0])/2&&r[1]>(e[i]-e[i-1])/2;t.tick.classed("zero-tick",function(t){return 0==t&&a})}return t}).result();!function(t){le(t).then(function(t){var e=t.tickEnter,n=t.tickExit,r=t.tick;return A?(e.attr("opacity",cr).attr("transform",function(t){var e=T(t);return y(e)}),{tick:r.transition(A),tickExit:n.transition(A).attr("opacity",cr).attr("transform",function(t){var e=T(t);return isFinite(e)?y(e):this.getAttribute("transform")})}):{tick:r,tickExit:n}}).then(function(t){var e=t.tick;t.tickExit.remove(),e.attr("opacity",1).attr("transform",function(t){return y(T(t))})})}(R),r.facetAxis||function(t){var e=p*u,r=d?function(t){return v*n.stepSize(t)/2}:null;le(t).then(function(t){var n=t.tick,i=t.tickEnter,a=n.select("line"),o=i.append("line").attr("stroke","#000").attr(m+"2",e);return d&&o.attr(g+"1",r).attr(g+"2",r),a.merge(o)}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m+"2",e),d&&t.attr(g+"1",r).attr(g+"2",r)})}(R),d&&c&&d&&b&&b.length&&le(k.selectAll(".extra-tick-line").data([null])).then(function(t){return t.merge(t.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(g+"1",S).attr(g+"2",S).attr(m+"1",0).attr(m+"2",p*u)}),c||(function(i){var a=r.textAnchor,o=p*w,s=e===hr.top?"0em":e===hr.bottom?"0.71em":"0.32em";function u(e){if(r.facetAxis)return e.attr("dx",18-t.position[0]).attr("dy",16)}le(i).then(function(t){var e=t.tick,n=t.tickEnter,r=e.select("text"),i=n.append("text").attr("fill","#000").attr(m,o).attr("dy",s);return P(i),u(i),r.merge(i)}).then(function(t){if(t.text(_).attr("text-anchor",a),!1===h&&!0===r.facetAxis){var e=Le(k.node().parentNode.getAttribute("transform"));N(t,O.width-Math.abs(e.x))}else N(t);return h&&"time"===n.scaleType&&function(t){if(!(b.length<2)){var e=0,n=-1,r=t.nodes();r.forEach(function(t,r){var i=t.textContent||"",a=i.length;a>e&&(e=a,n=r)});var i=T(b[1])-T(b[0]),a=!1;if(n>=0){var o=r[n].getBoundingClientRect();a=i-o.width<8}k.classed(Ue+"time-axis-overflow",a)}}(t),!h||"time"!==n.scaleType&&"linear"!==n.scaleType||function(t){if(0!==b.length){var e=b[0],n=b[b.length-1],r=k.append("line").attr("x1",T(e)).attr("x2",T(e)).attr("y1",0).attr("y2",1),i=k.append("line").attr("x1",T(n)).attr("x2",T(n)).attr("y1",0).attr("y2",1),a={left:r.node().getBoundingClientRect().left-O.left,right:O.right-i.node().getBoundingClientRect().right};r.remove(),i.remove();var o=function(t,e,n){var r=t.getBoundingClientRect(),i=e>0?"right":"left",o=(T(n),a[i]),s=Math.ceil(r.width/2-o+1);t.setAttribute("dx",String(s>0?-e*s:0))},s=t.filter(function(t){return t===e}).node(),u=t.filter(function(t){return t===n}).node();t.attr("dx",null),o(s,-1,e),o(u,1,n)}}(t),t}).then(function(t){return A?t.transition(A):t}).then(function(t){t.attr(m,o),P(t),u(t),d&&r.avoidCollisions&&!r.facetAxis&&(A?A.on("end.fixTickTextCollision",function(){return L(i.tick)}):L(i.tick))})}(R),i.hide||function(){var t=i,e=Se(k,"text.label").attr("class",Ae("label",t.cssClass)).attr("transform",Pe(t.rotate)).attr("text-anchor",t.textAnchor);le(e).then(function(t){return A?t.transition(A):t}).then(function(e){var n=v*t.padding,r=Math.abs(M-S),i=h?r:0;e.attr("x",i).attr("y",n).attr("text-anchor","end")});for(var n=t.text.split(" → "),r=n.length-1;r>0;r--)n.splice(r,0," → ");e.selectAll("tspan").data(n).enter().append("tspan").attr("class",function(t,e){return e%2?"label-token-delimiter label-token-delimiter-"+e:"label-token label-token-"+e}).text(function(t){return t}).exit().remove()}())}}function gr(t){return pr({scale:t.scale,scaleGuide:t.scaleGuide,ticksCount:t.ticksCount,tickSize:t.tickSize,gridOnly:!0,position:t.position})}var mr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yr=Se,vr=function(t){var e=t<=20?1:.75;return Math.max(2,Math.round(t*e))},br=function(t){function e(e){var n=t.call(this,e)||this;n.config=e,n.config.guide=Jt(n.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),n.config.guide.x=n.config.guide.x||{},n.config.guide.x=Jt(n.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.x.label&&(n.config.guide.x.label={text:n.config.guide.x.label}),n.config.guide.x.label=Jt(n.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),n.config.guide.y=n.config.guide.y||{},n.config.guide.y=Jt(n.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof n.config.guide.y.label&&(n.config.guide.y.label={text:n.config.guide.y.label}),n.config.guide.y.label=Jt(n.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var r=n.config,i=r.guide;if("extract-axes"===i.autoLayout){var a=r.options.containerHeight-(r.options.top+r.options.height);i.x.hide=i.x.hide||Math.floor(a)>0,i.y.hide=i.y.hide||Math.floor(r.options.left)>0}var o=n.config.options,s=n.config.guide.padding;return n.L=o.left+s.l,n.T=o.top+s.t,n.W=o.width-(s.l+s.r),n.H=o.height-(s.t+s.b),n}return mr(e,t),e.prototype.defineGrammarModel=function(t){var e=this.W,n=this.H;return this.xScale=t("pos",this.config.x,[0,e]),this.yScale=t("pos",this.config.y,function(t){return["ordinal","period"].indexOf(t.type)>=0?[0,n]:[n,0]}),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:function(){return e/2},yi:function(){return n/2},sizeX:function(){return e},sizeY:function(){return n}}},e.prototype.getGrammarRules=function(){return[function(t){var e=t.scaleX,n=t.scaleY;return{xi:function(n){return n?e(n[e.dim]):t.xi(n)},yi:function(e){return e?n(e[n.dim]):t.yi(e)},sizeX:function(n){return n?e.stepSize(n[e.dim]):t.sizeX(n)},sizeY:function(e){return e?n.stepSize(e[n.dim]):t.sizeY(e)}}}]},e.prototype.createScreenModel=function(t){return t},e.prototype.allocateRect=function(t){var e=this,n=this.screenModel;return{slot:function(t){return e.config.options.container.selectAll(".uid_"+t)},left:n.xi(t)-n.sizeX(t)/2,top:n.yi(t)-n.sizeY(t)/2,width:n.sizeX(t),height:n.sizeY(t),containerWidth:this.W,containerHeight:this.H}},e.prototype.drawFrames=function(t){var e=Object.assign({},this.config),n=e.options,r=this.W,i=this.H;if(e.x=this.xScale,e.y=this.yScale,e.x.scaleObj=this.xScale,e.y.scaleObj=this.yScale,e.x.guide=e.guide.x,e.y.guide=e.guide.y,e.x.guide.label.size=r,e.y.guide.label.size=i,(n.container.attr("transform")?et(n.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):n.container).attr("transform",Oe(this.L,this.T)),e.x.guide.hide)this._removeDimAxis(n.container,e.x);else{var a="top"===e.x.guide.scaleOrient?[0,0-e.guide.x.padding]:[0,i+e.guide.x.padding];this._drawDimAxis(n.container,e.x,a,r)}if(e.y.guide.hide)this._removeDimAxis(n.container,e.y);else{var o="right"===e.y.guide.scaleOrient?[r+e.guide.y.padding,0]:[0-e.guide.y.padding,0];this._drawDimAxis(n.container,e.y,o,i)}var s=t.reduce(function(t,e){return t.concat((e.units||[]).map(function(t){return t.uid}))},[]),u=this._drawGrid(n.container,e,r,i,n),l=st(u,".cell").data(s,function(t){return t});l.enter().append("g").attr("class",function(t){return Ue+"cell cell uid_"+t}).merge(l).classed("tau-active",!0),et(l,this.config.guide.animationSpeed).attr("opacity",1),et(l.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()},e.prototype._drawDimAxis=function(t,e,n,r){var i=wn.get(e.guide.tickFormat,e.guide.tickFormatNullAlias),o=function(t){return pr(t)}({scale:e.scaleObj,scaleGuide:e.guide,ticksCount:i?vr(r/e.guide.density):null,tickFormat:i||null,position:n}),s=this.config.guide.animationSpeed;yr(t,this._getAxisSelector(e)).classed("tau-active",!0).classed(e.guide.cssClass,!0).call(function(t){var e=et(t,s,"axisTransition"),r=t.attr("transform");Oe.apply(a,n)!==r&&(r?e:t).attr("transform",Oe.apply(a,n)),e.call(o),e.attr("opacity",1)})},e.prototype._removeDimAxis=function(t,e){var n=st(t,this._getAxisSelector(e)).classed("tau-active",!1);et(n,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()},e.prototype._getAxisSelector=function(t){return"g."+("h"===Ne(t.guide.scaleOrient)?"x":"y")+".axis"},e.prototype._drawGrid=function(t,e,n,r){var i=this;return yr(t,"g.grid").attr("transform",Oe(0,0)).call(function(t){var a=t,o=i.config.guide.animationSpeed,s=(e.guide.showGridLines||"").toLowerCase();if(s.length>0){var u=yr(a,"g.grid-lines");if(s.indexOf("x")>-1){var l=e.x,c=wn.get(l.guide.tickFormat),f=gr({scale:l.scaleObj,scaleGuide:l.guide,tickSize:r,ticksCount:c?vr(n/l.guide.density):null}),d=yr(u,"g.grid-lines-x");et(d,o).call(f)}if(s.indexOf("y")>-1){var h=e.y,p=(c=wn.get(h.guide.tickFormat),gr({scale:h.scaleObj,scaleGuide:h.guide,tickSize:-n,ticksCount:c?vr(r/h.guide.density):null})),g=yr(u,"g.grid-lines-y");et(g,o).call(p)}}})},e}(g),xr=n(11),_r=n(8),wr=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Er=function(){return(Er=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n})}else{var a=n[t].map(r[t].invert);e=[a[0],a[1]]}return{dim:r[t].dim,func:r[t].discrete?"inset":"between",args:e}});e.fire("brush",s)}};return t.selectAll(".brush").remove(),t.append("g").attr("class","brush").each(function(t){var e=r[t].range();i[t]=Sr.brushY().extent([[0,e[0]],[16,e[1]]]).on("start",s).on("brush",l).on("end",u),Sr.select(this).classed("brush-"+Rt(t),!0).call(i[t]),a=!1,i[t].move(Sr.select(this),e),a=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),t},e.prototype._forceBrushing=function(t){void 0===t&&(t={});var e=this.columnsBrushes,n=this.columnsScalesMap;this.columnsSelections;Object.keys(t).filter(function(r){return e[r]&&n[r]&&t[r]}).forEach(function(r){var i=t[r],a=[];if(n[r].discrete){var o=i.map(n[r]).filter(function(t){return t>=0}),s=n[r].stepSize()/2;a=[Math.min.apply(Math,o)-s,Math.max.apply(Math,o)+s]}else a=[i[0],i[1]];var u=Rt(r);e[r](Sr.select(".brush-"+u)),e[r].move(Sr.select(".brush-"+u),a.map(n[r]))})},e}(g),Tr=n(12);var Cr=n(4),Ar=function(){var t,e=[],n=[],r=1,i=1,a={},o=!1,s=function(t){var r=e.length,i=0,a=e[t].x-n[t].x,o=n[t].y-e[t].y,s=Math.sqrt(a*a+o*o);s>0&&(i+=.2*s),o/=s,i+=(a/=s)>0&&o>0?0:a<0&&o>0?3:a<0&&o<0?6:9;for(var u,l,f,d,h=e[t].x,p=e[t].y-e[t].height+2,g=e[t].x+e[t].width,m=e[t].y+2,y=0;yr&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var d=(o?t(l,e,n):s(l))-u;Math.random()r&&(e[l].x=c),e[l].x<0&&(e[l].x=c),e[l].y>i&&(e[l].y=f),e[l].y<0&&(e[l].y=f);var y=(o?t(l,e,n):s(l))-u;Math.random()1||l<0||l>1)},f=function(t,e,n){return t-e/n};return a.start=function(t){for(var n=e.length,r=1,i=0;i=200&&n.status<300){var t=n.responseText;try{e(null,JSON.parse(t))}catch(t){e(t,null)}}else e(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){e(t.error,null)},n.open("GET",t,!0),n.send(null)}(n.sourcemap,function(n,r){if(n)throw n;e._drawMap(t,r)}):this._drawMap(t,n.sourcemap)},e.prototype._calcLabels=function(t,e,n){var r=this.W,i=this.H,a={};return e.forEach(function(e){var o=(Cr.feature(t,t.objects[e]).features||[]).map(function(t){var i=t.properties||{},a=n.centroid(t),o=n.bounds(t),s=a[0],u=a[1],l=o[1][0]-o[0][0],c=i.name||"",f=i.abbr||c,d=l<5.5*c.length?f:c,h=l<13.75,p=h?r-s-16.5:0;return{id:e+"-"+t.id,sx:s,sy:u,x:s+p,y:u,width:5.5*d.length,height:10,name:d,r:p,isRef:h}}).filter(function(t){return!Number.isNaN(t.x)&&!Number.isNaN(t.y)}),s=o.map(function(t){return{x:t.sx,y:t.sy,r:t.r}});Ar().label(o).anchor(s).width(r).height(i).start(10),o.filter(function(t){return!t.isRef}).map(function(t){return t.x=t.sx,t.y=t.sy,t}).reduce(function(t,e){return t[e.id]=e,t},a);var u=o.filter(function(t){return t.isRef});u.length<6&&u.reduce(function(t,e){return t[e.id]=e,t},a)}),a},e.prototype._drawMap=function(t,e){var n,r,i=this,a=this,s=this.config.guide,u=this.config.options,l=this.config.options.container,c=this.latScale,f=this.lonScale,d=this.sizeScale,h=this.colorScale,p=this.codeScale,g=this.fillScale,m=this.W,y=this.H,v=Nr.filter(function(t){return(e.objects||{}).hasOwnProperty(t)});if(0===v.length)throw new Error("Invalid map: should contain some contours");if(g.dim){if(!p.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===v.indexOf(p.georole))throw console.log('There is no contour for georole "'+p.georole+'"'),console.log("Available contours are: "+v.join(" | ")),new Error("Invalid [georole]");n=p.georole}else n=v[v.length-1];if(this.contourToFill=n,c.dim&&f.dim){var b=Pr.extent(c.domain()),x=Pr.extent(f.domain());r=[(x[1]+x[0])/2,(b[1]+b[0])/2]}var _=this._createProjection(e,v[0],r),w=Pr.geoPath().projection(_),E=l.selectAll(".map-container").data([""+m+y+r+v.join("-")],function(t){return t});E.exit().remove();var S=E.enter().append("g").call(function(t){var n=t;n.attr("class","map-container");var r={},i=v.reduceRight(function(t,e){return t.concat(e)},[]);if(s.showNames&&(r=a._calcLabels(e,i,w)),i.forEach(function(t,i){var a=function(e){return r[t+"-"+e.id]};n.selectAll(".map-contour-"+t).data(Cr.feature(e,e.objects[t]).features||[]).enter().append("g").call(function(e){var n=e;n.attr("class","map-contour-"+t+" map-contour-level map-contour-level-"+i).attr("fill","none"),n.append("title").text(function(t){return(t.properties||{}).name}),n.append("path").attr("d",w),n.append("text").attr("class","place-label-"+t).attr("transform",function(t){var e=a(t);return e?"translate("+[e.x,e.y]+")":""}).text(function(t){var e=a(t);return e?e.name:""}),n.append("line").attr("class","place-label-link-"+t).attr("stroke","gray").attr("stroke-width",.25).attr("x1",function(t){var e=a(t);return e&&e.isRef?e.sx:0}).attr("y1",function(t){var e=a(t);return e&&e.isRef?e.sy:0}).attr("x2",function(t){var e=a(t);return e&&e.isRef?e.x-.6*e.name.length*5.5:0}).attr("y2",function(t){var e=a(t);return e&&e.isRef?e.y-3.5:0})})}),e.objects.hasOwnProperty("places")){var o=Cr.feature(e,e.objects.places),u=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0]+3.5,y:e[1]+3.5,width:5.5*t.properties.name.length,height:12,name:t.properties.name}}),l=o.features.map(function(t){var e=_(t.geometry.coordinates);return{x:e[0],y:e[1],r:2.5}});Ar().label(u).anchor(l).width(m).height(y).start(100),n.selectAll(".place").data(l).enter().append("circle").attr("class","place").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).attr("r",function(t){return t.r+"px"}),n.selectAll(".place-label").data(u).enter().append("text").attr("class","place-label").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).text(function(t){return t.name})}}).merge(E);this.groupByCode=t.reduce(function(t,e){return e.part().reduce(function(t,e){return t[(e[p.dim]||"").toLowerCase()]=e,t},t)},{});var M=this._resolveFeature.bind(this);if(S.selectAll(".map-contour-"+n).data(Cr.feature(e,e.objects[n]).features).call(function(t){t.classed("map-contour",!0).attr("fill",function(t){var e=M(t);return null===e?s.defaultFill:g(e[g.dim])})}).on("mouseover",function(t){return i.fire("area-mouseover",{data:M(t),event:o.event})}).on("mouseout",function(t){return i.fire("area-mouseout",{data:M(t),event:o.event})}).on("click",function(t){return i.fire("area-click",{data:M(t),event:o.event})}),!c.dim||!f.dim)return[];var T=function(t){return t.attr("r",function(t){return d(t[d.dim])}).attr("transform",function(t){var e=t.data;return"translate("+_([e[f.dim],e[c.dim]])+")"}).attr("class",function(t){var e=t.data;return h(e[h.dim])}).attr("opacity",.5).on("mouseover",function(t){var e=t.data;return a.fire("point-mouseover",{data:e,event:o.event})}).on("mouseout",function(t){var e=t.data;return a.fire("point-mouseout",{data:e,event:o.event})}).on("click",function(t){var e=t.data;return a.fire("point-click",{data:e,event:o.event})})},C=S.selectAll(".frame").data(t.map(function(t){return{tags:t.key||{},hash:t.hash(),data:t.part()}}),function(t){return t.hash});return C.exit().remove(),C.enter().append("g").merge(C).call(function(t){t.attr("class",function(t){return"frame frame-"+t.hash}).call(function(t){var e=t.selectAll("circle").data(function(t){return t.data.map(function(t){return{data:t,uid:u.uid}})});e.exit().remove(),e.call(T),e.enter().append("circle").call(T)})}),[]},e.prototype._resolveFeature=function(t){var e,n=this.groupByCode,r=t.properties,i=["c1","c2","c3","abbr","name"].filter(function(t){return r.hasOwnProperty(t)&&r[t]&&n.hasOwnProperty(r[t].toLowerCase())});if(0===i.length)e=null;else if(i.length>0){var a=r[i[0]].toLowerCase();e=n[a]}return e},e.prototype._highlightArea=function(t){var e=this,n=this.config.options.container,r=this.contourToFill;n.selectAll(".map-contour-"+r).classed("map-contour-highlighted",function(n){return t(e._resolveFeature(n))})},e.prototype._highlightPoint=function(t){this.config.options.container.selectAll("circle").classed("map-point-highlighted",function(e){var n=e.data;return t(n)}).attr("opacity",function(e){var n=e.data;return t(n)?.5:.1})},e.prototype._createProjection=function(t,e,n){var r=this.W,i=this.H,a=this.config.guide,o=100,s=[r/2,i/2],u=n||t.center,l=a.projection||t.projection||"mercator",c=this._createD3Projection(l,u,o,s),f=Pr.geoPath().projection(c).bounds(Cr.feature(t,t.objects[e])),d=o*r/(f[1][0]-f[0][0]),h=o*i/(f[1][1]-f[0][1]);return o=d=0},Vr=function(t,e){return!t.discrete&&e[t.dim]<0},Hr=function(t,e){return t.w(e)/2+Math.floor(t.model.size(e)/zr(t,e))},Wr=function(t,e){return t.h(e)/2+Math.floor(t.model.size(e)/zr(t,e))},Gr=function(t){return function(e){return{dx:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dx(n);if("-"===t[2]&&!Vr(r,n))return e.dx(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dx(n)+i*a*e.model.size(n)/2+i*Hr(e,n)}}}},Ur=function(t){return function(e){return{dy:function(n){var r=e.model.scaleY;if("+"===t[2]&&!Br(r,n))return e.dy(n);if("-"===t[2]&&!Vr(r,n))return e.dy(n);var i=t[1],a=t[0]===t[0].toUpperCase()?1:0;return e.dy(n)+i*a*e.model.size(n)/2+i*Wr(e,n)}}}};Ir.regRule("l",Gr(["l",-1,null])).regRule("L",Gr(["L",-1,null])).regRule("l+",Gr(["l",-1,"+"])).regRule("l-",Gr(["l",-1,"-"])).regRule("L+",Gr(["L",-1,"+"])).regRule("L-",Gr(["L",-1,"-"])).regRule("r",Gr(["r",1,null])).regRule("R",Gr(["R",1,null])).regRule("r+",Gr(["r",1,"+"])).regRule("r-",Gr(["r",1,"-"])).regRule("R+",Gr(["R",1,"+"])).regRule("R-",Gr(["R",1,"-"])).regRule("t",Ur(["t",-1,null])).regRule("T",Ur(["T",-1,null])).regRule("t+",Ur(["t",-1,"+"])).regRule("t-",Ur(["t",-1,"-"])).regRule("T+",Ur(["T",-1,"+"])).regRule("T-",Ur(["T",-1,"-"])).regRule("b",Ur(["b",1,null])).regRule("B",Ur(["B",1,null])).regRule("b+",Ur(["b",1,"+"])).regRule("b-",Ur(["b",1,"-"])).regRule("B+",Ur(["B",1,"+"])).regRule("B-",Ur(["B",1,"-"])).regRule("rotate-on-size-overflow",function(t,e){var n=e.data,r=e.lineBreakAvailable,i={};if(n.reduce(function(e,n){return e+(function(e){return t.model.size(e).5){var a=r?-.5:.5;i={angle:function(){return-90},w:function(e){return t.h(e)},h:function(e){return t.w(e)},dx:function(e){return t.h(e)*a-2},dy:function(){return 0}}}return i}).regRule("hide-by-label-height-vertical",function(t){return{hide:function(e){var n,r;return 0===t.angle(e)?(r=t.h(e),n=Math.abs(t.model.y0(e)-t.model.yi(e))):(r=t.w(e),n=t.model.size(e)),r>n||t.hide(e)}}}).regRule("cut-label-vertical",function(t){return{h:function(e){var n=t.h(e);if(Math.abs(t.angle(e))>0){var r=Math.abs(t.model.y0(e)-t.model.yi(e));return r0){var i=t.model.y0(e)=0?1:-1}(t,n)*e(t,n)};return t.model.flip?{dx:n}:{dy:n}}).regRule("inside-start-then-outside-end-horizontal",function(t,e){var n=[Ir.getRule("from-beginning"),Ir.getRule("towards"),Ir.getRule("cut-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Ir.getRule("to-end"),Ir.getRule("towards"),Ir.getRule("cut-outer-label-horizontal")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("inside-start-then-outside-end-vertical",function(t,e){var n=[Ir.getRule("from-beginning"),Ir.getRule("towards"),Ir.getRule("cut-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=[Ir.getRule("to-end"),Ir.getRule("towards"),Ir.getRule("cut-outer-label-vertical")].reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return n.label(t).length>=r.label(t).length}(t)?n:r)[e](t)},t},{}))}).regRule("outside-then-inside-horizontal",function(t,e){var n=["r+","l-","cut-outer-label-horizontal"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["x","dx","hide","label"].reduce(function(t,e){return t[e]=function(t){return(function(t){return r.label(t).length>n.label(t).length}(t)?r:n)[e](t)},t},{}))}).regRule("outside-then-inside-vertical",function(t,e){var n=["t+","b-","cut-outer-label-vertical"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(Ir.getRule).reduce(function(t,n){return Fr.compose(t,n(t,e))},t);return Object.assign({},n,["y","dy","hide","label"].reduce(function(t,i){return t[i]=function(t){return(function(t){var r=n.y(t,e)+n.dy(t,e);return r<=0||r>=e.maxHeight}(t)?r:n)[i](t,e)},t},{}))}).regRule("hide-by-label-height-horizontal",function(t){return{hide:function(e){return t.model.size(e)0)return r+s;var u=o-n;return u>0?r-u:r},dy:function(e){var n=t.dy(e),i=t.y(e)+n,a=t.h(e),o=i+a/2;if(0-(i-a/2)>0)return 0;var s=o-r;return s>0?n-s:n}}}).regRule("multiline-label-left-align",function(t){return{dy:function(e){var n=t.dy(e);return-90===t.angle(e)?n+t.h(e)/2:n}}}).regRule("multiline-label-vertical-center-align",function(t){return{dy:function(e){return t.dy(e)-t.h(e)/2}}}).regRule("multiline-hide-on-container-overflow",function(t,e){var n=e.maxWidth,r=e.maxHeight;return{hide:function(e){var i=t.angle(e),a=t.x(e)+t.dx(e),o=t.y(e)+t.dy(e);return!(!Gt(a,t.w(e),i,n)&&!Ut(o,t.h(e),i,r))||t.hide(e)}}});var Xr=function(){function t(t){this.minError=Number.MAX_VALUE,this.items=t.items,this.revision=this.items.map(function(t){return{i:t.i,x:t.x,y:t.y}}),this.penalties=t.penalties,this.transactor=t.transactor,this.cooling_schedule=t.cooling_schedule||function(t,e,n){return t-e/n}}return t.prototype.energy=function(t){return this.penalties.reduce(function(e,n){return e+n(t)},0)},t.prototype.move=function(t){var e=Math.floor(Math.random()*this.items.length),n=this.transactor(this.items[e]),r=this.energy(e);this.items[e]=n.modify();var i=this.energy(e),a=i-r,o=a<0?1:Math.exp(-a/t);Math.random()>=o?this.items[e]=n.revert():i0&&d.length>0?this.autoPosition(c,d):c;var h=f.reduce(function(t,e){var n;return Object.assign(t,((n={})[e]=!0,n))},{});c.text=c.text=h["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(c.text,u):c.text,c.text=c.text=h["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(c.text,u):c.text,c.text=h["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(c.text,c.edges):c.text,c.text=h["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(c.text):c.text,c.text=h["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(c.text):c.text;var p=c.text,g=function(t){return function(e,n){return p[n][t]}},m=g("x"),y=g("y"),v=g("angle"),b=g("color"),x=g("label"),_=function(t){if(t.style("fill",b).style("font-size",e.guide.fontSize+"px").style("display",function(t,e){return p[e].hide?"none":null}).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",function(t,e){return"translate("+m(t,e)+","+y(t,e)+") rotate("+v(t,e)+")"}),i){t.each(function(t,e){var n=o.select(this),r=v(t,e);n.text(null),x(t,e).split(a).forEach(function(t,e){n.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(e+1)+"em").text(t)})})}else t.text(x)};r.hideEqualLabels&&p.filter(function(t){return!t.hide}).filter(function(t,e,n){return e0&&(t.hide=!0)}),t},t.prototype.hideOnLabelLabelOverlap=function(t){var e=this,n={min:0,max:1,norm:2},r={"min/min":function(t,e){return e.y-t.y},"max/max":function(t,e){return t.y-e.y},"min/max":function(){return-1},"min/norm":function(){return-1},"max/norm":function(){return-1},"norm/norm":function(t,e){return t.y-e.y}};return t.filter(function(t){return!t.hide}).sort(function(t,e){return n[t.extr]-n[e.extr]}).forEach(function(i){t.forEach(function(t){i.i!==t.i&&function(t,i){var a=e.getLabelRect(t),o=e.getLabelRect(i),s=Number(!t.hide&&!i.hide);if(s*Math.max(0,Math.min(o.x1,a.x1)-Math.max(a.x0,o.x0))*(s*Math.max(0,Math.min(o.y1,a.y1)-Math.max(a.y0,o.y0)))>0){var u=[t,i];u.sort(function(t,e){return n[t.extr]-n[e.extr]}),(r[u[0].extr+"/"+u[1].extr](u[0],u[1])<0?u[0]:u[1]).hide=!0}}(i,t)})}),t},t.prototype.getLabelRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.w/2-e,x1:t.x+t.w/2+e,y0:t.y-t.h/2-e,y1:t.y+t.h/2+e}},t.prototype.getPointRect=function(t,e){return void 0===e&&(e=0),{x0:t.x-t.size/2-e,x1:t.x+t.size/2+e,y0:t.y-t.size/2-e,y1:t.y+t.size/2+e}},t.prototype.hideOnLabelAnchorOverlap=function(t){var e=this,n=function(t,n){var r=e.getLabelRect(t,2),i=e.getPointRect(n,2);return Math.max(0,Math.min(i.x1,r.x1)-Math.max(i.x0,r.x0))*Math.max(0,Math.min(i.y1,r.y1)-Math.max(i.y0,r.y0))>.001};return t.filter(function(t){return!t.hide}).forEach(function(e){for(var r=t.length,i=0;ir.right+u||sr.bottom+u)return null;var l=(i.find(o,s)||[]).map(function(t){var e=Math.sqrt(Math.pow(o-t.x,2)+Math.pow(s-t.y,2));if(e>u)return null;var n=ee.size)+" 1",n.left[0].x+","+n.left[0].y,"Z"].join(" "):ui(t.size>e.size?t:e)}function ci(t,e,n,r){var i=function(t,e,n,r){var i=hi(t,r);if(0===i||i+t.size/2<=r.size/2||i+r.size/2<=t.size/2)return null;var a=function(i){var a=i?[r,n,e,t]:[t,e,n,r],o=gi.apply(void 0,[1/12*2].concat(a)),s=gi.apply(void 0,[.5].concat(o.slice(0,4))),u=s[3],l=s[6],c=yi(a[0],u),f=yi(u,l),d=[c.left[0],A(.5,c.left[1],f.left[0]),f.left[1]],h=[c.right[0],A(.5,c.right[1],f.right[0]),f.right[1]],p=mi.apply(void 0,d)[1],g=mi.apply(void 0,h)[1],m=A(4,c.left[0],p),y=A(4,c.right[0],g);return{left:i?[y,h[0]]:[d[0],m],right:i?[m,d[0]]:[h[0],y]}},o=a(!1),s=a(!0);return{left:o.left.concat(s.left),right:o.right.concat(s.right)}}(t,e,n,r);if(!i)return li(t,r);var a=di(fi(t,i.right[0]),fi(t,i.left[0])),o=di(fi(r,i.right[1]),fi(r,i.left[1]));return["M"+i.left[0].x+","+i.left[0].y,"C"+i.left[1].x+","+i.left[1].y,i.left[2].x+","+i.left[2].y,i.left[3].x+","+i.left[3].y,"A"+r.size/2+","+r.size/2+" 0 "+Number(a>Math.PI)+" 1",i.right[3].x+","+i.right[3].y,"C"+i.right[2].x+","+i.right[2].y,i.right[1].x+","+i.right[1].y,i.right[0].x+","+i.right[0].y,"A"+t.size/2+","+t.size/2+" 0 "+Number(o>Math.PI)+" 1",i.left[0].x+","+i.left[0].y,"Z"].join(" ")}function fi(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function di(t,e){return e1?[t]:[]},d);c.exit().remove(),c.call(s(n.animationSpeed,a.pathAttributesUpdateInit,a.pathAttributesUpdateDone,a.afterPathUpdate));c.enter().append(a.pathElement).call(s(n.animationSpeed,a.pathAttributesEnterInit,a.pathAttributesEnterDone,a.afterPathUpdate)).merge(c).call(function(t){e.guide.animationSpeed>0&&!document.hidden?(t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(0)}),et(t,e.guide.animationSpeed,"pathTransition").attrTween(a.pathTween.attr,a.pathTween.fn)):t.attr(a.pathTween.attr,function(t){return a.pathTween.fn.call(this,t)(1)})});if(t.subscribe(l),"never"!==n.showAnchors){var f=function(t,e,n){var r=e.anchorShape,i=t.config.guide,a=t.screenModel,o=vi({},bi[r].getInitialAttrs(t,e),{opacity:"hover"===i.showAnchors?0:1,fill:function(t){return a.color(t)},class:"i-data-anchor"}),s=n.selectAll(".i-data-anchor").data(function(t){return t.filter(ii)},a.id);return s.exit().remove(),s.call(ot(i.animationSpeed,null,o)),s.enter().append(bi[e.anchorShape].element).call(ot(i.animationSpeed,{r:0},o)).merge(s)}(t,a,r);t.subscribe(f)}},l=i.toFibers(),c=l.map(function(t){return t.filter(ii)}),f=r.container.selectAll(".frame"),d=function(){var t=f.empty()?[]:f.data(),e=new Map;f.each(function(t){e.set(t,Number(this.getAttribute("data-id")))});var n=t.reduce(function(t,e){return t.set(e,e.map(i.id)),t},new Map),r=new Map,a=Math.max.apply(Math,[0].concat(Array.from(e.values())));return function(t){if(r.has(t))return r.get(t);var o,s=t.map(function(t){return i.id(t)}),u=(Array.from(n.entries()).find(function(t){var e=t[1];return s.some(function(t){return e.some(function(e){return e===t})})})||[null])[0];return o=u?e.get(u):++a,r.set(t,o),o}}();this._getDataSetId=d;var h=f.data(l,d);h.exit().remove(),h.call(u),h.enter().append("g").attr("data-id",d).call(u),h.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),t.subscribe(new Jr(i.model,e.flip,e.guide.label,r).draw(c))},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=o.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n)}}).filter(function(t){return!isNaN(t.x)&&!isNaN(t.y)}),i=r.reduce(function(t,e){var n=e.x,r=e.y;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,t.top),t.bottom=Math.max(r,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=qt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.y===e}:function(e){return t.x===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t[0]];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=Fe(a.node()),u=this.node().config.guide.maxHighlightDistance;if(tr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){return Array.isArray(e)?e:t(l>e.middle?e.greater:e.lower)}(i).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return xi(t,e,c)},highlight:function(t){var e,n,r=this.node().config.options.container,i="tau-chart__highlighted",a="tau-chart__dimmed",o=r.selectAll(".i-role-path"),s=o.data().filter(function(e){return e.filter(ii).some(t)}),u=s.length>0;o.call(ct(((e={})[i]=function(t){return u&&s.indexOf(t)>=0},e[a]=function(t){return u&&s.indexOf(t)<0},e)));var l=((n={})[i]=function(e){return!0===t(e)},n[a]=function(e){return!1===t(e)},n);r.selectAll(".i-role-dot").call(ct(l)),r.selectAll(".i-role-label").call(ct(l)),this._sortElements(t)},highlightDataPoints:function(t){var e=this.node(),n=function(t,e,n){var r=e.anchorShape,i=t.screenModel,a="hover"===t.config.guide.showAnchors;return t.config.options.container.selectAll(".i-data-anchor").call(lt(bi[r].getHighlightAttrs(t,e,n))).attr("opacity",a?function(t){return n(t)?1:0}:function(){return 1}).attr("fill",function(t){return i.color(t)}).attr("class",function(t){return Ae("i-data-anchor",i.class(t))}).classed(Ue+"highlighted",n)}(e,this.domElementModel,t),r=e.config.options.container,i=e.config.flip,a=n.filter(t),o=r.select(".cursor-line");if(a.empty())o.remove();else{o.empty()&&(o=r.append("line"));var s=e.screenModel.model,u=s.xi(a.data()[0]),l=s.xi(a.data()[0]),c=s.scaleY.domain(),f=s.scaleY(c[0]),d=s.scaleY(c[1]);o.attr("class","cursor-line").attr("x1",i?f:u).attr("y1",i?u:f).attr("x2",i?d:l).attr("y2",i?l:d)}this._sortElements(t)},_sortElements:function(t){var e=this.node().config.options.container,n=new Map,r=new Map,i=this._getDataSetId;e.selectAll(".i-role-path").each(function(e){n.set(this,i(e)),r.set(this,e.filter(ii).some(t))});var a=te(function(t,e){return r.get(t)-r.get(e)},function(t,e){return n.get(t)-n.get(e)}),o={line:0,g:1,text:2};Ce(e.node(),function(t,e){return"g"===t.tagName&&"g"===e.tagName?a(t,e):o[t.tagName]-o[e.tagName]})}},Ei=[1,2,3,4,5],Si=Ei.map(function(t){return Ue+"line-opacity-"+t}),Mi=Ei.map(function(t){return Ue+"line-width-"+t});function Ti(t){return Si[t-1]||Si[4]}function Ci(t,e){return t.length<2?"":String.prototype.concat.apply("",t.concat(e.slice().reverse()).map(function(t,e){return(0===e?"":" ")+t.x+","+t.y}))}function Ai(t,e){if(t.length<2)return"";var n=function(t){var e=t.map(function(t,e){return""+((e-1)%3==0?"C":"")+t.x+","+t.y+" "});return String.prototype.concat.apply("",e)};return"M"+n(t)+"L"+n(e.slice().reverse())+"Z"}var ki=function(){return(ki=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&(n=Oi.rgb(n).darker(1)),n}};e.pathAttributesEnterInit=a,e.pathAttributesUpdateDone=a;var o="polyline"===$(n.interpolate);return e.pathElement=o?"polygon":"path",e.anchorShape="vertical-stick",e.pathTween={attr:o?"points":"d",fn:ut(0,o?Ci:Ai,[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}},function(n){return{id:t.id(n),x:e.x0(n),y:e.y0(n)}}],t.id,n.interpolate)},e},_getBoundsInfo:function(t){if(0===t.length)return null;var e=this.node().screenModel,n=this.node().config.flip,r=t.map(function(t){var n=Oi.select(t).data()[0];return{node:t,data:n,x:e.x(n),y:e.y(n),y0:e.y0(n),group:e.group(n)}}),i=r.reduce(function(t,e){var n=e.x,r=e.y,i=e.y0;return t.left=Math.min(n,t.left),t.right=Math.max(n,t.right),t.top=Math.min(r,i,t.top),t.bottom=Math.max(r,i,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=qt(r.map(n?function(t){return t.y}:function(t){return t.x})).sort(function(t,e){return t-e}),o=a.reduce(function(t,e){return t[e]=[],t},{});if(r.forEach(function(t){var e=a.find(n?function(e){return t.y===e}:function(e){return t.x===e});o[e].push(t)}),function(){var t=Object.keys(r.reduce(function(t,e){return t[e.group]=!0,t},{})),e=t.reduce(function(t,e,n){return t[e]=n,t},{});a.forEach(function(n){var r=o[n];if(r.sort(function(t,n){return e[t.group]-e[n.group]}),r.lengthr.right+s.x+u||er.bottom+s.y+u)return null;var l=o?e-s.y:t-s.x,c=function t(e){if(e.isLeaf)return e;var n=e.left.end;return t(l1&&(f=1);var d=function(){var t=c.items.start.reduce(function(t,e){return t[e.group]={start:e,end:null,y:null,y0:null},t},{});return c.items.end.forEach(function(e){void 0!==t[e.group]?t[e.group].end=e:delete t[e.group]}),Object.keys(t).forEach(function(e){var n=t[e];n.end?(n.y=n.start.y+f*(n.end.y-n.start.y),n.y0=n.start.y0+f*(n.end.y0-n.start.y0)):delete t[e]}),Object.keys(t).map(function(e){return t[e]}).map(function(t){return{y:t.y,y0:t.y0,el:f<.5?t.start:t.end}}).filter(function(t){return null!=t.el.data})}(),h=e-s.y,p=d.filter(function(t){return h>=t.y&&h<=t.y0}),g=(p.length>0?p:d).map(function(t){return t.el}).map(function(n){var r=n.x+s.x,i=n.y+s.y,a=Math.abs(o?e-i:t-r),u=Math.abs(o?t-r:e-i);return{node:n.node,data:n.data,distance:a,secondaryDistance:u,x:r,y:i}});return xi(t,e,g)}},Ni={draw:wi.draw,getClosestElement:wi.getClosestElement,highlight:wi.highlight,highlightDataPoints:wi.highlightDataPoints,addInteraction:wi.addInteraction,_getBoundsInfo:wi._getBoundsInfo,_sortElements:wi._sortElements,init:function(t){var e=wi.init(t);return e.transformRules=[e.flip&&S.get("flip")],e.adjustRules=[function(t,n){var r=t.scaleSize.isEmptyScale(),i=Jt(e.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},n,{defMin:i.defMinSize,defMax:i.defMaxSize,minLimit:i.minSize,maxLimit:i.maxSize});return S.get("adjustStaticSizeScale")(t,a)}],e},buildModel:function(t){var e=wi.baseModel(t),n=this.node().config.guide,r=Ti(t.model.scaleColor.domain().length),i=Ue+"area area i-role-path "+r+" "+n.cssClass+" ";e.groupAttributes={class:function(t){return i+" "+e.class(t[0])+" frame"}};var a={fill:function(t){return e.color(t[0])},stroke:function(t){return e.color(t[0])}};return e.pathAttributesEnterInit=a,e.pathAttributesUpdateDone=a,e.pathElement="polygon",e.anchorShape="circle",e.pathTween={attr:"points",fn:ut(0,function(t,e){return function(n){return n.map(function(n){return[t(n),e(n)].join(",")}).join(" ")}}(function(t){return t.x},function(t){return t.y}),[function(n){return{id:t.id(n),x:e.x(n),y:e.y(n)}}],t.id)},e}};function Li(t){if(t.length<2)return"";for(var e="",n=0;n=160&&t<320?e=1:t>=320&&t<480?e=2:t>=480&&t<640?e=3:t>=640&&(e=4),Mi[e]}(r.width):"",o=Ti(t.model.scaleColor.domain().length),s=i?"line":"area",u=""+Ue+s+" "+s+" i-role-path "+a+" "+o+" "+n.cssClass+" ",l=i?{stroke:function(t){return f.color(t[0])},class:"i-role-datum"}:{fill:function(t){return f.color(t[0])}},c="cubic"===$(n.interpolate)?i?Ri:si:i?Li:oi,f=wi.baseModel(t),d=i?function(e){return{id:t.id(e),x:f.x(e),y:f.y(e)}}:function(e){return{id:t.id(e),x:f.x(e),y:f.y(e),size:f.size(e)}};return f.groupAttributes={class:function(t){return u+" "+f.class(t[0])+" frame"}},f.pathElement="path",f.anchorShape="circle",f.pathAttributesEnterInit=l,f.pathAttributesUpdateDone=l,f.pathTween={attr:"d",fn:ut(0,c,[d],t.id,n.interpolate)},f}},Di=function(t){return o.select(t).data()[0]},Ii={init:function(t){var e=Object.assign({},t);e.guide=e.guide||{},e.guide=Jt(e.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=e.guide.enableColorToBarPosition?e.guide.enableColorToBarPosition:!e.stack}),e.guide.size=Jt(e.guide.size||{},{enableDistributeEvenly:!0}),e.guide.label=Jt(e.guide.label||{},{position:e.flip?e.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:e.stack?["rotate-on-size-overflow","t-","b+","hide-by-label-height-vertical","cut-label-vertical","auto:hide-on-label-label-overlap"]:["rotate-on-size-overflow","outside-then-inside-vertical","auto:hide-on-label-label-overlap"]});var n=e.guide.avoidScalesOverflow,r=e.guide.enableColorToBarPosition,i=e.guide.size.enableDistributeEvenly;return e.transformRules=[e.flip&&S.get("flip"),e.guide.obsoleteVerticalStackOrder&&S.get("obsoleteVerticalStackOrder"),e.stack&&S.get("stack"),r&&S.get("positioningByColor")].filter(function(t){return t}),e.adjustRules=[i&&function(t,n){var r=Jt(e.guide.size||{},{defMinSize:e.guide.prettify?3:0,defMaxSize:e.guide.prettify?40:Number.MAX_VALUE}),i=Object.assign({},n,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return S.get("size_distribute_evenly")(t,i)},n&&i&&function(t,e){var n=Object.assign({},e,{sizeDirection:"x"});return S.get("avoidScalesOverflow")(t,n)},e.stack&&S.get("adjustYScale")].filter(function(t){return t}),e},addInteraction:function(){var t=this,e=this.node();e.on("highlight",function(e,n){return t.highlight(n)}),e.on("data-hover",function(e,n){return t.highlight(function(t,e){return function(n){return n===t||e}}(n.data,null))})},draw:function(){var t,e,n=this.node(),r=n.config,i=r.options;i.container=i.slot(r.uid);var a=r.guide.prettify,s="i-role-element i-role-datum bar "+Ue+"bar",u=n.screenModel,l=this.buildModel(u,{prettify:a,minBarH:1,minBarW:1,baseCssClass:s}),c=ot,f=r.flip?"y":"x",d=r.flip?"x":"y",h=r.flip?"width":"height",p=r.flip?"height":"width",g=u.toFibers(),m=g.reduce(function(t,e){return t.concat(e)},[]),y=l.class,v=Qt(l,"class"),b=i.container.selectAll(".bar").data(m,u.id);b.exit().classed("tau-removing",!0).call(c(r.guide.animationSpeed,null,((t={})[f]=function(){var t=o.select(this);return t.attr(f)-0+(t.attr(p)-0)/2},t[d]=function(){return this.getAttribute("data-zero")},t[p]=0,t[h]=0,t),function(t){var e=o.select(t);e.classed("tau-removing")&&e.remove()})),b.call(c(r.guide.animationSpeed,null,v));var x=b.enter().append("rect").call(c(r.guide.animationSpeed,(e={},e[d]=u[d+"0"],e[h]=0,e),v)).merge(b).attr("class",y).attr("data-zero",u[d+"0"]);n.subscribe(new Jr(u.model,u.model.flip,r.guide.label,i).draw(g));var _=function(){var t=m.reduce(function(t,e,n){return t.set(e,n+1),t},new Map);return function(e,n){return(t.get(Di(e))||-1)-(t.get(Di(n))||-1)}}();this._barsSorter=r.guide.sortByBarHeight?r.flip?function(t,e){var n=Di(t),r=Di(e),i=l.width(n),a=l.width(r);if(i===a){var o=l.y(n),s=l.y(r);return o===s?_(t,e):o-s}return a-i}:function(t,e){var n=Di(t),r=Di(e),i=l.height(n),a=l.height(r);if(i===a){var o=l.x(n),s=l.x(r);return o===s?_(t,e):o-s}return a-i}:_;var w={rect:0,text:1};this._typeSorter=function(t,e){return w[t.tagName]-w[e.tagName]},this._sortElements(this._typeSorter,this._barsSorter),n.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel:function(t,e){var n,r=e.prettify,i=e.minBarH,a=e.minBarW,o=e.baseCssClass,s=function(e){var n=t.size(e);return r&&(n=Math.max(a,n)),n},u=function(e){return e[t.model.scaleY.dim]};if(t.flip){var l=function(e){return Math.abs(t.x(e)-t.x0(e))};n={y:function(e){return t.y(e)-.5*s(e)},x:function(e){var n=Math.min(t.x0(e),t.x(e));if(r){var a=l(e),o=u(e),s=0;return 0===o&&(s=0),o>0&&(s=a),o<0&&(s=0-i),a0?n-i:n);return n},width:function(t){return s(t)},height:function(t){var e=c(t);return r&&(e=0===u(t)?e:Math.max(i,e)),e}}}return Object.assign(n,{class:function(e){return o+" "+t.class(e)},fill:function(e){return t.color(e)}})},_sortElements:function(){for(var t=[],e=0;es}}),i=r.reduce(function(t,e){var n=e.box;return t.left=Math.min(n.left,t.left),t.right=Math.max(n.right,t.right),t.top=Math.min(n.top,t.top),t.bottom=Math.max(n.bottom,t.bottom),t},{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=qt(r.map(n?function(t){return t.cy}:function(t){return t.cx})).sort(function(t,e){return t-e}),s=a.reduce(function(t,e){return t[e]=[],t},{});r.forEach(function(t){var e=a.find(n?function(e){return t.cy===e}:function(e){return t.cx===e});s[e].push(t)});var u=function(t){if(1===t.length)return s[t];var e=Math.ceil(t.length/2);return{middle:(t[e-1]+t[e])/2,lower:u(t.slice(0,e)),greater:u(t.slice(e))}};return{bounds:i,tree:u(a)}},getClosestElement:function(t,e){if(!this._boundsInfo)return null;var n=this._boundsInfo,r=n.bounds,i=n.tree,a=this.node().config.options.container,o=this.node().config.flip,s=Fe(a.node()),u=t-s.x,l=e-s.y,c=this.node().config.guide.maxHighlightDistance;if(ur.right+c||lr.bottom+c)return null;var f=o?l:u,d=o?u:l;return function t(e){return Array.isArray(e)?e:t(f>e.middle?e.greater:e.lower)}(i).map(function(t){var e=o?t.box.left:t.box.top,n=o?t.box.right:t.box.bottom,r=function(t,e,n){return t>=e&&t<=n}(d,e,n);if(!r&&Math.abs(d-e)>c&&Math.abs(d-n)>c)return null;var i=Math.abs(d-(t.invert!==o?n:e));return Object.assign(t,{distToValue:i,cursorInside:r})}).filter(function(t){return t}).sort(function(t,e){return t.cursorInside!==e.cursorInside?e.cursorInside-t.cursorInside:Math.abs(t.distToValue)-Math.abs(e.distToValue)}).map(function(t){var e=t.cx,n=t.cy,r=Math.abs(o?l-n:u-e),i=Math.abs(o?u-e:l-n);return{node:t.node,data:t.data,distance:r,secondaryDistance:i,x:e,y:n}})[0]||null},highlight:function(t){var e,n=this.node().config.options.container,r=((e={})["tau-chart__highlighted"]=function(e){return!0===t(e)},e["tau-chart__dimmed"]=function(e){return!1===t(e)},e);n.selectAll(".bar").call(ct(r)),n.selectAll(".i-role-label").call(ct(r)),this._sortElements(function(e,n){return t(Di(e))-t(Di(n))},this._typeSorter,this._barsSorter)}},ji=n(14),zi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bi=function(t){function e(e){var n=t.call(this,e)||this;return n.config=e,n.config.guide=Jt(n.config.guide||{},{}),n.on("highlight",function(t,e){return n.highlight(e)}),n}return zi(e,t),e.prototype.defineGrammarModel=function(t){var e=this.config,n=e.options;this.color=t("color",e.color,{}),this.scalesMap=e.columns.reduce(function(e,r){return e[r]=t("pos",r,[0,n.height]),e},{});var r=n.width/(e.columns.length-1),i=e.columns.reduce(function(t,e,n){return t[e]=n*r,t},{});return this.xBase=function(t){return i[t]},this.regScale("columns",this.scalesMap).regScale("color",this.color),{}},e.prototype.drawFrames=function(t){var e=this.config,n=this.config.options,r=this.scalesMap,i=this.xBase,a=this.color,o=ji.line(),s=function(t){t.attr("d",function(t){return o(e.columns.map(function(e){return[i(e),r[e](t[r[e].dim])]}))})},u=function(t){t.attr("stroke",function(t){return a.toColor(a(t[a.dim]))}),t.attr("class",function(t){return Ue+"__line line "+a.toClass(a(t[a.dim]))+" foreground"})},l=function(t){var e=t.selectAll(".background").data(function(t){return t.part()});e.exit().remove(),e.call(s),e.enter().append("path").attr("class","background line").call(s);var n=t.selectAll(".foreground").data(function(t){return t.part()});n.exit().remove(),n.call(function(t){s(t),u(t)}),n.enter().append("path").call(function(t){s(t),u(t)})},c=n.container.selectAll(".lines-frame").data(t,function(t){return t.hash()});c.exit().remove(),c.call(l),c.enter().append("g").attr("class","lines-frame").call(l),this.subscribe(n.container.selectAll(".lines-frame .foreground"))},e.prototype.highlight=function(t){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",function(e){return t(e)?"":"hidden"})},e}(g),Vi=function(){function t(t,e){var n,r=this;if(this._fields={},Array.isArray(e.fitToFrameByDims)&&e.fitToFrameByDims.length){n=t.part(function(t){var n={};return"where"===t.type&&t.args?(n.type=t.type,n.args=e.fitToFrameByDims.reduce(function(e,n){return t.args.hasOwnProperty(n)&&(e[n]=t.args[n]),e},{})):n=t,n})}else n=t.full();var i=this.getVarSet(n,e);e.order&&(i=$t(Kt(e.order,i),i)),this.vars=i;var a=i.map(function(t){return t});this.scaleConfig=e,this.scaleConfig.nice=this.scaleConfig.hasOwnProperty("nice")?this.scaleConfig.nice:this.scaleConfig.autoScale,this.addField("dim",this.scaleConfig.dim).addField("scaleDim",this.scaleConfig.dim).addField("scaleType",this.scaleConfig.type).addField("source",this.scaleConfig.source).addField("domain",function(){return r.vars}).addField("isInteger",a.every(Number.isInteger)).addField("originalSeries",function(){return a}).addField("isContains",function(t){return r.isInDomain(t)}).addField("isEmptyScale",function(){return r.isEmpty()}).addField("fixup",function(t){var e=r.scaleConfig;e.__fixup__=e.__fixup__||{},e.__fixup__=Object.assign(e.__fixup__,t(Object.assign({},e,e.__fixup__)))}).addField("commit",function(){r.scaleConfig=Object.assign(r.scaleConfig,r.scaleConfig.__fixup__),delete r.scaleConfig.__fixup__})}return t.prototype.isInDomain=function(t){return this.domain().indexOf(t)>=0},t.prototype.addField=function(t,e){return this._fields[t]=e,this[t]=e,this},t.prototype.getField=function(t){return this._fields[t]},t.prototype.isEmpty=function(){return!Boolean(this._fields.dim)},t.prototype.toBaseScale=function(t,e){var n=this;void 0===e&&(e=null);var r=Object.keys(this._fields).reduce(function(t,e){return t[e]=n._fields[e],t},t);return r.getHash=function(){return function(t,e){return Rt([t,e].map(function(t){return JSON.stringify}).join(""))}(n.vars,e)},r.value=r,r},t.prototype.getVarSet=function(t,e){return qt(e.hasOwnProperty("series")?e.series:t.map(function(t){return t[e.dim]}),function(t){return"date"===t?function(t){return new Date(t).getTime()}:function(t){return t}}(e.dimType))},t}(),Hi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Wi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._references=n.references,r._refCounter=n.refCounter,r.addField("scaleType","identity"),r}return Hi(e,t),e.prototype.create=function(){var t=this._references,e=this._refCounter;return this.toBaseScale(function(n,r){if(null==n){var i=t.get(r);null==i&&(i=e(),t.set(r,i))}else i=n;return i})},e}(Vi),Gi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ui=function(){return(Ui=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0){var h=Math.max.apply(Math,s.map(Math.abs));s=[-h,h]}r.vars=s}return r.addField("scaleType","color").addField("discrete",i).addField("brewer",a).addField("toColor",zt).addField("toClass",Bt),r}return Gi(e,t),e.prototype.create=function(){var t=this.discrete,e=this.vars,n=this.getField("brewer"),r=t?this.createDiscreteScale(e,n):this.createContinuesScale(e,n);return this.toBaseScale(r)},e.prototype.createDiscreteScale=function(t,e){var n,r=function(t,e){var n=t.map(function(t){return String(t).toString()});return Xi.scaleOrdinal().range(e).domain(n)},i=function(t){return function(e){return t(String(e).toString())}};if(Array.isArray(e))n=i(r(t,e));else if("function"==typeof e)n=function(n){return e(n,i(r(t,Wt(20).map(function(t){return"color20-"+(1+t)}))))};else{if(!kt(e))throw new Error("This brewer is not supported");n=function(t,e){var n=Object.keys(t),r=n.map(function(e){return t[e]}),i=Xi.scaleOrdinal().range(r).domain(n);return function(n){return t.hasOwnProperty(n)?i(String(n)):e(n)}}(e,function(){return"color-default"})}return n},e.prototype.createContinuesScale=function(t,e){if(!Array.isArray(e))throw new Error("This brewer is not supported");return Xi.scaleLinear().domain(jt(t.map(function(t){return t-0}),e.length)).range(e)},e}(Vi),Yi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),$i={sqrt:function(t){return Math.sqrt(t)},linear:function(t){return t}},Ki=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=r.scaleConfig,a=s.extent(r.vars),o=Number.isFinite(i.min)?i.min:a[0],u=Number.isFinite(i.max)?i.max:a[1];return r.vars=[Math.min.apply(Math,[o,a[0]].filter(Number.isFinite)),Math.max.apply(Math,[u,a[1]].filter(Number.isFinite))],r.addField("scaleType","size"),r.addField("funcType",n.func||"sqrt"),r}return Yi(e,t),e.prototype.isInDomain=function(t){var e=this.domain().sort(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(){var t,e=this.scaleConfig,n=this.vars,r=Jt({},e,{func:"sqrt",minSize:0,maxSize:1}),i=r.func,a=r.minSize,o=r.maxSize,s=$i[i],u=n.filter(function(t){return Number.isFinite(Number(t))});if(0===u.length)t=function(){return o};else{var l,c,f=Math.min.apply(Math,u),d=Math.max.apply(Math,u),h=s(Math.max(Math.abs(f),Math.abs(d),d-f));c=f<0?f:0,l=0===h?1:(o-a)/h,t=function(t){var e=null!==t?parseFloat(t):0;return Number.isFinite(e)?a+s(e-c)*l:o}}return this.toBaseScale(t)},e}(Vi),Ji=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qi=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","ordinal").addField("discrete",!0),r}return Ji(e,t),e.prototype.create=function(t){var e=this.scaleConfig,n=this.vars,r=u.scalePoint().domain(n).range(t).padding(.5),i=Math.max.apply(Math,t),a=function(t){return"function"==typeof e.ratio?e.ratio(t,i,n):"object"==typeof e.ratio?e.ratio[t]:1/n.length},o=function(t){return e.ratio?i-n.slice(n.indexOf(t)+1).reduce(function(t,e){return t+i*a(e)},i*a(t)*.5):r(t)};return Object.keys(r).forEach(function(t){return o[t]=r[t]}),o.stepSize=function(t){return a(t)*i},this.toBaseScale(o,t)},e}(Vi),Zi=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ta=function(){return(ta=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0},e.prototype.create=function(t){var e=this.periodGenerator,n=this.vars,r=this.vars.map(function(t){return t.getTime()}),i=this.scaleConfig,a=ea.scalePoint().domain(n).range(t).padding(.5),o=ea.scalePoint().domain(r.map(String)).range(t).padding(.5),s=Math.max.apply(Math,t),u=function(t){var e=new Date(t).getTime();return"function"==typeof i.ratio?i.ratio(e,s,r):"object"==typeof i.ratio?i.ratio[e]:1/n.length},l=function(t){var n=new Date(t),a=(e?e.cast(n):n).getTime();return i.ratio?s-r.slice(r.indexOf(a)+1).reduce(function(t,e){return t+s*u(e)},s*u(t)*.5):o(String(a))};return Object.keys(a).forEach(function(t){return l[t]=a[t]}),l.stepSize=function(t){return u(t)*s},this.toBaseScale(l,t)},e}(Vi),ra=n(15),ia=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),aa=function(){return(aa=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=r},e.prototype.create=function(t){var e=this,n=this.vars,r=this.scaleConfig.utcTime,i=this.periodGenerator,a=(r?oa.scaleUtc:oa.scaleTime)().domain(n).range(t),o=function(t){var e=n[0],r=n[1];return t>r&&(t=r),t=i&&t<=a});return function(t,e,n){void 0===n&&(n=10);var r,i,a=Number(t[0]),o=Number(t[1]),s=Math.abs(o-a)/n,u=oa.bisector(function(t){return t.duration}).right(ca,s);if(u===ca.length)r=e?oa.utcYear:oa.timeYear,i=oa.tickStep(a/la.year.duration,o/la.year.duration,n);else if(u){var l=s/ca[u-1].duration,c=ca[u].duration/s,f=ca[lc&&(e=c),a(e)}}return Object.keys(a).forEach(function(t){return o[t]=a[t]}),o.stepSize=function(){return 0},this.toBaseScale(o,t)},e}(Vi);function ua(t){return oa["time"+t[0].toUpperCase()+t.slice(1)]}var la={second:{duration:1e3,interval:oa.timeSecond,utc:oa.utcSecond},minute:{duration:6e4,interval:oa.timeMinute,utc:oa.utcMinute},hour:{duration:36e5,interval:oa.timeHour,utc:oa.utcHour},day:{duration:864e5,interval:oa.timeDay,utc:oa.utcDay},week:{duration:6048e5,interval:oa.timeWeek,utc:oa.utcWeek},month:{duration:2592e6,interval:oa.timeMonth,utc:oa.utcMonth},year:{duration:31536e6,interval:oa.timeYear,utc:oa.utcYear}},ca=function(){var t=function(t,e){return{time:t,step:e,duration:e*t.duration}};return[t(la.second,1),t(la.second,5),t(la.second,15),t(la.second,30),t(la.minute,1),t(la.minute,5),t(la.minute,15),t(la.minute,30),t(la.hour,1),t(la.hour,3),t(la.hour,6),t(la.hour,12),t(la.day,1),t(la.day,2),t(la.week,1),t(la.month,1),t(la.month,3),t(la.year,1)]}();var fa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),da=function(){return(da=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(t){var e=this.vars,n=this.extendScale(ha.scaleLinear());return n.domain(e).range(t).clamp(!0),this.toBaseScale(n,t)},e.prototype.extendScale=function(t){var e=this,n=t.copy,r=t.ticks;return Object.assign(t,{stepSize:function(){return 0},copy:function(){return e.extendScale(n.call(t))},ticks:this.getField("isInteger")?function(e){return r.call(t,e).filter(Number.isInteger)}:t.ticks}),t},e}(Vi),ga=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ma=function(){return(ma=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0,n=t.map(function(t){return Math.abs(t)}),r=Math.max.apply(Math,n),i=Math.min.apply(Math,n).toExponential().split("e"),a=r.toExponential().split("e"),o=parseFloat(Math.floor(Number(i[0]))+"e"+i[1]),s=parseFloat(Math.ceil(Number(a[0]))+"e"+a[1]);return e?[o,s]:[-s,-o]}(a)),r.vars=a,r.addField("scaleType","logarithmic").addField("discrete",!1),r}return ga(e,t),e.prototype.isInDomain=function(t){var e=this.domain(),n=e[0],r=e[e.length-1];return!Number.isNaN(n)&&!Number.isNaN(r)&&t<=r&&t>=n},e.prototype.create=function(t){var e=this.vars;xa(e);var n=function t(e){var n=e.copy;e.ticks=function(t){for(var n=[],r=ya.extent(e.domain()),i=Math.floor(ba(r[0])),a=Math.ceil(ba(r[1])),o=Math.ceil(10*(a-i)/(10*Math.ceil(t/10))),s=i;s<=a;s+=o)for(var u=1;u<=10;u++){var l=Math.pow(u,o)*Math.pow(10,s);(l=parseFloat(l.toExponential(0)))>=r[0]&&l<=r[1]&&n.push(l)}return n};e.copy=function(){var r=n.call(e);return t(r),r};return e}(ya.scaleLog()).domain(e).range(t);return n.stepSize=function(){return 0},this.toBaseScale(n,t)},e}(Vi);function ba(t){return Math.log(t)/Math.LN10}function xa(t){if(t[0]*t[1]<=0)throw new _("Logarithmic scale domain cannot cross zero.",w.INVALID_LOG_DOMAIN)}var _a,wa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ea=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.addField("scaleType","value").addField("georole",n.georole),r}return wa(e,t),e.prototype.create=function(){return this.toBaseScale(function(t){return t})},e}(Vi),Sa=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ma=function(){return(Ma=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=n},e.prototype.create=function(){var t=this.vars,e=this.getField("brewer");if(!Array.isArray(e))throw new Error("This brewer is not supported");var n=e.length,r=(t[1]-t[0])/n,i=Wt(n-1).map(function(t){return t+1}).reduce(function(e,n){return e.concat([t[0]+n*r])},[]),a=Ta.scaleThreshold().domain(i).range(e);return this.toBaseScale(a)},e}(Vi),Aa=function(t){return t||null},ka=function(t,e){return void 0===e&&(e=null),Array.isArray(t)?0===t.length?[e]:t:[t]},Oa=function(t,e){return{type:t,x:e.x,y:e.y,identity:e.identity,size:e.size,color:e.color,split:e.split,label:e.label,guide:{color:e.colorGuide,obsoleteVerticalStackOrder:e.obsoleteVerticalStackOrder,size:e.sizeGuide},flip:e.flip,stack:e.stack}},Pa={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"},Na=((_a={})[Pa.SUCCESS]=function(t){return t},_a[Pa.FAIL]=function(t,e){throw new Error((e.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},_a[Pa.WARNING]=function(t,e,n){var r=e.axis,i=e.indexMeasureAxis[0],a=t[i],o=t.filter(function(t){return t!==a});o.push(a);var s=n[i][r]||{},u=n[n.length-1][r]||{};return n[n.length-1][r]=s,n[i][r]=u,o},_a);function La(t,e,n){return e.reduce(function(e,r,i){var a=t[r];return a?e.status!=Pa.FAIL&&("measure"===a.type&&(e.countMeasureAxis++,e.indexMeasureAxis.push(i)),"measure"!==a.type&&1===e.countMeasureAxis?e.status=Pa.WARNING:e.countMeasureAxis>1&&(e.status=Pa.FAIL,e.messages.push('There is more than one measure dimension for "'+n+'" axis'))):(e.status=Pa.FAIL,r?e.messages.push('"'+r+'" dimension is undefined for "'+n+'" axis'):e.messages.push('"'+n+'" axis should be specified')),e},{status:Pa.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:n})}function Ra(t){for(var e=ka(t.x),n=ka(t.y),r=Math.max(e.length,n.length),i=ka(t.guide||{},{}),a=r-i.length,o=0;o0;c--){var f=s.pop(),d=u.pop(),h=l.pop()||{};c===a?(o.x=f,o.y=d,o.unit.push(Oa(t,{x:Aa(f),y:Aa(d),identity:e.identity,split:e.split,color:e.color,label:e.label,size:e.size,flip:e.flip,stack:e.stack,colorGuide:h.color,obsoleteVerticalStackOrder:h.obsoleteVerticalStackOrder,sizeGuide:h.size})),o.guide=Jt(h,{x:{label:f},y:{label:d}})):o={type:"COORDS.RECT",x:Aa(f),y:Aa(d),unit:[o],guide:Jt(h,{x:{label:f},y:{label:d}})}}return e.spec={dimensions:e.dimensions,unit:o},e}var Da=function(t){var e=Ra(t);return Fa("ELEMENT.INTERVAL",e=function(t){var e=(t.flip?t.y:t.x).indexOf(t.color)>=0,n=t.guide[t.guide.length-1];return e&&!n.hasOwnProperty("enableColorToBarPosition")&&(n.enableColorToBarPosition=!1),t}(e))},Ia=function(t){var e=Ra(t),n=e.data,r=e.settings.log,i=(0,{horizontal:function(t){return{prop:t.x[t.x.length-1],flip:!1}},vertical:function(t){return{prop:t.y[t.y.length-1],flip:!0}},auto:function(t){var e,i=t.x,a=t.y,o=i[i.length-1],s=i.slice(0,i.length-1),u=a[a.length-1],l=a.slice(0,a.length-1),c=t.color,f=s.concat(l).concat([c]).filter(function(t){return null!==t}),d=-1,h=[[[o].concat(f),u],[[u].concat(f),o]],p=null;return h.some(function(t,e){var i=t[0],a=t[1],o=an(n,i,[a]);return o.result?d=e:r(["Attempt to find a functional relation between",t[0]+" and "+t[1]+" is failed.","There are several "+o.error.keyY+" values (e.g. "+o.error.errY.join(",")+")","for ("+o.error.keyX+" = "+o.error.valX+")."].join(" ")),o.result})?(e=h[d][0][0],p=0!==d):(r("All attempts are failed. Gonna transform AREA to general PATH."),e=null),{prop:e,flip:p}}}["boolean"!=typeof e.flip?"auto":e.flip?"vertical":"horizontal"])(e);return null!==i.prop&&(e.data=ln(n,i.prop,e.dimensions[i.prop]),e.flip=i.flip),Fa("ELEMENT.AREA",e)},ja=function(){function t(t){this.unitRef=t}return t.prototype.value=function(){return this.unitRef},t.prototype.clone=function(){return JSON.parse(JSON.stringify(this.unitRef))},t.prototype.traverse=function(t){var e=function(t,n,r){n(t,r),(t.units||[]).map(function(r){return e(r,n,t)})};return e(this.unitRef,t,null),this},t.prototype.reduce=function(t,e){var n=e;return this.traverse(function(e,r){return n=t(n,e,r)}),n},t.prototype.addFrame=function(t){return this.unitRef.frames=this.unitRef.frames||[],t.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),t.source=t.hasOwnProperty("source")?t.source:this.unitRef.expression.source,t.pipe=t.pipe||[],this.unitRef.frames.push(t),this},t.prototype.addTransformation=function(t,e){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:t,args:e}),this},t.prototype.isCoordinates=function(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")},t.prototype.isElementOf=function(t){if(this.isCoordinates())return!1;var e=(this.unitRef.type||"").split("/");return 1===e.length&&e.unshift("RECT"),e[0].toUpperCase()===t.toUpperCase()},t}(),za=function(){function t(t){this.specRef=t}return t.prototype.value=function(){return this.specRef},t.prototype.unit=function(t){return t&&(this.specRef.unit=t),new ja(this.specRef.unit)},t.prototype.addTransformation=function(t,e){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[t]=e,this},t.prototype.getSettings=function(t){return this.specRef.settings[t]},t.prototype.setSettings=function(t,e){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[t]=e,this},t.prototype.getScale=function(t){return this.specRef.scales[t]},t.prototype.addScale=function(t,e){return this.specRef.scales[t]=e,this},t.prototype.regSource=function(t,e){return this.specRef.sources[t]=e,this},t.prototype.getSourceData=function(t){return(this.specRef.sources[t]||{data:[]}).data},t.prototype.getSourceDim=function(t,e){return(this.specRef.sources[t]||{dims:{}}).dims[e]||{}},t}(),Ba={},Va=function(){function t(){}return t.unit=function(t){return new ja(t)},t.spec=function(t){return new za(t)},t.cloneObject=function(t){return JSON.parse(JSON.stringify(t))},t.depthFirstSearch=function(e,n){if(n(e))return e;for(var r=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],i=0;i1))return"[columns] property must contain at least 2 dimensions"}]));var Xa="2.6.5";e.default={GPL:Ge,Plot:nr,Chart:ur,api:Ga,version:"2.6.5"}},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e){t.exports=r},function(t,e){t.exports=i},function(t,e){t.exports=a},function(t,e){t.exports=o},function(t,e){t.exports=s},function(t,e){t.exports=u},function(t,e,n){var r,i,a;!function(n,o){i=[],void 0===(a="function"==typeof(r=o)?r.apply(e,i):r)||(t.exports=a)}(0,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t,e){return t.indexOf(e)},r=window,i=r.document,a=i.documentElement,o=["top","bottom"];function s(t,e){for(var n in e)t[n]=e[n];return t}function u(t){var e=r.pageYOffset||a.scrollTop,n=r.pageXOffset||a.scrollLeft,i={left:0,right:0,top:0,bottom:0,width:0,height:0};if(function(t){return t&&null!=t.setInterval}(t))i.width=r.innerWidth||a.clientWidth,i.height=r.innerHeight||a.clientHeight;else{if(!a.contains(t)||null==t.getBoundingClientRect)return i;s(i,t.getBoundingClientRect()),i.width=i.right-i.left,i.height=i.bottom-i.top}return i.top=i.top+e-a.clientTop,i.left=i.left+n-a.clientLeft,i.right=i.left+i.width,i.bottom=i.top+i.height,i}var l=function(t,e){return r.getComputedStyle(t)[e]};function c(t){var e=String(l(t,c.propName)),n=e.match(/([0-9.]+)([ms]{1,2})/);return n&&(e=Number(n[1]),"s"===n[2]&&(e*=1e3)),0|e}c.propName=function(){for(var t=i.createElement("div"),e=["transitionDuration","webkitTransitionDuration"],n=0;n=e.bottom&&(i[0]="top"),i[1]){case"left":t.right-this.width<=e.left&&(i[1]="right");break;case"right":t.left+this.width>=e.right&&(i[1]="left");break;default:t.left+t.width/2+this.width/2>=e.right?i[1]="left":t.right-t.width/2-this.width/2<=e.left&&(i[1]="right")}else switch(t.left-this.width-a<=e.left?i[0]="right":t.right+this.width+a>=e.right&&(i[0]="left"),i[1]){case"top":t.bottom-this.height<=e.top&&(i[1]="bottom");break;case"bottom":t.top+this.height>=e.bottom&&(i[1]="top");break;default:t.top+t.height/2+this.height/2>=e.bottom?i[1]="top":t.bottom-t.height/2-this.height/2<=e.top&&(i[1]="bottom")}return i.join("-")},d.prototype.position=function(t,e){this.attachedTo&&(t=this.attachedTo),null==t&&this._p?(t=this._p[0],e=this._p[1]):this._p=arguments;var n,r,i="number"==typeof t?{left:0|t,right:0|t,top:0|e,bottom:0|e,width:0,height:0}:u(t),a=this.spacing,o=this._pickPlace(i);switch(o!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(o),this.curPlace=o),this.curPlace){case"top":n=i.top-this.height-a,r=i.left+i.width/2-this.width/2;break;case"top-left":n=i.top-this.height-a,r=i.right-this.width;break;case"top-right":n=i.top-this.height-a,r=i.left;break;case"bottom":n=i.bottom+a,r=i.left+i.width/2-this.width/2;break;case"bottom-left":n=i.bottom+a,r=i.right-this.width;break;case"bottom-right":n=i.bottom+a,r=i.left;break;case"left":n=i.top+i.height/2-this.height/2,r=i.left-this.width-a;break;case"left-top":n=i.bottom-this.height,r=i.left-this.width-a;break;case"left-bottom":n=i.top,r=i.left-this.width-a;break;case"right":n=i.top+i.height/2-this.height/2,r=i.right+a;break;case"right-top":n=i.bottom-this.height,r=i.right+a;break;case"right-bottom":n=i.top,r=i.right+a}return this.element.style.top=Math.round(n)+"px",this.element.style.left=Math.round(r)+"px",this},d.prototype.show=function(t,e){return t=this.attachedTo?this.attachedTo:t,clearTimeout(this.aIndex),null!=t&&this.position(t,e),this.hidden&&(this.hidden=0,i.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},d.prototype.getElement=function(){return this.element},d.prototype.hide=function(){if(!this.hidden){var t=this,e=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(e=c(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){t.aIndex=0,i.body.removeChild(t.element),t.hidden=1},e),this}},d.prototype.toggle=function(t,e){return this[this.hidden?"show":"hide"](t,e)},d.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||i.body.removeChild(this.element),this.element=this.options=null},d.prototype._aware=function(){-1===n(d.winAware,this)&&d.winAware.push(this)},d.prototype._unaware=function(){var t=n(d.winAware,this);-1!==t&&d.winAware.splice(t,1)},d.reposition=function(){var t,e=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return setTimeout(t,17)};function n(){t=0;for(var e=0,n=d.winAware.length;e0)-(t<0)||Number(t)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,n=Object(this),r=n.length>>>0,i=arguments[1],a=0;a>>0,i=arguments[1],a=0;a0?1:-1)*Math.floor(Math.abs(e)):e}(t);return Math.min(Math.max(e,0),n)};return function(t){var n=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var i,a=arguments.length>1?arguments[1]:void 0;if(void 0!==a){if(!e(a))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(i=arguments[2])}for(var o,s=r(n.length),u=e(this)?Object(new this(s)):new Array(s),l=0;l]*>/,"");var e=new ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}try{var a=new r.DOMParser(n.xmldom||{});return a.parseFromString(t,"image/svg+xml")}catch(e){return(a=new r.DOMParser(n.xmldom||{})).parseFromString(t,"text/xml")}},o.Property=function(t,e){this.name=t,this.value=e},o.Property.prototype.getValue=function(){return this.value},o.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},o.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},o.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},o.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},o.Property.prototype.addOpacity=function(e){var n=this.value;if(null!=e.value&&""!=e.value&&"string"==typeof this.value){var r=new t(this.value);r.ok&&(n="rgba("+r.r+", "+r.g+", "+r.b+", "+e.numValue()+")")}return new o.Property(this.name,n)},o.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t&&(t=t[1]),t||(t=this.value),o.Definitions[t]},o.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},o.Property.prototype.getFillStyleDefinition=function(t,e){var n=this.getDefinition();if(null!=n&&n.createGradient)return n.createGradient(o.ctx,t,e);if(null!=n&&n.createPattern){if(n.getHrefAttribute().hasValue()){var r=n.attribute("patternTransform");n=n.getHrefAttribute().getDefinition(),r.hasValue()&&(n.attribute("patternTransform",!0).value=r.value)}return n.createPattern(o.ctx,t)}return null},o.Property.prototype.getDPI=function(t){return 96},o.Property.prototype.getEM=function(t){var e=12,n=new o.Property("fontSize",o.Font.Parse(o.ctx.font).fontSize);return n.hasValue()&&(e=n.toPixels(t)),e},o.Property.prototype.getUnits=function(){var t=this.value+"";return t.replace(/[0-9\.\-]/g,"")},o.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var n=this.value+"";if(n.match(/em$/))return this.numValue()*this.getEM(t);if(n.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(n.match(/px$/))return this.numValue();if(n.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(n.match(/pc$/))return 15*this.numValue();if(n.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(n.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(n.match(/in$/))return this.numValue()*this.getDPI(t);if(n.match(/%$/))return this.numValue()*o.ViewPort.ComputeSize(t);var r=this.numValue();return e&&r<1?r*o.ViewPort.ComputeSize(t):r},o.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/s$/)?1e3*this.numValue():(t.match(/ms$/),this.numValue())},o.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var t=this.value+"";return t.match(/deg$/)?this.numValue()*(Math.PI/180):t.match(/grad$/)?this.numValue()*(Math.PI/200):t.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var s={baseline:"alphabetic","before-edge":"top","text-before-edge":"top",middle:"middle",central:"middle","after-edge":"bottom","text-after-edge":"bottom",ideographic:"ideographic",alphabetic:"alphabetic",hanging:"hanging",mathematical:"alphabetic"};return o.Property.prototype.toTextBaseline=function(){return this.hasValue()?s[this.value]:null},o.Font=new function(){this.Styles="normal|italic|oblique|inherit",this.Variants="normal|small-caps|inherit",this.Weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit",this.CreateFont=function(t,e,n,r,i,a){var s=null!=a?this.Parse(a):this.CreateFont("","","","","",o.ctx.font);return{fontFamily:i=i||s.fontFamily,fontSize:r||s.fontSize,fontStyle:t||s.fontStyle,fontWeight:n||s.fontWeight,fontVariant:e||s.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var t=this;this.Parse=function(e){for(var n={},r=o.trim(o.compressSpaces(e||"")).split(" "),i={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},a="",s=0;sthis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))},this.addX=function(t){this.addPoint(t,null)},this.addY=function(t){this.addPoint(null,t)},this.addBoundingBox=function(t){this.addPoint(t.x1,t.y1),this.addPoint(t.x2,t.y2)},this.addQuadraticCurve=function(t,e,n,r,i,a){var o=t+2/3*(n-t),s=e+2/3*(r-e),u=o+1/3*(i-t),l=s+1/3*(a-e);this.addBezierCurve(t,e,o,u,s,l,i,a)},this.addBezierCurve=function(t,e,n,r,i,a,o,s){var u=[t,e],l=[n,r],c=[i,a],f=[o,s];this.addPoint(u[0],u[1]),this.addPoint(f[0],f[1]);for(var d=0;d<=1;d++){var h=function(t){return Math.pow(1-t,3)*u[d]+3*Math.pow(1-t,2)*t*l[d]+3*(1-t)*Math.pow(t,2)*c[d]+Math.pow(t,3)*f[d]},p=6*u[d]-12*l[d]+6*c[d],g=-3*u[d]+9*l[d]-9*c[d]+3*f[d],m=3*l[d]-3*u[d];if(0!=g){var y=Math.pow(p,2)-4*m*g;if(!(y<0)){var v=(-p+Math.sqrt(y))/(2*g);0=this.tokens.length-1},this.isCommandOrEnd=function(){return!!this.isEnd()||null!=this.tokens[this.i+1].match(/^[A-Za-z]$/)},this.isRelativeCommand=function(){switch(this.command){case"m":case"l":case"h":case"v":case"c":case"s":case"q":case"t":case"a":case"z":return!0}return!1},this.getToken=function(){return this.i++,this.tokens[this.i]},this.getScalar=function(){return parseFloat(this.getToken())},this.nextCommand=function(){this.previousCommand=this.command,this.command=this.getToken()},this.getPoint=function(){var t=new o.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(t)},this.getAsControlPoint=function(){var t=this.getPoint();return this.control=t},this.getAsCurrentPoint=function(){var t=this.getPoint();return this.current=t},this.getReflectedControlPoint=function(){return"c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase()?this.current:new o.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(t){return this.isRelativeCommand()&&(t.x+=this.current.x,t.y+=this.current.y),t},this.addMarker=function(t,e,n){null!=n&&0this.maxDuration){if("indefinite"==this.attribute("repeatCount").value||"indefinite"==this.attribute("repeatDur").value)this.duration=0;else if("freeze"!=this.attribute("fill").valueOrDefault("remove")||this.frozen){if("remove"==this.attribute("fill").valueOrDefault("remove")&&!this.removed)return this.removed=!0,this.getProperty().value=this.parent.animationFrozen?this.parent.animationFrozenValue:this.initialValue,!0}else this.frozen=!0,this.parent.animationFrozen=!0,this.parent.animationFrozenValue=this.getProperty().value;return!1}this.duration=this.duration+t;var e=!1;if(this.begin~\.\[:]+)/g,l=/(\.[^\s\+>~\.\[:]+)/g,c=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,f=/(:[\w-]+\([^\)]*\))/gi,d=/(:[^\s\+>~\.\[:]+)/g,h=/([^\s\+>~\.\[:]+)/g;function p(t){var e=[0,0,0],n=function(n,r){var i=t.match(n);null!=i&&(e[r]+=i.length,t=t.replace(n," "))};return t=(t=t.replace(/:not\(([^\)]*)\)/g," $1 ")).replace(/{[\s\S]*/gm," "),n(s,1),n(u,0),n(l,1),n(c,2),n(f,1),n(d,1),t=(t=t.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),n(h,2),e.join("")}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,n,r,i,a){var s={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:n,scaleWidth:r,scaleHeight:i};for(var u in a)a.hasOwnProperty(u)&&(s[u]=a[u]);o(this.canvas,t,s)}),n.exports=o}(n={exports:{}}),n.exports}(n(22),n(23))},function(t,e,n){var r,i=i||function(t){"use strict";if(!(void 0===t||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var e=function(){return t.URL||t.webkitURL||t},n=t.document.createElementNS("http://www.w3.org/1999/xhtml","a"),r="download"in n,i=/constructor/i.test(t.HTMLElement)||t.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent),o=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},s=function(t){setTimeout(function(){"string"==typeof t?e().revokeObjectURL(t):t.remove()},4e4)},u=function(t){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob([String.fromCharCode(65279),t],{type:t.type}):t},l=function(l,c,f){f||(l=u(l));var d,h=this,p="application/octet-stream"===l.type,g=function(){!function(t,e,n){for(var r=(e=[].concat(e)).length;r--;){var i=t["on"+e[r]];if("function"==typeof i)try{i.call(t,n||t)}catch(t){o(t)}}}(h,"writestart progress write writeend".split(" "))};if(h.readyState=h.INIT,r)return d=e().createObjectURL(l),void setTimeout(function(){n.href=d,n.download=c,function(t){var e=new MouseEvent("click");t.dispatchEvent(e)}(n),g(),s(d),h.readyState=h.DONE});!function(){if((a||p&&i)&&t.FileReader){var n=new FileReader;return n.onloadend=function(){var e=a?n.result:n.result.replace(/^data:[^;]*;/,"data:attachment/file;");t.open(e,"_blank")||(t.location.href=e),e=void 0,h.readyState=h.DONE,g()},n.readAsDataURL(l),void(h.readyState=h.INIT)}d||(d=e().createObjectURL(l)),p?t.location.href=d:t.open(d,"_blank")||(t.location.href=d);h.readyState=h.DONE,g(),s(d)}()},c=l.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,n){return e=e||t.name||"download",n||(t=u(t)),navigator.msSaveOrOpenBlob(t,e)}:(c.abort=function(){},c.readyState=c.INIT=0,c.WRITING=1,c.DONE=2,c.error=c.onwritestart=c.onprogress=c.onwrite=c.onabort=c.onerror=c.onwriteend=null,function(t,e,n){return new l(t,e||t.name||"download",n)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content); +/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */void 0!==t&&t.exports?t.exports.saveAs=i:null!==n(24)&&null!==n(25)&&(void 0===(r=function(){return i}.call(e,n,e,t))||(t.exports=r))},function(t,e,n){(t.exports=n(26)(!1)).push([t.i,"body > * {\n visibility: hidden;\n}\nbody {\n overflow: hidden;\n}\nbody * {\n visibility: hidden !important;\n}\n\n.tau-chart__print-block {\n position: absolute;\n top: 0;\n left: 0;\n visibility: visible !important;\n display: block !important;\n width: 100%;\n /*height: 100%;*/\n}\n",""])},,function(t,e,n){t.exports=n(27)},function(t,e){t.exports=function(t){this.ok=!1,this.alpha=1,"#"==t.charAt(0)&&(t=t.substr(1,6)),t=(t=t.replace(/ /g,"")).toLowerCase();var e={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};t=e[t]||t;for(var n=[{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*((?:\d?\.)?\d)\)$/,example:["rgba(123, 234, 45, 0.8)","rgba(255,234,245,1.0)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),parseFloat(t[4])]}},{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(t){return[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}}],r=0;r3&&(this.alpha=s[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var t=this.r.toString(16),e=this.g.toString(16),n=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==n.length&&(n="0"+n),"#"+t+e+n},this.getHelpXML=function(){for(var t=new Array,r=0;r "+l.toRGB()+" -> "+l.toHex());u.appendChild(c),u.appendChild(f),s.appendChild(u)}catch(t){}return s}}},function(t,e){var n=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],r=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function i(t,e,n,r,i){if("string"==typeof t)t=document.getElementById(t);else if("undefined"!=typeof HTMLCanvasElement&&!t instanceof HTMLCanvasElement)return;var a,o=t.getContext("2d");try{try{a=o.getImageData(e,n,r,i)}catch(t){throw new Error("unable to access local image data: "+t)}}catch(t){throw new Error("unable to access image data: "+t)}return a}function a(t,e,n,r,a,s){if(!(isNaN(s)||s<1)){s|=0;var u=i(t,e,n,r,a);u=o(u,e,n,r,a,s),t.getContext("2d").putImageData(u,e,n)}}function o(t,e,i,a,o,s){var u,c,f,d,h,p,g,m,y,v,b,x,_,w,E,S,M,T,C,A,k,O,P,N,L=t.data,R=s+s+1,F=a-1,D=o-1,I=s+1,j=I*(I+1)/2,z=new l,B=z;for(f=1;f>U,0!=P?(P=255/P,L[p]=(m*G>>U)*P,L[p+1]=(y*G>>U)*P,L[p+2]=(v*G>>U)*P):L[p]=L[p+1]=L[p+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=g+((d=u+s+1)>U,P>0?(P=255/P,L[d]=(m*G>>U)*P,L[d+1]=(y*G>>U)*P,L[d+2]=(v*G>>U)*P):L[d]=L[d+1]=L[d+2]=0,m-=x,y-=_,v-=w,b-=E,x-=H.r,_-=H.g,w-=H.b,E-=H.a,d=u+((d=c+I)>V,k[p+1]=y*B>>V,k[p+2]=v*B>>V,m-=b,y-=x,v-=_,b-=j.r,x-=j.g,_-=j.b,d=g+((d=u+s+1)>V,k[d+1]=y*B>>V,k[d+2]=v*B>>V,m-=b,y-=x,v-=_,b-=j.r,x-=j.g,_-=j.b,d=u+((d=c+L)=0:e.dim===t.dim});if(null===i.method)return n;var a={l:-.5,r:.5},o=i.method,s=i.scale;return n[o]=function(t){var n=a[t.__pos__]||0;if(s.discrete)return e[o](t)+s.stepSize(t[s.dim])*n;if(s.period){for(var i=r.default.api.tickPeriod.get(s.period,{utc:s.utcTime}),u=s.domain(),l=i.cast(u[0]);l=0?i[t].map(function(t){return new Date(t)}):i[t];a.series=o.unique(s.concat(u))}})})},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},_useSavedDataRefs:function(t,e){var n=this._dataRefs;return this._usedDataRefsKeys.add(e),e in n?(n[e].forEach(function(e,n){return Object.assign(e,t[n])}),n[e]):(n[e]=t,t)},_startWatchingDataRefs:function(){var t=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(t)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs:function(){var t=this._dataRefs,e=this._initialDataRefsKeys,n=this._usedDataRefsKeys;Array.from(e).filter(function(t){return!n.has(t)}).forEach(function(e){return delete t[e]}),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems:function(t){var e=function(t,e){return t.reduce(function(t,n,r){return t[n]=e[r],t},{})};return t.reduce(function(t,n){return Array.isArray(n.dim)?Array.isArray(n.val)&&n.val.every(Array.isArray)&&n.val.forEach(function(r){t.push(e(n.dim,r))}):Array.isArray(n.val)?n.val.forEach(function(r){t.push(e([n.dim],[r]))}):t.push(e([n.dim],[n.val])),t},[])},_getAnnotatedDimValues:function(t){var e={};return this._getDataRowsFromItems(t).forEach(function(t){Object.keys(t).forEach(function(n){e[n]=e[n]||[],e[n].push(t[n])})}),e}}}r.default.api.plugins.add("annotations",c);var f=r.default.api.utils;function d(t){var e=t.x0,n=t.y0,r=null==t.collapse||t.collapse,i=function(t){return{y0:function(n){return t.scaleY.value(n[e])}}},a=function(t){return{y0:function(e){return t.scaleY.value(e[n])}}},o=function(t){var r=t.data();if(0===r.length)return{};var i=t.scaleY,a=Number.MAX_VALUE,o=Number.MIN_VALUE,s=t.flip?e:n,u=i.dim;return r.forEach(function(t){var e=t[s],n=t[u],r=ee?n:e;a=ro?i:o}),i.fixup(function(t){var e={};return(!t.hasOwnProperty("max")||t.maxa)&&(e.min=a),e}),{}},s={},u={},l=function(t){var i=t.data().slice(),a=t.scaleX,o=t.scaleY;if(0===i.length||!a.discrete)return{};var l=t.flip?e:n,c=o.dim;i.sort(f.createMultiSorter(function(t,e){return t[l]-e[l]},function(t,e){return t[c]-e[c]}));var d=a.dim,h=a.domain().reduce(function(t,e){return t[e]=[],t},{}),p=new Map;return i.forEach(r?function(t){var e=t[d],n=h[e],r=n.findIndex(function(e){return e[e.length-1][c]<=t[l]});r<0&&(r=n.length,n.push([])),n[r].push(t),p.set(t,r)}:function(t){var e=t[d],n=h[e],r=r=n.length;n.push([]),n[r].push(t),p.set(t,r)}),Object.keys(h).forEach(function(t){s[t]=h[t]}),a.fixup(function(t){var e={},n=a.domain().reduce(function(t,e){return t+s[e].length},0);return a.domain().forEach(function(t){u[t]=n}),e.ratio=function(t){return s[t].length/u[t]},e}),{xi:function(e){var n=e[d],r=a.stepSize(n);return t.xi(e)-r/2+r/s[n].length*(p.get(e)+.5)}}};return{onSpecReady:function(t,e){t.traverseSpec(e,function(t,e){"ELEMENT.INTERVAL"===t.type&&(t.transformModel=[t.flip?i:a,l],t.adjustScales=[o],t.guide.enableColorToBarPosition=!1,t.guide.label=t.guide.label||{},t.guide.label.position=t.guide.label.position||(t.flip?["inside-start-then-outside-end-horizontal","hide-by-label-height-horizontal"]:["inside-start-then-outside-end-vertical"]))})}}}r.default.api.plugins.add("bar-as-span",d);var h=n(0),p=r.default.api.utils,g="minimum",m="maximum",y={MIN:g,MAX:m,MEDIAN:"median",Q1:"Q1",Q3:"Q3"};function v(t,e){var n=t.length-1,r=e/100*n,i=Math.floor(r);if(0===i)return{pos:0,value:t[0]};if(i===n)return{pos:n,value:t[n]};var a=r-i;return a?{pos:r,value:t[i]+a*(t[i+1]-t[i])}:{pos:r,value:t[r]}}function b(t,e,n){for(var r=t.sort(function(t,e){return t-e}),i=v(r,25),a=v(r,50),o=v(r,75),s=o.value-i.value,u=i.value-1.5*s,l=o.value+1.5*s,c=r[0],f=r[r.length-1],d=0;d<=i.pos;d++){var h=r[d];if(h>u){c=h;break}}for(var p=r.length-1;p>=o.pos;p--){var g=r[p];if(go||t[r]\n
'+e+'
\n
\n '+C(n.map(function(t){return k(t)}))+"\n
\n\n"},k=function(t){var e=t.key,n=t.label,r=t.checked;return'\n
\n '+O()+'\n '+n+"\n
\n"},O=function(){return['','',""].join("")},P=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.matches(n)&&r(t,e),e=e.parentNode})},N=function(t,e){var n=function(t){return JSON.stringify(function(t){return null==t||""===t}(t)?null:t)},r=n(e);return function(e){var i=e[t],a=n(i);return r===a}},L=function(){function t(t){this.settings=_.defaults(t||{},{formatters:{},fields:null,skipColorDim:!0}),this._filters={},this.onRender=this._createRenderHandler()}return t.prototype.init=function(t){var e=this;this._chart=t;var n=function(e){var n=t.getSpec().scales;return Object.keys(n).map(function(t){return{name:t,config:n[t]}}).filter(e)},r=n(function(t){var e=t.config;t.name;return"ordinal"===e.type&&e.dim}),i=_.unique(r.map(function(t){return t.config.dim}));if(this.settings.fields&&(i=i.filter(function(t){return e.settings.fields.indexOf(t)>=0})),this.settings.skipColorDim){var a=n(function(t){var e=t.config;t.name;return"color"===e.type&&e.dim}).map(function(t){return t.config.dim});i=i.filter(function(t){return a.indexOf(t)<0})}r=r.filter(function(t){return i.indexOf(t.config.dim)>=0}),this._categoryScales=r,this._render()},t.prototype.destroy=function(){var t=this._filters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});!function(t){t&&t.parentElement&&t.parentElement.removeChild(t)}(this._node)},t.prototype._createRenderHandler=function(){return function(){if(this._lastClickedScrollInfo){var t=this._lastClickedScrollInfo.key,e=this._node.querySelector('[data-key="'+t+'"]');if(e){var n=this._lastClickedScrollInfo.top,r=e.getBoundingClientRect().top,i=this._getScrollContainer(),a=i.getBoundingClientRect().top;i.scrollTop=i.scrollTop-n-a+r}this._lastClickedScrollInfo=null}}},t.prototype._getContent=function(t){return function(t){var e=t.categories;return'\n
\n '+C(e.map(function(t){return A(t)}))+"\n
\n"}({categories:t})},t.prototype._getCategoriesInfo=function(){var t=this;return this._categoryScales.map(function(e){var n=e.name;return t._chart.getScaleInfo(n)}).map(function(e){var n=e.dim,r=t._getFieldLabel(n),i=t._getFieldFormat(n),a=t._chart.getDataSources({excludeFilter:["category-filter"]}),o=_.unique(a[e.source].data.map(function(t){return t[n]})).map(function(e){var r=i(e),a=t._getFilterKey(n,e);return{label:r,checked:!t._filters[a],key:a,value:e}});return{dim:n,label:r,values:o}})},t.prototype._render=function(){this._clear(),this._formatters=w.getFieldFormatters(this._chart.getSpec(),this.settings.formatters);var t=this._getCategoriesInfo(),e=function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstElementChild}(this._getContent(t));this._node=e,this._chart.insertToRightSidebar(e),this._subscribeToEvents(),this._filterKeys=t.reduce(function(t,e){var n=e.dim;return e.values.forEach(function(e){var r=e.key,i=e.value;t[r]={dim:n,value:i}}),t},{})},t.prototype._subscribeToEvents=function(){var t=this,e=this._node;P(e,"click","."+S,function(e,n){var r=n.getAttribute("data-key"),i=e.target.matches("."+T);t._toggleCategory(r,i?"toggle":"focus")}),P(e,"mouseover","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!0)}),P(e,"mouseout","."+S,function(e,n){var r=n.getAttribute("data-key");t._toggleHighlight(r,!1)})},t.prototype._isFilteredOut=function(t){return t in this._filters},t.prototype._toggleCategory=function(t,e){var n=this,r=Array.from(this._node.querySelectorAll("."+S)).reduce(function(t,e){return t[e.getAttribute("data-key")]=e,t},{}),i=Object.keys(this._filterKeys).map(function(t){var e=n._filterKeys[t],i=e.dim,a=e.value;return{node:r[t],key:t,dim:i,value:a,isChecked:!n._isFilteredOut(t)}}),a=i.reduce(function(t,e){return t[e.key]=e,t},{})[t],o=i.filter(function(t){return t.dim===a.dim}),s=function(t,e){e?t.classList.add(M):t.classList.remove(M)};switch(e){case"toggle":a.isChecked?(this._addFilter(t),s(a.node,!1)):(this._removeFilter(t),s(a.node,!0));break;case"focus":a.isChecked&&o.every(function(t){return t===a||!t.isChecked})?o.forEach(function(t){t.isChecked||(s(t.node,!0),n._removeFilter(t.key))}):(o.forEach(function(t){t!==a&&t.isChecked&&(s(t.node,!1),n._addFilter(t.key))}),a.isChecked||(s(a.node,!0),this._removeFilter(a.key)))}this._lastClickedScrollInfo={key:t,top:a.node.getBoundingClientRect().top-this._getScrollContainer().getBoundingClientRect().top},this._chart.refresh()},t.prototype._toggleHighlight=function(t,e){if(!this._isFilteredOut(t)){var n=this._filterKeys[t],r=n.dim,i=n.value,a=e?N(r,i):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){return t.fire("highlight",a)})}},t.prototype._clear=function(){var t=this._node;t&&t.parentElement&&t.parentElement.removeChild(t)},t.prototype._getScrollContainer=function(){return this._node.parentElement.parentElement},t.prototype._getFilterKey=function(t,e){return t+"__"+e},t.prototype._addFilter=function(t){var e=this._filterKeys[t],n=e.dim,r=e.value,i=N(n,r);this._filters[t]=this._chart.addFilter({tag:"category-filter",predicate:function(t){return!i(t)}})},t.prototype._removeFilter=function(t){var e=this._filters[t];delete this._filters[t],this._chart.removeFilter(e)},t.prototype._getFieldLabel=function(t){return this._formatters[t]?this._formatters[t].label:t},t.prototype._getFieldFormat=function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},t}();r.default.api.plugins.add("category-filter",function(t){return new L(t)});var R="http://www.w3.org/2000/svg",F=r.default.api.utils,D=r.default.api.svgUtils,I=r.default.api.pluginsSDK;function j(t){t=t||{};var e=document.createElementNS(R,"g"),n=h.select(e).attr("class","tau-crosshair__label");n.append("rect").attr("class","tau-crosshair__label__box"),n.append("text").attr("class","tau-crosshair__label__text-shadow"),n.append("text").attr("class","tau-crosshair__label__text");var r={options:function(e){return t=Object.assign(t,e),r},show:function(i){return t.container.appendChild(e),function(e){var r=e.x,i=e.y,a=e.text,o=e.color,s=e.colorCls;n.attr("class","tau-crosshair__label "+s);var u=t.halign,l=t.valign,c=t.hpad,f=t.vpad,d={left:"end",middle:"middle",right:"start"}[u],h={left:-c,middle:0,right:c}[u],p=n.select(".tau-crosshair__label__text").attr("fill",o),g=n.selectAll(".tau-crosshair__label__text, .tau-crosshair__label__text-shadow").attr("text-anchor",d).attr("x",r+h).attr("y",0).text(a),m=p.node().getBBox(),y={top:-f-m.height/2,middle:0,bottom:f+m.height/2}[l]-m.height/2-m.y;g.attr("y",i+y);var v=m.width+2*c,b=m.height+2*f,x={left:-v,middle:-v/2,right:0}[u],_={top:-b,middle:-b/2,bottom:0}[l];n.select(".tau-crosshair__label__box").attr("fill",o).attr("rx",t.boxCornerRadius).attr("ry",t.boxCornerRadius).attr("x",r+x).attr("y",i+_).attr("width",v).attr("height",b)}(i),function(){n.attr("transform","");var r=t.chart.getLayout().contentContainer.getBoundingClientRect(),i=t.chart.getSVG().getBoundingClientRect(),a=e.getBoundingClientRect(),o=Math.max(0,Math.max(r.left,i.left)-a.left)||Math.min(0,Math.min(r.right,i.right)-a.right),s=Math.max(0,Math.max(r.top,i.top)-a.top)||Math.min(0,Math.min(r.bottom,i.bottom)-a.bottom);n.attr("transform","translate("+o+","+s+")")}(),r},hide:function(){return e.parentNode&&e.parentNode.removeChild(e),r}};return r}function z(t){var e=F.defaults(t||{},{xAxis:!0,yAxis:!0,formatters:{},labelBoxHPadding:5,labelBoxVPadding:3,labelBoxCornerRadius:3,axisHPadding:22,axisVPadding:22});return{init:function(t){this._chart=t,this._formatters={},this._createNode()},_createNode:function(){var t=h.select(document.createElementNS(R,"g")).attr("class","tau-crosshair");this._labels={x:null,y:null};var n=function(n){var r=t.append("g").attr("class","tau-crosshair__group "+n);r.append("line").attr("class","tau-crosshair__line-shadow"),r.append("line").attr("class","tau-crosshair__line"),this._labels[n]=j({container:r.node(),chart:this._chart,halign:"x"===n?"middle":"left",valign:"x"===n?"bottom":"middle",boxCornerRadius:e.labelBoxCornerRadius,hpad:e.labelBoxHPadding,vpad:e.labelBoxVPadding})}.bind(this);e.xAxis&&n("x"),e.yAxis&&n("y"),this._element=t},_setValues:function(t,n,r){var i=function(t){var n=this._element.select(".tau-crosshair__group."+t.dir);n.select(".tau-crosshair__line").attr("class","tau-crosshair__line "+r.cls).attr("stroke",r.color),n.selectAll(".tau-crosshair__line, .tau-crosshair__line-shadow").attr("x1",t.startPt.x).attr("x2",t.valuePt.x).attr("y1",t.startPt.y).attr("y2",t.valuePt.y),("x"===t.dir&&e.xAxis||"y"===t.dir&&e.yAxis)&&this._labels[t.dir].options({halign:t.labelHAlign,valign:t.labelVAlign}).show({x:t.startPt.x,y:t.startPt.y,text:t.label,color:r.color,colorCls:r.cls})}.bind(this);i({dir:"x",startPt:{x:t.value,y:n.start+(t.minMode?0:e.axisVPadding)},valuePt:{x:t.value,y:n.value+n.crossPadding},label:t.label,labelHAlign:"middle",labelVAlign:"bottom"}),i({dir:"y",startPt:{x:t.start-(n.minMode?0:e.axisHPadding),y:n.value},valuePt:{x:t.value-t.crossPadding,y:n.value},label:n.label,labelHAlign:"left",labelVAlign:"middle"})},_showCrosshair:function(t,e,n){var r=this._chart.getSVG(),i=e.config.options.container.node(),a=D.getDeepTransformTranslate(i);this._element.attr("transform",D.translate(a.x,a.y)),r.appendChild(this._element.node());var o=e.getScale("x"),s=e.getScale("y"),u=e.getScale("color"),l=u(t.data[u.dim]),c=t.data[o.dim],f=t.data[s.dim],d=e.screenModel.x(t.data),h=e.screenModel.y(t.data);if(e.config.stack)if(e.config.flip){var p=e.data().filter(function(n){var r=n[s.dim];return n===t.data||(r===f||r-f==0)&&(e.screenModel.x(t.data)-e.screenModel.x(n))*n[o.dim]>0});d=(c<0?Math.min:Math.max).apply(null,p.map(function(t){return e.screenModel.x(t)},0)),c=p.reduce(function(t,e){return t+e[o.dim]},0)}else{var g=e.data().filter(function(n){var r=n[o.dim];return n===t.data||(r===c||r-c==0)&&(e.screenModel.y(n)-e.screenModel.y(t.data))*n[s.dim]>0});h=(f<0?Math.max:Math.min).apply(null,g.map(function(t){return e.screenModel.y(t)},0)),f=g.reduce(function(t,e){return t+e[s.dim]},0)}var m=t.node.getBBox(),y=["ELEMENT.AREA","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED"].indexOf(e.config.type)>=0?{x:m.width*(e.config.flip?c>0?1:0:.5),y:m.height*(e.config.flip?.5:f>0?1:0)}:{x:m.width/2,y:m.height/2};this._setValues({label:this._getFormat(o.dim)(c),start:0,value:d,crossPadding:y.x,minMode:n&&n.guide.x.hide},{label:this._getFormat(s.dim)(f),start:e.config.options.height,value:h,crossPadding:y.y,minMode:n&&n.guide.y.hide},{cls:u.toColor(l)?"":l,color:u.toColor(l)?l:""})},_hideCrosshair:function(){var t=this._element.node();t.parentNode&&t.parentNode.removeChild(t)},destroy:function(){this._hideCrosshair()},_subscribeToHover:function(){var t=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(e){return t.indexOf(e.config.type)>=0}).forEach(function(t){t.on("data-hover",function(t,e){if(e.data){if(t===e.unit){var n=I.getParentUnit(this._chart.getSpec(),t.config);this._showCrosshair(e,t,n)}}else this._hideCrosshair()}.bind(this))},this)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){this._formatters=I.getFieldFormatters(this._chart.getSpec(),e.formatters),this._subscribeToHover()}}}r.default.api.plugins.add("crosshair",z);var B="tau-chart__tooltip";function V(t,e){return{render:function(t){return this.args=t,t=Object.assign({},t,{fields:this.filterFields(t.fields)}),this.rootTemplate(t)},rootTemplate:function(t){return['
',this.buttonsTemplate(),"
",'
',this.contentTemplate(t),"
"].join("\n")},contentTemplate:function(t){return this.fieldsTemplate(t)},filterFields:function(t){return t},getLabel:function(e){return t.getFieldLabel(e)},getFormatter:function(e){return t.getFieldFormat(e)},fieldsTemplate:function(t){var e=this,n=t.data;return t.fields.map(function(t){return e.itemTemplate({data:n,field:t})}).join("\n")},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]);return['
','
'+r+"
",'
'+i+"
","
"].join("\n")},buttonsTemplate:function(){return[this.buttonTemplate({cls:"i-role-exclude",text:"Exclude",icon:function(){return''}})].join("\n")},buttonTemplate:function(t){var e=t.icon,n=t.text,r=t.cls;return['
','
'," "+(e?e()+" ":"")+n,"
","
"].join("\n")},didMount:function(){var e=t.getDomNode().querySelector(".i-role-exclude");e&&e.addEventListener("click",function(){t.excludeHighlightedElement(),t.setState({highlight:null,isStuck:!1})})}}}var H=r.default.api.utils,W=r.default.api.domUtils,G=r.default.api.pluginsSDK,U="tau-chart__tooltip",X=function(){function t(t){this.settings=H.defaults(t||{},{align:"bottom-right",clickable:!0,clsClickable:U+"__clickable",clsStuck:"stuck",clsTarget:U+"-target",escapeHtml:!0,fields:null,formatters:{},getTemplate:null,spacing:24,winBound:12}),this.onRender=this._getRenderHandler()}return t.prototype.init=function(t){this._chart=t,this._tooltip=this._chart.addBalloon({spacing:this.settings.spacing,winBound:this.settings.winBound,auto:!0,effectClass:"fade"}),this._initDomEvents(),this.state={highlight:null,isStuck:!1},this.setState(this.state),this._template=this._getTemplate()},t.prototype._getTemplate=function(){var t=V(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t},t.prototype._renderTemplate=function(t,e){return this._template.render({data:t,fields:e})},t.prototype._initDomEvents=function(){var t=this;this._scrollHandler=function(){t.setState({highlight:null,isStuck:!1})},window.addEventListener("scroll",this._scrollHandler,!0),this.settings.clickable&&(this._outerClickHandler=function(e){var n=Array.from(document.querySelectorAll("."+t.settings.clsClickable)).concat(t.getDomNode()).map(function(t){return t.getBoundingClientRect()}),r=Math.min.apply(Math,n.map(function(t){return t.top})),i=Math.min.apply(Math,n.map(function(t){return t.left})),a=Math.max.apply(Math,n.map(function(t){return t.right})),o=Math.max.apply(Math,n.map(function(t){return t.bottom}));(e.clientXa||e.clientYo)&&t.setState({highlight:null,isStuck:!1})})},t.prototype.getDomNode=function(){return this._tooltip.getElement()},t.prototype.setState=function(t){var e=this,n=this.settings,r=this.state,i=this.state=Object.assign({},r,t);r.highlight=r.highlight||{data:null,cursor:null,unit:null},i.highlight=i.highlight||{data:null,cursor:null,unit:null},i.isStuck&&r.highlight.data&&(i.highlight=r.highlight),i.highlight.data!==r.highlight.data&&(i.highlight.data?(this._hideTooltip(),this._showTooltip(i.highlight.data,i.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(function(){e._setTargetSvgClass(!0)})):i.isStuck||!r.highlight.data||i.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!i.highlight.data||r.highlight.cursor&&i.highlight.cursor.x===r.highlight.cursor.x&&i.highlight.cursor.y===r.highlight.cursor.y||(this._tooltip.position(i.highlight.cursor.x,i.highlight.cursor.y),this._tooltip.updateSize());var a=this.getDomNode();this.settings.clickable&&i.isStuck!==r.isStuck&&(i.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),a.classList.add(n.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(i.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),a.classList.remove(n.clsStuck),requestAnimationFrame(function(){e._setTargetEventsEnabled(!0);var t=e._chart.getSVG();t&&W.dispatchMouseEvent(t,"mouseleave")})))},t.prototype._showTooltip=function(t,e){var n=this.settings,r=n.fields||"function"==typeof n.getFields&&n.getFields(this._chart)||Object.keys(t),i=this._renderTemplate(t,r);this._tooltip.content(i).position(e.x,e.y).place(n.align).show().updateSize(),this._template.didMount&&this._template.didMount()},t.prototype._hideTooltip=function(){window.removeEventListener("click",this._outerClickHandler,!0),this._template.willUnmount&&this._template.willUnmount(),this._tooltip.hide()},t.prototype.destroy=function(){window.removeEventListener("scroll",this._scrollHandler,!0),this._setTargetSvgClass(!1),this.setState({highlight:null,isStuck:!1}),this._tooltip.destroy()},t.prototype._subscribeToHover=function(){var t=this,e=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(function(t){return e.indexOf(t.config.type)>=0}).forEach(function(e){e.on("data-hover",function(e,n){var r=document.body.getBoundingClientRect();t.setState({highlight:n.data?{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit}:null})}),t.settings.clickable&&e.on("data-click",function(e,n){var r=document.body.getBoundingClientRect();t.setState(n.data?{highlight:{data:n.data,cursor:{x:n.event.clientX-r.left,y:n.event.clientY-r.top},unit:n.unit},isStuck:!0}:{highlight:null,isStuck:null})})})},t.prototype.getFieldFormat=function(t){var e=this._formatters[t]?this._formatters[t].format:function(t){return String(t)};return this.settings.escapeHtml?function(t){return H.escapeHtml(e(t))}:e},t.prototype.getFieldLabel=function(t){var e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?H.escapeHtml(e):e},t.prototype._accentFocus=function(t){var e=function(e){return e===t};this._chart.select(function(){return!0}).forEach(function(t){t.fire("highlight",e)})},t.prototype._removeFocus=function(){var t=function(){return null};this._chart.select(function(){return!0}).forEach(function(e){e.fire("highlight",t),e.fire("highlight-data-points",t)})},t.prototype.excludeHighlightedElement=function(){var t=this.state.highlight.data;this._chart.addFilter({tag:"exclude",predicate:function(e){return e!==t}}),this._chart.refresh()},t.prototype._getRenderHandler=function(){return function(){this._formatters=G.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}},t.prototype._setTargetSvgClass=function(t){h.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)},t.prototype._setTargetEventsEnabled=function(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()},t}(),q="diff-tooltip",Y=q+"__item",$=q+"__header";var K=r.default.api.utils,J={draw:function(){var t=this.node().config;this._container=t.options.slot(t.uid)},addInteraction:function(){var t=this;this.node().on("interval-highlight",function(e,n){t._drawRange(n)})},_drawRange:function(t){var e=this.node(),n=e.config,r=e.screenModel.flip,i=this._container,a="interval-highlight",o=a+"__gradient",s=t?t[0]:null,u=t?t[1]:null,l=r?n.options.width:n.options.height;K.take(function(){var e=i.selectAll("."+a).data(t?[1]:[]);return e.exit().remove(),{g:e,gEnter:e.enter().append("g").attr("class",a).attr("pointer-events","none")}}()).then(function(e){!function(){for(var e=a+"__defs",s=a+"__gradient-start",u=a+"__gradient-end",l=i.node();"svg"!==(l=l.parentNode).tagName;);var c=e+"__"+n.uid,f=h.select(l).selectAll("#"+c).data(t?[1]:[]);f.exit().remove();var d=f.enter().append("defs").attr("class",e).attr("id",c).append("linearGradient").attr("id",o).attr("x1","0%").attr("y1",r?"100%":"0%").attr("x2",r?"0%":"100%").attr("y2","0%");d.append("stop").attr("class",s).attr("offset","0%"),d.append("stop").attr("class",u).attr("offset","100%")}(),function(t){var e=t.g,n=t.gEnter,i=a+"__range",c=e.select("."+i),f=n.append("rect").attr("class",i).attr("fill","url(#"+o+")"),d=r?{x:0,y:u,width:l,height:s-u}:{x:s,y:0,width:u-s,height:l},h=d.x,p=d.y,g=d.width,m=d.height;f.merge(c).attr("x",h).attr("y",p).attr("width",Math.abs(g)).attr("height",Math.abs(m))}(e),function(t){var e=t.g,n=t.gEnter,i=a+"__range-start",o=e.select("."+i),u=n.append("line").attr("class",i),c=r?{x1:0,y1:s,x2:l,y2:s}:{x1:s,y1:0,x2:s,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;u.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e),function(t){var e=t.g,n=t.gEnter,i=a+"__range-end",o=e.select("."+i),s=n.append("line").attr("class",i),c=r?{x1:0,y1:u,x2:l,y2:u}:{x1:u,y1:0,x2:u,y2:l},f=c.x1,d=c.y1,h=c.x2,p=c.y2;s.merge(o).attr("x1",f).attr("y1",d).attr("x2",h).attr("y2",p)}(e)})}},Q=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Z=r.default.api.utils,tt=function(t){function e(e){var n=t.call(this,e)||this;return n.onSpecReady=n._getSpecReadyHandler(),n}return Q(e,t),e.prototype.init=function(e){t.prototype.init.call(this,e),this._unitsGroupedData=new Map},e.prototype._getTemplate=function(){var t=function(t,e){var n=V(t);return Object.assign({},n,{hasColor:function(){return null!=this.args.colorField},contentTemplate:function(t){return[this.fieldsTemplate(t),this.tableTemplate(t)].join("\n")},filterFields:function(e){var r=t.state.highlight.unit.screenModel.model,i=r.scaleColor,a=r.scaleX,o=r.scaleY,s=e.filter(function(t){return t!==i.dim&&t!==a.dim&&t!==o.dim}),u=function(){return s.push(a.dim)};return this.shouldShowColorTable()?u():(u(),i.dim&&s.push(i.dim),s.push(o.dim)),n.filterFields.call(this,s)},itemTemplate:function(t){var e=t.data,n=t.field,r=this.getLabel(n),i=this.getFormatter(n)(e[n]),a=this.args.prev,o=(this.args.valueField,this.shouldShowDiff(n)),s=['',""+i,o?" "+this.fieldUpdownTemplate(this.getDiff({data:e,prev:a,field:n})):"",""].join("");return['
','
'+r+"
"," "+s,"
"].join("\n")},shouldShowDiff:function(t){return t===this.args.valueField},getDiff:function(t){var e=t.data,n=t.prev,r=t.field,i=this.getFormatter(r),a=(e?e[r]:0)-(n?n[r]:0);return{diff:i(a),sign:Math.sign(a)}},fieldUpdownTemplate:function(t){var e=t.diff,n=t.sign,r=q+"__field__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},shouldShowColorTable:function(){var t=this.args.groups;return this.hasColor()&&t.length>1},tableTemplate:function(t){return this.shouldShowColorTable()?['
',this.tableHeaderTemplate(t),this.tableBodyTemplate(t),"
"].join("\n"):""},tableHeaderTemplate:function(t){var e=t.colorField,n=t.valueField,r=this.getLabel(e),i=this.getLabel(n);return['
',' '+r+"",' '+i+"",' ▼▲',"
"].join("\n")},tableBodyTemplate:function(t){var e=this,n=t.data,r=t.groups,i=t.valueField,a=t.colorField,o=n,s=r.map(function(t){var e=t.data;return e?e[i]:0}),u=Math.min.apply(Math,s),l=Math.max.apply(Math,s);return['
','
',r.map(function(t){var n=t.data,r=t.prev;return e.tableRowTemplate({data:n,prev:r,highlighted:o,valueField:i,colorField:a,min:u,max:l})}).join("\n"),"
","
"].join("\n")},tableRowTemplate:function(t){var e=t.data,n=t.prev,r=t.highlighted,i=t.valueField,a=t.colorField,o=t.min,s=t.max,u=e?e[i]:0,l=this.getFormatter(a)((e||n)[a]),c=this.getFormatter(i)(u),f=e===r,d=this.getDiff({data:e,prev:n,field:i}),h=d.diff,p=d.sign,g=this.getColor(e||n),m=g.color,y=g.colorCls;return['
'," "+this.valueBarTemplate({min:o,max:s,v:u,color:m,colorCls:y}),' '+l+"",' '+c+""," "+this.updownTemplate({diff:h,sign:p}),"
"].join("\n")},valueBarTemplate:function(t){var e=t.min,n=t.max,r=t.v,i=t.color,a=t.colorCls;e=Math.min(e,0);var o=(n=Math.max(0,n))-e;return[""].join("\n")},getColor:function(e){var n=t.state.highlight.unit.screenModel;return{color:n.color(e),colorCls:n.class(e)}},updownTemplate:function(t){var e=t.diff,n=t.sign,r=Y+"__updown";return['0?"positive":"negative")+'">',(n>0?"▲":n<0?"▼":"")+(0===n?"":e),""].join("")},didMount:function(){n.didMount.call(this),this._scrollToHighlighted(),this._reserveSpaceForUpdown()},_scrollToHighlighted:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+q+"__body__content"),i=e.querySelector("."+Y+"_highlighted");if(n&&r&&i){var a=n.getBoundingClientRect(),o=r.getBoundingClientRect(),s=i.getBoundingClientRect(),u=0;if(s.bottom>a.bottom){var l=s.bottom-a.bottom+s.height,c=o.bottom-a.bottom;u=-Math.min(l,c),r.style.transform="translateY("+u+"px)"}o.top+ua.bottom&&n.classList.add(q+"__body_overflow-bottom")}},_reserveSpaceForUpdown:function(){var e=t.getDomNode(),n=e.querySelector("."+q+"__body"),r=e.querySelector("."+$);if(n&&r){var i="."+Y+"__updown:not(:empty)",a=Array.from(e.querySelectorAll(i)).map(function(t){return t.scrollWidth}),o=Math.max.apply(Math,a),s=Math.max(0,Math.ceil(o-15));n.style.paddingRight=s+"px",r.style.paddingRight=s+"px"}}})}(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t},e.prototype._renderTemplate=function(t,e){var n=this.state.highlight.unit,r=n.screenModel,i=r.model,a=i.scaleColor,o=(i.scaleX,i.scaleY),s=this._unitsGroupedData.get(n),u=this._getHighlightRange(t,n),l=u[0],c=u[1],f=function(t){var e=r.model.color(t);return isFinite(l)&&s[l][e]?s[l][e][0]:null},d=f(t),h=n.config.stack,p=!(!n.config.flip&&n.config.guide.obsoleteVerticalStackOrder&&n.config.stack),g=function(){var t=a.domain().slice().reduce(function(t,e,n){return t[e]=n,t},{});return p?function(e,n){return t[e[a.dim]]-t[n[a.dim]]}:function(e,n){return t[n[a.dim]]-t[e[a.dim]]}}(),m=p?function(t,e){return o(t[o.dim])-o(e[o.dim])}:function(t,e){return o(e[o.dim])-o(t[o.dim])},y=function(t){return Object.keys(s[t]).reduce(function(e,n){return e.concat(s[t][n])},[]).sort(h?g:m)},v=y(c).map(function(t){r.model.color(t);return{data:t,prev:f(t)}});if(isFinite(l)){var b=y(l),x=v.reduce(function(t,e){return t[r.model.color(e.data)]=!0,t},{});b.forEach(function(t){var e=r.model.color(t);x[e]||v.push({data:null,prev:t})}),h&&v.sort(function(t,e){return g(t.data||t.prev,e.data||e.prev)})}return this._template.render({data:t,prev:d,fields:e,groups:v,valueField:o.dim,colorField:a.dim})},e.prototype._getRenderHandler=function(){var e=t.prototype._getRenderHandler.call(this);return function(){var t=this;e.call(this);var n=this._chart,r=n.select(function(t){return"chart"===t.config.namespace&&0===t.config.type.indexOf("ELEMENT.")&&"ELEMENT.INTERVAL_HIGHLIGHT"!==t.config.type}),i=n.select(function(t){return"ELEMENT.INTERVAL_HIGHLIGHT"===t.config.type}).reduce(function(t,e,n){return t[n]=e,t},{});r.forEach(function(e,n){var r=e.data();t._unitsGroupedData.set(e,t._getGroupedData(r,e)),e.on("data-hover",function(r,a){var o=i[n],s=a.unit&&a.unit===e?t._getHighlightRange(a.data,a.unit):null;o.fire("interval-highlight",s)})})}},e.prototype._getSpecReadyHandler=function(){return function(t,e){t.traverseSpec(e,function(t,e){if(0===t.type.indexOf("ELEMENT.")){var n=JSON.parse(JSON.stringify(t));n.type="ELEMENT.INTERVAL_HIGHLIGHT",n.namespace="highlight";var r=e.units.indexOf(t);e.units.splice(r,0,n)}})}},e.prototype._getGroupedData=function(t,e){var n=e.screenModel.model.scaleX,i=Z.groupBy(t,function(t){return n(t[n.dim]).toString()}),a=e.config.guide.x.tickPeriod||e.config.guide.x.timeInterval;if(a){var o=n.domain(),s=e.config.guide.utcTime;r.default.api.tickPeriod.generate(o[0],o[1],a,{utc:s}).filter(function(t){return t>=o[0]&&t<=o[1]}).forEach(function(t){var e=n(t);i[e]||(i[e]=[])})}return Object.keys(i).reduce(function(t,n){return t[n]=Z.groupBy(i[n],function(t){return e.screenModel.model.color(t)}),t},{})},e.prototype._getHighlightRange=function(t,e){var n=e.screenModel.flip,r=e.screenModel.model.scaleX,i=r(t[r.dim]),a=this._unitsGroupedData.get(e),o=Object.keys(a).map(Number).sort(n?function(t,e){return e-t}:function(t,e){return t-e}),s=o.indexOf(i);return 0===s?[i,i]:[o[s-1],i]},e}(X);function et(t){return new tt(t)}r.default.api.unitsRegistry.reg("ELEMENT.INTERVAL_HIGHLIGHT",J,"ELEMENT.GENERIC.CARTESIAN"),r.default.api.plugins.add("diff-tooltip",et);var nt=n(17),rt=n.n(nt),it=n(18),at=n(19),ot=n.n(at),st="Taucharts Export Plug-in:",ut=r.default.api.utils,lt=r.default.api.pluginsSDK,ct=lt.tokens(),ft=function(t,e){return t.replace(new RegExp("^"+e+"+|"+e+"+$","g"),"")},dt=function(t){return(t=Math.round(t))%2?t+1:t},ht=function(t){return null===t||""===t||void 0===t};var pt,gt={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},mt=function(t,e){e=e||"all";var n=document.createElement("style");return n.setAttribute("media",e),n.innerHTML=t,n},yt=mt(ot.a,"print"),vt=function(){yt&&yt.parentNode&&yt.parentNode.removeChild(yt),pt&&pt.parentNode&&pt.parentNode.removeChild(pt)};/PhantomJS/.test(navigator.userAgent)||("onafterprint"in window?window.addEventListener("afterprint",vt):window.matchMedia("screen").addListener(function(t){t.matches&&vt()}));var bt=function(t,e,n){var r="data:"+e+";charset=UTF-8,%ef%bb%bf"+encodeURIComponent(n),i=document.createElement("a");i.setAttribute("href",r),i.setAttribute("download",t),i.setAttribute("target","_new"),document.body.appendChild(i),i.click(),document.body.removeChild(i),i=null},xt=function(t){return[].slice.call(t.querySelectorAll("text.label")).forEach(function(t){t.innerHTML=[].slice.call(t.querySelectorAll("tspan")).reduce(function(t,e){var n=e.value||e.text||e.textContent||"";return t+(n=n.charAt(0).toUpperCase()+n.substr(1))},"")}),t},_t=function(t,e,n){n=null==n?"":String(n);var r=(t||{})[e]||{};return(ut.isObject(r.label)?r.label.text:r.label)||n};function wt(t){return{onRender:function(){this._info=lt.extractFieldsFormatInfo(this._chart.getSpec())},_normalizeExportFields:function(t,e){var n=this._info;return t.map(function(t){var e=t,r=n[t]||{};return"string"==typeof t&&(e={field:t,title:r.label||t}),"function"!=typeof e.value&&(e.value=function(t){var e=t[this.field];return r.isComplexField?(e||{})[r.tickLabel]:e}),e}).filter(function(t){return!e.find(function(e){return t.field===e})})},_handleError:function(t){r.default.api.globalSettings.log([st,t],"error")},_createDataUrl:function(t,e){var n=this;(function(){for(var t=[],e=0;e=200&&n.status<300){var t=n.responseText;i[e]=t,a.splice(a.indexOf(n),1),0===a.length&&r(null,i)}else a.forEach(function(t){return t.abort()}),r(new Error(n.status+": "+n.statusText),null)},n.onerror=function(t){a.forEach(function(t){return t.abort()}),r(t.error,null)},n.open("GET",t,!0),n.send(null)})}).apply(void 0,this._cssPaths.concat([function(i,a){if(i)e(i,null);else try{var o=a.join(" ").replace(/&/g,""),s=mt(o),u=document.createElement("div");t.fire("beforeExportSVGNode");var l=t.getSVG().cloneNode(!0);t.fire("afterExportSVGNode"),u.appendChild(xt(l)),h.select(l).attr("version",1.1).attr("xmlns","http://www.w3.org/2000/svg"),l.insertBefore(s,l.firstChild),n._renderAdditionalInfo(l,t),n._addBackground(l,n._backgroundColor);var c=document.createElement("canvas");c.height=l.getAttribute("height"),c.width=l.getAttribute("width"),rt()(c,l.parentNode.innerHTML,{renderCallback:function(t){var n=(new XMLSerializer).serializeToString(t);"=0}))?'"'+a+'"':a}return t.concat(i)},[]).join(e))},[o.map(function(t){return t.title}).join(e)]).join("\r\n"),u=(this._fileName||"export")+".csv";bt(u,"text/csv",s)},_renderFillLegend:function(e,n,r,i){var a=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=ut.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},o=this._unit.getScale("color"),s=_t(e.guide,"color",o.dim).toUpperCase(),u="text-transform:uppercase;font-weight:600;font-size:"+t.fontSize+"px",l=o.domain().sort(function(t,e){return t-e}),c=o.brewer.length,f=t.fontSize,d=a(l,c).reverse().map(function(t,e){return''}),h=a(l,3).reverse().map(function(t,e,n){return''+t+""}),p=[''," ",' ',d.join("")," "," ",' '+s+"",' ',' '," ",h.join("")," "," Sorry, your browser does not support inline SVG.",""].join(""),g=(new DOMParser).parseFromString(p,"application/xml").documentElement;return document.body.appendChild(g),n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")").node().appendChild(g),{h:120,w:0}},_renderColorLegend:function(e,n,r,i){var a=this._unit.getScale("color"),o=_t(e.guide,"color",a.dim).toUpperCase(),s=this._getColorMap(r.getChartModelData({excludeFilter:["legend"]}),a,a.dim).values,u=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+t.paddingTop+")");return u.append("text").text(o.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":t.fontSize+"px"}),u.selectAll("g").data(s).enter().append("g").call(function(e){e.attr("transform",function(t,e){return"translate(5,"+20*(e+1)+")"}),e.append("circle").attr("r",6).attr("fill",function(t){return a.toColor(t.color)}).attr("class",function(t){return a.toClass(t.color)}),e.append("text").attr("x",12).attr("y",5).text(function(t){return ut.escape(ht(t.label)?"No "+o:t.label)}).style({"font-size":t.fontSize+"px"})}),{h:20*s.length,w:0}},_renderSizeLegend:function(e,n,r,i,a){var o,s=this._unit.getScale("size"),u=_t(e.guide,"size",s.dim).toUpperCase(),l=r.getChartModelData().sort(function(t,e){return s(t[s.dim])-s(e[s.dim])}),c=l.length,f=l[0][s.dim],d=l[c-1][s.dim];if(d-f){var h=function(t){return Math.log(t)/Math.LN10}(d-f),p=4-h<0?0:Math.round(4-h),g=Math.pow(10,p),m=(d-f)/5;o=ut.unique([f,f+m,f+2*m,f+3*m,d].map(function(t){return t===d||t===f?t:Math.round(t*g)/g}))}else o=[f];var y=o.map(function(t){var n=s(t),r=n/2;return{diameter:dt(n+2),radius:r,value:t,className:e.color?"color-definite":""}}.bind(this)).reverse(),v=Math.max.apply(null,y.map(function(t){return t.diameter})),b=t.fontSize,x=0,_=n.append("g").attr("class","legend").attr("transform","translate("+(i+10)+","+(t.paddingTop+a.h+20)+")");_.append("text").text(u.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":b+"px"}),_.selectAll("g").data(y).enter().append("g").call(function(t){t.attr("transform",function(){var t="translate(5,"+(x+=v)+")";return x+=10,t}),t.append("circle").attr("r",function(t){return t.radius}).attr("class",function(t){return t.className}).style({opacity:.4}),t.append("g").attr("transform",function(){return"translate("+v+","+b/2+")"}).append("text").attr("x",0).attr("y",0).text(function(t){return t.value}).style({"font-size":b+"px"})})},_renderAdditionalInfo:function(t,e){var n=this._findUnit(e);if(n){var r={h:0,w:0};t=h.select(t);var i=parseInt(t.attr("width"),10);t.attr("height");t.attr("width",i+160);var a=e.getScaleInfo(n.color);if(a.dim&&!a.discrete){var o=this._renderFillLegend(n,t,e,i);r.h=o.h+20,r.w=o.w}if(a.dim&&a.discrete){var s=this._renderColorLegend(n,t,e,i);r.h=s.h+20,r.w=s.w}var u=e.getScaleInfo(n.size);u.dim&&!u.discrete&&this._renderSizeLegend(n,t,e,i,r)}},_addBackground:function(t,e){if(e&&"transparent"!==e){var n=document.createElementNS("http://www.w3.org/2000/svg","rect");n.setAttribute("fill",e),n.setAttribute("x",0),n.setAttribute("y",0),n.setAttribute("width",t.getAttribute("width")),n.setAttribute("height",t.getAttribute("height")),t.insertBefore(n,t.firstChild)}},onUnitDraw:function(t,e){r.default.api.isChartElement(e)&&"chart"===e.config.namespace&&(this._unit=e)},_getColorMap:function(t,e,n){return ut.unique(t.map(function(t){var r=t[n];return{color:e(r),value:r,label:r}}),function(t){return t.value}).reduce(function(t,e){return t.brewer[e.value]=e.color,t.values.push(e),t},{brewer:{},values:[]})},_select:function(t,e){var n=this["_to"+(t=t||"").charAt(0).toUpperCase()+t.slice(1)];n&&n.call(this,e)},_handleMenu:function(t,e,n){t.addEventListener("click",function(t){if("a"===t.target.tagName.toLowerCase()){var r=t.target.getAttribute("data-value");this._select(r,e),n.hide()}}.bind(this)),t.addEventListener("mouseover",function(t){"a"===t.target.tagName.toLowerCase()&&t.target.focus()}.bind(this)),t.addEventListener("keydown",function(t){if(t.keyCode===gt.ESCAPE&&n.hide(),t.keyCode===gt.DOWN&&(t.target.parentNode.nextSibling?t.target.parentNode.nextSibling.childNodes[0].focus():t.target.parentNode.parentNode.firstChild.childNodes[0].focus()),t.keyCode===gt.UP&&(t.target.parentNode.previousSibling?t.target.parentNode.previousSibling.childNodes[0].focus():t.target.parentNode.parentNode.lastChild.childNodes[0].focus()),t.keyCode===gt.ENTER){var r=t.target.getAttribute("data-value");this._select(r,e)}t.preventDefault()}.bind(this));var r=null,i=function(){r=setTimeout(function(){n.hide()},100)},a=function(){clearTimeout(r)},o=function(){n.toggle(),n.hidden||t.querySelectorAll("a")[0].focus()};t.addEventListener("blur",i,!0),t.addEventListener("focus",a,!0),this._container.addEventListener("click",o),this._onDestroy(function(){t.removeEventListener("blur",i,!0),t.removeEventListener("focus",a,!0),this._container.removeEventListener("click",o),clearTimeout(r)})},init:function(e){t=t||{},t=ut.defaults(t,{backgroundColor:"white",visible:!0,fontSize:13,paddingTop:30}),this._chart=e,this._info={},this._cssPaths=t.cssPaths,this._fileName=t.fileName,this._backgroundColor=t.backgroundColor||"white",this._destroyListeners=[],this._csvSeparator=t.csvSeparator||",",this._exportFields=t.exportFields||[],this._appendFields=t.appendFields||[],this._excludeFields=t.excludeFields||[],this._cssPaths||(this._cssPaths=[],r.default.api.globalSettings.log('[export plugin]: the "cssPath" parameter should be specified for correct operation',"warn"));var n=t.visible?"":"display:none";this._container=e.insertToHeader('Export');var i=e.addBalloon({place:"bottom-left"});i.content(['"].join("")),i.attach(this._container);var a=i.getElement();a.setAttribute("tabindex","-1"),this._handleMenu(a,e,i);var o=e.on("export-to",function(t,e){var n=e.type,r=e.fileName;this._fileName=r||this._fileName,this._select(n,t)}.bind(this)),s=e.on("exportTo",function(t,e){r.default.api.globalSettings.log([st,"`exportTo` event is deprecated, use `export-to` instead."],"warn"),this._select(e,t)}.bind(this));this._onDestroy(function(){i.destroy(),e.removeHandler(o),e.removeHandler(s)})},_onDestroy:function(t){this._destroyListeners.push(t)},destroy:function(){this._destroyListeners.forEach(function(t){t.call(this)},this);!function(t){t&&t.parentElement&&t.parentElement.removeChild(t)}(this._container)}}}r.default.api.plugins.add("export-to",wt);var Et=function(){return(Et=Object.assign||function(t){for(var e,n=1,r=arguments.length;n=0&&e.x.push(t),n.indexOf("y")>=0&&e.y.push(t),this};var o=function(){var t=i.scrollLeft,o=i.scrollTop;a.forEach(function(e){e.call(null,t,o)});var u=function(i){var a="x"===i?t:o;a!==n[i]&&(clearTimeout(r[i]),s(e[i],function(t){t.transition("floatingAxes_scrollVisibility"),t.attr("opacity",1e-6)}),r[i]=setTimeout(function(){s(e[i],function(t){r[i]=null,t.transition("floatingAxes_scrollVisibility").duration(256).attr("opacity",1)})},128)),n[i]=a};u("x"),u("y")};function s(t,e,n){t.forEach(function(t){e.call(n,t)})}i.addEventListener("scroll",o),this.fireScroll=function(){o.call(null,i.scrollLeft,i.scrollTop)},this.destroy=function(){i.removeEventListener("scroll",o)}}(n),u=function(){var t=function(t){var e="> ."+t+".axis.tau-active";return[".frame-root.tau-active "+e,".frame-root.tau-active .cell.tau-active "+e].join(", ")};return{x:Array.from(i.querySelectorAll(t("x"))),y:Array.from(i.querySelectorAll(t("y")))}}(),l=function(){function t(t){return{axis:t,parentTransform:function(t){var e,n={translate0:{x:0,y:0},translate:{x:0,y:0}},r=t;for(;r&&"SVG"!==r.nodeName.toUpperCase();)e=Bt(r),n.translate0.x+=e.translate0.x,n.translate0.y+=e.translate0.y,n.translate.x+=e.translate.x,n.translate.y+=e.translate.y,r=r.parentNode;return n}(t.parentNode),axisTransform:Bt(t)}}return{x:u.x.map(t),y:u.y.map(t)}}(),c=function(t){return Math.max.apply(null,t)}(l.y.map(function(t){return t.axisTransform.translate.x+t.parentTransform.translate.x}))+1,f=function(t){return Math.min.apply(null,t)}(l.x.map(function(t){return t.axisTransform.translate.y+t.parentTransform.translate.y}))-1,d=r.default.api.globalSettings.getScrollbarSize(n);var p={scrollLeft:n.scrollLeft,scrollTop:n.scrollTop,visibleWidth:n.clientWidth,visibleHeight:n.clientHeight,scrollbarWidth:d.width,scrollbarHeight:d.height,svgWidth:Number(a.attr("width")),svgHeight:Number(a.attr("height")),minXAxesY:f,maxYAxesX:c},g=function(){var e=a.append("defs").attr("class","floating-axes floating-axes__defs"),n={ns:{x1:0,y1:0,x2:0,y2:1},ew:{x1:1,y1:0,x2:0,y2:0},sn:{x1:0,y1:1,x2:0,y2:0},we:{x1:0,y1:0,x2:1,y2:0}};return Object.keys(n).forEach(function(r){var i=n[r],a=e.append("linearGradient").attr("id","shadow-gradient-"+r+"-"+t).attr("x1",i.x1).attr("y1",i.y1).attr("x2",i.x2).attr("y2",i.y2);a.append("stop").attr("class","floating-axes__shadow-start").attr("offset","0%").attr("stop-color",At).attr("stop-opacity",Ot),a.append("stop").attr("class","floating-axes__shadow-end").attr("offset","100%").attr("stop-color",kt).attr("stop-opacity",Pt)}),e}();function m(t,e){e.forEach(function(e){e.axis[Lt]=e.axis.parentNode;var n=t.append("g");o?n.attr("transform",jt(e.parentTransform.translate0.x,e.parentTransform.translate0.y)).transition().duration(o).attr("transform",jt(e.parentTransform.translate.x,e.parentTransform.translate.y)):n.attr("transform",jt(e.parentTransform.translate.x,e.parentTransform.translate.y)),n.node().appendChild(e.axis),Array.prototype.forEach.call(e.axis.querySelectorAll(".label"),function(t){t[Rt]=t.getAttribute("transform")})})}var y=function(){var t=p.svgHeight-p.minXAxesY+1+p.scrollbarHeight,e=a.append("g").attr("class","floating-axes floating-axes__x").call(x,p.svgWidth,t,0,p.minXAxesY);m(e,l.x);var n=e.selectAll(".label");return s.handleVisibilityFor(e,"y").handleVisibilityFor(n,"x").onScroll(function(t,r){var i=Math.min(p.visibleHeight+r-p.svgHeight-p.scrollbarHeight,0);e.attr("transform",jt(0,i)),n.each(function(){var e=zt(this[Rt]),n=-p.svgWidth+p.visibleWidth+t-10;this.setAttribute("transform","translate("+(e.x+n)+","+e.y+") rotate("+e.r+")")})}),e}(),v=function(){var t=a.append("g").attr("class","floating-axes floating-axes__y").call(x,p.maxYAxesX,p.svgHeight);m(t,l.y);var e=t.selectAll(".label");return s.handleVisibilityFor(t,"x").handleVisibilityFor(e,"y").onScroll(function(n,r){var i=Math.max(n,0);t.attr("transform",jt(i,0)),e.each(function(){var t=zt(this[Rt]),e=r+10;this.setAttribute("transform","translate("+t.x+","+(t.y+e)+") rotate("+t.r+")")})}),t}(),b=function(){var t=p.svgHeight-p.minXAxesY+p.scrollbarHeight,e=a.append("g").attr("class","floating-axes floating-axes__corner").call(x,p.maxYAxesX,t);return s.handleVisibilityFor(e,"xy").onScroll(function(n,r){var i=Math.max(n,0),a=p.minXAxesY,o=Math.min(r+p.visibleHeight-t,a);e.attr("transform",jt(i,o))}),e}();function x(t,n,r,i,a){i=i||0,a=a||0,t.append("rect").attr("class","i-role-bg").attr("x",i-1).attr("y",a-1).attr("width",Math.max(0,n+2)).attr("height",Math.max(0,r+2)).attr("fill",e.bgcolor)}var _=function(){var e=p.maxYAxesX,n=p.svgHeight-p.minXAxesY+p.scrollbarHeight,r=a.append("g").attr("class","floating-axes floating-axes__shadows").attr("pointer-events","none"),i=function(e,n,i,a,o){return r.append("rect").attr("fill","url(#shadow-gradient-"+e+"-"+t+")").attr("x",n).attr("y",i).attr("width",Math.max(0,a)).attr("height",Math.max(0,o))},o=i("ns",0,0,e,Ct),u=i("ew",p.visibleWidth-Ct,p.visibleHeight-n,Ct,n),l=i("sn",0,p.visibleHeight-n-Ct,e,Ct),c=i("we",e,p.visibleHeight-n,Ct,n);s.handleVisibilityFor(o,"xy").handleVisibilityFor(u,"xy").handleVisibilityFor(l,"xy").handleVisibilityFor(c,"xy").onScroll(function(t,e){var n=t,i=e;r.attr("transform",jt(n,i));var a=function(t,e){t.style("visibility",e?"":"hidden")};a(o,e>0&&p.svgHeight>p.visibleHeight),a(u,t+p.visibleWidthp.visibleWidth),a(l,e+p.visibleHeightp.visibleHeight),a(c,t>0&&p.svgWidth>p.visibleWidth)})}(),w=y.node(),E=v.node(),S=b.node();s.onScroll(function(t){i.insertBefore(w,0===t?S.nextElementSibling:E)}),s.fireScroll(),this.floatingLayout={defs:g,xAxes:y,yAxes:v,shadows:_},a.selectAll(".floating-axes").on("mouseenter",function(){Mt.dispatchMouseEvent(i,"mouseleave")}).on("mousemove",function(){h.event.stopPropagation()}).on("click",function(){h.event.stopPropagation()})},removeFloatingLayout:function(){function t(t){t.selectAll(".axis").each(function(){this[Lt].appendChild(this),delete this[Lt],Array.prototype.forEach.call(this.querySelectorAll(".label"),function(t){t.setAttribute("transform",t[Rt]),delete t[Rt]})})}this.floatingLayout&&(this.floatingLayout.xAxes.call(t),this.floatingLayout.yAxes.call(t),this.scrollManager.destroy(),this.floatingLayout=null),St.select(this.chart.getSVG()).selectAll(".floating-axes").remove()},detectChartBackgroundColor:function(){var t,e=this.chart.getLayout().layout;do{if("none"!==(t=window.getComputedStyle(e)).backgroundImage)return null;if("transparent"!==t.backgroundColor&&"rgba(0, 0, 0, 0)"!==t.backgroundColor)return t.backgroundColor}while(e=e.parentElement);return null}}}function jt(t,e){return"translate("+t+","+e+")"}function zt(t){var e={x:0,y:0,r:0};if(!t)return e;var n=t.indexOf("translate(");if(n>=0){var r=t.indexOf(")",n+10),i=t.substring(n+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(i[0]),i.length>1&&(e.y=parseFloat(i[1]))}var a=t.indexOf("rotate(");if(a>=0){var o=t.indexOf(")",a+7),s=t.substring(a+7,o);e.r=parseFloat(s.trim())}return e}function Bt(t){var e=t[Nt]&&t[Nt].transform,n=zt(t.getAttribute("transform"));return{translate0:n,translate:e?zt(t[Nt].transform):n}}r.default.api.plugins.add("floating-axes",It);var Vt=r.default.api.utils;function Ht(t){Vt.defaults(t||{},{});var e=function(t,e,n,r){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains(n)&&r(t,e),e=e.parentNode})};return{init:function(t){this._chart=t,this._currentFilters={},this._legendColorByScaleId={};var n=this._chart.getSpec(),r=function(t){return function(e,r){var i=n.scales[r];return i.type===t&&i.dim&&e.push(r),e}};this._color=Object.keys(n.scales).reduce(r("color"),[]),this._fill=Object.keys(n.scales).reduce(r("fill"),[]);var i=this._color.length>0,a=this._fill.length>0;(i||a)&&(this._container=this._chart.insertToRightSidebar(this._containerTemplate),i&&(e(this._container,"click","tau-chart__legend__item-color",function(t,e){this._toggleLegendItem(e)}.bind(this)),e(this._container,"mouseover","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!0)}.bind(this)),e(this._container,"mouseout","tau-chart__legend__item-color",function(t,e){this._highlightToggle(e,!1)}.bind(this))))},onSpecReady:function(){this._assignStaticBrewersOrEx()},onRender:function(){this._clearPanel(),this._drawColorLegend(),this._drawFillLegend()},_containerTemplate:'
',_template:Vt.template('
<%=name%>
<%=items%>
'),_itemTemplate:Vt.template(["
\">",'
','
',"
","<%=label%>","
"].join("")),_itemFillTemplate:Vt.template(['
\' class="tau-chart__legend__item tau-chart__legend__item-color" style="padding: 6px 0px 10px 40px;margin-left:10px;">','
',' ',' <%=label%>',"
","
"].join("")),_clearPanel:function(){this._container&&(this._container.innerHTML="")},_drawColorLegend:function(){var t=this;t._color.forEach(function(e){var n=t._chart.select(function(t){return t.config.color===e})[0];if(n){var r=n.getScale("color"),i=t._chart.getDataSources({excludeFilter:["legend"]}),a=Vt.unique(i[r.source].data.map(function(t){return t[r.dim]})).map(function(n){var i=Vt.escape(n),a=r.dim+i;return{scaleId:e,dim:r.dim,color:r(n),disabled:t._currentFilters.hasOwnProperty(a),label:n,value:i}});t._legendColorByScaleId[e]=a,t._container.insertAdjacentHTML("beforeend",t._template({items:a.map(function(e){return t._itemTemplate({scaleId:e.scaleId,dim:e.dim,color:e.color,classDisabled:e.disabled?"disabled":"",label:e.label,value:e.value})}).join(""),name:(((n.guide||{}).color||{}).label||{}).text||r.dim}))}})},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n=t._chart.select(function(t){return"COORDS.MAP"===t.config.type&&t.config.fill===e});if(n.length>0){var r=n[0].getScale("fill"),i=r.brewer,a=r.domain(),o=(a[1]-a[0])/i.length,s=Vt.range(i.length).map(function(e){var n=a[0]+e*o,s="";return 0===e&&(s=a[0]),e===i.length-1&&(s=a[1]),t._itemFillTemplate({color:r(n),label:s,value:Vt.escape(n)})});t._container.insertAdjacentHTML("beforeend",t._template({items:s.join(""),name:(((n[0].guide||{}).fill||{}).label||{}).text||r.dim}))}})},_toggleLegendItem:function(t){var e=t.getAttribute("data-scale-id"),n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=n+r,a=this._legendColorByScaleId[e].filter(function(t){return!t.disabled});if(1!==a.length||e!==a[0].scaleId||r!==a[0].value){var o=this._currentFilters;if(o.hasOwnProperty(i)){var s=o[i];delete o[i],t.classList.remove("disabled"),this._chart.removeFilter(s)}else t.classList.add("disabled"),o[i]=this._chart.addFilter({tag:"legend",predicate:function(t){return t[n]!=r}});this._chart.refresh()}},_highlightToggle:function(t,e){var n=t.getAttribute("data-scale-id"),r=t.getAttribute("data-dim"),i=t.getAttribute("data-value");this._chart.select(function(t){return t.config.color===n}).forEach(function(t){t.fire("highlight",function(t){return!e||t[r]==i})})},_generateColorMap:function(t){var e=Vt.range(20).map(function(t){return"color20-"+(1+t)});return t.reduce(function(t,n,r){return t[n]=e[r%20],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();n.brewer||(n.brewer="measure"!==n.dimType?t._generateColorMap(i):["#e5f5e0","#a1d99b","#31a354"])})}}}r.default.api.plugins.add("geomap-legend",Ht);var Wt=r.default.api.utils;function Gt(t){Wt.defaults(t||{},{});var e=function(){return!1};return{init:function(t){this._currNode=null,this._currData=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&(n._exclude(),n._tooltip.hide(),n._blurSelection()),e=e.parentNode},!1);var e,n=this;this._showTooltip=function(t){clearTimeout(e),n._currData=t.data;var r="No data";null!==t.data&&(r=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join(""));var i=n._tooltip.getElement().querySelectorAll(".i-role-content");i[0]&&(i[0].innerHTML=r);var a=n._tooltip.getElement().querySelectorAll(".i-role-exclude");if(a[0]){var o=t.data&&n._chart.getChartModelData().length>1;a[0].style.visibility=o?"visible":"hidden"}n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this._hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},t?0:1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._hideTooltip(!0),n._blurSelection()},!1)},onRender:function(){var t=this;this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(e){t._subscribeToPoints(e),t._subscribeToArea(e)})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:Wt.template(['
','
<%=label%>
','
<%=value%>
',"
"].join("")),_exclude:function(){this._chart.addFilter({tag:"exclude",predicate:function(t){return function(e){return JSON.stringify(e)!==JSON.stringify(t)}}(this._currData)}),this._chart.refresh()},_blurSelection:function(){this._chart.select(function(t){return"COORDS.MAP"===t.config.type}).forEach(function(t){t.fire("highlight-area",e)}),this._currNode=null,this._currData=null},_subscribeToPoints:function(t){var e=this;t.on("point-mouseover",function(t,n){e._showTooltip(n)}),t.on("point-mouseout",function(t,n){e._hideTooltip()})},_subscribeToArea:function(t){var e=this;!t.getScale("code").dim||t.on("area-click",function(n,r){e._currNode=n,r.data?e._currData===r.data?(e._hideTooltip(!0),e._blurSelection()):(t.fire("highlight-area",function(t){var e=JSON.stringify(t);return function(t){return JSON.stringify(t)===e}}(r.data)),e._showTooltip(r)):(e._showTooltip(r),e._hideTooltip(!1),e._blurSelection())})}}}r.default.api.plugins.add("geomap-tooltip",Gt);var Ut=n(2),Xt=r.default.api.utils,qt=r.default.api.pluginsSDK,Yt=qt.tokens();function $t(t){var e=Xt.defaults(t||{},{title:"Layers",label:"Layer Type",showPanel:!0,showLayers:!0,mode:"merge",axisWidth:45,layers:[]});e.layers.forEach(function(t){t.guide=Xt.defaults(t.guide||{},{scaleOrient:"left",textAnchor:"end",hide:!1})});var n=function(t){return function(e){return Object.assign(e,t)}},r={line:n({type:"ELEMENT.LINE"}),area:n({type:"ELEMENT.AREA"}),dots:n({type:"ELEMENT.POINT"}),scatterplot:n({type:"ELEMENT.POINT"}),bar:n({type:"ELEMENT.INTERVAL"}),"stacked-bar":n({type:"ELEMENT.INTERVAL",stack:!0})};return{init:function(t){this._chart=t;var n=qt.spec(this._chart.getSpec()),r=this.checkIfApplicable(n);if(this._isApplicable=0===r.length,n.addTransformation("defined-only",function(t,e){var n=e.key;return t.filter(function(t){return null!==t[n]&&void 0!==t[n]})}),this._isApplicable){this.isFacet=this.checkIsFacet(n),this.primaryY=this.findPrimaryLayer(n);var i=this.getLayersText(),a=this.getLayersGroup(),o=e.label;this.fieldColorScale=o,n.setSettings("excludeNull",!1).setSettings("fitModel",null).addScale(o,{type:"color",source:"/",dim:o,brewer:e.brewer}).addTransformation("slice-layer",function(t,e){var n=e.key,r=e.group;return r?t.filter(function(t){var e=t[r],n=t[e];return e&&null!==n&&void 0!==n}):t.filter(function(t){return t[o]===i[n]&&null!==t[n]&&void 0!==t[n]})});var s=[this.primaryY].concat(e.layers).reduce(function(t,e){return t.concat(e.y)},[]);t.setupChartSourceModel(function(t){var e={};e[o]={type:"category"};var n={"/":{dims:e,data:[]}};return n["/"].dims=Object.assign(e,t["/"].dims),n["/"].data=t["/"].data.reduce(function(t,e){return t.concat(s.map(function(t){var n={};n[o]=i[t];var r=a[t];return r&&(n[r]=e[t],n.subLayer=r),Object.assign(n,e)}))},[]),Object.assign(n,Xt.omit(t,"/"))}),e.showPanel&&(this._container=t.insertToRightSidebar(this.containerTemplate),this._container.classList.add("applicable-true"),this.uiChangeEventsDispatcher=function(t){var n=t.target,r=n.classList;r.contains("i-role-show-layers")&&(e.showLayers=n.checked),r.contains("i-role-change-mode")&&(e.mode=n.value),this._chart.refresh()}.bind(this),this._container.addEventListener("change",this.uiChangeEventsDispatcher,!1))}else{n.getSettings("log")("[layers plugin]: is not applicable. "+r.join(" / "))}},getLayersText:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){return(Array.isArray(e.y)?e.y:[e.y]).reduce(function(t,n){return t[n]=this.extractLabelForKey(e,n),t}.bind(this),t)}.bind(this),{})},getLayersGroup:function(){return[this.primaryY].concat(e.layers).reduce(function(t,e){var n=null;return Array.isArray(e.y)&&(n=e.y.join(", ")),Xt.flatten([e.y]).reduce(function(t,e){return t[e]=n,t},t)}.bind(this),{})},checkIsFacet:function(t){return t.unit().reduce(function(t,e,n){return t||(n&&"COORDS.RECT"===n.type&&"COORDS.RECT"===e.type?t=!0:t)},!1)},checkIfApplicable:function(t){return t.unit().reduce(function(e,n,r){if(r&&"COORDS.RECT"!==r.type)return e.concat("Chart specification contains non-rectangular coordinates");if(r&&"COORDS.RECT"===r.type&&"COORDS.RECT"!==n.type){var i=t.getScale(n.y);if("measure"!==t.getSourceDim(i.source,i.dim).type)return e.concat("Y scale is not a measure")}return e},[])},isLeafElement:function(t,e){return e&&"COORDS.RECT"===e.type&&"COORDS.RECT"!==t.type},isFirstCoordNode:function(t,e){return!e&&t&&"COORDS.RECT"===t.type},isFinalCoordNode:function(t,e){return t&&"COORDS.RECT"===t.type&&t.units.every(function(t){return"COORDS.RECT"!==t.type})},buildLayersLayout:function(t){return t.regSource("$",{dims:{x:{type:"category"},y:{type:"category"}},data:[{x:1,y:1}]}).addScale("xLayoutScale",{type:"ordinal",source:"$",dim:"x"}).addScale("yLayoutScale",{type:"ordinal",source:"$",dim:"y"}).unit({type:"COORDS.RECT",x:"xLayoutScale",y:"yLayoutScale",expression:{source:"$",inherit:!1,operator:!1},guide:{showGridLines:"",x:{cssClass:"facet-axis"},y:{cssClass:"facet-axis"}}})},findPrimaryLayer:function(t){var e=this,n=t.unit().reduce(function(n,r){return n.concat(e.isFinalCoordNode(r)?{y:t.getScale(r.y).dim,isPrimary:!0,guide:r.guide.y,scaleName:r.y}:[])},[]);return qt.cloneObject(n[0])},createPrimaryUnitReducer:function(t,n,r,i){var a=this;return function(o,s,u){var l=function(t){return!0!==t.guide.hide};if(a.isFacet&&a.isFirstCoordNode(s,u)){s.guide.y.label=s.guide.y.label||{};var c=s.guide.y.label._original_text||s.guide.y.label.text;s.guide.y.label.text=[c,n.filter(l).map(a.extractLayerLabel.bind(a)).join(", ")].join(t.getSettings("facetLabelDelimiter")),"dock"===e.mode&&(s.guide.y.label.padding-=15,s.guide.y.padding+=15,s.guide.y.rotate=-90,s.guide.y.textAnchor="middle")}return a.isLeafElement(s,u)&&(u.units=u.units.filter(function(t){return t!==s})),a.isFinalCoordNode(s)&&(s.guide.y.label=s.guide.y.label||{},"dock"===e.mode&&(s.guide.padding.l=r,s.guide.padding.r=i,s.guide.y.hide=!0),"merge"===e.mode&&(s.guide.y.label.text=a.isFacet?"":n.filter(l).map(a.extractLayerLabel.bind(a)).join(", "))),o}},createSecondaryUnitReducer:function(t,n,i,a,o,s,u,l){var c=this,f=c.getScaleName(n.scaleName||n.y),d=n.guide.scaleOrient,h=Array.isArray(n.y),p=n.isPrimary;return function(g,m,y){if(c.isFacet&&c.isFirstCoordNode(m,y)&&(m.guide.y.label.text="",m.guide.x.hide=!0,m.guide.y.hide=!0),c.isLeafElement(m,y)){(n.type?r[n.type]:function(t){return t})(m),m.y=f;var v=t.getScale(m.size).dim;if(p&&v);else{var b="size_null"+l;t.addScale(b,{type:"size",source:"?",mid:1}),m.size=b}var x=t.getScale(m.color).dim;p&&x||(m.color=c.fieldColorScale,m.expression.operator="groupBy",m.expression.params=h?["subLayer"]:[c.fieldColorScale]);var _=h?{group:"subLayer"}:{key:n.y};qt.unit(m).addTransformation("slice-layer",_)}if(c.isFinalCoordNode(m)){if(m.y=f,m.guide.y=Object.assign(m.guide.y,n.guide||{}),m.guide.y.label=m.guide.y.label||{},m.guide.y.label.text=c.extractLayerLabel(n),m.guide.x.hide=!0,"dock"===e.mode){m.guide.showGridLines="",m.guide.padding.l=i,m.guide.padding.r=a,m.guide.y.label.textAnchor="end",m.guide.y.label.dock="right",m.guide.y.label.padding="right"===d?1:-10,m.guide.y.label.cssClass="label inline";var w="right"===d?u:s;m.guide.y.padding+=o*w}"merge"===e.mode&&(m.guide.showGridLines="",m.guide.y.hide=!0)}return g}},getScaleName:function(t){return Array.isArray(t)?t.join(", "):t},extractLabelForKey:function(t,e){var n=t.guide||{};n.label="string"==typeof n.label?{text:n.label}:n.label;var r=n.label||{},i=r.byKeys||{};return Array.isArray(t.y)?i[e]||e:r.text||r._original_text||t.y},extractLayerLabel:function(t){var e=this;return(Array.isArray(t.y)?t.y:[t.y]).map(function(n){return e.extractLabelForKey(t,n)}).join(", ")},onSpecReady:function(t,n){var r=this,i=qt.spec(n);if(e.showLayers&&r._isApplicable){i=e.layers.reduce(function(t,e){var n=r.getScaleName(e.y);return t.addScale(n,Object.assign({type:"linear",source:"/",dim:n,autoScale:!0},Xt.pick(e.guide||{},"min","max","autoScale","nice","niceInterval")))},i);var a,o=[this.primaryY].concat(e.layers).sort(function(t,e){return(t.guide.zIndex||0)-(e.guide.zIndex||0)}),s=i.unit(),u=e.axisWidth,l=function(t){return function(e){var n=e.guide.scaleOrient||"left";return!0!==e.guide.hide&&n===t}},c=l("left"),f=l("right"),d=o.filter(c).length*u,h=o.filter(f).length*u,p=r.buildLayersLayout(i).addFrame({key:{x:1,y:1},units:[(a=qt.unit(s.clone())).reduce(r.createPrimaryUnitReducer(i,o,d,h),a).value()]}),g=-1,m=-1;o.reduce(function(t,e,n){return g=c(e)?g+1:g,m=f(e)?m+1:m,t.addFrame({key:{x:1,y:1},units:[(a=qt.unit(s.clone())).reduce(r.createSecondaryUnitReducer(i,e,d,h,u,g,m,n),a).value()]})},p)}else i.unit().traverse(function(t,e){r.isLeafElement(t,e)&&qt.unit(t).addTransformation("defined-only",{key:i.getScale(t.y).dim})})},onUnitsStructureExpanded:function(){var t=this;if(t._isApplicable&&"merge"===e.mode){var n=qt.spec(t._chart.getSpec()),r=t.primaryY.scaleName,i=e.layers.map(function(e){return t.getScaleName(e.y)}).filter(function(t){return n.getScale(t)}).concat(r),a=i.reduce(function(e,n){var r=t._chart.getScaleInfo(n);return e[n]=r.domain().filter(function(t){return Number.isFinite(t)}),e},{}),o=Ut.extent(Xt.flatten(Object.keys(a).map(function(t){return a[t]})));i.forEach(function(t){var e=n.getScale(t);e.min=o[0],e.max=o[1],e.nice=!1})}},containerTemplate:'
',template:Xt.template(['","
",'","
"].join("")),onRender:function(){this._isApplicable&&e.showPanel&&(this._container.innerHTML=this.template({title:e.title,mode:e.mode,showLayers:e.showLayers}))}}}r.default.api.plugins.add("layers",$t);var Kt=n(6),Jt=r.default.api.utils,Qt=r.default.api.pluginsSDK,Zt=".tau-chart__legend__reset",te=".tau-chart__legend__item-color",ee=".tau-chart__legend__guide--color__overlay",ne=4,re=13,ie=0,ae=function(){return++ie},oe=r.default.api.utils.xml,se=function(t,e){var n=t[0],r=t[1],i=(r-n)/(e-1),a=Jt.range(e-2).map(function(t){return n+i*(t+1)});return[n].concat(a).concat(r)},ue=function(t,e,n){if(t.length<3)return t.slice(0);if(e<3)return[t[0],t[t.length-1]];var r,i=t[0]<0?Math.abs(t[0]):0,a=function(t){return t},o="sqrt"===n?function(t){return Math.sqrt(t+i)}:a,s="sqrt"===n?function(t){return Math.pow(t,2)-i}:a,u=[(t=t.map(o))[0]],l=t[t.length-1]-t[0],c=.5*l/(e-1),f=Jt.range(1,e-1).map(function(t){var n=l*t/(e-1);return{min:n-c,mid:n,max:n+c,diff:Number.MAX_VALUE,closest:null}}),d=0,h=function(){if(d!==f.length){var t=r;(r=f[d++]).min=Math.max(r.min,(t&&null!==t.closest?t.closest:u[0])+c)}};return h(),t.forEach(function(t){if(!(tr.max&&h();var e=Math.abs(t-r.mid);e0?Math.abs(e-t):n,a=ce(i),o=Math.abs(r-a);return Math.abs(r)>3&&o<=3?he:function(t){var e=ce(n-t),r=Math.min((a<0?Math.abs(a):0)+(e0,s=this._fill.length>0,u=this._size.length>0;if(this._assignStaticBrewersOrEx(),a||s||u){switch(n.position){case"left":this._container=this._chart.insertToLeftSidebar(this._containerTemplate);break;case"right":this._container=this._chart.insertToRightSidebar(this._containerTemplate);break;case"top":this._container=this._chart.insertToHeader(this._containerTemplate);break;case"bottom":this._container=this._chart.insertToFooter(this._containerTemplate);break;default:this._container=this._chart.insertToRightSidebar(this._containerTemplate)}a&&(o(this._container,"click",Zt,function(t,n){e._toggleLegendItem(n,"reset")}),o(this._container,"click",te,function(t,n){var r=t.ctrlKey||t.target.matches(ee)?"leave-others":"focus-single";e._toggleLegendItem(n,r)}),o(this._container,"mouseover",te,function(t,n){e._highlightToggle(n,!0)}),o(this._container,"mouseout",te,function(t,n){e._highlightToggle(n,!1)}))}},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])}),this._container&&this._container.parentElement&&(this._clearPanel(),this._container.parentElement.removeChild(this._container))},onSpecReady:function(t,e){this._formatters=Qt.getFieldFormatters(e,n.formatters)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:function(t){return String(t)}},onRender:function(){var t=this;if(e&&n.selectedCategories&&0!==n.selectedCategories.length){var r=this._getLegendColorByScales();return Object.keys(r).forEach(function(e){r[e].legendColorItems.forEach(function(e){var r=e.value,i=e.dim;if(-1===n.selectedCategories.indexOf(JSON.parse(r))){var o=i+r,s=a(i,r);t._currentFilters[o]=t._chart.addFilter({tag:"legend",predicate:function(t){return!s(t)}})}})}),e=!1,void this._chart.refresh()}this._clearPanel(),this._drawColorLegend(),this._drawFillLegend(),this._drawSizeLegend()},_containerTemplate:'
',_template:Jt.template(['
',"<%=top%>",'
<%=name%>
',"<%=items%>","
"].join("")),_itemTemplate:Jt.template(["
\">",'
','
','
',"
","
","
",' <%=label%>',"
"].join("")),_resetTemplate:Jt.template(['
','
Reset
',"
"].join("")),_clearPanel:function(){this._container&&(clearTimeout(this._scrollTimeout),this._getScrollContainer().removeEventListener("scroll",this._scrollListener),this._container.innerHTML="")},_drawFillLegend:function(){var t=this;t._fill.forEach(function(e){var n=t._chart.select(function(t){return t.config.color===e})[0];if(n){var r=n.config.guide||{},a=n.getScale("color"),o=a.domain().sort(function(t,e){return t-e}),s=i(o),u=s?o.map(Number):o,l=pe(u[0],u[u.length-1]),c=function(){var e=t._chart.getSpec(),n=Qt.extractFieldsFormatInfo(e)[a.dim].format;return n||(n=function(t){return new Date(t)}),function(t){return String(n(t))}}(),f=s?c:l,d=a.brewer.length,h=((r.color||{}).label||{}).text||a.dim,p=function(t){return t.length*re*.618},g=a.isInteger?(u[1]-u[0])%3==0?4:(u[1]-u[0])%2==0?3:2:3,m=se(u,g),y=(s?m.map(function(t){return new Date(t)}):m).map(f);y[0]===y[y.length-1]&&(y=[y[0]]),t._container.insertAdjacentHTML("beforeend",t._template({name:Jt.escape(h),top:null,items:'
'}));var v=t._container.lastElementChild.querySelector(".tau-chart__legend__gradient-wrapper"),b=v.getBoundingClientRect().width,x=!1;y.reduce(function(t,e){return t+p(e)},0)>b&&(y.length>1&&p(y[0])+p(y[y.length-1])>b?x=!0:y=[y[0],y[y.length-1]]);var _=x?function(){var t=-.382*re/2;return{width:b,height:120,barX:0,barY:0,barWidth:20,barHeight:120,textAnchor:"start",textX:Jt.range(g).map(function(){return 25}),textY:1===y.length?60+.618*re:y.map(function(e,n){var r=(y.length-1-n)/(y.length-1);return re*(1-r)+120*r+t})}}():function(){var t=p(y[0])/2,e=p(y[y.length-1])/2;return{width:b,height:28+re,barX:0,barY:0,barWidth:b,barHeight:20,textAnchor:"middle",textX:1===y.length?[b/2]:y.map(function(n,r){var i=r/(y.length-1);return t*(1-i)+(b-e)*i}),textY:Jt.range(g).map(function(){return 28+re})}}(),w=se(u,d).map(function(t,e){return oe("stop",{offset:e/(d-1)*100+"%",style:"stop-color:"+a(t)+';stop-opacity:1"'})}),E="legend-gradient-"+t.instanceId,S=oe.apply(void 0,["svg",{class:"tau-chart__legend__gradient",width:_.width,height:_.height},oe("defs",oe.apply(void 0,["linearGradient",{id:E,x1:"0%",y1:x?"100%":"0%",x2:x?"0%":"100%",y2:"0%"}].concat(w))),oe("rect",{class:"tau-chart__legend__gradient__bar",x:_.barX,y:_.barY,width:_.barWidth,height:_.barHeight,fill:"url(#"+E+")"})].concat(y.map(function(t,e){return oe("text",{x:_.textX[e],y:_.textY[e],"text-anchor":_.textAnchor},t)})));v.insertAdjacentHTML("beforeend",S)}})},_drawSizeLegend:function(){var t=this;t._size.forEach(function(e){var n=t._chart.select(function(t){return t.config.size===e})[0];if(n){var r=n.config.guide||{},i=n.getScale("size"),a=i.domain().sort(function(t,e){return t-e});if(!Array.isArray(a)||!a.every(isFinite))return;var o=((r.size||{}).label||{}).text||i.dim,s=a[0],u=a[a.length-1],l=[s];if(u-s){var c=le(u-s),f=Math.round(4-c),d=Math.pow(10,f),h=Jt.unique(t._chart.getDataSources({excludeFilter:["legend"]})[i.source].data.map(function(t){return t[i.dim]}).filter(function(t){return t>=s&&t<=u})).sort(function(t,e){return t-e}),p=ue(h,ne,i.funcType);l=Jt.unique(p.map(function(t){return Math.round(t*d)/d}))}var g=pe(l[0],l[l.length-1]),m=function(t){return t.length*re*.618};l.reverse();var y=l.map(i),v=Math.max.apply(null,y),b=l.map(g);t._container.insertAdjacentHTML("beforeend",t._template({name:Jt.escape(o),top:null,items:'
'}));var x=t._container.lastElementChild.querySelector(".tau-chart__legend__size-wrapper"),_=x.getBoundingClientRect().width,w=!1;(Math.max.apply(null,b.map(m))>_/4||1===b.length)&&(w=!0);var E=w?function(){for(var t=re,e=y[0]/2,n=y[y.length-1]/2,r=[e],i=1,a=void 0,o=void 0;i0&&(t._updateResetButtonPosition(),t._scrollTimeout=null,t._scrollListener=function(){var e=t._container.querySelector(Zt);e.style.display="none",t._scrollTimeout&&clearTimeout(t._scrollTimeout),t._scrollTimeout=setTimeout(function(){t._updateResetButtonPosition(),e.style.display="",t._scrollTimeout=null},250)},t._getScrollContainer().addEventListener("scroll",t._scrollListener))},_toggleLegendItem:function(t,e){var r=this,i=this._currentFilters,o=t?Array.prototype.filter.call(t.parentNode.childNodes,function(t){return t.matches(te)}):null,s=function(t){var e=t.getAttribute("data-dim"),n=t.getAttribute("data-value");return{sid:t.getAttribute("data-scale-id"),dim:e,val:n,key:e+n}},u=function(t){return t in i},l=function(t,e){var n=s(t);if(u(n.key)===e)if(e){var o=i[n.key];delete i[n.key],t.classList.remove("disabled"),r._chart.removeFilter(o)}else{t.classList.add("disabled");var l=a(n.dim,n.val);i[n.key]=r._chart.addFilter({tag:"legend",predicate:function(t){return!l(t)}})}},c=function(e){return e===t},f=!!t&&u(s(t).key),d=function(t,e){t.querySelector(".tau-chart__legend__guide").style.backgroundColor=e?"":"transparent"};if("reset"===e)o.forEach(function(t){l(t,!0),d(t,!0)});else if("leave-others"===e)o.forEach(function(t){c(t)&&l(t,f)}),d(t,f);else if("focus-single"===e){var h=!f&&o.every(function(t){return c(t)||u(s(t).key)});o.forEach(function(t){var e=c(t)||h;l(t,e)}),f&&d(t,!0)}var p=o.filter(function(t){return!u(s(t).key)}).map(function(t){return JSON.parse(s(t).val)});n.onSelect({type:e,selectedCategories:p}),this._chart.refresh()},_highlightToggle:function(t,e){if(!t.matches(".disabled")){var n=t.getAttribute("data-dim"),r=t.getAttribute("data-value"),i=e?a(n,r):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){t.fire("highlight",i)})}},_getScrollContainer:function(){return this._container.parentNode.parentNode},_updateResetButtonPosition:function(){this._container.querySelector(Zt).style.top=this._getScrollContainer().scrollTop+"px"},_generateColorMap:function(t,e){var n=e.length;return t.reduce(function(t,r,i){return t[r]=e[i%n],t},{})},_assignStaticBrewersOrEx:function(){var t=this;t._color.forEach(function(e){var n=t._chart.getSpec().scales[e],r=t._chart.getDataSources({excludeFilter:["legend"]}),i=t._chart.getScaleFactory(r).createScaleInfoByName(e).domain();if(!n.brewer||Array.isArray(n.brewer)){var a=n.brewer||Jt.range(20).map(function(t){return"color20-"+(1+t)});n.brewer=t._generateColorMap(i,a)}t._legendOrderState[e]=i.reduce(function(t,e,n){return t[e]=n,t},{})})}}}r.default.api.plugins.add("legend",ge);var me=r.default.api.utils;function ye(t){var e=me.defaults(t||{},{verbose:!1,forceBrush:{}}),n={init:function(t){e.verbose&&(this.panel=t.insertToRightSidebar(this.template())),t.traverseSpec(t.getSpec(),function(t){t&&"COORDS.PARALLEL"===t.type&&(t.guide=t.guide||{},t.guide.enableBrushing=!0)}),n.forceBrush=e.forceBrush||{}},onRender:function(t){var r=t.getSpec().scales,i=Object.keys(r).reduce(function(t,e){var i=r[e].dim;return n.forceBrush[i]&&(t[e]=n.forceBrush[i]),t},{}),a=t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type});a.forEach(function(t,r){t.parentUnit.on("brush",function(i,a){n.forceBrush={};var o=a.map(function(t){var e=t.dim,r=t.func,i=t.args;n.forceBrush[e]=i;var a=function(){return!0};return"between"===r&&(a=function(t){return t[e]>=i[0]&&i[1]>=t[e]}),"inset"===r&&(a=function(t){return i.indexOf(t[e])>=0}),a}),s=0;if(t.fire("highlight",function(t){var e=o.every(function(e){return e(t)});return s+=e?1:0,e}),e.verbose){var u=n.panel.getElementsByClassName("i-"+r);if(0===u.length){var l=document.createElement("div");l.className="i-"+r,n.panel.appendChild(l),u[0]=l}u[0].innerHTML=a.reduce(function(t,e){return t+"
"+e.dim+": ["+e.args.join(",")+"]
"},"
Matched: "+s+"
")}})}),a.forEach(function(t){t.parentUnit.fire("force-brush",i)})},template:me.template('
')};return n}r.default.api.plugins.add("parallel-brushing",ye);var ve=r.default.api.utils;function be(t){ve.defaults(t||{},{});return{init:function(t){this._cursor=null,this._chart=t,this._tooltip=t.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.classList.contains("i-role-exclude")&&n._exclude(),e=e.parentNode;n._tooltip.hide()},!1);var e,n=this;this.showTooltip=function(t){clearTimeout(e),n._cursor=t.data;var r=n._tooltip.getElement().querySelectorAll(".i-role-content");r[0]&&(r[0].innerHTML=Object.keys(t.data).map(function(e){return n.itemTemplate({label:e,value:t.data[e]})}).join("")),n._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this.hideTooltip=function(t){e=setTimeout(function(){n._tooltip.hide()},1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){n._tooltip.hide()},!1)},_exclude:function(){this._chart.addFilter({tag:"exclude",predicate:function(t){return function(e){return JSON.stringify(e)!==JSON.stringify(t)}}(this._cursor)}),this._chart.refresh()},onRender:function(t){var e=this;t.select(function(t){return"PARALLEL/ELEMENT.LINE"===t.config.type}).forEach(function(t){t.on("mouseout",function(t,n){e.hideTooltip(n)}),t.on("mouseover",function(t,n){e.showTooltip(n)})})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:ve.template(['
','
<%=label%>
','
<%=value%>
',"
"].join(""))}}r.default.api.plugins.add("parallel-tooltip",be);var xe=n(8),_e=n(3),we=n(7),Ee=function(){return(Ee=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0?a:Object.keys(i.dims),this._fieldBounds=t.fieldBounds||{},this._applyImmediately=Boolean(t.applyImmediately);var o=n._chart.getChartModelData();this._filtersContainer=n._chart.insertToRightSidebar(n._filtersContainer),this._filtersContainer.style.maxHeight="0px",n._fields.filter(function(t){var e="measure"===i.dims[t].type;return e||r.settings.log("The ["+t+"] isn't measure so Quick Filter plugin skipped it"),e}).forEach(function(t){n._data[t]=o.map(function(e){return e[t]});var e=n._fieldBounds[t];n._bounds[t]=e?[e.min,e.max]:Se.extent(n._data[t]),n._filter[t]=n._bounds[t],n._filtersContainer.insertAdjacentHTML("beforeend",n._filterWrapper({name:t})),n._container[t]=n._filtersContainer.lastChild,n._drawFilter(t)})},onRender:function(){this._filtersContainer.style.maxHeight="none"},_filtersContainer:'
',_filterWrapper:Me.template('
<%=name%>
'),_drawFilter:function(t){var e=this._data[t],n=this._bounds[t],r=this._filter[t],i=Me.isDate(n[0])||Me.isDate(n[1]),a=this,o=0,s=24,u=21,l=12,c=180-l-s,f=41-o-u-8,d=Se.scaleLinear().domain(n).range([0,c]),p=Se.brushX().extent([[0,0],[c,20]]).on("start",function(){a._layout.style["overflow-y"]="hidden"}).on("brush",this._applyImmediately?E:w).on("end",function(){a._layout.style["overflow-y"]="",E()}),g=Se.select(this._container[t]).append("svg").attr("width",c+l+s).attr("height",f+o+u+4).append("g").attr("transform","translate("+l+","+o+")"),m=(g.append("g").selectAll("rect").data(e).enter().append("rect").attr("transform",function(t){return"translate("+d(t)+","+(o+4)+")"}).attr("height",f).attr("width",1),g.append("g").attr("class","brush").call(p));m.append("g").attr("class","resize e").attr("cursor","ew-resize").attr("pointer-events","none"),m.append("g").attr("class","resize w").attr("cursor","ew-resize").attr("pointer-events","none"),m.selectAll(".resize").append("line").attr("transform","translate(0, 0)").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",f+8),m.selectAll(".resize").append("text").attr("x",0).attr("y",2*(f+4)),m.selectAll("rect").attr("height",f+8);var y=g.append("text").attr("x",c/2).attr("y",2*(f+4)).attr("class","date-label"),v=function(t){return Math.log(t)/Math.LN10}(a._filter[t][1]-a._filter[t][0]),b=Math.round(3-v),x=Math.pow(10,b);if(i){var _=function(t){var e=t.findIndex(function(t){var e=Se.timeFormat(t);return e(new Date(n[0]))!==e(new Date(n[1]))});return e=e<0?t.length:e,{comm:t.slice(0,e),diff:t.slice(e)}}(["’%y"," %b","%d","%H",":%M",":%S"]);_.comm.length<3?(_.diff.splice(-3),_.diff.reverse(),_.comm.reverse()):(_.comm.length<5&&_.diff.pop(),_.diff=_.comm.splice(3,_.comm.length-3).concat(_.diff),_.comm.reverse())}function w(){var e=h.event;if(e&&Array.isArray(e.selection)){var n=e.selection.map(d.invert);r=n,a._filter[t]=n}else r=a._filter[t];var o=i?new Date(r[0]).getTime():r[0],s=i?new Date(r[1]).getTime():r[1],u=Math.round(parseFloat(o)*x)/x,l=Math.round(parseFloat(s)*x)/x;m.select(".handle--w"),m.select(".handle--e");m.select(".resize.w").attr("transform","translate("+d(r[0])+",0)"),m.select(".resize.e").attr("transform","translate("+d(r[1])+",0)");var c=m.selectAll(".w text"),f=m.selectAll(".e text");if(i){var p=Se.timeFormat(_.comm.join("")),g=Se.timeFormat(_.diff.join(""));y.html(g(new Date(u))+" .. "+g(new Date(l))+' '+p(new Date(l))+"")}else c.text(u),f.text(l)}function E(){w(),a._applyFilter(t)}E(),p.move(m,r.map(d))},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(n){return e.removeFilter(t[n])});!function(t){t&&t.parentElement&&t.parentElement.removeChild(t)}(this._filtersContainer)},_applyFilter:function(t){var e=this._currentFilters,n=function(t,e,n){return function(r){var i=r[t];return in}}(t,this._filter[t][0],this._filter[t][1]),r=e[t];delete e[t],this._chart.removeFilter(r),e[t]=this._chart.addFilter({tag:"quick-filter",predicate:function(t){return!n(t)}}),Te<0?this._chart.refresh():(this._refreshRequestId&&clearTimeout(this._refreshRequestId),this._refreshRequestId=setTimeout(function(){this._refreshRequestId=null,this._chart.refresh()}.bind(this),Te))}}}r.default.api.plugins.add("quick-filter",Ce);var Ae=r.default.api.utils;function ke(t){var e=Ae.defaults(t||{},{show:!0,modes:["normal","entire-view","fit-width","fit-height","minimal"]});return{init:function(t){e.show&&(e.selectedMode=t.getSpec().settings.fitModel,t.insertToHeader(this.template({modes:e.modes.map(function(t){return""})})).addEventListener("change",function(n){var r=n.target;r.classList.contains("i-role-fit-model")&&(e.selectedMode=r.value,t.getSpec().settings.fitModel=e.selectedMode,t.refresh())},!1))},template:Ae.template(['
',"
"," View Mode: ",' ","
","
"].join(""))}}r.default.api.plugins.add("settings",ke);function Oe(t){return new X(t)}r.default.api.plugins.add("tooltip",Oe);var Pe=function(){var t={linear:function(t){for(var e=[0,0,0,0,0],n=0,r=[];nMath.abs(t[n][a])&&(a=r);for(i=n;i=n;i--)t[i][r]-=t[i][n]*t[n][r]/t[n][n]}for(r=s-1;r>=0;r--){for(o=0,i=r+1;i=0;s--)m+=s>1?Math.round(100*h[s])/100+"x^"+s+" + ":1==s?Math.round(100*h[s])/100+"x + ":Math.round(100*h[s])/100;return{equation:h,points:i,string:m}},lastvalue:function(t){for(var e=[],n=null,r=0;r0&&ot[o]-t[s]?a:o;for(var c=Math.abs(1/(t[u]-l)),f=0,d=0,h=0,p=0,g=0,m=a;m<=o;){var y=t[m],v=e[m],b=r((m1&&(a||s)&&(d=[d[0],d[d.length-1]]),t.concat(d.length>1?d:[])},[])},t.traverseSpec(n,function(t,r){if(i.predicateIsApplicable(n,t,r)){var a=n.scales[t.x],o=n.scales[t.y],s=n.scales[t.color]||{},u=JSON.parse(JSON.stringify(t));u.type="ELEMENT.LINE",u.size="size_null",u.namespace="trendline",u.transformation=u.transformation||[],u.transformation.push({type:"regression",args:{type:e.type,x:a,y:o,g:s}});u.guide=Ne.defaults({},u.guide||{}),u.guide.interpolate="linear",u.guide.showAnchors="never",u.guide.cssClass="tau-chart__trendline",u.guide.widthCssClass="tau-chart__line-width-1",u.guide.x=u.guide.x||{},u.guide.x.fillGaps=!1,delete u.guide.label,delete u.label,r.units.push(u)}})}},containerTemplate:'
',template:Ne.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(t){if(this._container){this._container.innerHTML=this.template({title:"Trend line",error:this._error,showTrend:e.showTrend&&this._isApplicable?"checked":"",models:e.models.map(function(t){return""})});var n=function(t){return function(){h.select(this).classed({active:t,"tau-chart__line-width-1":!t,"tau-chart__line-width-3":t})}};h.select(t.getSVG()).selectAll(".tau-chart__trendline").on("mouseenter",n(!0)).on("mouseleave",n(!1))}}}}r.default.api.plugins.add("trendline",Le);var Re={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},Fe=function(t,e){return Re[t][e].map(function(n,r){return t+" q"+r+"-"+e})};r.default.api.colorBrewers.add("tauBrewer",Fe);n.d(e,"GPL",function(){return De}),n.d(e,"Plot",function(){return Ie}),n.d(e,"Chart",function(){return je}),n.d(e,"api",function(){return ze}),n.d(e,"version",function(){return Be});var De=r.default.GPL,Ie=r.default.Plot,je=r.default.Chart,ze=r.default.api,Be=r.default.version}])}); \ No newline at end of file diff --git a/package.json b/package.json index c99af5577..fd15a8454 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taucharts", - "version": "2.6.4", + "version": "2.6.5", "homepage": "https://github.com/TargetProcess/taucharts", "description": "Data-focused charting library based on D3", "author": { @@ -89,7 +89,7 @@ "webpack": "4.19.1", "webpack-bundle-analyzer": "2.13.1", "webpack-cli": "3.1.0", - "webpack-dev-server": "3.1.10" + "webpack-dev-server": "3.1.14" }, "types": "./types/index.d.ts" }