diff --git a/README.md b/README.md index 4ddd4485f..8e6a3c35c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Taucharts [![Build Status](https://travis-ci.org/TargetProcess/tauCharts.png?branch=master)](https://travis-ci.org/TargetProcess/tauCharts) [![Coverage Status](https://img.shields.io/coveralls/TargetProcess/tauCharts.svg)](https://coveralls.io/r/TargetProcess/tauCharts) [![Code Climate](https://codeclimate.com/github/TargetProcess/tauCharts/badges/gpa.svg)](https://codeclimate.com/github/TargetProcess/tauCharts) +Taucharts [![Build Status](https://travis-ci.org/TargetProcess/tauCharts.svg?branch=master)](https://travis-ci.org/TargetProcess/tauCharts) [![Coverage Status](https://img.shields.io/coveralls/TargetProcess/tauCharts.svg)](https://coveralls.io/r/TargetProcess/tauCharts) [![Code Climate](https://codeclimate.com/github/TargetProcess/tauCharts/badges/gpa.svg)](https://codeclimate.com/github/TargetProcess/tauCharts) [![Slack Status](https://slack.taucharts.com/badge.svg)](https://slack.taucharts.com/) ====== diff --git a/dist/colorbrewer.css b/dist/colorbrewer.css index abb85873d..6eb20d37a 100644 --- a/dist/colorbrewer.css +++ b/dist/colorbrewer.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/annotations.css b/dist/plugins/annotations.css index bdec42e09..178aac142 100644 --- a/dist/plugins/annotations.css +++ b/dist/plugins/annotations.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 bdec42e09..178aac142 100644 --- a/dist/plugins/annotations.dark.css +++ b/dist/plugins/annotations.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/annotations.js b/dist/plugins/annotations.js index 20fbf6a63..dae1c30a7 100644 --- a/dist/plugins/annotations.js +++ b/dist/plugins/annotations.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 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 +!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 r in a)("object"==typeof exports?exports:t)[r]=a[r]}}(window,function(t,e){return function(t){var e={};function a(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=t,a.c=e,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},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 r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(r,n,function(e){return t[e]}.bind(null,n));return r},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 r=a(0),n=a.n(r),i=a(5);function o(t,e){return t.replace(/\{\{\s*(.+?)\s*\}\}/g,(t,a)=>e.hasOwnProperty(a)?e[a]:"")}var s=n.a.api.utils,l=n.a.api.pluginsSDK,c=function(t,e,a){"front"===a?t.push(e):t.unshift(e)},d=function(t){return function(e){var a={},r=[{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===r.method)return a;var i={l:-.5,r:.5},o=r.method,s=r.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){const e=n.a.api.tickPeriod.get(s.period,{utc:s.utcTime}),a=s.domain();let r=e.cast(a[0]);for(;re.settings.log(t,"LOG");this._dataRefs={},e.transformations.dataRange=((r,i)=>{var s=i.from,l=i.to,c=t.getScaleInfo(i.primaryScale),d=c.domain();if(c.period){var u=n.a.api.tickPeriod.get(c.period,{utc:e.settings.utcTime});s=u.cast(new Date(i.from)),l=u.cast(new Date(i.to))}s=null===s?d[0]:s,l=null===l?d[d.length-1]:l;var f=!c.isInDomain(s),m=!c.isInDomain(l);if(c.discrete?f||m:f&&m)return a("Annotation is out of domain"),[];var p=t.getScaleInfo(i.secondaryScale),y=p.domain(),h=[y[0],y[y.length-1]],g=c.dim,x=p.dim,_="__pos__",v={},S={},b={},A={};v[_]="l",v[g]=s,v[x]=h[0],S[_]="l",S[g]=l,S[x]=h[0],b[_]="r",b[g]=l,b[x]=h[1],A[_]="r",A[g]=s,A[x]=h[1];const D="y"===i.axis?b:A,T="y"===i.axis?A:b,R=this._getFormat(g);return i.startText&&(D.text=o(i.startText,{value:R(D[g])})),i.endText&&(T.text=o(i.endText,{value:R(T[g])})),this._useSavedDataRefs([v,S,b,A],String([g,s,l]))}),e.transformations.dataLimit=((r,i)=>{var s=i.primaryScale,l=i.secondaryScale,c=t.getScaleInfo(s),d=c.period?n.a.api.tickPeriod.get(c.period,{utc:e.settings.utcTime}).cast(new Date(i.from)):i.from;if(!c.isInDomain(d))return a("Annotation is out of domain"),[];var u=t.getScaleInfo(l),f=u.domain(),m=[f[0],f[f.length-1]],p={},y={},h=c.dim,g=u.dim,x="__pos__";const _=this._getFormat(h);return p[h]=d,p[g]=m[0],p[x]="l",i.startText&&(p.text=o(i.startText,{value:_(d)})),y[h]=d,y[g]=m[1],y[x]="r",i.endText&&(y.text=o(i.endText,{value:_(d)})),this._useSavedDataRefs([p,y],String([h,g,d]))}),e.transformations.lineNoteData=((e,r)=>{const i=r.xScale,s=r.yScale,l=t.getScaleInfo(i),c=t.getScaleInfo(s),d=l.period?n.a.api.tickPeriod.get(l.period,{utc:l.utcTime}):null,u=c.period?n.a.api.tickPeriod.get(c.period,{utc:c.utcTime}):null,f=r.points.map(t=>[d?d.cast(t[0]):t[0],u?u.cast(t[1]):t[1]]);if(f.some(t=>!l.isInDomain(t[0])||!c.isInDomain(t[1])))return a("Annotation is out of domain"),[];const m=l.dim,p=c.dim,y=[m,p].map(t=>this._getFormat(t)),h=f.map((t,e)=>{0===e||f.length;const a=0===e?r.startText:e===f.length-1?r.endText:"";return{[m]:t[0],[p]:t[1],text:a?o(a,{x:y[0](t[0]),y:y[1](t[1])}):null}});return this._useSavedDataRefs(h,JSON.stringify([m,p,r.points]))})},addAreaNote:function(t,e,a){var r=t.scales[e.x],n=t.scales[e.y],i=a.dim===r.dim?["x","y"]:a.dim===n.dim?["y","x"]:null;if(null===i)return void(e=>t.settings.log(e,"LOG"))("Annotation doesn't match any data field");var o=a.val[0],s=a.val[1];const l=a.text;var u={type:"ELEMENT.PATH",namespace:"annotations",x:e.x,y:e.y,color:a.colorScaleName,label:"annotation_text",expression:{inherit:!1,operator:"none",params:[],source:"/"},transformModel:[d(a)],transformation:[{type:"dataRange",args:{axis:i[0],startText:"string"==typeof l?l:l.start,endText:"string"==typeof l?"":l.end,from:o,to:s,primaryScale:e[i[0]],secondaryScale:e[i[1]]}}],guide:{animationSpeed:e.guide.animationSpeed,showAnchors:"never",cssClass:"tau-chart__annotation-area",label:{fontColor:a.color,position:["r","b","keep-in-box"]}}};c(e.units,u,a.position)},addLineNote:function(t,e,a){var r=t.scales[e.x],n=t.scales[e.y];let i,o=null,s=!0;if(Array.isArray(a.dim)?(s=!1,((i=a.dim)[0]===r.dim&&i[1]===n.dim||i[0]===n.dim&&i[1]===r.dim)&&(o=["x","y"])):a.dim===r.dim?o=["x","y"]:a.dim===n.dim&&(o=["y","x"]),null===o)return void(e=>t.settings.log(e,"LOG"))("Annotation doesn't match any field");var l=a.text,u={type:"ELEMENT.LINE",namespace:"annotations",x:e.x,y:e.y,label:"annotation_text",color:a.colorScaleName,expression:{inherit:!1,operator:"none",params:[],source:"/"},guide:{animationSpeed:e.guide.animationSpeed,showAnchors:"never",widthCssClass:"tau-chart__line-width-2",cssClass:"tau-chart__annotation-line",label:{fontColor:a.color,position:s?["r","b","keep-in-box"]:["auto:avoid-label-edges-overlap","auto:adjust-on-label-overflow","keep-in-box"]},x:{fillGaps:!1},y:{fillGaps:!1}}};let f=s?{transformModel:[d(a)],transformation:[{type:"dataLimit",args:{from:a.val,startText:"string"==typeof l?"":l.start,endText:"string"==typeof l?l:l.end,primaryScale:e[o[0]],secondaryScale:e[o[1]]}}]}:{transformation:[{type:"lineNoteData",args:{points:i[0]===r.dim?a.val:a.val.map(t=>t.slice().reverse()),startText:"string"==typeof l?"":l.start,endText:"string"==typeof l?l:l.end,xScale:e.x,yScale:e.y}}]};Object.assign(u,f),c(e.units,u,a.position)},onRender(){this._clearUnusedDataRefs()},onSpecReady(t,a){var r=this,n=[];this._setupAdditionalSeries(),this._startWatchingDataRefs(),t.traverseSpec(a,function(t){t&&"COORDS.RECT"===t.type&&t.units&&n.push(t)}),this._formatters=l.getFieldFormatters(a,e.formatters);var o=l.spec(a);n.forEach(function(t){e.items.map(function(t,e){var a=(t.color||"#BD10E0").toLowerCase(),r=i.rgb(a).toString();"black"!==a&&"rgb(0, 0, 0)"===r&&(r=null);var n=r||a,s="annotation_color_"+e;return o.addScale(s,{type:"color",source:"?",brewer:[n]}),{dim:t.dim,val:t.val,text:t.text,color:n,position:t.position,colorScaleName:s}}).forEach(function(e){Array.isArray(e.dim)?Array.isArray(e.val)&&e.val.every(Array.isArray)?r.addLineNote(a,t,e):(t=>a.settings.log(t,"LOG"))("Point annotation is not implemented yet"):Array.isArray(e.val)?r.addAreaNote(a,t,e):r.addLineNote(a,t,e)})})},_setupAdditionalSeries:function(){const t=this._chart,a=t.getSpec(),r=t.getDataSources()["/"].data,n=this._getAnnotatedDimValues(e.items);Object.keys(n).forEach(t=>{[`x_${t}`,`y_${t}`].forEach(e=>{if(e in a.scales){const i=a.scales[e],o=r.map(e=>e[t]),l=["period","time"].indexOf(i.type)>=0?n[t].map(t=>new Date(t)):n[t];i.series=s.unique(o.concat(l))}})})},_getFormat(t){return this._formatters[t]?this._formatters[t].format:t=>String(t)},_useSavedDataRefs(t,e){const a=this._dataRefs;return this._usedDataRefsKeys.add(e),e in a?(a[e].forEach((e,a)=>Object.assign(e,t[a])),a[e]):(a[e]=t,t)},_startWatchingDataRefs(){const t=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(t)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs(){const t=this._dataRefs,e=this._initialDataRefsKeys,a=this._usedDataRefsKeys;Array.from(e).filter(t=>!a.has(t)).forEach(e=>delete t[e]),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems(t){const e=(t,e)=>t.reduce((t,a,r)=>(t[a]=e[r],t),{});return t.reduce((t,a)=>(Array.isArray(a.dim)?Array.isArray(a.val)&&a.val.every(Array.isArray)&&a.val.forEach(r=>{t.push(e(a.dim,r))}):Array.isArray(a.val)?a.val.forEach(r=>{t.push(e([a.dim],[r]))}):t.push(e([a.dim],[a.val])),t),[])},_getAnnotatedDimValues(t){const e=this._getDataRowsFromItems(t),a={};return e.forEach(t=>{Object.keys(t).forEach(e=>{a[e]=a[e]||[],a[e].push(t[e])})}),a}}}n.a.api.plugins.add("annotations",u),e.default=u},5:function(t,a){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 70442ee04..da303f9e6 100644 --- a/dist/plugins/bar-as-span.js +++ b/dist/plugins/bar-as-span.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 bc36d174c..2736920ba 100644 --- a/dist/plugins/box-whiskers.js +++ b/dist/plugins/box-whiskers.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 0400b2b00..d5d5b48c7 100644 --- a/dist/plugins/category-filter.css +++ b/dist/plugins/category-filter.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 b2bd1d349..07c9f3043 100644 --- a/dist/plugins/category-filter.dark.css +++ b/dist/plugins/category-filter.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 d061fee05..8a4c7d753 100644 --- a/dist/plugins/category-filter.js +++ b/dist/plugins/category-filter.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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"));else if("function"==typeof define&&define.amd)define(["taucharts"],e);else{var r="object"==typeof exports?e(require("taucharts")):e(t.Taucharts);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=17)}({0:function(e,r){e.exports=t},17:function(t,e,r){"use strict";r.r(e),r.d(e,"default",function(){return y});var n=r(0),i=r.n(n),o=i.a.api.utils,a=i.a.api.pluginsSDK,u="tau-chart__category-filter",c=u+"__value",s=c+"_checked",l=c+"__toggle",f=function(t){return t.join("\n")},d=function(t){var e=t.label,r=t.values;return'\n
\n
'+e+'
\n
\n '+f(r.map(function(t){return h(t)}))+"\n
\n\n"},h=function(t){var e=t.key,r=t.label,n=t.checked;return'\n
\n '+_()+'\n '+r+"\n
\n"},_=function(){return['','',""].join("")},p=function(t,e,r,n){t.addEventListener(e,function(t){for(var e=t.target;e!==t.currentTarget&&null!==e;)e.matches(r)&&n(t,e),e=e.parentNode})},g=function(t,e){var r=function(t){return JSON.stringify(function(t){return null==t||""===t}(t)?null:t)},n=r(e);return function(e){var i=e[t],o=r(i);return n===o}},v=function(){function t(t){this.settings=o.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 r=function(e){var r=t.getSpec().scales;return Object.keys(r).map(function(t){return{name:t,config:r[t]}}).filter(e)},n=r(function(t){var e=t.config;t.name;return"ordinal"===e.type&&e.dim}),i=o.unique(n.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=r(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})}n=n.filter(function(t){return i.indexOf(t.config.dim)>=0}),this._categoryScales=n,this._render()},t.prototype.destroy=function(){var t=this._filters,e=this._chart;Object.keys(t).forEach(function(r){return e.removeFilter(t[r])});!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 r=this._lastClickedScrollInfo.top,n=e.getBoundingClientRect().top,i=this._getScrollContainer(),o=i.getBoundingClientRect().top;i.scrollTop=i.scrollTop-r-o+n}this._lastClickedScrollInfo=null}}},t.prototype._getContent=function(t){return function(t){var e=t.categories;return'\n
\n '+f(e.map(function(t){return d(t)}))+"\n
\n"}({categories:t})},t.prototype._getCategoriesInfo=function(){var t=this;return this._categoryScales.map(function(e){var r=e.name;return t._chart.getScaleInfo(r)}).map(function(e){var r=e.dim,n=t._getFieldLabel(r),i=t._getFieldFormat(r),a=t._chart.getDataSources({excludeFilter:["category-filter"]}),u=o.unique(a[e.source].data.map(function(t){return t[r]})).map(function(e){var n=i(e),o=t._getFilterKey(r,e);return{label:n,checked:!t._filters[o],key:o,value:e}});return{dim:r,label:n,values:u}})},t.prototype._render=function(){this._clear(),this._formatters=a.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 r=e.dim;return e.values.forEach(function(e){var n=e.key,i=e.value;t[n]={dim:r,value:i}}),t},{})},t.prototype._subscribeToEvents=function(){var t=this,e=this._node;p(e,"click","."+c,function(e,r){var n=r.getAttribute("data-key"),i=e.target.matches("."+l);t._toggleCategory(n,i?"toggle":"focus")}),p(e,"mouseover","."+c,function(e,r){var n=r.getAttribute("data-key");t._toggleHighlight(n,!0)}),p(e,"mouseout","."+c,function(e,r){var n=r.getAttribute("data-key");t._toggleHighlight(n,!1)})},t.prototype._isFilteredOut=function(t){return t in this._filters},t.prototype._toggleCategory=function(t,e){var r=this,n=Array.from(this._node.querySelectorAll("."+c)).reduce(function(t,e){return t[e.getAttribute("data-key")]=e,t},{}),i=Object.keys(this._filterKeys).map(function(t){var e=r._filterKeys[t],i=e.dim,o=e.value;return{node:n[t],key:t,dim:i,value:o,isChecked:!r._isFilteredOut(t)}}),o=i.reduce(function(t,e){return t[e.key]=e,t},{})[t],a=i.filter(function(t){return t.dim===o.dim}),u=function(t,e){e?t.classList.add(s):t.classList.remove(s)};switch(e){case"toggle":o.isChecked?(this._addFilter(t),u(o.node,!1)):(this._removeFilter(t),u(o.node,!0));break;case"focus":o.isChecked&&a.every(function(t){return t===o||!t.isChecked})?a.forEach(function(t){t.isChecked||(u(t.node,!0),r._removeFilter(t.key))}):(a.forEach(function(t){t!==o&&t.isChecked&&(u(t.node,!1),r._addFilter(t.key))}),o.isChecked||(u(o.node,!0),this._removeFilter(o.key)))}this._lastClickedScrollInfo={key:t,top:o.node.getBoundingClientRect().top-this._getScrollContainer().getBoundingClientRect().top},this._chart.refresh()},t.prototype._toggleHighlight=function(t,e){if(!this._isFilteredOut(t)){var r=this._filterKeys[t],n=r.dim,i=r.value,o=e?g(n,i):function(t){return null};this._chart.select(function(t){return!0}).forEach(function(t){return t.fire("highlight",o)})}},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],r=e.dim,n=e.value,i=g(r,n);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}();function y(t){return new v(t)}i.a.api.plugins.add("category-filter",y)}})}); \ No newline at end of file +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],t);else{var r="object"==typeof exports?t(require("taucharts")):t(e.Taucharts);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(window,function(e){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=17)}({0:function(t,r){t.exports=e},17:function(e,t,r){"use strict";r.r(t),r.d(t,"default",function(){return b});var i=r(0),n=r.n(i);const s=n.a.api.utils,o=n.a.api.pluginsSDK,l="tau-chart__category-filter",a=`${l}__value`,c=`${a}_checked`,d=`${a}__toggle`,u=e=>e.join("\n"),h=({categories:e})=>`\n
\n ${u(e.map(e=>f(e)))}\n
\n`,f=({label:e,values:t})=>`\n
\n
${e}
\n
\n ${u(t.map(e=>_(e)))}\n
\n\n`,_=({key:e,label:t,checked:r})=>`\n
\n ${g()}\n ${t}\n
\n`,g=()=>[``,``,""].join(""),m=e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},p=(e,t,r,i)=>{e.addEventListener(t,function(e){let t=e.target;for(;t!==e.currentTarget&&null!==t;)t.matches(r)&&i(e,t),t=t.parentNode})},y=(e,t)=>{const r=e=>JSON.stringify((e=>null==e||""===e)(e)?null:e),i=r(t);return t=>{const n=t[e],s=r(n);return i===s}};class v{constructor(e){this.settings=s.defaults(e||{},{formatters:{},fields:null,skipColorDim:!0}),this._filters={},this.onRender=this._createRenderHandler()}init(e){this._chart=e;const t=t=>{const r=e.getSpec().scales;return Object.keys(r).map(e=>{return{name:e,config:r[e]}}).filter(t)};let r=t(({config:e,name:t})=>"ordinal"===e.type&&e.dim),i=s.unique(r.map(({config:e})=>e.dim));if(this.settings.fields&&(i=i.filter(e=>this.settings.fields.indexOf(e)>=0)),this.settings.skipColorDim){const e=t(({config:e,name:t})=>"color"===e.type&&e.dim).map(({config:e})=>e.dim);i=i.filter(t=>e.indexOf(t)<0)}r=r.filter(e=>i.indexOf(e.config.dim)>=0),this._categoryScales=r,this._render()}destroy(){const e=this._filters,t=this._chart;Object.keys(e).forEach(r=>t.removeFilter(e[r]));(e=>e&&e.parentElement&&e.parentElement.removeChild(e))(this._node)}_createRenderHandler(){return function(){if(this._lastClickedScrollInfo){const e=this._lastClickedScrollInfo.key,t=this._node.querySelector(`[data-key="${e}"]`);if(t){const e=this._lastClickedScrollInfo.top,r=t.getBoundingClientRect().top,i=this._getScrollContainer(),n=i.getBoundingClientRect().top;i.scrollTop=i.scrollTop-e-n+r}this._lastClickedScrollInfo=null}}}_getContent(e){return h({categories:e})}_getCategoriesInfo(){return this._categoryScales.map(({name:e})=>this._chart.getScaleInfo(e)).map(e=>{const t=e.dim,r=this._getFieldLabel(t),i=this._getFieldFormat(t),n=this._chart.getDataSources({excludeFilter:["category-filter"]}),o=s.unique(n[e.source].data.map(e=>e[t])).map(e=>{const r=i(e),n=this._getFilterKey(t,e);return{label:r,checked:!this._filters[n],key:n,value:e}});return{dim:t,label:r,values:o}})}_render(){this._clear(),this._formatters=o.getFieldFormatters(this._chart.getSpec(),this.settings.formatters);const e=this._getCategoriesInfo(),t=this._getContent(e),r=m(t);this._node=r,this._chart.insertToRightSidebar(r),this._subscribeToEvents(),this._filterKeys=e.reduce((e,t)=>{const r=t.dim;return t.values.forEach(({key:t,value:i})=>{e[t]={dim:r,value:i}}),e},{})}_subscribeToEvents(){const e=this._node;p(e,"click",`.${a}`,(e,t)=>{const r=t.getAttribute("data-key"),i=e.target.matches(`.${d}`);this._toggleCategory(r,i?"toggle":"focus")}),p(e,"mouseover",`.${a}`,(e,t)=>{const r=t.getAttribute("data-key");this._toggleHighlight(r,!0)}),p(e,"mouseout",`.${a}`,(e,t)=>{const r=t.getAttribute("data-key");this._toggleHighlight(r,!1)})}_isFilteredOut(e){return e in this._filters}_toggleCategory(e,t){const r=Array.from(this._node.querySelectorAll(`.${a}`)).reduce((e,t)=>{return e[t.getAttribute("data-key")]=t,e},{}),i=Object.keys(this._filterKeys).map(e=>{const{dim:t,value:i}=this._filterKeys[e];return{node:r[e],key:e,dim:t,value:i,isChecked:!this._isFilteredOut(e)}}),n=i.reduce((e,t)=>(e[t.key]=t,e),{})[e],s=i.filter(e=>e.dim===n.dim),o=(e,t)=>{t?e.classList.add(c):e.classList.remove(c)};switch(t){case"toggle":n.isChecked?(this._addFilter(e),o(n.node,!1)):(this._removeFilter(e),o(n.node,!0));break;case"focus":n.isChecked&&s.every(e=>e===n||!e.isChecked)?s.forEach(e=>{e.isChecked||(o(e.node,!0),this._removeFilter(e.key))}):(s.forEach(e=>{e!==n&&e.isChecked&&(o(e.node,!1),this._addFilter(e.key))}),n.isChecked||(o(n.node,!0),this._removeFilter(n.key)));break}this._lastClickedScrollInfo={key:e,top:n.node.getBoundingClientRect().top-this._getScrollContainer().getBoundingClientRect().top},this._chart.refresh()}_toggleHighlight(e,t){if(this._isFilteredOut(e))return;const{dim:r,value:i}=this._filterKeys[e],n=t?y(r,i):e=>null;this._chart.select(e=>!0).forEach(e=>e.fire("highlight",n))}_clear(){const e=this._node;e&&e.parentElement&&e.parentElement.removeChild(e)}_getScrollContainer(){return this._node.parentElement.parentElement}_getFilterKey(e,t){return`${e}__${t}`}_addFilter(e){const{dim:t,value:r}=this._filterKeys[e],i=y(t,r);this._filters[e]=this._chart.addFilter({tag:"category-filter",predicate:e=>!i(e)})}_removeFilter(e){const t=this._filters[e];delete this._filters[e],this._chart.removeFilter(t)}_getFieldLabel(e){return this._formatters[e]?this._formatters[e].label:e}_getFieldFormat(e){return this._formatters[e]?this._formatters[e].format:e=>String(e)}}function b(e){return new v(e)}n.a.api.plugins.add("category-filter",b)}})}); \ No newline at end of file diff --git a/dist/plugins/color-brewer.js b/dist/plugins/color-brewer.js index d098cc557..8a290ee22 100644 --- a/dist/plugins/color-brewer.js +++ b/dist/plugins/color-brewer.js @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/crosshair.css b/dist/plugins/crosshair.css index e152cd2fc..303e462b1 100644 --- a/dist/plugins/crosshair.css +++ b/dist/plugins/crosshair.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 450b7bd1f..1c2f5533b 100644 --- a/dist/plugins/crosshair.dark.css +++ b/dist/plugins/crosshair.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/crosshair.js b/dist/plugins/crosshair.js index 4f4d0a271..40baedc35 100644 --- a/dist/plugins/crosshair.js +++ b/dist/plugins/crosshair.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var a="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var r in a)("object"==typeof exports?exports:t)[r]=a[r]}}(window,function(t,e){return function(t){var e={};function a(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,a),i.l=!0,i.exports}return a.m=t,a.c=e,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},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 r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(r,i,function(e){return t[e]}.bind(null,i));return r},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=18)}({0:function(e,a){e.exports=t},1:function(t,a){t.exports=e},18:function(t,e,a){"use strict";a.r(e);var r=a(0),i=a.n(r),n=a(1),o="http://www.w3.org/2000/svg",l=i.a.api.utils,s=i.a.api.svgUtils,d=i.a.api.pluginsSDK;function c(t){t=t||{};var e=document.createElementNS(o,"g"),a=n.select(e).attr("class","tau-crosshair__label");a.append("rect").attr("class","tau-crosshair__label__box"),a.append("text").attr("class","tau-crosshair__label__text-shadow"),a.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,n=e.text,o=e.color,l=e.colorCls;a.attr("class","tau-crosshair__label "+l);var s=t.halign,d=t.valign,c=t.hpad,u=t.vpad,h={left:"end",middle:"middle",right:"start"}[s],f={left:-c,middle:0,right:c}[s],g=a.select(".tau-crosshair__label__text").attr("fill",o),x=a.selectAll(".tau-crosshair__label__text, .tau-crosshair__label__text-shadow").attr("text-anchor",h).attr("x",r+f).attr("y",0).text(n),_=g.node().getBBox(),p={top:-u-_.height/2,middle:0,bottom:u+_.height/2}[d]-_.height/2-_.y;x.attr("y",i+p);var m=_.width+2*c,b=_.height+2*u,v={left:-m,middle:-m/2,right:0}[s],y={top:-b,middle:-b/2,bottom:0}[d];a.select(".tau-crosshair__label__box").attr("fill",o).attr("rx",t.boxCornerRadius).attr("ry",t.boxCornerRadius).attr("x",r+v).attr("y",i+y).attr("width",m).attr("height",b)}(i),function(){a.attr("transform","");var r=t.chart.getLayout().contentContainer.getBoundingClientRect(),i=t.chart.getSVG().getBoundingClientRect(),n=e.getBoundingClientRect(),o=Math.max(0,Math.max(r.left,i.left)-n.left)||Math.min(0,Math.min(r.right,i.right)-n.right),l=Math.max(0,Math.max(r.top,i.top)-n.top)||Math.min(0,Math.min(r.bottom,i.bottom)-n.bottom);a.attr("transform","translate("+o+","+l+")")}(),r},hide:function(){return e.parentNode&&e.parentNode.removeChild(e),r}};return r}function u(t){var e=l.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=n.select(document.createElementNS(o,"g")).attr("class","tau-crosshair");this._labels={x:null,y:null};var a=function(a){var r=t.append("g").attr("class","tau-crosshair__group "+a);r.append("line").attr("class","tau-crosshair__line-shadow"),r.append("line").attr("class","tau-crosshair__line"),this._labels[a]=c({container:r.node(),chart:this._chart,halign:"x"===a?"middle":"left",valign:"x"===a?"bottom":"middle",boxCornerRadius:e.labelBoxCornerRadius,hpad:e.labelBoxHPadding,vpad:e.labelBoxVPadding})}.bind(this);e.xAxis&&a("x"),e.yAxis&&a("y"),this._element=t},_setValues:function(t,a,r){var i=function(t){var a=this._element.select(".tau-crosshair__group."+t.dir);a.select(".tau-crosshair__line").attr("class","tau-crosshair__line "+r.cls).attr("stroke",r.color),a.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:a.start+(t.minMode?0:e.axisVPadding)},valuePt:{x:t.value,y:a.value+a.crossPadding},label:t.label,labelHAlign:"middle",labelVAlign:"bottom"}),i({dir:"y",startPt:{x:t.start-(a.minMode?0:e.axisHPadding),y:a.value},valuePt:{x:t.value-t.crossPadding,y:a.value},label:a.label,labelHAlign:"left",labelVAlign:"middle"})},_showCrosshair:function(t,e,a){var r=this._chart.getSVG(),i=e.config.options.container.node(),n=s.getDeepTransformTranslate(i);this._element.attr("transform",s.translate(n.x,n.y)),r.appendChild(this._element.node());var o=e.getScale("x"),l=e.getScale("y"),d=e.getScale("color"),c=d(t.data[d.dim]),u=t.data[o.dim],h=t.data[l.dim],f=e.screenModel.x(t.data),g=e.screenModel.y(t.data);if(e.config.stack)if(e.config.flip){var x=e.data().filter(function(a){var r=a[l.dim];return a===t.data||(r===h||r-h==0)&&(e.screenModel.x(t.data)-e.screenModel.x(a))*a[o.dim]>0});f=(u<0?Math.min:Math.max).apply(null,x.map(function(t){return e.screenModel.x(t)},0)),u=x.reduce(function(t,e){return t+e[o.dim]},0)}else{var _=e.data().filter(function(a){var r=a[o.dim];return a===t.data||(r===u||r-u==0)&&(e.screenModel.y(a)-e.screenModel.y(t.data))*a[l.dim]>0});g=(h<0?Math.max:Math.min).apply(null,_.map(function(t){return e.screenModel.y(t)},0)),h=_.reduce(function(t,e){return t+e[l.dim]},0)}var p=t.node.getBBox(),m=["ELEMENT.AREA","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED"].indexOf(e.config.type)>=0?{x:p.width*(e.config.flip?u>0?1:0:.5),y:p.height*(e.config.flip?.5:h>0?1:0)}:{x:p.width/2,y:p.height/2};this._setValues({label:this._getFormat(o.dim)(u),start:0,value:f,crossPadding:m.x,minMode:a&&a.guide.x.hide},{label:this._getFormat(l.dim)(h),start:e.config.options.height,value:g,crossPadding:m.y,minMode:a&&a.guide.y.hide},{cls:d.toColor(c)?"":c,color:d.toColor(c)?c:""})},_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 a=d.getParentUnit(this._chart.getSpec(),t.config);this._showCrosshair(e,t,a)}}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=d.getFieldFormatters(this._chart.getSpec(),e.formatters),this._subscribeToHover()}}}i.a.api.plugins.add("crosshair",u),e.default=u}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"),require("d3-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var a="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var r in a)("object"==typeof exports?exports:t)[r]=a[r]}}(window,function(t,e){return function(t){var e={};function a(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,a),i.l=!0,i.exports}return a.m=t,a.c=e,a.d=function(t,e,r){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},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 r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(r,i,function(e){return t[e]}.bind(null,i));return r},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=18)}({0:function(e,a){e.exports=t},1:function(t,a){t.exports=e},18:function(t,e,a){"use strict";a.r(e);var r=a(0),i=a.n(r),n=a(1);const o="http://www.w3.org/2000/svg";var l=i.a.api.utils,s=i.a.api.svgUtils,d=i.a.api.pluginsSDK;function c(t){t=t||{};var e=document.createElementNS(o,"g"),a=n.select(e).attr("class","tau-crosshair__label");a.append("rect").attr("class","tau-crosshair__label__box"),a.append("text").attr("class","tau-crosshair__label__text-shadow"),a.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,n=e.text,o=e.color,l=e.colorCls;a.attr("class","tau-crosshair__label "+l);var s=t.halign,d=t.valign,c=t.hpad,u=t.vpad,h={left:"end",middle:"middle",right:"start"}[s],f={left:-c,middle:0,right:c}[s],g=a.select(".tau-crosshair__label__text").attr("fill",o),x=a.selectAll(".tau-crosshair__label__text, .tau-crosshair__label__text-shadow").attr("text-anchor",h).attr("x",r+f).attr("y",0).text(n),_=g.node().getBBox(),p={top:-u-_.height/2,middle:0,bottom:u+_.height/2}[d]-_.height/2-_.y;x.attr("y",i+p);var m=_.width+2*c,b=_.height+2*u,v={left:-m,middle:-m/2,right:0}[s],y={top:-b,middle:-b/2,bottom:0}[d];a.select(".tau-crosshair__label__box").attr("fill",o).attr("rx",t.boxCornerRadius).attr("ry",t.boxCornerRadius).attr("x",r+v).attr("y",i+y).attr("width",m).attr("height",b)}(i),function(){a.attr("transform","");var r=t.chart.getLayout().contentContainer.getBoundingClientRect(),i=t.chart.getSVG().getBoundingClientRect(),n=e.getBoundingClientRect(),o=Math.max(0,Math.max(r.left,i.left)-n.left)||Math.min(0,Math.min(r.right,i.right)-n.right),l=Math.max(0,Math.max(r.top,i.top)-n.top)||Math.min(0,Math.min(r.bottom,i.bottom)-n.bottom);a.attr("transform","translate("+o+","+l+")")}(),r},hide:function(){return e.parentNode&&e.parentNode.removeChild(e),r}};return r}function u(t){var e=l.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=n.select(document.createElementNS(o,"g")).attr("class","tau-crosshair");this._labels={x:null,y:null};var a=function(a){var r=t.append("g").attr("class","tau-crosshair__group "+a);r.append("line").attr("class","tau-crosshair__line-shadow"),r.append("line").attr("class","tau-crosshair__line"),this._labels[a]=c({container:r.node(),chart:this._chart,halign:"x"===a?"middle":"left",valign:"x"===a?"bottom":"middle",boxCornerRadius:e.labelBoxCornerRadius,hpad:e.labelBoxHPadding,vpad:e.labelBoxVPadding})}.bind(this);e.xAxis&&a("x"),e.yAxis&&a("y"),this._element=t},_setValues:function(t,a,r){var i=function(t){var a=this._element.select(".tau-crosshair__group."+t.dir);a.select(".tau-crosshair__line").attr("class","tau-crosshair__line "+r.cls).attr("stroke",r.color),a.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:a.start+(t.minMode?0:e.axisVPadding)},valuePt:{x:t.value,y:a.value+a.crossPadding},label:t.label,labelHAlign:"middle",labelVAlign:"bottom"}),i({dir:"y",startPt:{x:t.start-(a.minMode?0:e.axisHPadding),y:a.value},valuePt:{x:t.value-t.crossPadding,y:a.value},label:a.label,labelHAlign:"left",labelVAlign:"middle"})},_showCrosshair:function(t,e,a){var r=this._chart.getSVG(),i=e.config.options.container.node(),n=s.getDeepTransformTranslate(i);this._element.attr("transform",s.translate(n.x,n.y)),r.appendChild(this._element.node());var o=e.getScale("x"),l=e.getScale("y"),d=e.getScale("color"),c=d(t.data[d.dim]),u=t.data[o.dim],h=t.data[l.dim],f=e.screenModel.x(t.data),g=e.screenModel.y(t.data);if(e.config.stack)if(e.config.flip){var x=e.data().filter(function(a){var r=a[l.dim];return a===t.data||(r===h||r-h==0)&&(e.screenModel.x(t.data)-e.screenModel.x(a))*a[o.dim]>0});f=(u<0?Math.min:Math.max).apply(null,x.map(function(t){return e.screenModel.x(t)},0)),u=x.reduce(function(t,e){return t+e[o.dim]},0)}else{var _=e.data().filter(function(a){var r=a[o.dim];return a===t.data||(r===u||r-u==0)&&(e.screenModel.y(a)-e.screenModel.y(t.data))*a[l.dim]>0});g=(h<0?Math.max:Math.min).apply(null,_.map(function(t){return e.screenModel.y(t)},0)),h=_.reduce(function(t,e){return t+e[l.dim]},0)}var p=t.node.getBBox(),m=["ELEMENT.AREA","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED"].indexOf(e.config.type)>=0?{x:p.width*(e.config.flip?u>0?1:0:.5),y:p.height*(e.config.flip?.5:h>0?1:0)}:{x:p.width/2,y:p.height/2};this._setValues({label:this._getFormat(o.dim)(u),start:0,value:f,crossPadding:m.x,minMode:a&&a.guide.x.hide},{label:this._getFormat(l.dim)(h),start:e.config.options.height,value:g,crossPadding:m.y,minMode:a&&a.guide.y.hide},{cls:d.toColor(c)?"":c,color:d.toColor(c)?c:""})},_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 a=d.getParentUnit(this._chart.getSpec(),t.config);this._showCrosshair(e,t,a)}}else this._hideCrosshair()}.bind(this))},this)},_getFormat:function(t){return this._formatters[t]?this._formatters[t].format:t=>String(t)},onRender:function(){this._formatters=d.getFieldFormatters(this._chart.getSpec(),e.formatters),this._subscribeToHover()}}}i.a.api.plugins.add("crosshair",u),e.default=u}})}); \ No newline at end of file diff --git a/dist/plugins/diff-tooltip.css b/dist/plugins/diff-tooltip.css index bc068c363..d8c333406 100644 --- a/dist/plugins/diff-tooltip.css +++ b/dist/plugins/diff-tooltip.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 fbe2f9006..2a2b8ecbe 100644 --- a/dist/plugins/diff-tooltip.dark.css +++ b/dist/plugins/diff-tooltip.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 6f89b8dd9..93375496d 100644 --- a/dist/plugins/diff-tooltip.js +++ b/dist/plugins/diff-tooltip.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var i="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(window,function(t,e){return function(t){var e={};function i(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,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=36)}({0:function(e,i){e.exports=t},1:function(t,i){t.exports=e},2:function(t,e,i){"use strict";i.d(e,"a",function(){return n}),i.d(e,"b",function(){return r});var n="tau-chart__tooltip";function r(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,i=t.data;return t.fields.map(function(t){return e.itemTemplate({data:i,field:t})}).join("\n")},itemTemplate:function(t){var e=t.data,i=t.field,r=this.getLabel(i),o=this.getFormatter(i)(e[i]);return['
','
'+r+"
",'
'+o+"
","
"].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,i=t.text,r=t.cls;return['
','
'," "+(e?e()+" ":"")+i,"
","
"].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})})}}}},3:function(t,e,i){"use strict";var n=i(0),r=i.n(n),o=i(1),a=i(2),s=r.a.api.utils,l=r.a.api.domUtils,c=r.a.api.pluginsSDK,u="tau-chart__tooltip",h=function(){function t(t){this.settings=s.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=Object(a.b)(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 i=Array.from(document.querySelectorAll("."+t.settings.clsClickable)).concat(t.getDomNode()).map(function(t){return t.getBoundingClientRect()}),n=Math.min.apply(Math,i.map(function(t){return t.top})),r=Math.min.apply(Math,i.map(function(t){return t.left})),o=Math.max.apply(Math,i.map(function(t){return t.right})),a=Math.max.apply(Math,i.map(function(t){return t.bottom}));(e.clientXo||e.clientYa)&&t.setState({highlight:null,isStuck:!1})})},t.prototype.getDomNode=function(){return this._tooltip.getElement()},t.prototype.setState=function(t){var e=this,i=this.settings,n=this.state,r=this.state=Object.assign({},n,t);n.highlight=n.highlight||{data:null,cursor:null,unit:null},r.highlight=r.highlight||{data:null,cursor:null,unit:null},r.isStuck&&n.highlight.data&&(r.highlight=n.highlight),r.highlight.data!==n.highlight.data&&(r.highlight.data?(this._hideTooltip(),this._showTooltip(r.highlight.data,r.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(function(){e._setTargetSvgClass(!0)})):r.isStuck||!n.highlight.data||r.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!r.highlight.data||n.highlight.cursor&&r.highlight.cursor.x===n.highlight.cursor.x&&r.highlight.cursor.y===n.highlight.cursor.y||(this._tooltip.position(r.highlight.cursor.x,r.highlight.cursor.y),this._tooltip.updateSize());var o=this.getDomNode();this.settings.clickable&&r.isStuck!==n.isStuck&&(r.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),o.classList.add(i.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(r.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),o.classList.remove(i.clsStuck),requestAnimationFrame(function(){e._setTargetEventsEnabled(!0);var t=e._chart.getSVG();t&&l.dispatchMouseEvent(t,"mouseleave")})))},t.prototype._showTooltip=function(t,e){var i=this.settings,n=i.fields||"function"==typeof i.getFields&&i.getFields(this._chart)||Object.keys(t),r=this._renderTemplate(t,n);this._tooltip.content(r).position(e.x,e.y).place(i.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,i){var n=document.body.getBoundingClientRect();t.setState({highlight:i.data?{data:i.data,cursor:{x:i.event.clientX-n.left,y:i.event.clientY-n.top},unit:i.unit}:null})}),t.settings.clickable&&e.on("data-click",function(e,i){var n=document.body.getBoundingClientRect();t.setState(i.data?{highlight:{data:i.data,cursor:{x:i.event.clientX-n.left,y:i.event.clientY-n.top},unit:i.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 s.escapeHtml(e(t))}:e},t.prototype.getFieldLabel=function(t){var e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?s.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=c.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}},t.prototype._setTargetSvgClass=function(t){o.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)},t.prototype._setTargetEventsEnabled=function(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()},t}();e.a=h},36:function(t,e,i){"use strict";i.r(e);var n=i(0),r=i.n(n),o=i(3),a=i(2),s="diff-tooltip",l=s+"__item",c=s+"__header";var u=i(1),h=r.a.api.utils,d={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,i){t._drawRange(i)})},_drawRange:function(t){var e=this.node(),i=e.config,n=e.screenModel.flip,r=this._container,o="interval-highlight",a=o+"__gradient",s=t?t[0]:null,l=t?t[1]:null,c=n?i.options.width:i.options.height;h.take(function(){var e=r.selectAll("."+o).data(t?[1]:[]);return e.exit().remove(),{g:e,gEnter:e.enter().append("g").attr("class",o).attr("pointer-events","none")}}()).then(function(e){!function(){for(var e=o+"__defs",s=o+"__gradient-start",l=o+"__gradient-end",c=r.node();"svg"!==(c=c.parentNode).tagName;);var h=e+"__"+i.uid,d=u.select(c).selectAll("#"+h).data(t?[1]:[]);d.exit().remove();var p=d.enter().append("defs").attr("class",e).attr("id",h).append("linearGradient").attr("id",a).attr("x1","0%").attr("y1",n?"100%":"0%").attr("x2",n?"0%":"100%").attr("y2","0%");p.append("stop").attr("class",s).attr("offset","0%"),p.append("stop").attr("class",l).attr("offset","100%")}(),function(t){var e=t.g,i=t.gEnter,r=o+"__range",u=e.select("."+r),h=i.append("rect").attr("class",r).attr("fill","url(#"+a+")"),d=n?{x:0,y:l,width:c,height:s-l}:{x:s,y:0,width:l-s,height:c},p=d.x,g=d.y,f=d.width,_=d.height;h.merge(u).attr("x",p).attr("y",g).attr("width",Math.abs(f)).attr("height",Math.abs(_))}(e),function(t){var e=t.g,i=t.gEnter,r=o+"__range-start",a=e.select("."+r),l=i.append("line").attr("class",r),u=n?{x1:0,y1:s,x2:c,y2:s}:{x1:s,y1:0,x2:s,y2:c},h=u.x1,d=u.y1,p=u.x2,g=u.y2;l.merge(a).attr("x1",h).attr("y1",d).attr("x2",p).attr("y2",g)}(e),function(t){var e=t.g,i=t.gEnter,r=o+"__range-end",a=e.select("."+r),s=i.append("line").attr("class",r),u=n?{x1:0,y1:l,x2:c,y2:l}:{x1:l,y1:0,x2:l,y2:c},h=u.x1,d=u.y1,p=u.x2,g=u.y2;s.merge(a).attr("x1",h).attr("y1",d).attr("x2",p).attr("y2",g)}(e)})}},p=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),g=r.a.api.utils,f=function(t){function e(e){var i=t.call(this,e)||this;return i.onSpecReady=i._getSpecReadyHandler(),i}return p(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 i=Object(a.b)(t,e);return Object.assign({},i,{hasColor:function(){return null!=this.args.colorField},contentTemplate:function(t){return[this.fieldsTemplate(t),this.tableTemplate(t)].join("\n")},filterFields:function(e){var n=t.state.highlight.unit.screenModel.model,r=n.scaleColor,o=n.scaleX,a=n.scaleY,s=e.filter(function(t){return t!==r.dim&&t!==o.dim&&t!==a.dim}),l=function(){return s.push(o.dim)};return this.shouldShowColorTable()?l():(l(),r.dim&&s.push(r.dim),s.push(a.dim)),i.filterFields.call(this,s)},itemTemplate:function(t){var e=t.data,i=t.field,n=this.getLabel(i),r=this.getFormatter(i)(e[i]),o=this.args.prev,s=(this.args.valueField,this.shouldShowDiff(i)),c=['',""+r,s?" "+this.fieldUpdownTemplate(this.getDiff({data:e,prev:o,field:i})):"",""].join("");return['
','
'+n+"
"," "+c,"
"].join("\n")},shouldShowDiff:function(t){return t===this.args.valueField},getDiff:function(t){var e=t.data,i=t.prev,n=t.field,r=this.getFormatter(n),o=(e?e[n]:0)-(i?i[n]:0);return{diff:r(o),sign:Math.sign(o)}},fieldUpdownTemplate:function(t){var e=t.diff,i=t.sign,n=s+"__field__updown";return['0?"positive":"negative")+'">',(i>0?"▲":i<0?"▼":"")+(0===i?"":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,i=t.valueField,n=this.getLabel(e),r=this.getLabel(i);return['
',' '+n+"",' '+r+"",' ▼▲',"
"].join("\n")},tableBodyTemplate:function(t){var e=this,i=t.data,n=t.groups,r=t.valueField,o=t.colorField,a=i,l=n.map(function(t){var e=t.data;return e?e[r]:0}),c=Math.min.apply(Math,l),u=Math.max.apply(Math,l);return['
','
',n.map(function(t){var i=t.data,n=t.prev;return e.tableRowTemplate({data:i,prev:n,highlighted:a,valueField:r,colorField:o,min:c,max:u})}).join("\n"),"
","
"].join("\n")},tableRowTemplate:function(t){var e=t.data,i=t.prev,n=t.highlighted,r=t.valueField,o=t.colorField,a=t.min,s=t.max,c=e?e[r]:0,u=this.getFormatter(o)((e||i)[o]),h=this.getFormatter(r)(c),d=e===n,p=this.getDiff({data:e,prev:i,field:r}),g=p.diff,f=p.sign,_=this.getColor(e||i),m=_.color,v=_.colorCls;return['
'," "+this.valueBarTemplate({min:a,max:s,v:c,color:m,colorCls:v}),' '+u+"",' '+h+""," "+this.updownTemplate({diff:g,sign:f}),"
"].join("\n")},valueBarTemplate:function(t){var e=t.min,i=t.max,n=t.v,r=t.color,o=t.colorCls;e=Math.min(e,0);var a=(i=Math.max(0,i))-e;return[""].join("\n")},getColor:function(e){var i=t.state.highlight.unit.screenModel;return{color:i.color(e),colorCls:i.class(e)}},updownTemplate:function(t){var e=t.diff,i=t.sign,n=l+"__updown";return['0?"positive":"negative")+'">',(i>0?"▲":i<0?"▼":"")+(0===i?"":e),""].join("")},didMount:function(){i.didMount.call(this),this._scrollToHighlighted(),this._reserveSpaceForUpdown()},_scrollToHighlighted:function(){var e=t.getDomNode(),i=e.querySelector("."+s+"__body"),n=e.querySelector("."+s+"__body__content"),r=e.querySelector("."+l+"_highlighted");if(i&&n&&r){var o=i.getBoundingClientRect(),a=n.getBoundingClientRect(),c=r.getBoundingClientRect(),u=0;if(c.bottom>o.bottom){var h=c.bottom-o.bottom+c.height,d=a.bottom-o.bottom;u=-Math.min(h,d),n.style.transform="translateY("+u+"px)"}a.top+uo.bottom&&i.classList.add(s+"__body_overflow-bottom")}},_reserveSpaceForUpdown:function(){var e=t.getDomNode(),i=e.querySelector("."+s+"__body"),n=e.querySelector("."+c);if(i&&n){var r="."+l+"__updown:not(:empty)",o=Array.from(e.querySelectorAll(r)).map(function(t){return t.scrollWidth}),a=Math.max.apply(Math,o),u=Math.max(0,Math.ceil(a-15));i.style.paddingRight=u+"px",n.style.paddingRight=u+"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 i=this.state.highlight.unit,n=i.screenModel,r=n.model,o=r.scaleColor,a=(r.scaleX,r.scaleY),s=this._unitsGroupedData.get(i),l=this._getHighlightRange(t,i),c=l[0],u=l[1],h=function(t){var e=n.model.color(t);return isFinite(c)&&s[c][e]?s[c][e][0]:null},d=h(t),p=i.config.stack,g=!(!i.config.flip&&i.config.guide.obsoleteVerticalStackOrder&&i.config.stack),f=function(){var t=o.domain().slice().reduce(function(t,e,i){return t[e]=i,t},{});return g?function(e,i){return t[e[o.dim]]-t[i[o.dim]]}:function(e,i){return t[i[o.dim]]-t[e[o.dim]]}}(),_=g?function(t,e){return a(t[a.dim])-a(e[a.dim])}:function(t,e){return a(e[a.dim])-a(t[a.dim])},m=function(t){return Object.keys(s[t]).reduce(function(e,i){return e.concat(s[t][i])},[]).sort(p?f:_)},v=m(u).map(function(t){n.model.color(t);return{data:t,prev:h(t)}});if(isFinite(c)){var y=m(c),b=v.reduce(function(t,e){return t[n.model.color(e.data)]=!0,t},{});y.forEach(function(t){var e=n.model.color(t);b[e]||v.push({data:null,prev:t})}),p&&v.sort(function(t,e){return f(t.data||t.prev,e.data||e.prev)})}return this._template.render({data:t,prev:d,fields:e,groups:v,valueField:a.dim,colorField:o.dim})},e.prototype._getRenderHandler=function(){var e=t.prototype._getRenderHandler.call(this);return function(){var t=this;e.call(this);var i=this._chart,n=i.select(function(t){return"chart"===t.config.namespace&&0===t.config.type.indexOf("ELEMENT.")&&"ELEMENT.INTERVAL_HIGHLIGHT"!==t.config.type}),r=i.select(function(t){return"ELEMENT.INTERVAL_HIGHLIGHT"===t.config.type}).reduce(function(t,e,i){return t[i]=e,t},{});n.forEach(function(e,i){var n=e.data();t._unitsGroupedData.set(e,t._getGroupedData(n,e)),e.on("data-hover",function(n,o){var a=r[i],s=o.unit&&o.unit===e?t._getHighlightRange(o.data,o.unit):null;a.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 i=JSON.parse(JSON.stringify(t));i.type="ELEMENT.INTERVAL_HIGHLIGHT",i.namespace="highlight";var n=e.units.indexOf(t);e.units.splice(n,0,i)}})}},e.prototype._getGroupedData=function(t,e){var i=e.screenModel.model.scaleX,n=g.groupBy(t,function(t){return i(t[i.dim]).toString()}),o=e.config.guide.x.tickPeriod||e.config.guide.x.timeInterval;if(o){var a=i.domain(),s=e.config.guide.utcTime;r.a.api.tickPeriod.generate(a[0],a[1],o,{utc:s}).filter(function(t){return t>=a[0]&&t<=a[1]}).forEach(function(t){var e=i(t);n[e]||(n[e]=[])})}return Object.keys(n).reduce(function(t,i){return t[i]=g.groupBy(n[i],function(t){return e.screenModel.model.color(t)}),t},{})},e.prototype._getHighlightRange=function(t,e){var i=e.screenModel.flip,n=e.screenModel.model.scaleX,r=n(t[n.dim]),o=this._unitsGroupedData.get(e),a=Object.keys(o).map(Number).sort(i?function(t,e){return e-t}:function(t,e){return t-e}),s=a.indexOf(r);return 0===s?[r,r]:[a[s-1],r]},e}(o.a);function _(t){return new f(t)}r.a.api.unitsRegistry.reg("ELEMENT.INTERVAL_HIGHLIGHT",d,"ELEMENT.GENERIC.CARTESIAN"),r.a.api.plugins.add("diff-tooltip",_);e.default=_}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"),require("d3-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var i="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(window,function(t,e){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=35)}({0:function(e,i){e.exports=t},1:function(t,i){t.exports=e},2:function(t,e,i){"use strict";i.d(e,"a",function(){return s}),i.d(e,"b",function(){return n});const s="tau-chart__tooltip";function n(t,e){return{render(t){return this.args=t,t=Object.assign({},t,{fields:this.filterFields(t.fields)}),this.rootTemplate(t)},rootTemplate(t){return[`
`,this.buttonsTemplate(),"
",`
`,this.contentTemplate(t),"
"].join("\n")},contentTemplate(t){return this.fieldsTemplate(t)},filterFields:t=>t,getLabel:e=>t.getFieldLabel(e),getFormatter:e=>t.getFieldFormat(e),fieldsTemplate({data:t,fields:e}){return e.map(e=>this.itemTemplate({data:t,field:e})).join("\n")},itemTemplate({data:t,field:e}){const i=this.getLabel(e),n=this.getFormatter(e)(t[e]);return[`
`,`
${i}
`,`
${n}
`,"
"].join("\n")},buttonsTemplate(){return[this.buttonTemplate({cls:"i-role-exclude",text:"Exclude",icon:()=>''})].join("\n")},buttonTemplate:({icon:t,text:e,cls:i})=>[`
`,`
`,` ${t?`${t()} `:""}${e}`,"
","
"].join("\n"),didMount(){const e=t.getDomNode().querySelector(".i-role-exclude");e&&e.addEventListener("click",()=>{t.excludeHighlightedElement(),t.setState({highlight:null,isStuck:!1})})}}}},3:function(t,e,i){"use strict";i.d(e,"a",function(){return d});var s=i(0),n=i.n(s),a=i(1),o=i(2);const l=n.a.api.utils,r=n.a.api.domUtils,c=n.a.api.pluginsSDK,h="tau-chart__tooltip";class d{constructor(t){this.settings=l.defaults(t||{},{align:"bottom-right",clickable:!0,clsClickable:`${h}__clickable`,clsStuck:"stuck",clsTarget:`${h}-target`,escapeHtml:!0,fields:null,formatters:{},getTemplate:null,spacing:24,winBound:12,onExclude:()=>{}}),this.onRender=this._getRenderHandler()}init(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()}_getTemplate(){const t=Object(o.b)(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t}_renderTemplate(t,e){return this._template.render({data:t,fields:e})}_initDomEvents(){this._scrollHandler=(()=>{this.setState({highlight:null,isStuck:!1})}),window.addEventListener("scroll",this._scrollHandler,!0),this.settings.clickable&&(this._outerClickHandler=(t=>{const e=Array.from(document.querySelectorAll(`.${this.settings.clsClickable}`)).concat(this.getDomNode()).map(t=>t.getBoundingClientRect()),i=Math.min(...e.map(t=>t.top)),s=Math.min(...e.map(t=>t.left)),n=Math.max(...e.map(t=>t.right)),a=Math.max(...e.map(t=>t.bottom));(t.clientXn||t.clientYa)&&this.setState({highlight:null,isStuck:!1})}))}getDomNode(){return this._tooltip.getElement()}setState(t){const e=this.settings,i=this.state,s=this.state=Object.assign({},i,t);i.highlight=i.highlight||{data:null,cursor:null,unit:null},s.highlight=s.highlight||{data:null,cursor:null,unit:null},s.isStuck&&i.highlight.data&&(s.highlight=i.highlight),s.highlight.data!==i.highlight.data&&(s.highlight.data?(this._hideTooltip(),this._showTooltip(s.highlight.data,s.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(()=>{this._setTargetSvgClass(!0)})):s.isStuck||!i.highlight.data||s.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!s.highlight.data||i.highlight.cursor&&s.highlight.cursor.x===i.highlight.cursor.x&&s.highlight.cursor.y===i.highlight.cursor.y||(this._tooltip.position(s.highlight.cursor.x,s.highlight.cursor.y),this._tooltip.updateSize());const n=this.getDomNode();this.settings.clickable&&s.isStuck!==i.isStuck&&(s.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),n.classList.add(e.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(s.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),n.classList.remove(e.clsStuck),requestAnimationFrame(()=>{this._setTargetEventsEnabled(!0);const t=this._chart.getSVG();t&&r.dispatchMouseEvent(t,"mouseleave")})))}_showTooltip(t,e){const i=this.settings,s=i.fields||"function"==typeof i.getFields&&i.getFields(this._chart)||Object.keys(t),n=this._renderTemplate(t,s);this._tooltip.content(n).position(e.x,e.y).place(i.align).show().updateSize(),this._template.didMount&&this._template.didMount()}_hideTooltip(){window.removeEventListener("click",this._outerClickHandler,!0),this._template.willUnmount&&this._template.willUnmount(),this._tooltip.hide()}destroy(){window.removeEventListener("scroll",this._scrollHandler,!0),this._setTargetSvgClass(!1),this.setState({highlight:null,isStuck:!1}),this._tooltip.destroy()}_subscribeToHover(){var t=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(e=>t.indexOf(e.config.type)>=0).forEach(t=>{t.on("data-hover",(t,e)=>{var i=document.body.getBoundingClientRect();this.setState({highlight:e.data?{data:e.data,cursor:{x:e.event.clientX-i.left,y:e.event.clientY-i.top},unit:e.unit}:null})}),this.settings.clickable&&t.on("data-click",(t,e)=>{const i=document.body.getBoundingClientRect();this.setState(e.data?{highlight:{data:e.data,cursor:{x:e.event.clientX-i.left,y:e.event.clientY-i.top},unit:e.unit},isStuck:!0}:{highlight:null,isStuck:null})})})}getFieldFormat(t){const e=this._formatters[t]?this._formatters[t].format:t=>String(t);return this.settings.escapeHtml?t=>l.escapeHtml(e(t)):e}getFieldLabel(t){const e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?l.escapeHtml(e):e}_accentFocus(t){const e=e=>e===t;this._chart.select(()=>!0).forEach(t=>{t.fire("highlight",e)})}_removeFocus(){const t=()=>null;this._chart.select(()=>!0).forEach(e=>{e.fire("highlight",t),e.fire("highlight-data-points",t)})}excludeHighlightedElement(){const t=this.state.highlight.data;this._chart.addFilter({tag:"exclude",predicate:e=>e!==t}),this.settings.onExclude(t),this._chart.refresh()}_getRenderHandler(){return function(){this._formatters=c.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}}_setTargetSvgClass(t){a.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)}_setTargetEventsEnabled(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()}}},35:function(t,e,i){"use strict";i.r(e);var s=i(0),n=i.n(s),a=i(3),o=i(2);const l="diff-tooltip",r=`${l}__item`,c=`${l}__header`;function h(t,e){const i=Object(o.b)(t,e);return Object.assign({},i,{hasColor(){const{colorField:t}=this.args;return null!=t},contentTemplate(t){return[this.fieldsTemplate(t),this.tableTemplate(t)].join("\n")},filterFields(e){const s=t.state.highlight.unit.screenModel,{scaleColor:n,scaleX:a,scaleY:o}=s.model,l=e.filter(t=>t!==n.dim&&t!==a.dim&&t!==o.dim),r=()=>l.push(a.dim);return this.shouldShowColorTable()?r():(r(),(()=>n.dim&&l.push(n.dim))(),(()=>l.push(o.dim))()),i.filterFields.call(this,l)},itemTemplate({data:t,field:e}){const i=this.getLabel(e),s=this.getFormatter(e)(t[e]),n=this.args.prev,a=(this.args.valueField,this.shouldShowDiff(e)),l=[``,`${s}`,a?` ${this.fieldUpdownTemplate(this.getDiff({data:t,prev:n,field:e}))}`:"",""].join("");return[`
`,`
${i}
`,` ${l}`,"
"].join("\n")},shouldShowDiff(t){return t===this.args.valueField},getDiff({data:t,prev:e,field:i}){const s=this.getFormatter(i),n=(t?t[i]:0)-(e?e[i]:0);return{diff:s(n),sign:Math.sign(n)}},fieldUpdownTemplate({diff:t,sign:e}){const i=`${l}__field__updown`;return[``,`${e>0?"▲":e<0?"▼":""}${0===e?"":t}`,""].join("")},shouldShowColorTable(){const t=this.args.groups;return this.hasColor()&&t.length>1},tableTemplate(t){return this.shouldShowColorTable()?[`
`,this.tableHeaderTemplate(t),this.tableBodyTemplate(t),"
"].join("\n"):""},tableHeaderTemplate({colorField:t,valueField:e}){const i=this.getLabel(t),s=this.getLabel(e);return[`
`,` ${i}`,` ${s}`,` ▼▲`,"
"].join("\n")},tableBodyTemplate({data:t,groups:e,valueField:i,colorField:s}){const n=t,a=e.map(({data:t})=>t?t[i]:0),o=Math.min(...a),r=Math.max(...a);return[`
`,`
`,e.map(({data:t,prev:e})=>this.tableRowTemplate({data:t,prev:e,highlighted:n,valueField:i,colorField:s,min:o,max:r})).join("\n"),"
","
"].join("\n")},tableRowTemplate({data:t,prev:e,highlighted:i,valueField:s,colorField:n,min:a,max:o}){const l=t?t[s]:0,c=this.getFormatter(n)((t||e)[n]),h=this.getFormatter(s)(l),d=t===i,{diff:u,sign:g}=this.getDiff({data:t,prev:e,field:s}),{color:p,colorCls:_}=this.getColor(t||e);return[`
`,` ${this.valueBarTemplate({min:a,max:o,v:l,color:p,colorCls:_})}`,` ${c}`,` ${h}`,` ${this.updownTemplate({diff:u,sign:g})}`,"
"].join("\n")},valueBarTemplate({min:t,max:e,v:i,color:s,colorCls:n}){t=Math.min(t,0);const a=(e=Math.max(0,e))-t;return[""].join("\n")},getColor(e){const i=t.state.highlight.unit.screenModel;return{color:i.color(e),colorCls:i.class(e)}},updownTemplate({diff:t,sign:e}){const i=`${r}__updown`;return[``,`${e>0?"▲":e<0?"▼":""}${0===e?"":t}`,""].join("")},didMount(){i.didMount.call(this),this._scrollToHighlighted(),this._reserveSpaceForUpdown()},_scrollToHighlighted(){const e=t.getDomNode(),i=e.querySelector(`.${l}__body`),s=e.querySelector(`.${l}__body__content`),n=e.querySelector(`.${r}_highlighted`);if(!(i&&s&&n))return;const a=i.getBoundingClientRect(),o=s.getBoundingClientRect(),c=n.getBoundingClientRect();var h=0;if(c.bottom>a.bottom){const t=c.bottom-a.bottom+c.height,e=o.bottom-a.bottom;h=-Math.min(t,e),s.style.transform=`translateY(${h}px)`}o.top+ha.bottom&&i.classList.add(`${l}__body_overflow-bottom`)},_reserveSpaceForUpdown(){const e=t.getDomNode(),i=e.querySelector(`.${l}__body`),s=e.querySelector(`.${c}`);if(!i||!s)return;const n=`.${r}__updown:not(:empty)`,a=Array.from(e.querySelectorAll(n)).map(t=>t.scrollWidth),o=Math.max(...a),h=Math.max(0,Math.ceil(o-15));i.style.paddingRight=`${h}px`,s.style.paddingRight=`${h}px`}})}var d=i(1);const u=n.a.api.utils,g="ELEMENT.INTERVAL_HIGHLIGHT";var p={draw(){const t=this.node().config;this._container=t.options.slot(t.uid)},addInteraction(){this.node().on("interval-highlight",(t,e)=>{this._drawRange(e)})},_drawRange(t){const e=this.node(),i=e.config,s=e.screenModel.flip,n=this._container,a="interval-highlight",o=`${a}__gradient`,l=t?t[0]:null,r=t?t[1]:null,c=s?i.options.width:i.options.height;u.take(function(){const e=n.selectAll(`.${a}`).data(t?[1]:[]);e.exit().remove();const i=e.enter().append("g").attr("class",a).attr("pointer-events","none");return{g:e,gEnter:i}}()).then(e=>{!function(){const e=`${a}__defs`,l=`${a}__gradient-start`,r=`${a}__gradient-end`;for(var c=n.node();"svg"!==(c=c.parentNode).tagName;);const h=`${e}__${i.uid}`,u=d.select(c).selectAll(`#${h}`).data(t?[1]:[]);u.exit().remove();const g=u.enter().append("defs").attr("class",e).attr("id",h).append("linearGradient").attr("id",o).attr("x1","0%").attr("y1",s?"100%":"0%").attr("x2",s?"0%":"100%").attr("y2","0%");g.append("stop").attr("class",l).attr("offset","0%"),g.append("stop").attr("class",r).attr("offset","100%")}(),function({g:t,gEnter:e}){const i=`${a}__range`,n=t.select(`.${i}`),h=e.append("rect").attr("class",i).attr("fill",`url(#${o})`),{x:d,y:u,width:g,height:p}=s?{x:0,y:r,width:c,height:l-r}:{x:l,y:0,width:r-l,height:c};h.merge(n).attr("x",d).attr("y",u).attr("width",Math.abs(g)).attr("height",Math.abs(p))}(e),function({g:t,gEnter:e}){const i=`${a}__range-start`,n=t.select(`.${i}`),o=e.append("line").attr("class",i),{x1:r,y1:h,x2:d,y2:u}=s?{x1:0,y1:l,x2:c,y2:l}:{x1:l,y1:0,x2:l,y2:c};o.merge(n).attr("x1",r).attr("y1",h).attr("x2",d).attr("y2",u)}(e),function({g:t,gEnter:e}){const i=`${a}__range-end`,n=t.select(`.${i}`),o=e.append("line").attr("class",i),{x1:l,y1:h,x2:d,y2:u}=s?{x1:0,y1:r,x2:c,y2:r}:{x1:r,y1:0,x2:r,y2:c};o.merge(n).attr("x1",l).attr("y1",h).attr("x2",d).attr("y2",u)}(e)})}};const _=n.a.api.utils;class m extends a.a{constructor(t){super(t),this.onSpecReady=this._getSpecReadyHandler()}init(t){super.init(t),this._unitsGroupedData=new Map}_getTemplate(){const t=h(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t}_renderTemplate(t,e){const i=this.state.highlight.unit,s=i.screenModel,{scaleColor:n,scaleX:a,scaleY:o}=s.model,l=this._unitsGroupedData.get(i),[r,c]=this._getHighlightRange(t,i),h=t=>{const e=s.model.color(t);return isFinite(r)&&l[r][e]?l[r][e][0]:null},d=h(t),u=i.config.stack,g=!(!i.config.flip&&i.config.guide.obsoleteVerticalStackOrder&&i.config.stack),p=(()=>{const t=n.domain().slice().reduce((t,e,i)=>(t[e]=i,t),{});return g?(e,i)=>t[e[n.dim]]-t[i[n.dim]]:(e,i)=>t[i[n.dim]]-t[e[n.dim]]})(),_=g?(t,e)=>o(t[o.dim])-o(e[o.dim]):(t,e)=>o(e[o.dim])-o(t[o.dim]),m=t=>Object.keys(l[t]).reduce((e,i)=>e.concat(l[t][i]),[]).sort(u?p:_),f=m(c).map(t=>{s.model.color(t);return{data:t,prev:h(t)}});if(isFinite(r)){const t=m(r),e=f.reduce((t,e)=>(t[s.model.color(e.data)]=!0,t),{});t.forEach(t=>{const i=s.model.color(t);e[i]||f.push({data:null,prev:t})}),u&&f.sort((t,e)=>p(t.data||t.prev,e.data||e.prev))}return this._template.render({data:t,prev:d,fields:e,groups:f,valueField:o.dim,colorField:n.dim})}_getRenderHandler(){const t=super._getRenderHandler();return function(){t.call(this);const e=this._chart,i=e.select(t=>"chart"===t.config.namespace&&0===t.config.type.indexOf("ELEMENT.")&&t.config.type!==g),s=e.select(t=>t.config.type===g).reduce((t,e,i)=>(t[i]=e,t),{});i.forEach((t,e)=>{const i=t.data();this._unitsGroupedData.set(t,this._getGroupedData(i,t)),t.on("data-hover",(i,n)=>{const a=s[e],o=n.unit&&n.unit===t?this._getHighlightRange(n.data,n.unit):null;a.fire("interval-highlight",o)})})}}_getSpecReadyHandler(){return function(t,e){t.traverseSpec(e,(t,e)=>{if(0!==t.type.indexOf("ELEMENT."))return;const i=JSON.parse(JSON.stringify(t));i.type=g,i.namespace="highlight";const s=e.units.indexOf(t);e.units.splice(s,0,i)})}}_getGroupedData(t,e){const i=e.screenModel.model.scaleX,s=_.groupBy(t,t=>i(t[i.dim]).toString()),a=e.config.guide.x.tickPeriod||e.config.guide.x.timeInterval;if(a){const t=i.domain(),o=e.config.guide.utcTime;n.a.api.tickPeriod.generate(t[0],t[1],a,{utc:o}).filter(e=>e>=t[0]&&e<=t[1]).forEach(t=>{const e=i(t);s[e]||(s[e]=[])})}return Object.keys(s).reduce((t,i)=>(t[i]=_.groupBy(s[i],t=>e.screenModel.model.color(t)),t),{})}_getHighlightRange(t,e){const i=e.screenModel.flip,s=e.screenModel.model.scaleX,n=s(t[s.dim]),a=this._unitsGroupedData.get(e),o=Object.keys(a).map(Number).sort(i?(t,e)=>e-t:(t,e)=>t-e),l=o.indexOf(n);return 0===l?[n,n]:[o[l-1],n]}}function f(t){return new m(t)}n.a.api.unitsRegistry.reg(g,p,"ELEMENT.GENERIC.CARTESIAN"),n.a.api.plugins.add("diff-tooltip",f);e.default=f}})}); \ No newline at end of file diff --git a/dist/plugins/export-to.css b/dist/plugins/export-to.css index c0558eadd..a1f36ff50 100644 --- a/dist/plugins/export-to.css +++ b/dist/plugins/export-to.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 c0558eadd..a1f36ff50 100644 --- a/dist/plugins/export-to.dark.css +++ b/dist/plugins/export-to.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 b9b9b0554..abd359670 100644 --- a/dist/plugins/export-to.js +++ b/dist/plugins/export-to.js @@ -1,10 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var i="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(window,function(t,e){return function(t){var e={};function i(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,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=19)}([function(e,i){e.exports=t},function(t,i){t.exports=e},,,,,function(t,e,i){t.exports=function(t,e){"use strict";var i;return t=t&&t.hasOwnProperty("default")?t.default:t,e=e&&e.hasOwnProperty("default")?e.default:e,function(i){var n;function r(){return document.createElement("canvas")}i.exports,(n=window).DOMParser=window.DOMParser;var a,s=function(i,o,l){if(null!=i||null!=o||null!=l){var h=function(i){var s={opts:i,FRAMERATE:30,MAX_VIRTUAL_PIXELS:3e4,log:function(t){}};1==s.opts.log&&"undefined"!=typeof console&&(s.log=function(t){console.log(t)}),s.init=function(t){var e=0;s.UniqueId=function(){return"canvg"+ ++e},s.Definitions={},s.Styles={},s.StylesSpecificity={},s.Animations=[],s.Images=[],s.ctx=t,s.ViewPort=new function(){this.viewPorts=[],this.Clear=function(){this.viewPorts=[]},this.SetCurrent=function(t,e){this.viewPorts.push({width:t,height:e})},this.RemoveCurrent=function(){this.viewPorts.pop()},this.Current=function(){return this.viewPorts[this.viewPorts.length-1]},this.width=function(){return this.Current().width},this.height=function(){return this.Current().height},this.ComputeSize=function(t){return null!=t&&"number"==typeof t?t:"x"==t?this.width():"y"==t?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}},s.init(),s.ImagesLoaded=function(){for(var t=0;t]*>/,"");var e=new ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}try{var a=new n.DOMParser(i.xmldom||{});return a.parseFromString(t,"image/svg+xml")}catch(e){return(a=new n.DOMParser(i.xmldom||{})).parseFromString(t,"text/xml")}},s.Property=function(t,e){this.name=t,this.value=e},s.Property.prototype.getValue=function(){return this.value},s.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},s.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},s.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},s.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},s.Property.prototype.addOpacity=function(e){var i=this.value;if(null!=e.value&&""!=e.value&&"string"==typeof this.value){var n=new t(this.value);n.ok&&(i="rgba("+n.r+", "+n.g+", "+n.b+", "+e.numValue()+")")}return new s.Property(this.name,i)},s.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t&&(t=t[1]),t||(t=this.value),s.Definitions[t]},s.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},s.Property.prototype.getFillStyleDefinition=function(t,e){var i=this.getDefinition();if(null!=i&&i.createGradient)return i.createGradient(s.ctx,t,e);if(null!=i&&i.createPattern){if(i.getHrefAttribute().hasValue()){var n=i.attribute("patternTransform");i=i.getHrefAttribute().getDefinition(),n.hasValue()&&(i.attribute("patternTransform",!0).value=n.value)}return i.createPattern(s.ctx,t)}return null},s.Property.prototype.getDPI=function(t){return 96},s.Property.prototype.getEM=function(t){var e=12,i=new s.Property("fontSize",s.Font.Parse(s.ctx.font).fontSize);return i.hasValue()&&(e=i.toPixels(t)),e},s.Property.prototype.getUnits=function(){var t=this.value+"";return t.replace(/[0-9\.\-]/g,"")},s.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var i=this.value+"";if(i.match(/em$/))return this.numValue()*this.getEM(t);if(i.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(i.match(/px$/))return this.numValue();if(i.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(i.match(/pc$/))return 15*this.numValue();if(i.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(i.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(i.match(/in$/))return this.numValue()*this.getDPI(t);if(i.match(/%$/))return this.numValue()*s.ViewPort.ComputeSize(t);var n=this.numValue();return e&&n<1?n*s.ViewPort.ComputeSize(t):n},s.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())},s.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 o={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 s.Property.prototype.toTextBaseline=function(){return this.hasValue()?o[this.value]:null},s.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,i,n,r,a){var o=null!=a?this.Parse(a):this.CreateFont("","","","","",s.ctx.font);return{fontFamily:r=r||o.fontFamily,fontSize:n||o.fontSize,fontStyle:t||o.fontStyle,fontWeight:i||o.fontWeight,fontVariant:e||o.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var t=this;this.Parse=function(e){for(var i={},n=s.trim(s.compressSpaces(e||"")).split(" "),r={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},a="",o=0;othis.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,i,n,r,a){var s=t+2/3*(i-t),o=e+2/3*(n-e),l=s+1/3*(r-t),h=o+1/3*(a-e);this.addBezierCurve(t,e,s,l,o,h,r,a)},this.addBezierCurve=function(t,e,i,n,r,a,s,o){var l=[t,e],h=[i,n],u=[r,a],c=[s,o];this.addPoint(l[0],l[1]),this.addPoint(c[0],c[1]);for(var f=0;f<=1;f++){var d=function(t){return Math.pow(1-t,3)*l[f]+3*Math.pow(1-t,2)*t*h[f]+3*(1-t)*Math.pow(t,2)*u[f]+Math.pow(t,3)*c[f]},p=6*l[f]-12*h[f]+6*u[f],m=-3*l[f]+9*h[f]-9*u[f]+3*c[f],g=3*h[f]-3*l[f];if(0!=m){var y=Math.pow(p,2)-4*g*m;if(!(y<0)){var v=(-p+Math.sqrt(y))/(2*m);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 s.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 s.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,i){null!=i&&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,h=/(\.[^\s\+>~\.\[:]+)/g,u=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,c=/(:[\w-]+\([^\)]*\))/gi,f=/(:[^\s\+>~\.\[:]+)/g,d=/([^\s\+>~\.\[:]+)/g;function p(t){var e=[0,0,0],i=function(i,n){var r=t.match(i);null!=r&&(e[n]+=r.length,t=t.replace(i," "))};return t=(t=t.replace(/:not\(([^\)]*)\)/g," $1 ")).replace(/{[\s\S]*/gm," "),i(o,1),i(l,0),i(h,1),i(u,2),i(c,1),i(f,1),t=(t=t.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),i(d,2),e.join("")}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,i,n,r,a){var o={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:i,scaleWidth:n,scaleHeight:r};for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);s(this.canvas,t,o)}),i.exports=s}(i={exports:{}}),i.exports}(i(20),i(21))},function(t,e,i){var n,r=r||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},i=t.document.createElementNS("http://www.w3.org/1999/xhtml","a"),n="download"in i,r=/constructor/i.test(t.HTMLElement)||t.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent),s=function(e){(t.setImmediate||t.setTimeout)(function(){throw e},0)},o=function(t){setTimeout(function(){"string"==typeof t?e().revokeObjectURL(t):t.remove()},4e4)},l=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},h=function(h,u,c){c||(h=l(h));var f,d=this,p="application/octet-stream"===h.type,m=function(){!function(t,e,i){for(var n=(e=[].concat(e)).length;n--;){var r=t["on"+e[n]];if("function"==typeof r)try{r.call(t,i||t)}catch(t){s(t)}}}(d,"writestart progress write writeend".split(" "))};if(d.readyState=d.INIT,n)return f=e().createObjectURL(h),void setTimeout(function(){i.href=f,i.download=u,function(t){var e=new MouseEvent("click");t.dispatchEvent(e)}(i),m(),o(f),d.readyState=d.DONE});!function(){if((a||p&&r)&&t.FileReader){var i=new FileReader;return i.onloadend=function(){var e=a?i.result:i.result.replace(/^data:[^;]*;/,"data:attachment/file;");t.open(e,"_blank")||(t.location.href=e),e=void 0,d.readyState=d.DONE,m()},i.readAsDataURL(h),void(d.readyState=d.INIT)}f||(f=e().createObjectURL(h)),p?t.location.href=f:t.open(f,"_blank")||(t.location.href=f);d.readyState=d.DONE,m(),o(f)}()},u=h.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(t,e,i){return e=e||t.name||"download",i||(t=l(t)),navigator.msSaveOrOpenBlob(t,e)}:(u.abort=function(){},u.readyState=u.INIT=0,u.WRITING=1,u.DONE=2,u.error=u.onwritestart=u.onprogress=u.onwrite=u.onabort=u.onerror=u.onwriteend=null,function(t,e,i){return new h(t,e||t.name||"download",i)})}}("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=r:null!==i(22)&&null!==i(23)&&(void 0===(n=function(){return r}.call(e,i,e,t))||(t.exports=n))},function(t,e,i){(t.exports=i(24)(!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,i){"use strict";i.r(e);var n=i(0),r=i.n(n),a=i(6),s=i.n(a),o=i(7),l=i(8),h=i.n(l),u=i(1),c="Taucharts Export Plug-in:",f=r.a.api.utils,d=r.a.api.pluginsSDK,p=d.tokens(),m=function(t,e){return t.replace(new RegExp("^"+e+"+|"+e+"+$","g"),"")},g=function(t){return(t=Math.round(t))%2?t+1:t},y=function(t){return null===t||""===t||void 0===t};var v,b={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},x=function(t,e){e=e||"all";var i=document.createElement("style");return i.setAttribute("media",e),i.innerHTML=t,i},w=x(h.a,"print"),E=function(){w&&w.parentNode&&w.parentNode.removeChild(w),v&&v.parentNode&&v.parentNode.removeChild(v)};/PhantomJS/.test(navigator.userAgent)||("onafterprint"in window?window.addEventListener("afterprint",E):window.matchMedia("screen").addListener(function(t){t.matches&&E()}));var P=function(t,e,i){var n="data:"+e+";charset=UTF-8,%ef%bb%bf"+encodeURIComponent(i),r=document.createElement("a");r.setAttribute("href",n),r.setAttribute("download",t),r.setAttribute("target","_new"),document.body.appendChild(r),r.click(),document.body.removeChild(r),r=null},C=function(t){return[].slice.call(t.querySelectorAll("text.label")).forEach(function(t){t.innerHTML=[].slice.call(t.querySelectorAll("tspan")).reduce(function(t,e){var i=e.value||e.text||e.textContent||"";return t+(i=i.charAt(0).toUpperCase()+i.substr(1))},"")}),t},S=function(t,e,i){i=null==i?"":String(i);var n=(t||{})[e]||{};return(f.isObject(n.label)?n.label.text:n.label)||i};function B(t){return{onRender:function(){this._info=d.extractFieldsFormatInfo(this._chart.getSpec())},_normalizeExportFields:function(t,e){var i=this._info;return t.map(function(t){var e=t,n=i[t]||{};return"string"==typeof t&&(e={field:t,title:n.label||t}),"function"!=typeof e.value&&(e.value=function(t){var e=t[this.field];return n.isComplexField?(e||{})[n.tickLabel]:e}),e}).filter(function(t){return!e.find(function(e){return t.field===e})})},_handleError:function(t){r.a.api.globalSettings.log([c,t],"error")},_createDataUrl:function(t,e){var i=this;(function(){for(var t=[],e=0;e=200&&i.status<300){var t=i.responseText;r[e]=t,a.splice(a.indexOf(i),1),0===a.length&&n(null,r)}else a.forEach(function(t){return t.abort()}),n(new Error(i.status+": "+i.statusText),null)},i.onerror=function(t){a.forEach(function(t){return t.abort()}),n(t.error,null)},i.open("GET",t,!0),i.send(null)})}).apply(void 0,this._cssPaths.concat([function(n,a){if(n)e(n,null);else try{var o=a.join(" ").replace(/&/g,""),l=x(o),h=document.createElement("div");t.fire("beforeExportSVGNode");var c=t.getSVG().cloneNode(!0);t.fire("afterExportSVGNode"),h.appendChild(C(c)),u.select(c).attr("version",1.1).attr("xmlns","http://www.w3.org/2000/svg"),c.insertBefore(l,c.firstChild),i._renderAdditionalInfo(c,t),i._addBackground(c,i._backgroundColor);var f=document.createElement("canvas");f.height=c.getAttribute("height"),f.width=c.getAttribute("width"),s()(f,c.parentNode.innerHTML,{renderCallback:function(t){var i=(new XMLSerializer).serializeToString(t);"=0}))?'"'+a+'"':a}return t.concat(r)},[]).join(e))},[s.map(function(t){return t.title}).join(e)]).join("\r\n"),l=(this._fileName||"export")+".csv";P(l,"text/csv",o)},_renderFillLegend:function(e,i,n,r){var a=function(t,e){var i=t[0],n=t[1],r=(n-i)/(e-1),a=f.range(e-2).map(function(t){return i+r*(t+1)});return[i].concat(a).concat(n)},s=this._unit.getScale("color"),o=S(e.guide,"color",s.dim).toUpperCase(),l="text-transform:uppercase;font-weight:600;font-size:"+t.fontSize+"px",h=s.domain().sort(function(t,e){return t-e}),u=s.brewer.length,c=t.fontSize,d=a(h,u).reverse().map(function(t,e){return''}),p=a(h,3).reverse().map(function(t,e,i){return''+t+""}),m=[''," ",' ',d.join("")," "," ",' '+o+"",' ',' '," ",p.join("")," "," Sorry, your browser does not support inline SVG.",""].join(""),g=(new DOMParser).parseFromString(m,"application/xml").documentElement;return document.body.appendChild(g),i.append("g").attr("class","legend").attr("transform","translate("+(r+10)+","+t.paddingTop+")").node().appendChild(g),{h:120,w:0}},_renderColorLegend:function(e,i,n,r){var a=this._unit.getScale("color"),s=S(e.guide,"color",a.dim).toUpperCase(),o=this._getColorMap(n.getChartModelData({excludeFilter:["legend"]}),a,a.dim).values,l=i.append("g").attr("class","legend").attr("transform","translate("+(r+10)+","+t.paddingTop+")");return l.append("text").text(s.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":t.fontSize+"px"}),l.selectAll("g").data(o).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 f.escape(y(t.label)?"No "+s:t.label)}).style({"font-size":t.fontSize+"px"})}),{h:20*o.length,w:0}},_renderSizeLegend:function(e,i,n,r,a){var s,o=this._unit.getScale("size"),l=S(e.guide,"size",o.dim).toUpperCase(),h=n.getChartModelData().sort(function(t,e){return o(t[o.dim])-o(e[o.dim])}),u=h.length,c=h[0][o.dim],d=h[u-1][o.dim];if(d-c){var p=function(t){return Math.log(t)/Math.LN10}(d-c),m=4-p<0?0:Math.round(4-p),y=Math.pow(10,m),v=(d-c)/5;s=f.unique([c,c+v,c+2*v,c+3*v,d].map(function(t){return t===d||t===c?t:Math.round(t*y)/y}))}else s=[c];var b=s.map(function(t){var i=o(t),n=i/2;return{diameter:g(i+2),radius:n,value:t,className:e.color?"color-definite":""}}.bind(this)).reverse(),x=Math.max.apply(null,b.map(function(t){return t.diameter})),w=t.fontSize,E=0,P=i.append("g").attr("class","legend").attr("transform","translate("+(r+10)+","+(t.paddingTop+a.h+20)+")");P.append("text").text(l.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":w+"px"}),P.selectAll("g").data(b).enter().append("g").call(function(t){t.attr("transform",function(){var t="translate(5,"+(E+=x)+")";return E+=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("+x+","+w/2+")"}).append("text").attr("x",0).attr("y",0).text(function(t){return t.value}).style({"font-size":w+"px"})})},_renderAdditionalInfo:function(t,e){var i=this._findUnit(e);if(i){var n={h:0,w:0};t=u.select(t);var r=parseInt(t.attr("width"),10);t.attr("height");t.attr("width",r+160);var a=e.getScaleInfo(i.color);if(a.dim&&!a.discrete){var s=this._renderFillLegend(i,t,e,r);n.h=s.h+20,n.w=s.w}if(a.dim&&a.discrete){var o=this._renderColorLegend(i,t,e,r);n.h=o.h+20,n.w=o.w}var l=e.getScaleInfo(i.size);l.dim&&!l.discrete&&this._renderSizeLegend(i,t,e,r,n)}},_addBackground:function(t,e){if(e&&"transparent"!==e){var i=document.createElementNS("http://www.w3.org/2000/svg","rect");i.setAttribute("fill",e),i.setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",t.getAttribute("width")),i.setAttribute("height",t.getAttribute("height")),t.insertBefore(i,t.firstChild)}},onUnitDraw:function(t,e){r.a.api.isChartElement(e)&&"chart"===e.config.namespace&&(this._unit=e)},_getColorMap:function(t,e,i){return f.unique(t.map(function(t){var n=t[i];return{color:e(n),value:n,label:n}}),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 i=this["_to"+(t=t||"").charAt(0).toUpperCase()+t.slice(1)];i&&i.call(this,e)},_handleMenu:function(t,e,i){t.addEventListener("click",function(t){if("a"===t.target.tagName.toLowerCase()){var n=t.target.getAttribute("data-value");this._select(n,e),i.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===b.ESCAPE&&i.hide(),t.keyCode===b.DOWN&&(t.target.parentNode.nextSibling?t.target.parentNode.nextSibling.childNodes[0].focus():t.target.parentNode.parentNode.firstChild.childNodes[0].focus()),t.keyCode===b.UP&&(t.target.parentNode.previousSibling?t.target.parentNode.previousSibling.childNodes[0].focus():t.target.parentNode.parentNode.lastChild.childNodes[0].focus()),t.keyCode===b.ENTER){var n=t.target.getAttribute("data-value");this._select(n,e)}t.preventDefault()}.bind(this));var n=null,r=function(){n=setTimeout(function(){i.hide()},100)},a=function(){clearTimeout(n)},s=function(){i.toggle(),i.hidden||t.querySelectorAll("a")[0].focus()};t.addEventListener("blur",r,!0),t.addEventListener("focus",a,!0),this._container.addEventListener("click",s),this._onDestroy(function(){t.removeEventListener("blur",r,!0),t.removeEventListener("focus",a,!0),this._container.removeEventListener("click",s),clearTimeout(n)})},init:function(e){t=t||{},t=f.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.a.api.globalSettings.log('[export plugin]: the "cssPath" parameter should be specified for correct operation',"warn"));var i=t.visible?"":"display:none";this._container=e.insertToHeader('Export');var n=e.addBalloon({place:"bottom-left"});n.content(['"].join("")),n.attach(this._container);var a=n.getElement();a.setAttribute("tabindex","-1"),this._handleMenu(a,e,n);var s=e.on("export-to",function(t,e){var i=e.type,n=e.fileName;this._fileName=n||this._fileName,this._select(i,t)}.bind(this)),o=e.on("exportTo",function(t,e){r.a.api.globalSettings.log([c,"`exportTo` event is deprecated, use `export-to` instead."],"warn"),this._select(e,t)}.bind(this));this._onDestroy(function(){n.destroy(),e.removeHandler(s),e.removeHandler(o)})},_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.a.api.plugins.add("export-to",B),e.default=B},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 i=[{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)]}}],n=0;n3&&(this.alpha=o[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),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,n=0;n "+h.toRGB()+" -> "+h.toHex());l.appendChild(u),l.appendChild(c),o.appendChild(l)}catch(t){}return o}}},function(t,e){var i=[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],n=[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 r(t,e,i,n,r){if("string"==typeof t)t=document.getElementById(t);else if("undefined"!=typeof HTMLCanvasElement&&!t instanceof HTMLCanvasElement)return;var a,s=t.getContext("2d");try{try{a=s.getImageData(e,i,n,r)}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,i,n,a,o){if(!(isNaN(o)||o<1)){o|=0;var l=r(t,e,i,n,a);l=s(l,e,i,n,a,o),t.getContext("2d").putImageData(l,e,i)}}function s(t,e,r,a,s,o){var l,u,c,f,d,p,m,g,y,v,b,x,w,E,P,C,S,B,T,M,k,V,A,D,N=t.data,R=o+o+1,_=a-1,I=s-1,O=o+1,L=O*(O+1)/2,z=new h,F=z;for(c=1;c>H,0!=A?(A=255/A,N[p]=(g*G>>H)*A,N[p+1]=(y*G>>H)*A,N[p+2]=(v*G>>H)*A):N[p]=N[p+1]=N[p+2]=0,g-=x,y-=w,v-=E,b-=P,x-=U.r,w-=U.g,E-=U.b,P-=U.a,f=m+((f=l+o+1)<_?f:_)<<2,g+=C+=U.r=N[f],y+=S+=U.g=N[f+1],v+=B+=U.b=N[f+2],b+=T+=U.a=N[f+3],U=U.next,x+=M=j.r,w+=k=j.g,E+=V=j.b,P+=A=j.a,C-=M,S-=k,B-=V,T-=A,j=j.next,p+=4;m+=a}for(l=0;l>H,A>0?(A=255/A,N[f]=(g*G>>H)*A,N[f+1]=(y*G>>H)*A,N[f+2]=(v*G>>H)*A):N[f]=N[f+1]=N[f+2]=0,g-=x,y-=w,v-=E,b-=P,x-=U.r,w-=U.g,E-=U.b,P-=U.a,f=l+((f=u+O)>X,k[p+1]=y*F>>X,k[p+2]=v*F>>X,g-=b,y-=x,v-=w,b-=L.r,x-=L.g,w-=L.b,f=m+((f=l+o+1)>X,k[f+1]=y*F>>X,k[f+2]=v*F>>X,g-=b,y-=x,v-=w,b-=L.r,x-=L.g,w-=L.b,f=l+((f=u+N)]*>/,"");var e=new ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}try{var a=i.xmldom?new n.DOMParser(i.xmldom):new n.DOMParser;return a.parseFromString(t,"image/svg+xml")}catch(e){return(a=i.xmldom?new n.DOMParser(i.xmldom):new n.DOMParser).parseFromString(t,"text/xml")}},s.Property=function(t,e){this.name=t,this.value=e},s.Property.prototype.getValue=function(){return this.value},s.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},s.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var t=parseFloat(this.value);return(this.value+"").match(/%$/)&&(t/=100),t},s.Property.prototype.valueOrDefault=function(t){return this.hasValue()?this.value:t},s.Property.prototype.numValueOrDefault=function(t){return this.hasValue()?this.numValue():t},s.Property.prototype.addOpacity=function(e){var i=this.value;if(null!=e.value&&""!=e.value&&"string"==typeof this.value){var n=new t(this.value);n.ok&&(i="rgba("+n.r+", "+n.g+", "+n.b+", "+e.numValue()+")")}return new s.Property(this.name,i)},s.Property.prototype.getDefinition=function(){var t=this.value.match(/#([^\)'"]+)/);return t&&(t=t[1]),t||(t=this.value),s.Definitions[t]},s.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},s.Property.prototype.getFillStyleDefinition=function(t,e){var i=this.getDefinition();if(null!=i&&i.createGradient)return i.createGradient(s.ctx,t,e);if(null!=i&&i.createPattern){if(i.getHrefAttribute().hasValue()){var n=i.attribute("patternTransform");i=i.getHrefAttribute().getDefinition(),n.hasValue()&&(i.attribute("patternTransform",!0).value=n.value)}return i.createPattern(s.ctx,t)}return null},s.Property.prototype.getDPI=function(t){return 96},s.Property.prototype.getREM=function(t){return s.rootEmSize},s.Property.prototype.getEM=function(t){return s.emSize},s.Property.prototype.getUnits=function(){var t=this.value+"";return t.replace(/[0-9\.\-]/g,"")},s.Property.prototype.isPixels=function(){if(!this.hasValue())return!1;var t=this.value+"";return!!t.match(/px$/)||!!t.match(/^[0-9]+$/)},s.Property.prototype.toPixels=function(t,e){if(!this.hasValue())return 0;var i=this.value+"";if(i.match(/rem$/))return this.numValue()*this.getREM(t);if(i.match(/em$/))return this.numValue()*this.getEM(t);if(i.match(/ex$/))return this.numValue()*this.getEM(t)/2;if(i.match(/px$/))return this.numValue();if(i.match(/pt$/))return this.numValue()*this.getDPI(t)*(1/72);if(i.match(/pc$/))return 15*this.numValue();if(i.match(/cm$/))return this.numValue()*this.getDPI(t)/2.54;if(i.match(/mm$/))return this.numValue()*this.getDPI(t)/25.4;if(i.match(/in$/))return this.numValue()*this.getDPI(t);if(i.match(/%$/))return this.numValue()*s.ViewPort.ComputeSize(t);var n=this.numValue();return e&&n<1?n*s.ViewPort.ComputeSize(t):n},s.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())},s.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 o={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 s.Property.prototype.toTextBaseline=function(){return this.hasValue()?o[this.value]:null},s.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,i,n,r,a){var o=null!=a?this.Parse(a):this.CreateFont("","","","","",s.ctx.font);return{fontFamily:r=r||o.fontFamily,fontSize:n||o.fontSize,fontStyle:t||o.fontStyle,fontWeight:i||o.fontWeight,fontVariant:e||o.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var t=this;this.Parse=function(e){for(var i={},n=s.trim(s.compressSpaces(e||"")).split(" "),r={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},a="",o=0;othis.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,i,n,r,a){var s=t+2/3*(i-t),o=e+2/3*(n-e),l=s+1/3*(r-t),h=o+1/3*(a-e);this.addBezierCurve(t,e,s,l,o,h,r,a)},this.addBezierCurve=function(t,e,i,n,r,a,s,o){var l=[t,e],h=[i,n],u=[r,a],c=[s,o];this.addPoint(l[0],l[1]),this.addPoint(c[0],c[1]);for(var f=0;f<=1;f++){var d=function(t){return Math.pow(1-t,3)*l[f]+3*Math.pow(1-t,2)*t*h[f]+3*(1-t)*Math.pow(t,2)*u[f]+Math.pow(t,3)*c[f]},p=6*l[f]-12*h[f]+6*u[f],m=-3*l[f]+9*h[f]-9*u[f]+3*c[f],g=3*h[f]-3*l[f];if(0!=m){var y=Math.pow(p,2)-4*g*m;if(!(y<0)){var v=(-p+Math.sqrt(y))/(2*m);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 s.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 s.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,i){null!=i&&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,h=/(\.[^\s\+>~\.\[:]+)/g,u=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,c=/(:[\w-]+\([^\)]*\))/gi,f=/(:[^\s\+>~\.\[:]+)/g,d=/([^\s\+>~\.\[:]+)/g;function p(t){var e=[0,0,0],i=function(i,n){var r=t.match(i);null!=r&&(e[n]+=r.length,t=t.replace(i," "))};return t=(t=t.replace(/:not\(([^\)]*)\)/g," $1 ")).replace(/{[\s\S]*/gm," "),i(o,1),i(l,0),i(h,1),i(u,2),i(c,1),i(f,1),t=(t=t.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),i(d,2),e.join("")}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(t,e,i,n,r,a){var o={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:e,offsetY:i,scaleWidth:n,scaleHeight:r};for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);s(this.canvas,t,o)}),i.exports=s}(i={exports:{}}),i.exports}(i(20),i(21))},function(t,e,i){(function(i){var n,r,a;r=[],void 0===(a="function"==typeof(n=function(){"use strict";function e(t,e,i){var n=new XMLHttpRequest;n.open("GET",t),n.responseType="blob",n.onload=function(){s(n.response,e,i)},n.onerror=function(){console.error("could not download file")},n.send()}function n(t){var e=new XMLHttpRequest;return e.open("HEAD",t,!1),e.send(),200<=e.status&&299>=e.status}function r(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(i){var e=document.createEvent("MouseEvents");e.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(e)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof i&&i.global===i?i:void 0,s=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype?function(t,i,s){var o=a.URL||a.webkitURL,l=document.createElement("a");i=i||t.name||"download",l.download=i,l.rel="noopener","string"==typeof t?(l.href=t,l.origin===location.origin?r(l):n(l.href)?e(t,i,s):r(l,l.target="_blank")):(l.href=o.createObjectURL(t),setTimeout(function(){o.revokeObjectURL(l.href)},4e4),setTimeout(function(){r(l)},0))}:"msSaveOrOpenBlob"in navigator?function(t,i,a){if(i=i||t.name||"download","string"!=typeof t)navigator.msSaveOrOpenBlob(function(t,e){return void 0===e?e={autoBom:!1}:"object"!=typeof e&&(console.warn("Deprecated: Expected third argument to be a object"),e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["\ufeff",t],{type:t.type}):t}(t,a),i);else if(n(t))e(t,i,a);else{var s=document.createElement("a");s.href=t,s.target="_blank",setTimeout(function(){r(s)})}}:function(t,i,n,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof t)return e(t,i,n);var s="application/octet-stream"===t.type,o=/constructor/i.test(a.HTMLElement)||a.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&o)&&"object"==typeof FileReader){var h=new FileReader;h.onloadend=function(){var t=h.result;t=l?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=t:location=t,r=null},h.readAsDataURL(t)}else{var u=a.URL||a.webkitURL,c=u.createObjectURL(t);r?r.location=c:location.href=c,r=null,setTimeout(function(){u.revokeObjectURL(c)},4e4)}});a.saveAs=s.saveAs=s,t.exports=s})?n.apply(e,r):n)||(t.exports=a)}).call(this,i(22))},function(t,e,i){(t.exports=i(23)(!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,i){"use strict";i.r(e);var n=i(0),r=i.n(n),a=i(6),s=i.n(a),o=i(7),l=i(8),h=i.n(l),u=i(1);const c="Taucharts Export Plug-in:";var f=r.a.api.utils,d=r.a.api.pluginsSDK,p=d.tokens(),m=function(t,e){return t.replace(new RegExp("^"+e+"+|"+e+"+$","g"),"")},g=function(t){return(t=Math.round(t))%2?t+1:t},y=function(t){return null===t||""===t||void 0===t};var v,b={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},x=function(t,e){e=e||"all";var i=document.createElement("style");return i.setAttribute("media",e),i.innerHTML=t,i},w=x(h.a,"print"),E=function(){w&&w.parentNode&&w.parentNode.removeChild(w),v&&v.parentNode&&v.parentNode.removeChild(v)};/PhantomJS/.test(navigator.userAgent)||("onafterprint"in window?window.addEventListener("afterprint",E):window.matchMedia("screen").addListener(function(t){t.matches&&E()}));var P=function(t,e,i){var n="data:"+e+";charset=UTF-8,%ef%bb%bf"+encodeURIComponent(i),r=document.createElement("a");r.setAttribute("href",n),r.setAttribute("download",t),r.setAttribute("target","_new"),document.body.appendChild(r),r.click(),document.body.removeChild(r),r=null},C=function(t){return[].slice.call(t.querySelectorAll("text.label")).forEach(function(t){t.innerHTML=[].slice.call(t.querySelectorAll("tspan")).reduce(function(t,e){var i=e.value||e.text||e.textContent||"";return t+(i=i.charAt(0).toUpperCase()+i.substr(1))},"")}),t},B=function(t,e,i){i=null==i?"":String(i);var n=(t||{})[e]||{};return(f.isObject(n.label)?n.label.text:n.label)||i};function T(t){return{onRender:function(){this._info=d.extractFieldsFormatInfo(this._chart.getSpec())},_normalizeExportFields:function(t,e){var i=this._info;return t.map(function(t){var e=t,n=i[t]||{};return"string"==typeof t&&(e={field:t,title:n.label||t}),"function"!=typeof e.value&&(e.value=function(t){var e=t[this.field];return n.isComplexField?(e||{})[n.tickLabel]:e}),e}).filter(function(t){return!e.find(function(e){return t.field===e})})},_handleError(t){r.a.api.globalSettings.log([c,t],"error")},_createDataUrl:function(t,e){!function(...t){const e=t.slice(0,t.length-1),i=t[t.length-1];if(0===e.length)return void setTimeout(()=>i(null,[]),0);const n=f.range(0,e.length).map(()=>null),r=e.map((t,e)=>{const a=new XMLHttpRequest;a.onload=(()=>{if(a.status>=200&&a.status<300){const t=a.responseText;n[e]=t,r.splice(r.indexOf(a),1),0===r.length&&i(null,n)}else r.forEach(t=>t.abort()),i(new Error(`${a.status}: ${a.statusText}`),null)}),a.onerror=(t=>{r.forEach(t=>t.abort()),i(t.error,null)}),a.open("GET",t,!0),a.send(null)})}(...this._cssPaths,(i,n)=>{if(i)e(i,null);else try{const c=n.join(" ").replace(/&/g,"");var a=x(c),o=document.createElement("div");t.fire("beforeExportSVGNode");var l=t.getSVG().cloneNode(!0);t.fire("afterExportSVGNode"),o.appendChild(C(l)),u.select(l).attr("version",1.1).attr("xmlns","http://www.w3.org/2000/svg"),l.insertBefore(a,l.firstChild),this._renderAdditionalInfo(l,t),this._addBackground(l,this._backgroundColor);var h=document.createElement("canvas");h.height=l.getAttribute("height"),h.width=l.getAttribute("width"),s()(h,l.parentNode.innerHTML,{renderCallback:function(t){var i=(new XMLSerializer).serializeToString(t);"{if(t)this._handleError(t);else{for(var i=atob(e.substring("data:image/png;base64,".length)),n=new Uint8Array(i.length),r=0,a=i.length;r{if(t)this._handleError(t);else{(v=document.createElement("img")).classList.add("tau-chart__print-block");var i=v;document.body.appendChild(i),i.src=e,document.head.appendChild(w),i.onload=function(){window.print()}}})},_toJson:function(t){var e=this._exportFields,i=t.getData(),n=t.getDataDims(),r=e.length?e:Object.keys(n),a=this._normalizeExportFields(r.concat(this._appendFields),this._excludeFields),s=i.map(function(t){return a.reduce(function(e,i){return e[i.title]=i.value(t),e},{})}),o=JSON.stringify(s,null,2),l=(this._fileName||"export")+".json";P(l,"application/json",o)},_toCsv:function(t){var e=this._csvSeparator,i=this._exportFields,n=t.getData(),r=t.getDataDims(),a=i.length?i:Object.keys(r),s=this._normalizeExportFields(a.concat(this._appendFields),this._excludeFields),o=n.reduce(function(t,i){return t.concat(s.reduce(function(t,e){var n=e.value(i),r=JSON.stringify(n);if(!f.isDate(n)&&f.isObject(n))r='"'+r.replace(/"/g,'""')+'"';else{var a=m(r,'"').replace(/"/g,'""');r=Boolean(['"',",",";","\n","\r"].find(function(t){return a.indexOf(t)>=0}))?'"'+a+'"':a}return t.concat(r)},[]).join(e))},[s.map(function(t){return t.title}).join(e)]).join("\r\n"),l=(this._fileName||"export")+".csv";P(l,"text/csv",o)},_renderFillLegend:function(e,i,n,r){var a=function(t,e){var i=t[0],n=t[1],r=(n-i)/(e-1),a=f.range(e-2).map(function(t){return i+r*(t+1)});return[i].concat(a).concat(n)},s=this._unit.getScale("color"),o=B(e.guide,"color",s.dim).toUpperCase(),l="text-transform:uppercase;font-weight:600;font-size:"+t.fontSize+"px",h=s.domain().sort(function(t,e){return t-e}),u=s.brewer.length,c=t.fontSize,d=a(h,u).reverse().map(function(t,e){return''}),p=a(h,3).reverse().map(function(t,e,i){return''+t+""}),m=[''," ",' ',d.join("")," "," ",' '+o+"",' ',' '," ",p.join("")," "," Sorry, your browser does not support inline SVG.",""].join(""),g=(new DOMParser).parseFromString(m,"application/xml").documentElement;return document.body.appendChild(g),i.append("g").attr("class","legend").attr("transform","translate("+(r+10)+","+t.paddingTop+")").node().appendChild(g),{h:120,w:0}},_renderColorLegend:function(e,i,n,r){var a=this._unit.getScale("color"),s=B(e.guide,"color",a.dim).toUpperCase(),o=this._getColorMap(n.getChartModelData({excludeFilter:["legend"]}),a,a.dim).values,l=i.append("g").attr("class","legend").attr("transform","translate("+(r+10)+","+t.paddingTop+")");return l.append("text").text(s.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":t.fontSize+"px"}),l.selectAll("g").data(o).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 f.escape(y(t.label)?"No "+s:t.label)}).style({"font-size":t.fontSize+"px"})}),{h:20*o.length,w:0}},_renderSizeLegend:function(e,i,n,r,a){var s,o,l=this._unit.getScale("size"),h=B(e.guide,"size",l.dim).toUpperCase(),u=n.getChartModelData().sort(function(t,e){return l(t[l.dim])-l(e[l.dim])}),c=u.length,d=u[0][l.dim],p=u[c-1][l.dim];if(p-d){var m=(o=p-d,Math.log(o)/Math.LN10),y=4-m<0?0:Math.round(4-m),v=Math.pow(10,y),b=(p-d)/5;s=f.unique([d,d+b,d+2*b,d+3*b,p].map(function(t){return t===p||t===d?t:Math.round(t*v)/v}))}else s=[d];var x=s.map(function(t){var i=l(t),n=i/2;return{diameter:g(i+2),radius:n,value:t,className:e.color?"color-definite":""}}.bind(this)).reverse(),w=Math.max.apply(null,x.map(function(t){return t.diameter})),E=t.fontSize,P=0,C=i.append("g").attr("class","legend").attr("transform","translate("+(r+10)+","+(t.paddingTop+a.h+20)+")");C.append("text").text(h.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":E+"px"}),C.selectAll("g").data(x).enter().append("g").call(function(t){t.attr("transform",function(){var t="translate(5,"+(P+=w)+")";return P+=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("+w+","+E/2+")"}).append("text").attr("x",0).attr("y",0).text(function(t){return t.value}).style({"font-size":E+"px"})})},_renderAdditionalInfo:function(t,e){var i=this._findUnit(e);if(i){var n={h:0,w:0};t=u.select(t);var r=parseInt(t.attr("width"),10);t.attr("height");t.attr("width",r+160);var a=e.getScaleInfo(i.color);if(a.dim&&!a.discrete){var s=this._renderFillLegend(i,t,e,r);n.h=s.h+20,n.w=s.w}if(a.dim&&a.discrete){var o=this._renderColorLegend(i,t,e,r);n.h=o.h+20,n.w=o.w}var l=e.getScaleInfo(i.size);l.dim&&!l.discrete&&this._renderSizeLegend(i,t,e,r,n)}},_addBackground:function(t,e){if(e&&"transparent"!==e){var i=document.createElementNS("http://www.w3.org/2000/svg","rect");i.setAttribute("fill",e),i.setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",t.getAttribute("width")),i.setAttribute("height",t.getAttribute("height")),t.insertBefore(i,t.firstChild)}},onUnitDraw:function(t,e){r.a.api.isChartElement(e)&&"chart"===e.config.namespace&&(this._unit=e)},_getColorMap:function(t,e,i){return f.unique(t.map(function(t){var n=t[i];return{color:e(n),value:n,label:n}}),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 i=this["_to"+(t=t||"").charAt(0).toUpperCase()+t.slice(1)];i&&i.call(this,e)},_handleMenu:function(t,e,i){t.addEventListener("click",function(t){if("a"===t.target.tagName.toLowerCase()){var n=t.target.getAttribute("data-value");this._select(n,e),i.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===b.ESCAPE&&i.hide(),t.keyCode===b.DOWN&&(t.target.parentNode.nextSibling?t.target.parentNode.nextSibling.childNodes[0].focus():t.target.parentNode.parentNode.firstChild.childNodes[0].focus()),t.keyCode===b.UP&&(t.target.parentNode.previousSibling?t.target.parentNode.previousSibling.childNodes[0].focus():t.target.parentNode.parentNode.lastChild.childNodes[0].focus()),t.keyCode===b.ENTER){var n=t.target.getAttribute("data-value");this._select(n,e)}t.preventDefault()}.bind(this));var n=null,r=function(){n=setTimeout(function(){i.hide()},100)},a=function(){clearTimeout(n)},s=function(){i.toggle(),i.hidden||t.querySelectorAll("a")[0].focus()};t.addEventListener("blur",r,!0),t.addEventListener("focus",a,!0),this._container.addEventListener("click",s),this._onDestroy(function(){t.removeEventListener("blur",r,!0),t.removeEventListener("focus",a,!0),this._container.removeEventListener("click",s),clearTimeout(n)})},init:function(e){t=t||{},t=f.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.a.api.globalSettings.log('[export plugin]: the "cssPath" parameter should be specified for correct operation',"warn"));var i=t.visible?"":"display:none";this._container=e.insertToHeader('Export');var n=e.addBalloon({place:"bottom-left"});n.content(['"].join("")),n.attach(this._container);var a=n.getElement();a.setAttribute("tabindex","-1"),this._handleMenu(a,e,n);const s=e.on("export-to",function(t,{type:e,fileName:i}){this._fileName=i||this._fileName,this._select(e,t)}.bind(this)),o=e.on("exportTo",function(t,e){r.a.api.globalSettings.log([c,"`exportTo` event is deprecated, use `export-to` instead."],"warn"),this._select(e,t)}.bind(this));this._onDestroy(function(){n.destroy(),e.removeHandler(s),e.removeHandler(o)})},_onDestroy:function(t){this._destroyListeners.push(t)},destroy:function(){this._destroyListeners.forEach(function(t){t.call(this)},this);(t=>t&&t.parentElement&&t.parentElement.removeChild(t))(this._container)}}}r.a.api.plugins.add("export-to",T),e.default=T},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 i=[{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)]}}],n=0;n3&&(this.alpha=o[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),i=this.b.toString(16);return 1==t.length&&(t="0"+t),1==e.length&&(e="0"+e),1==i.length&&(i="0"+i),"#"+t+e+i},this.getHelpXML=function(){for(var t=new Array,n=0;n "+h.toRGB()+" -> "+h.toHex());l.appendChild(u),l.appendChild(c),o.appendChild(l)}catch(t){}return o}}},function(t,e){var i=[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],n=[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 r(t,e,i,n,r){if("string"==typeof t)t=document.getElementById(t);else if("undefined"!=typeof HTMLCanvasElement&&!t instanceof HTMLCanvasElement)return;var a,s=t.getContext("2d");try{try{a=s.getImageData(e,i,n,r)}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,i,n,a,o){if(!(isNaN(o)||o<1)){o|=0;var l=r(t,e,i,n,a);l=s(l,e,i,n,a,o),t.getContext("2d").putImageData(l,e,i)}}function s(t,e,r,a,s,o){var l,u,c,f,d,p,m,g,y,v,b,x,w,E,P,C,B,T,S,M,k,V,A,D,N=t.data,R=o+o+1,_=a-1,O=s-1,z=o+1,I=z*(z+1)/2,L=new h,F=L;for(c=1;c>H,0!=A?(A=255/A,N[p]=(g*G>>H)*A,N[p+1]=(y*G>>H)*A,N[p+2]=(v*G>>H)*A):N[p]=N[p+1]=N[p+2]=0,g-=x,y-=w,v-=E,b-=P,x-=X.r,w-=X.g,E-=X.b,P-=X.a,f=m+((f=l+o+1)<_?f:_)<<2,g+=C+=X.r=N[f],y+=B+=X.g=N[f+1],v+=T+=X.b=N[f+2],b+=S+=X.a=N[f+3],X=X.next,x+=M=U.r,w+=k=U.g,E+=V=U.b,P+=A=U.a,C-=M,B-=k,T-=V,S-=A,U=U.next,p+=4;m+=a}for(l=0;l>H,A>0?(A=255/A,N[f]=(g*G>>H)*A,N[f+1]=(y*G>>H)*A,N[f+2]=(v*G>>H)*A):N[f]=N[f+1]=N[f+2]=0,g-=x,y-=w,v-=E,b-=P,x-=X.r,w-=X.g,E-=X.b,P-=X.a,f=l+((f=u+z)>j,k[p+1]=y*F>>j,k[p+2]=v*F>>j,g-=b,y-=x,v-=w,b-=I.r,x-=I.g,w-=I.b,f=m+((f=l+o+1)>j,k[f+1]=y*F>>j,k[f+2]=v*F>>j,g-=b,y-=x,v-=w,b-=I.r,x-=I.g,w-=I.b,f=l+((f=u+N)=0&&e.x.push(t),r.indexOf("y")>=0&&e.y.push(t),this};var o=function(){var t=n.scrollLeft,o=n.scrollTop;i.forEach(function(e){e.call(null,t,o)});var l=function(n){var i="x"===n?t:o;i!==r[n]&&(clearTimeout(a[n]),s(e[n],function(t){t.transition("floatingAxes_scrollVisibility"),t.attr("opacity",1e-6)}),a[n]=setTimeout(function(){s(e[n],function(t){a[n]=null,t.transition("floatingAxes_scrollVisibility").duration(256).attr("opacity",1)})},128)),r[n]=i};l("x"),l("y")};function s(t,e,r){t.forEach(function(t){e.call(r,t)})}n.addEventListener("scroll",o),this.fireScroll=function(){o.call(null,n.scrollLeft,n.scrollTop)},this.destroy=function(){n.removeEventListener("scroll",o)}}(r),v=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(a.querySelectorAll(t("x"))),y:Array.from(a.querySelectorAll(t("y")))}}(),m=function(){function t(t){return{axis:t,parentTransform:function(t){var e,r={translate0:{x:0,y:0},translate:{x:0,y:0}},a=t;for(;a&&"SVG"!==a.nodeName.toUpperCase();)e=_(a),r.translate0.x+=e.translate0.x,r.translate0.y+=e.translate0.y,r.translate.x+=e.translate.x,r.translate.y+=e.translate.y,a=a.parentNode;return r}(t.parentNode),axisTransform:_(t)}}return{x:v.x.map(t),y:v.y.map(t)}}(),b=function(t){return Math.max.apply(null,t)}(m.y.map(function(t){return t.axisTransform.translate.x+t.parentTransform.translate.x}))+1,H=function(t){return Math.min.apply(null,t)}(m.x.map(function(t){return t.axisTransform.translate.y+t.parentTransform.translate.y}))-1,F=n.a.api.globalSettings.getScrollbarSize(r);var T={scrollLeft:r.scrollLeft,scrollTop:r.scrollTop,visibleWidth:r.clientWidth,visibleHeight:r.clientHeight,scrollbarWidth:F.width,scrollbarHeight:F.height,svgWidth:Number(o.attr("width")),svgHeight:Number(o.attr("height")),minXAxesY:H,maxYAxesX:b},w=function(){var e=o.append("defs").attr("class","floating-axes floating-axes__defs"),r={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(r).forEach(function(a){var n=r[a],i=e.append("linearGradient").attr("id","shadow-gradient-"+a+"-"+t).attr("x1",n.x1).attr("y1",n.y1).attr("x2",n.x2).attr("y2",n.y2);i.append("stop").attr("class","floating-axes__shadow-start").attr("offset","0%").attr("stop-color",f).attr("stop-opacity",d),i.append("stop").attr("class","floating-axes__shadow-end").attr("offset","100%").attr("stop-color",h).attr("stop-opacity",x)}),e}();function L(t,e){e.forEach(function(e){e.axis[g]=e.axis.parentNode;var r=t.append("g");c?r.attr("transform",A(e.parentTransform.translate0.x,e.parentTransform.translate0.y)).transition().duration(c).attr("transform",A(e.parentTransform.translate.x,e.parentTransform.translate.y)):r.attr("transform",A(e.parentTransform.translate.x,e.parentTransform.translate.y)),r.node().appendChild(e.axis),Array.prototype.forEach.call(e.axis.querySelectorAll(".label"),function(t){t[y]=t.getAttribute("transform")})})}var O=function(){var t=T.svgHeight-T.minXAxesY+1+T.scrollbarHeight,e=o.append("g").attr("class","floating-axes floating-axes__x").call(V,T.svgWidth,t,0,T.minXAxesY);L(e,m.x);var r=e.selectAll(".label");return p.handleVisibilityFor(e,"y").handleVisibilityFor(r,"x").onScroll(function(t,a){var n=Math.min(T.visibleHeight+a-T.svgHeight-T.scrollbarHeight,0);e.attr("transform",A(0,n)),r.each(function(){var e=S(this[y]),r=-T.svgWidth+T.visibleWidth+t-10;this.setAttribute("transform","translate("+(e.x+r)+","+e.y+") rotate("+e.r+")")})}),e}(),E=function(){var t=o.append("g").attr("class","floating-axes floating-axes__y").call(V,T.maxYAxesX,T.svgHeight);L(t,m.y);var e=t.selectAll(".label");return p.handleVisibilityFor(t,"x").handleVisibilityFor(e,"y").onScroll(function(r,a){var n=Math.max(r,0);t.attr("transform",A(n,0)),e.each(function(){var t=S(this[y]),e=a+10;this.setAttribute("transform","translate("+t.x+","+(t.y+e)+") rotate("+t.r+")")})}),t}(),M=function(){var t=T.svgHeight-T.minXAxesY+T.scrollbarHeight,e=o.append("g").attr("class","floating-axes floating-axes__corner").call(V,T.maxYAxesX,t);return p.handleVisibilityFor(e,"xy").onScroll(function(r,a){var n=Math.max(r,0),i=T.minXAxesY,o=Math.min(a+T.visibleHeight-t,i);e.attr("transform",A(n,o))}),e}();function V(t,r,a,n,i){n=n||0,i=i||0,t.append("rect").attr("class","i-role-bg").attr("x",n-1).attr("y",i-1).attr("width",Math.max(0,r+2)).attr("height",Math.max(0,a+2)).attr("fill",e.bgcolor)}var j=function(){var e=T.maxYAxesX,r=T.svgHeight-T.minXAxesY+T.scrollbarHeight,a=o.append("g").attr("class","floating-axes floating-axes__shadows").attr("pointer-events","none"),n=function(e,r,n,i,o){return a.append("rect").attr("fill","url(#shadow-gradient-"+e+"-"+t+")").attr("x",r).attr("y",n).attr("width",Math.max(0,i)).attr("height",Math.max(0,o))},i=n("ns",0,0,e,u),s=n("ew",T.visibleWidth-u,T.visibleHeight-r,u,r),l=n("sn",0,T.visibleHeight-r-u,e,u),c=n("we",e,T.visibleHeight-r,u,r);p.handleVisibilityFor(i,"xy").handleVisibilityFor(s,"xy").handleVisibilityFor(l,"xy").handleVisibilityFor(c,"xy").onScroll(function(t,e){var r=t,n=e;a.attr("transform",A(r,n));var o=function(t,e){t.style("visibility",e?"":"hidden")};o(i,e>0&&T.svgHeight>T.visibleHeight),o(s,t+T.visibleWidthT.visibleWidth),o(l,e+T.visibleHeightT.visibleHeight),o(c,t>0&&T.svgWidth>T.visibleWidth)})}(),C=O.node(),W=E.node(),k=M.node();p.onScroll(function(t){a.insertBefore(C,0===t?k.nextElementSibling:W)}),p.fireScroll(),this.floatingLayout={defs:w,xAxes:O,yAxes:E,shadows:j},o.selectAll(".floating-axes").on("mouseenter",function(){l.dispatchMouseEvent(a,"mouseleave")}).on("mousemove",function(){i.event.stopPropagation()}).on("click",function(){i.event.stopPropagation()})},removeFloatingLayout:function(){function t(t){t.selectAll(".axis").each(function(){this[g].appendChild(this),delete this[g],Array.prototype.forEach.call(this.querySelectorAll(".label"),function(t){t.setAttribute("transform",t[y]),delete t[y]})})}this.floatingLayout&&(this.floatingLayout.xAxes.call(t),this.floatingLayout.yAxes.call(t),this.scrollManager.destroy(),this.floatingLayout=null),s.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 A(t,e){return"translate("+t+","+e+")"}function S(t){var e={x:0,y:0,r:0};if(!t)return e;var r=t.indexOf("translate(");if(r>=0){var a=t.indexOf(")",r+10),n=t.substring(r+10,a).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(n[0]),n.length>1&&(e.y=parseFloat(n[1]))}var i=t.indexOf("rotate(");if(i>=0){var o=t.indexOf(")",i+7),s=t.substring(i+7,o);e.r=parseFloat(s.trim())}return e}function _(t){var e=t[p]&&t[p].transform,r=S(t.getAttribute("transform"));return{translate0:r,translate:e?S(t[p].transform):r}}n.a.api.plugins.add("floating-axes",b),e.default=b}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"),require("d3-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var r="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var a in r)("object"==typeof exports?exports:t)[a]=r[a]}}(window,function(t,e){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=24)}({0:function(e,r){e.exports=t},1:function(t,r){t.exports=e},24:function(t,e,r){"use strict";r.r(e);var a=r(0),n=r.n(a),i=r(1);const o={...i},s=n.a.api.domUtils;var l=n.a.api.utils,c=16,f="#E5E7EB",u="#FFFFFF",h=1,d=0,x="__transitionAttrs__",p="__floatingAxesSrcParent__",g="__floatingAxesSrcTransform__",y=0,v=function(){return++y};function m(t){var e=l.defaults(t||{},{detectBackground:!0,bgcolor:"#fff"});return{init:function(t){this.instanceId=v(),this.chart=t,this.rootNode=t.getLayout().contentContainer,this.beforeExportHandler=t.on("beforeExportSVGNode",function(){this.removeFloatingLayout()},this),this.afterExportHandler=t.on("afterExportSVGNode",function(){this.createFloatingLayout()},this)},onBeforeRender:function(){this.removeFloatingLayout()},onRender:function(){if(e.detectBackground){var t=this.detectChartBackgroundColor();t&&(e.bgcolor=t)}u=e.bgcolor;var r=!0;this.chart.traverseSpec(this.chart.getSpec(),function(t){t&&0===t.type.indexOf("COORDS.")&&("COORDS.RECT"!==t.type?r=!1:"extract-axes"!==(t.guide||{}).autoLayout&&(r=!1))}),r&&this.createFloatingLayout()},destroy:function(){this.removeFloatingLayout(),this.chart.removeHandler(this.beforeExportHandler,this),this.chart.removeHandler(this.afterExportHandler,this)},createFloatingLayout:function(){var t,r,a=this.instanceId,l=this.rootNode,x=this.chart.getSVG(),y=o.select(x),v=this.chart.configGPL.settings.animationSpeed,m=this.scrollManager=new _(l),H=(t=function(t){var e="> ."+t+".axis.tau-active";return[".frame-root.tau-active "+e,".frame-root.tau-active .cell.tau-active "+e].join(", ")},{x:Array.from(x.querySelectorAll(t("x"))),y:Array.from(x.querySelectorAll(t("y")))}),F=function(){function t(t){return{axis:t,parentTransform:function(t){var e,r={translate0:{x:0,y:0},translate:{x:0,y:0}},a=t;for(;a&&"SVG"!==a.nodeName.toUpperCase();)e=S(a),r.translate0.x+=e.translate0.x,r.translate0.y+=e.translate0.y,r.translate.x+=e.translate.x,r.translate.y+=e.translate.y,a=a.parentNode;return r}(t.parentNode),axisTransform:S(t)}}return{x:H.x.map(t),y:H.y.map(t)}}(),T=(r=F.y.map(function(t){return t.axisTransform.translate.x+t.parentTransform.translate.x}),Math.max.apply(null,r)+1),L=function(t){return Math.min.apply(null,t)}(F.x.map(function(t){return t.axisTransform.translate.y+t.parentTransform.translate.y}))-1,w=n.a.api.globalSettings.getScrollbarSize(l);var E={scrollLeft:l.scrollLeft,scrollTop:l.scrollTop,visibleWidth:l.clientWidth,visibleHeight:l.clientHeight,scrollbarWidth:w.width,scrollbarHeight:w.height,svgWidth:Number(y.attr("width")),svgHeight:Number(y.attr("height")),minXAxesY:L,maxYAxesX:T},O=function(){var t=y.append("defs").attr("class","floating-axes floating-axes__defs"),e={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(e).forEach(function(r){var n=e[r],i=t.append("linearGradient").attr("id","shadow-gradient-"+r+"-"+a).attr("x1",n.x1).attr("y1",n.y1).attr("x2",n.x2).attr("y2",n.y2);i.append("stop").attr("class","floating-axes__shadow-start").attr("offset","0%").attr("stop-color",f).attr("stop-opacity",h),i.append("stop").attr("class","floating-axes__shadow-end").attr("offset","100%").attr("stop-color",u).attr("stop-opacity",d)}),t}();function M(t,e){e.forEach(function(e){e.axis[p]=e.axis.parentNode;var r=t.append("g");v?r.attr("transform",b(e.parentTransform.translate0.x,e.parentTransform.translate0.y)).transition().duration(v).attr("transform",b(e.parentTransform.translate.x,e.parentTransform.translate.y)):r.attr("transform",b(e.parentTransform.translate.x,e.parentTransform.translate.y)),r.node().appendChild(e.axis),Array.prototype.forEach.call(e.axis.querySelectorAll(".label"),function(t){t[g]=t.getAttribute("transform")})})}var V,C,W=function(){var t=E.svgHeight-E.minXAxesY+1+E.scrollbarHeight,e=y.append("g").attr("class","floating-axes floating-axes__x").call(N,E.svgWidth,t,0,E.minXAxesY);M(e,F.x);var r=e.selectAll(".label");return m.handleVisibilityFor(e,"y").handleVisibilityFor(r,"x").onScroll(function(t,a){var n=Math.min(E.visibleHeight+a-E.svgHeight-E.scrollbarHeight,0);e.attr("transform",b(0,n)),r.each(function(){var e=A(this[g]),r=-E.svgWidth+E.visibleWidth+t-10;this.setAttribute("transform","translate("+(e.x+r)+","+e.y+") rotate("+e.r+")")})}),e}(),j=function(){var t=y.append("g").attr("class","floating-axes floating-axes__y").call(N,E.maxYAxesX,E.svgHeight);M(t,F.y);var e=t.selectAll(".label");return m.handleVisibilityFor(t,"x").handleVisibilityFor(e,"y").onScroll(function(r,a){var n=Math.max(r,0);t.attr("transform",b(n,0)),e.each(function(){var t=A(this[g]);const e=a+10;this.setAttribute("transform","translate("+t.x+","+(t.y+e)+") rotate("+t.r+")")})}),t}(),k=(V=E.svgHeight-E.minXAxesY+E.scrollbarHeight,C=y.append("g").attr("class","floating-axes floating-axes__corner").call(N,E.maxYAxesX,V),m.handleVisibilityFor(C,"xy").onScroll(function(t,e){var r=Math.max(t,0),a=E.minXAxesY,n=Math.min(e+E.visibleHeight-V,a);C.attr("transform",b(r,n))}),C);function N(t,r,a,n,i){n=n||0,i=i||0,t.append("rect").attr("class","i-role-bg").attr("x",n-1).attr("y",i-1).attr("width",Math.max(0,r+2)).attr("height",Math.max(0,a+2)).attr("fill",e.bgcolor)}var X=function(){var t=E.maxYAxesX,e=E.svgHeight-E.minXAxesY+E.scrollbarHeight,r=y.append("g").attr("class","floating-axes floating-axes__shadows").attr("pointer-events","none"),n=function(t,e,n,i,o){return r.append("rect").attr("fill","url(#shadow-gradient-"+t+"-"+a+")").attr("x",e).attr("y",n).attr("width",Math.max(0,i)).attr("height",Math.max(0,o))},i=n("ns",0,0,t,c),o=n("ew",E.visibleWidth-c,E.visibleHeight-e,c,e),s=n("sn",0,E.visibleHeight-e-c,t,c),l=n("we",t,E.visibleHeight-e,c,e);m.handleVisibilityFor(i,"xy").handleVisibilityFor(o,"xy").handleVisibilityFor(s,"xy").handleVisibilityFor(l,"xy").onScroll(function(t,e){var a=t,n=e;r.attr("transform",b(a,n));var c=function(t,e){t.style("visibility",e?"":"hidden")};c(i,e>0&&E.svgHeight>E.visibleHeight),c(o,t+E.visibleWidthE.visibleWidth),c(s,e+E.visibleHeightE.visibleHeight),c(l,t>0&&E.svgWidth>E.visibleWidth)})}(),Y=W.node(),P=j.node(),q=k.node();m.onScroll(function(t){x.insertBefore(Y,0===t?q.nextElementSibling:P)}),m.fireScroll(),this.floatingLayout={defs:O,xAxes:W,yAxes:j,shadows:X},y.selectAll(".floating-axes").on("mouseenter",function(){s.dispatchMouseEvent(x,"mouseleave")}).on("mousemove",function(){i.event.stopPropagation()}).on("click",function(){i.event.stopPropagation()})},removeFloatingLayout:function(){function t(t){t.selectAll(".axis").each(function(){this[p].appendChild(this),delete this[p],Array.prototype.forEach.call(this.querySelectorAll(".label"),function(t){t.setAttribute("transform",t[g]),delete t[g]})})}this.floatingLayout&&(this.floatingLayout.xAxes.call(t),this.floatingLayout.yAxes.call(t),this.scrollManager.destroy(),this.floatingLayout=null),o.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 b(t,e){return"translate("+t+","+e+")"}function A(t){var e={x:0,y:0,r:0};if(!t)return e;var r=t.indexOf("translate(");if(r>=0){var a=t.indexOf(")",r+10),n=t.substring(r+10,a).trim().replace(","," ").replace(/\s+/," ").split(" ");e.x=parseFloat(n[0]),n.length>1&&(e.y=parseFloat(n[1]))}var i=t.indexOf("rotate(");if(i>=0){var o=t.indexOf(")",i+7),s=t.substring(i+7,o);e.r=parseFloat(s.trim())}return e}function S(t){var e=t[x]&&t[x].transform,r=A(t.getAttribute("transform"));return{translate0:r,translate:e?A(t[x].transform):r}}function _(t){var e={x:[],y:[]},r={x:0,y:0},a={x:null,y:null},n=t,i=[];this.onScroll=function(t){return i.push(t),this},this.handleVisibilityFor=function(t,r){return r.indexOf("x")>=0&&e.x.push(t),r.indexOf("y")>=0&&e.y.push(t),this};var o=function(){var t=n.scrollLeft,o=n.scrollTop;i.forEach(function(e){e.call(null,t,o)});var l=function(n){var i="x"===n?t:o;i!==r[n]&&(clearTimeout(a[n]),s(e[n],function(t){t.transition("floatingAxes_scrollVisibility"),t.attr("opacity",1e-6)}),a[n]=setTimeout(function(){s(e[n],function(t){a[n]=null,t.transition("floatingAxes_scrollVisibility").duration(256).attr("opacity",1)})},128)),r[n]=i};l("x"),l("y")};function s(t,e,r){t.forEach(function(t){e.call(r,t)})}n.addEventListener("scroll",o),this.fireScroll=function(){o.call(null,n.scrollLeft,n.scrollTop)},this.destroy=function(){n.removeEventListener("scroll",o)}}n.a.api.plugins.add("floating-axes",m),e.default=m}})}); \ No newline at end of file diff --git a/dist/plugins/geomap-legend.js b/dist/plugins/geomap-legend.js index 45faa5a0f..58c370076 100644 --- a/dist/plugins/geomap-legend.js +++ b/dist/plugins/geomap-legend.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],t);else{var r="object"==typeof exports?t(require("taucharts")):t(e.Taucharts);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(window,function(e){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=26)}({0:function(t,r){t.exports=e},26:function(e,t,r){"use strict";r.r(t);var a=r(0),n=r.n(a),i=n.a.api.utils;function l(e){i.defaults(e||{},{});var t=function(e,t,r,a){e.addEventListener(t,function(e){for(var t=e.target;t!==e.currentTarget&&null!==t;)t.classList.contains(r)&&a(e,t),t=t.parentNode})};return{init:function(e){this._chart=e,this._currentFilters={},this._legendColorByScaleId={};var r=this._chart.getSpec(),a=function(e){return function(t,a){var n=r.scales[a];return n.type===e&&n.dim&&t.push(a),t}};this._color=Object.keys(r.scales).reduce(a("color"),[]),this._fill=Object.keys(r.scales).reduce(a("fill"),[]);var n=this._color.length>0,i=this._fill.length>0;(n||i)&&(this._container=this._chart.insertToRightSidebar(this._containerTemplate),n&&(t(this._container,"click","tau-chart__legend__item-color",function(e,t){this._toggleLegendItem(t)}.bind(this)),t(this._container,"mouseover","tau-chart__legend__item-color",function(e,t){this._highlightToggle(t,!0)}.bind(this)),t(this._container,"mouseout","tau-chart__legend__item-color",function(e,t){this._highlightToggle(t,!1)}.bind(this))))},onSpecReady:function(){this._assignStaticBrewersOrEx()},onRender:function(){this._clearPanel(),this._drawColorLegend(),this._drawFillLegend()},_containerTemplate:'
',_template:i.template('
<%=name%>
<%=items%>
'),_itemTemplate:i.template(["
\">",'
','
',"
","<%=label%>","
"].join("")),_itemFillTemplate:i.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 e=this;e._color.forEach(function(t){var r=e._chart.select(function(e){return e.config.color===t})[0];if(r){var a=r.getScale("color"),n=e._chart.getDataSources({excludeFilter:["legend"]}),l=i.unique(n[a.source].data.map(function(e){return e[a.dim]})).map(function(r){var n=i.escape(r),l=a.dim+n;return{scaleId:t,dim:a.dim,color:a(r),disabled:e._currentFilters.hasOwnProperty(l),label:r,value:n}});e._legendColorByScaleId[t]=l,e._container.insertAdjacentHTML("beforeend",e._template({items:l.map(function(t){return e._itemTemplate({scaleId:t.scaleId,dim:t.dim,color:t.color,classDisabled:t.disabled?"disabled":"",label:t.label,value:t.value})}).join(""),name:(((r.guide||{}).color||{}).label||{}).text||a.dim}))}})},_drawFillLegend:function(){var e=this;e._fill.forEach(function(t){var r=e._chart.select(function(e){return"COORDS.MAP"===e.config.type&&e.config.fill===t});if(r.length>0){var a=r[0].getScale("fill"),n=a.brewer,l=a.domain(),o=(l[1]-l[0])/n.length,c=i.range(n.length).map(function(t){var r=l[0]+t*o,c="";return 0===t&&(c=l[0]),t===n.length-1&&(c=l[1]),e._itemFillTemplate({color:a(r),label:c,value:i.escape(r)})});e._container.insertAdjacentHTML("beforeend",e._template({items:c.join(""),name:(((r[0].guide||{}).fill||{}).label||{}).text||a.dim}))}})},_toggleLegendItem:function(e){var t=e.getAttribute("data-scale-id"),r=e.getAttribute("data-dim"),a=e.getAttribute("data-value"),n=r+a,i=this._legendColorByScaleId[t].filter(function(e){return!e.disabled});if(1!==i.length||t!==i[0].scaleId||a!==i[0].value){var l=this._currentFilters;if(l.hasOwnProperty(n)){var o=l[n];delete l[n],e.classList.remove("disabled"),this._chart.removeFilter(o)}else e.classList.add("disabled"),l[n]=this._chart.addFilter({tag:"legend",predicate:function(e){return e[r]!=a}});this._chart.refresh()}},_highlightToggle:function(e,t){var r=e.getAttribute("data-scale-id"),a=e.getAttribute("data-dim"),n=e.getAttribute("data-value");this._chart.select(function(e){return e.config.color===r}).forEach(function(e){e.fire("highlight",function(e){return!t||e[a]==n})})},_generateColorMap:function(e){var t=i.range(20).map(function(e){return"color20-"+(1+e)});return e.reduce(function(e,r,a){return e[r]=t[a%20],e},{})},_assignStaticBrewersOrEx:function(){var e=this;e._color.forEach(function(t){var r=e._chart.getSpec().scales[t],a=e._chart.getDataSources({excludeFilter:["legend"]}),n=e._chart.getScaleFactory(a).createScaleInfoByName(t).domain();r.brewer||(r.brewer="measure"!==r.dimType?e._generateColorMap(n):["#e5f5e0","#a1d99b","#31a354"])})}}}n.a.api.plugins.add("geomap-legend",l),t.default=l}})}); \ No newline at end of file +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],t);else{var r="object"==typeof exports?t(require("taucharts")):t(e.Taucharts);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(window,function(e){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=25)}({0:function(t,r){t.exports=e},25:function(e,t,r){"use strict";r.r(t);var a=r(0),n=r.n(a),i=n.a.api.utils;function l(e){i.defaults(e||{},{});var t=function(e,t,r,a){e.addEventListener(t,function(e){for(var t=e.target;t!==e.currentTarget&&null!==t;)t.classList.contains(r)&&a(e,t),t=t.parentNode})};return{init:function(e){this._chart=e,this._currentFilters={},this._legendColorByScaleId={};var r=this._chart.getSpec(),a=function(e){return function(t,a){var n=r.scales[a];return n.type===e&&n.dim&&t.push(a),t}};this._color=Object.keys(r.scales).reduce(a("color"),[]),this._fill=Object.keys(r.scales).reduce(a("fill"),[]);var n=this._color.length>0,i=this._fill.length>0;(n||i)&&(this._container=this._chart.insertToRightSidebar(this._containerTemplate),n&&(t(this._container,"click","tau-chart__legend__item-color",function(e,t){this._toggleLegendItem(t)}.bind(this)),t(this._container,"mouseover","tau-chart__legend__item-color",function(e,t){this._highlightToggle(t,!0)}.bind(this)),t(this._container,"mouseout","tau-chart__legend__item-color",function(e,t){this._highlightToggle(t,!1)}.bind(this))))},onSpecReady:function(){this._assignStaticBrewersOrEx()},onRender:function(){this._clearPanel(),this._drawColorLegend(),this._drawFillLegend()},_containerTemplate:'
',_template:i.template('
<%=name%>
<%=items%>
'),_itemTemplate:i.template(["
\">",'
','
',"
","<%=label%>","
"].join("")),_itemFillTemplate:i.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 e=this;e._color.forEach(function(t){var r=e._chart.select(function(e){return e.config.color===t})[0];if(r){var a=r.getScale("color"),n=e._chart.getDataSources({excludeFilter:["legend"]}),l=i.unique(n[a.source].data.map(function(e){return e[a.dim]})).map(function(r){var n=i.escape(r),l=a.dim+n;return{scaleId:t,dim:a.dim,color:a(r),disabled:e._currentFilters.hasOwnProperty(l),label:r,value:n}});e._legendColorByScaleId[t]=l,e._container.insertAdjacentHTML("beforeend",e._template({items:l.map(function(t){return e._itemTemplate({scaleId:t.scaleId,dim:t.dim,color:t.color,classDisabled:t.disabled?"disabled":"",label:t.label,value:t.value})}).join(""),name:(((r.guide||{}).color||{}).label||{}).text||a.dim}))}})},_drawFillLegend:function(){var e=this;e._fill.forEach(function(t){var r=e._chart.select(function(e){return"COORDS.MAP"===e.config.type&&e.config.fill===t});if(r.length>0){var a=r[0].getScale("fill"),n=a.brewer,l=a.domain(),o=(l[1]-l[0])/n.length,c=i.range(n.length).map(function(t){var r=l[0]+t*o,c="";return 0===t&&(c=l[0]),t===n.length-1&&(c=l[1]),e._itemFillTemplate({color:a(r),label:c,value:i.escape(r)})});e._container.insertAdjacentHTML("beforeend",e._template({items:c.join(""),name:(((r[0].guide||{}).fill||{}).label||{}).text||a.dim}))}})},_toggleLegendItem:function(e){var t=e.getAttribute("data-scale-id"),r=e.getAttribute("data-dim"),a=e.getAttribute("data-value"),n=r+a,i=this._legendColorByScaleId[t].filter(function(e){return!e.disabled});if(1!==i.length||t!==i[0].scaleId||a!==i[0].value){var l=this._currentFilters;if(l.hasOwnProperty(n)){var o=l[n];delete l[n],e.classList.remove("disabled"),this._chart.removeFilter(o)}else e.classList.add("disabled"),l[n]=this._chart.addFilter({tag:"legend",predicate:function(e){return e[r]!=a}});this._chart.refresh()}},_highlightToggle:function(e,t){var r=e.getAttribute("data-scale-id"),a=e.getAttribute("data-dim"),n=e.getAttribute("data-value");this._chart.select(function(e){return e.config.color===r}).forEach(function(e){e.fire("highlight",function(e){return!t||e[a]==n})})},_generateColorMap:function(e){var t=i.range(20).map(function(e){return"color20-"+(1+e)});return e.reduce(function(e,r,a){return e[r]=t[a%20],e},{})},_assignStaticBrewersOrEx:function(){var e=this;e._color.forEach(function(t){var r=e._chart.getSpec().scales[t],a=e._chart.getDataSources({excludeFilter:["legend"]}),n=e._chart.getScaleFactory(a).createScaleInfoByName(t).domain();r.brewer||(r.brewer="measure"!==r.dimType?e._generateColorMap(n):["#e5f5e0","#a1d99b","#31a354"])})}}}n.a.api.plugins.add("geomap-legend",l),t.default=l}})}); \ No newline at end of file diff --git a/dist/plugins/geomap-tooltip.js b/dist/plugins/geomap-tooltip.js index d2777728c..d7feffe32 100644 --- a/dist/plugins/geomap-tooltip.js +++ b/dist/plugins/geomap-tooltip.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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"));else if("function"==typeof define&&define.amd)define(["taucharts"],e);else{var i="object"==typeof exports?e(require("taucharts")):e(t.Taucharts);for(var o in i)("object"==typeof exports?exports:t)[o]=i[o]}}(window,function(t){return function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=27)}({0:function(e,i){e.exports=t},27:function(t,e,i){"use strict";i.r(e);var o=i(0),n=i.n(o),r=n.a.api.utils;function a(t){r.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")&&(i._exclude(),i._tooltip.hide(),i._blurSelection()),e=e.parentNode},!1);var e,i=this;this._showTooltip=function(t){clearTimeout(e),i._currData=t.data;var o="No data";null!==t.data&&(o=Object.keys(t.data).map(function(e){return i.itemTemplate({label:e,value:t.data[e]})}).join(""));var n=i._tooltip.getElement().querySelectorAll(".i-role-content");n[0]&&(n[0].innerHTML=o);var r=i._tooltip.getElement().querySelectorAll(".i-role-exclude");if(r[0]){var a=t.data&&i._chart.getChartModelData().length>1;r[0].style.visibility=a?"visible":"hidden"}i._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this._hideTooltip=function(t){e=setTimeout(function(){i._tooltip.hide()},t?0:1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){i._hideTooltip(!0),i._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:r.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,i){e._showTooltip(i)}),t.on("point-mouseout",function(t,i){e._hideTooltip()})},_subscribeToArea:function(t){var e=this;!t.getScale("code").dim||t.on("area-click",function(i,o){e._currNode=i,o.data?e._currData===o.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}}(o.data)),e._showTooltip(o)):(e._showTooltip(o),e._hideTooltip(!1),e._blurSelection())})}}}n.a.api.plugins.add("geomap-tooltip",a),e.default=a}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],e);else{var i="object"==typeof exports?e(require("taucharts")):e(t.Taucharts);for(var o in i)("object"==typeof exports?exports:t)[o]=i[o]}}(window,function(t){return function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=26)}({0:function(e,i){e.exports=t},26:function(t,e,i){"use strict";i.r(e);var o=i(0),n=i.n(o),r=n.a.api.utils;function a(t){r.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")&&(i._exclude(),i._tooltip.hide(),i._blurSelection()),e=e.parentNode},!1);var e,i=this;this._showTooltip=function(t){clearTimeout(e),i._currData=t.data;var o="No data";null!==t.data&&(o=Object.keys(t.data).map(function(e){return i.itemTemplate({label:e,value:t.data[e]})}).join(""));var n=i._tooltip.getElement().querySelectorAll(".i-role-content");n[0]&&(n[0].innerHTML=o);var r=i._tooltip.getElement().querySelectorAll(".i-role-exclude");if(r[0]){var a=t.data&&i._chart.getChartModelData().length>1;r[0].style.visibility=a?"visible":"hidden"}i._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this._hideTooltip=function(t){e=setTimeout(function(){i._tooltip.hide()},t?0:1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){i._hideTooltip(!0),i._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:r.template(['
','
<%=label%>
','
<%=value%>
',"
"].join("")),_exclude:function(){var t;this._chart.addFilter({tag:"exclude",predicate:(t=this._currData,function(e){return JSON.stringify(e)!==JSON.stringify(t)})}),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,i){e._showTooltip(i)}),t.on("point-mouseout",function(t,i){e._hideTooltip()})},_subscribeToArea:function(t){var e=this;!t.getScale("code").dim||t.on("area-click",function(i,o){var n,r;e._currNode=i,o.data?e._currData===o.data?(e._hideTooltip(!0),e._blurSelection()):(t.fire("highlight-area",(n=o.data,r=JSON.stringify(n),function(t){return JSON.stringify(t)===r})),e._showTooltip(o)):(e._showTooltip(o),e._hideTooltip(!1),e._blurSelection())})}}}n.a.api.plugins.add("geomap-tooltip",a),e.default=a}})}); \ No newline at end of file diff --git a/dist/plugins/layers.js b/dist/plugins/layers.js index 566ff4325..3257938bb 100644 --- a/dist/plugins/layers.js +++ b/dist/plugins/layers.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"),require("d3-array"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-array"],t);else{var r="object"==typeof exports?t(require("taucharts"),require("d3-array")):t(e.Taucharts,e.d3);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(window,function(e,t){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(i,a,function(t){return e[t]}.bind(null,a));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=28)}({0:function(t,r){t.exports=e},28:function(e,t,r){"use strict";r.r(t);var i=r(0),a=r.n(i),n=r(4),c=a.a.api.utils,o=a.a.api.pluginsSDK,u=o.tokens();function l(e){var t=c.defaults(e||{},{title:"Layers",label:"Layer Type",showPanel:!0,showLayers:!0,mode:"merge",axisWidth:45,layers:[]});t.layers.forEach(function(e){e.guide=c.defaults(e.guide||{},{scaleOrient:"left",textAnchor:"end",hide:!1})});var r=function(e){return function(t){return Object.assign(t,e)}},i={line:r({type:"ELEMENT.LINE"}),area:r({type:"ELEMENT.AREA"}),dots:r({type:"ELEMENT.POINT"}),scatterplot:r({type:"ELEMENT.POINT"}),bar:r({type:"ELEMENT.INTERVAL"}),"stacked-bar":r({type:"ELEMENT.INTERVAL",stack:!0})};return{init:function(e){this._chart=e;var r=o.spec(this._chart.getSpec()),i=this.checkIfApplicable(r);if(this._isApplicable=0===i.length,r.addTransformation("defined-only",function(e,t){var r=t.key;return e.filter(function(e){return null!==e[r]&&void 0!==e[r]})}),this._isApplicable){this.isFacet=this.checkIsFacet(r),this.primaryY=this.findPrimaryLayer(r);var a=this.getLayersText(),n=this.getLayersGroup(),u=t.label;this.fieldColorScale=u,r.setSettings("excludeNull",!1).setSettings("fitModel",null).addScale(u,{type:"color",source:"/",dim:u,brewer:t.brewer}).addTransformation("slice-layer",function(e,t){var r=t.key,i=t.group;return i?e.filter(function(e){var t=e[i],r=e[t];return t&&null!==r&&void 0!==r}):e.filter(function(e){return e[u]===a[r]&&null!==e[r]&&void 0!==e[r]})});var l=[this.primaryY].concat(t.layers).reduce(function(e,t){return e.concat(t.y)},[]);e.setupChartSourceModel(function(e){var t={};t[u]={type:"category"};var r={"/":{dims:t,data:[]}};return r["/"].dims=Object.assign(t,e["/"].dims),r["/"].data=e["/"].data.reduce(function(e,t){return e.concat(l.map(function(e){var r={};r[u]=a[e];var i=n[e];return i&&(r[i]=t[e],r.subLayer=i),Object.assign(r,t)}))},[]),Object.assign(r,c.omit(e,"/"))}),t.showPanel&&(this._container=e.insertToRightSidebar(this.containerTemplate),this._container.classList.add("applicable-true"),this.uiChangeEventsDispatcher=function(e){var r=e.target,i=r.classList;i.contains("i-role-show-layers")&&(t.showLayers=r.checked),i.contains("i-role-change-mode")&&(t.mode=r.value),this._chart.refresh()}.bind(this),this._container.addEventListener("change",this.uiChangeEventsDispatcher,!1))}else{r.getSettings("log")("[layers plugin]: is not applicable. "+i.join(" / "))}},getLayersText:function(){return[this.primaryY].concat(t.layers).reduce(function(e,t){return(Array.isArray(t.y)?t.y:[t.y]).reduce(function(e,r){return e[r]=this.extractLabelForKey(t,r),e}.bind(this),e)}.bind(this),{})},getLayersGroup:function(){return[this.primaryY].concat(t.layers).reduce(function(e,t){var r=null;return Array.isArray(t.y)&&(r=t.y.join(", ")),c.flatten([t.y]).reduce(function(e,t){return e[t]=r,e},e)}.bind(this),{})},checkIsFacet:function(e){return e.unit().reduce(function(e,t,r){return e||(r&&"COORDS.RECT"===r.type&&"COORDS.RECT"===t.type?e=!0:e)},!1)},checkIfApplicable:function(e){return e.unit().reduce(function(t,r,i){if(i&&"COORDS.RECT"!==i.type)return t.concat("Chart specification contains non-rectangular coordinates");if(i&&"COORDS.RECT"===i.type&&"COORDS.RECT"!==r.type){var a=e.getScale(r.y);if("measure"!==e.getSourceDim(a.source,a.dim).type)return t.concat("Y scale is not a measure")}return t},[])},isLeafElement:function(e,t){return t&&"COORDS.RECT"===t.type&&"COORDS.RECT"!==e.type},isFirstCoordNode:function(e,t){return!t&&e&&"COORDS.RECT"===e.type},isFinalCoordNode:function(e,t){return e&&"COORDS.RECT"===e.type&&e.units.every(function(e){return"COORDS.RECT"!==e.type})},buildLayersLayout:function(e){return e.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(e){var t=this,r=e.unit().reduce(function(r,i){return r.concat(t.isFinalCoordNode(i)?{y:e.getScale(i.y).dim,isPrimary:!0,guide:i.guide.y,scaleName:i.y}:[])},[]);return o.cloneObject(r[0])},createPrimaryUnitReducer:function(e,r,i,a){var n=this;return function(c,o,u){var l=function(e){return!0!==e.guide.hide};if(n.isFacet&&n.isFirstCoordNode(o,u)){o.guide.y.label=o.guide.y.label||{};var s=o.guide.y.label._original_text||o.guide.y.label.text;o.guide.y.label.text=[s,r.filter(l).map(n.extractLayerLabel.bind(n)).join(", ")].join(e.getSettings("facetLabelDelimiter")),"dock"===t.mode&&(o.guide.y.label.padding-=15,o.guide.y.padding+=15,o.guide.y.rotate=-90,o.guide.y.textAnchor="middle")}return n.isLeafElement(o,u)&&(u.units=u.units.filter(function(e){return e!==o})),n.isFinalCoordNode(o)&&(o.guide.y.label=o.guide.y.label||{},"dock"===t.mode&&(o.guide.padding.l=i,o.guide.padding.r=a,o.guide.y.hide=!0),"merge"===t.mode&&(o.guide.y.label.text=n.isFacet?"":r.filter(l).map(n.extractLayerLabel.bind(n)).join(", "))),c}},createSecondaryUnitReducer:function(e,r,a,n,c,u,l,s){var d=this,y=d.getScaleName(r.scaleName||r.y),f=r.guide.scaleOrient,p=Array.isArray(r.y),g=r.isPrimary;return function(h,m,b){if(d.isFacet&&d.isFirstCoordNode(m,b)&&(m.guide.y.label.text="",m.guide.x.hide=!0,m.guide.y.hide=!0),d.isLeafElement(m,b)){(r.type?i[r.type]:function(e){return e})(m),m.y=y;var v=e.getScale(m.size).dim;if(g&&v);else{var x="size_null"+s;e.addScale(x,{type:"size",source:"?",mid:1}),m.size=x}var L=e.getScale(m.color).dim;g&&L||(m.color=d.fieldColorScale,m.expression.operator="groupBy",m.expression.params=p?["subLayer"]:[d.fieldColorScale]);var S=p?{group:"subLayer"}:{key:r.y};o.unit(m).addTransformation("slice-layer",S)}if(d.isFinalCoordNode(m)){if(m.y=y,m.guide.y=Object.assign(m.guide.y,r.guide||{}),m.guide.y.label=m.guide.y.label||{},m.guide.y.label.text=d.extractLayerLabel(r),m.guide.x.hide=!0,"dock"===t.mode){m.guide.showGridLines="",m.guide.padding.l=a,m.guide.padding.r=n,m.guide.y.label.textAnchor="end",m.guide.y.label.dock="right",m.guide.y.label.padding="right"===f?1:-10,m.guide.y.label.cssClass="label inline";var _="right"===f?l:u;m.guide.y.padding+=c*_}"merge"===t.mode&&(m.guide.showGridLines="",m.guide.y.hide=!0)}return h}},getScaleName:function(e){return Array.isArray(e)?e.join(", "):e},extractLabelForKey:function(e,t){var r=e.guide||{};r.label="string"==typeof r.label?{text:r.label}:r.label;var i=r.label||{},a=i.byKeys||{};return Array.isArray(e.y)?a[t]||t:i.text||i._original_text||e.y},extractLayerLabel:function(e){var t=this;return(Array.isArray(e.y)?e.y:[e.y]).map(function(r){return t.extractLabelForKey(e,r)}).join(", ")},onSpecReady:function(e,r){var i=this,a=o.spec(r);if(t.showLayers&&i._isApplicable){a=t.layers.reduce(function(e,t){var r=i.getScaleName(t.y);return e.addScale(r,Object.assign({type:"linear",source:"/",dim:r,autoScale:!0},c.pick(t.guide||{},"min","max","autoScale","nice","niceInterval")))},a);var n,u=[this.primaryY].concat(t.layers).sort(function(e,t){return(e.guide.zIndex||0)-(t.guide.zIndex||0)}),l=a.unit(),s=t.axisWidth,d=function(e){return function(t){var r=t.guide.scaleOrient||"left";return!0!==t.guide.hide&&r===e}},y=d("left"),f=d("right"),p=u.filter(y).length*s,g=u.filter(f).length*s,h=i.buildLayersLayout(a).addFrame({key:{x:1,y:1},units:[(n=o.unit(l.clone())).reduce(i.createPrimaryUnitReducer(a,u,p,g),n).value()]}),m=-1,b=-1;u.reduce(function(e,t,r){return m=y(t)?m+1:m,b=f(t)?b+1:b,e.addFrame({key:{x:1,y:1},units:[(n=o.unit(l.clone())).reduce(i.createSecondaryUnitReducer(a,t,p,g,s,m,b,r),n).value()]})},h)}else a.unit().traverse(function(e,t){i.isLeafElement(e,t)&&o.unit(e).addTransformation("defined-only",{key:a.getScale(e.y).dim})})},onUnitsStructureExpanded:function(){var e=this;if(e._isApplicable&&"merge"===t.mode){var r=o.spec(e._chart.getSpec()),i=e.primaryY.scaleName,a=t.layers.map(function(t){return e.getScaleName(t.y)}).filter(function(e){return r.getScale(e)}).concat(i),u=a.reduce(function(t,r){var i=e._chart.getScaleInfo(r);return t[r]=i.domain().filter(function(e){return Number.isFinite(e)}),t},{}),l=n.extent(c.flatten(Object.keys(u).map(function(e){return u[e]})));a.forEach(function(e){var t=r.getScale(e);t.min=l[0],t.max=l[1],t.nice=!1})}},containerTemplate:'
',template:c.template(['","
",'","
"].join("")),onRender:function(){this._isApplicable&&t.showPanel&&(this._container.innerHTML=this.template({title:t.title,mode:t.mode,showLayers:t.showLayers}))}}}a.a.api.plugins.add("layers",l),t.default=l},4:function(e,r){e.exports=t}})}); \ No newline at end of file +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"),require("d3-array"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-array"],t);else{var r="object"==typeof exports?t(require("taucharts"),require("d3-array")):t(e.Taucharts,e.d3);for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(window,function(e,t){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(i,a,function(t){return e[t]}.bind(null,a));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=27)}({0:function(t,r){t.exports=e},27:function(e,t,r){"use strict";r.r(t);var i=r(0),a=r.n(i),n=r(4),c=a.a.api.utils,o=a.a.api.pluginsSDK,u=o.tokens();function l(e){var t=c.defaults(e||{},{title:"Layers",label:"Layer Type",showPanel:!0,showLayers:!0,mode:"merge",axisWidth:45,layers:[]});t.layers.forEach(function(e){e.guide=c.defaults(e.guide||{},{scaleOrient:"left",textAnchor:"end",hide:!1})});var r=function(e){return function(t){return Object.assign(t,e)}},i={line:r({type:"ELEMENT.LINE"}),area:r({type:"ELEMENT.AREA"}),dots:r({type:"ELEMENT.POINT"}),scatterplot:r({type:"ELEMENT.POINT"}),bar:r({type:"ELEMENT.INTERVAL"}),"stacked-bar":r({type:"ELEMENT.INTERVAL",stack:!0})};return{init:function(e){this._chart=e;var r=o.spec(this._chart.getSpec()),i=this.checkIfApplicable(r);if(this._isApplicable=0===i.length,r.addTransformation("defined-only",function(e,t){var r=t.key;return e.filter(function(e){return null!==e[r]&&void 0!==e[r]})}),this._isApplicable){this.isFacet=this.checkIsFacet(r),this.primaryY=this.findPrimaryLayer(r);var a=this.getLayersText(),n=this.getLayersGroup(),u=t.label;this.fieldColorScale=u,r.setSettings("excludeNull",!1).setSettings("fitModel",null).addScale(u,{type:"color",source:"/",dim:u,brewer:t.brewer}).addTransformation("slice-layer",function(e,t){var r=t.key,i=t.group;return i?e.filter(function(e){var t=e[i],r=e[t];return t&&null!=r}):e.filter(function(e){return e[u]===a[r]&&null!==e[r]&&void 0!==e[r]})});var l=[this.primaryY].concat(t.layers).reduce(function(e,t){return e.concat(t.y)},[]);e.setupChartSourceModel(function(e){var t={};t[u]={type:"category"};var r={"/":{dims:t,data:[]}};return r["/"].dims=Object.assign(t,e["/"].dims),r["/"].data=e["/"].data.reduce(function(e,t){return e.concat(l.map(function(e){var r={};r[u]=a[e];var i=n[e];return i&&(r[i]=t[e],r.subLayer=i),Object.assign(r,t)}))},[]),Object.assign(r,c.omit(e,"/"))}),t.showPanel&&(this._container=e.insertToRightSidebar(this.containerTemplate),this._container.classList.add("applicable-true"),this.uiChangeEventsDispatcher=function(e){var r=e.target,i=r.classList;i.contains("i-role-show-layers")&&(t.showLayers=r.checked),i.contains("i-role-change-mode")&&(t.mode=r.value),this._chart.refresh()}.bind(this),this._container.addEventListener("change",this.uiChangeEventsDispatcher,!1))}else{r.getSettings("log")("[layers plugin]: is not applicable. "+i.join(" / "))}},getLayersText:function(){return[this.primaryY].concat(t.layers).reduce(function(e,t){return(Array.isArray(t.y)?t.y:[t.y]).reduce(function(e,r){return e[r]=this.extractLabelForKey(t,r),e}.bind(this),e)}.bind(this),{})},getLayersGroup:function(){return[this.primaryY].concat(t.layers).reduce(function(e,t){var r=null;return Array.isArray(t.y)&&(r=t.y.join(", ")),c.flatten([t.y]).reduce(function(e,t){return e[t]=r,e},e)}.bind(this),{})},checkIsFacet:function(e){return e.unit().reduce(function(e,t,r){return e||(r&&"COORDS.RECT"===r.type&&"COORDS.RECT"===t.type?e=!0:e)},!1)},checkIfApplicable:function(e){return e.unit().reduce(function(t,r,i){if(i&&"COORDS.RECT"!==i.type)return t.concat("Chart specification contains non-rectangular coordinates");if(i&&"COORDS.RECT"===i.type&&"COORDS.RECT"!==r.type){var a=e.getScale(r.y);if("measure"!==e.getSourceDim(a.source,a.dim).type)return t.concat("Y scale is not a measure")}return t},[])},isLeafElement:function(e,t){return t&&"COORDS.RECT"===t.type&&"COORDS.RECT"!==e.type},isFirstCoordNode:function(e,t){return!t&&e&&"COORDS.RECT"===e.type},isFinalCoordNode:function(e,t){return e&&"COORDS.RECT"===e.type&&e.units.every(function(e){return"COORDS.RECT"!==e.type})},buildLayersLayout:function(e){return e.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(e){var t=this,r=e.unit().reduce(function(r,i){return r.concat(t.isFinalCoordNode(i)?{y:e.getScale(i.y).dim,isPrimary:!0,guide:i.guide.y,scaleName:i.y}:[])},[]);return o.cloneObject(r[0])},createPrimaryUnitReducer:function(e,r,i,a){var n=this;return function(c,o,u){var l=function(e){return!0!==e.guide.hide};if(n.isFacet&&n.isFirstCoordNode(o,u)){o.guide.y.label=o.guide.y.label||{};var s=o.guide.y.label._original_text||o.guide.y.label.text;o.guide.y.label.text=[s,r.filter(l).map(n.extractLayerLabel.bind(n)).join(", ")].join(e.getSettings("facetLabelDelimiter")),"dock"===t.mode&&(o.guide.y.label.padding-=15,o.guide.y.padding+=15,o.guide.y.rotate=-90,o.guide.y.textAnchor="middle")}return n.isLeafElement(o,u)&&(u.units=u.units.filter(function(e){return e!==o})),n.isFinalCoordNode(o)&&(o.guide.y.label=o.guide.y.label||{},"dock"===t.mode&&(o.guide.padding.l=i,o.guide.padding.r=a,o.guide.y.hide=!0),"merge"===t.mode&&(o.guide.y.label.text=n.isFacet?"":r.filter(l).map(n.extractLayerLabel.bind(n)).join(", "))),c}},createSecondaryUnitReducer:function(e,r,a,n,c,u,l,s){var d=this,y=d.getScaleName(r.scaleName||r.y),f=r.guide.scaleOrient,p=Array.isArray(r.y),g=r.isPrimary;return function(h,m,b){if(d.isFacet&&d.isFirstCoordNode(m,b)&&(m.guide.y.label.text="",m.guide.x.hide=!0,m.guide.y.hide=!0),d.isLeafElement(m,b)){(r.type?i[r.type]:function(e){return e})(m),m.y=y;var v=e.getScale(m.size).dim;if(g&&v);else{var x="size_null"+s;e.addScale(x,{type:"size",source:"?",mid:1}),m.size=x}var L=e.getScale(m.color).dim;g&&L||(m.color=d.fieldColorScale,m.expression.operator="groupBy",m.expression.params=p?["subLayer"]:[d.fieldColorScale]);var S=p?{group:"subLayer"}:{key:r.y};o.unit(m).addTransformation("slice-layer",S)}if(d.isFinalCoordNode(m)){if(m.y=y,m.guide.y=Object.assign(m.guide.y,r.guide||{}),m.guide.y.label=m.guide.y.label||{},m.guide.y.label.text=d.extractLayerLabel(r),m.guide.x.hide=!0,"dock"===t.mode){m.guide.showGridLines="",m.guide.padding.l=a,m.guide.padding.r=n,m.guide.y.label.textAnchor="end",m.guide.y.label.dock="right",m.guide.y.label.padding="right"===f?1:-10,m.guide.y.label.cssClass="label inline";var _="right"===f?l:u;m.guide.y.padding+=c*_}"merge"===t.mode&&(m.guide.showGridLines="",m.guide.y.hide=!0)}return h}},getScaleName:function(e){return Array.isArray(e)?e.join(", "):e},extractLabelForKey:function(e,t){var r=e.guide||{};r.label="string"==typeof r.label?{text:r.label}:r.label;var i=r.label||{},a=i.byKeys||{};return Array.isArray(e.y)?a[t]||t:i.text||i._original_text||e.y},extractLayerLabel:function(e){var t=this;return(Array.isArray(e.y)?e.y:[e.y]).map(function(r){return t.extractLabelForKey(e,r)}).join(", ")},onSpecReady:function(e,r){var i=this,a=o.spec(r);if(t.showLayers&&i._isApplicable){a=t.layers.reduce(function(e,t){var r=i.getScaleName(t.y);return e.addScale(r,Object.assign({type:"linear",source:"/",dim:r,autoScale:!0},c.pick(t.guide||{},"min","max","autoScale","nice","niceInterval")))},a);var n,u=[this.primaryY].concat(t.layers).sort(function(e,t){return(e.guide.zIndex||0)-(t.guide.zIndex||0)}),l=a.unit(),s=t.axisWidth,d=function(e){return function(t){var r=t.guide.scaleOrient||"left";return!0!==t.guide.hide&&r===e}},y=d("left"),f=d("right"),p=u.filter(y).length*s,g=u.filter(f).length*s,h=i.buildLayersLayout(a).addFrame({key:{x:1,y:1},units:[(n=o.unit(l.clone())).reduce(i.createPrimaryUnitReducer(a,u,p,g),n).value()]}),m=-1,b=-1;u.reduce(function(e,t,r){return m=y(t)?m+1:m,b=f(t)?b+1:b,e.addFrame({key:{x:1,y:1},units:[(n=o.unit(l.clone())).reduce(i.createSecondaryUnitReducer(a,t,p,g,s,m,b,r),n).value()]})},h)}else a.unit().traverse(function(e,t){i.isLeafElement(e,t)&&o.unit(e).addTransformation("defined-only",{key:a.getScale(e.y).dim})})},onUnitsStructureExpanded:function(){var e=this;if(e._isApplicable&&"merge"===t.mode){var r=o.spec(e._chart.getSpec()),i=e.primaryY.scaleName,a=t.layers.map(function(t){return e.getScaleName(t.y)}).filter(function(e){return r.getScale(e)}).concat(i),u=a.reduce(function(t,r){var i=e._chart.getScaleInfo(r);return t[r]=i.domain().filter(function(e){return Number.isFinite(e)}),t},{}),l=n.extent(c.flatten(Object.keys(u).map(function(e){return u[e]})));a.forEach(function(e){var t=r.getScale(e);t.min=l[0],t.max=l[1],t.nice=!1})}},containerTemplate:'
',template:c.template(['","
",'","
"].join("")),onRender:function(){this._isApplicable&&t.showPanel&&(this._container.innerHTML=this.template({title:t.title,mode:t.mode,showLayers:t.showLayers}))}}}a.a.api.plugins.add("layers",l),t.default=l},4:function(e,r){e.exports=t}})}); \ No newline at end of file diff --git a/dist/plugins/legend.css b/dist/plugins/legend.css index 5989e7ce8..880265ae7 100644 --- a/dist/plugins/legend.css +++ b/dist/plugins/legend.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 93b876fd8..1c8523fdd 100644 --- a/dist/plugins/legend.dark.css +++ b/dist/plugins/legend.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/legend.js b/dist/plugins/legend.js index f60cf145a..e19b4177c 100644 --- a/dist/plugins/legend.js +++ b/dist/plugins/legend.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"),require("d3-format"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-format"],t);else{var r="object"==typeof exports?t(require("taucharts"),require("d3-format")):t(e.Taucharts,e.d3);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(window,function(e,t){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=29)}({0:function(t,r){t.exports=e},29:function(e,t,r){"use strict";r.r(t);var n=r(0),a=r.n(n),i=r(9),o=a.a.api.utils,c=a.a.api.pluginsSDK,l=".tau-chart__legend__reset",s=".tau-chart__legend__item-color",u=".tau-chart__legend__guide--color__overlay",d=4,h=13,f=0,_=function(){return++f},g=a.a.api.utils.xml,m=function(e,t){var r=e[0],n=e[1],a=(n-r)/(t-1),i=o.range(t-2).map(function(e){return r+a*(e+1)});return[r].concat(i).concat(n)},p=function(e,t,r){if(e.length<3)return e.slice(0);if(t<3)return[e[0],e[e.length-1]];var n,a=e[0]<0?Math.abs(e[0]):0,i=function(e){return e},c="sqrt"===r?function(e){return Math.sqrt(e+a)}:i,l="sqrt"===r?function(e){return Math.pow(e,2)-a}:i,s=[(e=e.map(c))[0]],u=e[e.length-1]-e[0],d=.5*u/(t-1),h=o.range(1,t-1).map(function(e){var r=u*e/(t-1);return{min:r-d,mid:r,max:r+d,diff:Number.MAX_VALUE,closest:null}}),f=0,_=function(){if(f!==h.length){var e=n;(n=h[f++]).min=Math.max(n.min,(e&&null!==e.closest?e.closest:s[0])+d)}};return _(),e.forEach(function(e){if(!(en.max&&_();var t=Math.abs(e-n.mid);t0?Math.abs(t-e):r,i=b(a),o=Math.abs(n-i);return Math.abs(n)>3&&o<=3?S:function(e){var t=b(r-e),n=Math.min((i<0?Math.abs(i):0)+(t0,o=this._fill.length>0,c=this._size.length>0;if(this._assignStaticBrewersOrEx(),i||o||c){switch(r.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)}i&&(f(this._container,"click",l,function(e,r){t._toggleLegendItem(r,"reset")}),f(this._container,"click",s,function(e,r){var n=e.ctrlKey||e.target.matches(u)?"leave-others":"focus-single";t._toggleLegendItem(r,n)}),f(this._container,"mouseover",s,function(e,r){t._highlightToggle(r,!0)}),f(this._container,"mouseout",s,function(e,r){t._highlightToggle(r,!1)}))}},destroy:function(){var e=this._currentFilters,t=this._chart;Object.keys(e).forEach(function(r){return t.removeFilter(e[r])}),this._container&&this._container.parentElement&&(this._clearPanel(),this._container.parentElement.removeChild(this._container))},onSpecReady:function(e,t){this._formatters=c.getFieldFormatters(t,r.formatters)},_getFormat:function(e){return this._formatters[e]?this._formatters[e].format:function(e){return String(e)}},onRender:function(){var e=this;if(t&&r.selectedCategories&&0!==r.selectedCategories.length){var n=this._getLegendColorByScales();return Object.keys(n).forEach(function(t){n[t].legendColorItems.forEach(function(t){var n=t.value,a=t.dim;if(-1===r.selectedCategories.indexOf(JSON.parse(n))){var o=a+n,c=i(a,n);e._currentFilters[o]=e._chart.addFilter({tag:"legend",predicate:function(e){return!c(e)}})}})}),t=!1,void this._chart.refresh()}this._clearPanel(),this._drawColorLegend(),this._drawFillLegend(),this._drawSizeLegend()},_containerTemplate:'
',_template:o.template(['
',"<%=top%>",'
<%=name%>
',"<%=items%>","
"].join("")),_itemTemplate:o.template(["
\">",'
','
','
',"
","
","
",' <%=label%>',"
"].join("")),_resetTemplate:o.template(['
','
Reset
',"
"].join("")),_clearPanel:function(){this._container&&(clearTimeout(this._scrollTimeout),this._getScrollContainer().removeEventListener("scroll",this._scrollListener),this._container.innerHTML="")},_drawFillLegend:function(){var e=this;e._fill.forEach(function(t){var r=e._chart.select(function(e){return e.config.color===t})[0];if(r){var n=r.config.guide||{},i=r.getScale("color"),l=i.domain().sort(function(e,t){return e-t}),s=a(l),u=s?l.map(Number):l,d=w(u[0],u[u.length-1]),f=function(){var t=e._chart.getSpec(),r=c.extractFieldsFormatInfo(t)[i.dim].format;return r||(r=function(e){return new Date(e)}),function(e){return String(r(e))}}(),_=s?f:d,p=i.brewer.length,v=((n.color||{}).label||{}).text||i.dim,b=function(e){return e.length*h*.618},y=i.isInteger?(u[1]-u[0])%3==0?4:(u[1]-u[0])%2==0?3:2:3,x=m(u,y),S=(s?x.map(function(e){return new Date(e)}):x).map(_);S[0]===S[S.length-1]&&(S=[S[0]]),e._container.insertAdjacentHTML("beforeend",e._template({name:o.escape(v),top:null,items:'
'}));var M=e._container.lastElementChild.querySelector(".tau-chart__legend__gradient-wrapper"),T=M.getBoundingClientRect().width,C=!1;S.reduce(function(e,t){return e+b(t)},0)>T&&(S.length>1&&b(S[0])+b(S[S.length-1])>T?C=!0:S=[S[0],S[S.length-1]]);var L=C?function(){var e=-.382*h/2;return{width:T,height:120,barX:0,barY:0,barWidth:20,barHeight:120,textAnchor:"start",textX:o.range(y).map(function(){return 25}),textY:1===S.length?60+.618*h:S.map(function(t,r){var n=(S.length-1-r)/(S.length-1);return h*(1-n)+120*n+e})}}():function(){var e=b(S[0])/2,t=b(S[S.length-1])/2;return{width:T,height:28+h,barX:0,barY:0,barWidth:T,barHeight:20,textAnchor:"middle",textX:1===S.length?[T/2]:S.map(function(r,n){var a=n/(S.length-1);return e*(1-a)+(T-t)*a}),textY:o.range(y).map(function(){return 28+h})}}(),j=m(u,p).map(function(e,t){return g("stop",{offset:t/(p-1)*100+"%",style:"stop-color:"+i(e)+';stop-opacity:1"'})}),F="legend-gradient-"+e.instanceId,A=g.apply(void 0,["svg",{class:"tau-chart__legend__gradient",width:L.width,height:L.height},g("defs",g.apply(void 0,["linearGradient",{id:F,x1:"0%",y1:C?"100%":"0%",x2:C?"0%":"100%",y2:"0%"}].concat(j))),g("rect",{class:"tau-chart__legend__gradient__bar",x:L.barX,y:L.barY,width:L.barWidth,height:L.barHeight,fill:"url(#"+F+")"})].concat(S.map(function(e,t){return g("text",{x:L.textX[t],y:L.textY[t],"text-anchor":L.textAnchor},e)})));M.insertAdjacentHTML("beforeend",A)}})},_drawSizeLegend:function(){var e=this;e._size.forEach(function(t){var r=e._chart.select(function(e){return e.config.size===t})[0];if(r){var n=r.config.guide||{},a=r.getScale("size"),i=a.domain().sort(function(e,t){return e-t});if(!Array.isArray(i)||!i.every(isFinite))return;var c=((n.size||{}).label||{}).text||a.dim,l=i[0],s=i[i.length-1],u=[l];if(s-l){var f=v(s-l),_=Math.round(4-f),m=Math.pow(10,_),b=o.unique(e._chart.getDataSources({excludeFilter:["legend"]})[a.source].data.map(function(e){return e[a.dim]}).filter(function(e){return e>=l&&e<=s})).sort(function(e,t){return e-t}),y=p(b,d,a.funcType);u=o.unique(y.map(function(e){return Math.round(e*m)/m}))}var x=w(u[0],u[u.length-1]),S=function(e){return e.length*h*.618};u.reverse();var M=u.map(a),T=Math.max.apply(null,M),C=u.map(x);e._container.insertAdjacentHTML("beforeend",e._template({name:o.escape(c),top:null,items:'
'}));var L=e._container.lastElementChild.querySelector(".tau-chart__legend__size-wrapper"),j=L.getBoundingClientRect().width,F=!1;(Math.max.apply(null,C.map(S))>j/4||1===C.length)&&(F=!0);var A=F?function(){for(var e=h,t=M[0]/2,r=M[M.length-1]/2,n=[t],a=1,i=void 0,c=void 0;a0&&(e._updateResetButtonPosition(),e._scrollTimeout=null,e._scrollListener=function(){var t=e._container.querySelector(l);t.style.display="none",e._scrollTimeout&&clearTimeout(e._scrollTimeout),e._scrollTimeout=setTimeout(function(){e._updateResetButtonPosition(),t.style.display="",e._scrollTimeout=null},250)},e._getScrollContainer().addEventListener("scroll",e._scrollListener))},_toggleLegendItem:function(e,t){var n=this,a=this._currentFilters,o=e?Array.prototype.filter.call(e.parentNode.childNodes,function(e){return e.matches(s)}):null,c=function(e){var t=e.getAttribute("data-dim"),r=e.getAttribute("data-value");return{sid:e.getAttribute("data-scale-id"),dim:t,val:r,key:t+r}},l=function(e){return e in a},u=function(e,t){var r=c(e);if(l(r.key)===t)if(t){var o=a[r.key];delete a[r.key],e.classList.remove("disabled"),n._chart.removeFilter(o)}else{e.classList.add("disabled");var s=i(r.dim,r.val);a[r.key]=n._chart.addFilter({tag:"legend",predicate:function(e){return!s(e)}})}},d=function(t){return t===e},h=!!e&&l(c(e).key),f=function(e,t){e.querySelector(".tau-chart__legend__guide").style.backgroundColor=t?"":"transparent"};if("reset"===t)o.forEach(function(e){u(e,!0),f(e,!0)});else if("leave-others"===t)o.forEach(function(e){d(e)&&u(e,h)}),f(e,h);else if("focus-single"===t){var _=!h&&o.every(function(e){return d(e)||l(c(e).key)});o.forEach(function(e){var t=d(e)||_;u(e,t)}),h&&f(e,!0)}var g=o.filter(function(e){return!l(c(e).key)}).map(function(e){return JSON.parse(c(e).val)});r.onSelect({type:t,selectedCategories:g}),this._chart.refresh()},_highlightToggle:function(e,t){if(!e.matches(".disabled")){var r=e.getAttribute("data-dim"),n=e.getAttribute("data-value"),a=t?i(r,n):function(e){return null};this._chart.select(function(e){return!0}).forEach(function(e){e.fire("highlight",a)})}},_getScrollContainer:function(){return this._container.parentNode.parentNode},_updateResetButtonPosition:function(){this._container.querySelector(l).style.top=this._getScrollContainer().scrollTop+"px"},_generateColorMap:function(e,t){var r=t.length;return e.reduce(function(e,n,a){return e[n]=t[a%r],e},{})},_assignStaticBrewersOrEx:function(){var e=this;e._color.forEach(function(t){var r=e._chart.getSpec().scales[t],n=e._chart.getDataSources({excludeFilter:["legend"]}),a=e._chart.getScaleFactory(n).createScaleInfoByName(t).domain();if(!r.brewer||Array.isArray(r.brewer)){var i=r.brewer||o.range(20).map(function(e){return"color20-"+(1+e)});r.brewer=e._generateColorMap(a,i)}e._legendOrderState[t]=a.reduce(function(e,t,r){return e[t]=r,e},{})})}}}a.a.api.plugins.add("legend",M),t.default=M},9:function(e,r){e.exports=t}})}); \ No newline at end of file +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"),require("d3-format"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-format"],t);else{var r="object"==typeof exports?t(require("taucharts"),require("d3-format")):t(e.Taucharts,e.d3);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(window,function(e,t){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=28)}({0:function(t,r){t.exports=e},28:function(e,t,r){"use strict";r.r(t);var a=r(0),n=r.n(a),l=r(9);const i=n.a.api.utils,o=n.a.api.pluginsSDK,s=".tau-chart__legend__reset",c=".tau-chart__legend__item-color",d=".tau-chart__legend__guide--color__overlay",h=4,_=13;let u=0;const g=()=>++u,m=n.a.api.utils.xml,p=(e,t)=>{const r=e[0],a=e[1],n=(a-r)/(t-1),l=i.range(t-2).map(e=>r+n*(e+1));return[r].concat(l).concat(a)},f=(e,t,r)=>{if(e.length<3)return e.slice(0);if(t<3)return[e[0],e[e.length-1]];const a=e[0]<0?Math.abs(e[0]):0,n=e=>e,l="sqrt"===r?e=>Math.sqrt(e+a):n,o="sqrt"===r?e=>e**2-a:n;let s=[(e=e.map(l))[0]];const c=e[e.length-1]-e[0],d=.5*c/(t-1),h=i.range(1,t-1).map(e=>{const r=c*e/(t-1);return{min:r-d,mid:r,max:r+d,diff:Number.MAX_VALUE,closest:null}});let _,u=0;const g=()=>{if(u===h.length)return;const e=_;(_=h[u++]).min=Math.max(_.min,(e&&null!==e.closest?e.closest:s[0])+d)};return g(),e.forEach(e=>{if(e<_.min)return;e>_.max&&g();const t=Math.abs(e-_.mid);t<_.diff&&t{null!==e.closest&&s.push(e.closest)}),s.push(e[e.length-1]),s=s.map(o)},b=e=>Math.log(e)/Math.LN10,y=e=>0===e?0:Math.floor(b(Math.abs(e))),v=(()=>{const e=/\.0+([^\d].*)?$/,t=/(\.\d+?)0+([^\d].*)?$/;return r=>r.replace(e,"$1").replace(t,"$1$2")})(),x=l.format(".3s"),S=e=>v(x(e)),T=(e,t)=>{const r=Math.max(Math.abs(e),Math.abs(t)),a=y(r),n=e*t>0?Math.abs(t-e):r,l=y(n),i=Math.abs(a-l);return Math.abs(a)>3&&i<=3?S:e=>{const t=y(r-e),a=Math.min((l<0?Math.abs(l):0)+(t{}}),a=e=>null===e||""===e||void 0===e,n=e=>e.every(e=>i.isDate(e)),l=(e,t)=>r=>{const n=r[e],l=JSON.stringify(a(n)?null:n);return t===l},u=(e,t,r,a)=>{e.addEventListener(t,e=>{let t=e.target;for(;t!==e.currentTarget&&null!==t;)t.matches(r)&&a(e,t),t=t.parentNode})};return{init(e){this.instanceId=g(),this._chart=e,this._currentFilters={},this._legendColorByScaleId={},this._legendOrderState={};const t=this._chart.getSpec(),a=e=>(r,a)=>{const n=t.scales[a];return n.type===e&&n.dim&&r.push(a),r};this._color=Object.keys(t.scales).reduce(a("color"),[]).filter(t=>e.getScaleInfo(t).discrete),this._fill=Object.keys(t.scales).reduce(a("color"),[]).filter(t=>!e.getScaleInfo(t).discrete),this._size=Object.keys(t.scales).reduce(a("size"),[]);const n=this._color.length>0,l=this._fill.length>0,i=this._size.length>0;if(this._assignStaticBrewersOrEx(),n||l||i){switch(r.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)}n&&(u(this._container,"click",s,(e,t)=>{this._toggleLegendItem(t,"reset")}),u(this._container,"click",c,(e,t)=>{const r=e.ctrlKey||e.target.matches(d)?"leave-others":"focus-single";this._toggleLegendItem(t,r)}),u(this._container,"mouseover",c,(e,t)=>{this._highlightToggle(t,!0)}),u(this._container,"mouseout",c,(e,t)=>{this._highlightToggle(t,!1)}))}},destroy(){const e=this._currentFilters,t=this._chart;Object.keys(e).forEach(r=>t.removeFilter(e[r])),this._container&&this._container.parentElement&&(this._clearPanel(),this._container.parentElement.removeChild(this._container))},onSpecReady(e,t){this._formatters=o.getFieldFormatters(t,r.formatters)},_getFormat(e){return this._formatters[e]?this._formatters[e].format:e=>String(e)},onRender(){if(t&&r.selectedCategories&&0!==r.selectedCategories.length){let e=this._getLegendColorByScales();return Object.keys(e).forEach(t=>{e[t].legendColorItems.forEach(({value:e,dim:t})=>{if(-1===r.selectedCategories.indexOf(JSON.parse(e))){const r=t+e,a=l(t,e);this._currentFilters[r]=this._chart.addFilter({tag:"legend",predicate:e=>!a(e)})}})}),t=!1,void this._chart.refresh()}this._clearPanel(),this._drawColorLegend(),this._drawFillLegend(),this._drawSizeLegend()},_containerTemplate:'
',_template:i.template(['
',"<%=top%>",'
<%=name%>
',"<%=items%>","
"].join("")),_itemTemplate:i.template(["
\">",'
','
','
',"
","
","
",' <%=label%>',"
"].join("")),_resetTemplate:i.template(['
','
Reset
',"
"].join("")),_clearPanel(){this._container&&(clearTimeout(this._scrollTimeout),this._getScrollContainer().removeEventListener("scroll",this._scrollListener),this._container.innerHTML="")},_drawFillLegend(){const e=this;e._fill.forEach(t=>{const r=e._chart.select(e=>e.config.color===t)[0];if(r){const t=r.config.guide||{},a=r.getScale("color"),l=a.domain().sort((e,t)=>e-t),s=n(l),c=s?l.map(Number):l,d=T(c[0],c[c.length-1]),h=(()=>{const t=e._chart.getSpec();let r=o.extractFieldsFormatInfo(t)[a.dim].format;return r||(r=(e=>new Date(e))),e=>String(r(e))})(),u=s?h:d,g=a.brewer.length,f=((t.color||{}).label||{}).text||a.dim,b=e=>e.length*_*.618,y=a.isInteger?(c[1]-c[0])%3==0?4:(c[1]-c[0])%2==0?3:2:3,v=p(c,y);let x=(s?v.map(e=>new Date(e)):v).map(u);x[0]===x[x.length-1]&&(x=[x[0]]),e._container.insertAdjacentHTML("beforeend",e._template({name:i.escape(f),top:null,items:'
'}));const S=e._container.lastElementChild.querySelector(".tau-chart__legend__gradient-wrapper"),w=S.getBoundingClientRect().width;let M=!1;x.reduce((e,t)=>e+b(t),0)>w&&(x.length>1&&b(x[0])+b(x[x.length-1])>w?M=!0:x=[x[0],x[x.length-1]]);const C=20,L=M?(()=>{const e=-.382*_/2;return{width:w,height:120,barX:0,barY:0,barWidth:C,barHeight:120,textAnchor:"start",textX:i.range(y).map(()=>25),textY:1===x.length?60+.618*_:x.map((t,r)=>{const a=(x.length-1-r)/(x.length-1);return _*(1-a)+120*a+e})}})():(()=>{const e=b(x[0])/2,t=b(x[x.length-1])/2;return{width:w,height:C+8+_,barX:0,barY:0,barWidth:w,barHeight:C,textAnchor:"middle",textX:1===x.length?[w/2]:x.map((r,a)=>{const n=a/(x.length-1);return e*(1-n)+(w-t)*n}),textY:i.range(y).map(()=>C+8+_)}})(),j=p(c,g).map((e,t)=>{return m("stop",{offset:`${t/(g-1)*100}%`,style:`stop-color:${a(e)};stop-opacity:1"`})}),F=`legend-gradient-${e.instanceId}`,A=m("svg",{class:"tau-chart__legend__gradient",width:L.width,height:L.height},m("defs",m("linearGradient",{id:F,x1:"0%",y1:M?"100%":"0%",x2:M?"0%":"100%",y2:"0%"},...j)),m("rect",{class:"tau-chart__legend__gradient__bar",x:L.barX,y:L.barY,width:L.barWidth,height:L.barHeight,fill:`url(#${F})`}),...x.map((e,t)=>m("text",{x:L.textX[t],y:L.textY[t],"text-anchor":L.textAnchor},e)));S.insertAdjacentHTML("beforeend",A)}})},_drawSizeLegend(){const e=this;e._size.forEach(t=>{const r=e._chart.select(e=>e.config.size===t)[0];if(r){const t=r.config.guide||{},a=r.getScale("size"),n=a.domain().sort((e,t)=>e-t);if(!Array.isArray(n)||!n.every(isFinite))return;const l=((t.size||{}).label||{}).text||a.dim,o=n[0],s=n[n.length-1];let c=[o];if(s-o){const t=b(s-o),r=10**Math.round(4-t),n=i.unique(e._chart.getDataSources({excludeFilter:["legend"]})[a.source].data.map(e=>e[a.dim]).filter(e=>e>=o&&e<=s)).sort((e,t)=>e-t),l=f(n,h,a.funcType);c=i.unique(l.map(e=>Math.round(e*r)/r))}const d=T(c[0],c[c.length-1]),u=e=>e.length*_*.618;c.reverse();const g=c.map(a),p=Math.max.apply(null,g),y=c.map(d);e._container.insertAdjacentHTML("beforeend",e._template({name:i.escape(l),top:null,items:'
'}));const v=e._container.lastElementChild.querySelector(".tau-chart__legend__size-wrapper"),x=v.getBoundingClientRect().width;let S=!1;(Math.max.apply(null,y.map(u))>x/4||1===y.length)&&(S=!0);const w=S?(()=>{const e=_,t=g[0]/2,r=g[g.length-1]/2,a=[t];for(let t,r,n=1;np/2),circleY:a,textAnchor:"start",textX:i.range(y.length).map(()=>p+8),textY:a.map(e=>e+n)}})():(()=>{const e=Math.max(u(y[0])/2,g[0]/2),t=Math.max(u(y[y.length-1])/2,g[g.length-1]/2),r=(x-g.reduce((e,t,r)=>e+(0===r||r===g.length-1?t/2:t),0)-e-t)/(h-1),a=[e];for(let e,t,n=1;np-e/2);return{width:x,height:p+8+_,circleX:a,circleY:n,textAnchor:"middle",textX:a,textY:i.range(y.length).map(()=>p+8+_)}})(),M=m("svg",{class:"tau-chart__legend__size",width:w.width,height:w.height},...g.map((e,t)=>m("circle",{class:`tau-chart__legend__size__item__circle ${r.config.color?"color-definite":"color-default-size"}`,cx:w.circleX[t],cy:w.circleY[t],r:e/2})),...y.map((e,t)=>m("text",{class:"tau-chart__legend__size__item__label",x:w.textX[t],y:w.textY[t],"text-anchor":w.textAnchor},e)));v.insertAdjacentHTML("beforeend",M)}})},_getLegendColorByScales(){const e=this;return e._color.reduce((t,r)=>{const l=e._chart.select(e=>e.config.color===r)[0];if(l){const o=l.config.guide||{},s=l.getScale("color"),c=e._chart.getDataSources({excludeFilter:["legend"]});let d=i.unique(c[s.source].data.map(e=>e[s.dim]));const h=e._chart.getSpec().scales[r],_=n(d);if(h.order)d=i.union(i.intersection(h.order,d),d);else if("order"===h.dimType&&_)d=d.sort((e,t)=>new Date(e)-new Date(t));else{const t=e._legendOrderState[r];d=d.sort((e,r)=>{const a=t[e]-t[r];return a&&a/Math.abs(a)})}const u=((o.color||{}).label||{}).text||s.dim,g=(o.color||{}).tickFormatNullAlias||`No ${u}`,m=e._getFormat(s.dim);let p=d.map(t=>{const n=JSON.stringify(a(t)?null:t),l=s.dim+n;return{scaleId:r,dim:s.dim,color:s(t),disabled:e._currentFilters.hasOwnProperty(l),label:m(t),value:n}});t[r]={legendColorItems:p,title:u,colorScale:s,noVal:g}}return t},{})},_drawColorLegend(){const e=this,t=this._getLegendColorByScales();Object.keys(t).forEach(r=>{const{legendColorItems:n,title:l,colorScale:o,noVal:s}=t[r];e._container.insertAdjacentHTML("beforeend",e._template({name:i.escape(l),top:e._resetTemplate({classDisabled:n.some(function(e){return e.disabled})?"":"disabled"}),items:n.map(function(t){return e._itemTemplate({scaleId:t.scaleId,dim:i.escape(t.dim),color:t.color,cssClass:o.toClass(t.color),cssColor:t.disabled?"transparent":o.toColor(t.color),borderColor:o.toColor(t.color),classDisabled:t.disabled?"disabled":"",label:i.escape(a(t.label)?s:t.label),value:i.escape(t.value)})}).join("")}))}),e._color.length>0&&(e._updateResetButtonPosition(),e._scrollTimeout=null,e._scrollListener=(()=>{const t=e._container.querySelector(s);t.style.display="none",e._scrollTimeout&&clearTimeout(e._scrollTimeout),e._scrollTimeout=setTimeout(()=>{e._updateResetButtonPosition(),t.style.display="",e._scrollTimeout=null},250)}),e._getScrollContainer().addEventListener("scroll",e._scrollListener))},_toggleLegendItem(e,t){const a=this._currentFilters,n=e?Array.prototype.filter.call(e.parentNode.childNodes,e=>e.matches(c)):null,i=e=>{const t=e.getAttribute("data-dim"),r=e.getAttribute("data-value");return{sid:e.getAttribute("data-scale-id"),dim:t,val:r,key:t+r}},o=e=>e in a,s=(e,t)=>{const r=i(e);if(o(r.key)===t)if(t){const t=a[r.key];delete a[r.key],e.classList.remove("disabled"),this._chart.removeFilter(t)}else{e.classList.add("disabled");const t=l(r.dim,r.val);a[r.key]=this._chart.addFilter({tag:"legend",predicate:e=>!t(e)})}},d=t=>t===e,h=!!e&&o(i(e).key),_=(e,t)=>{e.querySelector(".tau-chart__legend__guide").style.backgroundColor=t?"":"transparent"};if("reset"===t)n.forEach(e=>{s(e,!0),_(e,!0)});else if("leave-others"===t)n.forEach(e=>{d(e)&&s(e,h)}),_(e,h);else if("focus-single"===t){const t=!h&&n.every(e=>d(e)||o(i(e).key));n.forEach(e=>{const r=d(e)||t;s(e,r)}),h&&_(e,!0)}const u=n.filter(e=>!o(i(e).key)).map(e=>JSON.parse(i(e).val));r.onSelect({type:t,selectedCategories:u}),this._chart.refresh()},_highlightToggle(e,t){if(e.matches(".disabled"))return;const r=e.getAttribute("data-dim"),a=e.getAttribute("data-value"),n=t?l(r,a):e=>null;this._chart.select(e=>!0).forEach(e=>{e.fire("highlight",n)})},_getScrollContainer(){return this._container.parentNode.parentNode},_updateResetButtonPosition(){this._container.querySelector(s).style.top=`${this._getScrollContainer().scrollTop}px`},_generateColorMap(e,t){const r=t.length;return e.reduce((e,a,n)=>(e[a]=t[n%r],e),{})},_assignStaticBrewersOrEx(){const e=this;e._color.forEach(t=>{const r=e._chart.getSpec().scales[t],a=e._chart.getDataSources({excludeFilter:["legend"]}),n=e._chart.getScaleFactory(a).createScaleInfoByName(t).domain();if(!r.brewer||Array.isArray(r.brewer)){const t=r.brewer||i.range(20).map(e=>`color20-${1+e}`);r.brewer=e._generateColorMap(n,t)}e._legendOrderState[t]=n.reduce((e,t,r)=>(e[t]=r,e),{})})}}}n.a.api.plugins.add("legend",w),t.default=w},9:function(e,r){e.exports=t}})}); \ No newline at end of file diff --git a/dist/plugins/parallel-brushing.js b/dist/plugins/parallel-brushing.js index 0388655c4..6e8237f0e 100644 --- a/dist/plugins/parallel-brushing.js +++ b/dist/plugins/parallel-brushing.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],r);else{var t="object"==typeof exports?r(require("taucharts")):r(e.Taucharts);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(window,function(e){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,t),u.l=!0,u.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var u in e)t.d(n,u,function(r){return e[r]}.bind(null,u));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=30)}({0:function(r,t){r.exports=e},30:function(e,r,t){"use strict";t.r(r);var n=t(0),u=t.n(n),i=u.a.api.utils;function o(e){var r=i.defaults(e||{},{verbose:!1,forceBrush:{}}),t={init:function(e){r.verbose&&(this.panel=e.insertToRightSidebar(this.template())),e.traverseSpec(e.getSpec(),function(e){e&&"COORDS.PARALLEL"===e.type&&(e.guide=e.guide||{},e.guide.enableBrushing=!0)}),t.forceBrush=r.forceBrush||{}},onRender:function(e){var n=e.getSpec().scales,u=Object.keys(n).reduce(function(e,r){var u=n[r].dim;return t.forceBrush[u]&&(e[r]=t.forceBrush[u]),e},{}),i=e.select(function(e){return"PARALLEL/ELEMENT.LINE"===e.config.type});i.forEach(function(e,n){e.parentUnit.on("brush",function(u,i){t.forceBrush={};var o=i.map(function(e){var r=e.dim,n=e.func,u=e.args;t.forceBrush[r]=u;var i=function(){return!0};return"between"===n&&(i=function(e){return e[r]>=u[0]&&u[1]>=e[r]}),"inset"===n&&(i=function(e){return u.indexOf(e[r])>=0}),i}),a=0;if(e.fire("highlight",function(e){var r=o.every(function(r){return r(e)});return a+=r?1:0,r}),r.verbose){var c=t.panel.getElementsByClassName("i-"+n);if(0===c.length){var f=document.createElement("div");f.className="i-"+n,t.panel.appendChild(f),c[0]=f}c[0].innerHTML=i.reduce(function(e,r){return e+"
"+r.dim+": ["+r.args.join(",")+"]
"},"
Matched: "+a+"
")}})}),i.forEach(function(e){e.parentUnit.fire("force-brush",u)})},template:i.template('
')};return t}u.a.api.plugins.add("parallel-brushing",o),r.default=o}})}); \ No newline at end of file +!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],r);else{var t="object"==typeof exports?r(require("taucharts")):r(e.Taucharts);for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(window,function(e){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,t),u.l=!0,u.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var u in e)t.d(n,u,function(r){return e[r]}.bind(null,u));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=29)}({0:function(r,t){r.exports=e},29:function(e,r,t){"use strict";t.r(r);var n=t(0),u=t.n(n),i=u.a.api.utils;function o(e){var r=i.defaults(e||{},{verbose:!1,forceBrush:{}}),t={init:function(e){r.verbose&&(this.panel=e.insertToRightSidebar(this.template())),e.traverseSpec(e.getSpec(),function(e){e&&"COORDS.PARALLEL"===e.type&&(e.guide=e.guide||{},e.guide.enableBrushing=!0)}),t.forceBrush=r.forceBrush||{}},onRender:function(e){var n=e.getSpec().scales,u=Object.keys(n).reduce(function(e,r){var u=n[r].dim;return t.forceBrush[u]&&(e[r]=t.forceBrush[u]),e},{}),i=e.select(function(e){return"PARALLEL/ELEMENT.LINE"===e.config.type});i.forEach(function(e,n){e.parentUnit.on("brush",function(u,i){t.forceBrush={};var o=i.map(function(e){var r=e.dim,n=e.func,u=e.args;t.forceBrush[r]=u;var i=function(){return!0};return"between"===n&&(i=function(e){return e[r]>=u[0]&&u[1]>=e[r]}),"inset"===n&&(i=function(e){return u.indexOf(e[r])>=0}),i}),a=0;if(e.fire("highlight",function(e){var r=o.every(function(r){return r(e)});return a+=r?1:0,r}),r.verbose){var c=t.panel.getElementsByClassName("i-"+n);if(0===c.length){var f=document.createElement("div");f.className="i-"+n,t.panel.appendChild(f),c[0]=f}c[0].innerHTML=i.reduce(function(e,r){return e+"
"+r.dim+": ["+r.args.join(",")+"]
"},"
Matched: "+a+"
")}})}),i.forEach(function(e){e.parentUnit.fire("force-brush",u)})},template:i.template('
')};return t}u.a.api.plugins.add("parallel-brushing",o),r.default=o}})}); \ No newline at end of file diff --git a/dist/plugins/parallel-tooltip.js b/dist/plugins/parallel-tooltip.js index fc38563c0..30459720f 100644 --- a/dist/plugins/parallel-tooltip.js +++ b/dist/plugins/parallel-tooltip.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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"));else if("function"==typeof define&&define.amd)define(["taucharts"],e);else{var o="object"==typeof exports?e(require("taucharts")):e(t.Taucharts);for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(window,function(t){return function(t){var e={};function o(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,i){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(i,n,function(e){return t[e]}.bind(null,n));return i},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=31)}({0:function(e,o){e.exports=t},31:function(t,e,o){"use strict";o.r(e);var i=o(0),n=o.n(i),r=n.a.api.utils;function a(t){r.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")&&o._exclude(),e=e.parentNode;o._tooltip.hide()},!1);var e,o=this;this.showTooltip=function(t){clearTimeout(e),o._cursor=t.data;var i=o._tooltip.getElement().querySelectorAll(".i-role-content");i[0]&&(i[0].innerHTML=Object.keys(t.data).map(function(e){return o.itemTemplate({label:e,value:t.data[e]})}).join("")),o._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this.hideTooltip=function(t){e=setTimeout(function(){o._tooltip.hide()},1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){o._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,o){e.hideTooltip(o)}),t.on("mouseover",function(t,o){e.showTooltip(o)})})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:r.template(['
','
<%=label%>
','
<%=value%>
',"
"].join(""))}}n.a.api.plugins.add("parallel-tooltip",a),e.default=a}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],e);else{var o="object"==typeof exports?e(require("taucharts")):e(t.Taucharts);for(var i in o)("object"==typeof exports?exports:t)[i]=o[i]}}(window,function(t){return function(t){var e={};function o(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,i){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(i,n,function(e){return t[e]}.bind(null,n));return i},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=30)}({0:function(e,o){e.exports=t},30:function(t,e,o){"use strict";o.r(e);var i=o(0),n=o.n(i),r=n.a.api.utils;function a(t){r.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")&&o._exclude(),e=e.parentNode;o._tooltip.hide()},!1);var e,o=this;this.showTooltip=function(t){clearTimeout(e),o._cursor=t.data;var i=o._tooltip.getElement().querySelectorAll(".i-role-content");i[0]&&(i[0].innerHTML=Object.keys(t.data).map(function(e){return o.itemTemplate({label:e,value:t.data[e]})}).join("")),o._tooltip.show(t.event.pageX,t.event.pageY).updateSize()},this.hideTooltip=function(t){e=setTimeout(function(){o._tooltip.hide()},1e3)},this._tooltip.getElement().addEventListener("mouseover",function(t){clearTimeout(e)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(t){o._tooltip.hide()},!1)},_exclude:function(){var t;this._chart.addFilter({tag:"exclude",predicate:(t=this._cursor,function(e){return JSON.stringify(e)!==JSON.stringify(t)})}),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,o){e.hideTooltip(o)}),t.on("mouseover",function(t,o){e.showTooltip(o)})})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:r.template(['
','
<%=label%>
','
<%=value%>
',"
"].join(""))}}n.a.api.plugins.add("parallel-tooltip",a),e.default=a}})}); \ No newline at end of file diff --git a/dist/plugins/quick-filter.css b/dist/plugins/quick-filter.css index 984d4ec34..caec60ffc 100644 --- a/dist/plugins/quick-filter.css +++ b/dist/plugins/quick-filter.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 984d4ec34..caec60ffc 100644 --- a/dist/plugins/quick-filter.dark.css +++ b/dist/plugins/quick-filter.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 1e5624aa2..2d19c8dcf 100644 --- a/dist/plugins/quick-filter.js +++ b/dist/plugins/quick-filter.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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-selection"),require("d3-array"),require("d3-brush"),require("d3-scale"),require("d3-time-format"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection","d3-array","d3-brush","d3-scale","d3-time-format"],e);else{var r="object"==typeof exports?e(require("taucharts"),require("d3-selection"),require("d3-array"),require("d3-brush"),require("d3-scale"),require("d3-time-format")):e(t.Taucharts,t.d3,t.d3,t.d3,t.d3,t.d3);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,function(t,e,r,n,i,a){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=32)}({0:function(e,r){e.exports=t},1:function(t,r){t.exports=e},10:function(t,e){t.exports=n},11:function(t,e){t.exports=i},12:function(t,e){t.exports=a},32:function(t,e,r){"use strict";r.r(e);var n=r(0),i=r.n(n),a=r(4),s=r(10),o=r(11),l=r(1),u=r(12),c=function(){return(c=Object.assign||function(t){for(var e,r=1,n=arguments.length;r0?a:Object.keys(i.dims),this._fieldBounds=t.fieldBounds||{},this._applyImmediately=Boolean(t.applyImmediately);var s=r._chart.getChartModelData();this._filtersContainer=r._chart.insertToRightSidebar(r._filtersContainer),this._filtersContainer.style.maxHeight="0px",r._fields.filter(function(t){var e="measure"===i.dims[t].type;return e||n.settings.log("The ["+t+"] isn't measure so Quick Filter plugin skipped it"),e}).forEach(function(t){r._data[t]=s.map(function(e){return e[t]});var e=r._fieldBounds[t];r._bounds[t]=e?[e.min,e.max]:f.extent(r._data[t]),r._filter[t]=r._bounds[t],r._filtersContainer.insertAdjacentHTML("beforeend",r._filterWrapper({name:t})),r._container[t]=r._filtersContainer.lastChild,r._drawFilter(t)})},onRender:function(){this._filtersContainer.style.maxHeight="none"},_filtersContainer:'
',_filterWrapper:d.template('
<%=name%>
'),_drawFilter:function(t){var e=this._data[t],r=this._bounds[t],n=this._filter[t],i=d.isDate(r[0])||d.isDate(r[1]),a=this,s=0,o=24,u=21,c=12,h=180-c-o,p=41-s-u-8,m=f.scaleLinear().domain(r).range([0,h]),_=f.brushX().extent([[0,0],[h,20]]).on("start",function(){a._layout.style["overflow-y"]="hidden"}).on("brush",this._applyImmediately?F:q).on("end",function(){a._layout.style["overflow-y"]="",F()}),y=f.select(this._container[t]).append("svg").attr("width",h+c+o).attr("height",p+s+u+4).append("g").attr("transform","translate("+c+","+s+")"),v=(y.append("g").selectAll("rect").data(e).enter().append("rect").attr("transform",function(t){return"translate("+m(t)+","+(s+4)+")"}).attr("height",p).attr("width",1),y.append("g").attr("class","brush").call(_));v.append("g").attr("class","resize e").attr("cursor","ew-resize").attr("pointer-events","none"),v.append("g").attr("class","resize w").attr("cursor","ew-resize").attr("pointer-events","none"),v.selectAll(".resize").append("line").attr("transform","translate(0, 0)").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",p+8),v.selectAll(".resize").append("text").attr("x",0).attr("y",2*(p+4)),v.selectAll("rect").attr("height",p+8);var g=y.append("text").attr("x",h/2).attr("y",2*(p+4)).attr("class","date-label"),b=function(t){return Math.log(t)/Math.LN10}(a._filter[t][1]-a._filter[t][0]),x=Math.round(3-b),w=Math.pow(10,x);if(i){var j=function(t){var e=t.findIndex(function(t){var e=f.timeFormat(t);return e(new Date(r[0]))!==e(new Date(r[1]))});return e=e<0?t.length:e,{comm:t.slice(0,e),diff:t.slice(e)}}(["’%y"," %b","%d","%H",":%M",":%S"]);j.comm.length<3?(j.diff.splice(-3),j.diff.reverse(),j.comm.reverse()):(j.comm.length<5&&j.diff.pop(),j.diff=j.comm.splice(3,j.comm.length-3).concat(j.diff),j.comm.reverse())}function q(){var e=l.event;if(e&&Array.isArray(e.selection)){var r=e.selection.map(m.invert);n=r,a._filter[t]=r}else n=a._filter[t];var s=i?new Date(n[0]).getTime():n[0],o=i?new Date(n[1]).getTime():n[1],u=Math.round(parseFloat(s)*w)/w,c=Math.round(parseFloat(o)*w)/w;v.select(".handle--w"),v.select(".handle--e");v.select(".resize.w").attr("transform","translate("+m(n[0])+",0)"),v.select(".resize.e").attr("transform","translate("+m(n[1])+",0)");var d=v.selectAll(".w text"),h=v.selectAll(".e text");if(i){var p=f.timeFormat(j.comm.join("")),_=f.timeFormat(j.diff.join(""));g.html(_(new Date(u))+" .. "+_(new Date(c))+' '+p(new Date(c))+"")}else d.text(u),h.text(c)}function F(){q(),a._applyFilter(t)}F(),_.move(v,n.map(m))},destroy:function(){var t=this._currentFilters,e=this._chart;Object.keys(t).forEach(function(r){return e.removeFilter(t[r])});!function(t){t&&t.parentElement&&t.parentElement.removeChild(t)}(this._filtersContainer)},_applyFilter:function(t){var e=this._currentFilters,r=function(t,e,r){return function(n){var i=n[t];return ir}}(t,this._filter[t][0],this._filter[t][1]),n=e[t];delete e[t],this._chart.removeFilter(n),e[t]=this._chart.addFilter({tag:"quick-filter",predicate:function(t){return!r(t)}}),h<0?this._chart.refresh():(this._refreshRequestId&&clearTimeout(this._refreshRequestId),this._refreshRequestId=setTimeout(function(){this._refreshRequestId=null,this._chart.refresh()}.bind(this),h))}}}i.a.api.plugins.add("quick-filter",p),e.default=p},4:function(t,e){t.exports=r}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"),require("d3-selection"),require("d3-array"),require("d3-brush"),require("d3-scale"),require("d3-time-format"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection","d3-array","d3-brush","d3-scale","d3-time-format"],e);else{var r="object"==typeof exports?e(require("taucharts"),require("d3-selection"),require("d3-array"),require("d3-brush"),require("d3-scale"),require("d3-time-format")):e(t.Taucharts,t.d3,t.d3,t.d3,t.d3,t.d3);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,function(t,e,r,n,i,a){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=31)}({0:function(e,r){e.exports=t},1:function(t,r){t.exports=e},10:function(t,e){t.exports=n},11:function(t,e){t.exports=i},12:function(t,e){t.exports=a},31:function(t,e,r){"use strict";r.r(e);var n=r(0),i=r.n(n),a=r(4),s=r(10),o=r(11),l=r(1),c=r(12);const u={...a,...s,...o,...l,...c};var f=i.a.api.utils,d=0;function h(t={}){return{init:function(e){this._chart=e,this._currentFilters={},this._data={},this._bounds={},this._filter={},this._container={},this._layout=this._chart.getLayout().layout;var r=this,n=this._chart.getSpec(),i=n.sources["/"],a=t.fields||t;this._fields=Array.isArray(a)&&a.length>0?a:Object.keys(i.dims),this._fieldBounds=t.fieldBounds||{},this._applyImmediately=Boolean(t.applyImmediately);var s=r._chart.getChartModelData();this._filtersContainer=r._chart.insertToRightSidebar(r._filtersContainer),this._filtersContainer.style.maxHeight="0px",r._fields.filter(function(t){var e="measure"===i.dims[t].type;return e||n.settings.log("The ["+t+"] isn't measure so Quick Filter plugin skipped it"),e}).forEach(function(t){r._data[t]=s.map(function(e){return e[t]});const e=r._fieldBounds[t];r._bounds[t]=e?[e.min,e.max]:u.extent(r._data[t]),r._filter[t]=r._bounds[t],r._filtersContainer.insertAdjacentHTML("beforeend",r._filterWrapper({name:t})),r._container[t]=r._filtersContainer.lastChild,r._drawFilter(t)})},onRender:function(){this._filtersContainer.style.maxHeight="none"},_filtersContainer:'
',_filterWrapper:f.template('
<%=name%>
'),_drawFilter:function(t){var e=this._data[t],r=this._bounds[t],n=this._filter[t],i=f.isDate(r[0])||f.isDate(r[1]),a=this,s=0,o=24,c=21,d=12,h=180-d-o,p=41-s-c-8,m=u.scaleLinear().domain(r).range([0,h]),_=u.brushX().extent([[0,0],[h,20]]).on("start",function(){a._layout.style["overflow-y"]="hidden"}).on("brush",this._applyImmediately?F:j).on("end",function(){a._layout.style["overflow-y"]="",F()}),y=u.select(this._container[t]).append("svg").attr("width",h+d+o).attr("height",p+s+c+4).append("g").attr("transform","translate("+d+","+s+")"),v=(y.append("g").selectAll("rect").data(e).enter().append("rect").attr("transform",function(t){return"translate("+m(t)+","+(s+4)+")"}).attr("height",p).attr("width",1),y.append("g").attr("class","brush").call(_));v.append("g").attr("class","resize e").attr("cursor","ew-resize").attr("pointer-events","none"),v.append("g").attr("class","resize w").attr("cursor","ew-resize").attr("pointer-events","none"),v.selectAll(".resize").append("line").attr("transform","translate(0, 0)").attr("x1",0).attr("x2",0).attr("y1",0).attr("y2",p+8),v.selectAll(".resize").append("text").attr("x",0).attr("y",2*(p+4)),v.selectAll("rect").attr("height",p+8);var g=y.append("text").attr("x",h/2).attr("y",2*(p+4)).attr("class","date-label"),b=function(t){return Math.log(t)/Math.LN10}(a._filter[t][1]-a._filter[t][0]),x=Math.round(3-b),w=Math.pow(10,x);if(i){var q=function(t){var e=t.findIndex(function(t){var e=u.timeFormat(t);return e(new Date(r[0]))!==e(new Date(r[1]))});return e=e<0?t.length:e,{comm:t.slice(0,e),diff:t.slice(e)}}(["’%y"," %b","%d","%H",":%M",":%S"]);q.comm.length<3?(q.diff.splice(-3),q.diff.reverse(),q.comm.reverse()):(q.comm.length<5&&q.diff.pop(),q.diff=q.comm.splice(3,q.comm.length-3).concat(q.diff),q.comm.reverse())}function j(){const e=l.event;if(e&&Array.isArray(e.selection)){const r=e.selection.map(m.invert);n=r,a._filter[t]=r}else n=a._filter[t];var r=i?new Date(n[0]).getTime():n[0],s=i?new Date(n[1]).getTime():n[1],o=Math.round(parseFloat(r)*w)/w,c=Math.round(parseFloat(s)*w)/w;v.select(".handle--w"),v.select(".handle--e");v.select(".resize.w").attr("transform",`translate(${m(n[0])},0)`),v.select(".resize.e").attr("transform",`translate(${m(n[1])},0)`);var f=v.selectAll(".w text"),d=v.selectAll(".e text");if(i){var h=u.timeFormat(q.comm.join("")),p=u.timeFormat(q.diff.join(""));g.html(p(new Date(o))+" .. "+p(new Date(c))+' '+h(new Date(c))+"")}else f.text(o),d.text(c)}function F(){j(),a._applyFilter(t)}F(),_.move(v,n.map(m))},destroy(){const t=this._currentFilters,e=this._chart;Object.keys(t).forEach(r=>e.removeFilter(t[r]));(t=>t&&t.parentElement&&t.parentElement.removeChild(t))(this._filtersContainer)},_applyFilter:function(t){var e=this._currentFilters,r=function(t,e,r){return function(n){var i=n[t];return ir}}(t,this._filter[t][0],this._filter[t][1]),n=e[t];delete e[t],this._chart.removeFilter(n),e[t]=this._chart.addFilter({tag:"quick-filter",predicate:function(t){return!r(t)}}),d<0?this._chart.refresh():(this._refreshRequestId&&clearTimeout(this._refreshRequestId),this._refreshRequestId=setTimeout(function(){this._refreshRequestId=null,this._chart.refresh()}.bind(this),d))}}}i.a.api.plugins.add("quick-filter",h),e.default=h},4:function(t,e){t.exports=r}})}); \ No newline at end of file diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index 89a6bae24..fe9df48cf 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],t);else{var n="object"==typeof exports?t(require("taucharts")):t(e.Taucharts);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}({0:function(t,n){t.exports=e},33:function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=o.a.api.utils;function s(e){var t=i.defaults(e||{},{show:!0,modes:["normal","entire-view","fit-width","fit-height","minimal"]});return{init:function(e){t.show&&(t.selectedMode=e.getSpec().settings.fitModel,e.insertToHeader(this.template({modes:t.modes.map(function(e){return""})})).addEventListener("change",function(n){var r=n.target;r.classList.contains("i-role-fit-model")&&(t.selectedMode=r.value,e.getSpec().settings.fitModel=t.selectedMode,e.refresh())},!1))},template:i.template(['
',"
"," View Mode: ",' ","
","
"].join(""))}}o.a.api.plugins.add("settings",s),t.default=s}})}); \ No newline at end of file +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"));else if("function"==typeof define&&define.amd)define(["taucharts"],t);else{var n="object"==typeof exports?t(require("taucharts")):t(e.Taucharts);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=32)}({0:function(t,n){t.exports=e},32:function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=o.a.api.utils;function s(e){var t=i.defaults(e||{},{show:!0,modes:["normal","entire-view","fit-width","fit-height","minimal"]});return{init:function(e){t.show&&(t.selectedMode=e.getSpec().settings.fitModel,e.insertToHeader(this.template({modes:t.modes.map(function(e){return""})})).addEventListener("change",function(n){var r=n.target;r.classList.contains("i-role-fit-model")&&(t.selectedMode=r.value,e.getSpec().settings.fitModel=t.selectedMode,e.refresh())},!1))},template:i.template(['
',"
"," View Mode: ",' ","
","
"].join(""))}}o.a.api.plugins.add("settings",s),t.default=s}})}); \ No newline at end of file diff --git a/dist/plugins/tooltip.css b/dist/plugins/tooltip.css index e6bd6c37b..e7aa17ced 100644 --- a/dist/plugins/tooltip.css +++ b/dist/plugins/tooltip.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 78f3604dc..785e66137 100644 --- a/dist/plugins/tooltip.dark.css +++ b/dist/plugins/tooltip.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/tooltip.js b/dist/plugins/tooltip.js index 35dc926d1..916445653 100644 --- a/dist/plugins/tooltip.js +++ b/dist/plugins/tooltip.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var i="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(window,function(t,e){return function(t){var e={};function i(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,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=34)}({0:function(e,i){e.exports=t},1:function(t,i){t.exports=e},2:function(t,e,i){"use strict";i.d(e,"a",function(){return n}),i.d(e,"b",function(){return r});var n="tau-chart__tooltip";function r(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,i=t.data;return t.fields.map(function(t){return e.itemTemplate({data:i,field:t})}).join("\n")},itemTemplate:function(t){var e=t.data,i=t.field,r=this.getLabel(i),o=this.getFormatter(i)(e[i]);return['
','
'+r+"
",'
'+o+"
","
"].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,i=t.text,r=t.cls;return['
','
'," "+(e?e()+" ":"")+i,"
","
"].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})})}}}},3:function(t,e,i){"use strict";var n=i(0),r=i.n(n),o=i(1),s=i(2),l=r.a.api.utils,a=r.a.api.domUtils,c=r.a.api.pluginsSDK,u="tau-chart__tooltip",h=function(){function t(t){this.settings=l.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=Object(s.b)(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 i=Array.from(document.querySelectorAll("."+t.settings.clsClickable)).concat(t.getDomNode()).map(function(t){return t.getBoundingClientRect()}),n=Math.min.apply(Math,i.map(function(t){return t.top})),r=Math.min.apply(Math,i.map(function(t){return t.left})),o=Math.max.apply(Math,i.map(function(t){return t.right})),s=Math.max.apply(Math,i.map(function(t){return t.bottom}));(e.clientXo||e.clientYs)&&t.setState({highlight:null,isStuck:!1})})},t.prototype.getDomNode=function(){return this._tooltip.getElement()},t.prototype.setState=function(t){var e=this,i=this.settings,n=this.state,r=this.state=Object.assign({},n,t);n.highlight=n.highlight||{data:null,cursor:null,unit:null},r.highlight=r.highlight||{data:null,cursor:null,unit:null},r.isStuck&&n.highlight.data&&(r.highlight=n.highlight),r.highlight.data!==n.highlight.data&&(r.highlight.data?(this._hideTooltip(),this._showTooltip(r.highlight.data,r.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(function(){e._setTargetSvgClass(!0)})):r.isStuck||!n.highlight.data||r.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!r.highlight.data||n.highlight.cursor&&r.highlight.cursor.x===n.highlight.cursor.x&&r.highlight.cursor.y===n.highlight.cursor.y||(this._tooltip.position(r.highlight.cursor.x,r.highlight.cursor.y),this._tooltip.updateSize());var o=this.getDomNode();this.settings.clickable&&r.isStuck!==n.isStuck&&(r.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),o.classList.add(i.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(r.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),o.classList.remove(i.clsStuck),requestAnimationFrame(function(){e._setTargetEventsEnabled(!0);var t=e._chart.getSVG();t&&a.dispatchMouseEvent(t,"mouseleave")})))},t.prototype._showTooltip=function(t,e){var i=this.settings,n=i.fields||"function"==typeof i.getFields&&i.getFields(this._chart)||Object.keys(t),r=this._renderTemplate(t,n);this._tooltip.content(r).position(e.x,e.y).place(i.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,i){var n=document.body.getBoundingClientRect();t.setState({highlight:i.data?{data:i.data,cursor:{x:i.event.clientX-n.left,y:i.event.clientY-n.top},unit:i.unit}:null})}),t.settings.clickable&&e.on("data-click",function(e,i){var n=document.body.getBoundingClientRect();t.setState(i.data?{highlight:{data:i.data,cursor:{x:i.event.clientX-n.left,y:i.event.clientY-n.top},unit:i.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 l.escapeHtml(e(t))}:e},t.prototype.getFieldLabel=function(t){var e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?l.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=c.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}},t.prototype._setTargetSvgClass=function(t){o.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)},t.prototype._setTargetEventsEnabled=function(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()},t}();e.a=h},34:function(t,e,i){"use strict";i.r(e);var n=i(0),r=i.n(n),o=i(3);function s(t){return new o.a(t)}r.a.api.plugins.add("tooltip",s),e.default=s}})}); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("taucharts"),require("d3-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],e);else{var i="object"==typeof exports?e(require("taucharts"),require("d3-selection")):e(t.Taucharts,t.d3);for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(window,function(t,e){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=33)}({0:function(e,i){e.exports=t},1:function(t,i){t.exports=e},2:function(t,e,i){"use strict";i.d(e,"a",function(){return s}),i.d(e,"b",function(){return n});const s="tau-chart__tooltip";function n(t,e){return{render(t){return this.args=t,t=Object.assign({},t,{fields:this.filterFields(t.fields)}),this.rootTemplate(t)},rootTemplate(t){return[`
`,this.buttonsTemplate(),"
",`
`,this.contentTemplate(t),"
"].join("\n")},contentTemplate(t){return this.fieldsTemplate(t)},filterFields:t=>t,getLabel:e=>t.getFieldLabel(e),getFormatter:e=>t.getFieldFormat(e),fieldsTemplate({data:t,fields:e}){return e.map(e=>this.itemTemplate({data:t,field:e})).join("\n")},itemTemplate({data:t,field:e}){const i=this.getLabel(e),n=this.getFormatter(e)(t[e]);return[`
`,`
${i}
`,`
${n}
`,"
"].join("\n")},buttonsTemplate(){return[this.buttonTemplate({cls:"i-role-exclude",text:"Exclude",icon:()=>''})].join("\n")},buttonTemplate:({icon:t,text:e,cls:i})=>[`
`,`
`,` ${t?`${t()} `:""}${e}`,"
","
"].join("\n"),didMount(){const e=t.getDomNode().querySelector(".i-role-exclude");e&&e.addEventListener("click",()=>{t.excludeHighlightedElement(),t.setState({highlight:null,isStuck:!1})})}}}},3:function(t,e,i){"use strict";i.d(e,"a",function(){return u});var s=i(0),n=i.n(s),l=i(1),a=i(2);const o=n.a.api.utils,r=n.a.api.domUtils,h=n.a.api.pluginsSDK,c="tau-chart__tooltip";class u{constructor(t){this.settings=o.defaults(t||{},{align:"bottom-right",clickable:!0,clsClickable:`${c}__clickable`,clsStuck:"stuck",clsTarget:`${c}-target`,escapeHtml:!0,fields:null,formatters:{},getTemplate:null,spacing:24,winBound:12,onExclude:()=>{}}),this.onRender=this._getRenderHandler()}init(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()}_getTemplate(){const t=Object(a.b)(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(t,this,this.settings):t}_renderTemplate(t,e){return this._template.render({data:t,fields:e})}_initDomEvents(){this._scrollHandler=(()=>{this.setState({highlight:null,isStuck:!1})}),window.addEventListener("scroll",this._scrollHandler,!0),this.settings.clickable&&(this._outerClickHandler=(t=>{const e=Array.from(document.querySelectorAll(`.${this.settings.clsClickable}`)).concat(this.getDomNode()).map(t=>t.getBoundingClientRect()),i=Math.min(...e.map(t=>t.top)),s=Math.min(...e.map(t=>t.left)),n=Math.max(...e.map(t=>t.right)),l=Math.max(...e.map(t=>t.bottom));(t.clientXn||t.clientYl)&&this.setState({highlight:null,isStuck:!1})}))}getDomNode(){return this._tooltip.getElement()}setState(t){const e=this.settings,i=this.state,s=this.state=Object.assign({},i,t);i.highlight=i.highlight||{data:null,cursor:null,unit:null},s.highlight=s.highlight||{data:null,cursor:null,unit:null},s.isStuck&&i.highlight.data&&(s.highlight=i.highlight),s.highlight.data!==i.highlight.data&&(s.highlight.data?(this._hideTooltip(),this._showTooltip(s.highlight.data,s.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(()=>{this._setTargetSvgClass(!0)})):s.isStuck||!i.highlight.data||s.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!s.highlight.data||i.highlight.cursor&&s.highlight.cursor.x===i.highlight.cursor.x&&s.highlight.cursor.y===i.highlight.cursor.y||(this._tooltip.position(s.highlight.cursor.x,s.highlight.cursor.y),this._tooltip.updateSize());const n=this.getDomNode();this.settings.clickable&&s.isStuck!==i.isStuck&&(s.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),n.classList.add(e.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(s.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),n.classList.remove(e.clsStuck),requestAnimationFrame(()=>{this._setTargetEventsEnabled(!0);const t=this._chart.getSVG();t&&r.dispatchMouseEvent(t,"mouseleave")})))}_showTooltip(t,e){const i=this.settings,s=i.fields||"function"==typeof i.getFields&&i.getFields(this._chart)||Object.keys(t),n=this._renderTemplate(t,s);this._tooltip.content(n).position(e.x,e.y).place(i.align).show().updateSize(),this._template.didMount&&this._template.didMount()}_hideTooltip(){window.removeEventListener("click",this._outerClickHandler,!0),this._template.willUnmount&&this._template.willUnmount(),this._tooltip.hide()}destroy(){window.removeEventListener("scroll",this._scrollHandler,!0),this._setTargetSvgClass(!1),this.setState({highlight:null,isStuck:!1}),this._tooltip.destroy()}_subscribeToHover(){var t=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(e=>t.indexOf(e.config.type)>=0).forEach(t=>{t.on("data-hover",(t,e)=>{var i=document.body.getBoundingClientRect();this.setState({highlight:e.data?{data:e.data,cursor:{x:e.event.clientX-i.left,y:e.event.clientY-i.top},unit:e.unit}:null})}),this.settings.clickable&&t.on("data-click",(t,e)=>{const i=document.body.getBoundingClientRect();this.setState(e.data?{highlight:{data:e.data,cursor:{x:e.event.clientX-i.left,y:e.event.clientY-i.top},unit:e.unit},isStuck:!0}:{highlight:null,isStuck:null})})})}getFieldFormat(t){const e=this._formatters[t]?this._formatters[t].format:t=>String(t);return this.settings.escapeHtml?t=>o.escapeHtml(e(t)):e}getFieldLabel(t){const e=this._formatters[t]?this._formatters[t].label:t;return this.settings.escapeHtml?o.escapeHtml(e):e}_accentFocus(t){const e=e=>e===t;this._chart.select(()=>!0).forEach(t=>{t.fire("highlight",e)})}_removeFocus(){const t=()=>null;this._chart.select(()=>!0).forEach(e=>{e.fire("highlight",t),e.fire("highlight-data-points",t)})}excludeHighlightedElement(){const t=this.state.highlight.data;this._chart.addFilter({tag:"exclude",predicate:e=>e!==t}),this.settings.onExclude(t),this._chart.refresh()}_getRenderHandler(){return function(){this._formatters=h.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}}_setTargetSvgClass(t){l.select(this._chart.getSVG()).classed(this.settings.clsTarget,t)}_setTargetEventsEnabled(t){t?this._chart.enablePointerEvents():this._chart.disablePointerEvents()}}},33:function(t,e,i){"use strict";i.r(e);var s=i(0),n=i.n(s),l=i(3);function a(t){return new l.a(t)}n.a.api.plugins.add("tooltip",a),e.default=a}})}); \ No newline at end of file diff --git a/dist/plugins/trendline.css b/dist/plugins/trendline.css index be3bc8947..00cbb7c22 100644 --- a/dist/plugins/trendline.css +++ b/dist/plugins/trendline.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 41da2571d..6caebfee1 100644 --- a/dist/plugins/trendline.dark.css +++ b/dist/plugins/trendline.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/plugins/trendline.js b/dist/plugins/trendline.js index 8008f5877..8888b3d0d 100644 --- a/dist/plugins/trendline.js +++ b/dist/plugins/trendline.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / * */ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"),require("d3-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],t);else{var n="object"==typeof exports?t(require("taucharts"),require("d3-selection")):t(e.Taucharts,e.d3);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=35)}({0:function(t,n){t.exports=e},1:function(e,n){e.exports=t},35:function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r),i=n(1),o=function(){var e={linear:function(e){for(var t=[0,0,0,0,0],n=0,r=[];nMath.abs(e[n][i])&&(i=r);for(a=n;a=n;a--)e[a][r]-=e[a][n]*e[n][r]/e[n][n]}for(r=s-1;r>=0;r--){for(o=0,a=r+1;a=0;s--)v+=s>1?Math.round(100*f[s])/100+"x^"+s+" + ":1==s?Math.round(100*f[s])/100+"x + ":Math.round(100*f[s])/100;return{equation:f,points:a,string:v}},lastvalue:function(e){for(var t=[],n=null,r=0;r0&&oe[o]-e[s]?i:o;for(var c=Math.abs(1/(e[l]-u)),h=0,p=0,f=0,d=0,g=0,v=i;v<=o;){var _=e[v],m=t[v],y=r((v1&&(i||u)&&(p=[p[0],p[p.length-1]]),e.concat(p.length>1?p:[])},[])},e.traverseSpec(n,function(e,a){if(r.predicateIsApplicable(n,e,a)){var i=n.scales[e.x],o=n.scales[e.y],l=n.scales[e.color]||{},u=JSON.parse(JSON.stringify(e));u.type="ELEMENT.LINE",u.size="size_null",u.namespace="trendline",u.transformation=u.transformation||[],u.transformation.push({type:"regression",args:{type:t.type,x:i,y:o,g:l}});u.guide=s.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,a.units.push(u)}})}},containerTemplate:'
',template:s.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(e){if(this._container){this._container.innerHTML=this.template({title:"Trend line",error:this._error,showTrend:t.showTrend&&this._isApplicable?"checked":"",models:t.models.map(function(e){return""})});var n=function(e){return function(){i.select(this).classed({active:e,"tau-chart__line-width-1":!e,"tau-chart__line-width-3":e})}};i.select(e.getSVG()).selectAll(".tau-chart__trendline").on("mouseenter",n(!0)).on("mouseleave",n(!1))}}}}a.a.api.plugins.add("trendline",l),t.default=l}})}); \ No newline at end of file +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("taucharts"),require("d3-selection"));else if("function"==typeof define&&define.amd)define(["taucharts","d3-selection"],t);else{var n="object"==typeof exports?t(require("taucharts"),require("d3-selection")):t(e.Taucharts,e.d3);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=34)}({0:function(t,n){t.exports=e},1:function(e,n){e.exports=t},34:function(e,t,n){"use strict";n.r(t);var r,a=n(0),i=n.n(a),o=n(1),s=(r={linear:function(e){for(var t=[0,0,0,0,0],n=0,r=[];nMath.abs(e[n][i])&&(i=r);for(a=n;a=n;a--)e[a][r]-=e[a][n]*e[n][r]/e[n][n]}for(r=s-1;r>=0;r--){for(o=0,a=r+1;a=0;s--)v+=s>1?Math.round(100*f[s])/100+"x^"+s+" + ":1==s?Math.round(100*f[s])/100+"x + ":Math.round(100*f[s])/100;return{equation:f,points:a,string:v}},lastvalue:function(e){for(var t=[],n=null,r=0;r0&&oe[o]-e[s]?i:o;for(var c=Math.abs(1/(e[l]-u)),h=0,p=0,f=0,d=0,g=0,v=i;v<=o;){var _=e[v],m=t[v],y=r((v1&&(i||u)&&(p=[p[0],p[p.length-1]]),e.concat(p.length>1?p:[])},[])},e.traverseSpec(n,function(e,a){if(r.predicateIsApplicable(n,e,a)){var i=n.scales[e.x],o=n.scales[e.y],s=n.scales[e.color]||{},u=JSON.parse(JSON.stringify(e));u.type="ELEMENT.LINE",u.size="size_null",u.namespace="trendline",u.transformation=u.transformation||[],u.transformation.push({type:"regression",args:{type:t.type,x:i,y:o,g:s}});u.guide=l.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,a.units.push(u)}})}},containerTemplate:'
',template:l.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(e){if(this._container){this._container.innerHTML=this.template({title:"Trend line",error:this._error,showTrend:t.showTrend&&this._isApplicable?"checked":"",models:t.models.map(function(e){return""})});var n=function(e){return function(){o.select(this).classed({active:e,"tau-chart__line-width-1":!e,"tau-chart__line-width-3":e})}};o.select(e.getSVG()).selectAll(".tau-chart__trendline").on("mouseenter",n(!0)).on("mouseleave",n(!1))}}}}i.a.api.plugins.add("trendline",u),t.default=u}})}); \ No newline at end of file diff --git a/dist/taucharts.css b/dist/taucharts.css index c13d70aa1..3f46d02f9 100644 --- a/dist/taucharts.css +++ b/dist/taucharts.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/taucharts.dark.css b/dist/taucharts.dark.css index 6115e66a0..9cb00fea1 100644 --- a/dist/taucharts.dark.css +++ b/dist/taucharts.dark.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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 b9d4c1c38..904e73ce9 100644 --- a/dist/taucharts.dark.min.css +++ b/dist/taucharts.dark.min.css @@ -1,6 +1,6 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-08) * Copyright 2019 Targetprocess, Inc. * Licensed under Apache License 2.0 * * / diff --git a/dist/taucharts.js b/dist/taucharts.js index 1d70ad840..c8c5e0863 100644 --- a/dist/taucharts.js +++ b/dist/taucharts.js @@ -1,9 +1,9 @@ /*! * /* - * taucharts@2.6.5 (2019-02-08) + * taucharts@2.7.0 (2019-03-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.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;se.fn.apply(e.context,e.args))},u[e]=t),t}class h{constructor(){this.handler=null,this.emit_destroy=d("destroy")}addHandler(e,t){t=t||this,this.handler={callbacks:e,context:t,handler:this.handler}}on(e,t,i){var r={};return r[e]=t,this.addHandler(r,i),r}fire(e,t){d.call(this,e).call(this,t)}removeHandler(e,t){var i,r=this;for(t=t||this;i=r,r=r.handler;)if(r.callbacks===e&&r.context===t)return r.callbacks=c,void(i.handler=r.handler)}destroy(){this.emit_destroy(),this.handler=null}}class g extends h{constructor(e){super(),this.screenModel=null,this._elementNameSpace=e.namespace||"default",this._elementScalesHub={}}regScale(e,t){return this._elementScalesHub[e]=t,this}getScale(e){return this._elementScalesHub[e]||null}fireNameSpaceEvent(e,t){var i=this._elementNameSpace;this.fire(`${e}.${i}`,t)}subscribe(e,t=(e=>e),i=(e=>e)){var r=this,n={};[{event:"mouseover",limit:0},{event:"mouseout",limit:0},{event:"click",limit:0},{event:"mousemove",limit:"requestAnimationFrame"}].forEach(a=>{var o=a.event,l=a.limit;e.on(o,qe(n,o,function(e){var n={data:t.call(this,e),event:i.call(this,s.event,e)};r.fire(o,n),r.fireNameSpaceEvent(o,n)},l))})}allocateRect(){return{left:0,top:0,width:0,height:0}}defineGrammarModel(e){return{}}getGrammarRules(){return[]}getAdjustScalesRules(){return[]}createScreenModel(e){return null}getClosestElement(e,t){return null}addInteraction(){}draw(){this.config.options.container=this.config.options.slot(this.config.uid),this.drawFrames(this.config.frames)}data(){return this.config.frames.reduce((e,t)=>e.concat(t.part()),[])}node(){return this}}const p=e=>({day:{cast:function(t){var i=new Date(t);return new Date(i[e.setHours](0,0,0,0))},next:function(t){var i=new Date(t),r=new Date(i[e.setDate](i[e.getDate]()+1));return this.cast(r)}},week:{cast:function(t){var i=new Date(t);return i=new Date(i[e.setHours](0,0,0,0)),new Date(i[e.setDate](i[e.getDate]()-i[e.getDay]()))},next:function(t){var i=new Date(t),r=new Date(i[e.setDate](i[e.getDate]()+7));return this.cast(r)}},month:{cast:function(t){var i=new Date(t);return i=new Date(i[e.setHours](0,0,0,0)),i=new Date(i[e.setDate](1))},next:function(t){var i=new Date(t),r=new Date(i[e.setMonth](i[e.getMonth]()+1));return this.cast(r)}},quarter:{cast:function(t){var i=new Date(t);i=new Date(i[e.setHours](0,0,0,0));var r=(i=new Date(i[e.setDate](1)))[e.getMonth](),n=r-r%3;return new Date(i[e.setMonth](n))},next:function(t){var i=new Date(t),r=new Date(i[e.setMonth](i[e.getMonth]()+3));return this.cast(r)}},year:{cast(t){var i=new Date(t);return i=new Date(i[e.setHours](0,0,0,0)),i=new Date(i[e.setDate](1)),i=new Date(i[e.setMonth](0))},next:function(t){var i=new Date(t),r=new Date(i[e.setFullYear](i[e.getFullYear]()+1));return this.cast(r)}}}),f=p({setHours:"setHours",setDate:"setDate",getDate:"getDate",setMonth:"setMonth",getDay:"getDay",getMonth:"getMonth",setFullYear:"setFullYear",getFullYear:"getFullYear"});var m=p({setHours:"setUTCHours",setDate:"setUTCDate",getDate:"getUTCDate",setMonth:"setUTCMonth",getDay:"getUTCDay",getMonth:"getUTCMonth",setFullYear:"setUTCFullYear",getFullYear:"getUTCFullYear"}),y={add(e,t,{utc:i}={utc:!1}){return(i?m:f)[e.toLowerCase()]=t,this},get:(e,{utc:t}={utc:!1})=>(t?m:f)[(e||"").toLowerCase()]||null,generate:(e,t,i,{utc:r}={utc:!1})=>{var n=[],a=y.get(i,{utc:r});if(a){var s=a.cast(new Date(t)),o=a.cast(new Date(e));for(n.push(o);(o=a.next(new Date(o)))<=s;)n.push(o)}return n}};class x extends Error{constructor(e,t,i){super(),this.name="TauChartError",this.message=e,this.errorCode=t,this.errorArgs=i}}const b={STACKED_FIELD_NOT_NUMBER:"STACKED_FIELD_NOT_NUMBER",NO_DATA:"NO_DATA",NOT_SUPPORTED_TYPE_CHART:"NOT_SUPPORTED_TYPE_CHART",UNKNOWN_UNIT_TYPE:"UNKNOWN_UNIT_TYPE",INVALID_LOG_DOMAIN:"INVALID_LOG_DOMAIN"},v={},w={get:e=>v[e],reg(e,t){return v[e]=t,this}},_="taucharts_synthetic_record";function S(e,t){return`translate(${e},${t})`}function M(e){return`rotate(${e})`}function k(e){return["bottom","top"].indexOf(e.toLowerCase())>=0?"h":"v"}function E(e){var t={x:0,y:0},i=e.indexOf("translate(");if(i>=0){var r=e.indexOf(")",i+10),n=e.substring(i+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");t.x=parseFloat(n[0]),n.length>1&&(t.y=parseFloat(n[1]))}return t}function A(e,t,i,r,n,a,s,o){var l,c,u,d,h,g;return g=((u=s-n)*(t-a)-(d=o-a)*(e-n))/(-u*(c=r-t)+(l=i-e)*d),(h=(-c*(e-n)+l*(t-a))/(-u*c+l*d))>=0&&h<=1&&g>=0&&g<=1}function T(e){for(var t,i,r={x:0,y:0},n=e;n&&"SVG"!==n.nodeName.toUpperCase();)(i=n.getAttribute("transform"))&&(t=E(i),r.x+=t.x,r.y+=t.y),n=n.parentNode;return r}function O(e,t,i){const r=e.selectAll(t).filter(i);if(r.empty())return;const n=s.select(r.node().parentNode).selectAll(t).filter(e=>!i(e)).nodes(),a=n[n.length-1];if(a){const e=Array.prototype.indexOf.call(a.parentNode.childNodes,a),t=a.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>e||this.parentNode.insertBefore(this,t)})}}w.reg("identity",()=>({})).reg("flip",e=>{var t=e.scaleY,i=e.scaleX;const r=i.domain(),n=i.discrete?r[0]:Math.max(0,Math.min(...r)),a=i.value(n)+-.5*i.stepSize(n);return{flip:!0,scaleX:t,scaleY:i,xi:e=>t.value(e[t.dim]),yi:e=>i.value(e[i.dim]),y0:()=>a}}).reg("obsoleteVerticalStackOrder",()=>({obsoleteVerticalStackOrder:!0})).reg("positioningByColor",e=>{return(e.scaleX.discrete?e=>{const t=e.data().reduce((t,i)=>{const r=i[e.scaleX.dim],n=i[e.scaleColor.dim];return t.hasOwnProperty(r)||(t[r]=[]),t[r].indexOf(n)<0&&t[r].push(n),t},{});var i=e.scaleX,r=e.scaleColor,n=r.discrete?r.domain():r.originalSeries().sort((e,t)=>e-t),a=n.length||1;const s=n.reduce((e,t,i)=>(e[t]=i,e),{});return Object.keys(t).forEach(e=>t[e].sort((e,t)=>s[e]-s[t])),{xi:r=>{const n=r[e.scaleX.dim],s=t[n]||[r[e.scaleColor.dim]],o=s.length,l=s.indexOf(r[e.scaleColor.dim]);var c=(e=>i.stepSize(e[i.dim])*(a/(1+a)))(r)/(a+1);return e.xi(r)-(o+1)*c/2+(1+l)*c}}}:()=>({}))(e)}).reg("groupOrderByAvg",e=>{const t=e.data(),i=t=>t.map(e.yi).reduce((e,t)=>e+t,0)/t.length,r=t.reduce((t,i)=>{var r=e.group(i);return t[r]=t[r]||[],t[r].push(i),t},{}),n=Object.keys(r).map(e=>[e,i(r[e])]).sort((e,t)=>e[1]-t[1]).map(e=>e[0]);return{order:e=>{const t=n.indexOf(e);return t<0?Number.MAX_VALUE:t}}}).reg("stack",e=>{const t=e.data(),i=e.scaleX,r=e.scaleY;if(r.discrete||r.domain().some(e=>"number"!=typeof e))throw new x(`Stacked field [${r.dim}] should be a number`,b.STACKED_FIELD_NOT_NUMBER,{field:r.dim});const n=e=>t=>{const n=t[i.dim],a=t[r.dim],s=a>=0?e.positive:e.negative,o=s[n]||0,l=o+a;return s[n]=l,{nextStack:l,prevStack:o}},a=n({positive:{},negative:{}}),s=n({positive:{},negative:{}}),o=t=>lt(t,e.id);var l=Number.MAX_VALUE,c=Number.MIN_VALUE;const u=e=>(l=ec?e:c,r.value(e)),d=o(e=>u(a(e).nextStack)),h=o(e=>u(s(e).prevStack)),g=t=>e.group(t)+"/"+(t[r.dim]>=0?1:-1),p=rt(t,g),f=Object.keys(p).sort(e.flip||!e.flip&&e.obsoleteVerticalStackOrder?(t,i)=>e.order(t)-e.order(i):(t,i)=>e.order(i)-e.order(t)).reduce((e,t)=>e.concat(p[t]),[]);return f.forEach(e=>{d(e),h(e)}),r.fixup(e=>{const t={};return(!e.hasOwnProperty("max")||e.maxl)&&(t.min=l),t}),{group:g,data:()=>f,yi:d,y0:h}}).reg("size_distribute_evenly",(e,{minLimit:t,maxLimit:i,defMin:r,defMax:n})=>{const a=e.data(),s=(e,t)=>e-t,o=e.scaleX.discrete?e.scaleX.stepSize()/2:Number.MAX_VALUE,l=a.map(t=>e.xi(t)).sort(s);var c=l[0],u=l.slice(1).map(e=>{var t=e-c;return c=e,t}).filter(e=>e>0).sort(s).concat(Number.MAX_VALUE)[0];const d=Math.min(u,o),h="number"==typeof t?t:r,g={minSize:h,maxSize:"number"==typeof i?i:Math.max(h,Math.min(n,d))};return e.scaleSize.fixup(e=>{const t={};return e.fixed?e.maxSize>g.maxSize&&(t.maxSize=g.maxSize):(t.fixed=!0,t.minSize=g.minSize,t.maxSize=g.maxSize),t}),{}}).reg("adjustStaticSizeScale",(e,{minLimit:t,maxLimit:i,defMin:r,defMax:n})=>{var a={minSize:"number"==typeof t?t:r,maxSize:"number"==typeof i?i:n};return e.scaleSize.fixup(e=>{var t={};return e.fixed||(t.fixed=!0,t.minSize=a.minSize,t.maxSize=a.maxSize),t}),{}}).reg("adjustSigmaSizeScale",(e,{minLimit:t,maxLimit:i,defMin:r,defMax:n})=>{const a=(e,t)=>e-t,s=e.data().map(t=>e.xi(t)).sort(a);var o=s[0];const l=s.slice(1).map(e=>{const t=e-o;return o=e,t}).filter(e=>e>0).sort(a).concat(Number.MAX_VALUE)[0],c=e.scaleX.discrete?e.scaleX.stepSize()/2:Number.MAX_VALUE,u=Math.min(l,c),d="number"==typeof t?t:r,h="number"==typeof i?i:n,g={minSize:d,maxSize:Math.max(d,Math.min(h,(e=>{var t=(d+h)/2,i=h,r=d;return Math.round(t+(i-t)/(1+Math.exp(-(e-r)/.5)))})(u)))};return e.scaleSize.fixup(e=>{const t={};return e.fixed?e.maxSize>g.maxSize&&(t.maxSize=g.maxSize):(t.fixed=!0,t.minSize=g.minSize,t.maxSize=g.maxSize),t}),{}}).reg("avoidScalesOverflow",(e,{sizeDirection:t})=>{const i=(e,i)=>!e||e.discrete||"logarithmic"===e.scaleType||t.indexOf(i)<0,r=i(e.scaleX,"x"),n=i(e.scaleY,"y");if(r&&n)return{};var a,s;e.scaleSize.fixup(e=>(a=e.minSize,s=e.maxSize,e));var o=e.data().reduce((t,i)=>{var o,l,c=e.size(i),u=(c>=a?c:a+c*(s-a))/2;return r||(o=e.xi(i),t.left=Math.min(t.left,o-u),t.right=Math.max(t.right,o+u)),n||(l=e.yi(i),t.top=Math.min(t.top,l-u),t.bottom=Math.max(t.bottom,l+u)),t},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE});const l=(t,i,r,n)=>{var a=t.domain(),s=Math.abs(t.value(a[1])-t.value(a[0])),o=(a[1]-a[0])/s;if(0===s)return 1;var l=Math.max(0,-i),c=Math.max(0,r-s),u=e.flip?c:l,d=e.flip?l:c,h=Number(a[0])-(n?d:u)*o,g=Number(a[1])+(n?u:d)*o;return t.fixup(e=>{var t={};if(e.fixedBorders){let[n,a]=e.fixedBorders.slice();(n>i||a({minSize:d,maxSize:h})),{}}).reg("fillGaps",(e,{isStack:t,xPeriod:i,utc:r})=>{const n=rt(e.data(),e.group),a=Object.keys(n).sort((t,i)=>e.order(t)-e.order(i)).reduce((e,t)=>e.concat([n[t]]),[]),s=e.scaleX.dim,o=e.scaleY.dim,l=e.scaleColor.dim,c=e.scaleSplit.dim,u=e=>e[o]>=0?1:-1,d=(t,i,r)=>{const n=rt(i,e=>e[s]),a=i[0];return t.reduce((t,i)=>t.concat(n[i]||((t,i,r)=>{const n=[t,e.id(i),r].join(" ");return{[s]:t,[o]:1e-10*r,[c]:i[c],[l]:i[l],[_]:!0,[`${_}id`]:n}})(i,a,r)),[])},h=(e,t)=>e-t,g=()=>it(a.reduce((e,t)=>e.concat(t.map(e=>e[s])),[])).sort(h),p=i?(()=>{const t=g(),n=Math.max(...t.map(e=>Number(e))),a=e.scaleX.domain(),s=y.generate(a[0],a[1],i,{utc:r}).filter(e=>e>=a[0]&&e<=a[1]);let o=0;const l=[],c=y.get(i,{utc:r});return s.forEach(e=>{const i=Number(e);if(!(i>=n)){for(let e=o;et.sort((t,i)=>e.xi(t)-e.xi(i))).reduce(t?(e,t)=>{const i=rt(t,e=>String(u(e)));return Object.keys(i).reduce((e,t)=>e.concat(d(p,i[t],t)),e)}:(e,t)=>{rt(t,e=>String(u(e)));const i=Math.max(...t.map(e=>e[s]));return e.concat(d(p.filter(e=>e<=i),t,0))},[]);return{data:()=>f,size:t=>t[_]?e.scaleSize(0):e.size(t),id:t=>t[_]?t[`${_}id`]:e.id(t)}});var C=i(5);const N="tau-chart__";function L(e){return e}const F=1e-6;function z(e){return`translate(${e+.5},0)`}function R(e){return`translate(0,${e+.5})`}const $={top:1,right:2,bottom:3,left:4};function D(e){const t=$[e.scaleGuide.scaleOrient],i=e.scale,r=e.scaleGuide,n=r.label,{ticksCount:a,tickFormat:s,tickSize:o,tickPadding:l,gridOnly:c}=st(e,{tickSize:6,tickPadding:3,gridOnly:!1}),u="linear"===i.scaleType,d="ordinal"===i.scaleType||"period"===i.scaleType,h=t===$.top||t===$.bottom,g=t===$.top||t===$.left?-1:1,p=h?"x":"y",f=h?"y":"x",m=h?z:R,y=h?1:-1;return x=>{var b;if(i.ticks){b=i.ticks(a);let e=Math.floor(1.25*a);for(;b.length>e&&e>2&&b.length>2;)b=i.ticks(--e)}else b=i.domain();r.hideTicks&&(b=c?b.filter(e=>0==e):[]);const v=null==s?i.tickFormat?i.tickFormat(a):L:s,w=Math.max(o,0)+l,_=i.range(),S=_[0]+.5,k=_[_.length-1]+.5;let A=(i.bandwidth?function(e){var t=Math.max(0,e.bandwidth()-1)/2;return e.round()&&(t=Math.round(t)),function(i){return e(i)+t}}:L)(i);if(r.facetAxis){let e=A;A=(t=>e(t)-i.stepSize(t)/2)}const T=x.selection?x:null,O=T?T.selection():x,C=function(e){let t=e.node();for(;t&&"svg"!==t.tagName;)t=t.parentNode;return t}(O).getBoundingClientRect();function z(e){const i=Ke(r.rotate);if(e.attr("transform",M(i)),Math.abs(i/90)%2>0){let r=i<180?1:-1,n=h?.5:-2,a=t===$.top||t===$.left?-1:1,s=n*(t===$.top||t===$.bottom?a<0?0:.71:.32);e.attr("x",9*r).attr("y",0).attr("dx",h?null:`${s}em`).attr("dy",`${s}em`)}}function R(e,t=0){const n=e=>Math.max(i.stepSize(e),r.tickFormatWordWrapLimit,t);r.tickFormatWordWrap?de(e,n,r.tickFormatWordWrapLines,r.tickFontHeight,!h):ue(e,n)}function D(e){!function(e,t){const i=t?-10:20,r=t?0:1,n=t?1:-1;var a=[];e.each(function(){var e=le.select(this),t=e.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],i=n*parseFloat(t),s=e.select("text"),o=s.node().getBBox().width,l=o/2,c=i-l,u=i+l;a.push({c:i,s:c,e:u,l:0,textRef:s,tickRef:e})});var s=a.sort((e,t)=>e.c-t.c);((e,t)=>e.map((e,i,r)=>t(r[i-1]||{e:-1/0,s:-1/0,l:0},e,r[i+1]||{e:1/0,s:1/0,l:0})))(s,(e,r,n)=>{var a=e.e>r.s,s=n.s{var i={"[T][1]":-1,"[T][-1]":0,"[T][0]":1,"[F][0]":-1},r=`[${t.toString().toUpperCase().charAt(0)}][${e}]`;return i.hasOwnProperty(r)?i[r]:0})(e.l,a);var o=r.textRef.size(),l=r.textRef.text();o>1&&(l=l.replace(/([\.]*$)/gi,"")+"...");var c=11*r.l,u=t?parseFloat(r.textRef.attr("y"))+c:0;let n=t?0:c,s=t?c:0;var d=function(e){var t=0;if(!e)return t;var i=e.indexOf("rotate(");if(i>=0){var r=e.indexOf(")",i+7),n=e.substring(i+7,r);t=parseFloat(n.trim())}return t}(r.textRef.attr("transform"));r.textRef.text((e,t)=>0===t?l:"").attr("transform","translate("+n+","+s+") rotate("+d+")");var h={x1:0,x2:0,y1:u+(t?-1:5),y2:i};t||(h.transform="rotate(-90)"),Ft(r.tickRef,"line.label-ref").call(ve(h))}else r.tickRef.selectAll("line.label-ref").remove();return r})}(e,h)}O.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===$.right?"start":t===$.left?"end":"middle"),c||function(){const e=r.hideTicks||r.hide?[]:[null];xt(O.selectAll(".domain").data(e)).then(e=>(T&&e.exit().transition(T).attr("opacity",0).remove(),e.merge(e.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000")))).then(e=>T?e.transition(T):e).then(e=>{e.attr("d",t===$.left||t==$.right?`M${g*o},${S}H0.5V${k}H${g*o}`:`M${S},${g*o}V0.5H${k}V${g*o}`)})}();const P=xt(O.selectAll(".tick").data(b,e=>String(i(e))).order()).then(e=>{const t=e.exit(),i=e.enter().append("g").attr("class","tick");return{tickExit:t,tickEnter:i,tick:e.merge(i)}}).then(e=>{if(u){const t=i.ticks(),r=i.domain(),n=b.length-1,a=t.length>1&&r[0]*r[1]<0&&-r[0]>(t[1]-t[0])/2&&r[1]>(t[n]-t[n-1])/2;e.tick.classed("zero-tick",e=>0==e&&a)}return e}).result();!function(e){xt(e).then(({tickEnter:e,tickExit:t,tick:i})=>T?(e.attr("opacity",F).attr("transform",function(e){const t=A(e);return m(t)}),{tick:i.transition(T),tickExit:t.transition(T).attr("opacity",F).attr("transform",function(e){const t=A(e);return isFinite(t)?m(t):this.getAttribute("transform")})}):{tick:i,tickExit:t}).then(({tick:e,tickExit:t})=>{t.remove(),e.attr("opacity",1).attr("transform",e=>m(A(e)))})}(P),r.facetAxis||function(e){const t=g*o,r=d?e=>y*i.stepSize(e)/2:null;xt(e).then(({tick:e,tickEnter:i})=>{const n=e.select("line"),a=i.append("line").attr("stroke","#000").attr(`${f}2`,t);return d&&a.attr(`${p}1`,r).attr(`${p}2`,r),n.merge(a)}).then(e=>T?e.transition(T):e).then(e=>{e.attr(`${f}2`,t),d&&e.attr(`${p}1`,r).attr(`${p}2`,r)})}(P),d&&c&&d&&b&&b.length&&xt(O.selectAll(".extra-tick-line").data([null])).then(e=>e.merge(e.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))).then(e=>T?e.transition(T):e).then(e=>{e.attr(`${p}1`,S).attr(`${p}2`,S).attr(`${f}1`,0).attr(`${f}2`,g*o)}),c||(function(n){const a=r.textAnchor,s=g*w,o=t===$.top?"0em":t===$.bottom?"0.71em":"0.32em";function l(t){if(r.facetAxis)return t.attr("dx",18-e.position[0]).attr("dy",16)}xt(n).then(({tick:e,tickEnter:t})=>{const i=e.select("text"),r=t.append("text").attr("fill","#000").attr(f,s).attr("dy",o);return z(r),l(r),i.merge(r)}).then(e=>{if(e.text(v).attr("text-anchor",a),!1===h&&!0===r.facetAxis){const t=E(O.node().parentNode.getAttribute("transform"));R(e,C.width-Math.abs(t.x))}else R(e);return h&&"time"===i.scaleType&&function(e){if(b.length<2)return;var t=0,i=-1;const r=e.nodes();r.forEach((e,r)=>{const n=e.textContent||"";var a=n.length;a>t&&(t=a,i=r)});const n=A(b[1])-A(b[0]);var a=!1;if(i>=0){var s=r[i].getBoundingClientRect();a=n-s.width<8}O.classed(`${N}time-axis-overflow`,a)}(e),!h||"time"!==i.scaleType&&"linear"!==i.scaleType||function(e){if(0===b.length)return;const t=b[0],i=b[b.length-1],r=O.append("line").attr("x1",A(t)).attr("x2",A(t)).attr("y1",0).attr("y2",1),n=O.append("line").attr("x1",A(i)).attr("x2",A(i)).attr("y1",0).attr("y2",1),a={left:r.node().getBoundingClientRect().left-C.left,right:C.right-n.node().getBoundingClientRect().right};r.remove(),n.remove();const s=(e,t,i)=>{const r=e.getBoundingClientRect(),n=t>0?"right":"left",s=(A(i),a[n]),o=Math.ceil(r.width/2-s+1);e.setAttribute("dx",String(o>0?-t*o:0))},o=e.filter(e=>e===t).node(),l=e.filter(e=>e===i).node();e.attr("dx",null),s(o,-1,t),s(l,1,i)}(e),e}).then(e=>T?e.transition(T):e).then(e=>{e.attr(f,s),z(e),l(e),d&&r.avoidCollisions&&!r.facetAxis&&(T?T.on("end.fixTickTextCollision",()=>D(n.tick)):D(n.tick))})}(P),n.hide||function(){const e=n,t=Ft(O,"text.label").attr("class",Dt("label",e.cssClass)).attr("transform",M(e.rotate)).attr("text-anchor",e.textAnchor);xt(t).then(e=>T?e.transition(T):e).then(t=>{const i=y*e.padding,r=Math.abs(k-S),n=h?r:0;t.attr("x",n).attr("y",i).attr("text-anchor","end")});const i=e.text.split(" → ");for(var r=i.length-1;r>0;r--)i.splice(r,0," → ");t.selectAll("tspan").data(i).enter().append("tspan").attr("class",(e,t)=>t%2?`label-token-delimiter label-token-delimiter-${t}`:`label-token label-token-${t}`).text(e=>e).exit().remove()}())}}function P(e){return D({scale:e.scale,scaleGuide:e.scaleGuide,ticksCount:e.ticksCount,tickSize:e.tickSize,gridOnly:!0,position:e.position})}function j(e,...t){return 2===t.length?t[0]*(1-e)+t[1]*e:3===t.length?t[0]*(1-e)*(1-e)+2*t[1]*(1-e)*e+t[2]*e*e:t[0]*(1-e)*(1-e)*(1-e)+3*t[1]*(1-e)*(1-e)*e+3*t[2]*(1-e)*e*e+t[3]*e*e*e}function I(e,...t){var i=t.map(e=>e.x),r=t.map(e=>e.y);return{x:j(e,...i),y:j(e,...r)}}function B(e,t,i,r,n){var a=I(e,t,i),s=I(e,t,i,r),o=I(e,i,r,n),l=I(e,r,n);return[t,a,s,I(e,s,o),o,l,n]}function W(e,t,i="polyline"){var r;return n=>0===n?e:1===n?t:(r||(r=("cubic"===i?function(e,t){for(var i=2;i!e.isInterpolated),i=e.length-2;i>=0;i--)n=e[i+1],(r=e[i]).isCubicControl||n.isCubicControl||(e.splice(i+1,0,I(1/3,n,r),I(2/3,n,r)),e[i+1].isCubicControl=!0,e[i+2].isCubicControl=!0);var a=e.filter((e,t)=>t%3==0),s=t.filter((e,t)=>t%3==0),o=a.map(e=>e.id),l=s.map(e=>e.id),c=o.reduce((t,i)=>(t[i]=e.findIndex(e=>e.id===i),t),{}),u=l.reduce((e,i)=>(e[i]=t.findIndex(e=>e.id===i),e),{}),d=o.filter(e=>l.indexOf(e)>=0),h=a.filter(e=>!e.positionIsBeingChanged),g=s.filter(e=>!e.positionIsBeingChanged),p=Q(h,g),f=Q(g,h),m=[];d.forEach((i,r)=>{var n=c[i],a=u[i];if(0===r&&(n>0||a>0)&&m.push(H({polylineFrom:e.slice(0,n+1),polylineTo:t.slice(0,a+1),toOppositeScale:0===a?p:f,isCubic:!0})),r>0){var s=c[d[r-1]],o=u[d[r-1]];n-s>3||a-o>3?m.push(U({polylineFrom:e.slice(s,n+1),polylineTo:t.slice(o,a+1),isCubic:!0})):m.push(function({polylineFrom:e,polylineTo:t}){return i=>J(e.slice(1,3),t.slice(1,3),i)}({polylineFrom:e.slice(s,n+1),polylineTo:t.slice(o,a+1)}))}m.push(G({pointFrom:e[n],pointTo:t[a]})),r===d.length-1&&(e.length-n-1>0||t.length-a-1>0)&&m.push(H({polylineFrom:e.slice(n),polylineTo:t.slice(a),toOppositeScale:t.length-a==1?p:f,isCubic:!0}))}),0===m.length&&(t.length>0&&0===d.length||e.length>0&&0===d.length)&&m.push(q({polylineFrom:e.slice(0),polylineTo:t.slice(0),isCubic:!0}));return e=>{var t=[];return m.forEach(i=>{var r=i(e);X(t,r)}),t}}:function(e,t){var i=(e=e.filter(e=>!e.isInterpolated)).map(e=>e.id),r=t.map(e=>e.id),n=i.filter(e=>r.indexOf(e)>=0),a=e.filter(e=>!e.positionIsBeingChanged),s=t.filter(e=>!e.positionIsBeingChanged),o=Q(a,s),l=Q(s,a),c=[];n.forEach((a,s)=>{var u=i.indexOf(a),d=r.indexOf(a);if(0===s&&(u>0||d>0)&&c.push(H({isCubic:!1,polylineFrom:e.slice(0,u+1),polylineTo:t.slice(0,d+1),toOppositeScale:0===d?o:l})),s>0){var h=i.indexOf(n[s-1]),g=r.indexOf(n[s-1]);(u-h>1||d-g>1)&&c.push(U({isCubic:!1,polylineFrom:e.slice(h,u+1),polylineTo:t.slice(g,d+1)}))}c.push(G({pointFrom:e[u],pointTo:t[d]})),s===n.length-1&&(e.length-u-1>0||t.length-d-1>0)&&c.push(H({isCubic:!1,polylineFrom:e.slice(u),polylineTo:t.slice(d),toOppositeScale:t.length-d==1?o:l}))}),0===c.length&&(t.length>0&&0===n.length||e.length>0&&0===n.length)&&c.push(q({isCubic:!1,polylineFrom:e.slice(0),polylineTo:t.slice(0)}));return e=>{var t=[];return c.forEach(i=>{var r=i(e);X(t,r)}),t}})(e,t)),r(n))}function H({polylineFrom:e,polylineTo:t,isCubic:i,toOppositeScale:r}){var n=e.length>t.length?e:t,a=1===t.length,s=e[0].id!==t[0].id,o=Boolean(s!==a);return e=>{var t=(i?Z:K)({t:e,polyline:n,decreasing:a,rightToLeft:o});a===o?t.shift():t.pop();var s=J(t.map(r),t,a?1-e:e);return s.forEach(e=>e.positionIsBeingChanged=!0),s}}function U({polylineFrom:e,polylineTo:t,isCubic:i}){var r=e.length,n=t.length;if(n!==r){var a=na+Number(e{if(r>2){var n=function(e,t){for(var i,r,n=[t[0]],a=0;ae/(r-1)),e.slice(c-3,c+1));Ze(r-2).forEach(e=>n[3*(e+1)].id=t[l.length-1+3*e].id),i&&n.forEach((e,t)=>{t>0&&ta+Number(e{Ze(1,r).forEach(n=>{var a;n===r-1?(a=Object.assign({},e[c]),i||(a.id=t[l.length].id)):((a=V(e[c-1],e[c],n/(r-1))).id=t[l.length].id,i&&(a.isInterpolated=!0)),l.push(a)}),c++}),l})({smallerPolyline:a?t:e,biggerPolyline:s,decreasing:a}),l=s.slice(1,s.length-1),c=o.slice(1,o.length-1);return e=>{var t=J(c,l,a?1-e:e);return t.forEach(e=>e.positionIsBeingChanged=!0),t}}var u=e.slice(1,e.length-1),d=t.slice(1,t.length-1);return e=>{var t=J(u,d,e);return t.forEach(e=>e.positionIsBeingChanged=!0),t}}function G({pointFrom:e,pointTo:t}){return i=>[V(e,t,i)]}function q({polylineFrom:e,polylineTo:t,isCubic:i}){var r=0===t.length,n=r,a=r?e:t;return e=>{var t=(i?Z:K)({t:e,polyline:a,decreasing:r,rightToLeft:n});return t.forEach((e,t)=>{t>0&&(e.positionIsBeingChanged=!0)}),t}}function X(e,t){return Array.prototype.push.apply(e,t)}function Y(e,t,i){return void 0===t?e:"number"==typeof t?e+i*(t-e):t}function V(e,t,i){if(e===t)return t;var r={};return Object.keys(e).forEach(n=>r[n]=Y(e[n],t[n],i)),void 0!==t.id&&(r.id=t.id),r}function J(e,t,i){return e.map((e,r)=>V(e,t[r],i))}function K({t:e,polyline:t,decreasing:i,rightToLeft:r}){var n=Boolean(i)!==Boolean(r),a=function(e,t){var i=0;if(e>0){for(var r,n,a,s,o=[0],l=0,c=1;cObject.assign({},m,{id:t[g+e].id,isInterpolated:!0})))}return p}(i?1-e:e,n?t.slice(0).reverse():t);return n&&a.reverse(),a}function Z({t:e,polyline:t,decreasing:i,rightToLeft:r}){var n=Boolean(i)!==Boolean(r),a=function(e,t){var i=(t.length-1)/3+1,r=0;if(e>0){for(var n,a,s,o,l,c,u,d,h=[0],g=0,p=1;pe.isInterpolated=!0),v[2].id=t[x].id,X(b,v),Ze(1,y).forEach(e=>{X(b,[{x:v[2].x,y:v[2].y,isCubicControl:!0,isInterpolated:!0},{x:v[2].x,y:v[2].y,isCubicControl:!0,isInterpolated:!0},Object.assign({},v[2],{id:t[x+3*e].id,isInterpolated:!0})])})}return b}(i?1-e:e,n?t.slice(0).reverse():t);return n&&a.reverse(),a}function Q(e,t){var i,r,n,a,s=[],o=[],l=0,c=e.length,u=t.length;for(i=0;ie;var d=Object.keys(s[0]).filter(e=>"number"==typeof s[0][e]).filter(e=>"id"!==e),h={},g=(e,t,i,r)=>n=>r+(n-t)*(r-i)/(t-e);return d.forEach(e=>{for(var t,i,r=s[0][e],n=o[0][e],a=s.length-1;a>0;a--)if((t=s[a][e])!==r)return i=o[a][e],void(h[e]=g(r,t,n,i));h[e]=((e,t)=>i=>i-e+t)(r,n)}),e=>{var t=Object.assign({},e);return d.forEach(i=>{t[i]=h[i](e[i])}),t}}function ee(e,t,i,r){return Math.sqrt((i-e)*(i-e)+(r-t)*(r-t))}function te(e,[t,i,r,n]){var a=B(e,t,i,r,n);return[a[1],a[2],a[4],a[5]].forEach(e=>e.isCubicControl=!0),Object.keys(n).forEach(i=>{"x"!==i&&"y"!==i&&"id"!==i&&(a[3][i]=Y(t[i],n[i],e))}),a}function ie(e,t){if(e.length<2)return e.slice(0);if(2===e.length)return[e[0],{x:re(e[0].x,e[1].x,1/3),y:re(e[0].y,e[1].y,1/3)},{x:re(e[0].x,e[1].x,2/3),y:re(e[0].y,e[1].y,2/3)},e[1]];var i,r,n,a,s,o,l,c,u,d,h,g,p,f,m=new Array(3*(e.length-1)+1);const y=m.length-1;for(var x=0;x0&&(m[3*x-2]=I(1/3,e[x-1],e[x]),m[3*x-1]=I(2/3,e[x-1],e[x]));for(var b=m.slice(0),v=0;v<3;v++){for(m[1]={x:re(m[0].x,m[3].x,1/3),y:re(m[0].y,re(m[3].y,m[2].y,1.5),2/3)},m[y-1]={x:re(m[y].x,m[y-3].x,1/3),y:re(m[y].y,re(m[y-3].y,m[y-2].y,1.5),2/3)},t&&((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})),x=6;xi.y==l>n.y&&(p=re(p*(f=(n.y-r.y)/(l-r.y)),p,1/(1+Math.abs(f))),h=(n.y-r.y)/p),r.y>i.y==se,step:function(e){for(var t,i,r,n,a=[],s=void 0!==e[0].id,o=void 0!==e[0].size,l=1;llt(e=>e.node().getComputedTextLength(),e=>e.node().textContent.length),ue=(e,t,i)=>{i=i||ce(),e.each(function(){var e=le.select(this.parentNode).data()[0],r=t(e),n=le.select(this),a=n.text().split(/\s+/),s=!1,o=a.reduce((e,t,a)=>{if(s)return e;var o=a>0?[e,t].join(" "):t,l=i(n.text(o));if(l{a=a||ce();var s=(e,t,i,r,n,a,s)=>{var o=s*i+a;return e.append("tspan").attr("x",r).attr("y",n).attr("dy",o+"em").text(t)};e.each(function(){var e=le.select(this.parentNode).data()[0],o=t(e),l=le.select(this),c=l.text().split(/\s+/),u=l.attr("x"),d=l.attr("y"),h=parseFloat(l.attr("dy"));l.text(null);var g=s(l,null,1.1,u,d,h,0),p=!1,f=c.length-1,m=c.reduce((e,t,r)=>{if(p)return e;var n=e.length===i||r===f,s=e[e.length-1],l=""!==s?s+" "+t:t,c=a(g.text(l)),u=c>o;if(u&&n){var d=Math.floor(o/c*l.length);e[e.length-1]=l.substr(0,d-4)+"...",p=!0}return u&&!n&&e.push(t),u||(e[e.length-1]=l),e},[""]).filter(e=>e.length>0);d=n?-1*(m.length-1)*Math.floor(.5*r):d,m.forEach((e,t)=>s(l,e,1.1,u,d,h,t)),g.remove()})};var he=(e,t,i)=>(t>0&&!document.hidden&&((e=e.transition(i).duration(t)).attr=ge),e.onTransitionEnd=function(e){return me(this,e),this},e),ge=function(e,t){var i,r=le.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?i=e:arguments.length>1&&(i={[e]:t});var n="__transitionAttrs__",a="__lastTransitions__",s=fe();this.each(function(){var e={};for(var t in i)"function"==typeof i[t]?e[t]=i[t].apply(this,arguments):e[t]=i[t];this[n]=Object.assign(this[n]||{},e),this[n][a]||Object.defineProperty(this[n],a,{value:{}}),Object.keys(e).forEach(e=>this[n][a][e]=s)});var o=function(){this[n]&&(Object.keys(i).filter(e=>this[n][a][e]===s).forEach(e=>delete this[n][e]),0===Object.keys(this[n]).length&&delete this[n])};return this.on(`interrupt.${s}`,()=>this.each(o)),this.on(`end.${s}`,()=>this.each(o)),r},pe=0,fe=function(){return++pe},me=(e,t)=>{if(le.transition.prototype.isPrototypeOf(e)&&!e.empty()){var i=()=>t.call(null,e);return e.on("interrupt.d3_on_transition_end",i),e.on("end.d3_on_transition_end",i),e}t.call(null,e)},ye=(e,t,i,r)=>{const n=r||(e=>e),a=function(){n(this)};return function(r){var n=r;return t&&(n=n.call(ve(st(t,i)))),n=(n=he(n,e)).call(ve(i)),e>0?n.on("end.d3_animationInterceptor",()=>n.each(a)):n.each(a),n}},xe=(e,t)=>{var i=e.node();return e.selectAll(t).filter(function(){return this.parentNode===i})},be=(e,t,i,r,n="linear")=>{const a="__pathPoints__";return function(e){this[a]||(this[a]=i.map(()=>[]));const s=i.map((t,i)=>{const s=it(e,r).map(t),o=(se(n)||se("linear"))(s),l=this[a][i];return{pointsFrom:l,pointsTo:o,interpolate:W(l,o,oe(n))}});return e=>{if(0===e){let e=s.map(e=>e.pointsFrom);return t(...e)}if(1===e){let e=s.map(e=>e.pointsTo);return this[a]=e,t(...e)}const i=s.map(t=>t.interpolate(e));return this[a]=i,t(...i)}}},ve=e=>t=>(Object.keys(e).forEach(i=>t.attr(i,e[i])),t),we=e=>t=>(Object.keys(e).forEach(i=>t.classed(i,e[i])),t);class _e extends g{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),this.config.guide.size=this.config.guide.size||{};var t=this.config.stack,i=this.config.guide.enableColorToBarPosition,r=[e.flip&&w.get("flip"),t&&w.get("stack"),i&&w.get("positioningByColor")];this.decorators=(this.config.transformRules||r).concat(e.transformModel||[]),this.adjusters=(this.config.adjustRules||[]).concat(e.adjustScales||[])}defineGrammarModel(e){const t=this.config;this.regScale("x",e("pos",t.x,[0,t.options.width])).regScale("y",e("pos",t.y,[t.options.height,0])).regScale("y",e("pos",t.y,e=>["ordinal","period"].indexOf(e.type)>=0?[0,t.options.height]:[t.options.height,0])).regScale("size",e("size",t.size,{})).regScale("color",e("color",t.color,{})).regScale("split",e("split",t.split,{})).regScale("label",e("label",t.label,{})).regScale("identity",e("identity",t.identity,{}));const i=this.getScale("x"),r=this.getScale("y"),n=this.getScale("size"),a=this.getScale("label"),s=this.getScale("color"),o=this.getScale("split"),l=this.getScale("identity"),c=r.domain(),u=r.discrete?c[0]:Math.max(0,Math.min(...c)),d=r.value(u)+.5*r.stepSize(u),h=s.domain(),g={data:()=>this.data(),flip:!1,scaleX:i,scaleY:r,scaleSize:n,scaleLabel:a,scaleColor:s,scaleSplit:o,scaleIdentity:l,color:e=>s.value(e[s.dim]),label:e=>a.value(e[a.dim]),group:e=>`${e[s.dim]}(@taucharts@)${e[o.dim]}`,order:e=>{const t=e.split("(@taucharts@)")[0],i=h.indexOf(t);return i<0?Number.MAX_VALUE:i},size:e=>n.value(e[n.dim]),id:e=>l.value(e[l.dim],e),xi:e=>i.value(e[i.dim]),yi:e=>r.value(e[r.dim]),y0:()=>d};return g.data().forEach(e=>g.id(e)),g}getGrammarRules(){return this.decorators.filter(e=>e)}getAdjustScalesRules(){return(this.adjusters||[]).filter(e=>e)}createScreenModel(e){const t=e.flip,i=(e,t,i)=>e?t:i;return{flip:t,id:e.id,x:i(t,e.yi,e.xi),y:i(t,e.xi,e.yi),x0:i(t,e.y0,e.xi),y0:i(t,e.xi,e.y0),size:e.size,group:e.group,order:e.order,label:e.label,color:t=>e.scaleColor.toColor(e.color(t)),class:t=>e.scaleColor.toClass(e.color(t)),model:e,toFibers:()=>{const t=rt(e.data(),e.group);return Object.keys(t).sort((t,i)=>e.order(t)-e.order(i)).reduce((e,i)=>e.concat([t[i]]),[])}}}drawFrames(){var e=this,t=this.config.options,i=t=>((e,t)=>{var i=Math.pow(10,t);return Math.round(i*e)/i})(e.screenModel.size(t)/2,4),r=ye,n=function(t,i,n){var a=e.config.guide.animationSpeed,o=t.selectAll(`.${i}`).data(e=>[e],e.screenModel.id);o.exit().call(r(a,null,{width:0},e=>s.select(e).remove())),o.call(r(a,null,n)),o.enter().append("rect").style("stroke-width",0).call(r(a,{width:0},n))},a=this.config.flip,o=a?"y":"x",l=a?"x":"y",c=a?"x0":"y0",u=a?"height":"width",d=a?"width":"height",h=function(t){n(t,"lvl-top",{[u]:e=>i(e),[d]:1,[o]:t=>e.screenModel[o](t)-i(t)/2,[l]:t=>e.screenModel[l](t),fill:t=>e.screenModel.color(t),class:t=>`lvl-top ${e.screenModel.class(t)}`}),n(t,"lvl-btm",{[u]:e=>i(e),[d]:1,[o]:t=>e.screenModel[o](t)-i(t)/2,[l]:t=>e.screenModel[c](t),fill:t=>e.screenModel.color(t),class:t=>`lvl-btm ${e.screenModel.class(t)}`}),n(t,"lvl-link",{[u]:.5,[d]:t=>Math.abs(e.screenModel[l](t)-e.screenModel[c](t)),[o]:t=>e.screenModel[o](t)-.25,[l]:t=>Math.min(e.screenModel[l](t),e.screenModel[c](t)),fill:t=>e.screenModel.color(t),class:t=>`lvl-link ${e.screenModel.class(t)}`})},g=function(t){t.attr("class",`frame-id-${e.config.uid}`).call(function(t){var i=t.selectAll(".generic").data(e=>e,e.screenModel.id);i.exit().remove(),i.call(h),i.enter().append("g").attr("class","generic").call(h)})},p=rt(this.data(),e.screenModel.group),f=Object.keys(p).sort((t,i)=>e.screenModel.order(t)-e.screenModel.order(i)).reduce((e,t)=>e.concat([p[t]]),[]),m=t.container.selectAll(`.frame-id-${e.config.uid}`).data(f);m.exit().remove(),m.call(g),m.enter().append("g").call(g)}}const Se={...o,...l};function Me(e,t,i,r){var n=r(i(e),e);return(n[t]||[]).forEach(e=>Me(e,t,i,r)),n}function ke(e,t,i,r=0){t(e,r)&&(e.units||[]).map(e=>ke(e,t,i,r+1)),i(e,r)}var Ee=function(){var e=[];function t(e){for(var t in e)this[t]=e[t]}function i(){this.copiedObjects=[];var e=this;this.recursiveDeepCopy=function(t){return e.deepCopy(t)},this.depth=0}function r(e,t){var r=new i;return t&&(r.maxDepth=t),r.deepCopy(e)}return t.prototype={constructor:t,canCopy:function(e){return!1},create:function(e){},populate:function(e,t,i){}},i.prototype={constructor:i,maxDepth:256,cacheResult:function(e,t){this.copiedObjects.push([e,t])},getCachedResult:function(e){for(var t=this.copiedObjects,i=t.length,r=0;rthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return e.populate(this.recursiveDeepCopy,t,i),this.depth--,i}},r.DeepCopier=t,r.deepCopiers=e,r.register=function(i){i instanceof t||(i=new t(i)),e.unshift(i)},r.register({canCopy:function(){return!0},create:function(e){return e instanceof e.constructor?"object"==typeof(t=e.constructor.prototype)?JSON.parse(JSON.stringify(t)):t:{};var t},populate:function(e,t,i){for(var r in t)t.hasOwnProperty(r)&&(i[r]=e(t[r]));return i}}),r.register({canCopy:function(e){return e instanceof Array},create:function(e){return new e.constructor},populate:function(e,t,i){for(var r=0;r/^(#|rgb\(|rgba\()/.test(e),Te=/(.)^/;let Oe={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Ce={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Ne=/\\|'|\r|\n|\u2028|\u2029/g,Le="(?:"+Object.keys(Oe).join("|")+")",Fe=RegExp(Le),ze=RegExp(Le,"g"),Re={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function $e(e){return Ee(e)}function De(e){return e instanceof Date&&!isNaN(Number(e))}function Pe(e){return null!=e&&"object"==typeof e}function je(e){var t=parseFloat(Math.min(...e).toFixed(15)),i=parseFloat(Math.max(...e).toFixed(15));if(t===i){i-=(i>=0?-1:1)*(i||1)/10}for(var r=[t=Math.min(0,t),i=Math.max(0,i)],n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/10)/Math.LN10)),s=10/n*a,o=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],l=-1;s>o[++l][0];);a*=o[l][1],r[0]=Math.floor(r[0]/a)*a,r[1]=Math.ceil(r[1]/a)*a;var c=t-r[0],u=r[1]-i,d=a/2;if(t<0){var h=c>=d?-c:0;r[0]=r[0]-h}if(i>0){var g=u>=d?-u:0;r[1]=r[1]+g}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Ie(e,t,{utc:i}={utc:!1}){var[r,n]=Se.extent(e),a=+n-+r,s=i?Se.scaleUtc:Se.scaleTime;if(0===a){return r=new Date(r.getTime()-864e5),n=new Date(n.getTime()+864e5),s().domain([r,n]).nice(t).domain()}var o=s().domain([r,n]).nice(t);if(t)return o.domain();var[l,c]=s().domain([r,n]).nice(t).domain(),u=o.ticks(),d=u.length-1;return(+r-+l)/(+u[1]-+l)<.5&&(r=l),(+c-+n)/(+c-+u[d-1])<.5&&(n=c),[r,n]}var Be=0,We={};function He(e){var t=btoa(encodeURIComponent(e)).replace(/=/g,"_");return We.hasOwnProperty(t)||(We[t]=`H${++Be}`),We[t]}function Ue(e,t,i){var r=0,n=null,a=lt((e,t)=>it(e.map(e=>t.reduce((t,i)=>t.concat((e=>De(e)?e.getTime():e)(e[i])),[])),e=>JSON.stringify(e)).reduce((e,t)=>{var i=t[0];return e[i]=e[i]||0,e[i]+=1,e},{}),(e,t)=>{let i=n===e?r:++r;return n=e,`${t.join("")}-${i}`});return(r,n,s)=>{var o=s.length,l=i.getSpec(),c=l.sources["/"].data,u=l.unit.units[0].guide||{};u.padding=u.padding||{l:0,r:0,t:0,b:0};var d=0;"x"===e?d=u.padding.l+u.padding.r:"y"===e&&(d=u.padding.t+u.padding.b);var h=(n-o*d)/(e=>{var t=a(c,e);return Object.keys(t).reduce((e,i)=>e+t[i],0)})(t);return(((e,t)=>a(c,e)[t])(t,r)*h+d)/n}}function Ge(e){var t=!0;try{ke(e,e=>{if(0===e.type.indexOf("COORDS.")&&"COORDS.RECT"!==e.type)throw new Error("Not applicable")},e=>e)}catch(e){"Not applicable"===e.message&&(t=!1)}return t}function qe(e,t,i,r=0){if("requestAnimationFrame"===r){var n=!1;return function(...r){n||(requestAnimationFrame(()=>{n=!1}),i.apply(this,r),n=!0),e.e=t,e.ts=Date.now()}}return function(...n){var a={e:t,ts:Date.now()};(e.e&&e.e===a.e?a.ts-e.ts:r)>=r&&i.apply(this,n),e.e=a.e,e.ts=a.ts}}function Xe(e,t){var i=e[0],r=e[1],n=(r-i)/(t-1),a=t>=2?Ze(t-2).map(e=>i+n*(e+1)):[];return[i,...a,r]}function Ye(e){return Ae(e)?e:""}function Ve(e){return Ae(e)?"":e}function Je(e){return e/180*Math.PI}function Ke(e){return Math.abs(e)>=360&&(e%=360),e<0&&(e=360+e),e}function Ze(e,t){1===arguments.length&&(t=e,e=0);const i=[];for(let r=e;r100}function et(e,t,i,r){return e+t*(-90===i?-1:1)-r>20}function tt(e){return Array.isArray(e)?[].concat(...e.map(e=>tt(e))):e}function it(e,t){for(var i={},r=[],n=e.length,a=t||(e=>String(e)),s=0;s{var r=t(i);return e[r]=e[r]||[],e[r].push(i),e},{})}function nt(e,t){return it(e.concat(t))}function at(e,t){return e.filter(e=>-1!==t.indexOf(e))}function st(e,...t){var i=t.length;if(0===i||!e)return e;for(var r=0;r{delete i[e]}),i}function lt(e,t){const i=function(r){const n=i.cache,a=String(t?t.apply(this,arguments):r);return n.hasOwnProperty(a)||(n[a]=e.apply(this,arguments)),n[a]};return i.cache={},i}function ct(...e){return(t,i)=>{var r=0;return e.every(e=>0===(r=e(t,i))),r}}function ut(e,...t){return null==e?{}:t.reduce((t,i)=>{let r=e[i];return r&&(t[i]=r),t},{})}function dt(e){return e=null==e?"":String(e),Fe.test(e)?e.replace(ze,e=>Oe[e]):e}function ht(e,t,i){!t&&i&&(t=i),t=st({},t,Re);var r=RegExp([(t.escape||Te).source,(t.interpolate||Te).source,(t.evaluate||Te).source].join("|")+"|$","g"),n=0,a="__p+='";e.replace(r,function(t,i,r,s,o){return a+=e.slice(n,o).replace(Ne,e=>"\\"+Ce[e]),n=o+t.length,i?a+="'+\n((__t=("+i+"))==null?'':utils.escape(__t))+\n'":r?a+="'+\n((__t=("+r+"))==null?'':__t)+\n'":s&&(a+="';\n"+s+"\n__p+='"),t}),a+="';\n",t.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{var s=new Function(t.variable||"obj",a)}catch(e){throw e.source=a,e}var o=function(e){return s.call(this,e)},l=t.variable||"obj";return o.source="function("+l+"){\n"+a+"}",o}function gt(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const pt=" ",ft=32,mt=["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((e,t)=>(e[t]=!0,e),{});function yt(e){var t=2,i=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(t=1,i={});const r=tt(Array.prototype.slice.call(arguments,t)),n=1===r.length&&"<"!==r[0].trim()[0],a=mt[e];if(a&&r.length>0)throw new Error(`Tag "${e}" is void but content is assigned to it`);const s=`<${e}`;var o=Object.keys(i).map(function(e){return` ${e}="${i[e]}"`}).join("");o.length>ft&&(o=Object.keys(i).map(function(e){return`\n${pt}${e}="${i[e]}"`}).join(""));const l=n?r[0]:"\n"+r.map(e=>{return String(e).split("\n").map(e=>`${pt}${e}`).join("\n")}).join("\n")+"\n";return`${s}${o}${a?"/>":`>${l}`}`}function xt(e){var t=e;const i={then:e=>(t=e(t),i),result:()=>t};return i}const bt=[_e];function vt(e){return bt.some(t=>e instanceof t)}function wt(e){return(e.units||[]).some(e=>e.hasOwnProperty("units"))}var _t=document.createElement("div"),St=new WeakMap;function Mt(e,t){var i;return e instanceof Node?i=e:(_t.insertAdjacentHTML("afterbegin",e),i=_t.childNodes[0]),t.appendChild(i),i}function kt(e){if(St.has(e))return St.get(e);var t=e.style.overflow;e.style.overflow="scroll";var i={width:e.offsetWidth-e.clientWidth,height:e.offsetHeight-e.clientHeight};return e.style.overflow=t,St.set(e,i),i}function Et(e,t){var i="horizontal"===(t=t||"both")||"both"===t,r="vertical"===t||"both"===t,n=kt(e),a=r?`${n.width}px`:"0",s=i?`${n.height}px`:"0";e.style.overflow="hidden",e.style.padding=`0 ${a} ${s} 0`;var o=e.scrollWidth>e.clientWidth,l=e.scrollHeight>e.clientHeight,c=r&&!l?`${n.width}px`:"0",u=i&&!o?`${n.height}px`:"0";return e.style.padding=`0 ${c} ${u} 0`,e.style.overflow="",e.style.overflowX=o?"scroll":"hidden",e.style.overflowY=l?"scroll":"hidden",n}function At(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function Tt(e,t){return parseInt(At(e,t)||"0",10)}function Ot(e){var t=Tt(e,"padding-left"),i=Tt(e,"padding-right"),r=Tt(e,"padding-bottom"),n=Tt(e,"padding-top"),a=Tt(e,"border-top-width")+Tt(e,"border-left-width")+Tt(e,"border-right-width")+Tt(e,"border-bottom-width"),s=e.getBoundingClientRect();return{width:s.width-t-i-2*a,height:s.height-r-n-2*a}}function Ct(e){var t=document.createElement("div");t.style.position="absolute",t.style.visibility="hidden",t.style.width="100px",t.style.height="100px",t.style.border="1px solid green",t.style.top="0",document.body.appendChild(t),t.innerHTML='\n \n \n \n \n \n ';var i=t.querySelector(".x.axis .tick text");i.textContent=e;var r={width:0,height:0},n=i.getBoundingClientRect();r.width=n.right-n.left,r.height=n.bottom-n.top;var a=0!==e.length?r.width/e.length:0;return r.width=r.width+1.5*a,document.body.removeChild(t),r}function Nt(e,{fontSize:t,fontFamily:i,fontWeight:r}){var n="string"==typeof t?t:`${t}px`,a=e.map(function(e){for(var t=0,a=0;t<=e.length-1;t++){a+=Lt(e.charAt(t),{fontSize:n,fontFamily:i,fontWeight:r}).width}return a}).sort(function(e,t){return t-e})[0],s=e.length,o=parseInt(n);return{width:a,height:o*s+.39*o*s}}const Lt=lt((e,{fontSize:t,fontFamily:i,fontWeight:r})=>{var n=document.createElement("div");n.style.position="absolute",n.style.visibility="hidden",n.style.border="0px",n.style.top="0",n.style.fontSize=t,n.style.fontFamily=i,n.style.fontWeight=r,document.body.appendChild(n),n.innerHTML=" "===e?" ":e;var a={width:0,height:0},s=n.getBoundingClientRect();return a.width=s.right-s.left,a.height=s.bottom-s.top,document.body.removeChild(n),a},(e,t)=>`${e}_${JSON.stringify(t)}`);function Ft(e,t){var i={".":(e,t)=>t.classed(e,!0),"#":(e,t)=>t.attr("id",e)},r=Object.keys(i).join("");if(t.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(t[0])>=0)throw new Error("Selector must have tag at the beginning.");var n,a=e instanceof Element,o=a?s.select(e):e,l=e=>a?e.node():e,c=o.selectAll(t).filter(function(){return this.parentNode===o.node()}).filter((e,t)=>0===t);if(!c.empty())return l(c);for(var u,d=-1,h=null,g=1,p=t.length;g<=p;g++)(g==p||r.indexOf(t[g])>=0)&&(u=t.substring(d+1,g),d<0?n=o.append(u):i[h].call(null,u,n),h=t[g],d=g);return l(n)}function zt(e,t){return Rt(e,t)[0]||null}function Rt(e,t){for(var i=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,n=e.firstElementChild;Boolean(n);n=n.nextElementSibling)r.call(n,t)&&i.push(n);return i}function $t(e,t){if(e.childElementCount>0){const n=Array.prototype.filter.call(e.childNodes,e=>e.nodeType===Node.ELEMENT_NODE),a=n.slice().sort(t),s=n.reduce((e,t,i)=>(e.set(t,i),e),new Map);var i,r;const o=a.reduce((e,t,n)=>{const o=s.get(t),l=n-o;return l!==r&&(i&&e.push(i),r=l,i={from:o,to:n,elements:[]}),i.elements.push(t),n===a.length-1&&e.push(i),e},[]),l=o.slice().sort((e,t)=>e.from-t.from),c=l.reduce((e,t,i)=>(e.set(t,i),e),new Map),u=e=>{const t=o.map((e,t)=>({elements:e.elements,from:c.get(e),to:t})).sort(ct((e,t)=>e.elements.length-t.elements.length,e?(e,t)=>t.to-e.to:(e,t)=>e.to-t.to));for(var i,r,n,a=0;ar.to)for(i=a+1;i=r.to&&n.fromr.from&&n.from<=r.to&&n.from--}return t.filter(e=>e.from!==e.to)},d=u(!0),h=u(!1),g=d.lengthe.elements);g.forEach(t=>{const i=p.splice(t.from,1)[0],r=p[t.to],n=r?r[0]:null;var a;1===t.elements.length?a=i[0]:(a=document.createDocumentFragment(),i.forEach(e=>{a.appendChild(e)})),e.insertBefore(a,n),p.splice(t.to,0,i)})}}function Dt(...e){var t=[];return e.filter(e=>Boolean(e)).forEach(e=>{"string"==typeof e?t.push(e):"object"==typeof e&&t.push.apply(t,Object.keys(e).filter(t=>Boolean(e[t])))}),it(t).join(" ").trim().replace(/\s{2,}/g," ")}function Pt(e,t,...i){const r=document.createEvent("MouseEvents"),n=[!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null],a=i.concat(n.slice(i.length));r.initMouseEvent(t,...a),e.dispatchEvent(r)}var jt=e=>De(e)?e.getTime():e,It={cross(e,t,i){var r=e(),n=it(r.map(e=>e[t]),jt),a=it(r.map(e=>e[i]),jt),s=0===n.length?[null]:n;return(0===a.length?[null]:a).reduce((e,r)=>e.concat(s.map(e=>{var n={};return t&&(n[t]=jt(e)),i&&(n[i]=jt(r)),n})),[])},cross_period(e,t,i,r,n,a){var s=e(),o=!!a&&a.utcTime,l=it(s.map(e=>e[t]),jt),c=it(s.map(e=>e[i]),jt),u=0===l.length?[null]:l,d=0===c.length?[null]:c;return r&&(u=y.generate(Math.min(...l),Math.max(...l),r,{utc:o})),n&&(d=y.generate(Math.min(...c),Math.max(...c),n,{utc:o})),d.reduce((e,r)=>e.concat(u.map(e=>{var n={};return t&&(n[t]=jt(e)),i&&(n[i]=jt(r)),n})),[])},groupBy:(e,t)=>it(e().map(e=>e[t]),jt).map(e=>({[t]:jt(e)})),none:()=>[null]};class Bt{constructor({key:e,pipe:t,source:i,units:r},n,a={}){this.key=e,this.pipe=t||[],this.source=i,this.units=r,this._frame={key:e,source:i,pipe:this.pipe},this._data=n,this._pipeReducer=((e,t)=>a[t.type](e,t.args))}hash(){return He([this._frame.pipe,this._frame.key,this._frame.source].map(e=>JSON.stringify(e)).join(""))}full(){return this._data}part(e=(e=>e)){return this._frame.pipe.map(e).reduce(this._pipeReducer,this._data)}}var Wt=e=>De(e)?e.getTime():e;const Ht=function(e){Object.keys(e).forEach(t=>this[t]=e[t])},Ut=(e,t,i)=>e.map(e=>"string"==typeof e?i.get(e):e).filter(e=>e).reduce((e,t)=>((e,t={})=>Object.assign(new Ht(e),t))(e,t(e,{})),t);class Gt extends h{constructor(e,t,i,r){super(),st(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||{},this.config=e,this.sources=e.sources,this.scales=e.scales,this.unitSet=i,this.grammarRules=r,this.scalesHub=t,this.transformations=Object.assign(e.transformations||{},{where(e,t){var i=Object.keys(t||{}).map(e=>i=>Wt(i[e])===t[e]);return e.filter(e=>i.every(t=>t(e)))}})}static traverseSpec(e,t,i,r=null,n=null){var a=[],s=(e,t,i,r,n)=>{a.push(()=>{t(e,r,n)}),e.frames&&e.frames.forEach(r=>{(r.units||[]).map(n=>s(n,t,i,e,r))}),a.push(()=>i(e,r,n))};return s(e.unit,t,i,r,n),a}unfoldStructure(){return this.root=this._expandUnitsStructure(this.config.unit),this.config}getDrawScenarioQueue(e){const t=this.grammarRules;var i=this._flattenDrawScenario(e,(e,i,r)=>{const n=!1===i.expression.inherit?null:r,a=this._createFrameScalesFactoryMethod(n),s=this.unitSet.create(i.type,Object.assign({},i,{options:e.allocateRect(r.key)})),o=new Ht(s.defineGrammarModel(a)),l=Ut(s.getGrammarRules(),o,t);return Ut(s.getAdjustScalesRules(),l,t),s.node().screenModel=s.createScreenModel(l),s}),r=this._flattenDrawScenario(e,(e,i,r)=>{const n=!1===i.expression.inherit?null:r,a=this._createFrameScalesFactoryMethod(n),s=this.unitSet.create(i.type,Object.assign({},i,{options:e.allocateRect(r.key)})),o=new Ht(s.defineGrammarModel(a)),l=Ut(s.getGrammarRules(),o,t);return s.node().screenModel=s.createScreenModel(l),s.parentUnit=e,s.addInteraction(),s});return i.concat(()=>{Object.keys(this.scales).forEach(e=>this.scalesHub.createScaleInfo(this.scales[e]).commit())}).concat(r)}_flattenDrawScenario(e,t){var i={},r=[],n=[e],a=Gt.traverseSpec({unit:this.root},(e,a,s)=>{e.uid=(()=>{var t=He((a?`${a.uid}/`:"")+JSON.stringify(Object.keys(e).filter(t=>"string"==typeof e[t]).reduce((t,i)=>(t[i]=e[i],t),{}))+`-${JSON.stringify(s.pipe)}`);return i.hasOwnProperty(t)?t+=`-${++i[t]}`:i[t]=0,t})(),e.guide=$e(e.guide);var o=t((()=>n[0])(),e,s);r.push(o),0===e.type.indexOf("COORDS.")&&(e=>n.unshift(e))(o)},e=>{0===e.type.indexOf("COORDS.")&&(()=>n.shift())()},null,this._datify({source:this.root.expression.source,pipe:[]}));return a.push(()=>r),a}_expandUnitsStructure(e,t=[]){var i=this;if(!1===e.expression.operator)e.frames=e.frames.map(e=>i._datify(e));else{var r=this._parseExpression(e.expression,t,e.guide);e.transformation=e.transformation||[],e.frames=r.exec().map(n=>{var a=(r.inherit?t:[]).concat([{type:"where",args:n}]).concat(e.transformation);return i._datify({key:n,pipe:a,source:r.source,units:e.units?e.units.map(e=>{var t=$e(e);return t.guide=e.guide,t}):[]})})}return e.frames.forEach(e=>e.units.forEach(t=>this._expandUnitsStructure(t,e.pipe))),e}_createFrameScalesFactoryMethod(e){var t=this;return(i,r,n)=>{var a=r||`${i}:default`;return t.scalesHub.createScaleInfo(t.scales[a],e).create("function"==typeof n?n(t.scales[a]):n)}}_datify(e){return new Bt(e,this.sources[e.source].data,this.transformations)}_parseExpression(e,t,i){var r=e.operator||"none",n=e.source,a=!1!==e.inherit,s=e.params,o={source:n,pipe:a?t:[]},l=()=>this._datify(o).part(),c=It[r];if(!c)throw new Error(`${r} operator is not supported`);return{source:n,inherit:a,func:c,args:s,exec:()=>c(l,...s||[],i)}}}var qt=i(10);qt.Tooltip.defaults.baseClass=N+"tooltip";const Xt=["top","bottom"];class Yt extends qt.Tooltip{_pickPlace(e){if(!this.options.auto)return this.options.place;const t=0|this.options.winBound,i=(r=t,{top:(n=function(){const e=window,t=document.documentElement,i=(e.pageYOffset||t.scrollTop)-t.clientTop,r=(e.pageXOffset||t.scrollLeft)-t.clientTop,n=e.innerWidth||t.clientWidth,a=e.innerHeight||t.clientHeight;return{top:i,right:r+n,bottom:i+a,left:r,width:n,height:a}}()).top+r,right:n.right-r,bottom:n.bottom-r,left:n.left+r,width:n.width-2*r,height:n.height-2*r});var r,n,a=this.options.place.split("-"),s=this.spacing;if(-1!==Xt.indexOf(a[0]))switch(e.top-this.height-s<=i.top?a[0]="bottom":e.bottom+this.height+s>=i.bottom&&(a[0]="top"),a[1]){case"left":e.right-this.width<=i.left&&(a[1]="right");break;case"right":e.left+this.width>=i.right&&(a[1]="left");break;default:e.left+e.width/2+this.width/2>=i.right?a[1]="left":e.right-e.width/2-this.width/2<=i.left&&(a[1]="right")}else switch(e.left-this.width-s<=i.left?a[0]="right":e.right+this.width+s>=i.right&&(a[0]="left"),a[1]){case"top":e.bottom-this.height<=i.top&&(a[1]="bottom");break;case"bottom":e.top+this.height>=i.bottom&&(a[1]="top");break;default:e.top+e.height/2+this.height/2>=i.bottom?a[1]="top":e.bottom-e.height/2-this.height/2<=i.top&&(a[1]="bottom")}return a.join("-")}}class Vt{constructor(e,t){this.chart=t,this.handlers=new Map,this.plugins=e.map(this.initPlugin,this)}initPlugin(e){e.init&&e.init(this.chart);const t=[];this.handlers.set(e,t);const i=(i,r)=>{t.push(this.chart.on(i,r,e))};return e.destroy&&i("destroy",e.destroy.bind(e)),Object.keys(e).forEach(t=>{if(0===t.indexOf("on")){const r=t.substr(2).toLowerCase();i(r,e[t].bind(e))}}),e}destroyPlugin(e){e.destroy&&e.destroy(),this.handlers.get(e).forEach(t=>{this.chart.removeHandler(t,e)})}destroy(){this.plugins.forEach(e=>this.destroyPlugin(e))}}var Jt={},Kt={},Zt={reg(e,t,i){return i?(Kt[e]=i,Jt[e]=function(e,t){this.___tauchartsseed___=new t(this.init(e))},Jt[e].prototype=Object.assign({init:e=>e,defineGrammarModel(e){return this.node().defineGrammarModel(e)},getGrammarRules(e){return this.node().getGrammarRules(e)},getAdjustScalesRules(e){return this.node().getAdjustScalesRules(e)},createScreenModel(e){return this.node().createScreenModel(e)},addInteraction(){this.node().addInteraction()},node(){return this.___tauchartsseed___},draw(){this.node().draw()}},t)):Jt[e]=t,this},get(e){if(!Jt.hasOwnProperty(e))throw new x("Unknown unit type: "+e,b.UNKNOWN_UNIT_TYPE);return Jt[e]},create(e,t){var i,r=this.get(e);Kt[e]?i=new r(t,this.get(Kt[e])):i=new r(t);return i}},Qt={},ei={};const ti={reg:(e,t,i=(e=>e))=>(Qt[e]=t,ei[e]=i,ti),get:e=>Qt[e],instance:(e={})=>({create:function(t,i,r){return new(ti.get(t))(i,(0,ei[t])(r,e))}})};class ii{constructor(e,t,i){this.registry=e,this.sources=t,this.scales=i}createScaleInfo(e,t=null){var i=e.dim,r=e.source,n=(this.sources[r].dims[i]||{}).type,a=this.sources[r].data,s=t||new Bt({source:r},a);return e.dimType=n,this.registry.create(e.type,s,e)}createScaleInfoByName(e,t=null){return this.createScaleInfo(this.scales[e],t)}}var ri={isYFunctionOfX:(e,t,i)=>{var r=!0,n=null;try{e.reduce((e,r)=>{var a=(e,t)=>{var i=r[t],n=Pe(i)?JSON.stringify(i):i;return e.push(n),e},s=t.reduce(a,[]).join("/"),o=i.reduce(a,[]).join("/");if(e.hasOwnProperty(s)){var l=e[s];if(l!==o)throw n={type:"RelationIsNotAFunction",keyX:t.join("/"),keyY:i.join("/"),valX:s,errY:[l,o]},new Error("RelationIsNotAFunction")}else e[s]=o;return e},{})}catch(e){if("RelationIsNotAFunction"!==e.message)throw e;r=!1}return{result:r,error:n}},excludeNullValues:(e,t)=>{var i=Object.keys(e).reduce((t,i)=>{var r=e[i];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||t.push(i),t},[]);return e=>{var r=!i.some(t=>!e.hasOwnProperty(t)||null===e[t]);return r||t(e),r}},autoAssignScales:function(e){var t={category:"ordinal",order:"ordinal",measure:"linear"},i={};return Object.keys(e).forEach(r=>{var n=e[r],a=(n.type||"category").toLowerCase();i[r]=Object.assign({},n,{type:a,scale:n.scale||t[a],value:n.value})}),i},autoDetectDimTypes:function(e){var t={type:"category",scale:"ordinal"};return e.reduce((e,i)=>(Object.keys(i).forEach(r=>{var n=i.hasOwnProperty(r)?i[r]:null;if(e[r]=e[r]||{type:null,hasNull:!1},null===n)e[r].hasNull=!0;else{var a=((e,t)=>{var i=t;return De(e)?(i.type="measure",i.scale="time"):Pe(e)?(i.type="order",i.scale="ordinal"):Number.isFinite(e)&&(i.type="measure",i.scale="linear"),i})(n,$e(t)),s=a.type,o=a.scale,l=null!==e[r].type&&e[r].type!==s;e[r].type=l?t.type:s,e[r].scale=l?t.scale:o}}),e),{})},sortByDim:function(e,t,i){var r=e,n=["period","time"].indexOf(i.scale)>=0?e=>new Date(e):e=>e;const a=e.reduce((e,t,i)=>(e.set(t,i),e),new Map);if("measure"===i.type||"period"===i.scale)r=e.slice().sort(ct((e,i)=>n(e[t])-n(i[t]),(e,t)=>a.get(e)-a.get(t)));else if(i.order){var s=i.order.reduce((e,t,i)=>(e[t]=i,e),{}),o=i.order.length,l=`(___${t}___)`;r=e.map(e=>{var i=s[e[t]];return i=i>=0?i:o,e[l]=i,e}).sort(ct((e,t)=>e[l]-t[l],(e,t)=>a.get(e)-a.get(t))).map(e=>(delete e[l],e))}return r}},ni=function(e,t){var i=document.createElement("div");return i.classList.add(N+e),t&&t.appendChild(i),i},ai=function(){var e=ni("layout"),t=ni("layout__header",e),i=ni("layout__container",e),r=ni("layout__sidebar",i),n=ni("layout__content",i),a=ni("layout__content__wrap",n),s=ni("layout__sidebar-right",i);return{layout:e,header:t,content:a,contentContainer:n,leftSidebar:r,rightSidebar:ni("layout__sidebar-right__wrap",s),rightSidebarContainer:s,footer:ni("layout__footer",e)}};class si{constructor(e){this.spec=e,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:e.settings}}convert(){var e=this.spec,t=this.dist;return this.ruleAssignSourceDims(e,t),this.ruleAssignStructure(e,t),this.ruleAssignSourceData(e,t),this.ruleApplyDefaults(t),t}ruleApplyDefaults(e){var t=e.settings||{},i=(e,t,r)=>{t(e,r),(e.units||[]).map(r=>i(r,t,e))};i(e.unit,(e,i)=>{if(e.namespace="chart",e.guide=st(e.guide||{},{animationSpeed:t.animationSpeed||0,utcTime:t.utcTime||!1}),i&&!e.hasOwnProperty("units")){e=st(e,{x:i.x,y:i.y});var r=$e(i.guide)||{};e.guide.x=st(e.guide.x||{},r.x),e.guide.y=st(e.guide.y||{},r.y),e.expression.inherit=i.expression.inherit}return!i||e.guide&&e.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(e.guide=Object.assign(e.guide||{},{obsoleteVerticalStackOrder:(i.guide||{}).obsoleteVerticalStackOrder})),e},null)}ruleAssignSourceData(e,t){var i=e.spec.dimensions||{},r=t.sources["/"].dims,n=(e,t)=>{let i=e[t];return Pe(i)&&!De(i)&&Object.keys(i).forEach(r=>e[t+"."+r]=i[r]),e};t.sources["/"].data=e.data.map(e=>{var t=Object.keys(e).reduce(n,e);return Object.keys(r).reduce((e,t)=>(e.hasOwnProperty(t)||(e[t]=null),null!==e[t]&&i[t]&&["period","time"].indexOf(i[t].scale)>=0&&(e[t]=new Date(e[t])),e),t)})}ruleAssignSourceDims(e,t){var i=e.spec.dimensions;t.sources["/"].dims=Object.keys(i).reduce((e,t)=>(e[t]={type:i[t].type},e),{})}ruleAssignStructure(e,t){var i=e=>{var r=$e(ot(e,"unit"));return this.ruleCreateScales(e,r,t.settings),r.expression=this.ruleInferExpression(e),e.unit&&(r.units=e.unit.map(i)),r},r=i(e.spec.unit);r.expression.inherit=!1,t.unit=r}ruleCreateScales(e,t,i){var r=e.guide||{};["identity","color","size","label","x","y","split"].forEach(n=>{e.hasOwnProperty(n)&&(t[n]=this.scalesPool(n,e[n],r[n]||{},i))})}ruleInferDim(e,t){var i=e,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(i))return i;t.hasOwnProperty("tickLabel")?i=`${e}.${t.tickLabel}`:r[e].value&&(i=`${e}.${r[e].value}`);var n=this.dist.sources["/"].dims;return n.hasOwnProperty(i)||(n[i]={type:n[e].type},delete n[e]),i}scalesPool(e,t,i,r){var n=`${e}_${t}`;if(this.dist.scales.hasOwnProperty(n))return n;var a=this.spec.spec.dimensions,s={};if("color"===e&&null!==t&&(s={type:"color",source:"/",dim:this.ruleInferDim(t,i)},i.hasOwnProperty("brewer")&&(s.brewer=i.brewer),a[t]&&a[t].hasOwnProperty("order")&&(s.order=a[t].order),i.hasOwnProperty("min")&&(s.min=i.min),i.hasOwnProperty("max")&&(s.max=i.max),i.hasOwnProperty("nice")&&(s.nice=i.nice)),"size"===e&&null!==t&&(s={type:"size",source:"/",dim:this.ruleInferDim(t,i)},i.hasOwnProperty("func")&&(s.func=i.func),i.hasOwnProperty("min")&&(s.min=i.min),i.hasOwnProperty("max")&&(s.max=i.max),i.hasOwnProperty("minSize")&&(s.minSize=i.minSize),i.hasOwnProperty("maxSize")&&(s.maxSize=i.maxSize)),"label"===e&&null!==t&&(s={type:"value",source:"/",dim:this.ruleInferDim(t,i)}),"split"===e&&null!==t&&(s={type:"value",source:"/",dim:this.ruleInferDim(t,i)}),"identity"===e&&null!==t&&(s={type:"identity",source:"/",dim:this.ruleInferDim(t,i)}),a.hasOwnProperty(t)&&("x"===e||"y"===e)){if(s={type:a[t].scale,source:"/",dim:this.ruleInferDim(t,i)},a[t].hasOwnProperty("order")&&(s.order=a[t].order),i.hasOwnProperty("min")&&(s.min=i.min),i.hasOwnProperty("max")&&(s.max=i.max),i.hasOwnProperty("autoScale")?s.autoScale=i.autoScale:s.autoScale=!0,i.hasOwnProperty("nice")?s.nice=i.nice:s.nice=s.autoScale,i.hasOwnProperty("niceInterval")?s.niceInterval=i.niceInterval:s.niceInterval=null,i.hasOwnProperty("tickPeriod")&&(s.period=i.tickPeriod,s.type="period"),i.hasOwnProperty("tickPeriod")&&i.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(i.hasOwnProperty("timeInterval")){s.period=i.timeInterval,s.type="time";let e=y.get(s.period,{utc:r.utcTime});i.hasOwnProperty("min")&&(s.min=e.cast(new Date(i.min))),i.hasOwnProperty("max")&&(s.max=e.cast(new Date(i.max)))}s.fitToFrameByDims=i.fitToFrameByDims,s.ratio=i.ratio}return this.dist.scales[n]=s,n}getScaleConfig(e,t){var i=`${e}_${t}`;return this.dist.scales[i]}ruleInferExpression(e){var t={operator:"none",params:[]},i=e.guide||{},r=i.x||{},n=i.y||{},a=this.getScaleConfig("x",e.x),s=this.getScaleConfig("y",e.y);return 0===e.type.indexOf("ELEMENT.")?e.color&&(t={operator:"groupBy",params:[this.ruleInferDim(e.color,i.color||{})]}):"COORDS.RECT"===e.type&&1===e.unit.length&&"COORDS.RECT"===e.unit[0].type&&(t=a.period||s.period?{operator:"cross_period",params:[this.ruleInferDim(e.x,r),this.ruleInferDim(e.y,n),a.period,s.period]}:{operator:"cross",params:[this.ruleInferDim(e.x,r),this.ruleInferDim(e.y,n)]}),Object.assign({inherit:!0,source:"/"},t)}}const oi={...i(6),...i(7)},li=oi.format(".4s"),ci=oi.format(".2r"),ui=oi.format(".1e"),di=(()=>{const e=/\.0+([^\d].*)?$/,t=/(\.\d+?)0+([^\d].*)?$/;return i=>i.replace(e,"$1").replace(t,"$1$2")})();var hi={_identity:(e,t)=>String(null==e?t:e),"x-num-auto":function(e){if(isNaN(e))return"NaN";var t=Math.abs(e);return di(t<1?0===t?"0":t<1e-6?ui(e):ci(e):li(e))},percent:function(e){return parseFloat((100*e).toFixed(2)).toString()+"%"},day:oi.timeFormat("%d-%b-%Y"),"day-utc":oi.utcFormat("%d-%b-%Y"),"day-short":oi.timeFormat("%d-%b"),"day-short-utc":oi.utcFormat("%d-%b"),week:oi.timeFormat("%d-%b-%Y"),"week-utc":oi.utcFormat("%d-%b-%Y"),"week-short":oi.timeFormat("%d-%b"),"week-short-utc":oi.utcFormat("%d-%b"),month:e=>{var t=0===new Date(e).getMonth()?"%B, %Y":"%B";return oi.timeFormat(t)(e)},"month-utc":e=>{var t=0===new Date(e).getUTCMonth()?"%B, %Y":"%B";return oi.utcFormat(t)(e)},"month-short":e=>{var t=0===new Date(e).getMonth()?"%b '%y":"%b";return oi.timeFormat(t)(e)},"month-short-utc":e=>{var t=0===new Date(e).getUTCMonth()?"%b '%y":"%b";return oi.utcFormat(t)(e)},"month-year":oi.timeFormat("%B, %Y"),"month-year-utc":oi.utcFormat("%B, %Y"),quarter:e=>{var t=new Date(e),i=t.getMonth();return"Q"+((i-i%3)/3+1)+" "+t.getFullYear()},"quarter-utc":e=>{var t=new Date(e),i=t.getUTCMonth();return"Q"+((i-i%3)/3+1)+" "+t.getUTCFullYear()},year:oi.timeFormat("%Y"),"year-utc":oi.utcFormat("%Y"),"x-time-auto":null},gi={get:(e,t)=>{var i=hi._identity,r=hi.hasOwnProperty(e),n=r?hi[e]:i;return r&&(n=hi[e]),!r&&e&&(n=(t=>{return(De(t)?oi.timeFormat(e):oi.format(e))(t)})),r||e||(n=i),null!==n?e=>n(e,t||""):null},add:(e,t)=>{hi[e]=t}},pi=e=>e.reduce((e,t)=>e+t,0);var fi=(e,t)=>{var i=t.guide||{},r={x:["label"],y:["label"],size:["label"],color:["label"],padding:[]};return Object.keys(r).forEach(t=>{let n=r[t];!function(e,t,i,r){var n=e.hasOwnProperty(i)?e[i]:{};n=n||{},r.forEach(e=>{Object.assign(t.guide[i][e],n[e])})}(i,e,t,n)}),Object.assign(e.guide,Object.keys(i).reduce((e,t)=>(r.hasOwnProperty(t)||(e[t]=i[t]),e),{})),e},mi=function(e,t,i){return e[t]=st(e[t]||{},{label:""}),e[t].label=Pe(e[t].label)?e[t].label:{text:e[t].label},e[t].label=st(e[t].label,i||{},{padding:32,rotate:0,textAnchor:"middle",cssClass:"label",dock:null}),e[t]},yi=function(e,t,i){return e[t]=st(e[t],i||{},{padding:0,density:30,rotate:0,tickPeriod:null,tickFormat:null,autoScale:!0}),e[t].tickFormat=e[t].tickFormat||e[t].tickPeriod,e[t].nice=e[t].hasOwnProperty("nice")?e[t].nice:e[t].autoScale,e[t]},xi=e=>{var t=e.units||[],i=!e.hasOwnProperty("units"),r=!t.some(e=>e.hasOwnProperty("units"));return{type:e.type,isLeaf:i,isLeafParent:!i&&r}},bi=function(e,t,i,r){if(0===e.length)return{width:0,height:0};if(null===t){var n=i("TauChart Library");return n.width=.625*r,n}e.every(e=>"number"==typeof e)&&(e=l.scaleLinear().domain(e).ticks());var a=e.reduce((e,i)=>{let r=t(i).toString().length;return!e.computed||r>e.computed?{value:i,computed:r}:e},{}).value;return i(t(a))},vi=(e,t)=>{var i=e.dimType,r=e.scaleType,n=[i,r,"*"].join(":"),a=[i,r].join(":");return t[n]||t[a]||t[i]||null},wi=(e,t,i)=>e.hasOwnProperty(`${t}:${i}`)?e[`${t}:${i}`]:e[`${t}`],_i=(e,t)=>{return["day","week","month"].indexOf(e)>=0&&(e+=`-short${t?"-utc":""}`),e},Si=({width:e,height:t},i)=>{var r=Math.abs(Je(i));return{width:Math.max(Math.cos(r)*e,t),height:Math.max(Math.sin(r)*e,t)}},Mi=(e,t="x")=>{var i=Ke(e),r="x"===t?[[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"]],n=r.findIndex(e=>i>=e[0]&&i{let r=Math.ceil(e.width/t);return{height:Math.min(r,i)*e.height,width:t}};function Ei(e,t,i,r,n,a){var s=i.values,o=r.values,l=i.isEmpty||e.x.hideTicks,c=r.isEmpty||e.y.hideTicks,u=bi(s,gi.get(e.x.tickFormat,e.x.tickFormatNullAlias),t.getAxisTickLabelSize,t.xAxisTickLabelLimit),d=bi(o,gi.get(e.y.tickFormat,e.y.tickFormatNullAlias),t.getAxisTickLabelSize,t.yAxisTickLabelLimit),h=u,g=d;u.width>t.xAxisTickLabelLimit&&(e.x.tickFormatWordWrap=!0,e.x.tickFormatWordWrapLines=t.xTickWordWrapLinesLimit,h=ki(u,t.xAxisTickLabelLimit,t.xTickWordWrapLinesLimit)),d.width>t.yAxisTickLabelLimit&&(e.y.tickFormatWordWrap=!0,e.y.tickFormatWordWrapLines=t.yTickWordWrapLinesLimit,g=ki(d,t.yAxisTickLabelLimit,t.yTickWordWrapLinesLimit)),a&&(e.y.tickFormatWordWrap=!1,e.y.tickFormatWordWrapLines=1,(g=ki(d,2*t.yAxisTickLabelLimit,1)).width=20);var p=l?0:1,f=c?0:1,m=e.x.label,y=e.y.label,x=m.text&&!m.hide?1:0,b=y.text&&!y.hide?1:0,v=Si(h,e.x.rotate),w=Si(g,e.y.rotate);n?(m.padding=(-t.xAxisPadding-t.xFontLabelHeight)/2+t.xFontLabelHeight,m.paddingNoTicks=m.padding,y.padding=(-t.yAxisPadding-t.yFontLabelHeight)/2,y.paddingNoTicks=y.padding,x=0,b=0):(m.padding=pi([p*(t.xTickWidth+v.height),x*(t.distToXAxisLabel+t.xFontLabelHeight)]),m.paddingNoTicks=x*(t.distToXAxisLabel+t.xFontLabelHeight),y.padding=pi([f*(t.yTickWidth+w.width),b*t.distToYAxisLabel]),y.paddingNoTicks=b*t.distToYAxisLabel),a&&(y.padding=0,y.paddingNoTicks=0);const _=t.xFontLabelDescenderLineHeight;return e.padding=Object.assign(e.padding,{b:e.x.hide?0:pi([e.x.padding,p*(t.xTickWidth+v.height),x*(t.distToXAxisLabel+t.xFontLabelHeight+_)]),l:e.y.hide?0:pi([e.y.padding,a?0:f*(t.yTickWidth+w.width),b*(t.distToYAxisLabel+t.yFontLabelHeight)])}),e.paddingNoTicks=Object.assign({},e.paddingNoTicks,{b:e.x.hide?0:pi([e.x.padding,x*(t.distToXAxisLabel+t.xFontLabelHeight+_)]),l:e.y.hide?0:pi([e.y.padding,b*(t.distToYAxisLabel+t.yFontLabelHeight)])}),e.x=Object.assign(e.x,{density:v.width+2*wi(t,"xDensityPadding",i.dimType),tickFontHeight:u.height,$minimalDomain:s.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:t.xAxisTickLabelLimit}),e.y=Object.assign(e.y,{density:w.height+2*wi(t,"yDensityPadding",r.dimType),tickFontHeight:d.height,$minimalDomain:o.length,$maxTickTextW:g.width,$maxTickTextH:g.height,tickFormatWordWrapLimit:t.yAxisTickLabelLimit}),e}var Ai=function({unit:e,meta:t,settings:i,allowXVertical:r,allowYVertical:n,inlineLabels:a}){var s=t.dimension(e.x),o=t.dimension(e.y),l=t.scaleMeta(e.x,e.guide.x),c=t.scaleMeta(e.y,e.guide.y),u=l.isEmpty,d=c.isEmpty;e.guide.x.tickFormat=_i(e.guide.x.tickFormat||vi(s,i.defaultFormats),i.utcTime),e.guide.y.tickFormat=_i(e.guide.y.tickFormat||vi(o,i.defaultFormats),i.utcTime);var h=!!r&&!("measure"===s.dimType),g=!!n&&!("measure"===o.dimType);if(e.guide.x.padding=u?0:i.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=d?0:i.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=Mi(e.guide.x.rotate,"x"),e.guide.y.rotate=g?-90:0,e.guide.y.textAnchor=Mi(e.guide.y.rotate,"y"),e.guide=Ei(e.guide,i,l,c,a,wt(e)),a){let t=e.guide.x.label,i=e.guide.y.label;t.cssClass+=" inline",t.dock="right",t.textAnchor="end",i.cssClass+=" inline",i.dock="right",i.textAnchor="end"}return e},Ti={NONE:(e,t,i)=>{var r=$e(e);return Oi($e(r.unit),r.unit,(e,t)=>(t.guide.x.tickFontHeight=i.getAxisTickLabelSize("X").height,t.guide.y.tickFontHeight=i.getAxisTickLabelSize("Y").height,t.guide.x.tickFormatWordWrapLimit=i.xAxisTickLabelLimit,t.guide.y.tickFormatWordWrapLimit=i.yAxisTickLabelLimit,t)),r},"BUILD-LABELS":(e,t)=>{var i=$e(e),r=[],n=[],a=null,s=null;Me(i.unit,"units",xi,(e,i)=>{if(e.isLeaf)return i;!a&&i.x&&(a=i),!s&&i.y&&(s=i),i.guide=i.guide||{},i.guide.x=i.guide.x||{label:{text:""}},i.guide.y=i.guide.y||{label:{text:""}},i.guide.x.label=Pe(i.guide.x.label)?i.guide.x.label:{text:i.guide.x.label&&i.guide.x.label.text?i.guide.x.label.text:""},i.guide.y.label=Pe(i.guide.y.label)?i.guide.y.label:{text:i.guide.y.label&&i.guide.y.label.text?i.guide.y.label.text:""},i.x&&(i.guide.x.label.text=i.guide.x.label.text||t.dimension(i.x).dimName),i.y&&(i.guide.y.label.text=i.guide.y.label.text||t.dimension(i.y).dimName);var o=i.guide.x.label.text;o&&(r.push(o),i.guide.x.tickFormatNullAlias=i.guide.x.hasOwnProperty("tickFormatNullAlias")?i.guide.x.tickFormatNullAlias:"No "+o,i.guide.x.label.text="",i.guide.x.label._original_text=o);var l=i.guide.y.label.text;return l&&(n.push(l),i.guide.y.tickFormatNullAlias=i.guide.y.hasOwnProperty("tickFormatNullAlias")?i.guide.y.tickFormatNullAlias:"No "+l,i.guide.y.label.text="",i.guide.y.label._original_text=l),i});return a&&(a.guide.x.label.text=a.guide.x.label.hide?"":r.join(" → ")),s&&(s.guide.y.label.text=s.guide.y.label.hide?"":n.join(" → ")),i},"BUILD-GUIDE":(e,t,i)=>{var r=$e(e);return Oi($e(r.unit),r.unit,(e,r)=>{if(e.isLeaf)return r;var n=!e.isLeaf&&!e.isLeafParent,a=t.scaleMeta(r.x,r.guide.x),s=t.scaleMeta(r.y,r.guide.y),o=!n&&Boolean(a.dimType)&&"measure"!==a.dimType;return r.guide.x.rotate=r.guide.x.rotate||(o?-90:0),r.guide.x.textAnchor=Mi(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||vi(a,i.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||vi(s,i.defaultFormats),r.guide.x.padding=n?0:i.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=n?0:i.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Ei(r.guide,st({distToXAxisLabel:a.isEmpty?i.xTickWidth:i.distToXAxisLabel,distToYAxisLabel:s.isEmpty?i.yTickWidth:i.distToYAxisLabel},i),a,s,null,wt(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:n?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!n||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:n?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!n&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:e.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":(e,t,i)=>{var r=$e(e);return Oi($e(r.unit),r.unit,(e,r)=>e.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=e.isLeafParent?"xy":""),e.isLeafParent?Ai({unit:r,meta:t,settings:st({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},i),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,Ai({unit:r,meta:t,settings:st({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},i),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))),r},AUTO:(e,t,i)=>["BUILD-LABELS","BUILD-GUIDE"].reduce((e,r)=>Ti[r](e,t,i),e),COMPACT:(e,t,i)=>["BUILD-LABELS","BUILD-COMPACT"].reduce((e,r)=>Ti[r](e,t,i),e)},Oi=(e,t,i)=>{var r=(e=>(e.options=e.options||{},e.guide=e.guide||{},e.guide.padding=st(e.guide.padding||{},{l:0,b:0,r:0,t:0}),e.guide.x=mi(e.guide,"x"),e.guide.x=yi(e.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),e.guide.y=mi(e.guide,"y",{rotate:-90}),e.guide.y=yi(e.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),e.guide.size=mi(e.guide,"size"),e.guide.color=mi(e.guide,"color"),e))(t);r=i(xi(r),r);var n=ot(r=fi(r,e),"units");return(r.units||[]).forEach(e=>Oi($e(e),((e,t)=>(e.guide=e.guide||{},e.guide.padding=e.guide.padding||{l:0,t:0,r:0,b:0},e.hasOwnProperty("units")||((e=st(e,t)).guide=st(e.guide,$e(t.guide)),e.guide.x=st(e.guide.x,$e(t.guide.x)),e.guide.y=st(e.guide.y,$e(t.guide.y))),e))(e,n),i)),r},Ci={get:(e,t,i,r)=>{var n={dimension:e=>{var t=i.scales[e],r=i.sources[t.source].dims[t.dim]||{};return{dimName:t.dim,dimType:r.type,scaleType:t.type}},scaleMeta:e=>{var t=r("pos",e).domain(),n=i.scales[e],a=i.sources[n.source].dims[n.dim]||{};return{dimName:n.dim,dimType:a.type,scaleType:n.type,values:t,isEmpty:null==a.type}}},a=(Ti[e]||Ti.NONE)({unit:$e(i.unit)},n,t);return i.unit=a.unit,i}};class Ni{constructor(e){this.spec=e,this.isApplicable=Ge(e.unit)}transform(e){var t=this.spec;if(!this.isApplicable)return t;var i=t.settings.size,r=t.settings.specEngine.find(e=>i.width<=e.width||i.height<=e.height);return Ci.get(r.name,t.settings,t,(t,i)=>e.getScaleInfo(i||`${t}:default`))}}class Li{static optimizeXAxisLabel(e,t){const{xAxisTickLabelLimit:i}=t,r=e=>{if(!e.guide.x.hide&&!e.guide.x.hideTicks&&0!==e.guide.x.rotate){e.guide.x.rotate=0,e.guide.x.textAnchor="middle";var t=0-Math.min(i,e.guide.x.$maxTickTextW)+e.guide.x.$maxTickTextH;n(e,t)}(e.units||[]).filter(e=>"COORDS.RECT"===e.type).forEach(e=>r(e))},n=(t,i)=>{e!==t&&"extract-axes"===t.guide.autoLayout?(e.guide.x.padding+=i,e.guide.padding.b+=i):(t.guide.x.label.padding+=t.guide.x.label.padding>0?i:0,t.guide.padding.b+=t.guide.padding.b>0?i:0)};r(e)}static hideAxisTicks(e,t,i){const r=e=>{const t="x"===i?"b":"l",n=e.guide;if(!n[i].hide&&!n[i].hideTicks){wt(e)&&"y"===i||(n[i].hideTicks=!0);var a=n[i].label.text&&!n[i].label.hide;n.padding[t]=n.paddingNoTicks?n.paddingNoTicks[t]:0,n[i].padding=n[i].paddingNoTicks||0,n[i].label.padding=a?n[i].label.paddingNoTicks:0}(e.units||[]).filter(e=>"COORDS.RECT"===e.type).forEach(e=>r(e))};r(e)}static facetsLabelsAtTop(e,t){const i=e=>{const t=e.units||[];if(wt(e)){const i=e.guide;i.y.facetAxis=!0,i.y.rotate=0,i.y.textAnchor="start",t.forEach(e=>{e.guide.padding.t=20})}t.filter(e=>"COORDS.RECT"===e.type).forEach(e=>i(e))};i(e)}}var Fi=e=>e.$maxTickTextW,zi=e=>0==e.rotate?e.$maxTickTextW:e.$maxTickTextH,Ri=e=>e.density,$i=e=>{var t=[],i=[],r=e=>{if("COORDS.RECT"===e.type&&e.units&&e.units[0]&&"COORDS.RECT"===e.units[0].type){var n=e.x.replace(/^x_/,""),a=e.y.replace(/^y_/,"");"null"!==n&&t.push(n),"null"!==a&&i.push(a),e.units.forEach(r)}};r(e.unit);var n={},a={},s=e=>{"COORDS.RECT"===e.type&&e.frames.forEach(e=>{e.key&&(Object.keys(e.key).forEach(r=>{t.indexOf(r)>=0&&(n.hasOwnProperty(r)||(n[r]=[]),n[r].indexOf(e.key[r])<0&&n[r].push(e.key[r])),i.indexOf(r)>=0&&(a.hasOwnProperty(r)||(a[r]=[]),a[r].indexOf(e.key[r])<0&&a[r].push(e.key[r]))}),e.units&&e.units.forEach(s))})};return s(e.unit),{xFacetCount:Object.keys(n).reduce((e,t)=>e*n[t].length,1),yFacetCount:Object.keys(a).reduce((e,t)=>e*a[t].length,1)}},Di={"entire-view"(e,t,i,r){var n=i.unit.guide,{xFacetCount:a,yFacetCount:s}=$i(i);s>0&&Li.facetsLabelsAtTop(i.unit,i.settings);var o=n.paddingNoTicks?n.padding.l-n.paddingNoTicks.l:0,l=n.paddingNoTicks?n.padding.b-n.paddingNoTicks.b:0,c=n.paddingNoTicks&&e.height-le.height||a*i.settings.minFacetWidth+o>e.width,u=n.paddingNoTicks&&e.width-oe.height||a*i.settings.minFacetWidth+o>e.width;c&&Li.hideAxisTicks(i.unit,i.settings,"x"),u&&Li.hideAxisTicks(i.unit,i.settings,"y");var d=e.width;if(t("x",i.unit,Fi)<=e.width)r(i.unit,i.settings);else{var h=t("x",i.unit,zi);if(h>e.width){var g=Math.max(e.width,t("x",i.unit,Ri));d=Math.min(h,g)}}var p=Math.max(e.height,t("y",i.unit,Ri));return!c&&d>e.width&&Li.hideAxisTicks(i.unit,i.settings,"x"),!u&&p>e.height&&Li.hideAxisTicks(i.unit,i.settings,"y"),{newW:e.width,newH:e.height}},minimal:(e,t,i)=>({newW:t("x",i.unit,Ri),newH:t("y",i.unit,Ri)}),normal(e,t,i,r){const{yFacetCount:n}=$i(i);n>0&&Li.facetsLabelsAtTop(i.unit,i.settings);var a=i.unit.guide;a.paddingNoTicks&&(e.width-a.padding.l+a.paddingNoTicks.le.width){var l=Math.max(e.width,t("x",i.unit,Ri));s=Math.min(o,l)}}return{newW:s,newH:Math.max(e.height,t("y",i.unit,Ri))}},"fit-width"(e,t,i,r){var n=i.unit.guide,a=n.paddingNoTicks?n.padding.l-n.paddingNoTicks.l:0;return(n.paddingNoTicks&&e.width-ae.width)&&Li.hideAxisTicks(i.unit,i.settings,"y"),t("x",i.unit,Fi)<=e.width&&r(i.unit,i.settings),{newW:e.width,newH:t("y",i.unit,Ri)}},"fit-height"(e,t,i){var r=i.unit.guide,n=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&e.height-ne.height)&&Li.hideAxisTicks(i.unit,i.settings,"x"),{newW:t("x",i.unit,Ri),newH:e.height}}};class Pi{constructor(e){this.spec=e,this.isApplicable=Ge(e.unit)}transform(e){var t=this.spec;if(!this.isApplicable)return t;var i=t.settings.fitModel;if(!i)return t;var r=t.scales,n=(e,t)=>{return e.discrete?t*e.domain().length:4*t},a=(t,i,s,o=null)=>{var l="x"===t?i.x:i.y,c="x"===t?i.y:i.x,u=i.guide,d=s("x"===t?u.x:u.y);const h=i.units[0];var g="x"===t?u.padding.l+u.padding.r:u.padding.b+u.padding.t;if("ELEMENT.INTERVAL"===h.type&&"y"===t===Boolean(h.flip)&&h.label&&!e.getScaleInfo(h.label,o).isEmpty()){const t=2*(u.label&&u.label.fontSize?u.label.fontSize:10),r=e.getScaleInfo(l,o);let a;if(r.discrete&&(null==h.guide.enableColorToBarPosition?!h.stack:h.guide.enableColorToBarPosition)){const t=h.color;if(t){const i=e.getScaleInfo(t,o);if(i.discrete){i.domain();a=i}}}const s=e=>{const i=e.part(),n=it(i.map(e=>e[r.dim])).length;let s=1;if(a){const e=i.reduce((e,t)=>{const i=t[r.dim],n=t[a.dim];return e[i]=e[i]||{},e[i][n]||(e[i][n]=!0),e},{}),t=Object.keys(e).map(t=>Object.keys(e[t]).length);s=Math.max(...t)}return n*s*t},c=i.frames.reduce((e,t)=>e+s(t),0),p=n(r,d);return g+Math.max(c,p)}if("COORDS.RECT"!==h.type){var p=e.getScaleInfo(l,o);return g+n(p,d)}var f=((e,t)=>e.reduce((e,i)=>{var r=(i.key||{})[t];return e[r]=e[r]||[],e[r].push(i),e},{}))(i.frames,r[c].dim),m=Object.keys(f).map(e=>f[e].map(e=>a(t,e.units[0],s,e)).reduce((e,t)=>e+t,0));return g+Math.max(...m)},s=t.settings.size,o=s.width,l=s.height,c=Di[i];if(c){let e=c(s,a,t,Li.optimizeXAxisLabel);o=e.newW,l=e.newH}return t.settings.size=((i,r,n)=>{var a=t.settings.getScrollbarSize(e.getLayout().contentContainer),s=r.width>i.width&&r.width<=i.width*n?i.width:r.width,o=r.height>i.height&&r.height<=i.height*n?i.height:r.height,l=i.width-s,c=i.height-o>=0?0:a.width;return{height:o-(l>=0?0:a.height),width:s-c}})(s,{width:o,height:l},t.settings.avoidScrollAtRatio),t}}class ji{constructor(e){this.spec=e,this.isApplicable=e.settings.autoRatio&&Ge(e.unit)}transform(e){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleApplyRatio(t,e)}catch(e){if("Not applicable"!==e.message)throw e}return t}ruleApplyRatio(e,t){var i=e=>"COORDS.RECT"===e.type||"RECT"===e.type,r=(e,t,i,n=0)=>{t(e,n)&&(e.units||[]).map(e=>r(e,t,i,n+1)),i(e,n)},n=[],a=[];r(e.unit,(e,t)=>{if(t>1||!i(e))throw new Error("Not applicable");return n.push(e.x),a.push(e.y),1===(e.units||[]).map(e=>{if(!i(e)&&!(e=>0===e.type.indexOf("ELEMENT."))(e))throw new Error("Not applicable");return e}).filter(i).length},()=>0);var s=t=>e.scales[t],o=e=>"/"===e.source&&!e.ratio&&!e.fitToFrameByDims,l=e=>"ordinal"===e.type||"period"===e.type&&!e.period,c=n.map(s).filter(o),u=a.map(s).filter(o);if([c.length,u.length].some(e=>2===e)){let e=e=>e.dim,i=(t,i,r)=>{t.fitToFrameByDims=r.slice(0,i).map(e)},r=(r,n)=>{2===n.filter(l).length&&(n.forEach(i),n[0].ratio=Ue(r,n.map(e),t))};r("x",c),r("y",u)}}}class Ii{constructor(e){this.spec=e,this.isApplicable="EXTRACT"===e.settings.layoutEngine&&Ge(e.unit)}transform(){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleExtractAxes(e)}catch(e){if("Not applicable"!==e.message)throw e;console.log("[TauCharts]: can't extract axes for the given chart specification")}return e}ruleExtractAxes(e){var t=e=>"COORDS.RECT"===e.type||"RECT"===e.type,i=e=>e?10:0,r={l:0,r:10,t:10,b:0},n={l:0,b:0},a=[],s=[];ke(e.unit,(e,i)=>{if(i>1||!t(e))throw new Error("Not applicable");e.guide=e.guide||{};var o=e.guide,l=o.padding||{l:0,r:0,t:0,b:0},c=o.paddingNoTicks||{l:0,b:0};return r.l+=l.l,r.r+=l.r,r.t+=l.t,r.b+=l.b,n.l+=c.l,n.b+=c.b,a.push(Object.assign({},r)),s.push(Object.assign({},n)),1===(e.units||[]).map(e=>{if(!t(e)&&!(e=>0===e.type.indexOf("ELEMENT."))(e))throw new Error("Not applicable");return e}).filter(t).length},e=>{var t=a.pop(),o=s.pop(),l=e.guide||{};l.x=l.x||{},l.x.padding=l.x.padding||0,l.x.paddingNoTicks=l.x.paddingNoTicks||0,l.y=l.y||{},l.y.padding=l.y.padding||0,l.y.paddingNoTicks=l.y.paddingNoTicks||0,l.padding={l:i(e.y),r:i(1),t:i(1),b:i(e.x)},l.paddingNoTicks={l:0,b:0},l.autoLayout="extract-axes",l.x.padding+=r.b-t.b,l.y.padding+=r.l-t.l,l.x.paddingNoTicks+=n.b-o.b,l.y.paddingNoTicks+=n.l-o.l}),e.unit.guide.padding=r,e.unit.guide.paddingNoTicks=n}}class Bi{constructor({src:e=null,timeout:t=Number.MAX_SAFE_INTEGER,syncInterval:i=Number.MAX_SAFE_INTEGER,callbacks:r={}}={}){this.setTimeoutDuration(t),this.setSyncInterval(i),this.setCallbacks(r),this._running=!1,this._queue=[],this._result=e,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=(()=>{if(!this._running||!this._requestedFrameId)return;const e=this._getCancelFrameFunction(),t=this._getRequestFrameFunction();e(this._requestedFrameId),this._requestedFrameId=t(this._requestedFrameCallback)}),this._tasksCount=0,this._finishedTasksCount=0}setTimeoutDuration(e){Bi.checkType(e,"number","timeout"),this._timeout=e}setSyncInterval(e){Bi.checkType(e,"number","syncInterval"),this._syncInterval=e}setCallbacks(e){Bi.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)}addTask(e){return this._queue.push(e),this._tasksCount++,this}run(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,Bi.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()}isRunning(){return this._running}_loopTasks(){for(var e,t,i,r,n=0,a=this._syncInterval/Bi.runnersInProgress;this._running&&!(i=this._asyncDuration>this._timeout)&&!(r=n>a)&&(e=this._queue.shift());){if(null===(t=this._runTask(e)))return;this._syncDuration+=t,this._asyncDuration+=t,n+=t}i&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!i&&r&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))}_runTask(e){var t=performance.now();if(this._callbacks.error)try{this._result=e.call(null,this._result,this)}catch(e){return this.stop(),this._callbacks.error.call(null,e,this),null}else this._result=e.call(null,this._result,this);var i=performance.now()-t;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),i}_requestFrame(){const e=performance.now(),t=()=>{this._requestedFrameId=null;const t=performance.now();this._asyncDuration+=t-e,this._loopTasks()},i=this._getRequestFrameFunction();this._requestedFrameCallback=t,this._requestedFrameId=i(t)}_getRequestFrameFunction(){return document.hidden?e=>(this._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})):e=>(this._requestedFrameType="animation",requestAnimationFrame(e))}_getCancelFrameFunction(){switch(this._requestedFrameType){case"animation":return e=>cancelAnimationFrame(e);case"idle":return e=>window.cancelIdleCallback(e)}}stop(){if(!this._running)throw new Error("Task Runner is already stopped");if(this._running=!1,Bi.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId){this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null}}static checkType(e,t,i){if(typeof e!==t)throw new Error(`Task Runner "${i}" property is not "${t}"`)}}Bi.runnersInProgress=0;var Wi=Bi;const Hi={...s};var Ui=Ft,Gi=zt;class qi extends h{on(e,t,i){return super.on(e,t,i)}constructor(e){super(),this._nodes=[],this._svg=null,this._filtersStore={filters:{},tick:0},this._layout=ai(),this.transformers=[ji,Ni],this.onUnitsStructureExpandedTransformers=[Ii,Pi],this._chartDataModel=(e=>e),this._reportProgress=null,this._taskRunner=null,this._renderingPhase=null,this.applyConfig(e)}updateConfig(e){this.applyConfig(e),this.refresh()}applyConfig(e){this._filtersStore.filters={},e=this.setupConfigSettings(e),this.configGPL=this.createGPLConfig(e),this._originData=Object.assign({},this.configGPL.sources),this._liveSpec=this.configGPL,this._emptyContainer=e.emptyContainer||"",this.setupPlugins(e)}createGPLConfig(e){let t;return this.isGPLConfig(e)?t=e:(e=this.setupConfig(e),t=new si(e).convert()),t=qi.setupPeriodData(t)}isGPLConfig(e){return 2===["sources","scales"].filter(t=>e.hasOwnProperty(t)).length}setupPlugins(e){const t=e.plugins||[];this._plugins&&this._plugins.destroy(),this._plugins=new Vt(t,this)}setupConfigSettings(e){return this._dataRefs=this._dataRefs||(()=>{let e=0;return{references:new WeakMap,refCounter:()=>++e}})(),e.settings=qi.setupSettings(st(e.settings||{},this._dataRefs)),e}destroy(){this.destroyNodes(),Hi.select(this._svg).remove(),Hi.select(this._layout.layout).remove(),this._cancelRendering(),super.destroy()}setupChartSourceModel(e){this._chartDataModel=e}setupConfig(e){if(!e.spec||!e.spec.unit)throw new Error("Provide spec for plot");var t=st(e,{spec:{},data:[],plugins:[],settings:{}});t.spec.dimensions=qi.setupMetaInfo(t.spec.dimensions,t.data);var i=t.settings.log;return t.settings.excludeNull&&this.addFilter({tag:"default",src:"/",predicate:ri.excludeNullValues(t.spec.dimensions,e=>i([e,"point was excluded, because it has undefined values."],"WARN"))}),t}static setupPeriodData(e){var t=qi.__api__.tickPeriod,i=e.settings.log;return Object.keys(e.scales).map(t=>e.scales[t]).filter(e=>"period"===e.type).forEach(r=>{t.get(r.period,{utc:e.settings.utcTime})||(i([`Unknown period "${r.period}".`,"Docs: https://api.taucharts.com/plugins/customticks.html#how-to-add-custom-tick-period"],"WARN"),r.period=null)}),e}static setupMetaInfo(e,t){var i=e||ri.autoDetectDimTypes(t);return ri.autoAssignScales(i)}static setupSettings(e){var t=qi.globalSettings,i=st(e||{},Object.keys(t).reduce((e,i)=>(e[i]="function"==typeof t[i]?t[i]:$e(t[i]),e),{}));return Array.isArray(i.specEngine)||(i.specEngine=[{width:Number.MAX_VALUE,name:i.specEngine}]),i}insertToLeftSidebar(e){return Mt(e,this._layout.leftSidebar)}insertToRightSidebar(e){return Mt(e,this._layout.rightSidebar)}insertToFooter(e){return Mt(e,this._layout.footer)}insertToHeader(e){return Mt(e,this._layout.header)}addBalloon(e){return new Yt("",e||{})}destroyNodes(){this._nodes.forEach(e=>e.destroy()),this._nodes=[],this._renderedItems=[]}onUnitDraw(e){this._nodes.push(e),this.fire("unitdraw",e),["click","mouseover","mouseout"].forEach(t=>e.on(t,(e,i)=>{this.fire(`element${t}`,{element:e,data:i.data,event:i.event})}))}onUnitsStructureExpanded(e){this.onUnitsStructureExpandedTransformers.forEach(t=>new t(e).transform(this)),this.fire("unitsstructureexpanded",e)}_getClosestElementPerUnit(e,t){return this._renderedItems.filter(e=>e.getClosestElement).map(i=>{var r=i.getClosestElement(e,t);return{unit:i.node(),closest:r}})}disablePointerEvents(){this._layout.layout.style.pointerEvents="none"}enablePointerEvents(){this._layout.layout.style.pointerEvents=""}_handlePointerEvent(e){const t=this._svg.getBoundingClientRect(),i=e.clientX-t.left,r=e.clientY-t.top,n="click"===e.type?"data-click":"data-hover";var a=null,s=null,o=null;const l=this._getClosestElementPerUnit(i,r),c=l.filter(e=>e.closest).sort((e,t)=>e.closest.distance===t.closest.distance?e.closest.secondaryDistance-t.closest.secondaryDistance:e.closest.distance-t.closest.distance);if(c.length>0){const e=c.findIndex(e=>e.closest.distance!==c[0].closest.distance||e.closest.secondaryDistance!==c[0].closest.secondaryDistance),t=e<0?c:c.slice(0,e);if(1===t.length)a=t[0].closest.data,s=t[0].closest.node,o=t[0].unit;else{const e=t.reduce((e,t)=>e+t.closest.x,0)/t.length,n=t.reduce((e,t)=>e+t.closest.y,0)/t.length,l=Math.atan2(n-r,e-i)+Math.PI,c=Math.round((t.length-1)*l/2/Math.PI),{closest:u}=t[c];a=u.data,s=u.node,o=t[c].unit}}l.forEach(t=>t.unit.fire(n,{event:e,data:a,node:s,unit:o}))}_initPointerEvents(){this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);const e=Hi.select(this._svg),t=this._liveSpec.settings.syncPointerEvents?e=>()=>e(s.event):e=>()=>{var t=s.event;this._pointerAnimationFrameId&&"mousemove"!==t.type&&this._cancelPointerAnimationFrame(),this._pointerAnimationFrameId||(this._pointerAnimationFrameId=requestAnimationFrame(()=>{this._pointerAnimationFrameId=null,e(t)}))},i=e=>this._handlePointerEvent(e);e.on("mousemove",t(i)),e.on("click",t(i)),e.on("mouseleave",t(e=>{"none"!==window.getComputedStyle(this._svg).pointerEvents&&this.select(()=>!0).forEach(t=>t.fire("data-hover",{event:e,data:null,node:null,unit:null}))}))}_cancelPointerAnimationFrame(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null}_setupTaskRunner(e){return this._resetTaskRunner(),this._taskRunner=new Wi({timeout:e.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:e.settings.asyncRendering?e.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:()=>{this._completeRendering(),this._renderingPhase=null},timeout:(e,t)=>{this._displayTimeoutWarning({timeout:e,proceed:()=>{this.disablePointerEvents(),t.setTimeoutDuration(Number.MAX_SAFE_INTEGER),t.run()},cancel:()=>{this._cancelRendering()}}),this.enablePointerEvents(),this.fire("renderingtimeout",e)},progress:e=>{var t={spec:0,draw:1}[this._renderingPhase]/2+e/2;this._reportProgress(t)},error:e.settings.handleRenderingErrors?t=>{this._cancelRendering(),this._displayRenderingError(t),this.fire("renderingerror",t),e.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',`Error message: ${t.message}`].join(" "),"ERROR")}:null}}),this._taskRunner}_resetTaskRunner(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)}renderTo(e,t){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(e,t);const i=this._createLiveSpec();if(!i)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(i),n=this._setupTaskRunner(i);this._scheduleDrawScenario(n,r),this._scheduleDrawing(n,r),n.run()}_insertLayout(e,t){this._target=e,this._defaultSize=Object.assign({},t);var i=Hi.select(e).node();if(null===i)throw new Error("Target element not found");this._layout.layout.parentNode!==i&&i.appendChild(this._layout.layout);var r=this._layout.content,n=kt(this._layout.contentContainer);this._layout.contentContainer.style.padding=`0 ${n.width}px ${n.height}px 0`,Et(this._layout.rightSidebarContainer,"vertical");var a=Object.assign({},t)||{};if(!a.width||!a.height){let{scrollLeft:e,scrollTop:t}=r.parentElement;r.style.display="none",a=st(a,Ot(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=e,r.parentElement.scrollTop=t,a.height||(a.height=Ot(this._layout.layout).height)}this.configGPL.settings.size=a}_createLiveSpec(){return this._liveSpec=$e(ot(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((e,t)=>new t(e).transform(this),this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)}_experimentalSetupAnimationSpeed(e){e.settings.initialAnimationSpeed=e.settings.initialAnimationSpeed||e.settings.animationSpeed;const t=e.settings.experimentalShouldAnimate(e)?e.settings.initialAnimationSpeed:0;e.settings.animationSpeed=t;const i=e=>{e.guide=e.guide||{},e.guide.animationSpeed=t,e.units&&e.units.forEach(i)};i(e.unit)}_createGPL(e){var t=new Gt(e,this.getScaleFactory(),Zt,w),i=t.unfoldStructure();return this.onUnitsStructureExpanded(i),t}_scheduleDrawScenario(e,t){const i=Hi.select(this._layout.content),r=t.config.settings.size;e.addTask(()=>this._renderingPhase="spec"),t.getDrawScenarioQueue({allocateRect:()=>({slot:e=>i.selectAll(`.uid_${e}`),frameId:"root",left:0,top:0,width:r.width,containerWidth:r.width,height:r.height,containerHeight:r.height})}).forEach(t=>e.addTask(t))}_scheduleDrawing(e,t){const i=t.config.settings.size;e.addTask(e=>{this._renderingPhase="draw",this._renderRoot({scenario:e,newSize:i}),this._cancelPointerAnimationFrame(),this._scheduleRenderScenario(e)})}_resetProgressLayout(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()}_renderRoot({scenario:e,newSize:t}){const i=Hi.select(this._layout.content);var r=e[0].config.uid,n=Ui(i,"svg").attr("width",Math.floor(t.width)).attr("height",Math.floor(t.height));n.attr("class")||n.attr("class",`${N}svg`),this._svg=n.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var a=n.selectAll("g.frame-root").data([r],e=>e);a.enter().append("g").classed(`${N}cell cell frame-root uid_${r}`,!0).merge(a).call(e=>{e.classed("tau-active",!0),he(e,this.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),a.exit().call(e=>{e.classed("tau-active",!1),he(e,this.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})}_scheduleRenderScenario(e){e.forEach(e=>{this._taskRunner.addTask(()=>{e.draw(),this.onUnitDraw(e.node()),this._renderedItems.push(e)})})}_completeRendering(){Et(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=`${this._liveSpec.settings.size.height}px`,this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),Et(this._layout.rightSidebarContainer,"vertical")}_cancelRendering(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()}_createProgressBar(){var e=Hi.select(this._layout.header),t=Ui(e,`div.${N}progress`);t.select(`div.${N}progress__value`).remove();var i=t.append("div").classed(`${N}progress__value`,!0).style("width",0);this._reportProgress=function(e){requestAnimationFrame(()=>{t.classed(`${N}progress_active`,e<1),i.style("width",`${100*e}%`)})}}_displayRenderingError(e){this._layout.layout.classList.add(`${N}layout_rendering-error`)}_clearRenderingError(){this._layout.layout.classList.remove(`${N}layout_rendering-error`)}getScaleFactory(e=null){return new ii(ti.instance(this._liveSpec.settings),e||this._liveSpec.sources,this._liveSpec.scales)}getScaleInfo(e,t=null){return this.getScaleFactory().createScaleInfoByName(e,t)}getSourceFiltersIterator(e){var t=tt(Object.keys(this._filtersStore.filters).map(e=>this._filtersStore.filters[e])).filter(t=>!e(t)).map(e=>e.predicate);return e=>t.reduce((t,i)=>t&&i(e),!0)}getDataSources(e={}){var t=this._chartDataModel(this._originData);return Object.keys(t).filter(e=>"?"!==e).reduce((i,r)=>{var n=t[r],a=this.getSourceFiltersIterator((t=>i=>e.excludeFilter&&-1!==e.excludeFilter.indexOf(i.tag)||i.src!==t)(r));return i[r]={dims:n.dims,data:n.data.filter(a)},i},{"?":t["?"]})}isEmptySources(e){return!Object.keys(e).filter(e=>"?"!==e).filter(t=>e[t].data.length>0).length}getChartModelData(e={},t="/"){return this.getDataSources(e)[t].data}getDataDims(e="/"){return this._originData[e].dims}getData(e="/"){return this._originData[e].data}setData(e,t="/"){this._originData[t].data=e,this.refresh()}getSVG(){return this._svg}addFilter(e){e.src=e.src||"/";var t=e.tag,i=this._filtersStore.filters[t]=this._filtersStore.filters[t]||[],r=this._filtersStore.tick++;return e.id=r,i.push(e),r}removeFilter(e){return Object.keys(this._filtersStore.filters).map(t=>{this._filtersStore.filters[t]=this._filtersStore.filters[t].filter(t=>t.id!==e)}),this}refresh(){this._target&&this.renderTo(this._target,this._defaultSize)}resize(e={}){this.renderTo(this._target,e)}select(e){return this._nodes.filter(e)}traverseSpec(e,t){var i=(e,t,r,n)=>{t(e,r,n),e.frames?e.frames.forEach(r=>{(r.units||[]).map(n=>i(n,t,e,r))}):(e.units||[]).map(r=>i(r,t,e,null))};i(e.unit,t,null,null)}getSpec(){return this._liveSpec}getLayout(){return this._layout}_displayTimeoutWarning({proceed:e,cancel:t,timeout:i}){var r=Math.round(100/3/1.5),n=function(e){return Math.round(100/3/1.5*e)};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(`.${N}rendering-timeout-continue-btn`).addEventListener("click",()=>{this._clearTimeoutWarning(),e.call(this)}),this._layout.content.querySelector(`.${N}rendering-timeout-cancel-btn`).addEventListener("click",()=>{this._clearTimeoutWarning(),t.call(this)})}_clearTimeoutWarning(){var e=Gi(this._layout.content,`.${N}rendering-timeout-warning`);e&&(this._layout.content.removeChild(e),this._layout.content.style.height="")}}var Xi={},Yi={},Vi=e=>{let t=`Chart type ${e} is not supported.`;throw console.log(t),console.log(`Use one of ${Object.keys(Xi).join(", ")}.`),new x(t,b.NOT_SUPPORTED_TYPE_CHART)},Ji={validate:(e,t)=>(Yi.hasOwnProperty(e)||Vi(e),Yi[e].reduce((e,i)=>e.concat(i(t)||[]),[])),get(e){var t=Xi[e];return"function"!=typeof t&&Vi(e),t},add:(e,t,i=[])=>(Xi[e]=t,Yi[e]=i,Ji),getAllRegisteredTypes:()=>Xi};class Ki extends qi{constructor(e){super(e),e.autoResize&&Ki.winAware.push(this)}applyConfig(e){var t=Ji.validate(e.type,e);if(t.length>0)throw new Error(t[0]);var i=Ji.get(e.type);(e=st(e,{autoResize:!0})).settings=qi.setupSettings(e.settings),e.dimensions=qi.setupMetaInfo(e.dimensions,e.data),super.applyConfig(i(e))}destroy(){var e=Ki.winAware.indexOf(this);-1!==e&&Ki.winAware.splice(e,1),super.destroy()}}Ki.winAware=[],Ki.resizeOnWindowEvent=function(){let e;function t(){e=0;for(let e=0,t=Ki.winAware.length;e{const t=e<=20?1:.75;return Math.max(2,Math.round(e*t))};const er={...i(11),...i(8),...s};var tr=i(12);var ir=i(4),rr=function(){var e,t=[],i=[],r=1,n=1,a={},s=!1,o=function(e){var r=t.length,n=0,a=t[e].x-i[e].x,s=i[e].y-t[e].y,o=Math.sqrt(a*a+s*s);o>0&&(n+=.2*o),s/=o,n+=(a/=o)>0&&s>0?0:a<0&&s>0?3:a<0&&s<0?6:9;for(var l,c,d,h,g=t[e].x,p=t[e].y-t[e].height+2,f=t[e].x+t[e].width,m=t[e].y+2,y=0;yr&&(t[c].x=u),t[c].x<0&&(t[c].x=u),t[c].y>n&&(t[c].y=d),t[c].y<0&&(t[c].y=d);var h=(s?e(c,t,i):o(c))-l;Math.random()r&&(t[c].x=u),t[c].x<0&&(t[c].x=u),t[c].y>n&&(t[c].y=d),t[c].y<0&&(t[c].y=d);var y=(s?e(c,t,i):o(c))-l;Math.random()1||c<0||c>1)},d=function(e,t,i){return e-t/i};return a.start=function(e){for(var i=t.length,r=1,n=0;n()=>e;class ur{constructor(e){this.model=e.model,this.x=e.x||cr(0),this.y=e.y||cr(0),this.dx=e.dx||cr(0),this.dy=e.dy||cr(0),this.w=e.w||cr(0),this.h=e.h||cr(0),this.hide=e.hide||cr(!1),this.label=e.label||cr(""),this.color=e.color||cr(""),this.angle=e.angle||cr(0),this.labelLinesAndSeparator=e.labelLinesAndSeparator||cr({lines:[],linesWidths:[],separator:""})}static seed(e,{fontColor:t,flip:i,formatter:r,labelRectSize:n,paddingKoeff:a=.5,lineBreakAvailable:s,lineBreakSeparator:o}){var l=i?e.yi:e.xi,c=i?e.xi:e.yi,u=t=>r(e.label(t)),d=e=>{const t=s?u(e).split(o):[u(e)];return{lines:t,linesWidths:t.map(e=>n([e]).width),separator:o}};return new ur({model:e,x:e=>l(e),y:e=>c(e),dy:e=>n(d(e).lines).height*a,w:e=>n(d(e).lines).width,h:e=>n(d(e).lines).height,label:u,labelLinesAndSeparator:d,color:()=>t,angle:()=>0})}static compose(e,t={}){return Object.keys(t).reduce((e,i)=>(e[i]=t[i],e),new ur(e))}}var dr={};class hr{static regRule(e,t){return dr[e]=t,this}static getRule(e){return dr[e]}}const gr=({lines:e,linesWidths:t,separator:i},r)=>e.map(function(e,i){const n=((e,t,i)=>i0===t?"":e.slice(0,t).replace(/\.+$/g,"")+"…")(e,n):e}).join(i);var pr=(e,t)=>{var i=5-(e.labelLinesAndSeparator(t).lines.length-1);return i<1?1:i},fr=(e,t)=>e.discrete||!e.discrete&&t[e.dim]>=0,mr=(e,t)=>!e.discrete&&t[e.dim]<0,yr=(e,t)=>e.w(t)/2+Math.floor(e.model.size(t)/pr(e,t)),xr=(e,t)=>e.h(t)/2+Math.floor(e.model.size(t)/pr(e,t)),br=e=>t=>({dx:i=>{var r=t.model.scaleY;if("+"===e[2]&&!fr(r,i))return t.dx(i);if("-"===e[2]&&!mr(r,i))return t.dx(i);var n=e[1],a=e[0]===e[0].toUpperCase()?1:0;return t.dx(i)+n*a*t.model.size(i)/2+n*yr(t,i)}}),vr=e=>t=>({dy:i=>{var r=t.model.scaleY;if("+"===e[2]&&!fr(r,i))return t.dy(i);if("-"===e[2]&&!mr(r,i))return t.dy(i);var n=e[1],a=e[0]===e[0].toUpperCase()?1:0;return t.dy(i)+n*a*t.model.size(i)/2+n*xr(t,i)}});hr.regRule("l",br(["l",-1,null])).regRule("L",br(["L",-1,null])).regRule("l+",br(["l",-1,"+"])).regRule("l-",br(["l",-1,"-"])).regRule("L+",br(["L",-1,"+"])).regRule("L-",br(["L",-1,"-"])).regRule("r",br(["r",1,null])).regRule("R",br(["R",1,null])).regRule("r+",br(["r",1,"+"])).regRule("r-",br(["r",1,"-"])).regRule("R+",br(["R",1,"+"])).regRule("R-",br(["R",1,"-"])).regRule("t",vr(["t",-1,null])).regRule("T",vr(["T",-1,null])).regRule("t+",vr(["t",-1,"+"])).regRule("t-",vr(["t",-1,"-"])).regRule("T+",vr(["T",-1,"+"])).regRule("T-",vr(["T",-1,"-"])).regRule("b",vr(["b",1,null])).regRule("B",vr(["B",1,null])).regRule("b+",vr(["b",1,"+"])).regRule("b-",vr(["b",1,"-"])).regRule("B+",vr(["B",1,"+"])).regRule("B-",vr(["B",1,"-"])).regRule("rotate-on-size-overflow",(e,{data:t,lineBreakAvailable:i})=>{var r={};if(t.reduce((t,i)=>t+((t=>e.model.size(t).5){var n=i?-.5:.5;r={angle:()=>-90,w:t=>e.h(t),h:t=>e.w(t),dx:t=>e.h(t)*n-2,dy:()=>0}}return r}).regRule("hide-by-label-height-vertical",e=>({hide:t=>{let i,r;return 0===e.angle(t)?(r=e.h(t),i=Math.abs(e.model.y0(t)-e.model.yi(t))):(r=e.w(t),i=e.model.size(t)),r>i||e.hide(t)}})).regRule("cut-label-vertical",e=>({h:t=>{const i=e.h(t);if(Math.abs(e.angle(t))>0){const r=Math.abs(e.model.y0(t)-e.model.yi(t));return r{const i=e.w(t);if(0===e.angle(t)){const r=e.model.size(t);return r{let i;return i=0===e.angle(t)?e.model.size(t):Math.abs(e.model.y0(t)-e.model.yi(t)),gr(e.labelLinesAndSeparator(t),i)},dy:t=>{const i=e.dy(t);if(0!==e.angle(t)){const r=e.h(t),n=Math.abs(e.model.y0(t)-e.model.yi(t));return n({h:(t,i)=>{const r=e.h(t);if(Math.abs(e.angle(t))>0){const n=e.model.y0(t){const i=e.w(t);if(0===e.angle(t)){const r=e.model.size(t);return r{let r;return r=0===e.angle(t)?e.model.size(t):e.model.y0(t){const r=e.dy(t);if(0!==e.angle(t)){const n=e.h(t),a=e.model.y0(t){var t=t=>e.model.y0(t);return e.model.flip?{x:t}:{y:t}}).regRule("to-end",e=>{var t=t=>e.model.yi(t);return e.model.flip?{x:t}:{y:t}}).regRule("towards",e=>{var t=e.model.flip?yr:xr,i=i=>((e,t)=>e.model.yi(t)-e.model.y0(t)>=0?1:-1)(e,i)*t(e,i);return e.model.flip?{dx:i}:{dy:i}}).regRule("inside-start-then-outside-end-horizontal",(e,t)=>{var i=[hr.getRule("from-beginning"),hr.getRule("towards"),hr.getRule("cut-label-horizontal")].reduce((e,i)=>ur.compose(e,i(e,t)),e),r=[hr.getRule("to-end"),hr.getRule("towards"),hr.getRule("cut-outer-label-horizontal")].reduce((e,i)=>ur.compose(e,i(e,t)),e);return Object.assign({},i,["x","dx","hide","label"].reduce((e,t)=>(e[t]=(e=>((e=>i.label(e).length>=r.label(e).length)(e)?i:r)[t](e)),e),{}))}).regRule("inside-start-then-outside-end-vertical",(e,t)=>{var i=[hr.getRule("from-beginning"),hr.getRule("towards"),hr.getRule("cut-label-vertical")].reduce((e,i)=>ur.compose(e,i(e,t)),e),r=[hr.getRule("to-end"),hr.getRule("towards"),hr.getRule("cut-outer-label-vertical")].reduce((e,i)=>ur.compose(e,i(e,t)),e);return Object.assign({},i,["y","dy","hide","label"].reduce((e,t)=>(e[t]=(e=>((e=>i.label(e).length>=r.label(e).length)(e)?i:r)[t](e)),e),{}))}).regRule("outside-then-inside-horizontal",(e,t)=>{var i=["r+","l-","cut-outer-label-horizontal"].map(hr.getRule).reduce((e,i)=>ur.compose(e,i(e,t)),e),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(hr.getRule).reduce((e,i)=>ur.compose(e,i(e,t)),e);return Object.assign({},i,["x","dx","hide","label"].reduce((e,t)=>(e[t]=(e=>((e=>r.label(e).length>i.label(e).length)(e)?r:i)[t](e)),e),{}))}).regRule("outside-then-inside-vertical",(e,t)=>{var i=["t+","b-","cut-outer-label-vertical"].map(hr.getRule).reduce((e,i)=>ur.compose(e,i(e,t)),e),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(hr.getRule).reduce((e,i)=>ur.compose(e,i(e,t)),e);return Object.assign({},i,["y","dy","hide","label"].reduce((e,n)=>(e[n]=(e=>((e=>{var r=i.y(e,t)+i.dy(e,t);return r<=0||r>=t.maxHeight})(e)?r:i)[n](e,t)),e),{}))}).regRule("hide-by-label-height-horizontal",e=>({hide:t=>e.model.size(t)({dx:t=>{const i=e.w(t),r=Math.abs(e.model.y0(t)-e.model.yi(t)),n=e.dx(t);return r{const i=e.w(t),r=Math.abs(e.model.y0(t)-e.model.yi(t));return r{const i=Math.abs(e.model.y0(t)-e.model.yi(t));return gr(e.labelLinesAndSeparator(t),i)}})).regRule("cut-outer-label-horizontal",(e,t)=>({dx:i=>{const r=e.w(i),n=e.model.y0(i){const r=e.w(i),n=e.model.y0(i){const r=e.model.y0(i)({dy:t=>e.model.size(t)/e.w(t)<1?e.dy(t)-e.h(t)/2-e.model.size(t)/2:e.dy(t)})).regRule("keep-in-box",(e,{maxWidth:t,maxHeight:i})=>({dx:i=>{var r=e.dx(i),n=e.x(i)+r,a=e.w(i),s=0-(n-a/2);if(s>0)return r+s;var o=n+a/2-t;return o>0?r-o:r},dy:t=>{var r=e.dy(t),n=e.y(t)+r,a=e.h(t);if(0-(n-a/2)>0)return 0;var s=n+a/2-i;return s>0?r-s:r}})).regRule("multiline-label-left-align",e=>({dy:t=>{const i=e.dy(t);return-90===e.angle(t)?i+e.h(t)/2:i}})).regRule("multiline-label-vertical-center-align",e=>({dy:t=>e.dy(t)-e.h(t)/2})).regRule("multiline-hide-on-container-overflow",(e,{maxWidth:t,maxHeight:i})=>({hide:r=>{var n=e.angle(r),a=e.x(r)+e.dx(r),s=e.y(r)+e.dy(r);return!(!Qe(a,e.w(r),n,t)&&!et(s,e.h(r),n,i))||e.hide(r)}}));class wr{constructor(e){this.minError=Number.MAX_VALUE,this.items=e.items,this.revision=this.items.map(e=>({i:e.i,x:e.x,y:e.y})),this.penalties=e.penalties,this.transactor=e.transactor,this.cooling_schedule=e.cooling_schedule||((e,t,i)=>e-t/i)}energy(e){return this.penalties.reduce((t,i)=>t+i(e),0)}move(e){const t=Math.floor(Math.random()*this.items.length),i=this.transactor(this.items[t]),r=this.energy(t);this.items[t]=i.modify();const n=this.energy(t),a=n-r,s=a<0?1:Math.exp(-a/e);Math.random()>=s?this.items[t]=i.revert():n({i:e.i,x:e.x,y:e.y})))}start(e){var t=1;const i=this.items.length;e:for(let r=0;rA(e,n,t,a,i,s,r,o);const Sr={};class Mr{static reg(e,t){return Sr[e]=t,this}static get(e){return Sr[e]}}Mr.reg("auto:avoid-label-label-overlap",(e,t,i=1)=>t=>{var r=e[t].x,n=e[t].y-e[t].h+2,a=e[t].x+e[t].w,s=e[t].y+2;return e.reduce((e,o,l)=>{var c=Number(l!==t),u=o.x,d=o.y-o.h+2,h=o.x+o.w,g=o.y+2;return e+c*(Math.max(0,Math.min(h,a)-Math.max(u,r))*Math.max(0,Math.min(g,s)-Math.max(d,n))*i)},0)}).reg("auto:avoid-label-anchor-overlap",(e,t,i=1)=>t=>{var r=e[t],n=r.x-r.w/2,a=r.x+r.w/2,s=r.y-r.h/2+2,o=r.y+r.h/2+2;return e.reduce((e,t)=>{var r=t.x0-t.size/2,l=t.x0+t.size/2,c=t.y0-t.size/2,u=t.y0+t.size/2;return e+Math.max(0,Math.min(l,a)-Math.max(r,n))*Math.max(0,Math.min(u,o)-Math.max(c,s))*i},0)}).reg("auto:avoid-label-edges-overlap",(e,t,i=1)=>r=>{var n=e[r],a=n.x-n.w/2,s=n.x+n.w/2,o=n.y-n.h/2,l=n.y+n.h/2;return t.reduce((e,t)=>{var r=_r(a,s,t.x0,t.x1,o,l,t.y0,t.y1),n=_r(a,s,t.x0,t.x1,l,o,t.y0,t.y1);return e+(Number(r)+Number(n))*i},0)});var kr=(e,t,i,r,n,a,s,o)=>A(e,n,t,a,i,s,r,o);class Er{constructor(e,t,i,{width:r,height:n,container:a}){this.container=a,this.model=e,this.flip=t,this.w=r,this.h=n,this.guide=st(i||{},{fontFamily:"Helvetica Neue, Segoe UI, Open Sans, Ubuntu, sans-serif",fontWeight:"normal",fontSize:10,fontColor:"#000",hideEqualLabels:!1,lineBreak:!1,lineBreakSeparator:"",position:[],tickFormat:null,tickFormatNullAlias:""})}draw(e){var t=this,i=this.model,r=this.guide,n=r.lineBreak,a=r.lineBreakSeparator,o=ur.seed(i,{fontColor:r.fontColor,flip:t.flip,formatter:gi.get(r.tickFormat,r.tickFormatNullAlias),labelRectSize:e=>Nt(e,r),lineBreakAvailable:n,lineBreakSeparator:a,paddingKoeff:n?0:.5}),l={lineBreakAvailable:n,maxWidth:t.w,maxHeight:t.h,data:e.reduce((e,t)=>e.concat(t),[])},c=this.applyFixedPositionRules(r,l,o,n,this.flip),u=e.reduce((e,t)=>{var i=t.map(e=>({data:e,x:c.x(e)+c.dx(e),y:c.y(e)+c.dy(e),w:c.w(e),h:c.h(e,l),hide:c.hide(e),extr:null,size:c.model.size(e),angle:c.angle(e),label:c.label(e),labelLinesAndSeparator:c.labelLinesAndSeparator(e),color:c.color(e)}));return e.text=e.text.concat(i),e.edges=e.edges.concat(((e,t)=>{for(var i=e.length-1,r=[],n=0;n<=i;n++){var a=0===n?n:n-1,s=n,o=n===i?n:n+1;r.push(t(e[a],e[s],e[o]))}return r})(i,(e,t,i)=>(t.y===Math.max(t.y,e.y,i.y)?t.extr="min":t.y===Math.min(t.y,e.y,i.y)?t.extr="max":t.extr="norm",{x0:e.x,x1:t.x,y0:e.y,y1:t.y}))),e},{text:[],edges:[]});u.text=u.text.filter(e=>e.label).map((e,t)=>Object.assign(e,{i:t}));var d=n?["auto:hide-on-label-label-overlap","auto:adjust-on-multiline-label-overflow"]:this.guide.position,h=d.filter(e=>0===e.indexOf("auto:avoid"));u=u.text.length>0&&h.length>0?this.autoPosition(u,h):u;var g=d.reduce((e,t)=>Object.assign(e,{[t]:!0}),{});u.text=u.text=g["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(u.text,l):u.text,u.text=u.text=g["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(u.text,l):u.text,u.text=g["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(u.text,u.edges):u.text,u.text=g["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(u.text):u.text,u.text=g["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(u.text):u.text;var p=u.text,f=e=>(t,i)=>p[i][e],m=f("x"),y=f("y"),x=f("angle"),b=f("color"),v=f("label"),w=function(e){if(e.style("fill",b).style("font-size",`${t.guide.fontSize}px`).style("display",(e,t)=>p[t].hide?"none":null).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",(e,t)=>`translate(${m(e,t)},${y(e,t)}) rotate(${x(e,t)})`),n){e.each(function(e,t){var i=s.select(this),r=x(e,t);i.text(null),v(e,t).split(a).forEach(function(e,t){i.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(t+1)+"em").text(e)})})}else e.text(v)};r.hideEqualLabels&&p.filter(e=>!e.hide).filter((e,t,i)=>te.hide=!0);var _=this.container.selectAll(".i-role-label").data(p.map(e=>e.data));return _.exit().remove(),_.call(w),_.enter().append("text").call(w),_}applyFixedPositionRules(e,t,i,r,n){var a=e.position.filter(e=>-1===e.indexOf("auto:"));return r&&(n&&a.push("multiline-label-vertical-center-align"),a.push("multiline-label-left-align","multiline-hide-on-container-overflow")),a.map(hr.getRule).reduce((e,i)=>ur.compose(e,i(e,t)),i)}autoPosition(e,t){const i=(e,t)=>{const i=4+(e.size+e.w)/2,r=2+(e.size+e.h)/2;return{x:i*Math.cos(t),y:r*Math.sin(t)}};var r=e.edges,n=e.text.map(e=>{const t={max:-Math.PI/2,min:Math.PI/2,norm:Math.random()*Math.PI*2},r=i(e,t[e.extr]);return{i:e.i,x0:e.x,y0:e.y,x:e.x+r.x,y:e.y+r.y,w:e.w,h:e.h,size:e.size,hide:e.hide,extr:e.extr}}).filter(e=>!e.hide);const a=new wr({items:n,transactor:e=>{const t=e.x,r=e.y;return{modify:()=>{const t={max:-Math.PI,min:Math.PI,norm:2*Math.PI}[e.extr],r=t/4+Math.random()*(2*t)/4,n=i(e,r);return e.x=e.x0+n.x,e.y=e.y0+n.y,e},revert:()=>(e.x=t,e.y=r,e)}},penalties:t.map(e=>Mr.get(e)).filter(e=>e).map(e=>e(n,r))}).start(5);return e.text=a.reduce((e,t)=>{var i=e[t.i];return i.x=t.x,i.y=t.y,e},e.text),e}hideOnLabelEdgesOverlap(e,t){const i=(e,t)=>{const i=this.getLabelRect(e);return t.reduce((e,t)=>{var r=kr(i.x0,i.x1,t.x0,t.x1,i.y0,i.y1,t.y0,t.y1),n=kr(i.x0,i.x1,t.x0,t.x1,i.y1,i.y0,t.y0,t.y1);return e+2*(Number(r)+Number(n))},0)};return e.filter(e=>!e.hide).forEach(e=>{i(e,t)>0&&(e.hide=!0)}),e}hideOnLabelLabelOverlap(e){var t={min:0,max:1,norm:2},i={"min/min":(e,t)=>t.y-e.y,"max/max":(e,t)=>e.y-t.y,"min/max":()=>-1,"min/norm":()=>-1,"max/norm":()=>-1,"norm/norm":(e,t)=>e.y-t.y},r=(e,r)=>{var n=this.getLabelRect(e),a=this.getLabelRect(r),s=Number(!e.hide&&!r.hide);if(s*Math.max(0,Math.min(a.x1,n.x1)-Math.max(n.x0,a.x0))*(s*Math.max(0,Math.min(a.y1,n.y1)-Math.max(n.y0,a.y0)))>0){let n=[e,r];n.sort((e,i)=>t[e.extr]-t[i.extr]),(i[`${n[0].extr}/${n[1].extr}`](n[0],n[1])<0?n[0]:n[1]).hide=!0}};return e.filter(e=>!e.hide).sort((e,i)=>t[e.extr]-t[i.extr]).forEach(t=>{e.forEach(e=>{t.i!==e.i&&r(t,e)})}),e}getLabelRect(e,t=0){return{x0:e.x-e.w/2-t,x1:e.x+e.w/2+t,y0:e.y-e.h/2-t,y1:e.y+e.h/2+t}}getPointRect(e,t=0){return{x0:e.x-e.size/2-t,x1:e.x+e.size/2+t,y0:e.y-e.size/2-t,y1:e.y+e.size/2+t}}hideOnLabelAnchorOverlap(e){var t=(e,t)=>{const i=this.getLabelRect(e,2),r=this.getPointRect(t,2);return Math.max(0,Math.min(r.x1,i.x1)-Math.max(r.x0,i.x0))*Math.max(0,Math.min(r.y1,i.y1)-Math.max(r.y0,i.y0))>.001};return e.filter(e=>!e.hide).forEach(i=>{const r=e.length;for(let n=0;n(e.hide||(e.x=Math.min(Math.max(e.x,e.w/2),t-e.w/2),e.y=Math.max(Math.min(e.y,i-e.h/2),e.h/2)),e))}adjustOnMultilineOverflow(e,{maxWidth:t}){return e.map(e=>(e.hide||0!==e.angle||(e.x=Math.min(Math.max(e.x,e.w/2),t-e.w/2)),e))}}const Ar={...i(13),...s},Tr={init(e){const t=Object.assign({},e);t.guide=st(t.guide||{},{animationSpeed:0,avoidScalesOverflow:!0,enableColorToBarPosition:!1,maxHighlightDistance:32}),t.guide.size=t.guide.size||{},t.guide.label=st(t.guide.label||{},{position:["auto:avoid-label-label-overlap","auto:avoid-label-anchor-overlap","auto:adjust-on-label-overflow","auto:hide-on-label-label-overlap","auto:hide-on-label-anchor-overlap"]});const i=t.guide.avoidScalesOverflow,r=t.guide.enableColorToBarPosition;return t.transformRules=[e=>{const t=[e.scaleX,e.scaleY].sort((e,t)=>{var i=e.discrete?1:0;return(t.discrete?1:0)*t.domain().length-i*e.domain().length})[0];return e.scaleY===t?w.get("flip")(e):w.get("identity")(e)},t.stack&&w.get("stack"),r&&w.get("positioningByColor")].filter(e=>e),t.adjustRules=[t.stack&&w.get("adjustYScale"),(e,i)=>{const r=e.scaleSize.isEmptyScale(),n=st(t.guide.size,{defMinSize:10,defMaxSize:r?10:40,enableDistributeEvenly:!r}),a=Object.assign({},i,{defMin:n.defMinSize,defMax:n.defMaxSize,minLimit:n.minSize,maxLimit:n.maxSize});return(n.enableDistributeEvenly?w.get("adjustSigmaSizeScale"):w.get("adjustStaticSizeScale"))(e,a)},i&&((e,t)=>{const i=Object.assign({},t,{sizeDirection:"xy"});return w.get("avoidScalesOverflow")(e,i)})].filter(e=>e),t},addInteraction(){const e=this.node();e.on("highlight",(e,t)=>this.highlight(t)),e.on("data-hover",(e,t)=>this.highlight(((e,t)=>i=>i===e||t)(t.data,null)))},draw(){const e=this.node(),t=e.config,i=t.options;i.container=i.slot(t.uid);const r=e=>he(e,t.guide.animationSpeed),n=`${N}dot dot i-role-element i-role-datum`,a=e.screenModel,s={fill:e=>a.color(e),class:e=>`${n} ${a.class(e)}`},o={r:e=>Math.round(1e4*a.size(e)/2)/1e4,cx:e=>a.x(e),cy:e=>a.y(e)},l=[],c=a.toFibers();var u;this._getGroupOrder=(u=c.reduce((e,t,i)=>(e.set(t,i),e),new Map),e=>u.get(e));const d=i.container.selectAll(".frame").data(c,e=>a.group(e[0]));d.enter().append("g").attr("opacity",0).merge(d).call(function(t){t.attr("class","frame").call(function(t){var i=t.selectAll("circle").data(e=>e,a.id),n=i.enter().append("circle").call(ve(o)).merge(i).call(ve(s));r(n).call(ve(o)),r(i.exit()).attr("r",0).remove(),l.push(...n.nodes()),e.subscribe(n)}),r(t).attr("opacity",1)});this._boundsInfo=this._getBoundsInfo(l),r(d.exit()).attr("opacity",0).remove().selectAll("circle").attr("r",0),e.subscribe(new Er(a.model,a.flip,t.guide.label,i).draw(c))},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,i=e.map(e=>{const i=Ar.select(e).data()[0];return{node:e,data:i,x:t.x(i),y:t.y(i),r:t.size(i)/2}}).filter(e=>!isNaN(e.x)&&!isNaN(e.y)),r=i.reduce((e,{x:t,y:i})=>(e.left=Math.min(t,e.left),e.right=Math.max(t,e.right),e.top=Math.min(i,e.top),e.bottom=Math.max(i,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),n=i.reduce((e,t)=>{const i=`${t.x},${t.y}`;return e[i]||(e[i]=[]),e[i].push(t),e},{});return{bounds:r,tree:Ar.quadtree().x(e=>e[0].x).y(e=>e[0].y).addAll(Object.keys(n).map(e=>n[e]))}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=T(this.node().config.options.container.node()),a=e-n.x,s=t-n.y,{maxHighlightDistance:o}=this.node().config.guide;if(ai.right+o||si.bottom+o)return null;const l=(r.find(a,s)||[]).map(e=>{const t=Math.sqrt(Math.pow(a-e.x,2)+Math.pow(s-e.y,2));if(t>o)return null;const i=te).sort((e,t)=>e.secondaryDistance-t.secondaryDistance),c=l.findIndex(e=>e.distance!==l[0].distance||e.secondaryDistance!==l[0].secondaryDistance),u=c<0?l:l.slice(0,c);if(1===u.length)return u[0];const d=u.reduce((e,t)=>e+t.x,0)/u.length,h=u.reduce((e,t)=>e+t.y,0)/u.length,g=Math.atan2(h-s,d-a)+Math.PI;return u[Math.round((u.length-1)*g/2/Math.PI)]},highlight(e){const t=this.node().config.options.container,i={"tau-chart__highlighted":t=>!0===e(t),"tau-chart__dimmed":t=>!1===e(t)};t.selectAll(".dot").call(we(i)),t.selectAll(".i-role-label").call(we(i)),this._sortElements(e)},_sortElements(e){const t=this.node().config.options.container,i=new Map,r=new Map;t.selectAll(".frame").each(function(t){i.set(this,t.some(e)),r.set(this,t)});const n=ct((e,t)=>i.get(e)-i.get(t),(e,t)=>this._getGroupOrder(r.get(e))-this._getGroupOrder(r.get(t)));$t(t.node(),(e,t)=>"g"===e.tagName&&"g"===t.tagName?n(e,t):e.tagName.localeCompare(t.tagName)),O(t,".dot",e)}};var Or=i(9);const Cr="taucharts_synthetic_record";function Nr(e){return!0!==e[Cr]}function Lr(e){return t=>{const i=e.stack,r=t.scaleX.period,n="linear"===t.scaleY.scaleType,a=!e.guide.x||null==e.guide.x.fillGaps;return!a&&e.guide.x.fillGaps||a&&(i||r&&n)?w.get("fillGaps")(t,{isStack:i,xPeriod:r,utc:e.guide.utcTime}):{}}}function Fr(e){if(0===e.length)return"";if(1===e.length)return Rr(e[0]);for(var t=[],i=1;it.size)} 1`,`${i.left[0].x},${i.left[0].y}`,"Z"].join(" "):Rr(e.size>t.size?e:t)}function Dr(e,t,i,r){var n=function(e,t,i,r){var n=Ir(e,r);if(0===n||n+e.size/2<=r.size/2||n+r.size/2<=e.size/2)return null;var a=n=>{var a=n?[r,i,t,e]:[e,t,i,r],s=Wr(1/12*2,...a),o=Wr(.5,...s.slice(0,4)),l=o[3],c=o[6],u=Ur(a[0],l),d=Ur(l,c),h=[u.left[0],I(.5,u.left[1],d.left[0]),d.left[1]],g=[u.right[0],I(.5,u.right[1],d.right[0]),d.right[1]],p=Hr(...h)[1],f=Hr(...g)[1],m=I(4,u.left[0],p),y=I(4,u.right[0],f);return{left:n?[y,g[0]]:[h[0],m],right:n?[m,h[0]]:[g[0],y]}},s=a(!1),o=a(!0);return{left:[...s.left,...o.left],right:[...s.right,...o.right]}}(e,t,i,r);if(!n)return $r(e,r);var a=jr(Pr(e,n.right[0]),Pr(e,n.left[0])),s=jr(Pr(r,n.right[1]),Pr(r,n.left[1]));return[`M${n.left[0].x},${n.left[0].y}`,`C${n.left[1].x},${n.left[1].y}`,`${n.left[2].x},${n.left[2].y}`,`${n.left[3].x},${n.left[3].y}`,`A${r.size/2},${r.size/2} 0 ${Number(a>Math.PI)} 1`,`${n.right[3].x},${n.right[3].y}`,`C${n.right[2].x},${n.right[2].y}`,`${n.right[1].x},${n.right[1].y}`,`${n.right[0].x},${n.right[0].y}`,`A${e.size/2},${e.size/2} 0 ${Number(s>Math.PI)} 1`,`${n.left[0].x},${n.left[0].y}`,"Z"].join(" ")}function Pr(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function jr(e,t){return tr.size(e)/2,cx:e=>t.x(e),cy:e=>t.y(e)}},getHighlightAttrs:function(e,t,i){e.config.guide;const r=e.screenModel,n="hover"===e.config.guide.showAnchors;return{r:n?e=>i(e)?Math.max(4,r.size(e)/2):0:e=>{var t=r.size(e)/2;return i(e)&&(t=Math.max(4,Math.ceil(1.25*t))),t}}}},"vertical-stick":{element:"path",getInitialAttrs:function(e,t){const i=e.config.guide,r=e.screenModel;return{"shape-rendering":"crispEdges",d:e=>{const n=t.x(e),a=t.y(e),s=t.x0(e),o=t.y0(e),l="hover"===i.showAnchors?0:r.size(e)/2;return Fr([{x:n,y:a,size:l},{x:s,y:o,size:l}])}}},getHighlightAttrs:function(e,t,i){e.config.guide;const r=e.screenModel,n="hover"===e.config.guide.showAnchors;return{d:e=>{const a=t.x(e),s=t.y(e),o=t.x0(e),l=t.y0(e),c=n?i(e)?Math.max(4,r.size(e)/2):0:i(e)?Math.max(4,Math.ceil(r.size(e)/2*1.25)):r.size(e)/2;return Fr([{x:a,y:s,size:c},{x:o,y:l,size:c}])}}}}};function qr(e,t,i){const r=i.sort((e,t)=>e.distance===t.distance?e.secondaryDistance-t.secondaryDistance:e.distance-t.distance),n=r.findIndex(e=>e.distance!==r[0].distance||e.secondaryDistance!==r[0].secondaryDistance),a=n<0?r:r.slice(0,n);if(1===a.length)return a[0];const s=a.reduce((e,t)=>e+t.x,0)/a.length,o=a.reduce((e,t)=>e+t.y,0)/a.length,l=Math.atan2(o-t,s-e)+Math.PI;return a[Math.round((a.length-1)*l/2/Math.PI)]}const Xr=`${N}dot-line dot-line i-role-dot i-role-datum ${N}dot`,Yr={init(e){const t=e;return t.guide=st(t.guide||{},{animationSpeed:0,cssClass:"",maxHighlightDistance:32,widthCssClass:"",color:{},label:{}}),t.guide.label=st(t.guide.label,{fontSize:11,hideEqualLabels:!0,position:["auto:avoid-label-label-overlap","auto:avoid-label-anchor-overlap","auto:avoid-label-edges-overlap","auto:adjust-on-label-overflow","auto:hide-on-label-label-overlap","auto:hide-on-label-edges-overlap"]}),t.guide.color=st(t.guide.color||{},{fill:null}),["never","hover","always"].indexOf(t.guide.showAnchors)<0&&(t.guide.showAnchors="hover"),t.transformRules=[],t.adjustRules=[],t},baseModel(e){var t={gog:e.model,x:e.x,y:e.y,x0:e.x0,y0:e.y0,size:e.size,group:e.group,order:e.order,color:e.color,class:e.class,groupAttributes:{},pathAttributesUpdateInit:{},pathAttributesUpdateDone:{},pathAttributesEnterInit:{},pathAttributesEnterDone:{},pathElement:null,dotAttributes:{r:e=>Math.round(1e4*t.size(e)/2)/1e4,cx:e=>t.x(e),cy:e=>t.y(e),fill:e=>t.color(e),class:e=>`${Xr} ${t.class(e)}`},dotAttributesDefault:{r:0,cy:e=>t.y0(e)}};return t},addInteraction(){const e=this.node(),t=this.node().config;e.on("highlight",(e,t)=>this.highlight(t)),e.on("highlight-data-points",(e,t)=>this.highlightDataPoints(t)),"never"!==t.guide.showAnchors&&e.on("data-hover",(e,t)=>this.highlightDataPoints(((e,t)=>i=>i===e||t)(t.data,null)))},draw(){const e=this.node(),t=e.config,i=t.guide,r=t.options;r.container=r.slot(t.uid);const n=e.screenModel,a=this.buildModel(n);this.domElementModel=a;const o=ye,l=function(r){r.call(ve(a.groupAttributes));const l=r.selectAll((e=>e.split(/\s+/g).map(e=>`.${e}`).join(""))(Xr)).data(e=>e.length<=1?e:[],n.id);l.exit().call(o(i.animationSpeed,null,{r:0},e=>s.select(e).remove())),l.call(o(i.animationSpeed,null,a.dotAttributes));const c=l.enter().append("circle").call(o(i.animationSpeed,a.dotAttributesDefault,a.dotAttributes)).merge(l);e.subscribe(c);const u=r.selectAll(`${a.pathElement}:not(.i-data-anchor)`).data(e=>e.length>1?[e]:[],h);u.exit().remove(),u.call(o(i.animationSpeed,a.pathAttributesUpdateInit,a.pathAttributesUpdateDone,a.afterPathUpdate));u.enter().append(a.pathElement).call(o(i.animationSpeed,a.pathAttributesEnterInit,a.pathAttributesEnterDone,a.afterPathUpdate)).merge(u).call(e=>{t.guide.animationSpeed>0&&!document.hidden?(e.attr(a.pathTween.attr,function(e){return a.pathTween.fn.call(this,e)(0)}),he(e,t.guide.animationSpeed,"pathTransition").attrTween(a.pathTween.attr,a.pathTween.fn)):e.attr(a.pathTween.attr,function(e){return a.pathTween.fn.call(this,e)(1)})});if(e.subscribe(c),"never"!==i.showAnchors){const t=function(e,t,i){const r=t.anchorShape,n=e.config.guide,a=e.screenModel,s={...Gr[r].getInitialAttrs(e,t),opacity:"hover"===n.showAnchors?0:1,fill:e=>a.color(e),class:"i-data-anchor"},o=i.selectAll(".i-data-anchor").data(e=>e.filter(Nr),a.id);return o.exit().remove(),o.call(ye(n.animationSpeed,null,s)),o.enter().append(Gr[t.anchorShape].element).call(ye(n.animationSpeed,{r:0},s)).merge(o)}(e,a,r);e.subscribe(t)}},c=n.toFibers(),u=c.map(e=>e.filter(Nr)),d=r.container.selectAll(".frame"),h=(()=>{const e=d.empty()?[]:d.data(),t=new Map;d.each(function(e){t.set(e,Number(this.getAttribute("data-id")))});const i=e.reduce((e,t)=>(e.set(t,t.map(n.id)),e),new Map),r=new Map;var a=Math.max(0,...Array.from(t.values()));return e=>{if(r.has(e))return r.get(e);const s=e.map(e=>n.id(e)),o=(Array.from(i.entries()).find(([,e])=>s.some(t=>e.some(e=>e===t)))||[null])[0];var l;return l=o?t.get(o):++a,r.set(e,l),l}})();this._getDataSetId=h;const g=d.data(c,h);g.exit().remove(),g.call(l),g.enter().append("g").attr("data-id",h).call(l),g.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),e.subscribe(new Er(n.model,t.flip,t.guide.label,r).draw(u))},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,{flip:i}=this.node().config,r=e.map(e=>{const i=s.select(e).data()[0];return{node:e,data:i,x:t.x(i),y:t.y(i)}}).filter(e=>!isNaN(e.x)&&!isNaN(e.y)),n=r.reduce((e,{x:t,y:i})=>(e.left=Math.min(t,e.left),e.right=Math.max(t,e.right),e.top=Math.min(i,e.top),e.bottom=Math.max(i,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=it(r.map(i?e=>e.y:e=>e.x)).sort((e,t)=>e-t),o=a.reduce((e,t)=>(e[t]=[],e),{});r.forEach(e=>{const t=a.find(i?t=>e.y===t:t=>e.x===t);o[t].push(e)});const l=e=>{if(1===e.length)return o[e[0]];const t=Math.ceil(e.length/2);return{middle:(e[t-1]+e[t])/2,lower:l(e.slice(0,t)),greater:l(e.slice(t))}};return{bounds:n,tree:l(a)}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=this.node().config.options.container,{flip:a}=this.node().config,s=T(n.node()),{maxHighlightDistance:o}=this.node().config.guide;if(ei.right+s.x+o||ti.bottom+s.y+o)return null;const l=a?t-s.y:e-s.x,c=function e(t){return Array.isArray(t)?t:e(l>t.middle?t.greater:t.lower)}(r).map(i=>{const r=i.x+s.x,n=i.y+s.y,o=Math.abs(a?t-n:e-r),l=Math.abs(a?e-r:t-n);return{node:i.node,data:i.data,distance:o,secondaryDistance:l,x:r,y:n}});return qr(e,t,c)},highlight(e){const t=this.node().config.options.container,i="tau-chart__highlighted",r="tau-chart__dimmed",n=t.selectAll(".i-role-path"),a=n.data().filter(t=>t.filter(Nr).some(e)),s=a.length>0;n.call(we({[i]:e=>s&&a.indexOf(e)>=0,[r]:e=>s&&a.indexOf(e)<0}));const o={[i]:t=>!0===e(t),[r]:t=>!1===e(t)};t.selectAll(".i-role-dot").call(we(o)),t.selectAll(".i-role-label").call(we(o)),this._sortElements(e)},highlightDataPoints(e){const t=this.node(),i=function(e,t,i){const r=t.anchorShape,n=e.screenModel,a="hover"===e.config.guide.showAnchors;return e.config.options.container.selectAll(".i-data-anchor").call(ve(Gr[r].getHighlightAttrs(e,t,i))).attr("opacity",a?e=>i(e)?1:0:()=>1).attr("fill",e=>n.color(e)).attr("class",e=>Dt("i-data-anchor",n.class(e))).classed(`${N}highlighted`,i)}(t,this.domElementModel,e),r=t.config.options.container,n=t.config.flip,a=i.filter(e);var s=r.select(".cursor-line");if(a.empty())s.remove();else{s.empty()&&(s=r.append("line"));const e=t.screenModel.model,i=e.xi(a.data()[0]),o=e.xi(a.data()[0]),l=e.scaleY.domain(),c=e.scaleY(l[0]),u=e.scaleY(l[1]);s.attr("class","cursor-line").attr("x1",n?c:i).attr("y1",n?i:c).attr("x2",n?u:o).attr("y2",n?o:u)}this._sortElements(e)},_sortElements(e){const t=this.node().config.options.container,i=new Map,r=new Map,n=this._getDataSetId;t.selectAll(".i-role-path").each(function(t){i.set(this,n(t)),r.set(this,t.filter(Nr).some(e))});const a=ct((e,t)=>r.get(e)-r.get(t),(e,t)=>i.get(e)-i.get(t)),s={line:0,g:1,text:2};$t(t.node(),(e,t)=>"g"===e.tagName&&"g"===t.tagName?a(e,t):s[e.tagName]-s[t.tagName])}};var Vr=[1,2,3,4,5],Jr=Vr.map(e=>N+"line-opacity-"+e),Kr=Vr.map(e=>N+"line-width-"+e);function Zr(e){return Jr[e-1]||Jr[4]}function Qr(e,t){if(e.length<2)return"";return String.prototype.concat.apply("",e.concat(t.slice().reverse()).map((e,t)=>`${0===t?"":" "}${e.x},${e.y}`))}function en(e,t){if(e.length<2)return"";const i=e=>{const t=e.map((e,t)=>{return`${(t-1)%3==0?"C":""}${e.x},${e.y} `});return String.prototype.concat.apply("",t)};return`M${i(e)}L${i(t.slice().reverse())}Z`}const tn={...Or,...s},rn={draw:Yr.draw,highlight:Yr.highlight,highlightDataPoints:Yr.highlightDataPoints,addInteraction:Yr.addInteraction,_sortElements:Yr._sortElements,init(e){const t=Yr.init(e),i=t.stack;return t.transformRules=[t.flip&&w.get("flip"),t.guide.obsoleteVerticalStackOrder&&w.get("obsoleteVerticalStackOrder"),!i&&w.get("groupOrderByAvg"),Lr(t),i&&w.get("stack")],t.adjustRules=[(e,i)=>{const r=e.scaleSize.isEmptyScale(),n=st(t.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},i,{defMin:n.defMinSize,defMax:n.defMaxSize,minLimit:n.minSize,maxLimit:n.maxSize});return w.get("adjustStaticSizeScale")(e,a)}],t},buildModel(e){const t=Yr.baseModel(e),i=this.node().config.guide,r=Zr(e.model.scaleColor.domain().length),n=`${N}area area i-role-path ${r} ${i.cssClass} `;t.groupAttributes={class:e=>`${n} ${t.class(e[0])} frame`};const a={fill:e=>t.color(e[0]),stroke:e=>{var i=t.color(e[0]);return i.length>0&&(i=tn.rgb(i).darker(1)),i}};t.pathAttributesEnterInit=a,t.pathAttributesUpdateDone=a;const s="polyline"===oe(i.interpolate);return t.pathElement=s?"polygon":"path",t.anchorShape="vertical-stick",t.pathTween={attr:s?"points":"d",fn:be(0,s?Qr:en,[i=>({id:e.id(i),x:t.x(i),y:t.y(i)}),i=>({id:e.id(i),x:t.x0(i),y:t.y0(i)})],e.id,i.interpolate)},t},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,{flip:i}=this.node().config,r=e.map(e=>{const i=tn.select(e).data()[0];return{node:e,data:i,x:t.x(i),y:t.y(i),y0:t.y0(i),group:t.group(i)}}),n=r.reduce((e,{x:t,y:i,y0:r})=>(e.left=Math.min(t,e.left),e.right=Math.max(t,e.right),e.top=Math.min(i,r,e.top),e.bottom=Math.max(i,r,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=it(r.map(i?e=>e.y:e=>e.x)).sort((e,t)=>e-t),s=a.reduce((e,t)=>(e[t]=[],e),{});if(r.forEach(e=>{const t=a.find(i?t=>e.y===t:t=>e.x===t);s[t].push(e)}),(()=>{const e=Object.keys(r.reduce((e,t)=>(e[t.group]=!0,e),{})),t=e.reduce((e,t,i)=>(e[t]=i,e),{});a.forEach(i=>{const r=s[i];if(r.sort((e,i)=>t[e.group]-t[i.group]),r.length{if(2===e.length){let[t,i]=e;return{start:t,end:i,isLeaf:!0,items:{start:s[t],end:s[i]}}}const t=e.length%2==0?e.length/2:(e.length-1)/2;e[t];return{start:e[0],end:e[e.length-1],isLeaf:!1,left:o(e.slice(0,t+1)),right:o(e.slice(t))}};return{bounds:n,tree:o(a)}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=this.node().config.options.container,{flip:a}=this.node().config,s=T(n.node()),{maxHighlightDistance:o}=this.node().config.guide;if(ei.right+s.x+o||ti.bottom+s.y+o)return null;const l=a?t-s.y:e-s.x,c=function e(t){if(t.isLeaf)return t;const i=t.left.end;return e(l1&&(u=1);const d=(()=>{const e=c.items.start.reduce((e,t)=>(e[t.group]={start:t,end:null,y:null,y0:null},e),{});return c.items.end.forEach(t=>{void 0!==e[t.group]?e[t.group].end=t:delete e[t.group]}),Object.keys(e).forEach(t=>{const i=e[t];i.end?(i.y=i.start.y+u*(i.end.y-i.start.y),i.y0=i.start.y0+u*(i.end.y0-i.start.y0)):delete e[t]}),Object.keys(e).map(t=>e[t]).map(e=>({y:e.y,y0:e.y0,el:u<.5?e.start:e.end})).filter(e=>null!=e.el.data)})(),h=t-s.y,g=d.filter(e=>h>=e.y&&h<=e.y0),p=(g.length>0?g:d).map(e=>e.el).map(i=>{const r=i.x+s.x,n=i.y+s.y,o=Math.abs(a?t-n:e-r),l=Math.abs(a?e-r:t-n);return{node:i.node,data:i.data,distance:o,secondaryDistance:l,x:r,y:n}});return qr(e,t,p)}},nn={draw:Yr.draw,getClosestElement:Yr.getClosestElement,highlight:Yr.highlight,highlightDataPoints:Yr.highlightDataPoints,addInteraction:Yr.addInteraction,_getBoundsInfo:Yr._getBoundsInfo,_sortElements:Yr._sortElements,init(e){const t=Yr.init(e);return t.transformRules=[t.flip&&w.get("flip")],t.adjustRules=[(e,i)=>{const r=e.scaleSize.isEmptyScale(),n=st(t.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},i,{defMin:n.defMinSize,defMax:n.defMaxSize,minLimit:n.minSize,maxLimit:n.maxSize});return w.get("adjustStaticSizeScale")(e,a)}],t},buildModel(e){const t=Yr.baseModel(e),i=this.node().config.guide,r=Zr(e.model.scaleColor.domain().length),n=`${N}area area i-role-path ${r} ${i.cssClass} `;t.groupAttributes={class:e=>`${n} ${t.class(e[0])} frame`};const a={fill:e=>t.color(e[0]),stroke:e=>t.color(e[0])};return t.pathAttributesEnterInit=a,t.pathAttributesUpdateDone=a,t.pathElement="polygon",t.anchorShape="circle",t.pathTween={attr:"points",fn:be(0,((e,t)=>i=>i.map(i=>[e(i),t(i)].join(",")).join(" "))(e=>e.x,e=>e.y),[i=>({id:e.id(i),x:t.x(i),y:t.y(i)})],e.id)},t}};function an(e){if(e.length<2)return"";for(var t="",i=0;ie.scaleSize.isEmptyScale();return t.adjustRules=[(e,i)=>{const r=st(t.guide.size||{},{defMinSize:2,defMaxSize:n(e)?6:40}),a=Object.assign({},i,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return w.get("adjustStaticSizeScale")(e,a)},r&&((e,t)=>{if(n(e))return()=>({});const i=Object.assign({},t,{sizeDirection:"xy"});return w.get("avoidScalesOverflow")(e,i)})].filter(e=>e),t},buildModel(e){const t=this.node().config,i=t.guide,r=t.options,n=!e.model.scaleSize.dim,a=n?i.widthCssClass||(s=r.width,o=0,s>=160&&s<320?o=1:s>=320&&s<480?o=2:s>=480&&s<640?o=3:s>=640&&(o=4),Kr[o]):"";var s,o;const l=Zr(e.model.scaleColor.domain().length),c=n?"line":"area",u=`${N}${c} ${c} i-role-path ${a} ${l} ${i.cssClass} `,d=n?{stroke:e=>g.color(e[0]),class:"i-role-datum"}:{fill:e=>g.color(e[0])},h="cubic"===oe(i.interpolate)?n?sn:zr:n?an:Fr,g=Yr.baseModel(e),p=n?t=>({id:e.id(t),x:g.x(t),y:g.y(t)}):t=>({id:e.id(t),x:g.x(t),y:g.y(t),size:g.size(t)});return g.groupAttributes={class:e=>`${u} ${g.class(e[0])} frame`},g.pathElement="path",g.anchorShape="circle",g.pathAttributesEnterInit=d,g.pathAttributesUpdateDone=d,g.pathTween={attr:"d",fn:be(0,h,[p],e.id,i.interpolate)},g}},ln=e=>s.select(e).data()[0],cn={init(e){const t=Object.assign({},e);t.guide=t.guide||{},t.guide=st(t.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=t.guide.enableColorToBarPosition?t.guide.enableColorToBarPosition:!t.stack}),t.guide.size=st(t.guide.size||{},{enableDistributeEvenly:!0}),t.guide.label=st(t.guide.label||{},{position:t.flip?t.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:t.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"]});const i=t.guide.avoidScalesOverflow,r=t.guide.enableColorToBarPosition,n=t.guide.size.enableDistributeEvenly;return t.transformRules=[t.flip&&w.get("flip"),t.guide.obsoleteVerticalStackOrder&&w.get("obsoleteVerticalStackOrder"),t.stack&&w.get("stack"),r&&w.get("positioningByColor")].filter(e=>e),t.adjustRules=[n&&((e,i)=>{const r=st(t.guide.size||{},{defMinSize:t.guide.prettify?3:0,defMaxSize:t.guide.prettify?40:Number.MAX_VALUE}),n=Object.assign({},i,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return w.get("size_distribute_evenly")(e,n)}),i&&n&&((e,t)=>{const i=Object.assign({},t,{sizeDirection:"x"});return w.get("avoidScalesOverflow")(e,i)}),t.stack&&w.get("adjustYScale")].filter(e=>e),t},addInteraction(){const e=this.node();e.on("highlight",(e,t)=>this.highlight(t)),e.on("data-hover",(e,t)=>this.highlight(((e,t)=>i=>i===e||t)(t.data,null)))},draw(){const e=this.node(),t=e.config,i=t.options;i.container=i.slot(t.uid);const r=t.guide.prettify,n=`i-role-element i-role-datum bar ${N}bar`,a=e.screenModel,o=this.buildModel(a,{prettify:r,minBarH:1,minBarW:1,baseCssClass:n}),l=ye,c=t.flip?"y":"x",u=t.flip?"x":"y",d=t.flip?"width":"height",h=t.flip?"height":"width",g=a.toFibers(),p=g.reduce((e,t)=>e.concat(t),[]),f=o.class,m=ot(o,"class"),y=i.container.selectAll(".bar").data(p,a.id);y.exit().classed("tau-removing",!0).call(l(t.guide.animationSpeed,null,{[c]:function(){var e=s.select(this);return e.attr(c)-0+(e.attr(h)-0)/2},[u]:function(){return this.getAttribute("data-zero")},[h]:0,[d]:0},e=>{var t=s.select(e);t.classed("tau-removing")&&t.remove()})),y.call(l(t.guide.animationSpeed,null,m));const x=y.enter().append("rect").call(l(t.guide.animationSpeed,{[u]:a[`${u}0`],[d]:0},m)).merge(y).attr("class",f).attr("data-zero",a[`${u}0`]);e.subscribe(new Er(a.model,a.model.flip,t.guide.label,i).draw(g));const b=(()=>{const e=p.reduce((e,t,i)=>(e.set(t,i+1),e),new Map);return(t,i)=>{return(e.get(ln(t))||-1)-(e.get(ln(i))||-1)}})();this._barsSorter=t.guide.sortByBarHeight?t.flip?(e,t)=>{const i=ln(e),r=ln(t),n=o.width(i),a=o.width(r);if(n===a){const n=o.y(i),a=o.y(r);return n===a?b(e,t):n-a}return a-n}:(e,t)=>{const i=ln(e),r=ln(t),n=o.height(i),a=o.height(r);if(n===a){const n=o.x(i),a=o.x(r);return n===a?b(e,t):n-a}return a-n}:b;const v={rect:0,text:1};this._typeSorter=((e,t)=>v[e.tagName]-v[t.tagName]),this._sortElements(this._typeSorter,this._barsSorter),e.subscribe(x),this._boundsInfo=this._getBoundsInfo(x.nodes())},buildModel(e,{prettify:t,minBarH:i,minBarW:r,baseCssClass:n}){const a=i=>{var n=e.size(i);return t&&(n=Math.max(r,n)),n};var s;const o=t=>t[e.model.scaleY.dim];if(e.flip){let r=t=>Math.abs(e.x(t)-e.x0(t));s={y:t=>e.y(t)-.5*a(t),x:n=>{const a=Math.min(e.x0(n),e.x(n));if(t){const e=r(n),t=o(n);var s=0;return 0===t&&(s=0),t>0&&(s=e),t<0&&(s=0-i),ea(e),width:e=>{const n=r(e);return t?0===o(e)?n:Math.max(i,n):n}}}else{let r=t=>Math.abs(e.y(t)-e.y0(t));s={x:t=>e.x(t)-.5*a(t),y:n=>{var a=Math.min(e.y0(n),e.y(n));if(t){a=r(n)0?a-i:a}return a},width:e=>a(e),height:e=>{var n=r(e);return t&&(n=0===o(e)?n:Math.max(i,n)),n}}}return Object.assign(s,{class:t=>`${n} ${e.class(t)}`,fill:t=>e.color(t)})},_sortElements(...e){$t(this.node().config.options.container.node(),ct(...e))},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,{flip:i}=this.node().config,r=e.map(e=>{const i=s.select(e).data()[0],r=t.x(i),n=t.x0(i),a=t.y(i),o=t.y0(i),l=Math.abs(r-n),c=Math.abs(a-o),u=(r+n)/2,d=(a+o)/2;return{node:e,data:i,cx:u,cy:d,box:{top:d-c/2,right:u+l/2,bottom:d+c/2,left:u-l/2},invert:a>o}}),n=r.reduce((e,{box:t})=>(e.left=Math.min(t.left,e.left),e.right=Math.max(t.right,e.right),e.top=Math.min(t.top,e.top),e.bottom=Math.max(t.bottom,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=it(r.map(i?e=>e.cy:e=>e.cx)).sort((e,t)=>e-t),o=a.reduce((e,t)=>(e[t]=[],e),{});r.forEach(e=>{const t=a.find(i?t=>e.cy===t:t=>e.cx===t);o[t].push(e)});const l=e=>{if(1===e.length)return o[e];const t=Math.ceil(e.length/2);return{middle:(e[t-1]+e[t])/2,lower:l(e.slice(0,t)),greater:l(e.slice(t))}};return{bounds:n,tree:l(a)}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=this.node().config.options.container,{flip:a}=this.node().config,s=T(n.node()),o=e-s.x,l=t-s.y,{maxHighlightDistance:c}=this.node().config.guide;if(oi.right+c||li.bottom+c)return null;const u=a?l:o,d=a?o:l;return function e(t){return Array.isArray(t)?t:e(u>t.middle?t.greater:t.lower)}(r).map(e=>{const t=a?e.box.left:e.box.top,i=a?e.box.right:e.box.bottom,r=((e,t,i)=>e>=t&&e<=i)(d,t,i);if(!r&&Math.abs(d-t)>c&&Math.abs(d-i)>c)return null;const n=Math.abs(d-(e.invert!==a?i:t));return Object.assign(e,{distToValue:n,cursorInside:r})}).filter(e=>e).sort((e,t)=>e.cursorInside!==t.cursorInside?t.cursorInside-e.cursorInside:Math.abs(e.distToValue)-Math.abs(t.distToValue)).map(e=>{const t=e.cx,i=e.cy,r=Math.abs(a?l-i:o-t),n=Math.abs(a?o-t:l-i);return{node:e.node,data:e.data,distance:r,secondaryDistance:n,x:t,y:i}})[0]||null},highlight(e){const t=this.node().config.options.container,i={"tau-chart__highlighted":t=>!0===e(t),"tau-chart__dimmed":t=>!1===e(t)};t.selectAll(".bar").call(we(i)),t.selectAll(".i-role-label").call(we(i)),this._sortElements((t,i)=>e(ln(t))-e(ln(i)),this._typeSorter,this._barsSorter)}};var un=i(14);var dn=e=>"date"===e?e=>new Date(e).getTime():e=>e,hn=(e,t)=>He([e,t].map(e=>JSON.stringify).join(""));class gn{constructor(e,t){var i;if(this._fields={},Array.isArray(t.fitToFrameByDims)&&t.fitToFrameByDims.length){let r=e=>{var i={};return"where"===e.type&&e.args?(i.type=e.type,i.args=t.fitToFrameByDims.reduce((t,i)=>(e.args.hasOwnProperty(i)&&(t[i]=e.args[i]),t),{})):i=e,i};i=e.part(r)}else i=e.full();var r=this.getVarSet(i,t);t.order&&(r=nt(at(t.order,r),r)),this.vars=r;const n=r.map(e=>e);this.scaleConfig=t,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",()=>this.vars).addField("isInteger",n.every(Number.isInteger)).addField("originalSeries",()=>n).addField("isContains",e=>this.isInDomain(e)).addField("isEmptyScale",()=>this.isEmpty()).addField("fixup",e=>{var t=this.scaleConfig;t.__fixup__=t.__fixup__||{},t.__fixup__=Object.assign(t.__fixup__,e(Object.assign({},t,t.__fixup__)))}).addField("commit",()=>{this.scaleConfig=Object.assign(this.scaleConfig,this.scaleConfig.__fixup__),delete this.scaleConfig.__fixup__})}isInDomain(e){return this.domain().indexOf(e)>=0}addField(e,t){return this._fields[e]=t,this[e]=t,this}getField(e){return this._fields[e]}isEmpty(){return!Boolean(this._fields.dim)}toBaseScale(e,t=null){var i=Object.keys(this._fields).reduce((e,t)=>(e[t]=this._fields[t],e),e);return i.getHash=(()=>hn(this.vars,t)),i.value=i,i}getVarSet(e,t){return it(t.hasOwnProperty("series")?t.series:e.map(e=>e[t.dim]),dn(t.dimType))}}const pn={...o,...l};let fn={sqrt:e=>Math.sqrt(e),linear:e=>e};const mn={...o,...l};var yn=i(15);const xn={...o,...l,...yn};function bn(e){return xn[`time${e[0].toUpperCase()}${e.slice(1)}`]}const vn={second:{duration:1e3,interval:xn.timeSecond,utc:xn.utcSecond},minute:{duration:6e4,interval:xn.timeMinute,utc:xn.utcMinute},hour:{duration:36e5,interval:xn.timeHour,utc:xn.utcHour},day:{duration:864e5,interval:xn.timeDay,utc:xn.utcDay},week:{duration:6048e5,interval:xn.timeWeek,utc:xn.utcWeek},month:{duration:2592e6,interval:xn.timeMonth,utc:xn.utcMonth},year:{duration:31536e6,interval:xn.timeYear,utc:xn.utcYear}},wn=(()=>{const e=(e,t)=>{return{time:e,step:t,duration:t*e.duration}};return[e(vn.second,1),e(vn.second,5),e(vn.second,15),e(vn.second,30),e(vn.minute,1),e(vn.minute,5),e(vn.minute,15),e(vn.minute,30),e(vn.hour,1),e(vn.hour,3),e(vn.hour,6),e(vn.hour,12),e(vn.day,1),e(vn.day,2),e(vn.week,1),e(vn.month,1),e(vn.month,3),e(vn.year,1)]})();const _n={...o,...l};const Sn={...o,...l};function Mn(e){return Math.log(e)/Math.LN10}function kn(e){if(e[0]*e[1]<=0)throw new x("Logarithmic scale domain cannot cross zero.",b.INVALID_LOG_DOMAIN)}const En={...o,...l};var An=e=>e||null,Tn=(e,t=null)=>Array.isArray(e)?0===e.length?[t]:e:[e],On=(e,t)=>({type:e,x:t.x,y:t.y,identity:t.identity,size:t.size,color:t.color,split:t.split,label:t.label,guide:{color:t.colorGuide,obsoleteVerticalStackOrder:t.obsoleteVerticalStackOrder,size:t.sizeGuide},flip:t.flip,stack:t.stack});const Cn={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"};var Nn={[Cn.SUCCESS]:e=>e,[Cn.FAIL]:(e,t)=>{throw new Error((t.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},[Cn.WARNING]:(e,t,i)=>{var r=t.axis,n=t.indexMeasureAxis[0],a=e[n],s=e.filter(e=>e!==a);s.push(a);var o=i[n][r]||{},l=i[i.length-1][r]||{};return i[i.length-1][r]=o,i[n][r]=l,s}};function Ln(e,t,i){return t.reduce(function(t,r,n){var a=e[r];return a?t.status!=Cn.FAIL&&("measure"===a.type&&(t.countMeasureAxis++,t.indexMeasureAxis.push(n)),"measure"!==a.type&&1===t.countMeasureAxis?t.status=Cn.WARNING:t.countMeasureAxis>1&&(t.status=Cn.FAIL,t.messages.push(`There is more than one measure dimension for "${i}" axis`))):(t.status=Cn.FAIL,r?t.messages.push(`"${r}" dimension is undefined for "${i}" axis`):t.messages.push(`"${i}" axis should be specified`)),t},{status:Cn.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:i})}function Fn(e){var t=Tn(e.x),i=Tn(e.y),r=Math.max(t.length,i.length),n=Tn(e.guide||{},{});let a=r-n.length;for(let e=0;e{const r=e[i],n=function(e,t,i){return null==t?t:String(t)}(e.dimensions,r);return null!=n&&(t[i]=n),t},{});return Object.assign({},e,{x:t,y:i,guide:n},l)}function zn(e,t){for(var i=t.x,r=t.y,n=t.guide,a=Math.max(i.length,r.length),s={type:"COORDS.RECT",unit:[]},o=[].concat(i),l=[].concat(r),c=[].concat(n),u=a;u>0;u--){var d=o.pop(),h=l.pop(),g=c.pop()||{};u===a?(s.x=d,s.y=h,s.unit.push(On(e,{x:An(d),y:An(h),identity:t.identity,split:t.split,color:t.color,label:t.label,size:t.size,flip:t.flip,stack:t.stack,colorGuide:g.color,obsoleteVerticalStackOrder:g.obsoleteVerticalStackOrder,sizeGuide:g.size})),s.guide=st(g,{x:{label:d},y:{label:h}})):s={type:"COORDS.RECT",x:An(d),y:An(h),unit:[s],guide:st(g,{x:{label:d},y:{label:h}})}}return t.spec={dimensions:t.dimensions,unit:s},t}const Rn=e=>{var t=Fn(e);return zn("ELEMENT.INTERVAL",t=(e=>{var t=(e.flip?e.y:e.x).indexOf(e.color)>=0,i=e.guide[e.guide.length-1];return t&&!i.hasOwnProperty("enableColorToBarPosition")&&(i.enableColorToBarPosition=!1),e})(t))},$n=e=>{var t=Fn(e),i=t.data,r=t.settings.log,n=(0,{horizontal:e=>({prop:e.x[e.x.length-1],flip:!1}),vertical:e=>({prop:e.y[e.y.length-1],flip:!0}),auto:e=>{var t,n=e.x,a=e.y,s=n[n.length-1],o=n.slice(0,n.length-1),l=a[a.length-1],c=a.slice(0,a.length-1),u=e.color,d=o.concat(c).concat([u]).filter(e=>null!==e),h=-1,g=[[[s].concat(d),l],[[l].concat(d),s]],p=null;return g.some((e,t)=>{var n=e[0],a=e[1],s=ri.isYFunctionOfX(i,n,[a]);return s.result?h=t:r(["Attempt to find a functional relation between",e[0]+" and "+e[1]+" is failed.","There are several "+s.error.keyY+" values (e.g. "+s.error.errY.join(",")+")","for ("+s.error.keyX+" = "+s.error.valX+")."].join(" ")),s.result})?(t=g[h][0][0],p=0!==h):(r("All attempts are failed. Gonna transform AREA to general PATH."),t=null),{prop:t,flip:p}}}["boolean"!=typeof t.flip?"auto":t.flip?"vertical":"horizontal"])(t);return null!==n.prop&&(t.data=ri.sortByDim(i,n.prop,t.dimensions[n.prop]),t.flip=n.flip),zn("ELEMENT.AREA",t)};class Dn{constructor(e){this.unitRef=e}value(){return this.unitRef}clone(){return JSON.parse(JSON.stringify(this.unitRef))}traverse(e){var t=(e,i,r)=>{i(e,r),(e.units||[]).map(r=>t(r,i,e))};return t(this.unitRef,e,null),this}reduce(e,t){var i=t;return this.traverse((t,r)=>i=e(i,t,r)),i}addFrame(e){return this.unitRef.frames=this.unitRef.frames||[],e.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),e.source=e.hasOwnProperty("source")?e.source:this.unitRef.expression.source,e.pipe=e.pipe||[],this.unitRef.frames.push(e),this}addTransformation(e,t){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:e,args:t}),this}isCoordinates(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")}isElementOf(e){if(this.isCoordinates())return!1;var t=(this.unitRef.type||"").split("/");return 1===t.length&&t.unshift("RECT"),t[0].toUpperCase()===e.toUpperCase()}}class Pn{constructor(e){this.specRef=e}value(){return this.specRef}unit(e){return e&&(this.specRef.unit=e),new Dn(this.specRef.unit)}addTransformation(e,t){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[e]=t,this}getSettings(e){return this.specRef.settings[e]}setSettings(e,t){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[e]=t,this}getScale(e){return this.specRef.scales[e]}addScale(e,t){return this.specRef.scales[e]=t,this}regSource(e,t){return this.specRef.sources[e]=t,this}getSourceData(e){return(this.specRef.sources[e]||{data:[]}).data}getSourceDim(e,t){return(this.specRef.sources[e]||{dims:{}}).dims[t]||{}}}var jn={};class In{static unit(e){return new Dn(e)}static spec(e){return new Pn(e)}static cloneObject(e){return JSON.parse(JSON.stringify(e))}static depthFirstSearch(e,t){if(t(e))return e;for(var i=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],r=0;r{t(e,r),(e.units||[]).map(r=>i(r,t,e))};i(e.unit,t,null)}static extractFieldsFormatInfo(e){var t=e.scales,i=function(e){return!t[e].dim},r=function(e,i,r){var n=i.guide||{},a=t[i[r]],s=n[r]||{};e[a.dim]=e[a.dim]||{label:[],format:[],nullAlias:[],tickLabel:[]};var o=s.label,l=s.label||{};e[a.dim].label.push("string"==typeof o?o:l._original_text||l.text);var c=s.tickFormat||s.tickPeriod;e[a.dim].format.push(c),e[a.dim].nullAlias.push(s.tickFormatNullAlias),e[a.dim].tickLabel.push(s.tickLabel)},n=[];In.traverseSpec(e,function(e){n.push(e)});var a=n.reduce(function(e,t){return"COORDS.RECT"===t.type&&t.hasOwnProperty("x")&&!i(t.x)&&r(e,t,"x"),"COORDS.RECT"===t.type&&t.hasOwnProperty("y")&&!i(t.y)&&r(e,t,"y"),t.hasOwnProperty("color")&&!i(t.color)&&r(e,t,"color"),t.hasOwnProperty("size")&&!i(t.size)&&r(e,t,"size"),t.hasOwnProperty("label")&&!i(t.label)&&r(e,t,"label"),e},{}),s=function(e,t){return e.filter(e=>e)[0]||t};return Object.keys(a).reduce(function(t,i){t[i]={},t[i].label=s(a[i].label,i);const r=s(a[i].format,null);t[i].nullAlias=s(a[i].nullAlias,`No ${t[i].label}`),t[i].tickLabel=s(a[i].tickLabel,null);const n="x-time-auto"===r?e.settings.utcTime?"day-utc":"day":r;var o=t[i].nullAlias,l=n?gi.get(n,o):e=>null==e?o:String(e);if(t[i].format=l,t[i].tickLabel){var c=i.replace("."+t[i].tickLabel,"");t[c]={label:t[i].label,nullAlias:t[i].nullAlias,tickLabel:t[i].tickLabel,format:function(e){return l(e&&e[t[c].tickLabel])},isComplexField:!0},t[i].parentField=c}return t},{})}static getFieldFormatters(e,t){const i=In.extractFieldsFormatInfo(e);Object.keys(i).forEach(e=>{i[e].parentField&&delete i[e]});return Object.keys(t).forEach(e=>{const r=(e=>{let t={};return"function"==typeof e||"string"==typeof e?t={format:e}:Pe(e)&&(t=ut(e,"label","format","nullAlias")),t})(t[e]);i[e]=Object.assign({label:e,nullAlias:"No "+e},i[e]||{},ut(r,"label","nullAlias")),r.hasOwnProperty("format")?i[e].format="function"==typeof r.format?r.format:gi.get(r.format,i[e].nullAlias):i[e].format=i[e].hasOwnProperty("format")?i[e].format:gi.get(null,i[e].nullAlias)}),Object.keys(i).reduce((e,t)=>{const r=i[t];return e[t]={label:r.label,format:r.format},e},{})}static tokens(){return{reg:function(e,t){return jn[e]=t,this},get:function(e){return jn[e]||e}}}static getParentUnit(e,t){var i=null;const r=(e,n)=>e.uid===t.uid?(i=n,!0):(e.frames?e.frames.some(t=>(t.units||[]).some(t=>r(t,e))):(e.units||[]).some(t=>r(t,e)),!1);return r(e.unit,null),i}}i(16);i.d(t,"api",function(){return Hn}),i.d(t,"version",function(){return Gn}),i.d(t,"GPL",function(){return Gt}),i.d(t,"Plot",function(){return qi}),i.d(t,"Chart",function(){return Ki});var Bn={},Wn={},Hn={errorCodes:b,unitsRegistry:Zt,scalesRegistry:ti,grammarRegistry:w,tickFormat:gi,isChartElement:vt,utils:n,svgUtils:r,domUtils:a,tickPeriod:y,colorBrewers:{add:function(e,t){Bn.hasOwnProperty(e)||(Bn[e]=t)},get:function(e){return Bn[e]}},d3_animationInterceptor:ye,pluginsSDK:In,plugins:{add:function(e,t){if(Wn.hasOwnProperty(e))throw new Error("Plugin is already registered.");Wn[e]=t},get:function(e){return Wn[e]||(t=>{throw new Error(`"${e}" plugin is not defined`)})}},chartTypesRegistry:Ji,globalSettings:{animationSpeed:750,renderingTimeout:1e4,asyncRendering:!0,syncRenderingInterval:50,syncPointerEvents:!1,handleRenderingErrors:!1,experimentalShouldAnimate:e=>{const t=(e,t)=>{var i=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(e=>i.setAttribute(e,String(t[e]))),i},i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",document.body.appendChild(i);const r=t("svg",{width:100,height:100});i.appendChild(r);const n=performance.now();var a,s,o;for(a=0;a<10;a++)for(s=0;s<10;s++)o=t("circle",{fill:"black",r:5,cx:10*a,cy:10*s}),r.appendChild(o);const l=performance.now()-n;return document.body.removeChild(i),e.sources["/"].data.length*l<500},defaultNiceColor:!0,defaultColorBrewer:["#fde725","#fbe723","#f8e621","#f6e620","#f4e61e","#f1e51d","#efe51c","#ece51b","#eae51a","#e7e419","#e5e419","#e2e418","#dfe318","#dde318","#dae319","#d8e219","#d5e21a","#d2e21b","#d0e11c","#cde11d","#cae11f","#c8e020","#c5e021","#c2df23","#c0df25","#bddf26","#bade28","#b8de29","#b5de2b","#b2dd2d","#b0dd2f","#addc30","#aadc32","#a8db34","#a5db36","#a2da37","#a0da39","#9dd93b","#9bd93c","#98d83e","#95d840","#93d741","#90d743","#8ed645","#8bd646","#89d548","#86d549","#84d44b","#81d34d","#7fd34e","#7cd250","#7ad151","#77d153","#75d054","#73d056","#70cf57","#6ece58","#6ccd5a","#69cd5b","#67cc5c","#65cb5e","#63cb5f","#60ca60","#5ec962","#5cc863","#5ac864","#58c765","#56c667","#54c568","#52c569","#50c46a","#4ec36b","#4cc26c","#4ac16d","#48c16e","#46c06f","#44bf70","#42be71","#40bd72","#3fbc73","#3dbc74","#3bbb75","#3aba76","#38b977","#37b878","#35b779","#34b679","#32b67a","#31b57b","#2fb47c","#2eb37c","#2db27d","#2cb17e","#2ab07f","#29af7f","#28ae80","#27ad81","#26ad81","#25ac82","#25ab82","#24aa83","#23a983","#22a884","#22a785","#21a685","#21a585","#20a486","#20a386","#1fa287","#1fa187","#1fa188","#1fa088","#1f9f88","#1f9e89","#1e9d89","#1e9c89","#1e9b8a","#1f9a8a","#1f998a","#1f988b","#1f978b","#1f968b","#1f958b","#1f948c","#20938c","#20928c","#20928c","#21918c","#21908d","#218f8d","#218e8d","#228d8d","#228c8d","#228b8d","#238a8d","#23898e","#23888e","#24878e","#24868e","#25858e","#25848e","#25838e","#26828e","#26828e","#26818e","#27808e","#277f8e","#277e8e","#287d8e","#287c8e","#297b8e","#297a8e","#29798e","#2a788e","#2a778e","#2a768e","#2b758e","#2b748e","#2c738e","#2c728e","#2c718e","#2d718e","#2d708e","#2e6f8e","#2e6e8e","#2e6d8e","#2f6c8e","#2f6b8e","#306a8e","#30698e","#31688e","#31678e","#31668e","#32658e","#32648e","#33638d","#33628d","#34618d","#34608d","#355f8d","#355e8d","#365d8d","#365c8d","#375b8d","#375a8c","#38598c","#38588c","#39568c","#39558c","#3a548c","#3a538b","#3b528b","#3b518b","#3c508b","#3c4f8a","#3d4e8a","#3d4d8a","#3e4c8a","#3e4a89","#3e4989","#3f4889","#3f4788","#404688","#404588","#414487","#414287","#424186","#424086","#423f85","#433e85","#433d84","#443b84","#443a83","#443983","#453882","#453781","#453581","#463480","#46337f","#46327e","#46307e","#472f7d","#472e7c","#472d7b","#472c7a","#472a7a","#482979","#482878","#482677","#482576","#482475","#482374","#482173","#482071","#481f70","#481d6f","#481c6e","#481b6d","#481a6c","#48186a","#481769","#481668","#481467","#471365","#471164","#471063","#470e61","#470d60","#460b5e","#460a5d","#46085c","#46075a","#450559","#450457","#440256","#440154"],defaultClassBrewer:Ze(20).map(e=>"color20-"+(1+e)),log:(e,t)=>{t=t||"INFO",Array.isArray(e)||(e=[e]),console[t.toLowerCase()].apply(console,e)},facetLabelDelimiter:" → ",excludeNull:!0,minChartWidth:300,minChartHeight:200,minFacetWidth:150,minFacetHeight:100,specEngine:[{name:"COMPACT",width:600,height:400},{name:"AUTO",width:Number.MAX_VALUE,height:Number.MAX_VALUE}],fitModel:"normal",layoutEngine:"EXTRACT",autoRatio:!0,defaultSourceMap:["https://raw.githubusercontent.com","TargetProcess/tauCharts/master/src/addons","world-countries.json"].join("/"),getAxisTickLabelSize:lt(Ct,e=>String(String(e).length)),getScrollbarSize:kt,avoidScrollAtRatio:1.5,xAxisTickLabelLimit:150,yAxisTickLabelLimit:150,xTickWordWrapLinesLimit:2,yTickWordWrapLinesLimit:2,xTickWidth:9,yTickWidth:9,distToXAxisLabel:10,distToYAxisLabel:10,xAxisPadding:20,yAxisPadding:20,xFontLabelDescenderLineHeight:4,xFontLabelHeight:10,yFontLabelHeight:10,xDensityPadding:2,yDensityPadding:2,"xDensityPadding:measure":8,"yDensityPadding:measure":8,utcTime:!1,defaultFormats:{measure:"x-num-auto","measure:time":"x-time-auto"}}};qi.__api__=Hn,qi.globalSettings=Hn.globalSettings,Hn.unitsRegistry.reg("COORDS.RECT",class extends g{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),this.config.guide.x=this.config.guide.x||{},this.config.guide.x=st(this.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof this.config.guide.x.label&&(this.config.guide.x.label={text:this.config.guide.x.label}),this.config.guide.x.label=st(this.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),this.config.guide.y=this.config.guide.y||{},this.config.guide.y=st(this.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof this.config.guide.y.label&&(this.config.guide.y.label={text:this.config.guide.y.label}),this.config.guide.y.label=st(this.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var t=this.config,i=t.guide;if("extract-axes"===i.autoLayout){var r=t.options.containerHeight-(t.options.top+t.options.height);i.x.hide=i.x.hide||Math.floor(r)>0,i.y.hide=i.y.hide||Math.floor(t.options.left)>0}var n=this.config.options,a=this.config.guide.padding;this.L=n.left+a.l,this.T=n.top+a.t,this.W=n.width-(a.l+a.r),this.H=n.height-(a.t+a.b)}defineGrammarModel(e){const t=this.W,i=this.H;return this.xScale=e("pos",this.config.x,[0,t]),this.yScale=e("pos",this.config.y,e=>["ordinal","period"].indexOf(e.type)>=0?[0,i]:[i,0]),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:()=>t/2,yi:()=>i/2,sizeX:()=>t,sizeY:()=>i}}getGrammarRules(){return[e=>{var t=e.scaleX,i=e.scaleY;return{xi:i=>i?t(i[t.dim]):e.xi(i),yi:t=>t?i(t[i.dim]):e.yi(t),sizeX:i=>i?t.stepSize(i[t.dim]):e.sizeX(i),sizeY:t=>t?i.stepSize(t[i.dim]):e.sizeY(t)}}]}createScreenModel(e){return e}allocateRect(e){var t=this.screenModel;return{slot:e=>this.config.options.container.selectAll(`.uid_${e}`),left:t.xi(e)-t.sizeX(e)/2,top:t.yi(e)-t.sizeY(e)/2,width:t.sizeX(e),height:t.sizeY(e),containerWidth:this.W,containerHeight:this.H}}drawFrames(e){var t=Object.assign({},this.config),i=t.options,r=this.W,n=this.H;if(t.x=this.xScale,t.y=this.yScale,t.x.scaleObj=this.xScale,t.y.scaleObj=this.yScale,t.x.guide=t.guide.x,t.y.guide=t.guide.y,t.x.guide.label.size=r,t.y.guide.label.size=n,(i.container.attr("transform")?he(i.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):i.container).attr("transform",S(this.L,this.T)),t.x.guide.hide)this._removeDimAxis(i.container,t.x);else{var a="top"===t.x.guide.scaleOrient?[0,0-t.guide.x.padding]:[0,n+t.guide.x.padding];this._drawDimAxis(i.container,t.x,a,r)}if(t.y.guide.hide)this._removeDimAxis(i.container,t.y);else{var s="right"===t.y.guide.scaleOrient?[r+t.guide.y.padding,0]:[0-t.guide.y.padding,0];this._drawDimAxis(i.container,t.y,s,n)}var o=e.reduce((e,t)=>e.concat((t.units||[]).map(e=>e.uid)),[]),l=this._drawGrid(i.container,t,r,n,i),c=xe(l,".cell").data(o,e=>e);c.enter().append("g").attr("class",e=>`${N}cell cell uid_${e}`).merge(c).classed("tau-active",!0),he(c,this.config.guide.animationSpeed).attr("opacity",1),he(c.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()}_drawDimAxis(e,t,i,r){var n=gi.get(t.guide.tickFormat,t.guide.tickFormatNullAlias),a=D({scale:t.scaleObj,scaleGuide:t.guide,ticksCount:n?Qi(r/t.guide.density):null,tickFormat:n||null,position:i}),s=this.config.guide.animationSpeed;Zi(e,this._getAxisSelector(t)).classed("tau-active",!0).classed(t.guide.cssClass,!0).call(e=>{var t=he(e,s,"axisTransition"),r=e.attr("transform");S(...i)!==r&&(r?t:e).attr("transform",S(...i)),t.call(a),t.attr("opacity",1)})}_removeDimAxis(e,t){var i=xe(e,this._getAxisSelector(t)).classed("tau-active",!1);he(i,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()}_getAxisSelector(e){return`g.${"h"===k(e.guide.scaleOrient)?"x":"y"}.axis`}_drawGrid(e,t,i,r){return Zi(e,"g.grid").attr("transform",S(0,0)).call(e=>{var n=e,a=this.config.guide.animationSpeed,s=(t.guide.showGridLines||"").toLowerCase();if(s.length>0){var o=Zi(n,"g.grid-lines");if(s.indexOf("x")>-1){let e=t.x,n=gi.get(e.guide.tickFormat);var l=P({scale:e.scaleObj,scaleGuide:e.guide,tickSize:r,ticksCount:n?Qi(i/e.guide.density):null}),c=Zi(o,"g.grid-lines-x");he(c,a).call(l)}if(s.indexOf("y")>-1){let e=t.y,n=gi.get(e.guide.tickFormat);var u=P({scale:e.scaleObj,scaleGuide:e.guide,tickSize:-i,ticksCount:n?Qi(r/e.guide.density):null}),d=Zi(o,"g.grid-lines-y");he(d,a).call(u)}}})}}).reg("COORDS.MAP",class extends g{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{defaultFill:"rgba(128,128,128,0.25)",padding:{l:0,r:0,t:0,b:0},showNames:!0}),this.contourToFill=null,this.on("highlight-area",(e,t)=>this._highlightArea(t)),this.on("highlight-point",(e,t)=>this._highlightPoint(t)),this.on("highlight",(e,t)=>this._highlightPoint(t))}defineGrammarModel(e){var t=this.config,i=t.options,r=t.guide.padding,n=i.width-(r.l+r.r),a=i.height-(r.t+r.b);return this.latScale=e("pos",t.latitude,[0,a]),this.lonScale=e("pos",t.longitude,[n,0]),this.sizeScale=e("size",t.size),this.colorScale=e("color",t.color),this.codeScale=e("value",t.code),this.fillScale=e("fill",t.fill),this.W=n,this.H=a,this.regScale("latitude",this.latScale).regScale("longitude",this.lonScale).regScale("size",this.sizeScale).regScale("color",this.colorScale).regScale("code",this.codeScale).regScale("fill",this.fillScale),{}}drawFrames(e){var t=this.config.guide;"string"==typeof t.sourcemap?function(e,t){const i=new XMLHttpRequest;i.onload=(()=>{if(i.status>=200&&i.status<300){const e=i.responseText;try{t(null,JSON.parse(e))}catch(e){t(e,null)}}else t(new Error(`${i.status}: ${i.statusText}`),null)}),i.onerror=(e=>{t(e.error,null)}),i.open("GET",e,!0),i.send(null)}(t.sourcemap,(t,i)=>{if(t)throw t;this._drawMap(e,i)}):this._drawMap(e,t.sourcemap)}_calcLabels(e,t,i){var r=this.W,n=this.H,a={};return t.forEach(t=>{var s=(ir.feature(e,e.objects[t]).features||[]).map(e=>{var n=e.properties||{},a=i.centroid(e),s=i.bounds(e),o=a[0],l=a[1],c=s[1][0]-s[0][0],u=n.name||"",d=n.abbr||u,h=c!Number.isNaN(e.x)&&!Number.isNaN(e.y)),o=s.map(e=>({x:e.sx,y:e.sy,r:e.r}));rr().label(s).anchor(o).width(r).height(n).start(sr),s.filter(e=>!e.isRef).map(e=>(e.x=e.sx,e.y=e.sy,e)).reduce((e,t)=>(e[t.id]=t,e),a);var l=s.filter(e=>e.isRef);l.length<6&&l.reduce((e,t)=>(e[t.id]=t,e),a)}),a}_drawMap(e,t){var i,r,n=this,a=this.config.guide,o=this.config.options,l=this.config.options.container,c=this.latScale,u=this.lonScale,d=this.sizeScale,h=this.colorScale,g=this.codeScale,p=this.fillScale,f=this.W,m=this.H,y=lr.filter(e=>(t.objects||{}).hasOwnProperty(e));if(0===y.length)throw new Error("Invalid map: should contain some contours");if(p.dim){if(!g.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===y.indexOf(g.georole))throw console.log(`There is no contour for georole "${g.georole}"`),console.log(`Available contours are: ${y.join(" | ")}`),new Error("Invalid [georole]");i=g.georole}else i=y[y.length-1];if(this.contourToFill=i,c.dim&&u.dim){var x=nr.extent(c.domain()),b=nr.extent(u.domain());r=[(b[1]+b[0])/2,(x[1]+x[0])/2]}var v=this._createProjection(t,y[0],r),w=nr.geoPath().projection(v),_=l.selectAll(".map-container").data([`${f}${m}${r}${y.join("-")}`],e=>e);_.exit().remove();const S=_.enter().append("g").call(function(e){var i=e;i.attr("class","map-container");var r={},s=y.reduceRight((e,t)=>e.concat(t),[]);if(a.showNames&&(r=n._calcLabels(t,s,w)),s.forEach((e,n)=>{var a=t=>r[`${e}-${t.id}`];i.selectAll(`.map-contour-${e}`).data(ir.feature(t,t.objects[e]).features||[]).enter().append("g").call(function(t){var i=t;i.attr("class",`map-contour-${e} map-contour-level map-contour-level-${n}`).attr("fill","none"),i.append("title").text(e=>(e.properties||{}).name),i.append("path").attr("d",w),i.append("text").attr("class",`place-label-${e}`).attr("transform",e=>{var t=a(e);return t?`translate(${[t.x,t.y]})`:""}).text(e=>{var t=a(e);return t?t.name:""}),i.append("line").attr("class",`place-label-link-${e}`).attr("stroke","gray").attr("stroke-width",.25).attr("x1",e=>{var t=a(e);return t&&t.isRef?t.sx:0}).attr("y1",e=>{var t=a(e);return t&&t.isRef?t.sy:0}).attr("x2",e=>{var t=a(e);return t&&t.isRef?t.x-.6*t.name.length*ar:0}).attr("y2",e=>{var t=a(e);return t&&t.isRef?t.y-3.5:0})})}),t.objects.hasOwnProperty("places")){var o=ir.feature(t,t.objects.places),l=o.features.map(e=>{var t=v(e.geometry.coordinates);return{x:t[0]+3.5,y:t[1]+3.5,width:e.properties.name.length*ar,height:12,name:e.properties.name}}),c=o.features.map(e=>{var t=v(e.geometry.coordinates);return{x:t[0],y:t[1],r:2.5}});rr().label(l).anchor(c).width(f).height(m).start(100),i.selectAll(".place").data(c).enter().append("circle").attr("class","place").attr("transform",e=>`translate(${e.x},${e.y})`).attr("r",e=>`${e.r}px`),i.selectAll(".place-label").data(l).enter().append("text").attr("class","place-label").attr("transform",e=>`translate(${e.x},${e.y})`).text(e=>e.name)}}).merge(_);this.groupByCode=e.reduce((e,t)=>t.part().reduce((e,t)=>(e[(t[g.dim]||"").toLowerCase()]=t,e),e),{});var M=this._resolveFeature.bind(this);if(S.selectAll(`.map-contour-${i}`).data(ir.feature(t,t.objects[i]).features).call(function(e){e.classed("map-contour",!0).attr("fill",e=>{var t=M(e);return null===t?a.defaultFill:p(t[p.dim])})}).on("mouseover",e=>this.fire("area-mouseover",{data:M(e),event:s.event})).on("mouseout",e=>this.fire("area-mouseout",{data:M(e),event:s.event})).on("click",e=>this.fire("area-click",{data:M(e),event:s.event})),!c.dim||!u.dim)return[];var k=function(e){return e.attr("r",e=>d(e[d.dim])).attr("transform",({data:e})=>`translate(${v([e[u.dim],e[c.dim]])})`).attr("class",({data:e})=>h(e[h.dim])).attr("opacity",or).on("mouseover",({data:e})=>n.fire("point-mouseover",{data:e,event:s.event})).on("mouseout",({data:e})=>n.fire("point-mouseout",{data:e,event:s.event})).on("click",({data:e})=>n.fire("point-click",{data:e,event:s.event}))},E=S.selectAll(".frame").data(e.map(e=>({tags:e.key||{},hash:e.hash(),data:e.part()})),e=>e.hash);return E.exit().remove(),E.enter().append("g").merge(E).call(function(e){e.attr("class",e=>`frame frame-${e.hash}`).call(function(e){var t=e.selectAll("circle").data(e=>e.data.map(e=>({data:e,uid:o.uid})));t.exit().remove(),t.call(k),t.enter().append("circle").call(k)})}),[]}_resolveFeature(e){var t,i=this.groupByCode,r=e.properties,n=["c1","c2","c3","abbr","name"].filter(e=>r.hasOwnProperty(e)&&r[e]&&i.hasOwnProperty(r[e].toLowerCase()));if(0===n.length)t=null;else if(n.length>0){let e=r[n[0]].toLowerCase();t=i[e]}return t}_highlightArea(e){var t=this.config.options.container,i=this.contourToFill;t.selectAll(`.map-contour-${i}`).classed("map-contour-highlighted",t=>e(this._resolveFeature(t)))}_highlightPoint(e){this.config.options.container.selectAll("circle").classed("map-point-highlighted",({data:t})=>e(t)).attr("opacity",({data:t})=>e(t)?or:.1)}_createProjection(e,t,i){var r=this.W,n=this.H,a=this.config.guide,s=100,o=[r/2,n/2],l=i||e.center,c=a.projection||e.projection||"mercator",u=this._createD3Projection(c,l,s,o),d=nr.geoPath().projection(u).bounds(ir.feature(e,e.objects[t])),h=s*r/(d[1][0]-d[0][0]),g=s*n/(d[1][1]-d[0][1]);return s=he.args).reduce((e,t)=>(e[t.method]&&(e=e[t.method](t.args)),e),s)}}).reg("COORDS.PARALLEL",class extends g{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{padding:{l:50,r:50,t:50,b:50},enableBrushing:!1}),this.columnsBrushes={},this.columnsSelections={},this.on("force-brush",(e,t)=>this._forceBrushing(t));var t=this.config.options,i=this.config.guide.padding;this.L=t.left+i.l,this.T=t.top+i.t,this.W=t.width-(i.l+i.r),this.H=t.height-(i.t+i.b)}defineGrammarModel(e){var t=this.config,i=this.W,r=this.H;this.columnsScalesMap=t.columns.reduce((t,i)=>(t[i]=e("pos",i,[0,r]),t),{});var n=i/(t.columns.length-1),a=t.columns.reduce((e,t,i)=>(e[t]=i*n,e),{});return this.xBase=(e=>a[e]),this.regScale("columns",this.columnsScalesMap),{}}allocateRect(){return{slot:e=>this.config.options.container.selectAll(`.uid_${e}`),left:0,top:0,width:this.W,height:this.H,containerWidth:this.W,containerHeight:this.H}}drawFrames(e){var t=Object.assign({},this.config),i=t.options,r=this._fnDrawGrid(i.container,t,i.frameId,Object.keys(this.columnsScalesMap).reduce((e,t)=>e.concat([this.columnsScalesMap[t].getHash()]),[]).join("_")),n=r.selectAll(`.parent-frame-${i.frameId}`).data(e,e=>e.hash());n.exit().remove(),n.enter().append("g").attr("class",e=>`${N}cell cell parent-frame-${i.frameId} frame-${e.hash()}`).merge(n).each(function(e){var t,r,n,a;t=i.frameId,r=er.select(this),n=e,(a=r.selectAll(`.layer_${t}`).data(n.units,e=>e.uid)).exit().remove(),a.enter().append("g").attr("class",e=>`layer_${t} uid_${e.uid}`)});var a=this._fnDrawColumns(r,t);t.guide.enableBrushing&&this._enableBrushing(a)}_fnDrawGrid(e,t,i,r){var n=e.selectAll(`.grid_${i}`).data([r],e=>e);return n.exit().remove(),n.enter().append("g").attr("class",`grid grid_${i}`).attr("transform",S(this.L,this.T)).merge(n)}_fnDrawColumns(e,t){var i=t.guide.columns||{},r=this.xBase,n=this.columnsScalesMap,a=er.axisLeft(),s=e.selectAll(".column").data(t.columns,e=>e);return s.exit().remove(),s.enter().append("g").attr("class","column").attr("transform",e=>S(r(e),0)).call(function(e){e.append("g").attr("class","y axis").each(function(e){var t=n[e].dim,r=a.scale(n[e]),s=i[t]||{},o=gi.get(s.tickFormat,s.tickFormatNullAlias);null!==o&&r.tickFormat(o),er.select(this).call(r)}).append("text").attr("class","label").attr("text-anchor","middle").attr("y",-9).text(e=>((i[e]||{}).label||{}).text||n[e].dim)}).merge(s)}_enableBrushing(e){var t=this.columnsSelections,i=this.columnsScalesMap,r=this.columnsBrushes,n=!0,a=e=>e,o=e=>e,l=()=>{var e=Object.keys(r).find(e=>r[e]===s.event.target);if(t[e]=s.event.selection,n){var a=Object.keys(r).filter(e=>t[e]).map(e=>{var r=[];if(i[e].discrete){let n=t[e];r=i[e].domain().filter(t=>{var r=i[e](t);return n[0]<=r&&n[1]>=r})}else{let n=t[e].map(i[e].invert);r=[n[0],n[1]]}return{dim:i[e].dim,func:i[e].discrete?"inset":"between",args:r}});this.fire("brush",a)}};return e.selectAll(".brush").remove(),e.append("g").attr("class","brush").each(function(e){var t=i[e].range();r[e]=er.brushY().extent([[0,t[0]],[16,t[1]]]).on("start",a).on("brush",l).on("end",o),er.select(this).classed(`brush-${He(e)}`,!0).call(r[e]),n=!1,r[e].move(er.select(this),t),n=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),e}_forceBrushing(e={}){var t=this.columnsBrushes,i=this.columnsScalesMap;this.columnsSelections,Object.keys(e).filter(r=>t[r]&&i[r]&&e[r]).forEach(r=>{var n=e[r],a=[];if(i[r].discrete){var s=n.map(i[r]).filter(e=>e>=0),o=i[r].stepSize()/2;a=[Math.min(...s)-o,Math.max(...s)+o]}else a=[n[0],n[1]];var l=He(r);t[r](er.select(`.brush-${l}`)),t[r].move(er.select(`.brush-${l}`),a.map(i[r]))})}}).reg("ELEMENT.GENERIC.CARTESIAN",_e).reg("ELEMENT.POINT",Tr,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.LINE",on,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.PATH",nn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.AREA",rn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.INTERVAL",cn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.INTERVAL.STACKED",cn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.INTERVAL.STACKED",cn,"ELEMENT.GENERIC.CARTESIAN").reg("PARALLEL/ELEMENT.LINE",class extends g{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{}),this.on("highlight",(e,t)=>this.highlight(t))}defineGrammarModel(e){var t=this.config,i=t.options;this.color=e("color",t.color,{}),this.scalesMap=t.columns.reduce((t,r)=>(t[r]=e("pos",r,[0,i.height]),t),{});var r=i.width/(t.columns.length-1),n=t.columns.reduce((e,t,i)=>(e[t]=i*r,e),{});return this.xBase=(e=>n[e]),this.regScale("columns",this.scalesMap).regScale("color",this.color),{}}drawFrames(e){var t=this.config,i=this.config.options,r=this.scalesMap,n=this.xBase,a=this.color,s=un.line(),o=function(e){e.attr("d",e=>s(t.columns.map(t=>[n(t),r[t](e[r[t].dim])])))},l=function(e){e.attr("stroke",e=>a.toColor(a(e[a.dim]))),e.attr("class",e=>`${N}__line line ${a.toClass(a(e[a.dim]))} foreground`)},c=function(e){var t=e.selectAll(".background").data(e=>e.part());t.exit().remove(),t.call(o),t.enter().append("path").attr("class","background line").call(o);var i=e.selectAll(".foreground").data(e=>e.part());i.exit().remove(),i.call(function(e){o(e),l(e)}),i.enter().append("path").call(function(e){o(e),l(e)})},u=i.container.selectAll(".lines-frame").data(e,e=>e.hash());u.exit().remove(),u.call(c),u.enter().append("g").attr("class","lines-frame").call(c),this.subscribe(i.container.selectAll(".lines-frame .foreground"))}highlight(e){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",t=>e(t)?"":"hidden")}}),Hn.scalesRegistry.reg("identity",class extends gn{constructor(e,t){super(e,t),this._references=t.references,this._refCounter=t.refCounter,this.addField("scaleType","identity")}create(){var e=this._references,t=this._refCounter;return this.toBaseScale((i,r)=>{if(null==i){var n=e.get(r);null==n&&(n=t(),e.set(r,n))}else n=i;return n})}},(e,t)=>st(e,{references:t.references,refCounter:t.refCounter})).reg("color",class extends gn{constructor(e,t){super(e,t);var i="measure"!==t.dimType,r=this.scaleConfig.brewer||(i?Ze(20).map(e=>"color20-"+(1+e)):["#eee","#000"]),n=this.scaleConfig;if(!i){var a=pn.extent(this.vars),s=e=>Number.isFinite(e)||De(e),o=s(n.min)?n.min:a[0],l=s(n.max)?n.max:a[1],c=[o,a[0]].filter(s),u=[l,a[1]].filter(s);if(a=[c.sort((e,t)=>e-t)[0],u.sort((e,t)=>t-e)[0]],n.nice&&a[0]<0&&a[1]>0){let e=Math.max(...a.map(Math.abs));a=[-e,e]}this.vars=a}this.addField("scaleType","color").addField("discrete",i).addField("brewer",r).addField("toColor",Ye).addField("toClass",Ve)}create(){var e=this.discrete,t=this.vars,i=this.getField("brewer"),r=e?this.createDiscreteScale(t,i):this.createContinuesScale(t,i);return this.toBaseScale(r)}createDiscreteScale(e,t){var i,r=(e,t)=>{var i=e.map(e=>String(e).toString());return pn.scaleOrdinal().range(t).domain(i)},n=e=>t=>e(String(t).toString());if(Array.isArray(t))i=n(r(e,t));else if("function"==typeof t)i=(i=>t(i,n(r(e,Ze(20).map(e=>"color20-"+(1+e))))));else{if(!Pe(t))throw new Error("This brewer is not supported");i=((e,t)=>{var i=Object.keys(e),r=i.map(t=>e[t]),n=pn.scaleOrdinal().range(r).domain(i);return i=>e.hasOwnProperty(i)?n(String(i)):t(i)})(t,()=>"color-default")}return i}createContinuesScale(e,t){if(!Array.isArray(t))throw new Error("This brewer is not supported");return pn.scaleLinear().domain(Xe(e.map(e=>e-0),t.length)).range(t)}},(e,t)=>st(e,{nice:t.defaultNiceColor,brewer:"measure"===e.dimType?t.defaultColorBrewer:t.defaultClassBrewer})).reg("fill",class extends gn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=En.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];r=[Math.min(n,r[0]),Math.max(a,r[1])],this.vars=i.nice?je(r):En.extent(r);var s=Ze(10).map(e=>`rgba(90,180,90,${(.2+e*(.8/9)).toFixed(2)})`),o=i.brewer||s;this.addField("scaleType","fill").addField("brewer",o)}isInDomain(e){var t=this.domain(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(){var e=this.vars,t=this.getField("brewer");if(!Array.isArray(t))throw new Error("This brewer is not supported");var i=t.length,r=(e[1]-e[0])/i,n=Ze(i-1).map(e=>e+1).reduce((t,i)=>t.concat([e[0]+i*r]),[]),a=En.scaleThreshold().domain(n).range(t);return this.toBaseScale(a)}}).reg("size",class extends gn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=o.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];this.vars=[Math.min(...[n,r[0]].filter(Number.isFinite)),Math.max(...[a,r[1]].filter(Number.isFinite))],this.addField("scaleType","size"),this.addField("funcType",t.func||"sqrt")}isInDomain(e){var t=this.domain().sort(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(){var e,t=this.scaleConfig,i=this.vars,r=st({},t,{func:"sqrt",minSize:0,maxSize:1}),n=r.func,a=r.minSize,s=r.maxSize,o=fn[n],l=i.filter(e=>Number.isFinite(Number(e)));if(0===l.length)e=(()=>s);else{var c,u,d=Math.min(...l),h=Math.max(...l),g=o(Math.max(Math.abs(d),Math.abs(h),h-d));u=d<0?d:0,c=0===g?1:(s-a)/g,e=(e=>{var t=null!==e?parseFloat(e):0;return Number.isFinite(t)?a+o(t-u)*c:s})}return this.toBaseScale(e)}}).reg("ordinal",class extends gn{constructor(e,t){super(e,t),this.addField("scaleType","ordinal").addField("discrete",!0)}create(e){var t=this.scaleConfig,i=this.vars,r=l.scalePoint().domain(i).range(e).padding(.5),n=Math.max(...e),a=e=>"function"==typeof t.ratio?t.ratio(e,n,i):"object"==typeof t.ratio?t.ratio[e]:1/i.length,s=e=>t.ratio?n-i.slice(i.indexOf(e)+1).reduce((e,t)=>e+n*a(t),n*a(e)*.5):r(e);return Object.keys(r).forEach(e=>s[e]=r[e]),s.stepSize=(e=>a(e)*n),this.toBaseScale(s,e)}}).reg("period",class extends gn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=this.vars,n=mn.extent(r),a=null===i.min||void 0===i.min?n[0]:new Date(i.min).getTime(),s=null===i.max||void 0===i.max?n[1]:new Date(i.max).getTime(),o=[new Date(Math.min(a,n[0])),new Date(Math.max(s,n[1]))],l=y.get(i.period,{utc:i.utcTime});i.fitToFrameByDims||null===l?this.vars=it(r.map(e=>new Date(e)),e=>e.getTime()).sort((e,t)=>Number(t)-Number(e)):this.vars=y.generate(o[0],o[1],i.period,{utc:i.utcTime}),this.periodGenerator=l,this.addField("scaleType","period").addField("utcTime",this.scaleConfig.utcTime).addField("period",this.scaleConfig.period).addField("discrete",!0)}isInDomain(e){const t=this.periodGenerator,i=new Date(e),r=(t?t.cast(i):i).getTime();return this.domain().map(e=>e.getTime()).indexOf(r)>=0}create(e){const t=this.periodGenerator;var i=this.vars,r=this.vars.map(e=>e.getTime()),n=this.scaleConfig,a=mn.scalePoint().domain(i).range(e).padding(.5),s=mn.scalePoint().domain(r.map(String)).range(e).padding(.5),o=Math.max(...e),l=e=>{var t=new Date(e).getTime();return"function"==typeof n.ratio?n.ratio(t,o,r):"object"==typeof n.ratio?n.ratio[t]:1/i.length},c=e=>{const i=new Date(e),a=(t?t.cast(i):i).getTime();return n.ratio?o-r.slice(r.indexOf(a)+1).reduce((e,t)=>e+o*l(t),o*l(e)*.5):s(String(a))};return Object.keys(a).forEach(e=>c[e]=a[e]),c.stepSize=(e=>l(e)*o),this.toBaseScale(c,e)}},(e,t)=>st(e,{utcTime:t.utcTime})).reg("time",class extends gn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=this.vars;const n=i.period?y.get(this.scaleConfig.period,{utc:i.utcTime}):null,a=xn.extent(r).map(n?e=>n.cast(new Date(e)):e=>new Date(e)),s=null==i.min?a[0]:new Date(i.min).getTime(),o=null==i.max?a[1]:new Date(i.max).getTime();if(r=[new Date(Math.min(s,Number(a[0]))),new Date(Math.max(o,Number(a[1])))],this.niceIntervalFn=null,i.nice&&!n){var l=i.niceInterval,c=l&&bn(l)?i.utcTime?xn[`utc${(u=l)[0].toUpperCase()}${u.slice(1)}`]:bn(l):null;this.niceIntervalFn=c||null,this.vars=Ie(r,this.niceIntervalFn,{utc:i.utcTime})}else this.vars=r;var u;if(n&&Number(this.vars[0])===Number(this.vars[1])){let e=this.vars[0];this.vars[0]=n.cast(new Date(Number(e)-1)),this.vars[1]=n.next(e)}this.periodGenerator=n,this.addField("scaleType","time").addField("utcTime",this.scaleConfig.utcTime).addField("period",this.scaleConfig.period)}isInDomain(e){var t=new Date(e);this.scaleConfig.period&&(t=this.periodGenerator.cast(t));var i=this.domain(),r=i[0],n=i[i.length-1];return!Number.isNaN(r)&&!Number.isNaN(n)&&t<=n&&t>=r}create(e){var t=this.vars,i=this.scaleConfig.utcTime;const r=this.periodGenerator,n=(i?xn.scaleUtc:xn.scaleTime)().domain(t).range(e);var a=e=>{var i=t[0],r=t[1];return e>r&&(e=r),e("number"!=typeof t&&(t=10),function(e,t,i,r=10){const[n,a]=e,s=y.get(t,{utc:i}),o=Number(n),l=Number(a),c=Number(s.next(s.cast(n)))-Number(s.cast(n));return(l-o)/c<=r?y.generate(n,a,t,{utc:i}).filter(e=>e>=n&&e<=a):function(e,t,i=10){const r=Number(e[0]),n=Number(e[1]),a=Math.abs(n-r)/i;var s,o;const l=xn.bisector(e=>e.duration).right(wn,a);if(l===wn.length)s=t?xn.utcYear:xn.timeYear,o=xn.tickStep(r/vn.year.duration,n/vn.year.duration,i);else if(l){let e=a/wn[l-1].duration,i=wn[l].duration/a,r=wn[e{let t=r.cast(e);return tl&&(t=l),n(t)})}return Object.keys(n).forEach(e=>a[e]=n[e]),a.stepSize=(()=>0),this.toBaseScale(a,e)}},(e,t)=>st(e,{utcTime:t.utcTime})).reg("linear",class extends gn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=_n.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];if(r=[Math.min(...[n,r[0]].filter(Number.isFinite)),Math.max(...[a,r[1]].filter(Number.isFinite))],this.vars=i.nice?je(r):_n.extent(r),this.vars[0]===this.vars[1]){var s=Math.pow(10,Math.floor(Math.log(this.vars[0])/Math.LN10));this.vars[0]-=s,this.vars[1]+=s||10}this.addField("scaleType","linear").addField("discrete",!1)}isInDomain(e){var t=this.domain(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(e){var t=this.vars,i=this.extendScale(_n.scaleLinear());return i.domain(t).range(e).clamp(!0),this.toBaseScale(i,e)}extendScale(e){var t=e.copy,i=e.ticks;return Object.assign(e,{stepSize:()=>0,copy:()=>this.extendScale(t.call(e)),ticks:this.getField("isInteger")?t=>i.call(e,t).filter(Number.isInteger):e.ticks}),e}}).reg("logarithmic",class extends gn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=Sn.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];kn(r=[Math.min(...[n,r[0]].filter(Number.isFinite)),Math.max(...[a,r[1]].filter(Number.isFinite))]),i.nice&&(r=function(e){var t=e[0]>0,i=e.map(e=>Math.abs(e)),r=Math.max(...i),n=Math.min(...i).toExponential().split("e"),a=r.toExponential().split("e"),s=parseFloat(Math.floor(Number(n[0]))+"e"+n[1]),o=parseFloat(Math.ceil(Number(a[0]))+"e"+a[1]);return t?[s,o]:[-o,-s]}(r)),this.vars=r,this.addField("scaleType","logarithmic").addField("discrete",!1)}isInDomain(e){var t=this.domain(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(e){var t=this.vars;kn(t);var i=function e(t){var i=t.copy;return t.ticks=function(e){var i=[],r=Sn.extent(t.domain()),n=Math.floor(Mn(r[0])),a=Math.ceil(Mn(r[1])),s=Math.ceil(10*(a-n)/(10*Math.ceil(e/10)));for(let e=n;e<=a;e+=s)for(let t=1;t<=10;t++){let n=Math.pow(t,s)*Math.pow(10,e);(n=parseFloat(n.toExponential(0)))>=r[0]&&n<=r[1]&&i.push(n)}return i},t.copy=function(){var r=i.call(t);return e(r),r},t}(Sn.scaleLog()).domain(t).range(e);return i.stepSize=(()=>0),this.toBaseScale(i,e)}}).reg("value",class extends gn{constructor(e,t){super(e,t),this.addField("scaleType","value").addField("georole",t.georole)}create(){return this.toBaseScale(e=>e)}});var Un=[e=>e.data?[]:["[data] must be specified"]];Hn.chartTypesRegistry.add("scatterplot",e=>{return zn("ELEMENT.POINT",Fn(e))},Un).add("line",e=>{var t=Fn(e),i=t.data,r=t.settings.log,n={none:()=>null,horizontal:e=>e.x[e.x.length-1],vertical:e=>e.y[e.y.length-1],auto:e=>{var t,n=e.x,a=e.y,s=n[n.length-1],o=n.slice(0,n.length-1),l=a[a.length-1],c=a.slice(0,a.length-1),u=e.color,d=o.concat(c).concat([u]).filter(e=>null!==e),h=-1,g=[[[s].concat(d),l],[[l].concat(d),s]];return g.some((e,t)=>{var n=e[0],a=e[1],s=ri.isYFunctionOfX(i,n,[a]);return s.result?h=t:r(["Attempt to find a functional relation between",e[0]+" and "+e[1]+" is failed.","There are several "+s.error.keyY+" values (e.g. "+s.error.errY.join(",")+")","for ("+s.error.keyX+" = "+s.error.valX+")."].join(" ")),s.result})?t=g[h][0][0]:(r(["All attempts are failed.","Will orient line horizontally by default.","NOTE: the [scatterplot] chart is more convenient for that data."].join(" ")),t=s),t}},a=(t.lineOrientation||"").toLowerCase(),s=(n.hasOwnProperty(a)?n[a]:n.auto)(t);return null!==s&&(t.data=ri.sortByDim(i,s,t.dimensions[s])),zn("ELEMENT.LINE",t)},Un).add("area",$n,Un).add("stacked-area",e=>$n(st(e,{stack:!0})),Un).add("bar",e=>Rn(st(e,{flip:!1})),Un).add("horizontalBar",e=>Rn(st({flip:!0},e)),Un).add("horizontal-bar",e=>Rn(st({flip:!0},e)),Un).add("stacked-bar",e=>Rn(st({flip:!1,stack:!0},e)),Un).add("horizontal-stacked-bar",e=>Rn(st({flip:!0,stack:!0},e)),Un).add("map",e=>{let t=Object.assign({sourcemap:e.settings.defaultSourceMap},e.guide||{});t.size=st(t.size||{},{min:1,max:10}),t.code=st(t.code||{},{georole:"countries"});var i={},r=(e,t,r={})=>{var n,a,s=t;return t?(n=`${e}_${t}`,a="/"):(n=`${e}:default`,a="?"),i.hasOwnProperty(n)||(i[n]=Object.assign({type:e,source:a,dim:s},r)),n};return{sources:{"?":{dims:{},data:[{}]},"/":{dims:Object.keys(e.dimensions).reduce((t,i)=>(t[i]={type:e.dimensions[i].type},t),{}),data:e.data}},scales:i,unit:{type:"COORDS.MAP",expression:{operator:"none",source:"/"},code:r("value",e.code,t.code),fill:r("fill",e.fill,t.fill),size:r("size",e.size,t.size),color:r("color",e.color,t.color),latitude:r("linear",e.latitude,{nice:!1}),longitude:r("linear",e.longitude,{nice:!1}),guide:t},plugins:e.plugins||[]}},Un.concat([e=>{var t=e.fill&&e.code;if(e.fill&&!t)return"[code] must be specified when using [fill]"},e=>{var t=e.latitude&&e.longitude;if((e.latitude||e.longitude)&&!t)return"[latitude] and [longitude] both must be specified"}])).add("parallel",e=>{var t=Object.assign({columns:{}},e.guide||{}),i={},r=(e,t,r={})=>{var n,a,s=t;return t?(n=`${e}_${t}`,a="/"):(n=`${e}:default`,a="?"),i.hasOwnProperty(n)||(i[n]=Object.assign({type:e,source:a,dim:s},r)),n},n=e.columns.map(i=>r(e.dimensions[i].scale,i,t.columns[i]));return{sources:{"?":{dims:{},data:[{}]},"/":{dims:Object.keys(e.dimensions).reduce((t,i)=>(t[i]={type:e.dimensions[i].type},t),{}),data:e.data}},scales:i,unit:{type:"COORDS.PARALLEL",expression:{operator:"none",source:"/"},columns:n,guide:t,units:[{type:"PARALLEL/ELEMENT.LINE",color:r("color",e.color,t.color),columns:n,expression:{operator:"none",source:"/"}}]},plugins:e.plugins||[]}},Un.concat([e=>{if(!(e.columns&&e.columns.length>1))return"[columns] property must contain at least 2 dimensions"}]));const Gn="2.7.0";t.default={GPL:Gt,Plot:qi,Chart:Ki,api:Hn,version:"2.7.0"}},function(e,i){e.exports=t},function(e,t){e.exports=i},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=a},function(e,t){e.exports=s},function(e,t){e.exports=o},function(e,t){e.exports=l},function(e,t,i){var r,n,a;n=[],void 0===(a="function"==typeof(r=function(){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}return i.m=e,i.c=t,i.p="",i(0)}([function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){return e.indexOf(t)},r=window,n=r.document,a=n.documentElement,s=["top","bottom"];function o(e,t){for(var i in t)e[i]=t[i];return e}function l(e){var t,i=r.pageYOffset||a.scrollTop,n=r.pageXOffset||a.scrollLeft,s={left:0,right:0,top:0,bottom:0,width:0,height:0};if((t=e)&&null!=t.setInterval)s.width=r.innerWidth||a.clientWidth,s.height=r.innerHeight||a.clientHeight;else{if(!a.contains(e)||null==e.getBoundingClientRect)return s;o(s,e.getBoundingClientRect()),s.width=s.right-s.left,s.height=s.bottom-s.top}return s.top=s.top+i-a.clientTop,s.left=s.left+n-a.clientLeft,s.right=s.left+s.width,s.bottom=s.top+s.height,s}var c=function(e,t){return r.getComputedStyle(e)[t]};function u(e){var t=String(c(e,u.propName)),i=t.match(/([0-9.]+)([ms]{1,2})/);return i&&(t=Number(i[1]),"s"===i[2]&&(t*=1e3)),0|t}u.propName=function(){for(var e=n.createElement("div"),t=["transitionDuration","webkitTransitionDuration"],i=0;i=t.bottom&&(n[0]="top"),n[1]){case"left":e.right-this.width<=t.left&&(n[1]="right");break;case"right":e.left+this.width>=t.right&&(n[1]="left");break;default:e.left+e.width/2+this.width/2>=t.right?n[1]="left":e.right-e.width/2-this.width/2<=t.left&&(n[1]="right")}else switch(e.left-this.width-a<=t.left?n[0]="right":e.right+this.width+a>=t.right&&(n[0]="left"),n[1]){case"top":e.bottom-this.height<=t.top&&(n[1]="bottom");break;case"bottom":e.top+this.height>=t.bottom&&(n[1]="top");break;default:e.top+e.height/2+this.height/2>=t.bottom?n[1]="top":e.bottom-e.height/2-this.height/2<=t.top&&(n[1]="bottom")}return n.join("-")},h.prototype.position=function(e,t){this.attachedTo&&(e=this.attachedTo),null==e&&this._p?(e=this._p[0],t=this._p[1]):this._p=arguments;var i,r,n="number"==typeof e?{left:0|e,right:0|e,top:0|t,bottom:0|t,width:0,height:0}:l(e),a=this.spacing,s=this._pickPlace(n);switch(s!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(s),this.curPlace=s),this.curPlace){case"top":i=n.top-this.height-a,r=n.left+n.width/2-this.width/2;break;case"top-left":i=n.top-this.height-a,r=n.right-this.width;break;case"top-right":i=n.top-this.height-a,r=n.left;break;case"bottom":i=n.bottom+a,r=n.left+n.width/2-this.width/2;break;case"bottom-left":i=n.bottom+a,r=n.right-this.width;break;case"bottom-right":i=n.bottom+a,r=n.left;break;case"left":i=n.top+n.height/2-this.height/2,r=n.left-this.width-a;break;case"left-top":i=n.bottom-this.height,r=n.left-this.width-a;break;case"left-bottom":i=n.top,r=n.left-this.width-a;break;case"right":i=n.top+n.height/2-this.height/2,r=n.right+a;break;case"right-top":i=n.bottom-this.height,r=n.right+a;break;case"right-bottom":i=n.top,r=n.right+a}return this.element.style.top=Math.round(i)+"px",this.element.style.left=Math.round(r)+"px",this},h.prototype.show=function(e,t){return e=this.attachedTo?this.attachedTo:e,clearTimeout(this.aIndex),null!=e&&this.position(e,t),this.hidden&&(this.hidden=0,n.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},h.prototype.getElement=function(){return this.element},h.prototype.hide=function(){if(!this.hidden){var e=this,t=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(t=u(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){e.aIndex=0,n.body.removeChild(e.element),e.hidden=1},t),this}},h.prototype.toggle=function(e,t){return this[this.hidden?"show":"hide"](e,t)},h.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||n.body.removeChild(this.element),this.element=this.options=null},h.prototype._aware=function(){-1===i(h.winAware,this)&&h.winAware.push(this)},h.prototype._unaware=function(){var e=i(h.winAware,this);-1!==e&&h.winAware.splice(e,1)},h.reposition=function(){var e,t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return setTimeout(e,17)};function i(){e=0;for(var t=0,i=h.winAware.length;t0)-(e<0)||Number(e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,i=Object(this),r=i.length>>>0,n=arguments[1],a=0;a>>0,n=arguments[1],a=0;a0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),s)},function(e){var t=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var i,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!a(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(i=arguments[2])}for(var n,s=o(t.length),l=a(this)?Object(new this(s)):new Array(s),c=0;ce[String(t++)]=i),e.length=t,e},configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(Map.prototype,"entries",{value:function(){var e={},t=0;return this.forEach((i,r)=>e[String(t++)]=[r,i]),e.length=t,e},configurable:!0,enumerable:!1,writable:!0})}Object.assign||Object.defineProperty(Object,"assign",{value:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;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 +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(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"],t):"object"==typeof exports?exports.Taucharts=t(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")):e.Taucharts=t(e.d3,e.d3,e.d3,e.topojson,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3)}(window,function(e,t,i,r,n,a,s,o,l,c,d,u,h,f){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=21)}([function(t,i){t.exports=e},function(e,t,i){"use strict";i.r(t);var r={};i.r(r),i.d(r,"translate",function(){return E}),i.d(r,"rotate",function(){return S}),i.d(r,"getOrientation",function(){return T}),i.d(r,"parseTransformTranslate",function(){return M}),i.d(r,"isIntersect",function(){return C}),i.d(r,"getDeepTransformTranslate",function(){return k}),i.d(r,"raiseElements",function(){return A});var n={};i.r(n),i.d(n,"traverseJSON",function(){return Se}),i.d(n,"traverseSpec",function(){return Te}),i.d(n,"clone",function(){return De}),i.d(n,"isDate",function(){return $e}),i.d(n,"isObject",function(){return ze}),i.d(n,"niceZeroBased",function(){return Be}),i.d(n,"niceTimeDomain",function(){return Ie}),i.d(n,"generateHash",function(){return He}),i.d(n,"generateRatioFunction",function(){return We}),i.d(n,"isSpecRectCoordsOnly",function(){return Ue}),i.d(n,"throttleLastEvent",function(){return Xe}),i.d(n,"splitEvenly",function(){return Ge}),i.d(n,"extRGBColor",function(){return qe}),i.d(n,"extCSSClass",function(){return Ye}),i.d(n,"toRadian",function(){return Ke}),i.d(n,"normalizeAngle",function(){return Je}),i.d(n,"range",function(){return Qe}),i.d(n,"hasXOverflow",function(){return Ze}),i.d(n,"hasYOverflow",function(){return et}),i.d(n,"flatten",function(){return tt}),i.d(n,"unique",function(){return it}),i.d(n,"groupBy",function(){return rt}),i.d(n,"union",function(){return nt}),i.d(n,"intersection",function(){return at}),i.d(n,"defaults",function(){return st}),i.d(n,"omit",function(){return ot}),i.d(n,"memoize",function(){return lt}),i.d(n,"createMultiSorter",function(){return ct}),i.d(n,"pick",function(){return dt}),i.d(n,"escape",function(){return ut}),i.d(n,"template",function(){return ht}),i.d(n,"escapeHtml",function(){return ft}),i.d(n,"xml",function(){return bt}),i.d(n,"take",function(){return yt}),i.d(n,"isChartElement",function(){return xt}),i.d(n,"isFacetUnit",function(){return _t});var a={};i.r(a),i.d(a,"appendTo",function(){return St}),i.d(a,"getScrollbarSize",function(){return Tt}),i.d(a,"setScrollPadding",function(){return Mt}),i.d(a,"getStyle",function(){return Ct}),i.d(a,"getStyleAsNum",function(){return kt}),i.d(a,"getContainerSize",function(){return At}),i.d(a,"getAxisTickLabelSize",function(){return Pt}),i.d(a,"getLabelSize",function(){return Ot}),i.d(a,"getCharSize",function(){return Nt}),i.d(a,"selectOrAppend",function(){return Lt}),i.d(a,"selectImmediate",function(){return Rt}),i.d(a,"selectAllImmediate",function(){return Ft}),i.d(a,"sortChildren",function(){return Dt}),i.d(a,"classes",function(){return $t}),i.d(a,"dispatchMouseEvent",function(){return zt});var s=i(0),o=i(2),l=i(3),c={},d={};function u(e){var t=d[e];return t||(t=function(){for(var t,i,r=this,n=0,a=[];r=r.handler;){if("function"==typeof(i=r.callbacks[e])){if(!t)for(t=[this],n=0;ne.fn.apply(e.context,e.args))},d[e]=t),t}class h{constructor(){this.handler=null,this.emit_destroy=u("destroy")}addHandler(e,t){t=t||this,this.handler={callbacks:e,context:t,handler:this.handler}}on(e,t,i){var r={};return r[e]=t,this.addHandler(r,i),r}fire(e,t){u.call(this,e).call(this,t)}removeHandler(e,t){var i,r=this;for(t=t||this;i=r,r=r.handler;)if(r.callbacks===e&&r.context===t)return r.callbacks=c,void(i.handler=r.handler)}destroy(){this.emit_destroy(),this.handler=null}}class f extends h{constructor(e){super(),this.screenModel=null,this._elementNameSpace=e.namespace||"default",this._elementScalesHub={}}regScale(e,t){return this._elementScalesHub[e]=t,this}getScale(e){return this._elementScalesHub[e]||null}fireNameSpaceEvent(e,t){var i=this._elementNameSpace;this.fire(`${e}.${i}`,t)}subscribe(e,t=(e=>e),i=(e=>e)){var r=this,n={};[{event:"mouseover",limit:0},{event:"mouseout",limit:0},{event:"click",limit:0},{event:"mousemove",limit:"requestAnimationFrame"}].forEach(a=>{var o=a.event,l=a.limit;e.on(o,Xe(n,o,function(e){var n={data:t.call(this,e),event:i.call(this,s.event,e)};r.fire(o,n),r.fireNameSpaceEvent(o,n)},l))})}allocateRect(){return{left:0,top:0,width:0,height:0}}defineGrammarModel(e){return{}}getGrammarRules(){return[]}getAdjustScalesRules(){return[]}createScreenModel(e){return null}getClosestElement(e,t){return null}addInteraction(){}draw(){this.config.options.container=this.config.options.slot(this.config.uid),this.drawFrames(this.config.frames)}data(){return this.config.frames.reduce((e,t)=>e.concat(t.part()),[])}node(){return this}}const p=e=>({day:{cast:function(t){var i=new Date(t);return new Date(i[e.setHours](0,0,0,0))},next:function(t){var i=new Date(t),r=new Date(i[e.setDate](i[e.getDate]()+1));return this.cast(r)}},week:{cast:function(t){var i=new Date(t);return i=new Date(i[e.setHours](0,0,0,0)),new Date(i[e.setDate](i[e.getDate]()-i[e.getDay]()))},next:function(t){var i=new Date(t),r=new Date(i[e.setDate](i[e.getDate]()+7));return this.cast(r)}},month:{cast:function(t){var i=new Date(t);return i=new Date(i[e.setHours](0,0,0,0)),i=new Date(i[e.setDate](1))},next:function(t){var i=new Date(t),r=new Date(i[e.setMonth](i[e.getMonth]()+1));return this.cast(r)}},quarter:{cast:function(t){var i=new Date(t);i=new Date(i[e.setHours](0,0,0,0));var r=(i=new Date(i[e.setDate](1)))[e.getMonth](),n=r-r%3;return new Date(i[e.setMonth](n))},next:function(t){var i=new Date(t),r=new Date(i[e.setMonth](i[e.getMonth]()+3));return this.cast(r)}},year:{cast(t){var i=new Date(t);return i=new Date(i[e.setHours](0,0,0,0)),i=new Date(i[e.setDate](1)),i=new Date(i[e.setMonth](0))},next:function(t){var i=new Date(t),r=new Date(i[e.setFullYear](i[e.getFullYear]()+1));return this.cast(r)}}}),g=p({setHours:"setHours",setDate:"setDate",getDate:"getDate",setMonth:"setMonth",getDay:"getDay",getMonth:"getMonth",setFullYear:"setFullYear",getFullYear:"getFullYear"});var m=p({setHours:"setUTCHours",setDate:"setUTCDate",getDate:"getUTCDate",setMonth:"setUTCMonth",getDay:"getUTCDay",getMonth:"getUTCMonth",setFullYear:"setUTCFullYear",getFullYear:"getUTCFullYear"}),b={add(e,t,{utc:i}={utc:!1}){return(i?m:g)[e.toLowerCase()]=t,this},get:(e,{utc:t}={utc:!1})=>(t?m:g)[(e||"").toLowerCase()]||null,generate:(e,t,i,{utc:r}={utc:!1})=>{var n=[],a=b.get(i,{utc:r});if(a){var s=a.cast(new Date(t)),o=a.cast(new Date(e));for(n.push(o);(o=a.next(new Date(o)))<=s;)n.push(o)}return n}};class y extends Error{constructor(e,t,i){super(),this.name="TauChartError",this.message=e,this.errorCode=t,this.errorArgs=i}}const v={STACKED_FIELD_NOT_NUMBER:"STACKED_FIELD_NOT_NUMBER",NO_DATA:"NO_DATA",NOT_SUPPORTED_TYPE_CHART:"NOT_SUPPORTED_TYPE_CHART",UNKNOWN_UNIT_TYPE:"UNKNOWN_UNIT_TYPE",INVALID_LOG_DOMAIN:"INVALID_LOG_DOMAIN"},x={},_={get:e=>x[e],reg(e,t){return x[e]=t,this}},w="taucharts_synthetic_record";function E(e,t){return`translate(${e},${t})`}function S(e){return`rotate(${e})`}function T(e){return["bottom","top"].indexOf(e.toLowerCase())>=0?"h":"v"}function M(e){var t={x:0,y:0},i=e.indexOf("translate(");if(i>=0){var r=e.indexOf(")",i+10),n=e.substring(i+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");t.x=parseFloat(n[0]),n.length>1&&(t.y=parseFloat(n[1]))}return t}function C(e,t,i,r,n,a,s,o){var l,c,d,u,h,f;return f=((d=s-n)*(t-a)-(u=o-a)*(e-n))/(-d*(c=r-t)+(l=i-e)*u),(h=(-c*(e-n)+l*(t-a))/(-d*c+l*u))>=0&&h<=1&&f>=0&&f<=1}function k(e){for(var t,i,r={x:0,y:0},n=e;n&&"SVG"!==n.nodeName.toUpperCase();)(i=n.getAttribute("transform"))&&(t=M(i),r.x+=t.x,r.y+=t.y),n=n.parentNode;return r}function A(e,t,i){const r=e.selectAll(t).filter(i);if(r.empty())return;const n=s.select(r.node().parentNode).selectAll(t).filter(e=>!i(e)).nodes(),a=n[n.length-1];if(a){const e=Array.prototype.indexOf.call(a.parentNode.childNodes,a),t=a.nextSibling;r.each(function(){Array.prototype.indexOf.call(this.parentNode.childNodes,this)>e||this.parentNode.insertBefore(this,t)})}}_.reg("identity",()=>({})).reg("flip",e=>{var t=e.scaleY,i=e.scaleX;const r=i.domain(),n=i.discrete?r[0]:Math.max(0,Math.min(...r)),a=i.value(n)+-.5*i.stepSize(n);return{flip:!0,scaleX:t,scaleY:i,xi:e=>t.value(e[t.dim]),yi:e=>i.value(e[i.dim]),y0:()=>a}}).reg("obsoleteVerticalStackOrder",()=>({obsoleteVerticalStackOrder:!0})).reg("positioningByColor",e=>{return(e.scaleX.discrete?e=>{const t=e.data().reduce((t,i)=>{const r=i[e.scaleX.dim],n=i[e.scaleColor.dim];return t.hasOwnProperty(r)||(t[r]=[]),t[r].indexOf(n)<0&&t[r].push(n),t},{});var i=e.scaleX,r=e.scaleColor,n=r.discrete?r.domain():r.originalSeries().sort((e,t)=>e-t),a=n.length||1;const s=n.reduce((e,t,i)=>(e[t]=i,e),{});return Object.keys(t).forEach(e=>t[e].sort((e,t)=>s[e]-s[t])),{xi:r=>{const n=r[e.scaleX.dim],s=t[n]||[r[e.scaleColor.dim]],o=s.length,l=s.indexOf(r[e.scaleColor.dim]);var c=(e=>i.stepSize(e[i.dim])*(a/(1+a)))(r)/(a+1);return e.xi(r)-(o+1)*c/2+(1+l)*c}}}:()=>({}))(e)}).reg("groupOrderByAvg",e=>{const t=e.data(),i=t=>t.map(e.yi).reduce((e,t)=>e+t,0)/t.length,r=t.reduce((t,i)=>{var r=e.group(i);return t[r]=t[r]||[],t[r].push(i),t},{}),n=Object.keys(r).map(e=>[e,i(r[e])]).sort((e,t)=>e[1]-t[1]).map(e=>e[0]);return{order:e=>{const t=n.indexOf(e);return t<0?Number.MAX_VALUE:t}}}).reg("stack",e=>{const t=e.data(),i=e.scaleX,r=e.scaleY;if(r.discrete||r.domain().some(e=>"number"!=typeof e))throw new y(`Stacked field [${r.dim}] should be a number`,v.STACKED_FIELD_NOT_NUMBER,{field:r.dim});const n=e=>t=>{const n=t[i.dim],a=t[r.dim],s=a>=0?e.positive:e.negative,o=s[n]||0,l=o+a;return s[n]=l,{nextStack:l,prevStack:o}},a=n({positive:{},negative:{}}),s=n({positive:{},negative:{}}),o=t=>lt(t,e.id);var l=Number.MAX_VALUE,c=Number.MIN_VALUE;const d=e=>(l=ec?e:c,r.value(e)),u=o(e=>d(a(e).nextStack)),h=o(e=>d(s(e).prevStack)),f=t=>e.group(t)+"/"+(t[r.dim]>=0?1:-1),p=rt(t,f),g=Object.keys(p).sort(e.flip||!e.flip&&e.obsoleteVerticalStackOrder?(t,i)=>e.order(t)-e.order(i):(t,i)=>e.order(i)-e.order(t)).reduce((e,t)=>e.concat(p[t]),[]);return g.forEach(e=>{u(e),h(e)}),r.fixup(e=>{const t={};return(!e.hasOwnProperty("max")||e.maxl)&&(t.min=l),t}),{group:f,data:()=>g,yi:u,y0:h}}).reg("size_distribute_evenly",(e,{minLimit:t,maxLimit:i,defMin:r,defMax:n})=>{const a=e.data(),s=(e,t)=>e-t,o=e.scaleX.discrete?e.scaleX.stepSize()/2:Number.MAX_VALUE,l=a.map(t=>e.xi(t)).sort(s);var c=l[0],d=l.slice(1).map(e=>{var t=e-c;return c=e,t}).filter(e=>e>0).sort(s).concat(Number.MAX_VALUE)[0];const u=Math.min(d,o),h="number"==typeof t?t:r,f={minSize:h,maxSize:"number"==typeof i?i:Math.max(h,Math.min(n,u))};return e.scaleSize.fixup(e=>{const t={};return e.fixed?e.maxSize>f.maxSize&&(t.maxSize=f.maxSize):(t.fixed=!0,t.minSize=f.minSize,t.maxSize=f.maxSize),t}),{}}).reg("adjustStaticSizeScale",(e,{minLimit:t,maxLimit:i,defMin:r,defMax:n})=>{var a={minSize:"number"==typeof t?t:r,maxSize:"number"==typeof i?i:n};return e.scaleSize.fixup(e=>{var t={};return e.fixed||(t.fixed=!0,t.minSize=a.minSize,t.maxSize=a.maxSize),t}),{}}).reg("adjustSigmaSizeScale",(e,{minLimit:t,maxLimit:i,defMin:r,defMax:n})=>{const a=(e,t)=>e-t,s=e.data().map(t=>e.xi(t)).sort(a);var o=s[0];const l=s.slice(1).map(e=>{const t=e-o;return o=e,t}).filter(e=>e>0).sort(a).concat(Number.MAX_VALUE)[0],c=e.scaleX.discrete?e.scaleX.stepSize()/2:Number.MAX_VALUE,d=Math.min(l,c),u="number"==typeof t?t:r,h="number"==typeof i?i:n,f={minSize:u,maxSize:Math.max(u,Math.min(h,(e=>{var t=(u+h)/2,i=h,r=u;return Math.round(t+(i-t)/(1+Math.exp(-(e-r)/.5)))})(d)))};return e.scaleSize.fixup(e=>{const t={};return e.fixed?e.maxSize>f.maxSize&&(t.maxSize=f.maxSize):(t.fixed=!0,t.minSize=f.minSize,t.maxSize=f.maxSize),t}),{}}).reg("avoidScalesOverflow",(e,{sizeDirection:t})=>{const i=(e,i)=>!e||e.discrete||"logarithmic"===e.scaleType||t.indexOf(i)<0,r=i(e.scaleX,"x"),n=i(e.scaleY,"y");if(r&&n)return{};var a,s;e.scaleSize.fixup(e=>(a=e.minSize,s=e.maxSize,e));var o=e.data().reduce((t,i)=>{var o,l,c=e.size(i),d=(c>=a?c:a+c*(s-a))/2;return r||(o=e.xi(i),t.left=Math.min(t.left,o-d),t.right=Math.max(t.right,o+d)),n||(l=e.yi(i),t.top=Math.min(t.top,l-d),t.bottom=Math.max(t.bottom,l+d)),t},{top:Number.MAX_VALUE,right:-Number.MAX_VALUE,bottom:-Number.MAX_VALUE,left:Number.MAX_VALUE});const l=(t,i,r,n)=>{var a=t.domain(),s=Math.abs(t.value(a[1])-t.value(a[0])),o=(a[1]-a[0])/s;if(0===s)return 1;var l=Math.max(0,-i),c=Math.max(0,r-s),d=e.flip?c:l,u=e.flip?l:c,h=Number(a[0])-(n?u:d)*o,f=Number(a[1])+(n?d:u)*o;return t.fixup(e=>{var t={};if(e.fixedBorders){let[n,a]=e.fixedBorders.slice();(n>i||a({minSize:u,maxSize:h})),{}}).reg("fillGaps",(e,{isStack:t,xPeriod:i,utc:r})=>{const n=rt(e.data(),e.group),a=Object.keys(n).sort((t,i)=>e.order(t)-e.order(i)).reduce((e,t)=>e.concat([n[t]]),[]),s=e.scaleX.dim,o=e.scaleY.dim,l=e.scaleColor.dim,c=e.scaleSplit.dim,d=e=>e[o]>=0?1:-1,u=(t,i,r)=>{const n=rt(i,e=>e[s]),a=i[0];return t.reduce((t,i)=>t.concat(n[i]||((t,i,r)=>{const n=[t,e.id(i),r].join(" ");return{[s]:t,[o]:1e-10*r,[c]:i[c],[l]:i[l],[w]:!0,[`${w}id`]:n}})(i,a,r)),[])},h=(e,t)=>e-t,f=()=>it(a.reduce((e,t)=>e.concat(t.map(e=>e[s])),[])).sort(h),p=i?(()=>{const t=f(),n=Math.max(...t.map(e=>Number(e))),a=e.scaleX.domain(),s=b.generate(a[0],a[1],i,{utc:r}).filter(e=>e>=a[0]&&e<=a[1]);let o=0;const l=[],c=b.get(i,{utc:r});return s.forEach(e=>{const i=Number(e);if(!(i>=n)){for(let e=o;et.sort((t,i)=>e.xi(t)-e.xi(i))).reduce(t?(e,t)=>{const i=rt(t,e=>String(d(e)));return Object.keys(i).reduce((e,t)=>e.concat(u(p,i[t],t)),e)}:(e,t)=>{rt(t,e=>String(d(e)));const i=Math.max(...t.map(e=>e[s]));return e.concat(u(p.filter(e=>e<=i),t,0))},[]);return{data:()=>g,size:t=>t[w]?e.scaleSize(0):e.size(t),id:t=>t[w]?t[`${w}id`]:e.id(t)}});var P=i(5);const O="tau-chart__";function N(e){return e}const L=1e-6;function R(e){return`translate(${e+.5},0)`}function F(e){return`translate(0,${e+.5})`}const D={top:1,right:2,bottom:3,left:4};function $(e){const t=D[e.scaleGuide.scaleOrient],i=e.scale,r=e.scaleGuide,n=r.label,{ticksCount:a,tickFormat:s,tickSize:o,tickPadding:l,gridOnly:c}=st(e,{tickSize:6,tickPadding:3,gridOnly:!1}),d="linear"===i.scaleType,u="ordinal"===i.scaleType||"period"===i.scaleType,h=t===D.top||t===D.bottom,f=t===D.top||t===D.left?-1:1,p=h?"x":"y",g=h?"y":"x",m=h?R:F,b=h?1:-1;return y=>{var v;if(i.ticks){v=i.ticks(a);let e=Math.floor(1.25*a);for(;v.length>e&&e>2&&v.length>2;)v=i.ticks(--e)}else v=i.domain();r.hideTicks&&(v=c?v.filter(e=>0==e):[]);const x=null==s?i.tickFormat?i.tickFormat(a):N:s,_=Math.max(o,0)+l,w=i.range(),E=w[0]+.5,T=w[w.length-1]+.5;let C=(i.bandwidth?function(e){var t=Math.max(0,e.bandwidth()-1)/2;return e.round()&&(t=Math.round(t)),function(i){return e(i)+t}}:N)(i);if(r.facetAxis){let e=C;C=(t=>e(t)-i.stepSize(t)/2)}const k=y.selection?y:null,A=k?k.selection():y,P=function(e){let t=e.node();for(;t&&"svg"!==t.tagName;)t=t.parentNode;return t}(A).getBoundingClientRect();function R(e){const i=Je(r.rotate);if(e.attr("transform",S(i)),Math.abs(i/90)%2>0){let r=i<180?1:-1,n=h?.5:-2,a=t===D.top||t===D.left?-1:1,s=n*(t===D.top||t===D.bottom?a<0?0:.71:.32);e.attr("x",9*r).attr("y",0).attr("dx",h?null:`${s}em`).attr("dy",`${s}em`)}}function F(e,t=0){const n=e=>Math.max(i.stepSize(e),r.tickFormatWordWrapLimit,t);r.tickFormatWordWrap?ue(e,n,r.tickFormatWordWrapLines,r.tickFontHeight,!h):de(e,n)}function $(e){!function(e,t){const i=t?-10:20,r=t?0:1,n=t?1:-1;var a=[];e.each(function(){var e=le.select(this),t=e.attr("transform").replace("translate(","").replace(" ",",").split(",")[r],i=n*parseFloat(t),s=e.select("text"),o=s.node().getBBox().width,l=o/2,c=i-l,d=i+l;a.push({c:i,s:c,e:d,l:0,textRef:s,tickRef:e})});var s=a.sort((e,t)=>e.c-t.c);((e,t)=>e.map((e,i,r)=>t(r[i-1]||{e:-1/0,s:-1/0,l:0},e,r[i+1]||{e:1/0,s:1/0,l:0})))(s,(e,r,n)=>{var a=e.e>r.s,s=n.s{var i={"[T][1]":-1,"[T][-1]":0,"[T][0]":1,"[F][0]":-1},r=`[${t.toString().toUpperCase().charAt(0)}][${e}]`;return i.hasOwnProperty(r)?i[r]:0})(e.l,a);var o=r.textRef.size(),l=r.textRef.text();o>1&&(l=l.replace(/([\.]*$)/gi,"")+"...");var c=11*r.l,d=t?parseFloat(r.textRef.attr("y"))+c:0;let n=t?0:c,s=t?c:0;var u=function(e){var t=0;if(!e)return t;var i=e.indexOf("rotate(");if(i>=0){var r=e.indexOf(")",i+7),n=e.substring(i+7,r);t=parseFloat(n.trim())}return t}(r.textRef.attr("transform"));r.textRef.text((e,t)=>0===t?l:"").attr("transform","translate("+n+","+s+") rotate("+u+")");var h={x1:0,x2:0,y1:d+(t?-1:5),y2:i};t||(h.transform="rotate(-90)"),Lt(r.tickRef,"line.label-ref").call(xe(h))}else r.tickRef.selectAll("line.label-ref").remove();return r})}(e,h)}A.attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===D.right?"start":t===D.left?"end":"middle"),c||function(){const e=r.hideTicks||r.hide?[]:[null];yt(A.selectAll(".domain").data(e)).then(e=>(k&&e.exit().transition(k).attr("opacity",0).remove(),e.merge(e.enter().insert("path",".tick").attr("class","domain").attr("opacity",1).attr("stroke","#000")))).then(e=>k?e.transition(k):e).then(e=>{e.attr("d",t===D.left||t==D.right?`M${f*o},${E}H0.5V${T}H${f*o}`:`M${E},${f*o}V0.5H${T}V${f*o}`)})}();const z=yt(A.selectAll(".tick").data(v,e=>String(i(e))).order()).then(e=>{const t=e.exit(),i=e.enter().append("g").attr("class","tick");return{tickExit:t,tickEnter:i,tick:e.merge(i)}}).then(e=>{if(d){const t=i.ticks(),r=i.domain(),n=v.length-1,a=t.length>1&&r[0]*r[1]<0&&-r[0]>(t[1]-t[0])/2&&r[1]>(t[n]-t[n-1])/2;e.tick.classed("zero-tick",e=>0==e&&a)}return e}).result();!function(e){yt(e).then(({tickEnter:e,tickExit:t,tick:i})=>k?(e.attr("opacity",L).attr("transform",function(e){const t=C(e);return m(t)}),{tick:i.transition(k),tickExit:t.transition(k).attr("opacity",L).attr("transform",function(e){const t=C(e);return isFinite(t)?m(t):this.getAttribute("transform")})}):{tick:i,tickExit:t}).then(({tick:e,tickExit:t})=>{t.remove(),e.attr("opacity",1).attr("transform",e=>m(C(e)))})}(z),r.facetAxis||function(e){const t=f*o,r=u?e=>b*i.stepSize(e)/2:null;yt(e).then(({tick:e,tickEnter:i})=>{const n=e.select("line"),a=i.append("line").attr("stroke","#000").attr(`${g}2`,t);return u&&a.attr(`${p}1`,r).attr(`${p}2`,r),n.merge(a)}).then(e=>k?e.transition(k):e).then(e=>{e.attr(`${g}2`,t),u&&e.attr(`${p}1`,r).attr(`${p}2`,r)})}(z),u&&c&&u&&v&&v.length&&yt(A.selectAll(".extra-tick-line").data([null])).then(e=>e.merge(e.enter().insert("line",".tick").attr("class","extra-tick-line").attr("stroke","#000"))).then(e=>k?e.transition(k):e).then(e=>{e.attr(`${p}1`,E).attr(`${p}2`,E).attr(`${g}1`,0).attr(`${g}2`,f*o)}),c||(function(n){const a=r.textAnchor,s=f*_,o=t===D.top?"0em":t===D.bottom?"0.71em":"0.32em";function l(t){if(r.facetAxis)return t.attr("dx",18-e.position[0]).attr("dy",16)}yt(n).then(({tick:e,tickEnter:t})=>{const i=e.select("text"),r=t.append("text").attr("fill","#000").attr(g,s).attr("dy",o);return R(r),l(r),i.merge(r)}).then(e=>{if(e.text(x).attr("text-anchor",a),!1===h&&!0===r.facetAxis){const t=M(A.node().parentNode.getAttribute("transform"));F(e,P.width-Math.abs(t.x))}else F(e);return h&&"time"===i.scaleType&&function(e){if(v.length<2)return;var t=0,i=-1;const r=e.nodes();r.forEach((e,r)=>{const n=e.textContent||"";var a=n.length;a>t&&(t=a,i=r)});const n=C(v[1])-C(v[0]);var a=!1;if(i>=0){var s=r[i].getBoundingClientRect();a=n-s.width<8}A.classed(`${O}time-axis-overflow`,a)}(e),!h||"time"!==i.scaleType&&"linear"!==i.scaleType||function(e){if(0===v.length)return;const t=v[0],i=v[v.length-1],r=A.append("line").attr("x1",C(t)).attr("x2",C(t)).attr("y1",0).attr("y2",1),n=A.append("line").attr("x1",C(i)).attr("x2",C(i)).attr("y1",0).attr("y2",1),a={left:r.node().getBoundingClientRect().left-P.left,right:P.right-n.node().getBoundingClientRect().right};r.remove(),n.remove();const s=(e,t,i)=>{const r=e.getBoundingClientRect(),n=t>0?"right":"left",s=(C(i),a[n]),o=Math.ceil(r.width/2-s+1);e.setAttribute("dx",String(o>0?-t*o:0))},o=e.filter(e=>e===t).node(),l=e.filter(e=>e===i).node();e.attr("dx",null),s(o,-1,t),s(l,1,i)}(e),e}).then(e=>k?e.transition(k):e).then(e=>{e.attr(g,s),R(e),l(e),u&&r.avoidCollisions&&!r.facetAxis&&(k?k.on("end.fixTickTextCollision",()=>$(n.tick)):$(n.tick))})}(z),n.hide||function(){const e=n,t=Lt(A,"text.label").attr("class",$t("label",e.cssClass)).attr("transform",S(e.rotate)).attr("text-anchor",e.textAnchor);yt(t).then(e=>k?e.transition(k):e).then(t=>{const i=b*e.padding,r=Math.abs(T-E),n=h?r:0;t.attr("x",n).attr("y",i).attr("text-anchor","end")});const i=e.text.split(" → ");for(var r=i.length-1;r>0;r--)i.splice(r,0," → ");t.selectAll("tspan").data(i).enter().append("tspan").attr("class",(e,t)=>t%2?`label-token-delimiter label-token-delimiter-${t}`:`label-token label-token-${t}`).text(e=>e).exit().remove()}())}}function z(e){return $({scale:e.scale,scaleGuide:e.scaleGuide,ticksCount:e.ticksCount,tickSize:e.tickSize,gridOnly:!0,position:e.position})}function B(e,...t){return 2===t.length?t[0]*(1-e)+t[1]*e:3===t.length?t[0]*(1-e)*(1-e)+2*t[1]*(1-e)*e+t[2]*e*e:t[0]*(1-e)*(1-e)*(1-e)+3*t[1]*(1-e)*(1-e)*e+3*t[2]*(1-e)*e*e+t[3]*e*e*e}function I(e,...t){var i=t.map(e=>e.x),r=t.map(e=>e.y);return{x:B(e,...i),y:B(e,...r)}}function j(e,t,i,r,n){var a=I(e,t,i),s=I(e,t,i,r),o=I(e,i,r,n),l=I(e,r,n);return[t,a,s,I(e,s,o),o,l,n]}function V(e,t,i="polyline"){var r;return n=>0===n?e:1===n?t:(r||(r=("cubic"===i?function(e,t){for(var i=2;i!e.isInterpolated),i=e.length-2;i>=0;i--)n=e[i+1],(r=e[i]).isCubicControl||n.isCubicControl||(e.splice(i+1,0,I(1/3,n,r),I(2/3,n,r)),e[i+1].isCubicControl=!0,e[i+2].isCubicControl=!0);var a=e.filter((e,t)=>t%3==0),s=t.filter((e,t)=>t%3==0),o=a.map(e=>e.id),l=s.map(e=>e.id),c=o.reduce((t,i)=>(t[i]=e.findIndex(e=>e.id===i),t),{}),d=l.reduce((e,i)=>(e[i]=t.findIndex(e=>e.id===i),e),{}),u=o.filter(e=>l.indexOf(e)>=0),h=a.filter(e=>!e.positionIsBeingChanged),f=s.filter(e=>!e.positionIsBeingChanged),p=Z(h,f),g=Z(f,h),m=[];u.forEach((i,r)=>{var n=c[i],a=d[i];if(0===r&&(n>0||a>0)&&m.push(H({polylineFrom:e.slice(0,n+1),polylineTo:t.slice(0,a+1),toOppositeScale:0===a?p:g,isCubic:!0})),r>0){var s=c[u[r-1]],o=d[u[r-1]];n-s>3||a-o>3?m.push(W({polylineFrom:e.slice(s,n+1),polylineTo:t.slice(o,a+1),isCubic:!0})):m.push(function({polylineFrom:e,polylineTo:t}){return i=>K(e.slice(1,3),t.slice(1,3),i)}({polylineFrom:e.slice(s,n+1),polylineTo:t.slice(o,a+1)}))}m.push(U({pointFrom:e[n],pointTo:t[a]})),r===u.length-1&&(e.length-n-1>0||t.length-a-1>0)&&m.push(H({polylineFrom:e.slice(n),polylineTo:t.slice(a),toOppositeScale:t.length-a==1?p:g,isCubic:!0}))}),0===m.length&&(t.length>0&&0===u.length||e.length>0&&0===u.length)&&m.push(X({polylineFrom:e.slice(0),polylineTo:t.slice(0),isCubic:!0}));return e=>{var t=[];return m.forEach(i=>{var r=i(e);G(t,r)}),t}}:function(e,t){var i=(e=e.filter(e=>!e.isInterpolated)).map(e=>e.id),r=t.map(e=>e.id),n=i.filter(e=>r.indexOf(e)>=0),a=e.filter(e=>!e.positionIsBeingChanged),s=t.filter(e=>!e.positionIsBeingChanged),o=Z(a,s),l=Z(s,a),c=[];n.forEach((a,s)=>{var d=i.indexOf(a),u=r.indexOf(a);if(0===s&&(d>0||u>0)&&c.push(H({isCubic:!1,polylineFrom:e.slice(0,d+1),polylineTo:t.slice(0,u+1),toOppositeScale:0===u?o:l})),s>0){var h=i.indexOf(n[s-1]),f=r.indexOf(n[s-1]);(d-h>1||u-f>1)&&c.push(W({isCubic:!1,polylineFrom:e.slice(h,d+1),polylineTo:t.slice(f,u+1)}))}c.push(U({pointFrom:e[d],pointTo:t[u]})),s===n.length-1&&(e.length-d-1>0||t.length-u-1>0)&&c.push(H({isCubic:!1,polylineFrom:e.slice(d),polylineTo:t.slice(u),toOppositeScale:t.length-u==1?o:l}))}),0===c.length&&(t.length>0&&0===n.length||e.length>0&&0===n.length)&&c.push(X({isCubic:!1,polylineFrom:e.slice(0),polylineTo:t.slice(0)}));return e=>{var t=[];return c.forEach(i=>{var r=i(e);G(t,r)}),t}})(e,t)),r(n))}function H({polylineFrom:e,polylineTo:t,isCubic:i,toOppositeScale:r}){var n=e.length>t.length?e:t,a=1===t.length,s=e[0].id!==t[0].id,o=Boolean(s!==a);return e=>{var t=(i?Q:J)({t:e,polyline:n,decreasing:a,rightToLeft:o});a===o?t.shift():t.pop();var s=K(t.map(r),t,a?1-e:e);return s.forEach(e=>e.positionIsBeingChanged=!0),s}}function W({polylineFrom:e,polylineTo:t,isCubic:i}){var r=e.length,n=t.length;if(n!==r){var a=na+Number(e{if(r>2){var n=function(e,t){for(var i,r,n=[t[0]],a=0;ae/(r-1)),e.slice(c-3,c+1));Qe(r-2).forEach(e=>n[3*(e+1)].id=t[l.length-1+3*e].id),i&&n.forEach((e,t)=>{t>0&&ta+Number(e{Qe(1,r).forEach(n=>{var a;n===r-1?(a=Object.assign({},e[c]),i||(a.id=t[l.length].id)):((a=Y(e[c-1],e[c],n/(r-1))).id=t[l.length].id,i&&(a.isInterpolated=!0)),l.push(a)}),c++}),l})({smallerPolyline:a?t:e,biggerPolyline:s,decreasing:a}),l=s.slice(1,s.length-1),c=o.slice(1,o.length-1);return e=>{var t=K(c,l,a?1-e:e);return t.forEach(e=>e.positionIsBeingChanged=!0),t}}var d=e.slice(1,e.length-1),u=t.slice(1,t.length-1);return e=>{var t=K(d,u,e);return t.forEach(e=>e.positionIsBeingChanged=!0),t}}function U({pointFrom:e,pointTo:t}){return i=>[Y(e,t,i)]}function X({polylineFrom:e,polylineTo:t,isCubic:i}){var r=0===t.length,n=r,a=r?e:t;return e=>{var t=(i?Q:J)({t:e,polyline:a,decreasing:r,rightToLeft:n});return t.forEach((e,t)=>{t>0&&(e.positionIsBeingChanged=!0)}),t}}function G(e,t){return Array.prototype.push.apply(e,t)}function q(e,t,i){return void 0===t?e:"number"==typeof t?e+i*(t-e):t}function Y(e,t,i){if(e===t)return t;var r={};return Object.keys(e).forEach(n=>r[n]=q(e[n],t[n],i)),void 0!==t.id&&(r.id=t.id),r}function K(e,t,i){return e.map((e,r)=>Y(e,t[r],i))}function J({t:e,polyline:t,decreasing:i,rightToLeft:r}){var n=Boolean(i)!==Boolean(r),a=function(e,t){var i=0;if(e>0){for(var r,n,a,s,o=[0],l=0,c=1;cObject.assign({},m,{id:t[f+e].id,isInterpolated:!0})))}return p}(i?1-e:e,n?t.slice(0).reverse():t);return n&&a.reverse(),a}function Q({t:e,polyline:t,decreasing:i,rightToLeft:r}){var n=Boolean(i)!==Boolean(r),a=function(e,t){var i=(t.length-1)/3+1,r=0;if(e>0){for(var n,a,s,o,l,c,d,u,h=[0],f=0,p=1;pe.isInterpolated=!0),x[2].id=t[y].id,G(v,x),Qe(1,b).forEach(e=>{G(v,[{x:x[2].x,y:x[2].y,isCubicControl:!0,isInterpolated:!0},{x:x[2].x,y:x[2].y,isCubicControl:!0,isInterpolated:!0},Object.assign({},x[2],{id:t[y+3*e].id,isInterpolated:!0})])})}return v}(i?1-e:e,n?t.slice(0).reverse():t);return n&&a.reverse(),a}function Z(e,t){var i,r,n,a,s=[],o=[],l=0,c=e.length,d=t.length;for(i=0;ie;var u=Object.keys(s[0]).filter(e=>"number"==typeof s[0][e]).filter(e=>"id"!==e),h={},f=(e,t,i,r)=>n=>r+(n-t)*(r-i)/(t-e);return u.forEach(e=>{for(var t,i,r=s[0][e],n=o[0][e],a=s.length-1;a>0;a--)if((t=s[a][e])!==r)return i=o[a][e],void(h[e]=f(r,t,n,i));h[e]=((e,t)=>i=>i-e+t)(r,n)}),e=>{var t=Object.assign({},e);return u.forEach(i=>{t[i]=h[i](e[i])}),t}}function ee(e,t,i,r){return Math.sqrt((i-e)*(i-e)+(r-t)*(r-t))}function te(e,[t,i,r,n]){var a=j(e,t,i,r,n);return[a[1],a[2],a[4],a[5]].forEach(e=>e.isCubicControl=!0),Object.keys(n).forEach(i=>{"x"!==i&&"y"!==i&&"id"!==i&&(a[3][i]=q(t[i],n[i],e))}),a}function ie(e,t){if(e.length<2)return e.slice(0);if(2===e.length)return[e[0],{x:re(e[0].x,e[1].x,1/3),y:re(e[0].y,e[1].y,1/3)},{x:re(e[0].x,e[1].x,2/3),y:re(e[0].y,e[1].y,2/3)},e[1]];var i,r,n,a,s,o,l,c,d,u,h,f,p,g,m=new Array(3*(e.length-1)+1);const b=m.length-1;for(var y=0;y0&&(m[3*y-2]=I(1/3,e[y-1],e[y]),m[3*y-1]=I(2/3,e[y-1],e[y]));for(var v=m.slice(0),x=0;x<3;x++){for(m[1]={x:re(m[0].x,m[3].x,1/3),y:re(m[0].y,re(m[3].y,m[2].y,1.5),2/3)},m[b-1]={x:re(m[b].x,m[b-3].x,1/3),y:re(m[b].y,re(m[b-3].y,m[b-2].y,1.5),2/3)},t&&((m[1].y-m[0].y)*(m[3].y-m[2].y)<0&&(m[1]={x:m[1].x,y:m[0].y}),(m[b-1].y-m[b].y)*(m[b-3].y-m[b-2].y)<0&&(m[b-1]={x:m[b-1].x,y:m[b].y})),y=6;yi.y==l>n.y&&(p=re(p*(g=(n.y-r.y)/(l-r.y)),p,1/(1+Math.abs(g))),h=(n.y-r.y)/p),r.y>i.y==se,step:function(e){for(var t,i,r,n,a=[],s=void 0!==e[0].id,o=void 0!==e[0].size,l=1;llt(e=>e.node().getComputedTextLength(),e=>e.node().textContent.length),de=(e,t,i)=>{i=i||ce(),e.each(function(){var e=le.select(this.parentNode).data()[0],r=t(e),n=le.select(this),a=n.text().split(/\s+/),s=!1,o=a.reduce((e,t,a)=>{if(s)return e;var o=a>0?[e,t].join(" "):t,l=i(n.text(o));if(l{a=a||ce();var s=(e,t,i,r,n,a,s)=>{var o=s*i+a;return e.append("tspan").attr("x",r).attr("y",n).attr("dy",o+"em").text(t)};e.each(function(){var e=le.select(this.parentNode).data()[0],o=t(e),l=le.select(this),c=l.text().split(/\s+/),d=l.attr("x"),u=l.attr("y"),h=parseFloat(l.attr("dy"));l.text(null);var f=s(l,null,1.1,d,u,h,0),p=!1,g=c.length-1,m=c.reduce((e,t,r)=>{if(p)return e;var n=e.length===i||r===g,s=e[e.length-1],l=""!==s?s+" "+t:t,c=a(f.text(l)),d=c>o;if(d&&n){var u=Math.floor(o/c*l.length);e[e.length-1]=l.substr(0,u-4)+"...",p=!0}return d&&!n&&e.push(t),d||(e[e.length-1]=l),e},[""]).filter(e=>e.length>0);u=n?-1*(m.length-1)*Math.floor(.5*r):u,m.forEach((e,t)=>s(l,e,1.1,d,u,h,t)),f.remove()})};var he=(e,t,i)=>(t>0&&!document.hidden&&((e=e.transition(i).duration(t)).attr=fe),e.onTransitionEnd=function(e){return me(this,e),this},e),fe=function(e,t){var i,r=le.transition.prototype.attr.apply(this,arguments);if(0===arguments.length)throw new Error("Unexpected `transition().attr()` arguments.");1===arguments.length?i=e:arguments.length>1&&(i={[e]:t});var n="__transitionAttrs__",a="__lastTransitions__",s=ge();this.each(function(){var e={};for(var t in i)"function"==typeof i[t]?e[t]=i[t].apply(this,arguments):e[t]=i[t];this[n]=Object.assign(this[n]||{},e),this[n][a]||Object.defineProperty(this[n],a,{value:{}}),Object.keys(e).forEach(e=>this[n][a][e]=s)});var o=function(){this[n]&&(Object.keys(i).filter(e=>this[n][a][e]===s).forEach(e=>delete this[n][e]),0===Object.keys(this[n]).length&&delete this[n])};return this.on(`interrupt.${s}`,()=>this.each(o)),this.on(`end.${s}`,()=>this.each(o)),r},pe=0,ge=function(){return++pe},me=(e,t)=>{if(le.transition.prototype.isPrototypeOf(e)&&!e.empty()){var i=()=>t.call(null,e);return e.on("interrupt.d3_on_transition_end",i),e.on("end.d3_on_transition_end",i),e}t.call(null,e)},be=(e,t,i,r)=>{const n=r||(e=>e),a=function(){n(this)};return function(r){var n=r;return t&&(n=n.call(xe(st(t,i)))),n=(n=he(n,e)).call(xe(i)),e>0?n.on("end.d3_animationInterceptor",()=>n.each(a)):n.each(a),n}},ye=(e,t)=>{var i=e.node();return e.selectAll(t).filter(function(){return this.parentNode===i})},ve=(e,t,i,r,n="linear")=>{const a="__pathPoints__";return function(e){this[a]||(this[a]=i.map(()=>[]));const s=i.map((t,i)=>{const s=it(e,r).map(t),o=(se(n)||se("linear"))(s),l=this[a][i];return{pointsFrom:l,pointsTo:o,interpolate:V(l,o,oe(n))}});return e=>{if(0===e){let e=s.map(e=>e.pointsFrom);return t(...e)}if(1===e){let e=s.map(e=>e.pointsTo);return this[a]=e,t(...e)}const i=s.map(t=>t.interpolate(e));return this[a]=i,t(...i)}}},xe=e=>t=>(Object.keys(e).forEach(i=>t.attr(i,e[i])),t),_e=e=>t=>(Object.keys(e).forEach(i=>t.classed(i,e[i])),t);class we extends f{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{animationSpeed:0,enableColorToBarPosition:!1}),this.config.guide.size=this.config.guide.size||{};var t=this.config.stack,i=this.config.guide.enableColorToBarPosition,r=[e.flip&&_.get("flip"),t&&_.get("stack"),i&&_.get("positioningByColor")];this.decorators=(this.config.transformRules||r).concat(e.transformModel||[]),this.adjusters=(this.config.adjustRules||[]).concat(e.adjustScales||[])}defineGrammarModel(e){const t=this.config;this.regScale("x",e("pos",t.x,[0,t.options.width])).regScale("y",e("pos",t.y,[t.options.height,0])).regScale("y",e("pos",t.y,e=>["ordinal","period"].indexOf(e.type)>=0?[0,t.options.height]:[t.options.height,0])).regScale("size",e("size",t.size,{})).regScale("color",e("color",t.color,{})).regScale("split",e("split",t.split,{})).regScale("label",e("label",t.label,{})).regScale("identity",e("identity",t.identity,{}));const i=this.getScale("x"),r=this.getScale("y"),n=this.getScale("size"),a=this.getScale("label"),s=this.getScale("color"),o=this.getScale("split"),l=this.getScale("identity"),c=r.domain(),d=r.discrete?c[0]:Math.max(0,Math.min(...c)),u=r.value(d)+.5*r.stepSize(d),h=s.domain(),f={data:()=>this.data(),flip:!1,scaleX:i,scaleY:r,scaleSize:n,scaleLabel:a,scaleColor:s,scaleSplit:o,scaleIdentity:l,color:e=>s.value(e[s.dim]),label:e=>a.value(e[a.dim]),group:e=>`${e[s.dim]}(@taucharts@)${e[o.dim]}`,order:e=>{const t=e.split("(@taucharts@)")[0],i=h.indexOf(t);return i<0?Number.MAX_VALUE:i},size:e=>n.value(e[n.dim]),id:e=>l.value(e[l.dim],e),xi:e=>i.value(e[i.dim]),yi:e=>r.value(e[r.dim]),y0:()=>u};return f.data().forEach(e=>f.id(e)),f}getGrammarRules(){return this.decorators.filter(e=>e)}getAdjustScalesRules(){return(this.adjusters||[]).filter(e=>e)}createScreenModel(e){const t=e.flip,i=(e,t,i)=>e?t:i;return{flip:t,id:e.id,x:i(t,e.yi,e.xi),y:i(t,e.xi,e.yi),x0:i(t,e.y0,e.xi),y0:i(t,e.xi,e.y0),size:e.size,group:e.group,order:e.order,label:e.label,color:t=>e.scaleColor.toColor(e.color(t)),class:t=>e.scaleColor.toClass(e.color(t)),model:e,toFibers:()=>{const t=rt(e.data(),e.group);return Object.keys(t).sort((t,i)=>e.order(t)-e.order(i)).reduce((e,i)=>e.concat([t[i]]),[])}}}drawFrames(){var e=this,t=this.config.options,i=t=>((e,t)=>{var i=Math.pow(10,t);return Math.round(i*e)/i})(e.screenModel.size(t)/2,4),r=be,n=function(t,i,n){var a=e.config.guide.animationSpeed,o=t.selectAll(`.${i}`).data(e=>[e],e.screenModel.id);o.exit().call(r(a,null,{width:0},e=>s.select(e).remove())),o.call(r(a,null,n)),o.enter().append("rect").style("stroke-width",0).call(r(a,{width:0},n))},a=this.config.flip,o=a?"y":"x",l=a?"x":"y",c=a?"x0":"y0",d=a?"height":"width",u=a?"width":"height",h=function(t){n(t,"lvl-top",{[d]:e=>i(e),[u]:1,[o]:t=>e.screenModel[o](t)-i(t)/2,[l]:t=>e.screenModel[l](t),fill:t=>e.screenModel.color(t),class:t=>`lvl-top ${e.screenModel.class(t)}`}),n(t,"lvl-btm",{[d]:e=>i(e),[u]:1,[o]:t=>e.screenModel[o](t)-i(t)/2,[l]:t=>e.screenModel[c](t),fill:t=>e.screenModel.color(t),class:t=>`lvl-btm ${e.screenModel.class(t)}`}),n(t,"lvl-link",{[d]:.5,[u]:t=>Math.abs(e.screenModel[l](t)-e.screenModel[c](t)),[o]:t=>e.screenModel[o](t)-.25,[l]:t=>Math.min(e.screenModel[l](t),e.screenModel[c](t)),fill:t=>e.screenModel.color(t),class:t=>`lvl-link ${e.screenModel.class(t)}`})},f=function(t){t.attr("class",`frame-id-${e.config.uid}`).call(function(t){var i=t.selectAll(".generic").data(e=>e,e.screenModel.id);i.exit().remove(),i.call(h),i.enter().append("g").attr("class","generic").call(h)})},p=rt(this.data(),e.screenModel.group),g=Object.keys(p).sort((t,i)=>e.screenModel.order(t)-e.screenModel.order(i)).reduce((e,t)=>e.concat([p[t]]),[]),m=t.container.selectAll(`.frame-id-${e.config.uid}`).data(g);m.exit().remove(),m.call(f),m.enter().append("g").call(f)}}const Ee={...o,...l};function Se(e,t,i,r){var n=r(i(e),e);return(n[t]||[]).forEach(e=>Se(e,t,i,r)),n}function Te(e,t,i,r=0){t(e,r)&&(e.units||[]).map(e=>Te(e,t,i,r+1)),i(e,r)}var Me=function(){var e=[];function t(e){for(var t in e)this[t]=e[t]}function i(){this.copiedObjects=[];var e=this;this.recursiveDeepCopy=function(t){return e.deepCopy(t)},this.depth=0}function r(e,t){var r=new i;return t&&(r.maxDepth=t),r.deepCopy(e)}return t.prototype={constructor:t,canCopy:function(e){return!1},create:function(e){},populate:function(e,t,i){}},i.prototype={constructor:i,maxDepth:256,cacheResult:function(e,t){this.copiedObjects.push([e,t])},getCachedResult:function(e){for(var t=this.copiedObjects,i=t.length,r=0;rthis.maxDepth)throw new Error("Exceeded max recursion depth in deep copy.");return e.populate(this.recursiveDeepCopy,t,i),this.depth--,i}},r.DeepCopier=t,r.deepCopiers=e,r.register=function(i){i instanceof t||(i=new t(i)),e.unshift(i)},r.register({canCopy:function(){return!0},create:function(e){return e instanceof e.constructor?"object"==typeof(t=e.constructor.prototype)?JSON.parse(JSON.stringify(t)):t:{};var t},populate:function(e,t,i){for(var r in t)t.hasOwnProperty(r)&&(i[r]=e(t[r]));return i}}),r.register({canCopy:function(e){return e instanceof Array},create:function(e){return new e.constructor},populate:function(e,t,i){for(var r=0;r/^(#|rgb\(|rgba\()/.test(e),ke=/(.)^/;let Ae={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Pe={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Oe=/\\|'|\r|\n|\u2028|\u2029/g,Ne="(?:"+Object.keys(Ae).join("|")+")",Le=RegExp(Ne),Re=RegExp(Ne,"g"),Fe={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};function De(e){return Me(e)}function $e(e){return e instanceof Date&&!isNaN(Number(e))}function ze(e){return null!=e&&"object"==typeof e}function Be(e){var t=parseFloat(Math.min(...e).toFixed(15)),i=parseFloat(Math.max(...e).toFixed(15));if(t===i){i-=(i>=0?-1:1)*(i||1)/10}for(var r=[t=Math.min(0,t),i=Math.max(0,i)],n=r[1]-r[0],a=Math.pow(10,Math.floor(Math.log(n/10)/Math.LN10)),s=10/n*a,o=[[.15,10],[.35,5],[.75,2],[1,1],[2,1]],l=-1;s>o[++l][0];);a*=o[l][1],r[0]=Math.floor(r[0]/a)*a,r[1]=Math.ceil(r[1]/a)*a;var c=t-r[0],d=r[1]-i,u=a/2;if(t<0){var h=c>=u?-c:0;r[0]=r[0]-h}if(i>0){var f=d>=u?-d:0;r[1]=r[1]+f}return[parseFloat(r[0].toFixed(15)),parseFloat(r[1].toFixed(15))]}function Ie(e,t,{utc:i}={utc:!1}){var[r,n]=Ee.extent(e),a=+n-+r,s=i?Ee.scaleUtc:Ee.scaleTime;if(0===a){return r=new Date(r.getTime()-864e5),n=new Date(n.getTime()+864e5),s().domain([r,n]).nice(t).domain()}var o=s().domain([r,n]).nice(t);if(t)return o.domain();var[l,c]=s().domain([r,n]).nice(t).domain(),d=o.ticks(),u=d.length-1;return(+r-+l)/(+d[1]-+l)<.5&&(r=l),(+c-+n)/(+c-+d[u-1])<.5&&(n=c),[r,n]}var je=0,Ve={};function He(e){var t=btoa(encodeURIComponent(e)).replace(/=/g,"_");return Ve.hasOwnProperty(t)||(Ve[t]=`H${++je}`),Ve[t]}function We(e,t,i){var r=0,n=null,a=lt((e,t)=>it(e.map(e=>t.reduce((t,i)=>t.concat((e=>$e(e)?e.getTime():e)(e[i])),[])),e=>JSON.stringify(e)).reduce((e,t)=>{var i=t[0];return e[i]=e[i]||0,e[i]+=1,e},{}),(e,t)=>{let i=n===e?r:++r;return n=e,`${t.join("")}-${i}`});return(r,n,s)=>{var o=s.length,l=i.getSpec(),c=l.sources["/"].data,d=l.unit.units[0].guide||{};d.padding=d.padding||{l:0,r:0,t:0,b:0};var u=0;"x"===e?u=d.padding.l+d.padding.r:"y"===e&&(u=d.padding.t+d.padding.b);var h=(n-o*u)/(e=>{var t=a(c,e);return Object.keys(t).reduce((e,i)=>e+t[i],0)})(t);return(((e,t)=>a(c,e)[t])(t,r)*h+u)/n}}function Ue(e){var t=!0;try{Te(e,e=>{if(0===e.type.indexOf("COORDS.")&&"COORDS.RECT"!==e.type)throw new Error("Not applicable")},e=>e)}catch(e){"Not applicable"===e.message&&(t=!1)}return t}function Xe(e,t,i,r=0){if("requestAnimationFrame"===r){var n=!1;return function(...r){n||(requestAnimationFrame(()=>{n=!1}),i.apply(this,r),n=!0),e.e=t,e.ts=Date.now()}}return function(...n){var a={e:t,ts:Date.now()};(e.e&&e.e===a.e?a.ts-e.ts:r)>=r&&i.apply(this,n),e.e=a.e,e.ts=a.ts}}function Ge(e,t){var i=e[0],r=e[1],n=(r-i)/(t-1),a=t>=2?Qe(t-2).map(e=>i+n*(e+1)):[];return[i,...a,r]}function qe(e){return Ce(e)?e:""}function Ye(e){return Ce(e)?"":e}function Ke(e){return e/180*Math.PI}function Je(e){return Math.abs(e)>=360&&(e%=360),e<0&&(e=360+e),e}function Qe(e,t){1===arguments.length&&(t=e,e=0);const i=[];for(let r=e;r100}function et(e,t,i,r){return e+t*(-90===i?-1:1)-r>20}function tt(e){return Array.isArray(e)?[].concat(...e.map(e=>tt(e))):e}function it(e,t){for(var i={},r=[],n=e.length,a=t||(e=>String(e)),s=0;s{var r=t(i);return e[r]=e[r]||[],e[r].push(i),e},{})}function nt(e,t){return it(e.concat(t))}function at(e,t){return e.filter(e=>-1!==t.indexOf(e))}function st(e,...t){var i=t.length;if(0===i||!e)return e;for(var r=0;r{delete i[e]}),i}function lt(e,t){const i=function(r){const n=i.cache,a=String(t?t.apply(this,arguments):r);return n.hasOwnProperty(a)||(n[a]=e.apply(this,arguments)),n[a]};return i.cache={},i}function ct(...e){return(t,i)=>{var r=0;return e.every(e=>0===(r=e(t,i))),r}}function dt(e,...t){return null==e?{}:t.reduce((t,i)=>{let r=e[i];return r&&(t[i]=r),t},{})}function ut(e){return e=null==e?"":String(e),Le.test(e)?e.replace(Re,e=>Ae[e]):e}function ht(e,t,i){!t&&i&&(t=i),t=st({},t,Fe);var r=RegExp([(t.escape||ke).source,(t.interpolate||ke).source,(t.evaluate||ke).source].join("|")+"|$","g"),n=0,a="__p+='";e.replace(r,function(t,i,r,s,o){return a+=e.slice(n,o).replace(Oe,e=>"\\"+Pe[e]),n=o+t.length,i?a+="'+\n((__t=("+i+"))==null?'':utils.escape(__t))+\n'":r?a+="'+\n((__t=("+r+"))==null?'':__t)+\n'":s&&(a+="';\n"+s+"\n__p+='"),t}),a+="';\n",t.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{var s=new Function(t.variable||"obj",a)}catch(e){throw e.source=a,e}var o=function(e){return s.call(this,e)},l=t.variable||"obj";return o.source="function("+l+"){\n"+a+"}",o}function ft(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const pt=" ",gt=32,mt=["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((e,t)=>(e[t]=!0,e),{});function bt(e){var t=2,i=arguments[1];("object"!=typeof arguments[1]||Array.isArray(arguments[1]))&&(t=1,i={});const r=tt(Array.prototype.slice.call(arguments,t)),n=1===r.length&&"<"!==r[0].trim()[0],a=mt[e];if(a&&r.length>0)throw new Error(`Tag "${e}" is void but content is assigned to it`);const s=`<${e}`;var o=Object.keys(i).map(function(e){return` ${e}="${i[e]}"`}).join("");o.length>gt&&(o=Object.keys(i).map(function(e){return`\n${pt}${e}="${i[e]}"`}).join(""));const l=n?r[0]:"\n"+r.map(e=>{return String(e).split("\n").map(e=>`${pt}${e}`).join("\n")}).join("\n")+"\n";return`${s}${o}${a?"/>":`>${l}`}`}function yt(e){var t=e;const i={then:e=>(t=e(t),i),result:()=>t};return i}const vt=[we];function xt(e){return vt.some(t=>e instanceof t)}function _t(e){return(e.units||[]).some(e=>e.hasOwnProperty("units"))}var wt=document.createElement("div"),Et=new WeakMap;function St(e,t){var i;return e instanceof Node?i=e:(wt.insertAdjacentHTML("afterbegin",e),i=wt.childNodes[0]),t.appendChild(i),i}function Tt(e){if(Et.has(e))return Et.get(e);var t=e.style.overflow;e.style.overflow="scroll";var i={width:e.offsetWidth-e.clientWidth,height:e.offsetHeight-e.clientHeight};return e.style.overflow=t,Et.set(e,i),i}function Mt(e,t){var i="horizontal"===(t=t||"both")||"both"===t,r="vertical"===t||"both"===t,n=Tt(e),a=r?`${n.width}px`:"0",s=i?`${n.height}px`:"0";e.style.overflow="hidden",e.style.padding=`0 ${a} ${s} 0`;var o=e.scrollWidth>e.clientWidth,l=e.scrollHeight>e.clientHeight,c=r&&!l?`${n.width}px`:"0",d=i&&!o?`${n.height}px`:"0";return e.style.padding=`0 ${c} ${d} 0`,e.style.overflow="",e.style.overflowX=o?"scroll":"hidden",e.style.overflowY=l?"scroll":"hidden",n}function Ct(e,t){return window.getComputedStyle(e).getPropertyValue(t)}function kt(e,t){return parseInt(Ct(e,t)||"0",10)}function At(e){var t=kt(e,"padding-left"),i=kt(e,"padding-right"),r=kt(e,"padding-bottom"),n=kt(e,"padding-top"),a=kt(e,"border-top-width")+kt(e,"border-left-width")+kt(e,"border-right-width")+kt(e,"border-bottom-width"),s=e.getBoundingClientRect();return{width:s.width-t-i-2*a,height:s.height-r-n-2*a}}function Pt(e){var t=document.createElement("div");t.style.position="absolute",t.style.visibility="hidden",t.style.width="100px",t.style.height="100px",t.style.border="1px solid green",t.style.top="0",document.body.appendChild(t),t.innerHTML='\n \n \n \n \n \n ';var i=t.querySelector(".x.axis .tick text");i.textContent=e;var r={width:0,height:0},n=i.getBoundingClientRect();r.width=n.right-n.left,r.height=n.bottom-n.top;var a=0!==e.length?r.width/e.length:0;return r.width=r.width+1.5*a,document.body.removeChild(t),r}function Ot(e,{fontSize:t,fontFamily:i,fontWeight:r}){var n="string"==typeof t?t:`${t}px`,a=e.map(function(e){for(var t=0,a=0;t<=e.length-1;t++){a+=Nt(e.charAt(t),{fontSize:n,fontFamily:i,fontWeight:r}).width}return a}).sort(function(e,t){return t-e})[0],s=e.length,o=parseInt(n);return{width:a,height:o*s+.39*o*s}}const Nt=lt((e,{fontSize:t,fontFamily:i,fontWeight:r})=>{var n=document.createElement("div");n.style.position="absolute",n.style.visibility="hidden",n.style.border="0px",n.style.top="0",n.style.fontSize=t,n.style.fontFamily=i,n.style.fontWeight=r,document.body.appendChild(n),n.innerHTML=" "===e?" ":e;var a={width:0,height:0},s=n.getBoundingClientRect();return a.width=s.right-s.left,a.height=s.bottom-s.top,document.body.removeChild(n),a},(e,t)=>`${e}_${JSON.stringify(t)}`);function Lt(e,t){var i={".":(e,t)=>t.classed(e,!0),"#":(e,t)=>t.attr("id",e)},r=Object.keys(i).join("");if(t.indexOf(" ")>=0)throw new Error("Selector should not contain whitespaces.");if(r.indexOf(t[0])>=0)throw new Error("Selector must have tag at the beginning.");var n,a=e instanceof Element,o=a?s.select(e):e,l=e=>a?e.node():e,c=o.selectAll(t).filter(function(){return this.parentNode===o.node()}).filter((e,t)=>0===t);if(!c.empty())return l(c);for(var d,u=-1,h=null,f=1,p=t.length;f<=p;f++)(f==p||r.indexOf(t[f])>=0)&&(d=t.substring(u+1,f),u<0?n=o.append(d):i[h].call(null,d,n),h=t[f],u=f);return l(n)}function Rt(e,t){return Ft(e,t)[0]||null}function Ft(e,t){for(var i=[],r=Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,n=e.firstElementChild;Boolean(n);n=n.nextElementSibling)r.call(n,t)&&i.push(n);return i}function Dt(e,t){if(e.childElementCount>0){const n=Array.prototype.filter.call(e.childNodes,e=>e.nodeType===Node.ELEMENT_NODE),a=n.slice().sort(t),s=n.reduce((e,t,i)=>(e.set(t,i),e),new Map);var i,r;const o=a.reduce((e,t,n)=>{const o=s.get(t),l=n-o;return l!==r&&(i&&e.push(i),r=l,i={from:o,to:n,elements:[]}),i.elements.push(t),n===a.length-1&&e.push(i),e},[]),l=o.slice().sort((e,t)=>e.from-t.from),c=l.reduce((e,t,i)=>(e.set(t,i),e),new Map),d=e=>{const t=o.map((e,t)=>({elements:e.elements,from:c.get(e),to:t})).sort(ct((e,t)=>e.elements.length-t.elements.length,e?(e,t)=>t.to-e.to:(e,t)=>e.to-t.to));for(var i,r,n,a=0;ar.to)for(i=a+1;i=r.to&&n.fromr.from&&n.from<=r.to&&n.from--}return t.filter(e=>e.from!==e.to)},u=d(!0),h=d(!1),f=u.lengthe.elements);f.forEach(t=>{const i=p.splice(t.from,1)[0],r=p[t.to],n=r?r[0]:null;var a;1===t.elements.length?a=i[0]:(a=document.createDocumentFragment(),i.forEach(e=>{a.appendChild(e)})),e.insertBefore(a,n),p.splice(t.to,0,i)})}}function $t(...e){var t=[];return e.filter(e=>Boolean(e)).forEach(e=>{"string"==typeof e?t.push(e):"object"==typeof e&&t.push.apply(t,Object.keys(e).filter(t=>Boolean(e[t])))}),it(t).join(" ").trim().replace(/\s{2,}/g," ")}function zt(e,t,...i){const r=document.createEvent("MouseEvents"),n=[!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null],a=i.concat(n.slice(i.length));r.initMouseEvent(t,...a),e.dispatchEvent(r)}var Bt=e=>$e(e)?e.getTime():e,It={cross(e,t,i){var r=e(),n=it(r.map(e=>e[t]),Bt),a=it(r.map(e=>e[i]),Bt),s=0===n.length?[null]:n;return(0===a.length?[null]:a).reduce((e,r)=>e.concat(s.map(e=>{var n={};return t&&(n[t]=Bt(e)),i&&(n[i]=Bt(r)),n})),[])},cross_period(e,t,i,r,n,a){var s=e(),o=!!a&&a.utcTime,l=it(s.map(e=>e[t]),Bt),c=it(s.map(e=>e[i]),Bt),d=0===l.length?[null]:l,u=0===c.length?[null]:c;return r&&(d=b.generate(Math.min(...l),Math.max(...l),r,{utc:o})),n&&(u=b.generate(Math.min(...c),Math.max(...c),n,{utc:o})),u.reduce((e,r)=>e.concat(d.map(e=>{var n={};return t&&(n[t]=Bt(e)),i&&(n[i]=Bt(r)),n})),[])},groupBy:(e,t)=>it(e().map(e=>e[t]),Bt).map(e=>({[t]:Bt(e)})),none:()=>[null]};class jt{constructor({key:e,pipe:t,source:i,units:r},n,a={}){this.key=e,this.pipe=t||[],this.source=i,this.units=r,this._frame={key:e,source:i,pipe:this.pipe},this._data=n,this._pipeReducer=((e,t)=>a[t.type](e,t.args))}hash(){return He([this._frame.pipe,this._frame.key,this._frame.source].map(e=>JSON.stringify(e)).join(""))}full(){return this._data}part(e=(e=>e)){return this._frame.pipe.map(e).reduce(this._pipeReducer,this._data)}}var Vt=e=>$e(e)?e.getTime():e;const Ht=function(e){Object.keys(e).forEach(t=>this[t]=e[t])},Wt=(e,t,i)=>e.map(e=>"string"==typeof e?i.get(e):e).filter(e=>e).reduce((e,t)=>((e,t={})=>Object.assign(new Ht(e),t))(e,t(e,{})),t);class Ut extends h{constructor(e,t,i,r){super(),st(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||{},this.config=e,this.sources=e.sources,this.scales=e.scales,this.unitSet=i,this.grammarRules=r,this.scalesHub=t,this.transformations=Object.assign(e.transformations||{},{where(e,t){var i=Object.keys(t||{}).map(e=>i=>Vt(i[e])===t[e]);return e.filter(e=>i.every(t=>t(e)))}})}static traverseSpec(e,t,i,r=null,n=null){var a=[],s=(e,t,i,r,n)=>{a.push(()=>{t(e,r,n)}),e.frames&&e.frames.forEach(r=>{(r.units||[]).map(n=>s(n,t,i,e,r))}),a.push(()=>i(e,r,n))};return s(e.unit,t,i,r,n),a}unfoldStructure(){return this.root=this._expandUnitsStructure(this.config.unit),this.config}getDrawScenarioQueue(e){const t=this.grammarRules;var i=this._flattenDrawScenario(e,(e,i,r)=>{const n=!1===i.expression.inherit?null:r,a=this._createFrameScalesFactoryMethod(n),s=this.unitSet.create(i.type,Object.assign({},i,{options:e.allocateRect(r.key)})),o=new Ht(s.defineGrammarModel(a)),l=Wt(s.getGrammarRules(),o,t);return Wt(s.getAdjustScalesRules(),l,t),s.node().screenModel=s.createScreenModel(l),s}),r=this._flattenDrawScenario(e,(e,i,r)=>{const n=!1===i.expression.inherit?null:r,a=this._createFrameScalesFactoryMethod(n),s=this.unitSet.create(i.type,Object.assign({},i,{options:e.allocateRect(r.key)})),o=new Ht(s.defineGrammarModel(a)),l=Wt(s.getGrammarRules(),o,t);return s.node().screenModel=s.createScreenModel(l),s.parentUnit=e,s.addInteraction(),s});return i.concat(()=>{Object.keys(this.scales).forEach(e=>this.scalesHub.createScaleInfo(this.scales[e]).commit())}).concat(r)}_flattenDrawScenario(e,t){var i={},r=[],n=[e],a=Ut.traverseSpec({unit:this.root},(e,a,s)=>{e.uid=(()=>{var t=He((a?`${a.uid}/`:"")+JSON.stringify(Object.keys(e).filter(t=>"string"==typeof e[t]).reduce((t,i)=>(t[i]=e[i],t),{}))+`-${JSON.stringify(s.pipe)}`);return i.hasOwnProperty(t)?t+=`-${++i[t]}`:i[t]=0,t})(),e.guide=De(e.guide);var o=t((()=>n[0])(),e,s);r.push(o),0===e.type.indexOf("COORDS.")&&(e=>n.unshift(e))(o)},e=>{0===e.type.indexOf("COORDS.")&&(()=>n.shift())()},null,this._datify({source:this.root.expression.source,pipe:[]}));return a.push(()=>r),a}_expandUnitsStructure(e,t=[]){var i=this;if(!1===e.expression.operator)e.frames=e.frames.map(e=>i._datify(e));else{var r=this._parseExpression(e.expression,t,e.guide);e.transformation=e.transformation||[],e.frames=r.exec().map(n=>{var a=(r.inherit?t:[]).concat([{type:"where",args:n}]).concat(e.transformation);return i._datify({key:n,pipe:a,source:r.source,units:e.units?e.units.map(e=>{var t=De(e);return t.guide=e.guide,t}):[]})})}return e.frames.forEach(e=>e.units.forEach(t=>this._expandUnitsStructure(t,e.pipe))),e}_createFrameScalesFactoryMethod(e){var t=this;return(i,r,n)=>{var a=r||`${i}:default`;return t.scalesHub.createScaleInfo(t.scales[a],e).create("function"==typeof n?n(t.scales[a]):n)}}_datify(e){return new jt(e,this.sources[e.source].data,this.transformations)}_parseExpression(e,t,i){var r=e.operator||"none",n=e.source,a=!1!==e.inherit,s=e.params,o={source:n,pipe:a?t:[]},l=()=>this._datify(o).part(),c=It[r];if(!c)throw new Error(`${r} operator is not supported`);return{source:n,inherit:a,func:c,args:s,exec:()=>c(l,...s||[],i)}}}var Xt=i(10);Xt.Tooltip.defaults.baseClass=O+"tooltip";const Gt=["top","bottom"];class qt extends Xt.Tooltip{_pickPlace(e){if(!this.options.auto)return this.options.place;const t=0|this.options.winBound,i=(r=t,{top:(n=function(){const e=window,t=document.documentElement,i=(e.pageYOffset||t.scrollTop)-t.clientTop,r=(e.pageXOffset||t.scrollLeft)-t.clientTop,n=e.innerWidth||t.clientWidth,a=e.innerHeight||t.clientHeight;return{top:i,right:r+n,bottom:i+a,left:r,width:n,height:a}}()).top+r,right:n.right-r,bottom:n.bottom-r,left:n.left+r,width:n.width-2*r,height:n.height-2*r});var r,n,a=this.options.place.split("-"),s=this.spacing;if(-1!==Gt.indexOf(a[0]))switch(e.top-this.height-s<=i.top?a[0]="bottom":e.bottom+this.height+s>=i.bottom&&(a[0]="top"),a[1]){case"left":e.right-this.width<=i.left&&(a[1]="right");break;case"right":e.left+this.width>=i.right&&(a[1]="left");break;default:e.left+e.width/2+this.width/2>=i.right?a[1]="left":e.right-e.width/2-this.width/2<=i.left&&(a[1]="right")}else switch(e.left-this.width-s<=i.left?a[0]="right":e.right+this.width+s>=i.right&&(a[0]="left"),a[1]){case"top":e.bottom-this.height<=i.top&&(a[1]="bottom");break;case"bottom":e.top+this.height>=i.bottom&&(a[1]="top");break;default:e.top+e.height/2+this.height/2>=i.bottom?a[1]="top":e.bottom-e.height/2-this.height/2<=i.top&&(a[1]="bottom")}return a.join("-")}}class Yt{constructor(e,t){this.chart=t,this.handlers=new Map,this.plugins=e.map(this.initPlugin,this)}initPlugin(e){e.init&&e.init(this.chart);const t=[];this.handlers.set(e,t);const i=(i,r)=>{t.push(this.chart.on(i,r,e))};return e.destroy&&i("destroy",e.destroy.bind(e)),Object.keys(e).forEach(t=>{if(0===t.indexOf("on")){const r=t.substr(2).toLowerCase();i(r,e[t].bind(e))}}),e}destroyPlugin(e){e.destroy&&e.destroy(),this.handlers.get(e).forEach(t=>{this.chart.removeHandler(t,e)})}destroy(){this.plugins.forEach(e=>this.destroyPlugin(e))}}var Kt={},Jt={},Qt={reg(e,t,i){return i?(Jt[e]=i,Kt[e]=function(e,t){this.___tauchartsseed___=new t(this.init(e))},Kt[e].prototype=Object.assign({init:e=>e,defineGrammarModel(e){return this.node().defineGrammarModel(e)},getGrammarRules(e){return this.node().getGrammarRules(e)},getAdjustScalesRules(e){return this.node().getAdjustScalesRules(e)},createScreenModel(e){return this.node().createScreenModel(e)},addInteraction(){this.node().addInteraction()},node(){return this.___tauchartsseed___},draw(){this.node().draw()}},t)):Kt[e]=t,this},get(e){if(!Kt.hasOwnProperty(e))throw new y("Unknown unit type: "+e,v.UNKNOWN_UNIT_TYPE);return Kt[e]},create(e,t){var i,r=this.get(e);Jt[e]?i=new r(t,this.get(Jt[e])):i=new r(t);return i}},Zt={},ei={};const ti={reg:(e,t,i=(e=>e))=>(Zt[e]=t,ei[e]=i,ti),get:e=>Zt[e],instance:(e={})=>({create:function(t,i,r){return new(ti.get(t))(i,(0,ei[t])(r,e))}})};class ii{constructor(e,t,i){this.registry=e,this.sources=t,this.scales=i}createScaleInfo(e,t=null){var i=e.dim,r=e.source,n=(this.sources[r].dims[i]||{}).type,a=this.sources[r].data,s=t||new jt({source:r},a);return e.dimType=n,this.registry.create(e.type,s,e)}createScaleInfoByName(e,t=null){return this.createScaleInfo(this.scales[e],t)}}var ri={isYFunctionOfX:(e,t,i)=>{var r=!0,n=null;try{e.reduce((e,r)=>{var a=(e,t)=>{var i=r[t],n=ze(i)?JSON.stringify(i):i;return e.push(n),e},s=t.reduce(a,[]).join("/"),o=i.reduce(a,[]).join("/");if(e.hasOwnProperty(s)){var l=e[s];if(l!==o)throw n={type:"RelationIsNotAFunction",keyX:t.join("/"),keyY:i.join("/"),valX:s,errY:[l,o]},new Error("RelationIsNotAFunction")}else e[s]=o;return e},{})}catch(e){if("RelationIsNotAFunction"!==e.message)throw e;r=!1}return{result:r,error:n}},excludeNullValues:(e,t)=>{var i=Object.keys(e).reduce((t,i)=>{var r=e[i];return r.hasOwnProperty("hasNull")&&!r.hasNull||"measure"!==r.type&&"period"!==r.scale||t.push(i),t},[]);return e=>{var r=!i.some(t=>!e.hasOwnProperty(t)||null===e[t]);return r||t(e),r}},autoAssignScales:function(e){var t={category:"ordinal",order:"ordinal",measure:"linear"},i={};return Object.keys(e).forEach(r=>{var n=e[r],a=(n.type||"category").toLowerCase();i[r]=Object.assign({},n,{type:a,scale:n.scale||t[a],value:n.value})}),i},autoDetectDimTypes:function(e){var t={type:"category",scale:"ordinal"};return e.reduce((e,i)=>(Object.keys(i).forEach(r=>{var n=i.hasOwnProperty(r)?i[r]:null;if(e[r]=e[r]||{type:null,hasNull:!1},null===n)e[r].hasNull=!0;else{var a=((e,t)=>{var i=t;return $e(e)?(i.type="measure",i.scale="time"):ze(e)?(i.type="order",i.scale="ordinal"):Number.isFinite(e)&&(i.type="measure",i.scale="linear"),i})(n,De(t)),s=a.type,o=a.scale,l=null!==e[r].type&&e[r].type!==s;e[r].type=l?t.type:s,e[r].scale=l?t.scale:o}}),e),{})},sortByDim:function(e,t,i){var r=e,n=["period","time"].indexOf(i.scale)>=0?e=>new Date(e):e=>e;const a=e.reduce((e,t,i)=>(e.set(t,i),e),new Map);if("measure"===i.type||"period"===i.scale)r=e.slice().sort(ct((e,i)=>n(e[t])-n(i[t]),(e,t)=>a.get(e)-a.get(t)));else if(i.order){var s=i.order.reduce((e,t,i)=>(e[t]=i,e),{}),o=i.order.length,l=`(___${t}___)`;r=e.map(e=>{var i=s[e[t]];return i=i>=0?i:o,e[l]=i,e}).sort(ct((e,t)=>e[l]-t[l],(e,t)=>a.get(e)-a.get(t))).map(e=>(delete e[l],e))}return r}},ni=function(e,t){var i=document.createElement("div");return i.classList.add(O+e),t&&t.appendChild(i),i},ai=function(){var e=ni("layout"),t=ni("layout__header",e),i=ni("layout__container",e),r=ni("layout__sidebar",i),n=ni("layout__content",i),a=ni("layout__content__wrap",n),s=ni("layout__sidebar-right",i);return{layout:e,header:t,content:a,contentContainer:n,leftSidebar:r,rightSidebar:ni("layout__sidebar-right__wrap",s),rightSidebarContainer:s,footer:ni("layout__footer",e)}};class si{constructor(e){this.spec=e,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:e.settings}}convert(){var e=this.spec,t=this.dist;return this.ruleAssignSourceDims(e,t),this.ruleAssignStructure(e,t),this.ruleAssignSourceData(e,t),this.ruleApplyDefaults(t),t}ruleApplyDefaults(e){var t=e.settings||{},i=(e,t,r)=>{t(e,r),(e.units||[]).map(r=>i(r,t,e))};i(e.unit,(e,i)=>{if(e.namespace="chart",e.guide=st(e.guide||{},{animationSpeed:t.animationSpeed||0,utcTime:t.utcTime||!1}),i&&!e.hasOwnProperty("units")){e=st(e,{x:i.x,y:i.y});var r=De(i.guide)||{};e.guide.x=st(e.guide.x||{},r.x),e.guide.y=st(e.guide.y||{},r.y),e.expression.inherit=i.expression.inherit}return!i||e.guide&&e.guide.hasOwnProperty("obsoleteVerticalStackOrder")||(e.guide=Object.assign(e.guide||{},{obsoleteVerticalStackOrder:(i.guide||{}).obsoleteVerticalStackOrder})),e},null)}ruleAssignSourceData(e,t){var i=e.spec.dimensions||{},r=t.sources["/"].dims,n=(e,t)=>{let i=e[t];return ze(i)&&!$e(i)&&Object.keys(i).forEach(r=>e[t+"."+r]=i[r]),e};t.sources["/"].data=e.data.map(e=>{var t=Object.keys(e).reduce(n,e);return Object.keys(r).reduce((e,t)=>(e.hasOwnProperty(t)||(e[t]=null),null!==e[t]&&i[t]&&["period","time"].indexOf(i[t].scale)>=0&&(e[t]=new Date(e[t])),e),t)})}ruleAssignSourceDims(e,t){var i=e.spec.dimensions;t.sources["/"].dims=Object.keys(i).reduce((e,t)=>(e[t]={type:i[t].type},e),{})}ruleAssignStructure(e,t){var i=e=>{var r=De(ot(e,"unit"));return this.ruleCreateScales(e,r,t.settings),r.expression=this.ruleInferExpression(e),e.unit&&(r.units=e.unit.map(i)),r},r=i(e.spec.unit);r.expression.inherit=!1,t.unit=r}ruleCreateScales(e,t,i){var r=e.guide||{};["identity","color","size","label","x","y","split"].forEach(n=>{e.hasOwnProperty(n)&&(t[n]=this.scalesPool(n,e[n],r[n]||{},i))})}ruleInferDim(e,t){var i=e,r=this.spec.spec.dimensions;if(!r.hasOwnProperty(i))return i;t.hasOwnProperty("tickLabel")?i=`${e}.${t.tickLabel}`:r[e].value&&(i=`${e}.${r[e].value}`);var n=this.dist.sources["/"].dims;return n.hasOwnProperty(i)||(n[i]={type:n[e].type},delete n[e]),i}scalesPool(e,t,i,r){var n=`${e}_${t}`;if(this.dist.scales.hasOwnProperty(n))return n;var a=this.spec.spec.dimensions,s={};if("color"===e&&null!==t&&(s={type:"color",source:"/",dim:this.ruleInferDim(t,i)},i.hasOwnProperty("brewer")&&(s.brewer=i.brewer),a[t]&&a[t].hasOwnProperty("order")&&(s.order=a[t].order),i.hasOwnProperty("min")&&(s.min=i.min),i.hasOwnProperty("max")&&(s.max=i.max),i.hasOwnProperty("nice")&&(s.nice=i.nice)),"size"===e&&null!==t&&(s={type:"size",source:"/",dim:this.ruleInferDim(t,i)},i.hasOwnProperty("func")&&(s.func=i.func),i.hasOwnProperty("min")&&(s.min=i.min),i.hasOwnProperty("max")&&(s.max=i.max),i.hasOwnProperty("minSize")&&(s.minSize=i.minSize),i.hasOwnProperty("maxSize")&&(s.maxSize=i.maxSize)),"label"===e&&null!==t&&(s={type:"value",source:"/",dim:this.ruleInferDim(t,i)}),"split"===e&&null!==t&&(s={type:"value",source:"/",dim:this.ruleInferDim(t,i)}),"identity"===e&&null!==t&&(s={type:"identity",source:"/",dim:this.ruleInferDim(t,i)}),a.hasOwnProperty(t)&&("x"===e||"y"===e)){if(s={type:a[t].scale,source:"/",dim:this.ruleInferDim(t,i)},a[t].hasOwnProperty("order")&&(s.order=a[t].order),i.hasOwnProperty("min")&&(s.min=i.min),i.hasOwnProperty("max")&&(s.max=i.max),i.hasOwnProperty("autoScale")?s.autoScale=i.autoScale:s.autoScale=!0,i.hasOwnProperty("nice")?s.nice=i.nice:s.nice=s.autoScale,i.hasOwnProperty("niceInterval")?s.niceInterval=i.niceInterval:s.niceInterval=null,i.hasOwnProperty("tickPeriod")&&(s.period=i.tickPeriod,s.type="period"),i.hasOwnProperty("tickPeriod")&&i.hasOwnProperty("timeInterval"))throw new Error('Use "tickPeriod" for period scale, "timeInterval" for time scale, but not both');if(i.hasOwnProperty("timeInterval")){s.period=i.timeInterval,s.type="time";let e=b.get(s.period,{utc:r.utcTime});i.hasOwnProperty("min")&&(s.min=e.cast(new Date(i.min))),i.hasOwnProperty("max")&&(s.max=e.cast(new Date(i.max)))}s.fitToFrameByDims=i.fitToFrameByDims,s.ratio=i.ratio}return this.dist.scales[n]=s,n}getScaleConfig(e,t){var i=`${e}_${t}`;return this.dist.scales[i]}ruleInferExpression(e){var t={operator:"none",params:[]},i=e.guide||{},r=i.x||{},n=i.y||{},a=this.getScaleConfig("x",e.x),s=this.getScaleConfig("y",e.y);return 0===e.type.indexOf("ELEMENT.")?e.color&&(t={operator:"groupBy",params:[this.ruleInferDim(e.color,i.color||{})]}):"COORDS.RECT"===e.type&&1===e.unit.length&&"COORDS.RECT"===e.unit[0].type&&(t=a.period||s.period?{operator:"cross_period",params:[this.ruleInferDim(e.x,r),this.ruleInferDim(e.y,n),a.period,s.period]}:{operator:"cross",params:[this.ruleInferDim(e.x,r),this.ruleInferDim(e.y,n)]}),Object.assign({inherit:!0,source:"/"},t)}}const oi={...i(6),...i(7)},li=oi.format(".4s"),ci=oi.format(".2r"),di=oi.format(".1e"),ui=(()=>{const e=/\.0+([^\d].*)?$/,t=/(\.\d+?)0+([^\d].*)?$/;return i=>i.replace(e,"$1").replace(t,"$1$2")})();var hi={_identity:(e,t)=>String(null==e?t:e),"x-num-auto":function(e){if(isNaN(e))return"NaN";var t=Math.abs(e);return ui(t<1?0===t?"0":t<1e-6?di(e):ci(e):li(e))},percent:function(e){return parseFloat((100*e).toFixed(2)).toString()+"%"},day:oi.timeFormat("%d-%b-%Y"),"day-utc":oi.utcFormat("%d-%b-%Y"),"day-short":oi.timeFormat("%d-%b"),"day-short-utc":oi.utcFormat("%d-%b"),week:oi.timeFormat("%d-%b-%Y"),"week-utc":oi.utcFormat("%d-%b-%Y"),"week-short":oi.timeFormat("%d-%b"),"week-short-utc":oi.utcFormat("%d-%b"),month:e=>{var t=0===new Date(e).getMonth()?"%B, %Y":"%B";return oi.timeFormat(t)(e)},"month-utc":e=>{var t=0===new Date(e).getUTCMonth()?"%B, %Y":"%B";return oi.utcFormat(t)(e)},"month-short":e=>{var t=0===new Date(e).getMonth()?"%b '%y":"%b";return oi.timeFormat(t)(e)},"month-short-utc":e=>{var t=0===new Date(e).getUTCMonth()?"%b '%y":"%b";return oi.utcFormat(t)(e)},"month-year":oi.timeFormat("%B, %Y"),"month-year-utc":oi.utcFormat("%B, %Y"),quarter:e=>{var t=new Date(e),i=t.getMonth();return"Q"+((i-i%3)/3+1)+" "+t.getFullYear()},"quarter-utc":e=>{var t=new Date(e),i=t.getUTCMonth();return"Q"+((i-i%3)/3+1)+" "+t.getUTCFullYear()},year:oi.timeFormat("%Y"),"year-utc":oi.utcFormat("%Y"),"x-time-auto":null},fi={get:(e,t)=>{var i=hi._identity,r=hi.hasOwnProperty(e),n=r?hi[e]:i;return r&&(n=hi[e]),!r&&e&&(n=(t=>{return($e(t)?oi.timeFormat(e):oi.format(e))(t)})),r||e||(n=i),null!==n?e=>n(e,t||""):null},add:(e,t)=>{hi[e]=t}},pi=e=>e.reduce((e,t)=>e+t,0);var gi=(e,t)=>{var i=t.guide||{},r={x:["label"],y:["label"],size:["label"],color:["label"],padding:[]};return Object.keys(r).forEach(t=>{let n=r[t];!function(e,t,i,r){var n=e.hasOwnProperty(i)?e[i]:{};n=n||{},r.forEach(e=>{Object.assign(t.guide[i][e],n[e])})}(i,e,t,n)}),Object.assign(e.guide,Object.keys(i).reduce((e,t)=>(r.hasOwnProperty(t)||(e[t]=i[t]),e),{})),e},mi=function(e,t,i){return e[t]=st(e[t]||{},{label:""}),e[t].label=ze(e[t].label)?e[t].label:{text:e[t].label},e[t].label=st(e[t].label,i||{},{padding:32,rotate:0,textAnchor:"middle",cssClass:"label",dock:null}),e[t]},bi=function(e,t,i){return e[t]=st(e[t],i||{},{padding:0,density:30,rotate:0,tickPeriod:null,tickFormat:null,autoScale:!0}),e[t].tickFormat=e[t].tickFormat||e[t].tickPeriod,e[t].nice=e[t].hasOwnProperty("nice")?e[t].nice:e[t].autoScale,e[t]},yi=e=>{var t=e.units||[],i=!e.hasOwnProperty("units"),r=!t.some(e=>e.hasOwnProperty("units"));return{type:e.type,isLeaf:i,isLeafParent:!i&&r}},vi=function(e,t,i,r){if(0===e.length)return{width:0,height:0};if(null===t){var n=i("TauChart Library");return n.width=.625*r,n}e.every(e=>"number"==typeof e)&&(e=l.scaleLinear().domain(e).ticks());var a=e.reduce((e,i)=>{let r=t(i).toString().length;return!e.computed||r>e.computed?{value:i,computed:r}:e},{}).value;return i(t(a))},xi=(e,t)=>{var i=e.dimType,r=e.scaleType,n=[i,r,"*"].join(":"),a=[i,r].join(":");return t[n]||t[a]||t[i]||null},_i=(e,t,i)=>e.hasOwnProperty(`${t}:${i}`)?e[`${t}:${i}`]:e[`${t}`],wi=(e,t)=>{return["day","week","month"].indexOf(e)>=0&&(e+=`-short${t?"-utc":""}`),e},Ei=({width:e,height:t},i)=>{var r=Math.abs(Ke(i));return{width:Math.max(Math.cos(r)*e,t),height:Math.max(Math.sin(r)*e,t)}},Si=(e,t="x")=>{var i=Je(e),r="x"===t?[[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"]],n=r.findIndex(e=>i>=e[0]&&i{let r=Math.ceil(e.width/t);return{height:Math.min(r,i)*e.height,width:t}};function Mi(e,t,i,r,n,a){var s=i.values,o=r.values,l=i.isEmpty||e.x.hideTicks,c=r.isEmpty||e.y.hideTicks,d=vi(s,fi.get(e.x.tickFormat,e.x.tickFormatNullAlias),t.getAxisTickLabelSize,t.xAxisTickLabelLimit),u=vi(o,fi.get(e.y.tickFormat,e.y.tickFormatNullAlias),t.getAxisTickLabelSize,t.yAxisTickLabelLimit),h=d,f=u;d.width>t.xAxisTickLabelLimit&&(e.x.tickFormatWordWrap=!0,e.x.tickFormatWordWrapLines=t.xTickWordWrapLinesLimit,h=Ti(d,t.xAxisTickLabelLimit,t.xTickWordWrapLinesLimit)),u.width>t.yAxisTickLabelLimit&&(e.y.tickFormatWordWrap=!0,e.y.tickFormatWordWrapLines=t.yTickWordWrapLinesLimit,f=Ti(u,t.yAxisTickLabelLimit,t.yTickWordWrapLinesLimit)),a&&(e.y.tickFormatWordWrap=!1,e.y.tickFormatWordWrapLines=1,(f=Ti(u,2*t.yAxisTickLabelLimit,1)).width=20);var p=l?0:1,g=c?0:1,m=e.x.label,b=e.y.label,y=m.text&&!m.hide?1:0,v=b.text&&!b.hide?1:0,x=Ei(h,e.x.rotate),_=Ei(f,e.y.rotate);n?(m.padding=(-t.xAxisPadding-t.xFontLabelHeight)/2+t.xFontLabelHeight,m.paddingNoTicks=m.padding,b.padding=(-t.yAxisPadding-t.yFontLabelHeight)/2,b.paddingNoTicks=b.padding,y=0,v=0):(m.padding=pi([p*(t.xTickWidth+x.height),y*(t.distToXAxisLabel+t.xFontLabelHeight)]),m.paddingNoTicks=y*(t.distToXAxisLabel+t.xFontLabelHeight),b.padding=pi([g*(t.yTickWidth+_.width),v*t.distToYAxisLabel]),b.paddingNoTicks=v*t.distToYAxisLabel),a&&(b.padding=0,b.paddingNoTicks=0);const w=t.xFontLabelDescenderLineHeight;return e.padding=Object.assign(e.padding,{b:e.x.hide?0:pi([e.x.padding,p*(t.xTickWidth+x.height),y*(t.distToXAxisLabel+t.xFontLabelHeight+w)]),l:e.y.hide?0:pi([e.y.padding,a?0:g*(t.yTickWidth+_.width),v*(t.distToYAxisLabel+t.yFontLabelHeight)])}),e.paddingNoTicks=Object.assign({},e.paddingNoTicks,{b:e.x.hide?0:pi([e.x.padding,y*(t.distToXAxisLabel+t.xFontLabelHeight+w)]),l:e.y.hide?0:pi([e.y.padding,v*(t.distToYAxisLabel+t.yFontLabelHeight)])}),e.x=Object.assign(e.x,{density:x.width+2*_i(t,"xDensityPadding",i.dimType),tickFontHeight:d.height,$minimalDomain:s.length,$maxTickTextW:h.width,$maxTickTextH:h.height,tickFormatWordWrapLimit:t.xAxisTickLabelLimit}),e.y=Object.assign(e.y,{density:_.height+2*_i(t,"yDensityPadding",r.dimType),tickFontHeight:u.height,$minimalDomain:o.length,$maxTickTextW:f.width,$maxTickTextH:f.height,tickFormatWordWrapLimit:t.yAxisTickLabelLimit}),e}var Ci=function({unit:e,meta:t,settings:i,allowXVertical:r,allowYVertical:n,inlineLabels:a}){var s=t.dimension(e.x),o=t.dimension(e.y),l=t.scaleMeta(e.x,e.guide.x),c=t.scaleMeta(e.y,e.guide.y),d=l.isEmpty,u=c.isEmpty;e.guide.x.tickFormat=wi(e.guide.x.tickFormat||xi(s,i.defaultFormats),i.utcTime),e.guide.y.tickFormat=wi(e.guide.y.tickFormat||xi(o,i.defaultFormats),i.utcTime);var h=!!r&&!("measure"===s.dimType),f=!!n&&!("measure"===o.dimType);if(e.guide.x.padding=d?0:i.xAxisPadding,e.guide.x.paddingNoTicks=e.guide.x.padding,e.guide.y.padding=u?0:i.yAxisPadding,e.guide.y.paddingNoTicks=e.guide.y.padding,e.guide.x.rotate=h?-90:0,e.guide.x.textAnchor=Si(e.guide.x.rotate,"x"),e.guide.y.rotate=f?-90:0,e.guide.y.textAnchor=Si(e.guide.y.rotate,"y"),e.guide=Mi(e.guide,i,l,c,a,_t(e)),a){let t=e.guide.x.label,i=e.guide.y.label;t.cssClass+=" inline",t.dock="right",t.textAnchor="end",i.cssClass+=" inline",i.dock="right",i.textAnchor="end"}return e},ki={NONE:(e,t,i)=>{var r=De(e);return Ai(De(r.unit),r.unit,(e,t)=>(t.guide.x.tickFontHeight=i.getAxisTickLabelSize("X").height,t.guide.y.tickFontHeight=i.getAxisTickLabelSize("Y").height,t.guide.x.tickFormatWordWrapLimit=i.xAxisTickLabelLimit,t.guide.y.tickFormatWordWrapLimit=i.yAxisTickLabelLimit,t)),r},"BUILD-LABELS":(e,t)=>{var i=De(e),r=[],n=[],a=null,s=null;Se(i.unit,"units",yi,(e,i)=>{if(e.isLeaf)return i;!a&&i.x&&(a=i),!s&&i.y&&(s=i),i.guide=i.guide||{},i.guide.x=i.guide.x||{label:{text:""}},i.guide.y=i.guide.y||{label:{text:""}},i.guide.x.label=ze(i.guide.x.label)?i.guide.x.label:{text:i.guide.x.label&&i.guide.x.label.text?i.guide.x.label.text:""},i.guide.y.label=ze(i.guide.y.label)?i.guide.y.label:{text:i.guide.y.label&&i.guide.y.label.text?i.guide.y.label.text:""},i.x&&(i.guide.x.label.text=i.guide.x.label.text||t.dimension(i.x).dimName),i.y&&(i.guide.y.label.text=i.guide.y.label.text||t.dimension(i.y).dimName);var o=i.guide.x.label.text;o&&(r.push(o),i.guide.x.tickFormatNullAlias=i.guide.x.hasOwnProperty("tickFormatNullAlias")?i.guide.x.tickFormatNullAlias:"No "+o,i.guide.x.label.text="",i.guide.x.label._original_text=o);var l=i.guide.y.label.text;return l&&(n.push(l),i.guide.y.tickFormatNullAlias=i.guide.y.hasOwnProperty("tickFormatNullAlias")?i.guide.y.tickFormatNullAlias:"No "+l,i.guide.y.label.text="",i.guide.y.label._original_text=l),i});return a&&(a.guide.x.label.text=a.guide.x.label.hide?"":r.join(" → ")),s&&(s.guide.y.label.text=s.guide.y.label.hide?"":n.join(" → ")),i},"BUILD-GUIDE":(e,t,i)=>{var r=De(e);return Ai(De(r.unit),r.unit,(e,r)=>{if(e.isLeaf)return r;var n=!e.isLeaf&&!e.isLeafParent,a=t.scaleMeta(r.x,r.guide.x),s=t.scaleMeta(r.y,r.guide.y),o=!n&&Boolean(a.dimType)&&"measure"!==a.dimType;return r.guide.x.rotate=r.guide.x.rotate||(o?-90:0),r.guide.x.textAnchor=Si(r.guide.x.rotate),r.guide.x.tickFormat=r.guide.x.tickFormat||xi(a,i.defaultFormats),r.guide.y.tickFormat=r.guide.y.tickFormat||xi(s,i.defaultFormats),r.guide.x.padding=n?0:i.xAxisPadding,r.guide.x.paddingNoTicks=r.guide.x.padding,r.guide.y.padding=n?0:i.yAxisPadding,r.guide.y.paddingNoTicks=r.guide.y.padding,r.guide=Mi(r.guide,st({distToXAxisLabel:a.isEmpty?i.xTickWidth:i.distToXAxisLabel,distToYAxisLabel:s.isEmpty?i.yTickWidth:i.distToYAxisLabel},i),a,s,null,_t(r)),r.guide.x=Object.assign(r.guide.x,{cssClass:n?r.guide.x.cssClass+" facet-axis":r.guide.x.cssClass,avoidCollisions:!!n||r.guide.x.avoidCollisions}),r.guide.y=Object.assign(r.guide.y,{cssClass:n?r.guide.y.cssClass+" facet-axis":r.guide.y.cssClass,avoidCollisions:!n&&r.guide.y.avoidCollisions}),r.guide=Object.assign(r.guide,{showGridLines:r.guide.hasOwnProperty("showGridLines")?r.guide.showGridLines:e.isLeafParent?"xy":""}),r}),r},"BUILD-COMPACT":(e,t,i)=>{var r=De(e);return Ai(De(r.unit),r.unit,(e,r)=>e.isLeaf?r:(r.guide.hasOwnProperty("showGridLines")||(r.guide.showGridLines=e.isLeafParent?"xy":""),e.isLeafParent?Ci({unit:r,meta:t,settings:st({xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},i),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,Ci({unit:r,meta:t,settings:st({xAxisPadding:0,yAxisPadding:0,distToXAxisLabel:0,distToYAxisLabel:0,xTickWordWrapLinesLimit:1,yTickWordWrapLinesLimit:1},i),allowXVertical:!1,allowYVertical:!0,inlineLabels:!1})))),r},AUTO:(e,t,i)=>["BUILD-LABELS","BUILD-GUIDE"].reduce((e,r)=>ki[r](e,t,i),e),COMPACT:(e,t,i)=>["BUILD-LABELS","BUILD-COMPACT"].reduce((e,r)=>ki[r](e,t,i),e)},Ai=(e,t,i)=>{var r=(e=>(e.options=e.options||{},e.guide=e.guide||{},e.guide.padding=st(e.guide.padding||{},{l:0,b:0,r:0,t:0}),e.guide.x=mi(e.guide,"x"),e.guide.x=bi(e.guide,"x",{cssClass:"x axis",scaleOrient:"bottom",textAnchor:"middle"}),e.guide.y=mi(e.guide,"y",{rotate:-90}),e.guide.y=bi(e.guide,"y",{cssClass:"y axis",scaleOrient:"left",textAnchor:"end"}),e.guide.size=mi(e.guide,"size"),e.guide.color=mi(e.guide,"color"),e))(t);r=i(yi(r),r);var n=ot(r=gi(r,e),"units");return(r.units||[]).forEach(e=>Ai(De(e),((e,t)=>(e.guide=e.guide||{},e.guide.padding=e.guide.padding||{l:0,t:0,r:0,b:0},e.hasOwnProperty("units")||((e=st(e,t)).guide=st(e.guide,De(t.guide)),e.guide.x=st(e.guide.x,De(t.guide.x)),e.guide.y=st(e.guide.y,De(t.guide.y))),e))(e,n),i)),r},Pi={get:(e,t,i,r)=>{var n={dimension:e=>{var t=i.scales[e],r=i.sources[t.source].dims[t.dim]||{};return{dimName:t.dim,dimType:r.type,scaleType:t.type}},scaleMeta:e=>{var t=r("pos",e).domain(),n=i.scales[e],a=i.sources[n.source].dims[n.dim]||{};return{dimName:n.dim,dimType:a.type,scaleType:n.type,values:t,isEmpty:null==a.type}}},a=(ki[e]||ki.NONE)({unit:De(i.unit)},n,t);return i.unit=a.unit,i}};class Oi{constructor(e){this.spec=e,this.isApplicable=Ue(e.unit)}transform(e){var t=this.spec;if(!this.isApplicable)return t;var i=t.settings.size,r=t.settings.specEngine.find(e=>i.width<=e.width||i.height<=e.height);return Pi.get(r.name,t.settings,t,(t,i)=>e.getScaleInfo(i||`${t}:default`))}}class Ni{static optimizeXAxisLabel(e,t){const{xAxisTickLabelLimit:i}=t,r=e=>{if(!e.guide.x.hide&&!e.guide.x.hideTicks&&0!==e.guide.x.rotate){e.guide.x.rotate=0,e.guide.x.textAnchor="middle";var t=0-Math.min(i,e.guide.x.$maxTickTextW)+e.guide.x.$maxTickTextH;n(e,t)}(e.units||[]).filter(e=>"COORDS.RECT"===e.type).forEach(e=>r(e))},n=(t,i)=>{e!==t&&"extract-axes"===t.guide.autoLayout?(e.guide.x.padding+=i,e.guide.padding.b+=i):(t.guide.x.label.padding+=t.guide.x.label.padding>0?i:0,t.guide.padding.b+=t.guide.padding.b>0?i:0)};r(e)}static hideAxisTicks(e,t,i){const r=e=>{const t="x"===i?"b":"l",n=e.guide;if(!n[i].hide&&!n[i].hideTicks){_t(e)&&"y"===i||(n[i].hideTicks=!0);var a=n[i].label.text&&!n[i].label.hide;n.padding[t]=n.paddingNoTicks?n.paddingNoTicks[t]:0,n[i].padding=n[i].paddingNoTicks||0,n[i].label.padding=a?n[i].label.paddingNoTicks:0}(e.units||[]).filter(e=>"COORDS.RECT"===e.type).forEach(e=>r(e))};r(e)}static facetsLabelsAtTop(e,t){const i=e=>{const t=e.units||[];if(_t(e)){const i=e.guide;i.y.facetAxis=!0,i.y.rotate=0,i.y.textAnchor="start",t.forEach(e=>{e.guide.padding.t=20})}t.filter(e=>"COORDS.RECT"===e.type).forEach(e=>i(e))};i(e)}}var Li=e=>e.$maxTickTextW,Ri=e=>0==e.rotate?e.$maxTickTextW:e.$maxTickTextH,Fi=e=>e.density,Di=e=>{var t=[],i=[],r=e=>{if("COORDS.RECT"===e.type&&e.units&&e.units[0]&&"COORDS.RECT"===e.units[0].type){var n=e.x.replace(/^x_/,""),a=e.y.replace(/^y_/,"");"null"!==n&&t.push(n),"null"!==a&&i.push(a),e.units.forEach(r)}};r(e.unit);var n={},a={},s=e=>{"COORDS.RECT"===e.type&&e.frames.forEach(e=>{e.key&&(Object.keys(e.key).forEach(r=>{t.indexOf(r)>=0&&(n.hasOwnProperty(r)||(n[r]=[]),n[r].indexOf(e.key[r])<0&&n[r].push(e.key[r])),i.indexOf(r)>=0&&(a.hasOwnProperty(r)||(a[r]=[]),a[r].indexOf(e.key[r])<0&&a[r].push(e.key[r]))}),e.units&&e.units.forEach(s))})};return s(e.unit),{xFacetCount:Object.keys(n).reduce((e,t)=>e*n[t].length,1),yFacetCount:Object.keys(a).reduce((e,t)=>e*a[t].length,1)}},$i={"entire-view"(e,t,i,r){var n=i.unit.guide,{xFacetCount:a,yFacetCount:s}=Di(i);s>0&&Ni.facetsLabelsAtTop(i.unit,i.settings);var o=n.paddingNoTicks?n.padding.l-n.paddingNoTicks.l:0,l=n.paddingNoTicks?n.padding.b-n.paddingNoTicks.b:0,c=n.paddingNoTicks&&e.height-le.height||a*i.settings.minFacetWidth+o>e.width,d=n.paddingNoTicks&&e.width-oe.height||a*i.settings.minFacetWidth+o>e.width;c&&Ni.hideAxisTicks(i.unit,i.settings,"x"),d&&Ni.hideAxisTicks(i.unit,i.settings,"y");var u=e.width;if(t("x",i.unit,Li)<=e.width)r(i.unit,i.settings);else{var h=t("x",i.unit,Ri);if(h>e.width){var f=Math.max(e.width,t("x",i.unit,Fi));u=Math.min(h,f)}}var p=Math.max(e.height,t("y",i.unit,Fi));return!c&&u>e.width&&Ni.hideAxisTicks(i.unit,i.settings,"x"),!d&&p>e.height&&Ni.hideAxisTicks(i.unit,i.settings,"y"),{newW:e.width,newH:e.height}},minimal:(e,t,i)=>({newW:t("x",i.unit,Fi),newH:t("y",i.unit,Fi)}),normal(e,t,i,r){const{yFacetCount:n}=Di(i);n>0&&Ni.facetsLabelsAtTop(i.unit,i.settings);var a=i.unit.guide;a.paddingNoTicks&&(e.width-a.padding.l+a.paddingNoTicks.le.width){var l=Math.max(e.width,t("x",i.unit,Fi));s=Math.min(o,l)}}return{newW:s,newH:Math.max(e.height,t("y",i.unit,Fi))}},"fit-width"(e,t,i,r){var n=i.unit.guide,a=n.paddingNoTicks?n.padding.l-n.paddingNoTicks.l:0;return(n.paddingNoTicks&&e.width-ae.width)&&Ni.hideAxisTicks(i.unit,i.settings,"y"),t("x",i.unit,Li)<=e.width&&r(i.unit,i.settings),{newW:e.width,newH:t("y",i.unit,Fi)}},"fit-height"(e,t,i){var r=i.unit.guide,n=r.paddingNoTicks?r.padding.b-r.paddingNoTicks.b:0;return(r.paddingNoTicks&&e.height-ne.height)&&Ni.hideAxisTicks(i.unit,i.settings,"x"),{newW:t("x",i.unit,Fi),newH:e.height}}};class zi{constructor(e){this.spec=e,this.isApplicable=Ue(e.unit)}transform(e){var t=this.spec;if(!this.isApplicable)return t;var i=t.settings.fitModel;if(!i)return t;var r=t.scales,n=(e,t)=>{return e.discrete?t*e.domain().length:4*t},a=(t,i,s,o=null)=>{var l="x"===t?i.x:i.y,c="x"===t?i.y:i.x,d=i.guide,u=s("x"===t?d.x:d.y);const h=i.units[0];var f="x"===t?d.padding.l+d.padding.r:d.padding.b+d.padding.t;if("ELEMENT.INTERVAL"===h.type&&"y"===t===Boolean(h.flip)&&h.label&&!e.getScaleInfo(h.label,o).isEmpty()){const t=2*(d.label&&d.label.fontSize?d.label.fontSize:10),r=e.getScaleInfo(l,o);let a;if(r.discrete&&(null==h.guide.enableColorToBarPosition?!h.stack:h.guide.enableColorToBarPosition)){const t=h.color;if(t){const i=e.getScaleInfo(t,o);if(i.discrete){i.domain();a=i}}}const s=e=>{const i=e.part(),n=it(i.map(e=>e[r.dim])).length;let s=1;if(a){const e=i.reduce((e,t)=>{const i=t[r.dim],n=t[a.dim];return e[i]=e[i]||{},e[i][n]||(e[i][n]=!0),e},{}),t=Object.keys(e).map(t=>Object.keys(e[t]).length);s=Math.max(...t)}return n*s*t},c=i.frames.reduce((e,t)=>e+s(t),0),p=n(r,u);return f+Math.max(c,p)}if("COORDS.RECT"!==h.type){var p=e.getScaleInfo(l,o);return f+n(p,u)}var g=((e,t)=>e.reduce((e,i)=>{var r=(i.key||{})[t];return e[r]=e[r]||[],e[r].push(i),e},{}))(i.frames,r[c].dim),m=Object.keys(g).map(e=>g[e].map(e=>a(t,e.units[0],s,e)).reduce((e,t)=>e+t,0));return f+Math.max(...m)},s=t.settings.size,o=s.width,l=s.height,c=$i[i];if(c){let e=c(s,a,t,Ni.optimizeXAxisLabel);o=e.newW,l=e.newH}return t.settings.size=((i,r,n)=>{var a=t.settings.getScrollbarSize(e.getLayout().contentContainer),s=r.width>i.width&&r.width<=i.width*n?i.width:r.width,o=r.height>i.height&&r.height<=i.height*n?i.height:r.height,l=i.width-s,c=i.height-o>=0?0:a.width;return{height:o-(l>=0?0:a.height),width:s-c}})(s,{width:o,height:l},t.settings.avoidScrollAtRatio),t}}class Bi{constructor(e){this.spec=e,this.isApplicable=e.settings.autoRatio&&Ue(e.unit)}transform(e){var t=this.spec;if(!this.isApplicable)return t;try{this.ruleApplyRatio(t,e)}catch(e){if("Not applicable"!==e.message)throw e}return t}ruleApplyRatio(e,t){var i=e=>"COORDS.RECT"===e.type||"RECT"===e.type,r=(e,t,i,n=0)=>{t(e,n)&&(e.units||[]).map(e=>r(e,t,i,n+1)),i(e,n)},n=[],a=[];r(e.unit,(e,t)=>{if(t>1||!i(e))throw new Error("Not applicable");return n.push(e.x),a.push(e.y),1===(e.units||[]).map(e=>{if(!i(e)&&!(e=>0===e.type.indexOf("ELEMENT."))(e))throw new Error("Not applicable");return e}).filter(i).length},()=>0);var s=t=>e.scales[t],o=e=>"/"===e.source&&!e.ratio&&!e.fitToFrameByDims,l=e=>"ordinal"===e.type||"period"===e.type&&!e.period,c=n.map(s).filter(o),d=a.map(s).filter(o);if([c.length,d.length].some(e=>2===e)){let e=e=>e.dim,i=(t,i,r)=>{t.fitToFrameByDims=r.slice(0,i).map(e)},r=(r,n)=>{2===n.filter(l).length&&(n.forEach(i),n[0].ratio=We(r,n.map(e),t))};r("x",c),r("y",d)}}}class Ii{constructor(e){this.spec=e,this.isApplicable="EXTRACT"===e.settings.layoutEngine&&Ue(e.unit)}transform(){var e=this.spec;if(!this.isApplicable)return e;try{this.ruleExtractAxes(e)}catch(e){if("Not applicable"!==e.message)throw e;console.log("[TauCharts]: can't extract axes for the given chart specification")}return e}ruleExtractAxes(e){var t=e=>"COORDS.RECT"===e.type||"RECT"===e.type,i=e=>e?10:0,r={l:0,r:10,t:10,b:0},n={l:0,b:0},a=[],s=[];Te(e.unit,(e,i)=>{if(i>1||!t(e))throw new Error("Not applicable");e.guide=e.guide||{};var o=e.guide,l=o.padding||{l:0,r:0,t:0,b:0},c=o.paddingNoTicks||{l:0,b:0};return r.l+=l.l,r.r+=l.r,r.t+=l.t,r.b+=l.b,n.l+=c.l,n.b+=c.b,a.push(Object.assign({},r)),s.push(Object.assign({},n)),1===(e.units||[]).map(e=>{if(!t(e)&&!(e=>0===e.type.indexOf("ELEMENT."))(e))throw new Error("Not applicable");return e}).filter(t).length},e=>{var t=a.pop(),o=s.pop(),l=e.guide||{};l.x=l.x||{},l.x.padding=l.x.padding||0,l.x.paddingNoTicks=l.x.paddingNoTicks||0,l.y=l.y||{},l.y.padding=l.y.padding||0,l.y.paddingNoTicks=l.y.paddingNoTicks||0,l.padding={l:i(e.y),r:i(1),t:i(1),b:i(e.x)},l.paddingNoTicks={l:0,b:0},l.autoLayout="extract-axes",l.x.padding+=r.b-t.b,l.y.padding+=r.l-t.l,l.x.paddingNoTicks+=n.b-o.b,l.y.paddingNoTicks+=n.l-o.l}),e.unit.guide.padding=r,e.unit.guide.paddingNoTicks=n}}class ji{constructor({src:e=null,timeout:t=Number.MAX_SAFE_INTEGER,syncInterval:i=Number.MAX_SAFE_INTEGER,callbacks:r={}}={}){this.setTimeoutDuration(t),this.setSyncInterval(i),this.setCallbacks(r),this._running=!1,this._queue=[],this._result=e,this._syncDuration=0,this._asyncDuration=0,this._requestedFrameId=null,this._visibilityChangeHandler=(()=>{if(!this._running||!this._requestedFrameId)return;const e=this._getCancelFrameFunction(),t=this._getRequestFrameFunction();e(this._requestedFrameId),this._requestedFrameId=t(this._requestedFrameCallback)}),this._tasksCount=0,this._finishedTasksCount=0}setTimeoutDuration(e){ji.checkType(e,"number","timeout"),this._timeout=e}setSyncInterval(e){ji.checkType(e,"number","syncInterval"),this._syncInterval=e}setCallbacks(e){ji.checkType(e,"object","callbacks"),this._callbacks=Object.assign(this._callbacks||{},e)}addTask(e){return this._queue.push(e),this._tasksCount++,this}run(){if(this._running)throw new Error("Task Runner is already running");this._running=!0,ji.runnersInProgress++,document.addEventListener("visibilitychange",this._visibilityChangeHandler),this._loopTasks()}isRunning(){return this._running}_loopTasks(){for(var e,t,i,r,n=0,a=this._syncInterval/ji.runnersInProgress;this._running&&!(i=this._asyncDuration>this._timeout)&&!(r=n>a)&&(e=this._queue.shift());){if(null===(t=this._runTask(e)))return;this._syncDuration+=t,this._asyncDuration+=t,n+=t}i&&this._queue.length>0&&(this.stop(),this._callbacks.timeout&&this._callbacks.timeout.call(null,this._asyncDuration,this)),!i&&r&&this._queue.length>0&&this._requestFrame(),0===this._queue.length&&(this.stop(),this._callbacks.done&&this._callbacks.done.call(null,this._result,this))}_runTask(e){var t=performance.now();if(this._callbacks.error)try{this._result=e.call(null,this._result,this)}catch(e){return this.stop(),this._callbacks.error.call(null,e,this),null}else this._result=e.call(null,this._result,this);var i=performance.now()-t;return this._finishedTasksCount++,this._callbacks.progress&&this._callbacks.progress.call(null,this._finishedTasksCount/this._tasksCount,this),i}_requestFrame(){const e=performance.now(),t=()=>{this._requestedFrameId=null;const t=performance.now();this._asyncDuration+=t-e,this._loopTasks()},i=this._getRequestFrameFunction();this._requestedFrameCallback=t,this._requestedFrameId=i(t)}_getRequestFrameFunction(){return document.hidden?e=>(this._requestedFrameType="idle",window.requestIdleCallback(e,{timeout:17})):e=>(this._requestedFrameType="animation",requestAnimationFrame(e))}_getCancelFrameFunction(){switch(this._requestedFrameType){case"animation":return e=>cancelAnimationFrame(e);case"idle":return e=>window.cancelIdleCallback(e)}}stop(){if(!this._running)throw new Error("Task Runner is already stopped");if(this._running=!1,ji.runnersInProgress--,document.removeEventListener("visibilitychange",this._visibilityChangeHandler),this._requestedFrameId){this._getCancelFrameFunction()(this._requestedFrameId),this._requestedFrameId=null}}static checkType(e,t,i){if(typeof e!==t)throw new Error(`Task Runner "${i}" property is not "${t}"`)}}ji.runnersInProgress=0;var Vi=ji;const Hi={...s};var Wi=Lt,Ui=Rt;class Xi extends h{on(e,t,i){return super.on(e,t,i)}constructor(e){super(),this._nodes=[],this._svg=null,this._filtersStore={filters:{},tick:0},this._layout=ai(),this.transformers=[Bi,Oi],this.onUnitsStructureExpandedTransformers=[Ii,zi],this._chartDataModel=(e=>e),this._reportProgress=null,this._taskRunner=null,this._renderingPhase=null,this.applyConfig(e)}updateConfig(e){this.applyConfig(e),this.refresh()}applyConfig(e){this._filtersStore.filters={},e=this.setupConfigSettings(e),this.configGPL=this.createGPLConfig(e),this._originData=Object.assign({},this.configGPL.sources),this._liveSpec=this.configGPL,this._emptyContainer=e.emptyContainer||"",this.setupPlugins(e)}createGPLConfig(e){let t;return this.isGPLConfig(e)?t=e:(e=this.setupConfig(e),t=new si(e).convert()),t=Xi.setupPeriodData(t)}isGPLConfig(e){return 2===["sources","scales"].filter(t=>e.hasOwnProperty(t)).length}setupPlugins(e){const t=e.plugins||[];this._plugins&&this._plugins.destroy(),this._plugins=new Yt(t,this)}setupConfigSettings(e){return this._dataRefs=this._dataRefs||(()=>{let e=0;return{references:new WeakMap,refCounter:()=>++e}})(),e.settings=Xi.setupSettings(st(e.settings||{},this._dataRefs)),e}destroy(){this.destroyNodes(),Hi.select(this._svg).remove(),Hi.select(this._layout.layout).remove(),this._cancelRendering(),super.destroy()}setupChartSourceModel(e){this._chartDataModel=e}setupConfig(e){if(!e.spec||!e.spec.unit)throw new Error("Provide spec for plot");var t=st(e,{spec:{},data:[],plugins:[],settings:{}});t.spec.dimensions=Xi.setupMetaInfo(t.spec.dimensions,t.data);var i=t.settings.log;return t.settings.excludeNull&&this.addFilter({tag:"default",src:"/",predicate:ri.excludeNullValues(t.spec.dimensions,e=>i([e,"point was excluded, because it has undefined values."],"WARN"))}),t}static setupPeriodData(e){var t=Xi.__api__.tickPeriod,i=e.settings.log;return Object.keys(e.scales).map(t=>e.scales[t]).filter(e=>"period"===e.type).forEach(r=>{t.get(r.period,{utc:e.settings.utcTime})||(i([`Unknown period "${r.period}".`,"Docs: https://api.taucharts.com/plugins/customticks.html#how-to-add-custom-tick-period"],"WARN"),r.period=null)}),e}static setupMetaInfo(e,t){var i=e||ri.autoDetectDimTypes(t);return ri.autoAssignScales(i)}static setupSettings(e){var t=Xi.globalSettings,i=st(e||{},Object.keys(t).reduce((e,i)=>(e[i]="function"==typeof t[i]?t[i]:De(t[i]),e),{}));return Array.isArray(i.specEngine)||(i.specEngine=[{width:Number.MAX_VALUE,name:i.specEngine}]),i}insertToLeftSidebar(e){return St(e,this._layout.leftSidebar)}insertToRightSidebar(e){return St(e,this._layout.rightSidebar)}insertToFooter(e){return St(e,this._layout.footer)}insertToHeader(e){return St(e,this._layout.header)}addBalloon(e){return new qt("",e||{})}destroyNodes(){this._nodes.forEach(e=>e.destroy()),this._nodes=[],this._renderedItems=[]}onUnitDraw(e){this._nodes.push(e),this.fire("unitdraw",e),["click","mouseover","mouseout"].forEach(t=>e.on(t,(e,i)=>{this.fire(`element${t}`,{element:e,data:i.data,event:i.event})}))}onUnitsStructureExpanded(e){this.onUnitsStructureExpandedTransformers.forEach(t=>new t(e).transform(this)),this.fire("unitsstructureexpanded",e)}_getClosestElementPerUnit(e,t){return this._renderedItems.filter(e=>e.getClosestElement).map(i=>{var r=i.getClosestElement(e,t);return{unit:i.node(),closest:r}})}disablePointerEvents(){this._layout.layout.style.pointerEvents="none"}enablePointerEvents(){this._layout.layout.style.pointerEvents=""}_handlePointerEvent(e){const t=this._svg.getBoundingClientRect(),i=e.clientX-t.left,r=e.clientY-t.top,n="click"===e.type?"data-click":"data-hover";var a=null,s=null,o=null;const l=this._getClosestElementPerUnit(i,r),c=l.filter(e=>e.closest).sort((e,t)=>e.closest.distance===t.closest.distance?e.closest.secondaryDistance-t.closest.secondaryDistance:e.closest.distance-t.closest.distance);if(c.length>0){const e=c.findIndex(e=>e.closest.distance!==c[0].closest.distance||e.closest.secondaryDistance!==c[0].closest.secondaryDistance),t=e<0?c:c.slice(0,e);if(1===t.length)a=t[0].closest.data,s=t[0].closest.node,o=t[0].unit;else{const e=t.reduce((e,t)=>e+t.closest.x,0)/t.length,n=t.reduce((e,t)=>e+t.closest.y,0)/t.length,l=Math.atan2(n-r,e-i)+Math.PI,c=Math.round((t.length-1)*l/2/Math.PI),{closest:d}=t[c];a=d.data,s=d.node,o=t[c].unit}}l.forEach(t=>t.unit.fire(n,{event:e,data:a,node:s,unit:o}))}_initPointerEvents(){this._liveSpec.settings.syncPointerEvents||(this._pointerAnimationFrameId=null);const e=Hi.select(this._svg),t=this._liveSpec.settings.syncPointerEvents?e=>()=>e(s.event):e=>()=>{var t=s.event;this._pointerAnimationFrameId&&"mousemove"!==t.type&&this._cancelPointerAnimationFrame(),this._pointerAnimationFrameId||(this._pointerAnimationFrameId=requestAnimationFrame(()=>{this._pointerAnimationFrameId=null,e(t)}))},i=e=>this._handlePointerEvent(e);e.on("mousemove",t(i)),e.on("click",t(i)),e.on("mouseleave",t(e=>{"none"!==window.getComputedStyle(this._svg).pointerEvents&&this.select(()=>!0).forEach(t=>t.fire("data-hover",{event:e,data:null,node:null,unit:null}))}))}_cancelPointerAnimationFrame(){cancelAnimationFrame(this._pointerAnimationFrameId),this._pointerAnimationFrameId=null}_setupTaskRunner(e){return this._resetTaskRunner(),this._taskRunner=new Vi({timeout:e.settings.renderingTimeout||Number.MAX_SAFE_INTEGER,syncInterval:e.settings.asyncRendering?e.settings.syncRenderingInterval:Number.MAX_SAFE_INTEGER,callbacks:{done:()=>{this._completeRendering(),this._renderingPhase=null},timeout:(e,t)=>{this._displayTimeoutWarning({timeout:e,proceed:()=>{this.disablePointerEvents(),t.setTimeoutDuration(Number.MAX_SAFE_INTEGER),t.run()},cancel:()=>{this._cancelRendering()}}),this.enablePointerEvents(),this.fire("renderingtimeout",e)},progress:e=>{var t={spec:0,draw:1}[this._renderingPhase]/2+e/2;this._reportProgress(t)},error:e.settings.handleRenderingErrors?t=>{this._cancelRendering(),this._displayRenderingError(t),this.fire("renderingerror",t),e.settings.log(["An error occured during chart rendering.",'Set "handleRenderingErrors: false" in chart settings to debug.',`Error message: ${t.message}`].join(" "),"ERROR")}:null}}),this._taskRunner}_resetTaskRunner(){this._taskRunner&&this._taskRunner.isRunning()&&(this._taskRunner.stop(),this._taskRunner=null)}renderTo(e,t){this._resetProgressLayout(),this.disablePointerEvents(),this._insertLayout(e,t);const i=this._createLiveSpec();if(!i)return this._svg=null,this._layout.content.innerHTML=this._emptyContainer,void this.enablePointerEvents();var r=this._createGPL(i),n=this._setupTaskRunner(i);this._scheduleDrawScenario(n,r),this._scheduleDrawing(n,r),n.run()}_insertLayout(e,t){this._target=e,this._defaultSize=Object.assign({},t);var i=Hi.select(e).node();if(null===i)throw new Error("Target element not found");this._layout.layout.parentNode!==i&&i.appendChild(this._layout.layout);var r=this._layout.content,n=Tt(this._layout.contentContainer);this._layout.contentContainer.style.padding=`0 ${n.width}px ${n.height}px 0`,Mt(this._layout.rightSidebarContainer,"vertical");var a=Object.assign({},t)||{};if(!a.width||!a.height){let{scrollLeft:e,scrollTop:t}=r.parentElement;r.style.display="none",a=st(a,At(r.parentNode)),r.style.display="",r.parentElement.scrollLeft=e,r.parentElement.scrollTop=t,a.height||(a.height=At(this._layout.layout).height)}this.configGPL.settings.size=a}_createLiveSpec(){return this._liveSpec=De(ot(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((e,t)=>new t(e).transform(this),this._liveSpec),this.destroyNodes(),this.fire("specready",this._liveSpec),this._liveSpec)}_experimentalSetupAnimationSpeed(e){e.settings.initialAnimationSpeed=e.settings.initialAnimationSpeed||e.settings.animationSpeed;const t=e.settings.experimentalShouldAnimate(e)?e.settings.initialAnimationSpeed:0;e.settings.animationSpeed=t;const i=e=>{e.guide=e.guide||{},e.guide.animationSpeed=t,e.units&&e.units.forEach(i)};i(e.unit)}_createGPL(e){var t=new Ut(e,this.getScaleFactory(),Qt,_),i=t.unfoldStructure();return this.onUnitsStructureExpanded(i),t}_scheduleDrawScenario(e,t){const i=Hi.select(this._layout.content),r=t.config.settings.size;e.addTask(()=>this._renderingPhase="spec"),t.getDrawScenarioQueue({allocateRect:()=>({slot:e=>i.selectAll(`.uid_${e}`),frameId:"root",left:0,top:0,width:r.width,containerWidth:r.width,height:r.height,containerHeight:r.height})}).forEach(t=>e.addTask(t))}_scheduleDrawing(e,t){const i=t.config.settings.size;e.addTask(e=>{this._renderingPhase="draw",this._renderRoot({scenario:e,newSize:i}),this._cancelPointerAnimationFrame(),this._scheduleRenderScenario(e)})}_resetProgressLayout(){this._createProgressBar(),this._clearRenderingError(),this._clearTimeoutWarning()}_renderRoot({scenario:e,newSize:t}){const i=Hi.select(this._layout.content);var r=e[0].config.uid,n=Wi(i,"svg").attr("width",Math.floor(t.width)).attr("height",Math.floor(t.height));n.attr("class")||n.attr("class",`${O}svg`),this._svg=n.node(),this._initPointerEvents(),this.fire("beforerender",this._svg);var a=n.selectAll("g.frame-root").data([r],e=>e);a.enter().append("g").classed(`${O}cell cell frame-root uid_${r}`,!0).merge(a).call(e=>{e.classed("tau-active",!0),he(e,this.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1)}),a.exit().call(e=>{e.classed("tau-active",!1),he(e,this.configGPL.settings.animationSpeed,"frameRootToggle").attr("opacity",1e-6).remove()})}_scheduleRenderScenario(e){e.forEach(e=>{this._taskRunner.addTask(()=>{e.draw(),this.onUnitDraw(e.node()),this._renderedItems.push(e)})})}_completeRendering(){Mt(this._layout.contentContainer),this._layout.rightSidebar.style.maxHeight=`${this._liveSpec.settings.size.height}px`,this.enablePointerEvents(),this._svg&&this.fire("render",this._svg),Mt(this._layout.rightSidebarContainer,"vertical")}_cancelRendering(){this.enablePointerEvents(),this._resetTaskRunner(),this._cancelPointerAnimationFrame()}_createProgressBar(){var e=Hi.select(this._layout.header),t=Wi(e,`div.${O}progress`);t.select(`div.${O}progress__value`).remove();var i=t.append("div").classed(`${O}progress__value`,!0).style("width",0);this._reportProgress=function(e){requestAnimationFrame(()=>{t.classed(`${O}progress_active`,e<1),i.style("width",`${100*e}%`)})}}_displayRenderingError(e){this._layout.layout.classList.add(`${O}layout_rendering-error`)}_clearRenderingError(){this._layout.layout.classList.remove(`${O}layout_rendering-error`)}getScaleFactory(e=null){return new ii(ti.instance(this._liveSpec.settings),e||this._liveSpec.sources,this._liveSpec.scales)}getScaleInfo(e,t=null){return this.getScaleFactory().createScaleInfoByName(e,t)}getSourceFiltersIterator(e){var t=tt(Object.keys(this._filtersStore.filters).map(e=>this._filtersStore.filters[e])).filter(t=>!e(t)).map(e=>e.predicate);return e=>t.reduce((t,i)=>t&&i(e),!0)}getDataSources(e={}){var t=this._chartDataModel(this._originData);return Object.keys(t).filter(e=>"?"!==e).reduce((i,r)=>{var n=t[r],a=this.getSourceFiltersIterator((t=>i=>e.excludeFilter&&-1!==e.excludeFilter.indexOf(i.tag)||i.src!==t)(r));return i[r]={dims:n.dims,data:n.data.filter(a)},i},{"?":t["?"]})}isEmptySources(e){return!Object.keys(e).filter(e=>"?"!==e).filter(t=>e[t].data.length>0).length}getChartModelData(e={},t="/"){return this.getDataSources(e)[t].data}getDataDims(e="/"){return this._originData[e].dims}getData(e="/"){return this._originData[e].data}setData(e,t="/"){this._originData[t].data=e,this.refresh()}getSVG(){return this._svg}addFilter(e){e.src=e.src||"/";var t=e.tag,i=this._filtersStore.filters[t]=this._filtersStore.filters[t]||[],r=this._filtersStore.tick++;return e.id=r,i.push(e),r}removeFilter(e){return Object.keys(this._filtersStore.filters).map(t=>{this._filtersStore.filters[t]=this._filtersStore.filters[t].filter(t=>t.id!==e)}),this}refresh(){this._target&&this.renderTo(this._target,this._defaultSize)}resize(e={}){this.renderTo(this._target,e)}select(e){return this._nodes.filter(e)}traverseSpec(e,t){var i=(e,t,r,n)=>{t(e,r,n),e.frames?e.frames.forEach(r=>{(r.units||[]).map(n=>i(n,t,e,r))}):(e.units||[]).map(r=>i(r,t,e,null))};i(e.unit,t,null,null)}getSpec(){return this._liveSpec}getLayout(){return this._layout}_displayTimeoutWarning({proceed:e,cancel:t,timeout:i}){var r=Math.round(100/3/1.5),n=function(e){return Math.round(100/3/1.5*e)};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(`.${O}rendering-timeout-continue-btn`).addEventListener("click",()=>{this._clearTimeoutWarning(),e.call(this)}),this._layout.content.querySelector(`.${O}rendering-timeout-cancel-btn`).addEventListener("click",()=>{this._clearTimeoutWarning(),t.call(this)})}_clearTimeoutWarning(){var e=Ui(this._layout.content,`.${O}rendering-timeout-warning`);e&&(this._layout.content.removeChild(e),this._layout.content.style.height="")}}var Gi={},qi={},Yi=e=>{let t=`Chart type ${e} is not supported.`;throw console.log(t),console.log(`Use one of ${Object.keys(Gi).join(", ")}.`),new y(t,v.NOT_SUPPORTED_TYPE_CHART)},Ki={validate:(e,t)=>(qi.hasOwnProperty(e)||Yi(e),qi[e].reduce((e,i)=>e.concat(i(t)||[]),[])),get(e){var t=Gi[e];return"function"!=typeof t&&Yi(e),t},add:(e,t,i=[])=>(Gi[e]=t,qi[e]=i,Ki),getAllRegisteredTypes:()=>Gi};class Ji extends Xi{constructor(e){super(e),e.autoResize&&Ji.winAware.push(this)}applyConfig(e){var t=Ki.validate(e.type,e);if(t.length>0)throw new Error(t[0]);var i=Ki.get(e.type);(e=st(e,{autoResize:!0})).settings=Xi.setupSettings(e.settings),e.dimensions=Xi.setupMetaInfo(e.dimensions,e.data),super.applyConfig(i(e))}destroy(){var e=Ji.winAware.indexOf(this);-1!==e&&Ji.winAware.splice(e,1),super.destroy()}}Ji.winAware=[],Ji.resizeOnWindowEvent=function(){let e;function t(){e=0;for(let e=0,t=Ji.winAware.length;e{const t=e<=20?1:.75;return Math.max(2,Math.round(e*t))};const er={...i(11),...i(8),...s};var tr=i(12);var ir=i(4),rr=function(){var e,t=[],i=[],r=1,n=1,a={},s=!1,o=function(e){var r=t.length,n=0,a=t[e].x-i[e].x,s=i[e].y-t[e].y,o=Math.sqrt(a*a+s*s);o>0&&(n+=.2*o),s/=o,n+=(a/=o)>0&&s>0?0:a<0&&s>0?3:a<0&&s<0?6:9;for(var l,c,u,h,f=t[e].x,p=t[e].y-t[e].height+2,g=t[e].x+t[e].width,m=t[e].y+2,b=0;br&&(t[c].x=d),t[c].x<0&&(t[c].x=d),t[c].y>n&&(t[c].y=u),t[c].y<0&&(t[c].y=u);var h=(s?e(c,t,i):o(c))-l;Math.random()r&&(t[c].x=d),t[c].x<0&&(t[c].x=d),t[c].y>n&&(t[c].y=u),t[c].y<0&&(t[c].y=u);var b=(s?e(c,t,i):o(c))-l;Math.random()1||c<0||c>1)},u=function(e,t,i){return e-t/i};return a.start=function(e){for(var i=t.length,r=1,n=0;n()=>e;class dr{constructor(e){this.model=e.model,this.x=e.x||cr(0),this.y=e.y||cr(0),this.dx=e.dx||cr(0),this.dy=e.dy||cr(0),this.w=e.w||cr(0),this.h=e.h||cr(0),this.hide=e.hide||cr(!1),this.label=e.label||cr(""),this.color=e.color||cr(""),this.angle=e.angle||cr(0),this.labelLinesAndSeparator=e.labelLinesAndSeparator||cr({lines:[],linesWidths:[],separator:""})}static seed(e,{fontColor:t,flip:i,formatter:r,labelRectSize:n,paddingKoeff:a=.5,lineBreakAvailable:s,lineBreakSeparator:o}){var l=i?e.yi:e.xi,c=i?e.xi:e.yi,d=t=>r(e.label(t)),u=e=>{const t=s?d(e).split(o):[d(e)];return{lines:t,linesWidths:t.map(e=>n([e]).width),separator:o}};return new dr({model:e,x:e=>l(e),y:e=>c(e),dy:e=>n(u(e).lines).height*a,w:e=>n(u(e).lines).width,h:e=>n(u(e).lines).height,label:d,labelLinesAndSeparator:u,color:()=>t,angle:()=>0})}static compose(e,t={}){return Object.keys(t).reduce((e,i)=>(e[i]=t[i],e),new dr(e))}}var ur={};class hr{static regRule(e,t){return ur[e]=t,this}static getRule(e){return ur[e]}}const fr=({lines:e,linesWidths:t,separator:i},r)=>e.map(function(e,i){const n=((e,t,i)=>i0===t?"":e.slice(0,t).replace(/\.+$/g,"")+"…")(e,n):e}).join(i);var pr=(e,t)=>{var i=5-(e.labelLinesAndSeparator(t).lines.length-1);return i<1?1:i},gr=(e,t)=>e.discrete||!e.discrete&&t[e.dim]>=0,mr=(e,t)=>!e.discrete&&t[e.dim]<0,br=(e,t)=>e.w(t)/2+Math.floor(e.model.size(t)/pr(e,t)),yr=(e,t)=>e.h(t)/2+Math.floor(e.model.size(t)/pr(e,t)),vr=e=>t=>({dx:i=>{var r=t.model.scaleY;if("+"===e[2]&&!gr(r,i))return t.dx(i);if("-"===e[2]&&!mr(r,i))return t.dx(i);var n=e[1],a=e[0]===e[0].toUpperCase()?1:0;return t.dx(i)+n*a*t.model.size(i)/2+n*br(t,i)}}),xr=e=>t=>({dy:i=>{var r=t.model.scaleY;if("+"===e[2]&&!gr(r,i))return t.dy(i);if("-"===e[2]&&!mr(r,i))return t.dy(i);var n=e[1],a=e[0]===e[0].toUpperCase()?1:0;return t.dy(i)+n*a*t.model.size(i)/2+n*yr(t,i)}});hr.regRule("l",vr(["l",-1,null])).regRule("L",vr(["L",-1,null])).regRule("l+",vr(["l",-1,"+"])).regRule("l-",vr(["l",-1,"-"])).regRule("L+",vr(["L",-1,"+"])).regRule("L-",vr(["L",-1,"-"])).regRule("r",vr(["r",1,null])).regRule("R",vr(["R",1,null])).regRule("r+",vr(["r",1,"+"])).regRule("r-",vr(["r",1,"-"])).regRule("R+",vr(["R",1,"+"])).regRule("R-",vr(["R",1,"-"])).regRule("t",xr(["t",-1,null])).regRule("T",xr(["T",-1,null])).regRule("t+",xr(["t",-1,"+"])).regRule("t-",xr(["t",-1,"-"])).regRule("T+",xr(["T",-1,"+"])).regRule("T-",xr(["T",-1,"-"])).regRule("b",xr(["b",1,null])).regRule("B",xr(["B",1,null])).regRule("b+",xr(["b",1,"+"])).regRule("b-",xr(["b",1,"-"])).regRule("B+",xr(["B",1,"+"])).regRule("B-",xr(["B",1,"-"])).regRule("rotate-on-size-overflow",(e,{data:t,lineBreakAvailable:i})=>{var r={};if(t.reduce((t,i)=>t+((t=>e.model.size(t).5){var n=i?-.5:.5;r={angle:()=>-90,w:t=>e.h(t),h:t=>e.w(t),dx:t=>e.h(t)*n-2,dy:()=>0}}return r}).regRule("hide-by-label-height-vertical",e=>({hide:t=>{let i,r;return 0===e.angle(t)?(r=e.h(t),i=Math.abs(e.model.y0(t)-e.model.yi(t))):(r=e.w(t),i=e.model.size(t)),r>i||e.hide(t)}})).regRule("cut-label-vertical",e=>({h:t=>{const i=e.h(t);if(Math.abs(e.angle(t))>0){const r=Math.abs(e.model.y0(t)-e.model.yi(t));return r{const i=e.w(t);if(0===e.angle(t)){const r=e.model.size(t);return r{let i;return i=0===e.angle(t)?e.model.size(t):Math.abs(e.model.y0(t)-e.model.yi(t)),fr(e.labelLinesAndSeparator(t),i)},dy:t=>{const i=e.dy(t);if(0!==e.angle(t)){const r=e.h(t),n=Math.abs(e.model.y0(t)-e.model.yi(t));return n({h:(t,i)=>{const r=e.h(t);if(Math.abs(e.angle(t))>0){const n=e.model.y0(t){const i=e.w(t);if(0===e.angle(t)){const r=e.model.size(t);return r{let r;return r=0===e.angle(t)?e.model.size(t):e.model.y0(t){const r=e.dy(t);if(0!==e.angle(t)){const n=e.h(t),a=e.model.y0(t){var t=t=>e.model.y0(t);return e.model.flip?{x:t}:{y:t}}).regRule("to-end",e=>{var t=t=>e.model.yi(t);return e.model.flip?{x:t}:{y:t}}).regRule("towards",e=>{var t=e.model.flip?br:yr,i=i=>((e,t)=>e.model.yi(t)-e.model.y0(t)>=0?1:-1)(e,i)*t(e,i);return e.model.flip?{dx:i}:{dy:i}}).regRule("inside-start-then-outside-end-horizontal",(e,t)=>{var i=[hr.getRule("from-beginning"),hr.getRule("towards"),hr.getRule("cut-label-horizontal")].reduce((e,i)=>dr.compose(e,i(e,t)),e),r=[hr.getRule("to-end"),hr.getRule("towards"),hr.getRule("cut-outer-label-horizontal")].reduce((e,i)=>dr.compose(e,i(e,t)),e);return Object.assign({},i,["x","dx","hide","label"].reduce((e,t)=>(e[t]=(e=>((e=>i.label(e).length>=r.label(e).length)(e)?i:r)[t](e)),e),{}))}).regRule("inside-start-then-outside-end-vertical",(e,t)=>{var i=[hr.getRule("from-beginning"),hr.getRule("towards"),hr.getRule("cut-label-vertical")].reduce((e,i)=>dr.compose(e,i(e,t)),e),r=[hr.getRule("to-end"),hr.getRule("towards"),hr.getRule("cut-outer-label-vertical")].reduce((e,i)=>dr.compose(e,i(e,t)),e);return Object.assign({},i,["y","dy","hide","label"].reduce((e,t)=>(e[t]=(e=>((e=>i.label(e).length>=r.label(e).length)(e)?i:r)[t](e)),e),{}))}).regRule("outside-then-inside-horizontal",(e,t)=>{var i=["r+","l-","cut-outer-label-horizontal"].map(hr.getRule).reduce((e,i)=>dr.compose(e,i(e,t)),e),r=["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"].map(hr.getRule).reduce((e,i)=>dr.compose(e,i(e,t)),e);return Object.assign({},i,["x","dx","hide","label"].reduce((e,t)=>(e[t]=(e=>((e=>r.label(e).length>i.label(e).length)(e)?r:i)[t](e)),e),{}))}).regRule("outside-then-inside-vertical",(e,t)=>{var i=["t+","b-","cut-outer-label-vertical"].map(hr.getRule).reduce((e,i)=>dr.compose(e,i(e,t)),e),r=["t-","b+","hide-by-label-height-vertical","cut-label-vertical"].map(hr.getRule).reduce((e,i)=>dr.compose(e,i(e,t)),e);return Object.assign({},i,["y","dy","hide","label"].reduce((e,n)=>(e[n]=(e=>((e=>{var r=i.y(e,t)+i.dy(e,t);return r<=0||r>=t.maxHeight})(e)?r:i)[n](e,t)),e),{}))}).regRule("hide-by-label-height-horizontal",e=>({hide:t=>e.model.size(t)({dx:t=>{const i=e.w(t),r=Math.abs(e.model.y0(t)-e.model.yi(t)),n=e.dx(t);return r{const i=e.w(t),r=Math.abs(e.model.y0(t)-e.model.yi(t));return r{const i=Math.abs(e.model.y0(t)-e.model.yi(t));return fr(e.labelLinesAndSeparator(t),i)}})).regRule("cut-outer-label-horizontal",(e,t)=>({dx:i=>{const r=e.w(i),n=e.model.y0(i){const r=e.w(i),n=e.model.y0(i){const r=e.model.y0(i)({dy:t=>e.model.size(t)/e.w(t)<1?e.dy(t)-e.h(t)/2-e.model.size(t)/2:e.dy(t)})).regRule("keep-in-box",(e,{maxWidth:t,maxHeight:i})=>({dx:i=>{var r=e.dx(i),n=e.x(i)+r,a=e.w(i),s=0-(n-a/2);if(s>0)return r+s;var o=n+a/2-t;return o>0?r-o:r},dy:t=>{var r=e.dy(t),n=e.y(t)+r,a=e.h(t);if(0-(n-a/2)>0)return 0;var s=n+a/2-i;return s>0?r-s:r}})).regRule("multiline-label-left-align",e=>({dy:t=>{const i=e.dy(t);return-90===e.angle(t)?i+e.h(t)/2:i}})).regRule("multiline-label-vertical-center-align",e=>({dy:t=>e.dy(t)-e.h(t)/2})).regRule("multiline-hide-on-container-overflow",(e,{maxWidth:t,maxHeight:i})=>({hide:r=>{var n=e.angle(r),a=e.x(r)+e.dx(r),s=e.y(r)+e.dy(r);return!(!Ze(a,e.w(r),n,t)&&!et(s,e.h(r),n,i))||e.hide(r)}}));class _r{constructor(e){this.minError=Number.MAX_VALUE,this.items=e.items,this.revision=this.items.map(e=>({i:e.i,x:e.x,y:e.y})),this.penalties=e.penalties,this.transactor=e.transactor,this.cooling_schedule=e.cooling_schedule||((e,t,i)=>e-t/i)}energy(e){return this.penalties.reduce((t,i)=>t+i(e),0)}move(e){const t=Math.floor(Math.random()*this.items.length),i=this.transactor(this.items[t]),r=this.energy(t);this.items[t]=i.modify();const n=this.energy(t),a=n-r,s=a<0?1:Math.exp(-a/e);Math.random()>=s?this.items[t]=i.revert():n({i:e.i,x:e.x,y:e.y})))}start(e){var t=1;const i=this.items.length;e:for(let r=0;rC(e,n,t,a,i,s,r,o);const Er={};class Sr{static reg(e,t){return Er[e]=t,this}static get(e){return Er[e]}}Sr.reg("auto:avoid-label-label-overlap",(e,t,i=1)=>t=>{var r=e[t].x,n=e[t].y-e[t].h+2,a=e[t].x+e[t].w,s=e[t].y+2;return e.reduce((e,o,l)=>{var c=Number(l!==t),d=o.x,u=o.y-o.h+2,h=o.x+o.w,f=o.y+2;return e+c*(Math.max(0,Math.min(h,a)-Math.max(d,r))*Math.max(0,Math.min(f,s)-Math.max(u,n))*i)},0)}).reg("auto:avoid-label-anchor-overlap",(e,t,i=1)=>t=>{var r=e[t],n=r.x-r.w/2,a=r.x+r.w/2,s=r.y-r.h/2+2,o=r.y+r.h/2+2;return e.reduce((e,t)=>{var r=t.x0-t.size/2,l=t.x0+t.size/2,c=t.y0-t.size/2,d=t.y0+t.size/2;return e+Math.max(0,Math.min(l,a)-Math.max(r,n))*Math.max(0,Math.min(d,o)-Math.max(c,s))*i},0)}).reg("auto:avoid-label-edges-overlap",(e,t,i=1)=>r=>{var n=e[r],a=n.x-n.w/2,s=n.x+n.w/2,o=n.y-n.h/2,l=n.y+n.h/2;return t.reduce((e,t)=>{var r=wr(a,s,t.x0,t.x1,o,l,t.y0,t.y1),n=wr(a,s,t.x0,t.x1,l,o,t.y0,t.y1);return e+(Number(r)+Number(n))*i},0)});var Tr=(e,t,i,r,n,a,s,o)=>C(e,n,t,a,i,s,r,o);class Mr{constructor(e,t,i,{width:r,height:n,container:a}){this.container=a,this.model=e,this.flip=t,this.w=r,this.h=n,this.guide=st(i||{},{fontFamily:"Helvetica Neue, Segoe UI, Open Sans, Ubuntu, sans-serif",fontWeight:"normal",fontSize:10,fontColor:"#000",hideEqualLabels:!1,lineBreak:!1,lineBreakSeparator:"",position:[],tickFormat:null,tickFormatNullAlias:""})}draw(e){var t=this,i=this.model,r=this.guide,n=r.lineBreak,a=r.lineBreakSeparator,o=dr.seed(i,{fontColor:r.fontColor,flip:t.flip,formatter:fi.get(r.tickFormat,r.tickFormatNullAlias),labelRectSize:e=>Ot(e,r),lineBreakAvailable:n,lineBreakSeparator:a,paddingKoeff:n?0:.5}),l={lineBreakAvailable:n,maxWidth:t.w,maxHeight:t.h,data:e.reduce((e,t)=>e.concat(t),[])},c=this.applyFixedPositionRules(r,l,o,n,this.flip),d=e.reduce((e,t)=>{var i=t.map(e=>({data:e,x:c.x(e)+c.dx(e),y:c.y(e)+c.dy(e),w:c.w(e),h:c.h(e,l),hide:c.hide(e),extr:null,size:c.model.size(e),angle:c.angle(e),label:c.label(e),labelLinesAndSeparator:c.labelLinesAndSeparator(e),color:c.color(e)}));return e.text=e.text.concat(i),e.edges=e.edges.concat(((e,t)=>{for(var i=e.length-1,r=[],n=0;n<=i;n++){var a=0===n?n:n-1,s=n,o=n===i?n:n+1;r.push(t(e[a],e[s],e[o]))}return r})(i,(e,t,i)=>(t.y===Math.max(t.y,e.y,i.y)?t.extr="min":t.y===Math.min(t.y,e.y,i.y)?t.extr="max":t.extr="norm",{x0:e.x,x1:t.x,y0:e.y,y1:t.y}))),e},{text:[],edges:[]});d.text=d.text.filter(e=>e.label).map((e,t)=>Object.assign(e,{i:t}));var u=n?["auto:hide-on-label-label-overlap","auto:adjust-on-multiline-label-overflow"]:this.guide.position,h=u.filter(e=>0===e.indexOf("auto:avoid"));d=d.text.length>0&&h.length>0?this.autoPosition(d,h):d;var f=u.reduce((e,t)=>Object.assign(e,{[t]:!0}),{});d.text=d.text=f["auto:adjust-on-label-overflow"]?this.adjustOnOverflow(d.text,l):d.text,d.text=d.text=f["auto:adjust-on-multiline-label-overflow"]?this.adjustOnMultilineOverflow(d.text,l):d.text,d.text=f["auto:hide-on-label-edges-overlap"]?this.hideOnLabelEdgesOverlap(d.text,d.edges):d.text,d.text=f["auto:hide-on-label-label-overlap"]?this.hideOnLabelLabelOverlap(d.text):d.text,d.text=f["auto:hide-on-label-anchor-overlap"]?this.hideOnLabelAnchorOverlap(d.text):d.text;var p=d.text,g=e=>(t,i)=>p[i][e],m=g("x"),b=g("y"),y=g("angle"),v=g("color"),x=g("label"),_=function(e){if(e.style("fill",v).style("font-size",`${t.guide.fontSize}px`).style("display",(e,t)=>p[t].hide?"none":null).attr("class","i-role-label").attr("text-anchor","middle").attr("transform",(e,t)=>`translate(${m(e,t)},${b(e,t)}) rotate(${y(e,t)})`),n){e.each(function(e,t){var i=s.select(this),r=y(e,t);i.text(null),x(e,t).split(a).forEach(function(e,t){i.append("tspan").attr("text-anchor",0!==r?"start":"middle").attr("x",0).attr("y",0).attr("dy",1.2*(t+1)+"em").text(e)})})}else e.text(x)};r.hideEqualLabels&&p.filter(e=>!e.hide).filter((e,t,i)=>te.hide=!0);var w=this.container.selectAll(".i-role-label").data(p.map(e=>e.data));return w.exit().remove(),w.call(_),w.enter().append("text").call(_),w}applyFixedPositionRules(e,t,i,r,n){var a=e.position.filter(e=>-1===e.indexOf("auto:"));return r&&(n&&a.push("multiline-label-vertical-center-align"),a.push("multiline-label-left-align","multiline-hide-on-container-overflow")),a.map(hr.getRule).reduce((e,i)=>dr.compose(e,i(e,t)),i)}autoPosition(e,t){const i=(e,t)=>{const i=4+(e.size+e.w)/2,r=2+(e.size+e.h)/2;return{x:i*Math.cos(t),y:r*Math.sin(t)}};var r=e.edges,n=e.text.map(e=>{const t={max:-Math.PI/2,min:Math.PI/2,norm:Math.random()*Math.PI*2},r=i(e,t[e.extr]);return{i:e.i,x0:e.x,y0:e.y,x:e.x+r.x,y:e.y+r.y,w:e.w,h:e.h,size:e.size,hide:e.hide,extr:e.extr}}).filter(e=>!e.hide);const a=new _r({items:n,transactor:e=>{const t=e.x,r=e.y;return{modify:()=>{const t={max:-Math.PI,min:Math.PI,norm:2*Math.PI}[e.extr],r=t/4+Math.random()*(2*t)/4,n=i(e,r);return e.x=e.x0+n.x,e.y=e.y0+n.y,e},revert:()=>(e.x=t,e.y=r,e)}},penalties:t.map(e=>Sr.get(e)).filter(e=>e).map(e=>e(n,r))}).start(5);return e.text=a.reduce((e,t)=>{var i=e[t.i];return i.x=t.x,i.y=t.y,e},e.text),e}hideOnLabelEdgesOverlap(e,t){const i=(e,t)=>{const i=this.getLabelRect(e);return t.reduce((e,t)=>{var r=Tr(i.x0,i.x1,t.x0,t.x1,i.y0,i.y1,t.y0,t.y1),n=Tr(i.x0,i.x1,t.x0,t.x1,i.y1,i.y0,t.y0,t.y1);return e+2*(Number(r)+Number(n))},0)};return e.filter(e=>!e.hide).forEach(e=>{i(e,t)>0&&(e.hide=!0)}),e}hideOnLabelLabelOverlap(e){var t={min:0,max:1,norm:2},i={"min/min":(e,t)=>t.y-e.y,"max/max":(e,t)=>e.y-t.y,"min/max":()=>-1,"min/norm":()=>-1,"max/norm":()=>-1,"norm/norm":(e,t)=>e.y-t.y},r=(e,r)=>{var n=this.getLabelRect(e),a=this.getLabelRect(r),s=Number(!e.hide&&!r.hide);if(s*Math.max(0,Math.min(a.x1,n.x1)-Math.max(n.x0,a.x0))*(s*Math.max(0,Math.min(a.y1,n.y1)-Math.max(n.y0,a.y0)))>0){let n=[e,r];n.sort((e,i)=>t[e.extr]-t[i.extr]),(i[`${n[0].extr}/${n[1].extr}`](n[0],n[1])<0?n[0]:n[1]).hide=!0}};return e.filter(e=>!e.hide).sort((e,i)=>t[e.extr]-t[i.extr]).forEach(t=>{e.forEach(e=>{t.i!==e.i&&r(t,e)})}),e}getLabelRect(e,t=0){return{x0:e.x-e.w/2-t,x1:e.x+e.w/2+t,y0:e.y-e.h/2-t,y1:e.y+e.h/2+t}}getPointRect(e,t=0){return{x0:e.x-e.size/2-t,x1:e.x+e.size/2+t,y0:e.y-e.size/2-t,y1:e.y+e.size/2+t}}hideOnLabelAnchorOverlap(e){var t=(e,t)=>{const i=this.getLabelRect(e,2),r=this.getPointRect(t,2);return Math.max(0,Math.min(r.x1,i.x1)-Math.max(r.x0,i.x0))*Math.max(0,Math.min(r.y1,i.y1)-Math.max(r.y0,i.y0))>.001};return e.filter(e=>!e.hide).forEach(i=>{const r=e.length;for(let n=0;n(e.hide||(e.x=Math.min(Math.max(e.x,e.w/2),t-e.w/2),e.y=Math.max(Math.min(e.y,i-e.h/2),e.h/2)),e))}adjustOnMultilineOverflow(e,{maxWidth:t}){return e.map(e=>(e.hide||0!==e.angle||(e.x=Math.min(Math.max(e.x,e.w/2),t-e.w/2)),e))}}const Cr={...i(13),...s},kr={init(e){const t=Object.assign({},e);t.guide=st(t.guide||{},{animationSpeed:0,avoidScalesOverflow:!0,enableColorToBarPosition:!1,maxHighlightDistance:32}),t.guide.size=t.guide.size||{},t.guide.label=st(t.guide.label||{},{position:["auto:avoid-label-label-overlap","auto:avoid-label-anchor-overlap","auto:adjust-on-label-overflow","auto:hide-on-label-label-overlap","auto:hide-on-label-anchor-overlap"]});const i=t.guide.avoidScalesOverflow,r=t.guide.enableColorToBarPosition;return t.transformRules=[e=>{const t=[e.scaleX,e.scaleY].sort((e,t)=>{var i=e.discrete?1:0;return(t.discrete?1:0)*t.domain().length-i*e.domain().length})[0];return e.scaleY===t?_.get("flip")(e):_.get("identity")(e)},t.stack&&_.get("stack"),r&&_.get("positioningByColor")].filter(e=>e),t.adjustRules=[t.stack&&_.get("adjustYScale"),(e,i)=>{const r=e.scaleSize.isEmptyScale(),n=st(t.guide.size,{defMinSize:10,defMaxSize:r?10:40,enableDistributeEvenly:!r}),a=Object.assign({},i,{defMin:n.defMinSize,defMax:n.defMaxSize,minLimit:n.minSize,maxLimit:n.maxSize});return(n.enableDistributeEvenly?_.get("adjustSigmaSizeScale"):_.get("adjustStaticSizeScale"))(e,a)},i&&((e,t)=>{const i=Object.assign({},t,{sizeDirection:"xy"});return _.get("avoidScalesOverflow")(e,i)})].filter(e=>e),t},addInteraction(){const e=this.node();e.on("highlight",(e,t)=>this.highlight(t)),e.on("data-hover",(e,t)=>this.highlight(((e,t)=>i=>i===e||t)(t.data,null)))},draw(){const e=this.node(),t=e.config,i=t.options;i.container=i.slot(t.uid);const r=e=>he(e,t.guide.animationSpeed),n=`${O}dot dot i-role-element i-role-datum`,a=e.screenModel,s={fill:e=>a.color(e),class:e=>`${n} ${a.class(e)}`},o={r:e=>Math.round(1e4*a.size(e)/2)/1e4,cx:e=>a.x(e),cy:e=>a.y(e)},l=[],c=a.toFibers();var d;this._getGroupOrder=(d=c.reduce((e,t,i)=>(e.set(t,i),e),new Map),e=>d.get(e));const u=i.container.selectAll(".frame").data(c,e=>a.group(e[0]));u.enter().append("g").attr("opacity",0).merge(u).call(function(t){t.attr("class","frame").call(function(t){var i=t.selectAll("circle").data(e=>e,a.id),n=i.enter().append("circle").call(xe(o)).merge(i).call(xe(s));r(n).call(xe(o)),r(i.exit()).attr("r",0).remove(),l.push(...n.nodes()),e.subscribe(n)}),r(t).attr("opacity",1)});this._boundsInfo=this._getBoundsInfo(l),r(u.exit()).attr("opacity",0).remove().selectAll("circle").attr("r",0),e.subscribe(new Mr(a.model,a.flip,t.guide.label,i).draw(c))},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,i=e.map(e=>{const i=Cr.select(e).data()[0];return{node:e,data:i,x:t.x(i),y:t.y(i),r:t.size(i)/2}}).filter(e=>!isNaN(e.x)&&!isNaN(e.y)),r=i.reduce((e,{x:t,y:i})=>(e.left=Math.min(t,e.left),e.right=Math.max(t,e.right),e.top=Math.min(i,e.top),e.bottom=Math.max(i,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),n=i.reduce((e,t)=>{const i=`${t.x},${t.y}`;return e[i]||(e[i]=[]),e[i].push(t),e},{});return{bounds:r,tree:Cr.quadtree().x(e=>e[0].x).y(e=>e[0].y).addAll(Object.keys(n).map(e=>n[e]))}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=k(this.node().config.options.container.node()),a=e-n.x,s=t-n.y,{maxHighlightDistance:o}=this.node().config.guide;if(ai.right+o||si.bottom+o)return null;const l=(r.find(a,s)||[]).map(e=>{const t=Math.sqrt(Math.pow(a-e.x,2)+Math.pow(s-e.y,2));if(t>o)return null;const i=te).sort((e,t)=>e.secondaryDistance-t.secondaryDistance),c=l.findIndex(e=>e.distance!==l[0].distance||e.secondaryDistance!==l[0].secondaryDistance),d=c<0?l:l.slice(0,c);if(1===d.length)return d[0];const u=d.reduce((e,t)=>e+t.x,0)/d.length,h=d.reduce((e,t)=>e+t.y,0)/d.length,f=Math.atan2(h-s,u-a)+Math.PI;return d[Math.round((d.length-1)*f/2/Math.PI)]},highlight(e){const t=this.node().config.options.container,i={"tau-chart__highlighted":t=>!0===e(t),"tau-chart__dimmed":t=>!1===e(t)};t.selectAll(".dot").call(_e(i)),t.selectAll(".i-role-label").call(_e(i)),this._sortElements(e)},_sortElements(e){const t=this.node().config.options.container,i=new Map,r=new Map;t.selectAll(".frame").each(function(t){i.set(this,t.some(e)),r.set(this,t)});const n=ct((e,t)=>i.get(e)-i.get(t),(e,t)=>this._getGroupOrder(r.get(e))-this._getGroupOrder(r.get(t)));Dt(t.node(),(e,t)=>"g"===e.tagName&&"g"===t.tagName?n(e,t):e.tagName.localeCompare(t.tagName)),A(t,".dot",e)}};var Ar=i(9);const Pr="taucharts_synthetic_record";function Or(e){return!0!==e[Pr]}function Nr(e){return t=>{const i=e.stack,r=t.scaleX.period,n="linear"===t.scaleY.scaleType,a=!e.guide.x||null==e.guide.x.fillGaps;return!a&&e.guide.x.fillGaps||a&&(i||r&&n)?_.get("fillGaps")(t,{isStack:i,xPeriod:r,utc:e.guide.utcTime}):{}}}function Lr(e){if(0===e.length)return"";if(1===e.length)return Fr(e[0]);for(var t=[],i=1;it.size)} 1`,`${i.left[0].x},${i.left[0].y}`,"Z"].join(" "):Fr(e.size>t.size?e:t)}function $r(e,t,i,r){var n=function(e,t,i,r){var n=Ir(e,r);if(0===n||n+e.size/2<=r.size/2||n+r.size/2<=e.size/2)return null;var a=n=>{var a=n?[r,i,t,e]:[e,t,i,r],s=Vr(1/12*2,...a),o=Vr(.5,...s.slice(0,4)),l=o[3],c=o[6],d=Wr(a[0],l),u=Wr(l,c),h=[d.left[0],I(.5,d.left[1],u.left[0]),u.left[1]],f=[d.right[0],I(.5,d.right[1],u.right[0]),u.right[1]],p=Hr(...h)[1],g=Hr(...f)[1],m=I(4,d.left[0],p),b=I(4,d.right[0],g);return{left:n?[b,f[0]]:[h[0],m],right:n?[m,h[0]]:[f[0],b]}},s=a(!1),o=a(!0);return{left:[...s.left,...o.left],right:[...s.right,...o.right]}}(e,t,i,r);if(!n)return Dr(e,r);var a=Br(zr(e,n.right[0]),zr(e,n.left[0])),s=Br(zr(r,n.right[1]),zr(r,n.left[1]));return[`M${n.left[0].x},${n.left[0].y}`,`C${n.left[1].x},${n.left[1].y}`,`${n.left[2].x},${n.left[2].y}`,`${n.left[3].x},${n.left[3].y}`,`A${r.size/2},${r.size/2} 0 ${Number(a>Math.PI)} 1`,`${n.right[3].x},${n.right[3].y}`,`C${n.right[2].x},${n.right[2].y}`,`${n.right[1].x},${n.right[1].y}`,`${n.right[0].x},${n.right[0].y}`,`A${e.size/2},${e.size/2} 0 ${Number(s>Math.PI)} 1`,`${n.left[0].x},${n.left[0].y}`,"Z"].join(" ")}function zr(e,t){return Math.atan2(t.y-e.y,t.x-e.x)}function Br(e,t){return tr.size(e)/2,cx:e=>t.x(e),cy:e=>t.y(e)}},getHighlightAttrs:function(e,t,i){e.config.guide;const r=e.screenModel,n="hover"===e.config.guide.showAnchors;return{r:n?e=>i(e)?Math.max(4,r.size(e)/2):0:e=>{var t=r.size(e)/2;return i(e)&&(t=Math.max(4,Math.ceil(1.25*t))),t}}}},"vertical-stick":{element:"path",getInitialAttrs:function(e,t){const i=e.config.guide,r=e.screenModel;return{"shape-rendering":"crispEdges",d:e=>{const n=t.x(e),a=t.y(e),s=t.x0(e),o=t.y0(e),l="hover"===i.showAnchors?0:r.size(e)/2;return Lr([{x:n,y:a,size:l},{x:s,y:o,size:l}])}}},getHighlightAttrs:function(e,t,i){e.config.guide;const r=e.screenModel,n="hover"===e.config.guide.showAnchors;return{d:e=>{const a=t.x(e),s=t.y(e),o=t.x0(e),l=t.y0(e),c=n?i(e)?Math.max(4,r.size(e)/2):0:i(e)?Math.max(4,Math.ceil(r.size(e)/2*1.25)):r.size(e)/2;return Lr([{x:a,y:s,size:c},{x:o,y:l,size:c}])}}}}};function Xr(e,t,i){const r=i.sort((e,t)=>e.distance===t.distance?e.secondaryDistance-t.secondaryDistance:e.distance-t.distance),n=r.findIndex(e=>e.distance!==r[0].distance||e.secondaryDistance!==r[0].secondaryDistance),a=n<0?r:r.slice(0,n);if(1===a.length)return a[0];const s=a.reduce((e,t)=>e+t.x,0)/a.length,o=a.reduce((e,t)=>e+t.y,0)/a.length,l=Math.atan2(o-t,s-e)+Math.PI;return a[Math.round((a.length-1)*l/2/Math.PI)]}const Gr=`${O}dot-line dot-line i-role-dot i-role-datum ${O}dot`,qr={init(e){const t=e;return t.guide=st(t.guide||{},{animationSpeed:0,cssClass:"",maxHighlightDistance:32,widthCssClass:"",color:{},label:{}}),t.guide.label=st(t.guide.label,{fontSize:11,hideEqualLabels:!0,position:["auto:avoid-label-label-overlap","auto:avoid-label-anchor-overlap","auto:avoid-label-edges-overlap","auto:adjust-on-label-overflow","auto:hide-on-label-label-overlap","auto:hide-on-label-edges-overlap"]}),t.guide.color=st(t.guide.color||{},{fill:null}),["never","hover","always"].indexOf(t.guide.showAnchors)<0&&(t.guide.showAnchors="hover"),t.transformRules=[],t.adjustRules=[],t},baseModel(e){var t={gog:e.model,x:e.x,y:e.y,x0:e.x0,y0:e.y0,size:e.size,group:e.group,order:e.order,color:e.color,class:e.class,groupAttributes:{},pathAttributesUpdateInit:{},pathAttributesUpdateDone:{},pathAttributesEnterInit:{},pathAttributesEnterDone:{},pathElement:null,dotAttributes:{r:e=>Math.round(1e4*t.size(e)/2)/1e4,cx:e=>t.x(e),cy:e=>t.y(e),fill:e=>t.color(e),class:e=>`${Gr} ${t.class(e)}`},dotAttributesDefault:{r:0,cy:e=>t.y0(e)}};return t},addInteraction(){const e=this.node(),t=this.node().config;e.on("highlight",(e,t)=>this.highlight(t)),e.on("highlight-data-points",(e,t)=>this.highlightDataPoints(t)),"never"!==t.guide.showAnchors&&e.on("data-hover",(e,t)=>this.highlightDataPoints(((e,t)=>i=>i===e||t)(t.data,null)))},draw(){const e=this.node(),t=e.config,i=t.guide,r=t.options;r.container=r.slot(t.uid);const n=e.screenModel,a=this.buildModel(n);this.domElementModel=a;const o=be,l=function(r){r.call(xe(a.groupAttributes));const l=r.selectAll((e=>e.split(/\s+/g).map(e=>`.${e}`).join(""))(Gr)).data(e=>e.length<=1?e:[],n.id);l.exit().call(o(i.animationSpeed,null,{r:0},e=>s.select(e).remove())),l.call(o(i.animationSpeed,null,a.dotAttributes));const c=l.enter().append("circle").call(o(i.animationSpeed,a.dotAttributesDefault,a.dotAttributes)).merge(l);e.subscribe(c);const d=r.selectAll(`${a.pathElement}:not(.i-data-anchor)`).data(e=>e.length>1?[e]:[],h);d.exit().remove(),d.call(o(i.animationSpeed,a.pathAttributesUpdateInit,a.pathAttributesUpdateDone,a.afterPathUpdate));d.enter().append(a.pathElement).call(o(i.animationSpeed,a.pathAttributesEnterInit,a.pathAttributesEnterDone,a.afterPathUpdate)).merge(d).call(e=>{t.guide.animationSpeed>0&&!document.hidden?(e.attr(a.pathTween.attr,function(e){return a.pathTween.fn.call(this,e)(0)}),he(e,t.guide.animationSpeed,"pathTransition").attrTween(a.pathTween.attr,a.pathTween.fn)):e.attr(a.pathTween.attr,function(e){return a.pathTween.fn.call(this,e)(1)})});if(e.subscribe(c),"never"!==i.showAnchors){const t=function(e,t,i){const r=t.anchorShape,n=e.config.guide,a=e.screenModel,s={...Ur[r].getInitialAttrs(e,t),opacity:"hover"===n.showAnchors?0:1,fill:e=>a.color(e),class:"i-data-anchor"},o=i.selectAll(".i-data-anchor").data(e=>e.filter(Or),a.id);return o.exit().remove(),o.call(be(n.animationSpeed,null,s)),o.enter().append(Ur[t.anchorShape].element).call(be(n.animationSpeed,{r:0},s)).merge(o)}(e,a,r);e.subscribe(t)}},c=n.toFibers(),d=c.map(e=>e.filter(Or)),u=r.container.selectAll(".frame"),h=(()=>{const e=u.empty()?[]:u.data(),t=new Map;u.each(function(e){t.set(e,Number(this.getAttribute("data-id")))});const i=e.reduce((e,t)=>(e.set(t,t.map(n.id)),e),new Map),r=new Map;var a=Math.max(0,...Array.from(t.values()));return e=>{if(r.has(e))return r.get(e);const s=e.map(e=>n.id(e)),o=(Array.from(i.entries()).find(([,e])=>s.some(t=>e.some(e=>e===t)))||[null])[0];var l;return l=o?t.get(o):++a,r.set(e,l),l}})();this._getDataSetId=h;const f=u.data(c,h);f.exit().remove(),f.call(l),f.enter().append("g").attr("data-id",h).call(l),f.order(),this._boundsInfo=this._getBoundsInfo(r.container.selectAll(".i-data-anchor").nodes()),e.subscribe(new Mr(n.model,t.flip,t.guide.label,r).draw(d))},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,{flip:i}=this.node().config,r=e.map(e=>{const i=s.select(e).data()[0];return{node:e,data:i,x:t.x(i),y:t.y(i)}}).filter(e=>!isNaN(e.x)&&!isNaN(e.y)),n=r.reduce((e,{x:t,y:i})=>(e.left=Math.min(t,e.left),e.right=Math.max(t,e.right),e.top=Math.min(i,e.top),e.bottom=Math.max(i,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=it(r.map(i?e=>e.y:e=>e.x)).sort((e,t)=>e-t),o=a.reduce((e,t)=>(e[t]=[],e),{});r.forEach(e=>{const t=a.find(i?t=>e.y===t:t=>e.x===t);o[t].push(e)});const l=e=>{if(1===e.length)return o[e[0]];const t=Math.ceil(e.length/2);return{middle:(e[t-1]+e[t])/2,lower:l(e.slice(0,t)),greater:l(e.slice(t))}};return{bounds:n,tree:l(a)}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=this.node().config.options.container,{flip:a}=this.node().config,s=k(n.node()),{maxHighlightDistance:o}=this.node().config.guide;if(ei.right+s.x+o||ti.bottom+s.y+o)return null;const l=a?t-s.y:e-s.x,c=function e(t){return Array.isArray(t)?t:e(l>t.middle?t.greater:t.lower)}(r).map(i=>{const r=i.x+s.x,n=i.y+s.y,o=Math.abs(a?t-n:e-r),l=Math.abs(a?e-r:t-n);return{node:i.node,data:i.data,distance:o,secondaryDistance:l,x:r,y:n}});return Xr(e,t,c)},highlight(e){const t=this.node().config.options.container,i="tau-chart__highlighted",r="tau-chart__dimmed",n=t.selectAll(".i-role-path"),a=n.data().filter(t=>t.filter(Or).some(e)),s=a.length>0;n.call(_e({[i]:e=>s&&a.indexOf(e)>=0,[r]:e=>s&&a.indexOf(e)<0}));const o={[i]:t=>!0===e(t),[r]:t=>!1===e(t)};t.selectAll(".i-role-dot").call(_e(o)),t.selectAll(".i-role-label").call(_e(o)),this._sortElements(e)},highlightDataPoints(e){const t=this.node(),i=function(e,t,i){const r=t.anchorShape,n=e.screenModel,a="hover"===e.config.guide.showAnchors;return e.config.options.container.selectAll(".i-data-anchor").call(xe(Ur[r].getHighlightAttrs(e,t,i))).attr("opacity",a?e=>i(e)?1:0:()=>1).attr("fill",e=>n.color(e)).attr("class",e=>$t("i-data-anchor",n.class(e))).classed(`${O}highlighted`,i)}(t,this.domElementModel,e),r=t.config.options.container,n=t.config.flip,a=i.filter(e);var s=r.select(".cursor-line");if(a.empty())s.remove();else{s.empty()&&(s=r.append("line"));const e=t.screenModel.model,i=e.xi(a.data()[0]),o=e.xi(a.data()[0]),l=e.scaleY.domain(),c=e.scaleY(l[0]),d=e.scaleY(l[1]);s.attr("class","cursor-line").attr("x1",n?c:i).attr("y1",n?i:c).attr("x2",n?d:o).attr("y2",n?o:d)}this._sortElements(e)},_sortElements(e){const t=this.node().config.options.container,i=new Map,r=new Map,n=this._getDataSetId;t.selectAll(".i-role-path").each(function(t){i.set(this,n(t)),r.set(this,t.filter(Or).some(e))});const a=ct((e,t)=>r.get(e)-r.get(t),(e,t)=>i.get(e)-i.get(t)),s={line:0,g:1,text:2};Dt(t.node(),(e,t)=>"g"===e.tagName&&"g"===t.tagName?a(e,t):s[e.tagName]-s[t.tagName])}};var Yr=[1,2,3,4,5],Kr=Yr.map(e=>O+"line-opacity-"+e),Jr=Yr.map(e=>O+"line-width-"+e);function Qr(e){return Kr[e-1]||Kr[4]}function Zr(e,t){if(e.length<2)return"";return String.prototype.concat.apply("",e.concat(t.slice().reverse()).map((e,t)=>`${0===t?"":" "}${e.x},${e.y}`))}function en(e,t){if(e.length<2)return"";const i=e=>{const t=e.map((e,t)=>{return`${(t-1)%3==0?"C":""}${e.x},${e.y} `});return String.prototype.concat.apply("",t)};return`M${i(e)}L${i(t.slice().reverse())}Z`}const tn={...Ar,...s},rn={draw:qr.draw,highlight:qr.highlight,highlightDataPoints:qr.highlightDataPoints,addInteraction:qr.addInteraction,_sortElements:qr._sortElements,init(e){const t=qr.init(e),i=t.stack;return t.transformRules=[t.flip&&_.get("flip"),t.guide.obsoleteVerticalStackOrder&&_.get("obsoleteVerticalStackOrder"),!i&&_.get("groupOrderByAvg"),Nr(t),i&&_.get("stack")],t.adjustRules=[(e,i)=>{const r=e.scaleSize.isEmptyScale(),n=st(t.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},i,{defMin:n.defMinSize,defMax:n.defMaxSize,minLimit:n.minSize,maxLimit:n.maxSize});return _.get("adjustStaticSizeScale")(e,a)}],t},buildModel(e){const t=qr.baseModel(e),i=this.node().config.guide,r=Qr(e.model.scaleColor.domain().length),n=`${O}area area i-role-path ${r} ${i.cssClass} `;t.groupAttributes={class:e=>`${n} ${t.class(e[0])} frame`};const a={fill:e=>t.color(e[0]),stroke:e=>{var i=t.color(e[0]);return i.length>0&&(i=tn.rgb(i).darker(1)),i}};t.pathAttributesEnterInit=a,t.pathAttributesUpdateDone=a;const s="polyline"===oe(i.interpolate);return t.pathElement=s?"polygon":"path",t.anchorShape="vertical-stick",t.pathTween={attr:s?"points":"d",fn:ve(0,s?Zr:en,[i=>({id:e.id(i),x:t.x(i),y:t.y(i)}),i=>({id:e.id(i),x:t.x0(i),y:t.y0(i)})],e.id,i.interpolate)},t},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,{flip:i}=this.node().config,r=e.map(e=>{const i=tn.select(e).data()[0];return{node:e,data:i,x:t.x(i),y:t.y(i),y0:t.y0(i),group:t.group(i)}}),n=r.reduce((e,{x:t,y:i,y0:r})=>(e.left=Math.min(t,e.left),e.right=Math.max(t,e.right),e.top=Math.min(i,r,e.top),e.bottom=Math.max(i,r,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=it(r.map(i?e=>e.y:e=>e.x)).sort((e,t)=>e-t),s=a.reduce((e,t)=>(e[t]=[],e),{});if(r.forEach(e=>{const t=a.find(i?t=>e.y===t:t=>e.x===t);s[t].push(e)}),(()=>{const e=Object.keys(r.reduce((e,t)=>(e[t.group]=!0,e),{})),t=e.reduce((e,t,i)=>(e[t]=i,e),{});a.forEach(i=>{const r=s[i];if(r.sort((e,i)=>t[e.group]-t[i.group]),r.length{if(2===e.length){let[t,i]=e;return{start:t,end:i,isLeaf:!0,items:{start:s[t],end:s[i]}}}const t=e.length%2==0?e.length/2:(e.length-1)/2;e[t];return{start:e[0],end:e[e.length-1],isLeaf:!1,left:o(e.slice(0,t+1)),right:o(e.slice(t))}};return{bounds:n,tree:o(a)}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=this.node().config.options.container,{flip:a}=this.node().config,s=k(n.node()),{maxHighlightDistance:o}=this.node().config.guide;if(ei.right+s.x+o||ti.bottom+s.y+o)return null;const l=a?t-s.y:e-s.x,c=function e(t){if(t.isLeaf)return t;const i=t.left.end;return e(l1&&(d=1);const u=(()=>{const e=c.items.start.reduce((e,t)=>(e[t.group]={start:t,end:null,y:null,y0:null},e),{});return c.items.end.forEach(t=>{void 0!==e[t.group]?e[t.group].end=t:delete e[t.group]}),Object.keys(e).forEach(t=>{const i=e[t];i.end?(i.y=i.start.y+d*(i.end.y-i.start.y),i.y0=i.start.y0+d*(i.end.y0-i.start.y0)):delete e[t]}),Object.keys(e).map(t=>e[t]).map(e=>({y:e.y,y0:e.y0,el:d<.5?e.start:e.end})).filter(e=>null!=e.el.data)})(),h=t-s.y,f=u.filter(e=>h>=e.y&&h<=e.y0),p=(f.length>0?f:u).map(e=>e.el).map(i=>{const r=i.x+s.x,n=i.y+s.y,o=Math.abs(a?t-n:e-r),l=Math.abs(a?e-r:t-n);return{node:i.node,data:i.data,distance:o,secondaryDistance:l,x:r,y:n}});return Xr(e,t,p)}},nn={draw:qr.draw,getClosestElement:qr.getClosestElement,highlight:qr.highlight,highlightDataPoints:qr.highlightDataPoints,addInteraction:qr.addInteraction,_getBoundsInfo:qr._getBoundsInfo,_sortElements:qr._sortElements,init(e){const t=qr.init(e);return t.transformRules=[t.flip&&_.get("flip")],t.adjustRules=[(e,i)=>{const r=e.scaleSize.isEmptyScale(),n=st(t.guide.size||{},{defMinSize:2,defMaxSize:r?6:40}),a=Object.assign({},i,{defMin:n.defMinSize,defMax:n.defMaxSize,minLimit:n.minSize,maxLimit:n.maxSize});return _.get("adjustStaticSizeScale")(e,a)}],t},buildModel(e){const t=qr.baseModel(e),i=this.node().config.guide,r=Qr(e.model.scaleColor.domain().length),n=`${O}area area i-role-path ${r} ${i.cssClass} `;t.groupAttributes={class:e=>`${n} ${t.class(e[0])} frame`};const a={fill:e=>t.color(e[0]),stroke:e=>t.color(e[0])};return t.pathAttributesEnterInit=a,t.pathAttributesUpdateDone=a,t.pathElement="polygon",t.anchorShape="circle",t.pathTween={attr:"points",fn:ve(0,((e,t)=>i=>i.map(i=>[e(i),t(i)].join(",")).join(" "))(e=>e.x,e=>e.y),[i=>({id:e.id(i),x:t.x(i),y:t.y(i)})],e.id)},t}};function an(e){if(e.length<2)return"";for(var t="",i=0;ie.scaleSize.isEmptyScale();return t.adjustRules=[(e,i)=>{const r=st(t.guide.size||{},{defMinSize:2,defMaxSize:n(e)?6:40}),a=Object.assign({},i,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return _.get("adjustStaticSizeScale")(e,a)},r&&((e,t)=>{if(n(e))return()=>({});const i=Object.assign({},t,{sizeDirection:"xy"});return _.get("avoidScalesOverflow")(e,i)})].filter(e=>e),t},buildModel(e){const t=this.node().config,i=t.guide,r=t.options,n=!e.model.scaleSize.dim,a=n?i.widthCssClass||(s=r.width,o=0,s>=160&&s<320?o=1:s>=320&&s<480?o=2:s>=480&&s<640?o=3:s>=640&&(o=4),Jr[o]):"";var s,o;const l=Qr(e.model.scaleColor.domain().length),c=n?"line":"area",d=`${O}${c} ${c} i-role-path ${a} ${l} ${i.cssClass} `,u=n?{stroke:e=>f.color(e[0]),class:"i-role-datum"}:{fill:e=>f.color(e[0])},h="cubic"===oe(i.interpolate)?n?sn:Rr:n?an:Lr,f=qr.baseModel(e),p=n?t=>({id:e.id(t),x:f.x(t),y:f.y(t)}):t=>({id:e.id(t),x:f.x(t),y:f.y(t),size:f.size(t)});return f.groupAttributes={class:e=>`${d} ${f.class(e[0])} frame`},f.pathElement="path",f.anchorShape="circle",f.pathAttributesEnterInit=u,f.pathAttributesUpdateDone=u,f.pathTween={attr:"d",fn:ve(0,h,[p],e.id,i.interpolate)},f}},ln=e=>s.select(e).data()[0],cn={init(e){const t=Object.assign({},e);t.guide=t.guide||{},t.guide=st(t.guide,{animationSpeed:0,avoidScalesOverflow:!0,maxHighlightDistance:32,prettify:!0,sortByBarHeight:!0,enableColorToBarPosition:null!=t.guide.enableColorToBarPosition?t.guide.enableColorToBarPosition:!t.stack}),t.guide.size=st(t.guide.size||{},{enableDistributeEvenly:!0}),t.guide.label=st(t.guide.label||{},{position:t.flip?t.stack?["r-","l+","hide-by-label-height-horizontal","cut-label-horizontal"]:["outside-then-inside-horizontal","auto:hide-on-label-label-overlap"]:t.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"]});const i=t.guide.avoidScalesOverflow,r=t.guide.enableColorToBarPosition,n=t.guide.size.enableDistributeEvenly;return t.transformRules=[t.flip&&_.get("flip"),t.guide.obsoleteVerticalStackOrder&&_.get("obsoleteVerticalStackOrder"),t.stack&&_.get("stack"),r&&_.get("positioningByColor")].filter(e=>e),t.adjustRules=[n&&((e,i)=>{const r=st(t.guide.size||{},{defMinSize:t.guide.prettify?3:0,defMaxSize:t.guide.prettify?40:Number.MAX_VALUE}),n=Object.assign({},i,{defMin:r.defMinSize,defMax:r.defMaxSize,minLimit:r.minSize,maxLimit:r.maxSize});return _.get("size_distribute_evenly")(e,n)}),i&&n&&((e,t)=>{const i=Object.assign({},t,{sizeDirection:"x"});return _.get("avoidScalesOverflow")(e,i)}),t.stack&&_.get("adjustYScale")].filter(e=>e),t},addInteraction(){const e=this.node();e.on("highlight",(e,t)=>this.highlight(t)),e.on("data-hover",(e,t)=>this.highlight(((e,t)=>i=>i===e||t)(t.data,null)))},draw(){const e=this.node(),t=e.config,i=t.options;i.container=i.slot(t.uid);const r=t.guide.prettify,n=`i-role-element i-role-datum bar ${O}bar`,a=e.screenModel,o=this.buildModel(a,{prettify:r,minBarH:1,minBarW:1,baseCssClass:n}),l=be,c=t.flip?"y":"x",d=t.flip?"x":"y",u=t.flip?"width":"height",h=t.flip?"height":"width",f=a.toFibers(),p=f.reduce((e,t)=>e.concat(t),[]),g=o.class,m=ot(o,"class"),b=i.container.selectAll(".bar").data(p,a.id);b.exit().classed("tau-removing",!0).call(l(t.guide.animationSpeed,null,{[c]:function(){var e=s.select(this);return e.attr(c)-0+(e.attr(h)-0)/2},[d]:function(){return this.getAttribute("data-zero")},[h]:0,[u]:0},e=>{var t=s.select(e);t.classed("tau-removing")&&t.remove()})),b.call(l(t.guide.animationSpeed,null,m));const y=b.enter().append("rect").call(l(t.guide.animationSpeed,{[d]:a[`${d}0`],[u]:0},m)).merge(b).attr("class",g).attr("data-zero",a[`${d}0`]);e.subscribe(new Mr(a.model,a.model.flip,t.guide.label,i).draw(f));const v=(()=>{const e=p.reduce((e,t,i)=>(e.set(t,i+1),e),new Map);return(t,i)=>{return(e.get(ln(t))||-1)-(e.get(ln(i))||-1)}})();this._barsSorter=t.guide.sortByBarHeight?t.flip?(e,t)=>{const i=ln(e),r=ln(t),n=o.width(i),a=o.width(r);if(n===a){const n=o.y(i),a=o.y(r);return n===a?v(e,t):n-a}return a-n}:(e,t)=>{const i=ln(e),r=ln(t),n=o.height(i),a=o.height(r);if(n===a){const n=o.x(i),a=o.x(r);return n===a?v(e,t):n-a}return a-n}:v;const x={rect:0,text:1};this._typeSorter=((e,t)=>x[e.tagName]-x[t.tagName]),this._sortElements(this._typeSorter,this._barsSorter),e.subscribe(y),this._boundsInfo=this._getBoundsInfo(y.nodes())},buildModel(e,{prettify:t,minBarH:i,minBarW:r,baseCssClass:n}){const a=i=>{var n=e.size(i);return t&&(n=Math.max(r,n)),n};var s;const o=t=>t[e.model.scaleY.dim];if(e.flip){let r=t=>Math.abs(e.x(t)-e.x0(t));s={y:t=>e.y(t)-.5*a(t),x:n=>{const a=Math.min(e.x0(n),e.x(n));if(t){const e=r(n),t=o(n);var s=0;return 0===t&&(s=0),t>0&&(s=e),t<0&&(s=0-i),ea(e),width:e=>{const n=r(e);return t?0===o(e)?n:Math.max(i,n):n}}}else{let r=t=>Math.abs(e.y(t)-e.y0(t));s={x:t=>e.x(t)-.5*a(t),y:n=>{var a=Math.min(e.y0(n),e.y(n));if(t){a=r(n)0?a-i:a}return a},width:e=>a(e),height:e=>{var n=r(e);return t&&(n=0===o(e)?n:Math.max(i,n)),n}}}return Object.assign(s,{class:t=>`${n} ${e.class(t)}`,fill:t=>e.color(t)})},_sortElements(...e){Dt(this.node().config.options.container.node(),ct(...e))},_getBoundsInfo(e){if(0===e.length)return null;const t=this.node().screenModel,{flip:i}=this.node().config,r=e.map(e=>{const i=s.select(e).data()[0],r=t.x(i),n=t.x0(i),a=t.y(i),o=t.y0(i),l=Math.abs(r-n),c=Math.abs(a-o),d=(r+n)/2,u=(a+o)/2;return{node:e,data:i,cx:d,cy:u,box:{top:u-c/2,right:d+l/2,bottom:u+c/2,left:d-l/2},invert:a>o}}),n=r.reduce((e,{box:t})=>(e.left=Math.min(t.left,e.left),e.right=Math.max(t.right,e.right),e.top=Math.min(t.top,e.top),e.bottom=Math.max(t.bottom,e.bottom),e),{left:Number.MAX_VALUE,right:Number.MIN_VALUE,top:Number.MAX_VALUE,bottom:Number.MIN_VALUE}),a=it(r.map(i?e=>e.cy:e=>e.cx)).sort((e,t)=>e-t),o=a.reduce((e,t)=>(e[t]=[],e),{});r.forEach(e=>{const t=a.find(i?t=>e.cy===t:t=>e.cx===t);o[t].push(e)});const l=e=>{if(1===e.length)return o[e];const t=Math.ceil(e.length/2);return{middle:(e[t-1]+e[t])/2,lower:l(e.slice(0,t)),greater:l(e.slice(t))}};return{bounds:n,tree:l(a)}},getClosestElement(e,t){if(!this._boundsInfo)return null;const{bounds:i,tree:r}=this._boundsInfo,n=this.node().config.options.container,{flip:a}=this.node().config,s=k(n.node()),o=e-s.x,l=t-s.y,{maxHighlightDistance:c}=this.node().config.guide;if(oi.right+c||li.bottom+c)return null;const d=a?l:o,u=a?o:l;return function e(t){return Array.isArray(t)?t:e(d>t.middle?t.greater:t.lower)}(r).map(e=>{const t=a?e.box.left:e.box.top,i=a?e.box.right:e.box.bottom,r=((e,t,i)=>e>=t&&e<=i)(u,t,i);if(!r&&Math.abs(u-t)>c&&Math.abs(u-i)>c)return null;const n=Math.abs(u-(e.invert!==a?i:t));return Object.assign(e,{distToValue:n,cursorInside:r})}).filter(e=>e).sort((e,t)=>e.cursorInside!==t.cursorInside?t.cursorInside-e.cursorInside:Math.abs(e.distToValue)-Math.abs(t.distToValue)).map(e=>{const t=e.cx,i=e.cy,r=Math.abs(a?l-i:o-t),n=Math.abs(a?o-t:l-i);return{node:e.node,data:e.data,distance:r,secondaryDistance:n,x:t,y:i}})[0]||null},highlight(e){const t=this.node().config.options.container,i={"tau-chart__highlighted":t=>!0===e(t),"tau-chart__dimmed":t=>!1===e(t)};t.selectAll(".bar").call(_e(i)),t.selectAll(".i-role-label").call(_e(i)),this._sortElements((t,i)=>e(ln(t))-e(ln(i)),this._typeSorter,this._barsSorter)}};var dn=i(14);var un=e=>"date"===e?e=>new Date(e).getTime():e=>e,hn=(e,t)=>He([e,t].map(e=>JSON.stringify).join(""));class fn{constructor(e,t){var i;if(this._fields={},Array.isArray(t.fitToFrameByDims)&&t.fitToFrameByDims.length){let r=e=>{var i={};return"where"===e.type&&e.args?(i.type=e.type,i.args=t.fitToFrameByDims.reduce((t,i)=>(e.args.hasOwnProperty(i)&&(t[i]=e.args[i]),t),{})):i=e,i};i=e.part(r)}else i=e.full();var r=this.getVarSet(i,t);t.order&&(r=nt(at(t.order,r),r)),this.vars=r;const n=r.map(e=>e);this.scaleConfig=t,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",()=>this.vars).addField("isInteger",n.every(Number.isInteger)).addField("originalSeries",()=>n).addField("isContains",e=>this.isInDomain(e)).addField("isEmptyScale",()=>this.isEmpty()).addField("fixup",e=>{var t=this.scaleConfig;t.__fixup__=t.__fixup__||{},t.__fixup__=Object.assign(t.__fixup__,e(Object.assign({},t,t.__fixup__)))}).addField("commit",()=>{this.scaleConfig=Object.assign(this.scaleConfig,this.scaleConfig.__fixup__),delete this.scaleConfig.__fixup__})}isInDomain(e){return this.domain().indexOf(e)>=0}addField(e,t){return this._fields[e]=t,this[e]=t,this}getField(e){return this._fields[e]}isEmpty(){return!Boolean(this._fields.dim)}toBaseScale(e,t=null){var i=Object.keys(this._fields).reduce((e,t)=>(e[t]=this._fields[t],e),e);return i.getHash=(()=>hn(this.vars,t)),i.value=i,i}getVarSet(e,t){return it(t.hasOwnProperty("series")?t.series:e.map(e=>e[t.dim]),un(t.dimType))}}const pn={...o,...l};let gn={sqrt:e=>Math.sqrt(e),linear:e=>e};const mn={...o,...l};var bn=i(15);const yn={...o,...l,...bn};function vn(e){return yn[`time${e[0].toUpperCase()}${e.slice(1)}`]}const xn={second:{duration:1e3,interval:yn.timeSecond,utc:yn.utcSecond},minute:{duration:6e4,interval:yn.timeMinute,utc:yn.utcMinute},hour:{duration:36e5,interval:yn.timeHour,utc:yn.utcHour},day:{duration:864e5,interval:yn.timeDay,utc:yn.utcDay},week:{duration:6048e5,interval:yn.timeWeek,utc:yn.utcWeek},month:{duration:2592e6,interval:yn.timeMonth,utc:yn.utcMonth},year:{duration:31536e6,interval:yn.timeYear,utc:yn.utcYear}},_n=(()=>{const e=(e,t)=>{return{time:e,step:t,duration:t*e.duration}};return[e(xn.second,1),e(xn.second,5),e(xn.second,15),e(xn.second,30),e(xn.minute,1),e(xn.minute,5),e(xn.minute,15),e(xn.minute,30),e(xn.hour,1),e(xn.hour,3),e(xn.hour,6),e(xn.hour,12),e(xn.day,1),e(xn.day,2),e(xn.week,1),e(xn.month,1),e(xn.month,3),e(xn.year,1)]})();const wn={...o,...l};const En={...o,...l};function Sn(e){return Math.log(e)/Math.LN10}function Tn(e){if(e[0]*e[1]<=0)throw new y("Logarithmic scale domain cannot cross zero.",v.INVALID_LOG_DOMAIN)}const Mn={...o,...l};var Cn=e=>e||null,kn=(e,t=null)=>Array.isArray(e)?0===e.length?[t]:e:[e],An=(e,t)=>({type:e,x:t.x,y:t.y,identity:t.identity,size:t.size,color:t.color,split:t.split,label:t.label,guide:{color:t.colorGuide,obsoleteVerticalStackOrder:t.obsoleteVerticalStackOrder,size:t.sizeGuide},flip:t.flip,stack:t.stack});const Pn={SUCCESS:"SUCCESS",WARNING:"WARNING",FAIL:"FAIL"};var On={[Pn.SUCCESS]:e=>e,[Pn.FAIL]:(e,t)=>{throw new Error((t.messages||[]).join("\n")||["This configuration is not supported,","See https://api.taucharts.com/basic/facet.html#easy-approach-for-creating-facet-chart"].join(" "))},[Pn.WARNING]:(e,t,i)=>{var r=t.axis,n=t.indexMeasureAxis[0],a=e[n],s=e.filter(e=>e!==a);s.push(a);var o=i[n][r]||{},l=i[i.length-1][r]||{};return i[i.length-1][r]=o,i[n][r]=l,s}};function Nn(e,t,i){return t.reduce(function(t,r,n){var a=e[r];return a?t.status!=Pn.FAIL&&("measure"===a.type&&(t.countMeasureAxis++,t.indexMeasureAxis.push(n)),"measure"!==a.type&&1===t.countMeasureAxis?t.status=Pn.WARNING:t.countMeasureAxis>1&&(t.status=Pn.FAIL,t.messages.push(`There is more than one measure dimension for "${i}" axis`))):(t.status=Pn.FAIL,r?t.messages.push(`"${r}" dimension is undefined for "${i}" axis`):t.messages.push(`"${i}" axis should be specified`)),t},{status:Pn.SUCCESS,countMeasureAxis:0,indexMeasureAxis:[],messages:[],axis:i})}function Ln(e){var t=kn(e.x),i=kn(e.y),r=Math.max(t.length,i.length),n=kn(e.guide||{},{});let a=r-n.length;for(let e=0;e{const r=e[i],n=function(e,t,i){return null==t?t:String(t)}(e.dimensions,r);return null!=n&&(t[i]=n),t},{});return Object.assign({},e,{x:t,y:i,guide:n},l)}function Rn(e,t){for(var i=t.x,r=t.y,n=t.guide,a=Math.max(i.length,r.length),s={type:"COORDS.RECT",unit:[]},o=[].concat(i),l=[].concat(r),c=[].concat(n),d=a;d>0;d--){var u=o.pop(),h=l.pop(),f=c.pop()||{};d===a?(s.x=u,s.y=h,s.unit.push(An(e,{x:Cn(u),y:Cn(h),identity:t.identity,split:t.split,color:t.color,label:t.label,size:t.size,flip:t.flip,stack:t.stack,colorGuide:f.color,obsoleteVerticalStackOrder:f.obsoleteVerticalStackOrder,sizeGuide:f.size})),s.guide=st(f,{x:{label:u},y:{label:h}})):s={type:"COORDS.RECT",x:Cn(u),y:Cn(h),unit:[s],guide:st(f,{x:{label:u},y:{label:h}})}}return t.spec={dimensions:t.dimensions,unit:s},t}const Fn=e=>{var t=Ln(e);return Rn("ELEMENT.INTERVAL",t=(e=>{var t=(e.flip?e.y:e.x).indexOf(e.color)>=0,i=e.guide[e.guide.length-1];return t&&!i.hasOwnProperty("enableColorToBarPosition")&&(i.enableColorToBarPosition=!1),e})(t))},Dn=e=>{var t=Ln(e),i=t.data,r=t.settings.log,n=(0,{horizontal:e=>({prop:e.x[e.x.length-1],flip:!1}),vertical:e=>({prop:e.y[e.y.length-1],flip:!0}),auto:e=>{var t,n=e.x,a=e.y,s=n[n.length-1],o=n.slice(0,n.length-1),l=a[a.length-1],c=a.slice(0,a.length-1),d=e.color,u=o.concat(c).concat([d]).filter(e=>null!==e),h=-1,f=[[[s].concat(u),l],[[l].concat(u),s]],p=null;return f.some((e,t)=>{var n=e[0],a=e[1],s=ri.isYFunctionOfX(i,n,[a]);return s.result?h=t:r(["Attempt to find a functional relation between",e[0]+" and "+e[1]+" is failed.","There are several "+s.error.keyY+" values (e.g. "+s.error.errY.join(",")+")","for ("+s.error.keyX+" = "+s.error.valX+")."].join(" ")),s.result})?(t=f[h][0][0],p=0!==h):(r("All attempts are failed. Gonna transform AREA to general PATH."),t=null),{prop:t,flip:p}}}["boolean"!=typeof t.flip?"auto":t.flip?"vertical":"horizontal"])(t);return null!==n.prop&&(t.data=ri.sortByDim(i,n.prop,t.dimensions[n.prop]),t.flip=n.flip),Rn("ELEMENT.AREA",t)};class $n{constructor(e){this.unitRef=e}value(){return this.unitRef}clone(){return JSON.parse(JSON.stringify(this.unitRef))}traverse(e){var t=(e,i,r)=>{i(e,r),(e.units||[]).map(r=>t(r,i,e))};return t(this.unitRef,e,null),this}reduce(e,t){var i=t;return this.traverse((t,r)=>i=e(i,t,r)),i}addFrame(e){return this.unitRef.frames=this.unitRef.frames||[],e.key.__layerid__=["L",(new Date).getTime(),this.unitRef.frames.length].join(""),e.source=e.hasOwnProperty("source")?e.source:this.unitRef.expression.source,e.pipe=e.pipe||[],this.unitRef.frames.push(e),this}addTransformation(e,t){return this.unitRef.transformation=this.unitRef.transformation||[],this.unitRef.transformation.push({type:e,args:t}),this}isCoordinates(){return 0===(this.unitRef.type||"").toUpperCase().indexOf("COORDS.")}isElementOf(e){if(this.isCoordinates())return!1;var t=(this.unitRef.type||"").split("/");return 1===t.length&&t.unshift("RECT"),t[0].toUpperCase()===e.toUpperCase()}}class zn{constructor(e){this.specRef=e}value(){return this.specRef}unit(e){return e&&(this.specRef.unit=e),new $n(this.specRef.unit)}addTransformation(e,t){return this.specRef.transformations=this.specRef.transformations||{},this.specRef.transformations[e]=t,this}getSettings(e){return this.specRef.settings[e]}setSettings(e,t){return this.specRef.settings=this.specRef.settings||{},this.specRef.settings[e]=t,this}getScale(e){return this.specRef.scales[e]}addScale(e,t){return this.specRef.scales[e]=t,this}regSource(e,t){return this.specRef.sources[e]=t,this}getSourceData(e){return(this.specRef.sources[e]||{data:[]}).data}getSourceDim(e,t){return(this.specRef.sources[e]||{dims:{}}).dims[t]||{}}}var Bn={};class In{static unit(e){return new $n(e)}static spec(e){return new zn(e)}static cloneObject(e){return JSON.parse(JSON.stringify(e))}static depthFirstSearch(e,t){if(t(e))return e;for(var i=e.hasOwnProperty("frames")?e.frames:[{units:e.units}],r=0;r{t(e,r),(e.units||[]).map(r=>i(r,t,e))};i(e.unit,t,null)}static extractFieldsFormatInfo(e){var t=e.scales,i=function(e){return!t[e].dim},r=function(e,i,r){var n=i.guide||{},a=t[i[r]],s=n[r]||{};e[a.dim]=e[a.dim]||{label:[],format:[],nullAlias:[],tickLabel:[]};var o=s.label,l=s.label||{};e[a.dim].label.push("string"==typeof o?o:l._original_text||l.text);var c=s.tickFormat||s.tickPeriod;e[a.dim].format.push(c),e[a.dim].nullAlias.push(s.tickFormatNullAlias),e[a.dim].tickLabel.push(s.tickLabel)},n=[];In.traverseSpec(e,function(e){n.push(e)});var a=n.reduce(function(e,t){return"COORDS.RECT"===t.type&&t.hasOwnProperty("x")&&!i(t.x)&&r(e,t,"x"),"COORDS.RECT"===t.type&&t.hasOwnProperty("y")&&!i(t.y)&&r(e,t,"y"),t.hasOwnProperty("color")&&!i(t.color)&&r(e,t,"color"),t.hasOwnProperty("size")&&!i(t.size)&&r(e,t,"size"),t.hasOwnProperty("label")&&!i(t.label)&&r(e,t,"label"),e},{}),s=function(e,t){return e.filter(e=>e)[0]||t};return Object.keys(a).reduce(function(t,i){t[i]={},t[i].label=s(a[i].label,i);const r=s(a[i].format,null);t[i].nullAlias=s(a[i].nullAlias,`No ${t[i].label}`),t[i].tickLabel=s(a[i].tickLabel,null);const n="x-time-auto"===r?e.settings.utcTime?"day-utc":"day":r;var o=t[i].nullAlias,l=n?fi.get(n,o):e=>null==e?o:String(e);if(t[i].format=l,t[i].tickLabel){var c=i.replace("."+t[i].tickLabel,"");t[c]={label:t[i].label,nullAlias:t[i].nullAlias,tickLabel:t[i].tickLabel,format:function(e){return l(e&&e[t[c].tickLabel])},isComplexField:!0},t[i].parentField=c}return t},{})}static getFieldFormatters(e,t){const i=In.extractFieldsFormatInfo(e);Object.keys(i).forEach(e=>{i[e].parentField&&delete i[e]});return Object.keys(t).forEach(e=>{const r=(e=>{let t={};return"function"==typeof e||"string"==typeof e?t={format:e}:ze(e)&&(t=dt(e,"label","format","nullAlias")),t})(t[e]);i[e]=Object.assign({label:e,nullAlias:"No "+e},i[e]||{},dt(r,"label","nullAlias")),r.hasOwnProperty("format")?i[e].format="function"==typeof r.format?r.format:fi.get(r.format,i[e].nullAlias):i[e].format=i[e].hasOwnProperty("format")?i[e].format:fi.get(null,i[e].nullAlias)}),Object.keys(i).reduce((e,t)=>{const r=i[t];return e[t]={label:r.label,format:r.format},e},{})}static tokens(){return{reg:function(e,t){return Bn[e]=t,this},get:function(e){return Bn[e]||e}}}static getParentUnit(e,t){var i=null;const r=(e,n)=>e.uid===t.uid?(i=n,!0):(e.frames?e.frames.some(t=>(t.units||[]).some(t=>r(t,e))):(e.units||[]).some(t=>r(t,e)),!1);return r(e.unit,null),i}}i(16);i.d(t,"api",function(){return Hn}),i.d(t,"version",function(){return Un}),i.d(t,"GPL",function(){return Ut}),i.d(t,"Plot",function(){return Xi}),i.d(t,"Chart",function(){return Ji});var jn={},Vn={},Hn={errorCodes:v,unitsRegistry:Qt,scalesRegistry:ti,grammarRegistry:_,tickFormat:fi,isChartElement:xt,utils:n,svgUtils:r,domUtils:a,tickPeriod:b,colorBrewers:{add:function(e,t){jn.hasOwnProperty(e)||(jn[e]=t)},get:function(e){return jn[e]}},d3_animationInterceptor:be,pluginsSDK:In,plugins:{add:function(e,t){if(Vn.hasOwnProperty(e))throw new Error("Plugin is already registered.");Vn[e]=t},get:function(e){return Vn[e]||(t=>{throw new Error(`"${e}" plugin is not defined`)})}},chartTypesRegistry:Ki,globalSettings:{animationSpeed:750,renderingTimeout:1e4,asyncRendering:!0,syncRenderingInterval:50,syncPointerEvents:!1,handleRenderingErrors:!1,experimentalShouldAnimate:e=>{const t=(e,t)=>{var i=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(t).forEach(e=>i.setAttribute(e,String(t[e]))),i},i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",document.body.appendChild(i);const r=t("svg",{width:100,height:100});i.appendChild(r);const n=performance.now();var a,s,o;for(a=0;a<10;a++)for(s=0;s<10;s++)o=t("circle",{fill:"black",r:5,cx:10*a,cy:10*s}),r.appendChild(o);const l=performance.now()-n;return document.body.removeChild(i),e.sources["/"].data.length*l<500},defaultNiceColor:!0,defaultColorBrewer:["#fde725","#fbe723","#f8e621","#f6e620","#f4e61e","#f1e51d","#efe51c","#ece51b","#eae51a","#e7e419","#e5e419","#e2e418","#dfe318","#dde318","#dae319","#d8e219","#d5e21a","#d2e21b","#d0e11c","#cde11d","#cae11f","#c8e020","#c5e021","#c2df23","#c0df25","#bddf26","#bade28","#b8de29","#b5de2b","#b2dd2d","#b0dd2f","#addc30","#aadc32","#a8db34","#a5db36","#a2da37","#a0da39","#9dd93b","#9bd93c","#98d83e","#95d840","#93d741","#90d743","#8ed645","#8bd646","#89d548","#86d549","#84d44b","#81d34d","#7fd34e","#7cd250","#7ad151","#77d153","#75d054","#73d056","#70cf57","#6ece58","#6ccd5a","#69cd5b","#67cc5c","#65cb5e","#63cb5f","#60ca60","#5ec962","#5cc863","#5ac864","#58c765","#56c667","#54c568","#52c569","#50c46a","#4ec36b","#4cc26c","#4ac16d","#48c16e","#46c06f","#44bf70","#42be71","#40bd72","#3fbc73","#3dbc74","#3bbb75","#3aba76","#38b977","#37b878","#35b779","#34b679","#32b67a","#31b57b","#2fb47c","#2eb37c","#2db27d","#2cb17e","#2ab07f","#29af7f","#28ae80","#27ad81","#26ad81","#25ac82","#25ab82","#24aa83","#23a983","#22a884","#22a785","#21a685","#21a585","#20a486","#20a386","#1fa287","#1fa187","#1fa188","#1fa088","#1f9f88","#1f9e89","#1e9d89","#1e9c89","#1e9b8a","#1f9a8a","#1f998a","#1f988b","#1f978b","#1f968b","#1f958b","#1f948c","#20938c","#20928c","#20928c","#21918c","#21908d","#218f8d","#218e8d","#228d8d","#228c8d","#228b8d","#238a8d","#23898e","#23888e","#24878e","#24868e","#25858e","#25848e","#25838e","#26828e","#26828e","#26818e","#27808e","#277f8e","#277e8e","#287d8e","#287c8e","#297b8e","#297a8e","#29798e","#2a788e","#2a778e","#2a768e","#2b758e","#2b748e","#2c738e","#2c728e","#2c718e","#2d718e","#2d708e","#2e6f8e","#2e6e8e","#2e6d8e","#2f6c8e","#2f6b8e","#306a8e","#30698e","#31688e","#31678e","#31668e","#32658e","#32648e","#33638d","#33628d","#34618d","#34608d","#355f8d","#355e8d","#365d8d","#365c8d","#375b8d","#375a8c","#38598c","#38588c","#39568c","#39558c","#3a548c","#3a538b","#3b528b","#3b518b","#3c508b","#3c4f8a","#3d4e8a","#3d4d8a","#3e4c8a","#3e4a89","#3e4989","#3f4889","#3f4788","#404688","#404588","#414487","#414287","#424186","#424086","#423f85","#433e85","#433d84","#443b84","#443a83","#443983","#453882","#453781","#453581","#463480","#46337f","#46327e","#46307e","#472f7d","#472e7c","#472d7b","#472c7a","#472a7a","#482979","#482878","#482677","#482576","#482475","#482374","#482173","#482071","#481f70","#481d6f","#481c6e","#481b6d","#481a6c","#48186a","#481769","#481668","#481467","#471365","#471164","#471063","#470e61","#470d60","#460b5e","#460a5d","#46085c","#46075a","#450559","#450457","#440256","#440154"],defaultClassBrewer:Qe(20).map(e=>"color20-"+(1+e)),log:(e,t)=>{t=t||"INFO",Array.isArray(e)||(e=[e]),console[t.toLowerCase()].apply(console,e)},facetLabelDelimiter:" → ",excludeNull:!0,minChartWidth:300,minChartHeight:200,minFacetWidth:150,minFacetHeight:100,specEngine:[{name:"COMPACT",width:600,height:400},{name:"AUTO",width:Number.MAX_VALUE,height:Number.MAX_VALUE}],fitModel:"normal",layoutEngine:"EXTRACT",autoRatio:!0,defaultSourceMap:["https://raw.githubusercontent.com","TargetProcess/tauCharts/master/src/addons","world-countries.json"].join("/"),getAxisTickLabelSize:lt(Pt,e=>String(String(e).length)),getScrollbarSize:Tt,avoidScrollAtRatio:1.5,xAxisTickLabelLimit:150,yAxisTickLabelLimit:150,xTickWordWrapLinesLimit:2,yTickWordWrapLinesLimit:2,xTickWidth:9,yTickWidth:9,distToXAxisLabel:10,distToYAxisLabel:10,xAxisPadding:20,yAxisPadding:20,xFontLabelDescenderLineHeight:4,xFontLabelHeight:10,yFontLabelHeight:10,xDensityPadding:2,yDensityPadding:2,"xDensityPadding:measure":8,"yDensityPadding:measure":8,utcTime:!1,defaultFormats:{measure:"x-num-auto","measure:time":"x-time-auto"}}};Xi.__api__=Hn,Xi.globalSettings=Hn.globalSettings,Hn.unitsRegistry.reg("COORDS.RECT",class extends f{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{showGridLines:"xy",padding:{l:50,r:0,t:0,b:50}}),this.config.guide.x=this.config.guide.x||{},this.config.guide.x=st(this.config.guide.x,{cssClass:"x axis",textAnchor:"middle",padding:10,hide:!1,scaleOrient:"bottom",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof this.config.guide.x.label&&(this.config.guide.x.label={text:this.config.guide.x.label}),this.config.guide.x.label=st(this.config.guide.x.label,{text:"X",rotate:0,padding:40,textAnchor:"middle"}),this.config.guide.y=this.config.guide.y||{},this.config.guide.y=st(this.config.guide.y,{cssClass:"y axis",textAnchor:"start",padding:10,hide:!1,scaleOrient:"left",rotate:0,density:20,label:{},tickFormatWordWrapLimit:100}),"string"==typeof this.config.guide.y.label&&(this.config.guide.y.label={text:this.config.guide.y.label}),this.config.guide.y.label=st(this.config.guide.y.label,{text:"Y",rotate:-90,padding:20,textAnchor:"middle"});var t=this.config,i=t.guide;if("extract-axes"===i.autoLayout){var r=t.options.containerHeight-(t.options.top+t.options.height);i.x.hide=i.x.hide||Math.floor(r)>0,i.y.hide=i.y.hide||Math.floor(t.options.left)>0}var n=this.config.options,a=this.config.guide.padding;this.L=n.left+a.l,this.T=n.top+a.t,this.W=n.width-(a.l+a.r),this.H=n.height-(a.t+a.b)}defineGrammarModel(e){const t=this.W,i=this.H;return this.xScale=e("pos",this.config.x,[0,t]),this.yScale=e("pos",this.config.y,e=>["ordinal","period"].indexOf(e.type)>=0?[0,i]:[i,0]),this.regScale("x",this.xScale).regScale("y",this.yScale),{scaleX:this.xScale,scaleY:this.yScale,xi:()=>t/2,yi:()=>i/2,sizeX:()=>t,sizeY:()=>i}}getGrammarRules(){return[e=>{var t=e.scaleX,i=e.scaleY;return{xi:i=>i?t(i[t.dim]):e.xi(i),yi:t=>t?i(t[i.dim]):e.yi(t),sizeX:i=>i?t.stepSize(i[t.dim]):e.sizeX(i),sizeY:t=>t?i.stepSize(t[i.dim]):e.sizeY(t)}}]}createScreenModel(e){return e}allocateRect(e){var t=this.screenModel;return{slot:e=>this.config.options.container.selectAll(`.uid_${e}`),left:t.xi(e)-t.sizeX(e)/2,top:t.yi(e)-t.sizeY(e)/2,width:t.sizeX(e),height:t.sizeY(e),containerWidth:this.W,containerHeight:this.H}}drawFrames(e){var t=Object.assign({},this.config),i=t.options,r=this.W,n=this.H;if(t.x=this.xScale,t.y=this.yScale,t.x.scaleObj=this.xScale,t.y.scaleObj=this.yScale,t.x.guide=t.guide.x,t.y.guide=t.guide.y,t.x.guide.label.size=r,t.y.guide.label.size=n,(i.container.attr("transform")?he(i.container,this.config.guide.animationSpeed,"cartesianContainerTransform"):i.container).attr("transform",E(this.L,this.T)),t.x.guide.hide)this._removeDimAxis(i.container,t.x);else{var a="top"===t.x.guide.scaleOrient?[0,0-t.guide.x.padding]:[0,n+t.guide.x.padding];this._drawDimAxis(i.container,t.x,a,r)}if(t.y.guide.hide)this._removeDimAxis(i.container,t.y);else{var s="right"===t.y.guide.scaleOrient?[r+t.guide.y.padding,0]:[0-t.guide.y.padding,0];this._drawDimAxis(i.container,t.y,s,n)}var o=e.reduce((e,t)=>e.concat((t.units||[]).map(e=>e.uid)),[]),l=this._drawGrid(i.container,t,r,n,i),c=ye(l,".cell").data(o,e=>e);c.enter().append("g").attr("class",e=>`${O}cell cell uid_${e}`).merge(c).classed("tau-active",!0),he(c,this.config.guide.animationSpeed).attr("opacity",1),he(c.exit().classed("tau-active",!1),this.config.guide.animationSpeed).attr("opacity",1e-6).remove()}_drawDimAxis(e,t,i,r){var n=fi.get(t.guide.tickFormat,t.guide.tickFormatNullAlias),a=$({scale:t.scaleObj,scaleGuide:t.guide,ticksCount:n?Zi(r/t.guide.density):null,tickFormat:n||null,position:i}),s=this.config.guide.animationSpeed;Qi(e,this._getAxisSelector(t)).classed("tau-active",!0).classed(t.guide.cssClass,!0).call(e=>{var t=he(e,s,"axisTransition"),r=e.attr("transform");E(...i)!==r&&(r?t:e).attr("transform",E(...i)),t.call(a),t.attr("opacity",1)})}_removeDimAxis(e,t){var i=ye(e,this._getAxisSelector(t)).classed("tau-active",!1);he(i,this.config.guide.animationSpeed,"axisTransition").attr("opacity",1e-6).remove()}_getAxisSelector(e){return`g.${"h"===T(e.guide.scaleOrient)?"x":"y"}.axis`}_drawGrid(e,t,i,r){return Qi(e,"g.grid").attr("transform",E(0,0)).call(e=>{var n=e,a=this.config.guide.animationSpeed,s=(t.guide.showGridLines||"").toLowerCase();if(s.length>0){var o=Qi(n,"g.grid-lines");if(s.indexOf("x")>-1){let e=t.x,n=fi.get(e.guide.tickFormat);var l=z({scale:e.scaleObj,scaleGuide:e.guide,tickSize:r,ticksCount:n?Zi(i/e.guide.density):null}),c=Qi(o,"g.grid-lines-x");he(c,a).call(l)}if(s.indexOf("y")>-1){let e=t.y,n=fi.get(e.guide.tickFormat);var d=z({scale:e.scaleObj,scaleGuide:e.guide,tickSize:-i,ticksCount:n?Zi(r/e.guide.density):null}),u=Qi(o,"g.grid-lines-y");he(u,a).call(d)}}})}}).reg("COORDS.MAP",class extends f{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{defaultFill:"rgba(128,128,128,0.25)",padding:{l:0,r:0,t:0,b:0},showNames:!0}),this.contourToFill=null,this.on("highlight-area",(e,t)=>this._highlightArea(t)),this.on("highlight-point",(e,t)=>this._highlightPoint(t)),this.on("highlight",(e,t)=>this._highlightPoint(t))}defineGrammarModel(e){var t=this.config,i=t.options,r=t.guide.padding,n=i.width-(r.l+r.r),a=i.height-(r.t+r.b);return this.latScale=e("pos",t.latitude,[0,a]),this.lonScale=e("pos",t.longitude,[n,0]),this.sizeScale=e("size",t.size),this.colorScale=e("color",t.color),this.codeScale=e("value",t.code),this.fillScale=e("fill",t.fill),this.W=n,this.H=a,this.regScale("latitude",this.latScale).regScale("longitude",this.lonScale).regScale("size",this.sizeScale).regScale("color",this.colorScale).regScale("code",this.codeScale).regScale("fill",this.fillScale),{}}drawFrames(e){var t=this.config.guide;"string"==typeof t.sourcemap?function(e,t){const i=new XMLHttpRequest;i.onload=(()=>{if(i.status>=200&&i.status<300){const e=i.responseText;try{t(null,JSON.parse(e))}catch(e){t(e,null)}}else t(new Error(`${i.status}: ${i.statusText}`),null)}),i.onerror=(e=>{t(e.error,null)}),i.open("GET",e,!0),i.send(null)}(t.sourcemap,(t,i)=>{if(t)throw t;this._drawMap(e,i)}):this._drawMap(e,t.sourcemap)}_calcLabels(e,t,i){var r=this.W,n=this.H,a={};return t.forEach(t=>{var s=(ir.feature(e,e.objects[t]).features||[]).map(e=>{var n=e.properties||{},a=i.centroid(e),s=i.bounds(e),o=a[0],l=a[1],c=s[1][0]-s[0][0],d=n.name||"",u=n.abbr||d,h=c!Number.isNaN(e.x)&&!Number.isNaN(e.y)),o=s.map(e=>({x:e.sx,y:e.sy,r:e.r}));rr().label(s).anchor(o).width(r).height(n).start(sr),s.filter(e=>!e.isRef).map(e=>(e.x=e.sx,e.y=e.sy,e)).reduce((e,t)=>(e[t.id]=t,e),a);var l=s.filter(e=>e.isRef);l.length<6&&l.reduce((e,t)=>(e[t.id]=t,e),a)}),a}_drawMap(e,t){var i,r,n=this,a=this.config.guide,o=this.config.options,l=this.config.options.container,c=this.latScale,d=this.lonScale,u=this.sizeScale,h=this.colorScale,f=this.codeScale,p=this.fillScale,g=this.W,m=this.H,b=lr.filter(e=>(t.objects||{}).hasOwnProperty(e));if(0===b.length)throw new Error("Invalid map: should contain some contours");if(p.dim){if(!f.georole)throw console.log("Specify [georole] for code scale"),new Error("[georole] is missing");if(-1===b.indexOf(f.georole))throw console.log(`There is no contour for georole "${f.georole}"`),console.log(`Available contours are: ${b.join(" | ")}`),new Error("Invalid [georole]");i=f.georole}else i=b[b.length-1];if(this.contourToFill=i,c.dim&&d.dim){var y=nr.extent(c.domain()),v=nr.extent(d.domain());r=[(v[1]+v[0])/2,(y[1]+y[0])/2]}var x=this._createProjection(t,b[0],r),_=nr.geoPath().projection(x),w=l.selectAll(".map-container").data([`${g}${m}${r}${b.join("-")}`],e=>e);w.exit().remove();const E=w.enter().append("g").call(function(e){var i=e;i.attr("class","map-container");var r={},s=b.reduceRight((e,t)=>e.concat(t),[]);if(a.showNames&&(r=n._calcLabels(t,s,_)),s.forEach((e,n)=>{var a=t=>r[`${e}-${t.id}`];i.selectAll(`.map-contour-${e}`).data(ir.feature(t,t.objects[e]).features||[]).enter().append("g").call(function(t){var i=t;i.attr("class",`map-contour-${e} map-contour-level map-contour-level-${n}`).attr("fill","none"),i.append("title").text(e=>(e.properties||{}).name),i.append("path").attr("d",_),i.append("text").attr("class",`place-label-${e}`).attr("transform",e=>{var t=a(e);return t?`translate(${[t.x,t.y]})`:""}).text(e=>{var t=a(e);return t?t.name:""}),i.append("line").attr("class",`place-label-link-${e}`).attr("stroke","gray").attr("stroke-width",.25).attr("x1",e=>{var t=a(e);return t&&t.isRef?t.sx:0}).attr("y1",e=>{var t=a(e);return t&&t.isRef?t.sy:0}).attr("x2",e=>{var t=a(e);return t&&t.isRef?t.x-.6*t.name.length*ar:0}).attr("y2",e=>{var t=a(e);return t&&t.isRef?t.y-3.5:0})})}),t.objects.hasOwnProperty("places")){var o=ir.feature(t,t.objects.places),l=o.features.map(e=>{var t=x(e.geometry.coordinates);return{x:t[0]+3.5,y:t[1]+3.5,width:e.properties.name.length*ar,height:12,name:e.properties.name}}),c=o.features.map(e=>{var t=x(e.geometry.coordinates);return{x:t[0],y:t[1],r:2.5}});rr().label(l).anchor(c).width(g).height(m).start(100),i.selectAll(".place").data(c).enter().append("circle").attr("class","place").attr("transform",e=>`translate(${e.x},${e.y})`).attr("r",e=>`${e.r}px`),i.selectAll(".place-label").data(l).enter().append("text").attr("class","place-label").attr("transform",e=>`translate(${e.x},${e.y})`).text(e=>e.name)}}).merge(w);this.groupByCode=e.reduce((e,t)=>t.part().reduce((e,t)=>(e[(t[f.dim]||"").toLowerCase()]=t,e),e),{});var S=this._resolveFeature.bind(this);if(E.selectAll(`.map-contour-${i}`).data(ir.feature(t,t.objects[i]).features).call(function(e){e.classed("map-contour",!0).attr("fill",e=>{var t=S(e);return null===t?a.defaultFill:p(t[p.dim])})}).on("mouseover",e=>this.fire("area-mouseover",{data:S(e),event:s.event})).on("mouseout",e=>this.fire("area-mouseout",{data:S(e),event:s.event})).on("click",e=>this.fire("area-click",{data:S(e),event:s.event})),!c.dim||!d.dim)return[];var T=function(e){return e.attr("r",e=>u(e[u.dim])).attr("transform",({data:e})=>`translate(${x([e[d.dim],e[c.dim]])})`).attr("class",({data:e})=>h(e[h.dim])).attr("opacity",or).on("mouseover",({data:e})=>n.fire("point-mouseover",{data:e,event:s.event})).on("mouseout",({data:e})=>n.fire("point-mouseout",{data:e,event:s.event})).on("click",({data:e})=>n.fire("point-click",{data:e,event:s.event}))},M=E.selectAll(".frame").data(e.map(e=>({tags:e.key||{},hash:e.hash(),data:e.part()})),e=>e.hash);return M.exit().remove(),M.enter().append("g").merge(M).call(function(e){e.attr("class",e=>`frame frame-${e.hash}`).call(function(e){var t=e.selectAll("circle").data(e=>e.data.map(e=>({data:e,uid:o.uid})));t.exit().remove(),t.call(T),t.enter().append("circle").call(T)})}),[]}_resolveFeature(e){var t,i=this.groupByCode,r=e.properties,n=["c1","c2","c3","abbr","name"].filter(e=>r.hasOwnProperty(e)&&r[e]&&i.hasOwnProperty(r[e].toLowerCase()));if(0===n.length)t=null;else if(n.length>0){let e=r[n[0]].toLowerCase();t=i[e]}return t}_highlightArea(e){var t=this.config.options.container,i=this.contourToFill;t.selectAll(`.map-contour-${i}`).classed("map-contour-highlighted",t=>e(this._resolveFeature(t)))}_highlightPoint(e){this.config.options.container.selectAll("circle").classed("map-point-highlighted",({data:t})=>e(t)).attr("opacity",({data:t})=>e(t)?or:.1)}_createProjection(e,t,i){var r=this.W,n=this.H,a=this.config.guide,s=100,o=[r/2,n/2],l=i||e.center,c=a.projection||e.projection||"mercator",d=this._createD3Projection(c,l,s,o),u=nr.geoPath().projection(d).bounds(ir.feature(e,e.objects[t])),h=s*r/(u[1][0]-u[0][0]),f=s*n/(u[1][1]-u[0][1]);return s=he.args).reduce((e,t)=>(e[t.method]&&(e=e[t.method](t.args)),e),s)}}).reg("COORDS.PARALLEL",class extends f{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{padding:{l:50,r:50,t:50,b:50},enableBrushing:!1}),this.columnsBrushes={},this.columnsSelections={},this.on("force-brush",(e,t)=>this._forceBrushing(t));var t=this.config.options,i=this.config.guide.padding;this.L=t.left+i.l,this.T=t.top+i.t,this.W=t.width-(i.l+i.r),this.H=t.height-(i.t+i.b)}defineGrammarModel(e){var t=this.config,i=this.W,r=this.H;this.columnsScalesMap=t.columns.reduce((t,i)=>(t[i]=e("pos",i,[0,r]),t),{});var n=i/(t.columns.length-1),a=t.columns.reduce((e,t,i)=>(e[t]=i*n,e),{});return this.xBase=(e=>a[e]),this.regScale("columns",this.columnsScalesMap),{}}allocateRect(){return{slot:e=>this.config.options.container.selectAll(`.uid_${e}`),left:0,top:0,width:this.W,height:this.H,containerWidth:this.W,containerHeight:this.H}}drawFrames(e){var t=Object.assign({},this.config),i=t.options,r=this._fnDrawGrid(i.container,t,i.frameId,Object.keys(this.columnsScalesMap).reduce((e,t)=>e.concat([this.columnsScalesMap[t].getHash()]),[]).join("_")),n=r.selectAll(`.parent-frame-${i.frameId}`).data(e,e=>e.hash());n.exit().remove(),n.enter().append("g").attr("class",e=>`${O}cell cell parent-frame-${i.frameId} frame-${e.hash()}`).merge(n).each(function(e){var t,r,n,a;t=i.frameId,r=er.select(this),n=e,(a=r.selectAll(`.layer_${t}`).data(n.units,e=>e.uid)).exit().remove(),a.enter().append("g").attr("class",e=>`layer_${t} uid_${e.uid}`)});var a=this._fnDrawColumns(r,t);t.guide.enableBrushing&&this._enableBrushing(a)}_fnDrawGrid(e,t,i,r){var n=e.selectAll(`.grid_${i}`).data([r],e=>e);return n.exit().remove(),n.enter().append("g").attr("class",`grid grid_${i}`).attr("transform",E(this.L,this.T)).merge(n)}_fnDrawColumns(e,t){var i=t.guide.columns||{},r=this.xBase,n=this.columnsScalesMap,a=er.axisLeft(),s=e.selectAll(".column").data(t.columns,e=>e);return s.exit().remove(),s.enter().append("g").attr("class","column").attr("transform",e=>E(r(e),0)).call(function(e){e.append("g").attr("class","y axis").each(function(e){var t=n[e].dim,r=a.scale(n[e]),s=i[t]||{},o=fi.get(s.tickFormat,s.tickFormatNullAlias);null!==o&&r.tickFormat(o),er.select(this).call(r)}).append("text").attr("class","label").attr("text-anchor","middle").attr("y",-9).text(e=>((i[e]||{}).label||{}).text||n[e].dim)}).merge(s)}_enableBrushing(e){var t=this.columnsSelections,i=this.columnsScalesMap,r=this.columnsBrushes,n=!0,a=e=>e,o=e=>e,l=()=>{var e=Object.keys(r).find(e=>r[e]===s.event.target);if(t[e]=s.event.selection,n){var a=Object.keys(r).filter(e=>t[e]).map(e=>{var r=[];if(i[e].discrete){let n=t[e];r=i[e].domain().filter(t=>{var r=i[e](t);return n[0]<=r&&n[1]>=r})}else{let n=t[e].map(i[e].invert);r=[n[0],n[1]]}return{dim:i[e].dim,func:i[e].discrete?"inset":"between",args:r}});this.fire("brush",a)}};return e.selectAll(".brush").remove(),e.append("g").attr("class","brush").each(function(e){var t=i[e].range();r[e]=er.brushY().extent([[0,t[0]],[16,t[1]]]).on("start",a).on("brush",l).on("end",o),er.select(this).classed(`brush-${He(e)}`,!0).call(r[e]),n=!1,r[e].move(er.select(this),t),n=!0}).selectAll("rect").attr("transform","translate(-8,0)").attr("width",16),e}_forceBrushing(e={}){var t=this.columnsBrushes,i=this.columnsScalesMap;this.columnsSelections,Object.keys(e).filter(r=>t[r]&&i[r]&&e[r]).forEach(r=>{var n=e[r],a=[];if(i[r].discrete){var s=n.map(i[r]).filter(e=>e>=0),o=i[r].stepSize()/2;a=[Math.min(...s)-o,Math.max(...s)+o]}else a=[n[0],n[1]];var l=He(r);t[r](er.select(`.brush-${l}`)),t[r].move(er.select(`.brush-${l}`),a.map(i[r]))})}}).reg("ELEMENT.GENERIC.CARTESIAN",we).reg("ELEMENT.POINT",kr,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.LINE",on,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.PATH",nn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.AREA",rn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.INTERVAL",cn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.INTERVAL.STACKED",cn,"ELEMENT.GENERIC.CARTESIAN").reg("ELEMENT.INTERVAL.STACKED",cn,"ELEMENT.GENERIC.CARTESIAN").reg("PARALLEL/ELEMENT.LINE",class extends f{constructor(e){super(e),this.config=e,this.config.guide=st(this.config.guide||{},{}),this.on("highlight",(e,t)=>this.highlight(t))}defineGrammarModel(e){var t=this.config,i=t.options;this.color=e("color",t.color,{}),this.scalesMap=t.columns.reduce((t,r)=>(t[r]=e("pos",r,[0,i.height]),t),{});var r=i.width/(t.columns.length-1),n=t.columns.reduce((e,t,i)=>(e[t]=i*r,e),{});return this.xBase=(e=>n[e]),this.regScale("columns",this.scalesMap).regScale("color",this.color),{}}drawFrames(e){var t=this.config,i=this.config.options,r=this.scalesMap,n=this.xBase,a=this.color,s=dn.line(),o=function(e){e.attr("d",e=>s(t.columns.map(t=>[n(t),r[t](e[r[t].dim])])))},l=function(e){e.attr("stroke",e=>a.toColor(a(e[a.dim]))),e.attr("class",e=>`${O}__line line ${a.toClass(a(e[a.dim]))} foreground`)},c=function(e){var t=e.selectAll(".background").data(e=>e.part());t.exit().remove(),t.call(o),t.enter().append("path").attr("class","background line").call(o);var i=e.selectAll(".foreground").data(e=>e.part());i.exit().remove(),i.call(function(e){o(e),l(e)}),i.enter().append("path").call(function(e){o(e),l(e)})},d=i.container.selectAll(".lines-frame").data(e,e=>e.hash());d.exit().remove(),d.call(c),d.enter().append("g").attr("class","lines-frame").call(c),this.subscribe(i.container.selectAll(".lines-frame .foreground"))}highlight(e){this.config.options.container.selectAll(".lines-frame .foreground").style("visibility",t=>e(t)?"":"hidden")}}),Hn.scalesRegistry.reg("identity",class extends fn{constructor(e,t){super(e,t),this._references=t.references,this._refCounter=t.refCounter,this.addField("scaleType","identity")}create(){var e=this._references,t=this._refCounter;return this.toBaseScale((i,r)=>{if(null==i){var n=e.get(r);null==n&&(n=t(),e.set(r,n))}else n=i;return n})}},(e,t)=>st(e,{references:t.references,refCounter:t.refCounter})).reg("color",class extends fn{constructor(e,t){super(e,t);var i="measure"!==t.dimType,r=this.scaleConfig.brewer||(i?Qe(20).map(e=>"color20-"+(1+e)):["#eee","#000"]),n=this.scaleConfig;if(!i){var a=pn.extent(this.vars),s=e=>Number.isFinite(e)||$e(e),o=s(n.min)?n.min:a[0],l=s(n.max)?n.max:a[1],c=[o,a[0]].filter(s),d=[l,a[1]].filter(s);if(a=[c.sort((e,t)=>e-t)[0],d.sort((e,t)=>t-e)[0]],n.nice&&a[0]<0&&a[1]>0){let e=Math.max(...a.map(Math.abs));a=[-e,e]}this.vars=a}this.addField("scaleType","color").addField("discrete",i).addField("brewer",r).addField("toColor",qe).addField("toClass",Ye)}create(){var e=this.discrete,t=this.vars,i=this.getField("brewer"),r=e?this.createDiscreteScale(t,i):this.createContinuesScale(t,i);return this.toBaseScale(r)}createDiscreteScale(e,t){var i,r=(e,t)=>{var i=e.map(e=>String(e).toString());return pn.scaleOrdinal().range(t).domain(i)},n=e=>t=>e(String(t).toString());if(Array.isArray(t))i=n(r(e,t));else if("function"==typeof t)i=(i=>t(i,n(r(e,Qe(20).map(e=>"color20-"+(1+e))))));else{if(!ze(t))throw new Error("This brewer is not supported");i=((e,t)=>{var i=Object.keys(e),r=i.map(t=>e[t]),n=pn.scaleOrdinal().range(r).domain(i);return i=>e.hasOwnProperty(i)?n(String(i)):t(i)})(t,()=>"color-default")}return i}createContinuesScale(e,t){if(!Array.isArray(t))throw new Error("This brewer is not supported");return pn.scaleLinear().domain(Ge(e.map(e=>e-0),t.length)).range(t)}},(e,t)=>st(e,{nice:t.defaultNiceColor,brewer:"measure"===e.dimType?t.defaultColorBrewer:t.defaultClassBrewer})).reg("fill",class extends fn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=Mn.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];r=[Math.min(n,r[0]),Math.max(a,r[1])],this.vars=i.nice?Be(r):Mn.extent(r);var s=Qe(10).map(e=>`rgba(90,180,90,${(.2+e*(.8/9)).toFixed(2)})`),o=i.brewer||s;this.addField("scaleType","fill").addField("brewer",o)}isInDomain(e){var t=this.domain(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(){var e=this.vars,t=this.getField("brewer");if(!Array.isArray(t))throw new Error("This brewer is not supported");var i=t.length,r=(e[1]-e[0])/i,n=Qe(i-1).map(e=>e+1).reduce((t,i)=>t.concat([e[0]+i*r]),[]),a=Mn.scaleThreshold().domain(n).range(t);return this.toBaseScale(a)}}).reg("size",class extends fn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=o.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];this.vars=[Math.min(...[n,r[0]].filter(Number.isFinite)),Math.max(...[a,r[1]].filter(Number.isFinite))],this.addField("scaleType","size"),this.addField("funcType",t.func||"sqrt")}isInDomain(e){var t=this.domain().sort(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(){var e,t=this.scaleConfig,i=this.vars,r=st({},t,{func:"sqrt",minSize:0,maxSize:1}),n=r.func,a=r.minSize,s=r.maxSize,o=gn[n],l=i.filter(e=>Number.isFinite(Number(e)));if(0===l.length)e=(()=>s);else{var c,d,u=Math.min(...l),h=Math.max(...l),f=o(Math.max(Math.abs(u),Math.abs(h),h-u));d=u<0?u:0,c=0===f?1:(s-a)/f,e=(e=>{var t=null!==e?parseFloat(e):0;return Number.isFinite(t)?a+o(t-d)*c:s})}return this.toBaseScale(e)}}).reg("ordinal",class extends fn{constructor(e,t){super(e,t),this.addField("scaleType","ordinal").addField("discrete",!0)}create(e){var t=this.scaleConfig,i=this.vars,r=l.scalePoint().domain(i).range(e).padding(.5),n=Math.max(...e),a=e=>"function"==typeof t.ratio?t.ratio(e,n,i):"object"==typeof t.ratio?t.ratio[e]:1/i.length,s=e=>t.ratio?n-i.slice(i.indexOf(e)+1).reduce((e,t)=>e+n*a(t),n*a(e)*.5):r(e);return Object.keys(r).forEach(e=>s[e]=r[e]),s.stepSize=(e=>a(e)*n),this.toBaseScale(s,e)}}).reg("period",class extends fn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=this.vars,n=mn.extent(r),a=null===i.min||void 0===i.min?n[0]:new Date(i.min).getTime(),s=null===i.max||void 0===i.max?n[1]:new Date(i.max).getTime(),o=[new Date(Math.min(a,n[0])),new Date(Math.max(s,n[1]))],l=b.get(i.period,{utc:i.utcTime});i.fitToFrameByDims||null===l?this.vars=it(r.map(e=>new Date(e)),e=>e.getTime()).sort((e,t)=>Number(t)-Number(e)):this.vars=b.generate(o[0],o[1],i.period,{utc:i.utcTime}),this.periodGenerator=l,this.addField("scaleType","period").addField("utcTime",this.scaleConfig.utcTime).addField("period",this.scaleConfig.period).addField("discrete",!0)}isInDomain(e){const t=this.periodGenerator,i=new Date(e),r=(t?t.cast(i):i).getTime();return this.domain().map(e=>e.getTime()).indexOf(r)>=0}create(e){const t=this.periodGenerator;var i=this.vars,r=this.vars.map(e=>e.getTime()),n=this.scaleConfig,a=mn.scalePoint().domain(i).range(e).padding(.5),s=mn.scalePoint().domain(r.map(String)).range(e).padding(.5),o=Math.max(...e),l=e=>{var t=new Date(e).getTime();return"function"==typeof n.ratio?n.ratio(t,o,r):"object"==typeof n.ratio?n.ratio[t]:1/i.length},c=e=>{const i=new Date(e),a=(t?t.cast(i):i).getTime();return n.ratio?o-r.slice(r.indexOf(a)+1).reduce((e,t)=>e+o*l(t),o*l(e)*.5):s(String(a))};return Object.keys(a).forEach(e=>c[e]=a[e]),c.stepSize=(e=>l(e)*o),this.toBaseScale(c,e)}},(e,t)=>st(e,{utcTime:t.utcTime})).reg("time",class extends fn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=this.vars;const n=i.period?b.get(this.scaleConfig.period,{utc:i.utcTime}):null,a=yn.extent(r).map(n?e=>n.cast(new Date(e)):e=>new Date(e)),s=null==i.min?a[0]:new Date(i.min).getTime(),o=null==i.max?a[1]:new Date(i.max).getTime();if(r=[new Date(Math.min(s,Number(a[0]))),new Date(Math.max(o,Number(a[1])))],this.niceIntervalFn=null,i.nice&&!n){var l=i.niceInterval,c=l&&vn(l)?i.utcTime?yn[`utc${(d=l)[0].toUpperCase()}${d.slice(1)}`]:vn(l):null;this.niceIntervalFn=c||null,this.vars=Ie(r,this.niceIntervalFn,{utc:i.utcTime})}else this.vars=r;var d;if(n&&Number(this.vars[0])===Number(this.vars[1])){let e=this.vars[0];this.vars[0]=n.cast(new Date(Number(e)-1)),this.vars[1]=n.next(e)}this.periodGenerator=n,this.addField("scaleType","time").addField("utcTime",this.scaleConfig.utcTime).addField("period",this.scaleConfig.period)}isInDomain(e){var t=new Date(e);this.scaleConfig.period&&(t=this.periodGenerator.cast(t));var i=this.domain(),r=i[0],n=i[i.length-1];return!Number.isNaN(r)&&!Number.isNaN(n)&&t<=n&&t>=r}create(e){var t=this.vars,i=this.scaleConfig.utcTime;const r=this.periodGenerator,n=(i?yn.scaleUtc:yn.scaleTime)().domain(t).range(e);var a=e=>{var i=t[0],r=t[1];return e>r&&(e=r),e("number"!=typeof t&&(t=10),function(e,t,i,r=10){const[n,a]=e,s=b.get(t,{utc:i}),o=Number(n),l=Number(a),c=Number(s.next(s.cast(n)))-Number(s.cast(n));return(l-o)/c<=r?b.generate(n,a,t,{utc:i}).filter(e=>e>=n&&e<=a):function(e,t,i=10){const r=Number(e[0]),n=Number(e[1]),a=Math.abs(n-r)/i;var s,o;const l=yn.bisector(e=>e.duration).right(_n,a);if(l===_n.length)s=t?yn.utcYear:yn.timeYear,o=yn.tickStep(r/xn.year.duration,n/xn.year.duration,i);else if(l){let e=a/_n[l-1].duration,i=_n[l].duration/a,r=_n[e{let t=r.cast(e);return tl&&(t=l),n(t)})}return Object.keys(n).forEach(e=>a[e]=n[e]),a.stepSize=(()=>0),this.toBaseScale(a,e)}},(e,t)=>st(e,{utcTime:t.utcTime})).reg("linear",class extends fn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=wn.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];if(r=[Math.min(...[n,r[0]].filter(Number.isFinite)),Math.max(...[a,r[1]].filter(Number.isFinite))],this.vars=i.nice?Be(r):wn.extent(r),this.vars[0]===this.vars[1]){var s=Math.pow(10,Math.floor(Math.log(this.vars[0])/Math.LN10));this.vars[0]-=s,this.vars[1]+=s||10}this.addField("scaleType","linear").addField("discrete",!1)}isInDomain(e){var t=this.domain(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(e){var t=this.vars,i=this.extendScale(wn.scaleLinear());return i.domain(t).range(e).clamp(!0),this.toBaseScale(i,e)}extendScale(e){var t=e.copy,i=e.ticks;return Object.assign(e,{stepSize:()=>0,copy:()=>this.extendScale(t.call(e)),ticks:this.getField("isInteger")?t=>i.call(e,t).filter(Number.isInteger):e.ticks}),e}}).reg("logarithmic",class extends fn{constructor(e,t){super(e,t);var i=this.scaleConfig,r=En.extent(this.vars),n=Number.isFinite(i.min)?i.min:r[0],a=Number.isFinite(i.max)?i.max:r[1];Tn(r=[Math.min(...[n,r[0]].filter(Number.isFinite)),Math.max(...[a,r[1]].filter(Number.isFinite))]),i.nice&&(r=function(e){var t=e[0]>0,i=e.map(e=>Math.abs(e)),r=Math.max(...i),n=Math.min(...i).toExponential().split("e"),a=r.toExponential().split("e"),s=parseFloat(Math.floor(Number(n[0]))+"e"+n[1]),o=parseFloat(Math.ceil(Number(a[0]))+"e"+a[1]);return t?[s,o]:[-o,-s]}(r)),this.vars=r,this.addField("scaleType","logarithmic").addField("discrete",!1)}isInDomain(e){var t=this.domain(),i=t[0],r=t[t.length-1];return!Number.isNaN(i)&&!Number.isNaN(r)&&e<=r&&e>=i}create(e){var t=this.vars;Tn(t);var i=function e(t){var i=t.copy;return t.ticks=function(e){var i=[],r=En.extent(t.domain()),n=Math.floor(Sn(r[0])),a=Math.ceil(Sn(r[1])),s=Math.ceil(10*(a-n)/(10*Math.ceil(e/10)));for(let e=n;e<=a;e+=s)for(let t=1;t<=10;t++){let n=Math.pow(t,s)*Math.pow(10,e);(n=parseFloat(n.toExponential(0)))>=r[0]&&n<=r[1]&&i.push(n)}return i},t.copy=function(){var r=i.call(t);return e(r),r},t}(En.scaleLog()).domain(t).range(e);return i.stepSize=(()=>0),this.toBaseScale(i,e)}}).reg("value",class extends fn{constructor(e,t){super(e,t),this.addField("scaleType","value").addField("georole",t.georole)}create(){return this.toBaseScale(e=>e)}});var Wn=[e=>e.data?[]:["[data] must be specified"]];Hn.chartTypesRegistry.add("scatterplot",e=>{return Rn("ELEMENT.POINT",Ln(e))},Wn).add("line",e=>{var t=Ln(e),i=t.data,r=t.settings.log,n={none:()=>null,horizontal:e=>e.x[e.x.length-1],vertical:e=>e.y[e.y.length-1],auto:e=>{var t,n=e.x,a=e.y,s=n[n.length-1],o=n.slice(0,n.length-1),l=a[a.length-1],c=a.slice(0,a.length-1),d=e.color,u=o.concat(c).concat([d]).filter(e=>null!==e),h=-1,f=[[[s].concat(u),l],[[l].concat(u),s]];return f.some((e,t)=>{var n=e[0],a=e[1],s=ri.isYFunctionOfX(i,n,[a]);return s.result?h=t:r(["Attempt to find a functional relation between",e[0]+" and "+e[1]+" is failed.","There are several "+s.error.keyY+" values (e.g. "+s.error.errY.join(",")+")","for ("+s.error.keyX+" = "+s.error.valX+")."].join(" ")),s.result})?t=f[h][0][0]:(r(["All attempts are failed.","Will orient line horizontally by default.","NOTE: the [scatterplot] chart is more convenient for that data."].join(" ")),t=s),t}},a=(t.lineOrientation||"").toLowerCase(),s=(n.hasOwnProperty(a)?n[a]:n.auto)(t);return null!==s&&(t.data=ri.sortByDim(i,s,t.dimensions[s])),Rn("ELEMENT.LINE",t)},Wn).add("area",Dn,Wn).add("stacked-area",e=>Dn(st(e,{stack:!0})),Wn).add("bar",e=>Fn(st(e,{flip:!1})),Wn).add("horizontalBar",e=>Fn(st({flip:!0},e)),Wn).add("horizontal-bar",e=>Fn(st({flip:!0},e)),Wn).add("stacked-bar",e=>Fn(st({flip:!1,stack:!0},e)),Wn).add("horizontal-stacked-bar",e=>Fn(st({flip:!0,stack:!0},e)),Wn).add("map",e=>{let t=Object.assign({sourcemap:e.settings.defaultSourceMap},e.guide||{});t.size=st(t.size||{},{min:1,max:10}),t.code=st(t.code||{},{georole:"countries"});var i={},r=(e,t,r={})=>{var n,a,s=t;return t?(n=`${e}_${t}`,a="/"):(n=`${e}:default`,a="?"),i.hasOwnProperty(n)||(i[n]=Object.assign({type:e,source:a,dim:s},r)),n};return{sources:{"?":{dims:{},data:[{}]},"/":{dims:Object.keys(e.dimensions).reduce((t,i)=>(t[i]={type:e.dimensions[i].type},t),{}),data:e.data}},scales:i,unit:{type:"COORDS.MAP",expression:{operator:"none",source:"/"},code:r("value",e.code,t.code),fill:r("fill",e.fill,t.fill),size:r("size",e.size,t.size),color:r("color",e.color,t.color),latitude:r("linear",e.latitude,{nice:!1}),longitude:r("linear",e.longitude,{nice:!1}),guide:t},plugins:e.plugins||[]}},Wn.concat([e=>{var t=e.fill&&e.code;if(e.fill&&!t)return"[code] must be specified when using [fill]"},e=>{var t=e.latitude&&e.longitude;if((e.latitude||e.longitude)&&!t)return"[latitude] and [longitude] both must be specified"}])).add("parallel",e=>{var t=Object.assign({columns:{}},e.guide||{}),i={},r=(e,t,r={})=>{var n,a,s=t;return t?(n=`${e}_${t}`,a="/"):(n=`${e}:default`,a="?"),i.hasOwnProperty(n)||(i[n]=Object.assign({type:e,source:a,dim:s},r)),n},n=e.columns.map(i=>r(e.dimensions[i].scale,i,t.columns[i]));return{sources:{"?":{dims:{},data:[{}]},"/":{dims:Object.keys(e.dimensions).reduce((t,i)=>(t[i]={type:e.dimensions[i].type},t),{}),data:e.data}},scales:i,unit:{type:"COORDS.PARALLEL",expression:{operator:"none",source:"/"},columns:n,guide:t,units:[{type:"PARALLEL/ELEMENT.LINE",color:r("color",e.color,t.color),columns:n,expression:{operator:"none",source:"/"}}]},plugins:e.plugins||[]}},Wn.concat([e=>{if(!(e.columns&&e.columns.length>1))return"[columns] property must contain at least 2 dimensions"}]));const Un="2.7.0";t.default={GPL:Ut,Plot:Xi,Chart:Ji,api:Hn,version:"2.7.0"}},function(e,i){e.exports=t},function(e,t){e.exports=i},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=a},function(e,t){e.exports=s},function(e,t){e.exports=o},function(e,t){e.exports=l},function(e,t,i){var r,n,a;n=[],void 0===(a="function"==typeof(r=function(){return function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={exports:{},id:r,loaded:!1};return e[r].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}return i.m=e,i.c=t,i.p="",i(0)}([function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e,t){return e.indexOf(t)},r=window,n=r.document,a=n.documentElement,s=["top","bottom"];function o(e,t){for(var i in t)e[i]=t[i];return e}function l(e){var t,i=r.pageYOffset||a.scrollTop,n=r.pageXOffset||a.scrollLeft,s={left:0,right:0,top:0,bottom:0,width:0,height:0};if((t=e)&&null!=t.setInterval)s.width=r.innerWidth||a.clientWidth,s.height=r.innerHeight||a.clientHeight;else{if(!a.contains(e)||null==e.getBoundingClientRect)return s;o(s,e.getBoundingClientRect()),s.width=s.right-s.left,s.height=s.bottom-s.top}return s.top=s.top+i-a.clientTop,s.left=s.left+n-a.clientLeft,s.right=s.left+s.width,s.bottom=s.top+s.height,s}var c=function(e,t){return r.getComputedStyle(e)[t]};function d(e){var t=String(c(e,d.propName)),i=t.match(/([0-9.]+)([ms]{1,2})/);return i&&(t=Number(i[1]),"s"===i[2]&&(t*=1e3)),0|t}d.propName=function(){for(var e=n.createElement("div"),t=["transitionDuration","webkitTransitionDuration"],i=0;i=t.bottom&&(n[0]="top"),n[1]){case"left":e.right-this.width<=t.left&&(n[1]="right");break;case"right":e.left+this.width>=t.right&&(n[1]="left");break;default:e.left+e.width/2+this.width/2>=t.right?n[1]="left":e.right-e.width/2-this.width/2<=t.left&&(n[1]="right")}else switch(e.left-this.width-a<=t.left?n[0]="right":e.right+this.width+a>=t.right&&(n[0]="left"),n[1]){case"top":e.bottom-this.height<=t.top&&(n[1]="bottom");break;case"bottom":e.top+this.height>=t.bottom&&(n[1]="top");break;default:e.top+e.height/2+this.height/2>=t.bottom?n[1]="top":e.bottom-e.height/2-this.height/2<=t.top&&(n[1]="bottom")}return n.join("-")},h.prototype.position=function(e,t){this.attachedTo&&(e=this.attachedTo),null==e&&this._p?(e=this._p[0],t=this._p[1]):this._p=arguments;var i,r,n="number"==typeof e?{left:0|e,right:0|e,top:0|t,bottom:0|t,width:0,height:0}:l(e),a=this.spacing,s=this._pickPlace(n);switch(s!==this.curPlace&&(this.curPlace&&this.classes.remove(this.curPlace),this.classes.add(s),this.curPlace=s),this.curPlace){case"top":i=n.top-this.height-a,r=n.left+n.width/2-this.width/2;break;case"top-left":i=n.top-this.height-a,r=n.right-this.width;break;case"top-right":i=n.top-this.height-a,r=n.left;break;case"bottom":i=n.bottom+a,r=n.left+n.width/2-this.width/2;break;case"bottom-left":i=n.bottom+a,r=n.right-this.width;break;case"bottom-right":i=n.bottom+a,r=n.left;break;case"left":i=n.top+n.height/2-this.height/2,r=n.left-this.width-a;break;case"left-top":i=n.bottom-this.height,r=n.left-this.width-a;break;case"left-bottom":i=n.top,r=n.left-this.width-a;break;case"right":i=n.top+n.height/2-this.height/2,r=n.right+a;break;case"right-top":i=n.bottom-this.height,r=n.right+a;break;case"right-bottom":i=n.top,r=n.right+a}return this.element.style.top=Math.round(i)+"px",this.element.style.left=Math.round(r)+"px",this},h.prototype.show=function(e,t){return e=this.attachedTo?this.attachedTo:e,clearTimeout(this.aIndex),null!=e&&this.position(e,t),this.hidden&&(this.hidden=0,n.body.appendChild(this.element)),this.attachedTo&&this._aware(),this.options.inClass&&(this.options.effectClass&&this.element.clientHeight,this.classes.add(this.options.inClass)),this},h.prototype.getElement=function(){return this.element},h.prototype.hide=function(){if(!this.hidden){var e=this,t=0;return this.options.inClass&&(this.classes.remove(this.options.inClass),this.options.effectClass&&(t=d(this.element))),this.attachedTo&&this._unaware(),clearTimeout(this.aIndex),this.aIndex=setTimeout(function(){e.aIndex=0,n.body.removeChild(e.element),e.hidden=1},t),this}},h.prototype.toggle=function(e,t){return this[this.hidden?"show":"hide"](e,t)},h.prototype.destroy=function(){clearTimeout(this.aIndex),this._unaware(),this.hidden||n.body.removeChild(this.element),this.element=this.options=null},h.prototype._aware=function(){-1===i(h.winAware,this)&&h.winAware.push(this)},h.prototype._unaware=function(){var e=i(h.winAware,this);-1!==e&&h.winAware.splice(e,1)},h.reposition=function(){var e,t=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e){return setTimeout(e,17)};function i(){e=0;for(var t=0,i=h.winAware.length;t0)-(e<0)||Number(e)}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,i=Object(this),r=i.length>>>0,n=arguments[1],a=0;a>>0,n=arguments[1],a=0;a0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),s)},function(e){var t=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var i,r=arguments.length>1?arguments[1]:void 0;if(void 0!==r){if(!a(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(i=arguments[2])}for(var n,s=o(t.length),l=a(this)?Object(new this(s)):new Array(s),c=0;ce[String(t++)]=i),e.length=t,e},configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(Map.prototype,"entries",{value:function(){var e={},t=0;return this.forEach((i,r)=>e[String(t++)]=[r,i]),e.length=t,e},configurable:!0,enumerable:!1,writable:!0})}Object.assign||Object.defineProperty(Object,"assign",{value:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),i=1;i]*>/,"");var t=new ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}try{var a=i.xmldom?new r.DOMParser(i.xmldom):new r.DOMParser;return a.parseFromString(e,"image/svg+xml")}catch(t){return(a=i.xmldom?new r.DOMParser(i.xmldom):new r.DOMParser).parseFromString(e,"text/xml")}},s.Property=function(e,t){this.name=e,this.value=t},s.Property.prototype.getValue=function(){return this.value},s.Property.prototype.hasValue=function(){return null!=this.value&&""!==this.value},s.Property.prototype.numValue=function(){if(!this.hasValue())return 0;var e=parseFloat(this.value);return(this.value+"").match(/%$/)&&(e/=100),e},s.Property.prototype.valueOrDefault=function(e){return this.hasValue()?this.value:e},s.Property.prototype.numValueOrDefault=function(e){return this.hasValue()?this.numValue():e},s.Property.prototype.addOpacity=function(t){var i=this.value;if(null!=t.value&&""!=t.value&&"string"==typeof this.value){var r=new e(this.value);r.ok&&(i="rgba("+r.r+", "+r.g+", "+r.b+", "+t.numValue()+")")}return new s.Property(this.name,i)},s.Property.prototype.getDefinition=function(){var e=this.value.match(/#([^\)'"]+)/);return e&&(e=e[1]),e||(e=this.value),s.Definitions[e]},s.Property.prototype.isUrlDefinition=function(){return 0==this.value.indexOf("url(")},s.Property.prototype.getFillStyleDefinition=function(e,t){var i=this.getDefinition();if(null!=i&&i.createGradient)return i.createGradient(s.ctx,e,t);if(null!=i&&i.createPattern){if(i.getHrefAttribute().hasValue()){var r=i.attribute("patternTransform");i=i.getHrefAttribute().getDefinition(),r.hasValue()&&(i.attribute("patternTransform",!0).value=r.value)}return i.createPattern(s.ctx,e)}return null},s.Property.prototype.getDPI=function(e){return 96},s.Property.prototype.getREM=function(e){return s.rootEmSize},s.Property.prototype.getEM=function(e){return s.emSize},s.Property.prototype.getUnits=function(){var e=this.value+"";return e.replace(/[0-9\.\-]/g,"")},s.Property.prototype.isPixels=function(){if(!this.hasValue())return!1;var e=this.value+"";return!!e.match(/px$/)||!!e.match(/^[0-9]+$/)},s.Property.prototype.toPixels=function(e,t){if(!this.hasValue())return 0;var i=this.value+"";if(i.match(/rem$/))return this.numValue()*this.getREM(e);if(i.match(/em$/))return this.numValue()*this.getEM(e);if(i.match(/ex$/))return this.numValue()*this.getEM(e)/2;if(i.match(/px$/))return this.numValue();if(i.match(/pt$/))return this.numValue()*this.getDPI(e)*(1/72);if(i.match(/pc$/))return 15*this.numValue();if(i.match(/cm$/))return this.numValue()*this.getDPI(e)/2.54;if(i.match(/mm$/))return this.numValue()*this.getDPI(e)/25.4;if(i.match(/in$/))return this.numValue()*this.getDPI(e);if(i.match(/%$/))return this.numValue()*s.ViewPort.ComputeSize(e);var r=this.numValue();return t&&r<1?r*s.ViewPort.ComputeSize(e):r},s.Property.prototype.toMilliseconds=function(){if(!this.hasValue())return 0;var e=this.value+"";return e.match(/s$/)?1e3*this.numValue():(e.match(/ms$/),this.numValue())},s.Property.prototype.toRadians=function(){if(!this.hasValue())return 0;var e=this.value+"";return e.match(/deg$/)?this.numValue()*(Math.PI/180):e.match(/grad$/)?this.numValue()*(Math.PI/200):e.match(/rad$/)?this.numValue():this.numValue()*(Math.PI/180)};var o={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 s.Property.prototype.toTextBaseline=function(){return this.hasValue()?o[this.value]:null},s.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(e,t,i,r,n,a){var o=null!=a?this.Parse(a):this.CreateFont("","","","","",s.ctx.font);return{fontFamily:n=n||o.fontFamily,fontSize:r||o.fontSize,fontStyle:e||o.fontStyle,fontWeight:i||o.fontWeight,fontVariant:t||o.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var e=this;this.Parse=function(t){for(var i={},r=s.trim(s.compressSpaces(t||"")).split(" "),n={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1},a="",o=0;othis.x2&&(this.x2=e)),null!=t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),tthis.y2&&(this.y2=t))},this.addX=function(e){this.addPoint(e,null)},this.addY=function(e){this.addPoint(null,e)},this.addBoundingBox=function(e){this.addPoint(e.x1,e.y1),this.addPoint(e.x2,e.y2)},this.addQuadraticCurve=function(e,t,i,r,n,a){var s=e+2/3*(i-e),o=t+2/3*(r-t),l=s+1/3*(n-e),c=o+1/3*(a-t);this.addBezierCurve(e,t,s,l,o,c,n,a)},this.addBezierCurve=function(e,t,i,r,n,a,s,o){var l=[e,t],c=[i,r],d=[n,a],u=[s,o];this.addPoint(l[0],l[1]),this.addPoint(u[0],u[1]);for(var h=0;h<=1;h++){var f=function(e){return Math.pow(1-e,3)*l[h]+3*Math.pow(1-e,2)*e*c[h]+3*(1-e)*Math.pow(e,2)*d[h]+Math.pow(e,3)*u[h]},p=6*l[h]-12*c[h]+6*d[h],g=-3*l[h]+9*c[h]-9*d[h]+3*u[h],m=3*c[h]-3*l[h];if(0!=g){var b=Math.pow(p,2)-4*m*g;if(!(b<0)){var y=(-p+Math.sqrt(b))/(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 e=new s.Point(this.getScalar(),this.getScalar());return this.makeAbsolute(e)},this.getAsControlPoint=function(){var e=this.getPoint();return this.control=e},this.getAsCurrentPoint=function(){var e=this.getPoint();return this.current=e},this.getReflectedControlPoint=function(){return"c"!=this.previousCommand.toLowerCase()&&"s"!=this.previousCommand.toLowerCase()&&"q"!=this.previousCommand.toLowerCase()&&"t"!=this.previousCommand.toLowerCase()?this.current:new s.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)},this.makeAbsolute=function(e){return this.isRelativeCommand()&&(e.x+=this.current.x,e.y+=this.current.y),e},this.addMarker=function(e,t,i){null!=i&&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+e;var t=!1;if(this.begin~\.\[:]+)/g,c=/(\.[^\s\+>~\.\[:]+)/g,d=/(::[^\s\+>~\.\[:]+|:first-line|:first-letter|:before|:after)/gi,u=/(:[\w-]+\([^\)]*\))/gi,h=/(:[^\s\+>~\.\[:]+)/g,f=/([^\s\+>~\.\[:]+)/g;function p(e){var t=[0,0,0],i=function(i,r){var n=e.match(i);null!=n&&(t[r]+=n.length,e=e.replace(i," "))};return e=(e=e.replace(/:not\(([^\)]*)\)/g," $1 ")).replace(/{[\s\S]*/gm," "),i(o,1),i(l,0),i(c,1),i(d,2),i(u,1),i(h,1),e=(e=e.replace(/[\*\s\+>~]/g," ")).replace(/[#\.]/g," "),i(f,2),t.join("")}"undefined"!=typeof CanvasRenderingContext2D&&(CanvasRenderingContext2D.prototype.drawSvg=function(e,t,i,r,n,a){var o={ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:t,offsetY:i,scaleWidth:r,scaleHeight:n};for(var l in a)a.hasOwnProperty(l)&&(o[l]=a[l]);s(this.canvas,e,o)}),i.exports=s}(i={exports:{}}),i.exports}(i(22),i(23))},function(e,t,i){(function(i){var r,n,a;n=[],void 0===(a="function"==typeof(r=function(){"use strict";function t(e,t,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){s(r.response,t,i)},r.onerror=function(){console.error("could not download file")},r.send()}function r(e){var t=new XMLHttpRequest;return t.open("HEAD",e,!1),t.send(),200<=t.status&&299>=t.status}function n(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof i&&i.global===i?i:void 0,s=a.saveAs||("object"!=typeof window||window!==a?function(){}:"download"in HTMLAnchorElement.prototype?function(e,i,s){var o=a.URL||a.webkitURL,l=document.createElement("a");i=i||e.name||"download",l.download=i,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?n(l):r(l.href)?t(e,i,s):n(l,l.target="_blank")):(l.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(l.href)},4e4),setTimeout(function(){n(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,i,a){if(i=i||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}(e,a),i);else if(r(e))t(e,i,a);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){n(s)})}}:function(e,i,r,n){if((n=n||open("","_blank"))&&(n.document.title=n.document.body.innerText="downloading..."),"string"==typeof e)return t(e,i,r);var s="application/octet-stream"===e.type,o=/constructor/i.test(a.HTMLElement)||a.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&o)&&"object"==typeof FileReader){var c=new FileReader;c.onloadend=function(){var e=c.result;e=l?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=e:location=e,n=null},c.readAsDataURL(e)}else{var d=a.URL||a.webkitURL,u=d.createObjectURL(e);n?n.location=u:location.href=u,n=null,setTimeout(function(){d.revokeObjectURL(u)},4e4)}});a.saveAs=s.saveAs=s,e.exports=s})?r.apply(t,n):r)||(e.exports=a)}).call(this,i(24))},function(e,t,i){(e.exports=i(25)(!1)).push([e.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(e,t,i){e.exports=i(26)},function(e,t){e.exports=function(e){this.ok=!1,this.alpha=1,"#"==e.charAt(0)&&(e=e.substr(1,6)),e=(e=e.replace(/ /g,"")).toLowerCase();var t={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"};e=t[e]||e;for(var i=[{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(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3]),parseFloat(e[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(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,example:["#00ff00","336699"],process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,example:["#fb0","f0f"],process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}],r=0;r3&&(this.alpha=o[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 e=this.r.toString(16),t=this.g.toString(16),i=this.b.toString(16);return 1==e.length&&(e="0"+e),1==t.length&&(t="0"+t),1==i.length&&(i="0"+i),"#"+e+t+i},this.getHelpXML=function(){for(var e=new Array,r=0;r "+c.toRGB()+" -> "+c.toHex());l.appendChild(d),l.appendChild(u),o.appendChild(l)}catch(e){}return o}}},function(e,t){var i=[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 n(e,t,i,r,n){if("string"==typeof e)e=document.getElementById(e);else if("undefined"!=typeof HTMLCanvasElement&&!e instanceof HTMLCanvasElement)return;var a,s=e.getContext("2d");try{try{a=s.getImageData(t,i,r,n)}catch(e){throw new Error("unable to access local image data: "+e)}}catch(e){throw new Error("unable to access image data: "+e)}return a}function a(e,t,i,r,a,o){if(!(isNaN(o)||o<1)){o|=0;var l=n(e,t,i,r,a);l=s(l,t,i,r,a,o),e.getContext("2d").putImageData(l,t,i)}}function s(e,t,n,a,s,o){var l,d,u,h,f,p,g,m,b,y,v,x,_,w,E,S,T,M,C,k,A,P,O,N,L=e.data,R=o+o+1,F=a-1,D=s-1,$=o+1,z=$*($+1)/2,B=new c,I=B;for(u=1;u>U,0!=O?(O=255/O,L[p]=(m*W>>U)*O,L[p+1]=(b*W>>U)*O,L[p+2]=(y*W>>U)*O):L[p]=L[p+1]=L[p+2]=0,m-=x,b-=_,y-=w,v-=E,x-=V.r,_-=V.g,w-=V.b,E-=V.a,h=g+((h=l+o+1)>U,O>0?(O=255/O,L[h]=(m*W>>U)*O,L[h+1]=(b*W>>U)*O,L[h+2]=(y*W>>U)*O):L[h]=L[h+1]=L[h+2]=0,m-=x,b-=_,y-=w,v-=E,x-=V.r,_-=V.g,w-=V.b,E-=V.a,h=l+((h=d+$)>j,A[p+1]=b*I>>j,A[p+2]=y*I>>j,m-=v,b-=x,y-=_,v-=z.r,x-=z.g,_-=z.b,h=g+((h=l+o+1)>j,A[h+1]=b*I>>j,A[h+2]=y*I>>j,m-=v,b-=x,y-=_,v-=z.r,x-=z.g,_-=z.b,h=l+((h=d+L)t.hasOwnProperty(i)?t[i]:"")}var s=r.default.api.utils,o=r.default.api.pluginsSDK,l=function(e,t,i){"front"===i?e.push(t):e.unshift(t)},c=function(e){return function(t){var i={},n=[{dim:t.scaleX.dim,scale:t.scaleY,method:"yi"},{dim:t.scaleY.dim,scale:t.scaleX,method:"xi"},{dim:null,scale:null,method:null,k:null}].find(function(t){return Array.isArray(e.dim)?e.dim.indexOf(t.dim)>=0:t.dim===e.dim});if(null===n.method)return i;var a={l:-.5,r:.5},s=n.method,o=n.scale;return i[s]=function(e){var i=a[e.__pos__]||0;if(o.discrete)return t[s](e)+o.stepSize(e[o.dim])*i;if(o.period){const t=r.default.api.tickPeriod.get(o.period,{utc:o.utcTime}),i=o.domain();let n=t.cast(i[0]);for(;nt.settings.log(e,"LOG");this._dataRefs={},t.transformations.dataRange=((n,s)=>{var o=s.from,l=s.to,c=e.getScaleInfo(s.primaryScale),d=c.domain();if(c.period){var u=r.default.api.tickPeriod.get(c.period,{utc:t.settings.utcTime});o=u.cast(new Date(s.from)),l=u.cast(new Date(s.to))}o=null===o?d[0]:o,l=null===l?d[d.length-1]:l;var h=!c.isInDomain(o),f=!c.isInDomain(l);if(c.discrete?h||f:h&&f)return i("Annotation is out of domain"),[];var p=e.getScaleInfo(s.secondaryScale),g=p.domain(),m=[g[0],g[g.length-1]],b=c.dim,y=p.dim,v="__pos__",x={},_={},w={},E={};x[v]="l",x[b]=o,x[y]=m[0],_[v]="l",_[b]=l,_[y]=m[0],w[v]="r",w[b]=l,w[y]=m[1],E[v]="r",E[b]=o,E[y]=m[1];const S="y"===s.axis?w:E,T="y"===s.axis?E:w,M=this._getFormat(b);return s.startText&&(S.text=a(s.startText,{value:M(S[b])})),s.endText&&(T.text=a(s.endText,{value:M(T[b])})),this._useSavedDataRefs([x,_,w,E],String([b,o,l]))}),t.transformations.dataLimit=((n,s)=>{var o=s.primaryScale,l=s.secondaryScale,c=e.getScaleInfo(o),d=c.period?r.default.api.tickPeriod.get(c.period,{utc:t.settings.utcTime}).cast(new Date(s.from)):s.from;if(!c.isInDomain(d))return i("Annotation is out of domain"),[];var u=e.getScaleInfo(l),h=u.domain(),f=[h[0],h[h.length-1]],p={},g={},m=c.dim,b=u.dim,y="__pos__";const v=this._getFormat(m);return p[m]=d,p[b]=f[0],p[y]="l",s.startText&&(p.text=a(s.startText,{value:v(d)})),g[m]=d,g[b]=f[1],g[y]="r",s.endText&&(g.text=a(s.endText,{value:v(d)})),this._useSavedDataRefs([p,g],String([m,b,d]))}),t.transformations.lineNoteData=((t,n)=>{const s=n.xScale,o=n.yScale,l=e.getScaleInfo(s),c=e.getScaleInfo(o),d=l.period?r.default.api.tickPeriod.get(l.period,{utc:l.utcTime}):null,u=c.period?r.default.api.tickPeriod.get(c.period,{utc:c.utcTime}):null,h=n.points.map(e=>[d?d.cast(e[0]):e[0],u?u.cast(e[1]):e[1]]);if(h.some(e=>!l.isInDomain(e[0])||!c.isInDomain(e[1])))return i("Annotation is out of domain"),[];const f=l.dim,p=c.dim,g=[f,p].map(e=>this._getFormat(e)),m=h.map((e,t)=>{0===t||h.length;const i=0===t?n.startText:t===h.length-1?n.endText:"";return{[f]:e[0],[p]:e[1],text:i?a(i,{x:g[0](e[0]),y:g[1](e[1])}):null}});return this._useSavedDataRefs(m,JSON.stringify([f,p,n.points]))})},addAreaNote:function(e,t,i){var r=e.scales[t.x],n=e.scales[t.y],a=i.dim===r.dim?["x","y"]:i.dim===n.dim?["y","x"]:null;if(null===a)return void(t=>e.settings.log(t,"LOG"))("Annotation doesn't match any data field");var s=i.val[0],o=i.val[1];const d=i.text;var u={type:"ELEMENT.PATH",namespace:"annotations",x:t.x,y:t.y,color:i.colorScaleName,label:"annotation_text",expression:{inherit:!1,operator:"none",params:[],source:"/"},transformModel:[c(i)],transformation:[{type:"dataRange",args:{axis:a[0],startText:"string"==typeof d?d:d.start,endText:"string"==typeof d?"":d.end,from:s,to:o,primaryScale:t[a[0]],secondaryScale:t[a[1]]}}],guide:{animationSpeed:t.guide.animationSpeed,showAnchors:"never",cssClass:"tau-chart__annotation-area",label:{fontColor:i.color,position:["r","b","keep-in-box"]}}};l(t.units,u,i.position)},addLineNote:function(e,t,i){var r=e.scales[t.x],n=e.scales[t.y];let a,s=null,o=!0;if(Array.isArray(i.dim)?(o=!1,((a=i.dim)[0]===r.dim&&a[1]===n.dim||a[0]===n.dim&&a[1]===r.dim)&&(s=["x","y"])):i.dim===r.dim?s=["x","y"]:i.dim===n.dim&&(s=["y","x"]),null===s)return void(t=>e.settings.log(t,"LOG"))("Annotation doesn't match any field");var d=i.text,u={type:"ELEMENT.LINE",namespace:"annotations",x:t.x,y:t.y,label:"annotation_text",color:i.colorScaleName,expression:{inherit:!1,operator:"none",params:[],source:"/"},guide:{animationSpeed:t.guide.animationSpeed,showAnchors:"never",widthCssClass:"tau-chart__line-width-2",cssClass:"tau-chart__annotation-line",label:{fontColor:i.color,position:o?["r","b","keep-in-box"]:["auto:avoid-label-edges-overlap","auto:adjust-on-label-overflow","keep-in-box"]},x:{fillGaps:!1},y:{fillGaps:!1}}};let h=o?{transformModel:[c(i)],transformation:[{type:"dataLimit",args:{from:i.val,startText:"string"==typeof d?"":d.start,endText:"string"==typeof d?d:d.end,primaryScale:t[s[0]],secondaryScale:t[s[1]]}}]}:{transformation:[{type:"lineNoteData",args:{points:a[0]===r.dim?i.val:i.val.map(e=>e.slice().reverse()),startText:"string"==typeof d?"":d.start,endText:"string"==typeof d?d:d.end,xScale:t.x,yScale:t.y}}]};Object.assign(u,h),l(t.units,u,i.position)},onRender(){this._clearUnusedDataRefs()},onSpecReady(e,i){var r=this,a=[];this._setupAdditionalSeries(),this._startWatchingDataRefs(),e.traverseSpec(i,function(e){e&&"COORDS.RECT"===e.type&&e.units&&a.push(e)}),this._formatters=o.getFieldFormatters(i,t.formatters);var s=o.spec(i);a.forEach(function(e){t.items.map(function(e,t){var i=(e.color||"#BD10E0").toLowerCase(),r=n.rgb(i).toString();"black"!==i&&"rgb(0, 0, 0)"===r&&(r=null);var a=r||i,o="annotation_color_"+t;return s.addScale(o,{type:"color",source:"?",brewer:[a]}),{dim:e.dim,val:e.val,text:e.text,color:a,position:e.position,colorScaleName:o}}).forEach(function(t){Array.isArray(t.dim)?Array.isArray(t.val)&&t.val.every(Array.isArray)?r.addLineNote(i,e,t):(e=>i.settings.log(e,"LOG"))("Point annotation is not implemented yet"):Array.isArray(t.val)?r.addAreaNote(i,e,t):r.addLineNote(i,e,t)})})},_setupAdditionalSeries:function(){const e=this._chart,i=e.getSpec(),r=e.getDataSources()["/"].data,n=this._getAnnotatedDimValues(t.items);Object.keys(n).forEach(e=>{[`x_${e}`,`y_${e}`].forEach(t=>{if(t in i.scales){const a=i.scales[t],o=r.map(t=>t[e]),l=["period","time"].indexOf(a.type)>=0?n[e].map(e=>new Date(e)):n[e];a.series=s.unique(o.concat(l))}})})},_getFormat(e){return this._formatters[e]?this._formatters[e].format:e=>String(e)},_useSavedDataRefs(e,t){const i=this._dataRefs;return this._usedDataRefsKeys.add(t),t in i?(i[t].forEach((t,i)=>Object.assign(t,e[i])),i[t]):(i[t]=e,e)},_startWatchingDataRefs(){const e=this._dataRefs;this._initialDataRefsKeys=new Set(Object.keys(e)),this._usedDataRefsKeys=new Set},_clearUnusedDataRefs(){const e=this._dataRefs,t=this._initialDataRefsKeys,i=this._usedDataRefsKeys;Array.from(t).filter(e=>!i.has(e)).forEach(t=>delete e[t]),this._initialDataRefsKeys=null,this._usedDataRefsKeys=null},_getDataRowsFromItems(e){const t=(e,t)=>e.reduce((e,i,r)=>(e[i]=t[r],e),{});return e.reduce((e,i)=>(Array.isArray(i.dim)?Array.isArray(i.val)&&i.val.every(Array.isArray)&&i.val.forEach(r=>{e.push(t(i.dim,r))}):Array.isArray(i.val)?i.val.forEach(r=>{e.push(t([i.dim],[r]))}):e.push(t([i.dim],[i.val])),e),[])},_getAnnotatedDimValues(e){const t=this._getDataRowsFromItems(e),i={};return t.forEach(e=>{Object.keys(e).forEach(t=>{i[t]=i[t]||[],i[t].push(e[t])})}),i}}}r.default.api.plugins.add("annotations",d);var u=r.default.api.utils;function h(e){var t=e.x0,i=e.y0,r=null==e.collapse||e.collapse,n=function(e){return{y0:function(i){return e.scaleY.value(i[t])}}},a=function(e){return{y0:function(t){return e.scaleY.value(t[i])}}},s=function(e){var r=e.data();if(0===r.length)return{};var n=e.scaleY,a=Number.MAX_VALUE,s=Number.MIN_VALUE,o=e.flip?t:i,l=n.dim;return r.forEach(function(e){var t=e[o],i=e[l],r=tt?i:t;a=rs?n:s}),n.fixup(function(e){var t={};return(!e.hasOwnProperty("max")||e.maxa)&&(t.min=a),t}),{}},o={},l={},c=function(e){var n=e.data().slice(),a=e.scaleX,s=e.scaleY;if(0===n.length||!a.discrete)return{};var c=e.flip?t:i,d=s.dim;n.sort(u.createMultiSorter(function(e,t){return e[c]-t[c]},function(e,t){return e[d]-t[d]}));var h=a.dim,f=a.domain().reduce(function(e,t){return e[t]=[],e},{}),p=new Map;return n.forEach(r?function(e){var t=e[h],i=f[t],r=i.findIndex(function(t){return t[t.length-1][d]<=e[c]});r<0&&(r=i.length,i.push([])),i[r].push(e),p.set(e,r)}:function(e){var t=e[h],i=f[t],r=r=i.length;i.push([]),i[r].push(e),p.set(e,r)}),Object.keys(f).forEach(function(e){o[e]=f[e]}),a.fixup(function(e){var t={},i=a.domain().reduce(function(e,t){return e+o[t].length},0);return a.domain().forEach(function(e){l[e]=i}),t.ratio=function(e){return o[e].length/l[e]},t}),{xi:function(t){var i=t[h],r=a.stepSize(i);return e.xi(t)-r/2+r/o[i].length*(p.get(t)+.5)}}};return{onSpecReady:function(e,t){e.traverseSpec(t,function(e,t){"ELEMENT.INTERVAL"===e.type&&(e.transformModel=[e.flip?n:a,c],e.adjustScales=[s],e.guide.enableColorToBarPosition=!1,e.guide.label=e.guide.label||{},e.guide.label.position=e.guide.label.position||(e.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",h);var f=i(0),p=r.default.api.utils,g="minimum",m="maximum",b={MIN:g,MAX:m,MEDIAN:"median",Q1:"Q1",Q3:"Q3"};function y(e,t){var i=e.length-1,r=t/100*i,n=Math.floor(r);if(0===n)return{pos:0,value:e[0]};if(n===i)return{pos:i,value:e[i]};var a=r-n;return a?{pos:r,value:e[n]+a*(e[n+1]-e[n])}:{pos:r,value:e[r]}}function v(e,t,i){for(var r=e.sort(function(e,t){return e-t}),n=y(r,25),a=y(r,50),s=y(r,75),o=s.value-n.value,l=n.value-1.5*o,c=s.value+1.5*o,d=r[0],u=r[r.length-1],h=0;h<=n.pos;h++){var f=r[h];if(f>l){d=f;break}}for(var p=r.length-1;p>=s.pos;p--){var g=r[p];if(gs||e[r]e.join("\n"),k=({categories:e})=>`\n
\n ${C(e.map(e=>A(e)))}\n
\n`,A=({label:e,values:t})=>`\n
\n
${e}
\n
\n ${C(t.map(e=>P(e)))}\n
\n\n`,P=({key:e,label:t,checked:i})=>`\n
\n ${O()}\n ${t}\n
\n`,O=()=>[``,``,""].join(""),N=e=>{const t=document.createElement("div");return t.innerHTML=e,t.firstElementChild},L=(e,t,i,r)=>{e.addEventListener(t,function(e){let t=e.target;for(;t!==e.currentTarget&&null!==t;)t.matches(i)&&r(e,t),t=t.parentNode})},R=(e,t)=>{const i=e=>JSON.stringify((e=>null==e||""===e)(e)?null:e),r=i(t);return t=>{const n=t[e],a=i(n);return r===a}};class F{constructor(e){this.settings=_.defaults(e||{},{formatters:{},fields:null,skipColorDim:!0}),this._filters={},this.onRender=this._createRenderHandler()}init(e){this._chart=e;const t=t=>{const i=e.getSpec().scales;return Object.keys(i).map(e=>{return{name:e,config:i[e]}}).filter(t)};let i=t(({config:e,name:t})=>"ordinal"===e.type&&e.dim),r=_.unique(i.map(({config:e})=>e.dim));if(this.settings.fields&&(r=r.filter(e=>this.settings.fields.indexOf(e)>=0)),this.settings.skipColorDim){const e=t(({config:e,name:t})=>"color"===e.type&&e.dim).map(({config:e})=>e.dim);r=r.filter(t=>e.indexOf(t)<0)}i=i.filter(e=>r.indexOf(e.config.dim)>=0),this._categoryScales=i,this._render()}destroy(){const e=this._filters,t=this._chart;Object.keys(e).forEach(i=>t.removeFilter(e[i]));(e=>e&&e.parentElement&&e.parentElement.removeChild(e))(this._node)}_createRenderHandler(){return function(){if(this._lastClickedScrollInfo){const e=this._lastClickedScrollInfo.key,t=this._node.querySelector(`[data-key="${e}"]`);if(t){const e=this._lastClickedScrollInfo.top,i=t.getBoundingClientRect().top,r=this._getScrollContainer(),n=r.getBoundingClientRect().top;r.scrollTop=r.scrollTop-e-n+i}this._lastClickedScrollInfo=null}}}_getContent(e){return k({categories:e})}_getCategoriesInfo(){return this._categoryScales.map(({name:e})=>this._chart.getScaleInfo(e)).map(e=>{const t=e.dim,i=this._getFieldLabel(t),r=this._getFieldFormat(t),n=this._chart.getDataSources({excludeFilter:["category-filter"]}),a=_.unique(n[e.source].data.map(e=>e[t])).map(e=>{const i=r(e),n=this._getFilterKey(t,e);return{label:i,checked:!this._filters[n],key:n,value:e}});return{dim:t,label:i,values:a}})}_render(){this._clear(),this._formatters=w.getFieldFormatters(this._chart.getSpec(),this.settings.formatters);const e=this._getCategoriesInfo(),t=this._getContent(e),i=N(t);this._node=i,this._chart.insertToRightSidebar(i),this._subscribeToEvents(),this._filterKeys=e.reduce((e,t)=>{const i=t.dim;return t.values.forEach(({key:t,value:r})=>{e[t]={dim:i,value:r}}),e},{})}_subscribeToEvents(){const e=this._node;L(e,"click",`.${S}`,(e,t)=>{const i=t.getAttribute("data-key"),r=e.target.matches(`.${M}`);this._toggleCategory(i,r?"toggle":"focus")}),L(e,"mouseover",`.${S}`,(e,t)=>{const i=t.getAttribute("data-key");this._toggleHighlight(i,!0)}),L(e,"mouseout",`.${S}`,(e,t)=>{const i=t.getAttribute("data-key");this._toggleHighlight(i,!1)})}_isFilteredOut(e){return e in this._filters}_toggleCategory(e,t){const i=Array.from(this._node.querySelectorAll(`.${S}`)).reduce((e,t)=>{return e[t.getAttribute("data-key")]=t,e},{}),r=Object.keys(this._filterKeys).map(e=>{const{dim:t,value:r}=this._filterKeys[e];return{node:i[e],key:e,dim:t,value:r,isChecked:!this._isFilteredOut(e)}}),n=r.reduce((e,t)=>(e[t.key]=t,e),{})[e],a=r.filter(e=>e.dim===n.dim),s=(e,t)=>{t?e.classList.add(T):e.classList.remove(T)};switch(t){case"toggle":n.isChecked?(this._addFilter(e),s(n.node,!1)):(this._removeFilter(e),s(n.node,!0));break;case"focus":n.isChecked&&a.every(e=>e===n||!e.isChecked)?a.forEach(e=>{e.isChecked||(s(e.node,!0),this._removeFilter(e.key))}):(a.forEach(e=>{e!==n&&e.isChecked&&(s(e.node,!1),this._addFilter(e.key))}),n.isChecked||(s(n.node,!0),this._removeFilter(n.key)));break}this._lastClickedScrollInfo={key:e,top:n.node.getBoundingClientRect().top-this._getScrollContainer().getBoundingClientRect().top},this._chart.refresh()}_toggleHighlight(e,t){if(this._isFilteredOut(e))return;const{dim:i,value:r}=this._filterKeys[e],n=t?R(i,r):e=>null;this._chart.select(e=>!0).forEach(e=>e.fire("highlight",n))}_clear(){const e=this._node;e&&e.parentElement&&e.parentElement.removeChild(e)}_getScrollContainer(){return this._node.parentElement.parentElement}_getFilterKey(e,t){return`${e}__${t}`}_addFilter(e){const{dim:t,value:i}=this._filterKeys[e],r=R(t,i);this._filters[e]=this._chart.addFilter({tag:"category-filter",predicate:e=>!r(e)})}_removeFilter(e){const t=this._filters[e];delete this._filters[e],this._chart.removeFilter(t)}_getFieldLabel(e){return this._formatters[e]?this._formatters[e].label:e}_getFieldFormat(e){return this._formatters[e]?this._formatters[e].format:e=>String(e)}}r.default.api.plugins.add("category-filter",function(e){return new F(e)});const D="http://www.w3.org/2000/svg";var $=r.default.api.utils,z=r.default.api.svgUtils,B=r.default.api.pluginsSDK;function I(e){e=e||{};var t=document.createElementNS(D,"g"),i=f.select(t).attr("class","tau-crosshair__label");i.append("rect").attr("class","tau-crosshair__label__box"),i.append("text").attr("class","tau-crosshair__label__text-shadow"),i.append("text").attr("class","tau-crosshair__label__text");var r={options:function(t){return e=Object.assign(e,t),r},show:function(n){return e.container.appendChild(t),function(t){var r=t.x,n=t.y,a=t.text,s=t.color,o=t.colorCls;i.attr("class","tau-crosshair__label "+o);var l=e.halign,c=e.valign,d=e.hpad,u=e.vpad,h={left:"end",middle:"middle",right:"start"}[l],f={left:-d,middle:0,right:d}[l],p=i.select(".tau-crosshair__label__text").attr("fill",s),g=i.selectAll(".tau-crosshair__label__text, .tau-crosshair__label__text-shadow").attr("text-anchor",h).attr("x",r+f).attr("y",0).text(a),m=p.node().getBBox(),b={top:-u-m.height/2,middle:0,bottom:u+m.height/2}[c]-m.height/2-m.y;g.attr("y",n+b);var y=m.width+2*d,v=m.height+2*u,x={left:-y,middle:-y/2,right:0}[l],_={top:-v,middle:-v/2,bottom:0}[c];i.select(".tau-crosshair__label__box").attr("fill",s).attr("rx",e.boxCornerRadius).attr("ry",e.boxCornerRadius).attr("x",r+x).attr("y",n+_).attr("width",y).attr("height",v)}(n),function(){i.attr("transform","");var r=e.chart.getLayout().contentContainer.getBoundingClientRect(),n=e.chart.getSVG().getBoundingClientRect(),a=t.getBoundingClientRect(),s=Math.max(0,Math.max(r.left,n.left)-a.left)||Math.min(0,Math.min(r.right,n.right)-a.right),o=Math.max(0,Math.max(r.top,n.top)-a.top)||Math.min(0,Math.min(r.bottom,n.bottom)-a.bottom);i.attr("transform","translate("+s+","+o+")")}(),r},hide:function(){return t.parentNode&&t.parentNode.removeChild(t),r}};return r}function j(e){var t=$.defaults(e||{},{xAxis:!0,yAxis:!0,formatters:{},labelBoxHPadding:5,labelBoxVPadding:3,labelBoxCornerRadius:3,axisHPadding:22,axisVPadding:22});return{init:function(e){this._chart=e,this._formatters={},this._createNode()},_createNode:function(){var e=f.select(document.createElementNS(D,"g")).attr("class","tau-crosshair");this._labels={x:null,y:null};var i=function(i){var r=e.append("g").attr("class","tau-crosshair__group "+i);r.append("line").attr("class","tau-crosshair__line-shadow"),r.append("line").attr("class","tau-crosshair__line"),this._labels[i]=I({container:r.node(),chart:this._chart,halign:"x"===i?"middle":"left",valign:"x"===i?"bottom":"middle",boxCornerRadius:t.labelBoxCornerRadius,hpad:t.labelBoxHPadding,vpad:t.labelBoxVPadding})}.bind(this);t.xAxis&&i("x"),t.yAxis&&i("y"),this._element=e},_setValues:function(e,i,r){var n=function(e){var i=this._element.select(".tau-crosshair__group."+e.dir);i.select(".tau-crosshair__line").attr("class","tau-crosshair__line "+r.cls).attr("stroke",r.color),i.selectAll(".tau-crosshair__line, .tau-crosshair__line-shadow").attr("x1",e.startPt.x).attr("x2",e.valuePt.x).attr("y1",e.startPt.y).attr("y2",e.valuePt.y),("x"===e.dir&&t.xAxis||"y"===e.dir&&t.yAxis)&&this._labels[e.dir].options({halign:e.labelHAlign,valign:e.labelVAlign}).show({x:e.startPt.x,y:e.startPt.y,text:e.label,color:r.color,colorCls:r.cls})}.bind(this);n({dir:"x",startPt:{x:e.value,y:i.start+(e.minMode?0:t.axisVPadding)},valuePt:{x:e.value,y:i.value+i.crossPadding},label:e.label,labelHAlign:"middle",labelVAlign:"bottom"}),n({dir:"y",startPt:{x:e.start-(i.minMode?0:t.axisHPadding),y:i.value},valuePt:{x:e.value-e.crossPadding,y:i.value},label:i.label,labelHAlign:"left",labelVAlign:"middle"})},_showCrosshair:function(e,t,i){var r=this._chart.getSVG(),n=t.config.options.container.node(),a=z.getDeepTransformTranslate(n);this._element.attr("transform",z.translate(a.x,a.y)),r.appendChild(this._element.node());var s=t.getScale("x"),o=t.getScale("y"),l=t.getScale("color"),c=l(e.data[l.dim]),d=e.data[s.dim],u=e.data[o.dim],h=t.screenModel.x(e.data),f=t.screenModel.y(e.data);if(t.config.stack)if(t.config.flip){var p=t.data().filter(function(i){var r=i[o.dim];return i===e.data||(r===u||r-u==0)&&(t.screenModel.x(e.data)-t.screenModel.x(i))*i[s.dim]>0});h=(d<0?Math.min:Math.max).apply(null,p.map(function(e){return t.screenModel.x(e)},0)),d=p.reduce(function(e,t){return e+t[s.dim]},0)}else{var g=t.data().filter(function(i){var r=i[s.dim];return i===e.data||(r===d||r-d==0)&&(t.screenModel.y(i)-t.screenModel.y(e.data))*i[o.dim]>0});f=(u<0?Math.max:Math.min).apply(null,g.map(function(e){return t.screenModel.y(e)},0)),u=g.reduce(function(e,t){return e+t[o.dim]},0)}var m=e.node.getBBox(),b=["ELEMENT.AREA","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED"].indexOf(t.config.type)>=0?{x:m.width*(t.config.flip?d>0?1:0:.5),y:m.height*(t.config.flip?.5:u>0?1:0)}:{x:m.width/2,y:m.height/2};this._setValues({label:this._getFormat(s.dim)(d),start:0,value:h,crossPadding:b.x,minMode:i&&i.guide.x.hide},{label:this._getFormat(o.dim)(u),start:t.config.options.height,value:f,crossPadding:b.y,minMode:i&&i.guide.y.hide},{cls:l.toColor(c)?"":c,color:l.toColor(c)?c:""})},_hideCrosshair:function(){var e=this._element.node();e.parentNode&&e.parentNode.removeChild(e)},destroy:function(){this._hideCrosshair()},_subscribeToHover:function(){var 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,t){if(t.data){if(e===t.unit){var i=B.getParentUnit(this._chart.getSpec(),e.config);this._showCrosshair(t,e,i)}}else this._hideCrosshair()}.bind(this))},this)},_getFormat:function(e){return this._formatters[e]?this._formatters[e].format:e=>String(e)},onRender:function(){this._formatters=B.getFieldFormatters(this._chart.getSpec(),t.formatters),this._subscribeToHover()}}}r.default.api.plugins.add("crosshair",j);const V="tau-chart__tooltip";function H(e,t){return{render(e){return this.args=e,e=Object.assign({},e,{fields:this.filterFields(e.fields)}),this.rootTemplate(e)},rootTemplate(e){return[`
`,this.buttonsTemplate(),"
",`
`,this.contentTemplate(e),"
"].join("\n")},contentTemplate(e){return this.fieldsTemplate(e)},filterFields:e=>e,getLabel:t=>e.getFieldLabel(t),getFormatter:t=>e.getFieldFormat(t),fieldsTemplate({data:e,fields:t}){return t.map(t=>this.itemTemplate({data:e,field:t})).join("\n")},itemTemplate({data:e,field:t}){const i=this.getLabel(t),r=this.getFormatter(t)(e[t]);return[`
`,`
${i}
`,`
${r}
`,"
"].join("\n")},buttonsTemplate(){return[this.buttonTemplate({cls:"i-role-exclude",text:"Exclude",icon:()=>''})].join("\n")},buttonTemplate:({icon:e,text:t,cls:i})=>[`
`,`
`,` ${e?`${e()} `:""}${t}`,"
","
"].join("\n"),didMount(){const t=e.getDomNode().querySelector(".i-role-exclude");t&&t.addEventListener("click",()=>{e.excludeHighlightedElement(),e.setState({highlight:null,isStuck:!1})})}}}const W=r.default.api.utils,U=r.default.api.domUtils,X=r.default.api.pluginsSDK,G="tau-chart__tooltip";class q{constructor(e){this.settings=W.defaults(e||{},{align:"bottom-right",clickable:!0,clsClickable:`${G}__clickable`,clsStuck:"stuck",clsTarget:`${G}-target`,escapeHtml:!0,fields:null,formatters:{},getTemplate:null,spacing:24,winBound:12,onExclude:()=>{}}),this.onRender=this._getRenderHandler()}init(e){this._chart=e,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()}_getTemplate(){const e=H(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(e,this,this.settings):e}_renderTemplate(e,t){return this._template.render({data:e,fields:t})}_initDomEvents(){this._scrollHandler=(()=>{this.setState({highlight:null,isStuck:!1})}),window.addEventListener("scroll",this._scrollHandler,!0),this.settings.clickable&&(this._outerClickHandler=(e=>{const t=Array.from(document.querySelectorAll(`.${this.settings.clsClickable}`)).concat(this.getDomNode()).map(e=>e.getBoundingClientRect()),i=Math.min(...t.map(e=>e.top)),r=Math.min(...t.map(e=>e.left)),n=Math.max(...t.map(e=>e.right)),a=Math.max(...t.map(e=>e.bottom));(e.clientXn||e.clientYa)&&this.setState({highlight:null,isStuck:!1})}))}getDomNode(){return this._tooltip.getElement()}setState(e){const t=this.settings,i=this.state,r=this.state=Object.assign({},i,e);i.highlight=i.highlight||{data:null,cursor:null,unit:null},r.highlight=r.highlight||{data:null,cursor:null,unit:null},r.isStuck&&i.highlight.data&&(r.highlight=i.highlight),r.highlight.data!==i.highlight.data&&(r.highlight.data?(this._hideTooltip(),this._showTooltip(r.highlight.data,r.highlight.cursor),this._setTargetSvgClass(!0),requestAnimationFrame(()=>{this._setTargetSvgClass(!0)})):r.isStuck||!i.highlight.data||r.highlight.data||(this._removeFocus(),this._hideTooltip(),this._setTargetSvgClass(!1))),!r.highlight.data||i.highlight.cursor&&r.highlight.cursor.x===i.highlight.cursor.x&&r.highlight.cursor.y===i.highlight.cursor.y||(this._tooltip.position(r.highlight.cursor.x,r.highlight.cursor.y),this._tooltip.updateSize());const n=this.getDomNode();this.settings.clickable&&r.isStuck!==i.isStuck&&(r.isStuck?(window.addEventListener("click",this._outerClickHandler,!0),n.classList.add(t.clsStuck),this._setTargetEventsEnabled(!1),this._accentFocus(r.highlight.data),this._tooltip.updateSize()):(window.removeEventListener("click",this._outerClickHandler,!0),n.classList.remove(t.clsStuck),requestAnimationFrame(()=>{this._setTargetEventsEnabled(!0);const e=this._chart.getSVG();e&&U.dispatchMouseEvent(e,"mouseleave")})))}_showTooltip(e,t){const i=this.settings,r=i.fields||"function"==typeof i.getFields&&i.getFields(this._chart)||Object.keys(e),n=this._renderTemplate(e,r);this._tooltip.content(n).position(t.x,t.y).place(i.align).show().updateSize(),this._template.didMount&&this._template.didMount()}_hideTooltip(){window.removeEventListener("click",this._outerClickHandler,!0),this._template.willUnmount&&this._template.willUnmount(),this._tooltip.hide()}destroy(){window.removeEventListener("scroll",this._scrollHandler,!0),this._setTargetSvgClass(!1),this.setState({highlight:null,isStuck:!1}),this._tooltip.destroy()}_subscribeToHover(){var e=["ELEMENT.LINE","ELEMENT.AREA","ELEMENT.PATH","ELEMENT.INTERVAL","ELEMENT.INTERVAL.STACKED","ELEMENT.POINT"];this._chart.select(t=>e.indexOf(t.config.type)>=0).forEach(e=>{e.on("data-hover",(e,t)=>{var i=document.body.getBoundingClientRect();this.setState({highlight:t.data?{data:t.data,cursor:{x:t.event.clientX-i.left,y:t.event.clientY-i.top},unit:t.unit}:null})}),this.settings.clickable&&e.on("data-click",(e,t)=>{const i=document.body.getBoundingClientRect();this.setState(t.data?{highlight:{data:t.data,cursor:{x:t.event.clientX-i.left,y:t.event.clientY-i.top},unit:t.unit},isStuck:!0}:{highlight:null,isStuck:null})})})}getFieldFormat(e){const t=this._formatters[e]?this._formatters[e].format:e=>String(e);return this.settings.escapeHtml?e=>W.escapeHtml(t(e)):t}getFieldLabel(e){const t=this._formatters[e]?this._formatters[e].label:e;return this.settings.escapeHtml?W.escapeHtml(t):t}_accentFocus(e){const t=t=>t===e;this._chart.select(()=>!0).forEach(e=>{e.fire("highlight",t)})}_removeFocus(){const e=()=>null;this._chart.select(()=>!0).forEach(t=>{t.fire("highlight",e),t.fire("highlight-data-points",e)})}excludeHighlightedElement(){const e=this.state.highlight.data;this._chart.addFilter({tag:"exclude",predicate:t=>t!==e}),this.settings.onExclude(e),this._chart.refresh()}_getRenderHandler(){return function(){this._formatters=X.getFieldFormatters(this._chart.getSpec(),this.settings.formatters),this._subscribeToHover(),this.setState({highlight:null,isStuck:!1})}}_setTargetSvgClass(e){f.select(this._chart.getSVG()).classed(this.settings.clsTarget,e)}_setTargetEventsEnabled(e){e?this._chart.enablePointerEvents():this._chart.disablePointerEvents()}}const Y="diff-tooltip",K=`${Y}__item`,J=`${Y}__header`;function Q(e,t){const i=H(e);return Object.assign({},i,{hasColor(){const{colorField:e}=this.args;return null!=e},contentTemplate(e){return[this.fieldsTemplate(e),this.tableTemplate(e)].join("\n")},filterFields(t){const r=e.state.highlight.unit.screenModel,{scaleColor:n,scaleX:a,scaleY:s}=r.model,o=t.filter(e=>e!==n.dim&&e!==a.dim&&e!==s.dim),l=()=>o.push(a.dim);return this.shouldShowColorTable()?l():(l(),(()=>n.dim&&o.push(n.dim))(),(()=>o.push(s.dim))()),i.filterFields.call(this,o)},itemTemplate({data:e,field:t}){const i=this.getLabel(t),r=this.getFormatter(t)(e[t]),n=this.args.prev,a=(this.args.valueField,this.shouldShowDiff(t)),s=[``,`${r}`,a?` ${this.fieldUpdownTemplate(this.getDiff({data:e,prev:n,field:t}))}`:"",""].join("");return[`
`,`
${i}
`,` ${s}`,"
"].join("\n")},shouldShowDiff(e){return e===this.args.valueField},getDiff({data:e,prev:t,field:i}){const r=this.getFormatter(i),n=(e?e[i]:0)-(t?t[i]:0);return{diff:r(n),sign:Math.sign(n)}},fieldUpdownTemplate({diff:e,sign:t}){const i=`${Y}__field__updown`;return[``,`${t>0?"▲":t<0?"▼":""}${0===t?"":e}`,""].join("")},shouldShowColorTable(){const e=this.args.groups;return this.hasColor()&&e.length>1},tableTemplate(e){return this.shouldShowColorTable()?[`
`,this.tableHeaderTemplate(e),this.tableBodyTemplate(e),"
"].join("\n"):""},tableHeaderTemplate({colorField:e,valueField:t}){const i=this.getLabel(e),r=this.getLabel(t);return[`
`,` ${i}`,` ${r}`,` ▼▲`,"
"].join("\n")},tableBodyTemplate({data:e,groups:t,valueField:i,colorField:r}){const n=e,a=t.map(({data:e})=>e?e[i]:0),s=Math.min(...a),o=Math.max(...a);return[`
`,`
`,t.map(({data:e,prev:t})=>this.tableRowTemplate({data:e,prev:t,highlighted:n,valueField:i,colorField:r,min:s,max:o})).join("\n"),"
","
"].join("\n")},tableRowTemplate({data:e,prev:t,highlighted:i,valueField:r,colorField:n,min:a,max:s}){const o=e?e[r]:0,l=this.getFormatter(n)((e||t)[n]),c=this.getFormatter(r)(o),d=e===i,{diff:u,sign:h}=this.getDiff({data:e,prev:t,field:r}),{color:f,colorCls:p}=this.getColor(e||t);return[`
`,` ${this.valueBarTemplate({min:a,max:s,v:o,color:f,colorCls:p})}`,` ${l}`,` ${c}`,` ${this.updownTemplate({diff:u,sign:h})}`,"
"].join("\n")},valueBarTemplate({min:e,max:t,v:i,color:r,colorCls:n}){e=Math.min(e,0);const a=(t=Math.max(0,t))-e;return[""].join("\n")},getColor(t){const i=e.state.highlight.unit.screenModel;return{color:i.color(t),colorCls:i.class(t)}},updownTemplate({diff:e,sign:t}){const i=`${K}__updown`;return[``,`${t>0?"▲":t<0?"▼":""}${0===t?"":e}`,""].join("")},didMount(){i.didMount.call(this),this._scrollToHighlighted(),this._reserveSpaceForUpdown()},_scrollToHighlighted(){const t=e.getDomNode(),i=t.querySelector(`.${Y}__body`),r=t.querySelector(`.${Y}__body__content`),n=t.querySelector(`.${K}_highlighted`);if(!(i&&r&&n))return;const a=i.getBoundingClientRect(),s=r.getBoundingClientRect(),o=n.getBoundingClientRect();var l=0;if(o.bottom>a.bottom){const e=o.bottom-a.bottom+o.height,t=s.bottom-a.bottom;l=-Math.min(e,t),r.style.transform=`translateY(${l}px)`}s.top+la.bottom&&i.classList.add(`${Y}__body_overflow-bottom`)},_reserveSpaceForUpdown(){const t=e.getDomNode(),i=t.querySelector(`.${Y}__body`),r=t.querySelector(`.${J}`);if(!i||!r)return;const n=`.${K}__updown:not(:empty)`,a=Array.from(t.querySelectorAll(n)).map(e=>e.scrollWidth),s=Math.max(...a),o=Math.max(0,Math.ceil(s-15));i.style.paddingRight=`${o}px`,r.style.paddingRight=`${o}px`}})}const Z=r.default.api.utils,ee="ELEMENT.INTERVAL_HIGHLIGHT";var te={draw(){const e=this.node().config;this._container=e.options.slot(e.uid)},addInteraction(){this.node().on("interval-highlight",(e,t)=>{this._drawRange(t)})},_drawRange(e){const t=this.node(),i=t.config,r=t.screenModel.flip,n=this._container,a="interval-highlight",s=`${a}__gradient`,o=e?e[0]:null,l=e?e[1]:null,c=r?i.options.width:i.options.height;Z.take(function(){const t=n.selectAll(`.${a}`).data(e?[1]:[]);t.exit().remove();const i=t.enter().append("g").attr("class",a).attr("pointer-events","none");return{g:t,gEnter:i}}()).then(t=>{!function(){const t=`${a}__defs`,o=`${a}__gradient-start`,l=`${a}__gradient-end`;for(var c=n.node();"svg"!==(c=c.parentNode).tagName;);const d=`${t}__${i.uid}`,u=f.select(c).selectAll(`#${d}`).data(e?[1]:[]);u.exit().remove();const h=u.enter().append("defs").attr("class",t).attr("id",d).append("linearGradient").attr("id",s).attr("x1","0%").attr("y1",r?"100%":"0%").attr("x2",r?"0%":"100%").attr("y2","0%");h.append("stop").attr("class",o).attr("offset","0%"),h.append("stop").attr("class",l).attr("offset","100%")}(),function({g:e,gEnter:t}){const i=`${a}__range`,n=e.select(`.${i}`),d=t.append("rect").attr("class",i).attr("fill",`url(#${s})`),{x:u,y:h,width:f,height:p}=r?{x:0,y:l,width:c,height:o-l}:{x:o,y:0,width:l-o,height:c};d.merge(n).attr("x",u).attr("y",h).attr("width",Math.abs(f)).attr("height",Math.abs(p))}(t),function({g:e,gEnter:t}){const i=`${a}__range-start`,n=e.select(`.${i}`),s=t.append("line").attr("class",i),{x1:l,y1:d,x2:u,y2:h}=r?{x1:0,y1:o,x2:c,y2:o}:{x1:o,y1:0,x2:o,y2:c};s.merge(n).attr("x1",l).attr("y1",d).attr("x2",u).attr("y2",h)}(t),function({g:e,gEnter:t}){const i=`${a}__range-end`,n=e.select(`.${i}`),s=t.append("line").attr("class",i),{x1:o,y1:d,x2:u,y2:h}=r?{x1:0,y1:l,x2:c,y2:l}:{x1:l,y1:0,x2:l,y2:c};s.merge(n).attr("x1",o).attr("y1",d).attr("x2",u).attr("y2",h)}(t)})}};const ie=r.default.api.utils;class re extends q{constructor(e){super(e),this.onSpecReady=this._getSpecReadyHandler()}init(e){super.init(e),this._unitsGroupedData=new Map}_getTemplate(){const e=Q(this,this.settings);return"function"==typeof this.settings.getTemplate?this.settings.getTemplate(e,this,this.settings):e}_renderTemplate(e,t){const i=this.state.highlight.unit,r=i.screenModel,{scaleColor:n,scaleX:a,scaleY:s}=r.model,o=this._unitsGroupedData.get(i),[l,c]=this._getHighlightRange(e,i),d=e=>{const t=r.model.color(e);return isFinite(l)&&o[l][t]?o[l][t][0]:null},u=d(e),h=i.config.stack,f=!(!i.config.flip&&i.config.guide.obsoleteVerticalStackOrder&&i.config.stack),p=(()=>{const e=n.domain().slice().reduce((e,t,i)=>(e[t]=i,e),{});return f?(t,i)=>e[t[n.dim]]-e[i[n.dim]]:(t,i)=>e[i[n.dim]]-e[t[n.dim]]})(),g=f?(e,t)=>s(e[s.dim])-s(t[s.dim]):(e,t)=>s(t[s.dim])-s(e[s.dim]),m=e=>Object.keys(o[e]).reduce((t,i)=>t.concat(o[e][i]),[]).sort(h?p:g),b=m(c).map(e=>{r.model.color(e);return{data:e,prev:d(e)}});if(isFinite(l)){const e=m(l),t=b.reduce((e,t)=>(e[r.model.color(t.data)]=!0,e),{});e.forEach(e=>{const i=r.model.color(e);t[i]||b.push({data:null,prev:e})}),h&&b.sort((e,t)=>p(e.data||e.prev,t.data||t.prev))}return this._template.render({data:e,prev:u,fields:t,groups:b,valueField:s.dim,colorField:n.dim})}_getRenderHandler(){const e=super._getRenderHandler();return function(){e.call(this);const t=this._chart,i=t.select(e=>"chart"===e.config.namespace&&0===e.config.type.indexOf("ELEMENT.")&&e.config.type!==ee),r=t.select(e=>e.config.type===ee).reduce((e,t,i)=>(e[i]=t,e),{});i.forEach((e,t)=>{const i=e.data();this._unitsGroupedData.set(e,this._getGroupedData(i,e)),e.on("data-hover",(i,n)=>{const a=r[t],s=n.unit&&n.unit===e?this._getHighlightRange(n.data,n.unit):null;a.fire("interval-highlight",s)})})}}_getSpecReadyHandler(){return function(e,t){e.traverseSpec(t,(e,t)=>{if(0!==e.type.indexOf("ELEMENT."))return;const i=JSON.parse(JSON.stringify(e));i.type=ee,i.namespace="highlight";const r=t.units.indexOf(e);t.units.splice(r,0,i)})}}_getGroupedData(e,t){const i=t.screenModel.model.scaleX,n=ie.groupBy(e,e=>i(e[i.dim]).toString()),a=t.config.guide.x.tickPeriod||t.config.guide.x.timeInterval;if(a){const e=i.domain(),s=t.config.guide.utcTime;r.default.api.tickPeriod.generate(e[0],e[1],a,{utc:s}).filter(t=>t>=e[0]&&t<=e[1]).forEach(e=>{const t=i(e);n[t]||(n[t]=[])})}return Object.keys(n).reduce((e,i)=>(e[i]=ie.groupBy(n[i],e=>t.screenModel.model.color(e)),e),{})}_getHighlightRange(e,t){const i=t.screenModel.flip,r=t.screenModel.model.scaleX,n=r(e[r.dim]),a=this._unitsGroupedData.get(t),s=Object.keys(a).map(Number).sort(i?(e,t)=>t-e:(e,t)=>e-t),o=s.indexOf(n);return 0===o?[n,n]:[s[o-1],n]}}function ne(e){return new re(e)}r.default.api.unitsRegistry.reg(ee,te,"ELEMENT.GENERIC.CARTESIAN"),r.default.api.plugins.add("diff-tooltip",ne);var ae=i(17),se=i.n(ae),oe=i(18),le=i(19),ce=i.n(le);const de="Taucharts Export Plug-in:";var ue=r.default.api.utils,he=r.default.api.pluginsSDK,fe=he.tokens(),pe=function(e,t){return e.replace(new RegExp("^"+t+"+|"+t+"+$","g"),"")},ge=function(e){return(e=Math.round(e))%2?e+1:e},me=function(e){return null===e||""===e||void 0===e};var be,ye={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},ve=function(e,t){t=t||"all";var i=document.createElement("style");return i.setAttribute("media",t),i.innerHTML=e,i},xe=ve(ce.a,"print"),_e=function(){xe&&xe.parentNode&&xe.parentNode.removeChild(xe),be&&be.parentNode&&be.parentNode.removeChild(be)};/PhantomJS/.test(navigator.userAgent)||("onafterprint"in window?window.addEventListener("afterprint",_e):window.matchMedia("screen").addListener(function(e){e.matches&&_e()}));var we=function(e,t,i){var r="data:"+t+";charset=UTF-8,%ef%bb%bf"+encodeURIComponent(i),n=document.createElement("a");n.setAttribute("href",r),n.setAttribute("download",e),n.setAttribute("target","_new"),document.body.appendChild(n),n.click(),document.body.removeChild(n),n=null},Ee=function(e){return[].slice.call(e.querySelectorAll("text.label")).forEach(function(e){e.innerHTML=[].slice.call(e.querySelectorAll("tspan")).reduce(function(e,t){var i=t.value||t.text||t.textContent||"";return e+(i=i.charAt(0).toUpperCase()+i.substr(1))},"")}),e},Se=function(e,t,i){i=null==i?"":String(i);var r=(e||{})[t]||{};return(ue.isObject(r.label)?r.label.text:r.label)||i};function Te(e){return{onRender:function(){this._info=he.extractFieldsFormatInfo(this._chart.getSpec())},_normalizeExportFields:function(e,t){var i=this._info;return e.map(function(e){var t=e,r=i[e]||{};return"string"==typeof e&&(t={field:e,title:r.label||e}),"function"!=typeof t.value&&(t.value=function(e){var t=e[this.field];return r.isComplexField?(t||{})[r.tickLabel]:t}),t}).filter(function(e){return!t.find(function(t){return e.field===t})})},_handleError(e){r.default.api.globalSettings.log([de,e],"error")},_createDataUrl:function(e,t){!function(...e){const t=e.slice(0,e.length-1),i=e[e.length-1];if(0===t.length)return void setTimeout(()=>i(null,[]),0);const r=ue.range(0,t.length).map(()=>null),n=t.map((e,t)=>{const a=new XMLHttpRequest;a.onload=(()=>{if(a.status>=200&&a.status<300){const e=a.responseText;r[t]=e,n.splice(n.indexOf(a),1),0===n.length&&i(null,r)}else n.forEach(e=>e.abort()),i(new Error(`${a.status}: ${a.statusText}`),null)}),a.onerror=(e=>{n.forEach(e=>e.abort()),i(e.error,null)}),a.open("GET",e,!0),a.send(null)})}(...this._cssPaths,(i,n)=>{if(i)t(i,null);else try{const c=n.join(" ").replace(/&/g,"");var a=ve(c),s=document.createElement("div");e.fire("beforeExportSVGNode");var o=e.getSVG().cloneNode(!0);e.fire("afterExportSVGNode"),s.appendChild(Ee(o)),f.select(o).attr("version",1.1).attr("xmlns","http://www.w3.org/2000/svg"),o.insertBefore(a,o.firstChild),this._renderAdditionalInfo(o,e),this._addBackground(o,this._backgroundColor);var l=document.createElement("canvas");l.height=o.getAttribute("height"),l.width=o.getAttribute("width"),se()(l,o.parentNode.innerHTML,{renderCallback:function(e){var i=(new XMLSerializer).serializeToString(e);"{if(e)this._handleError(e);else{for(var i=atob(t.substring("data:image/png;base64,".length)),r=new Uint8Array(i.length),n=0,a=i.length;n{if(e)this._handleError(e);else{(be=document.createElement("img")).classList.add("tau-chart__print-block");var i=be;document.body.appendChild(i),i.src=t,document.head.appendChild(xe),i.onload=function(){window.print()}}})},_toJson:function(e){var t=this._exportFields,i=e.getData(),r=e.getDataDims(),n=t.length?t:Object.keys(r),a=this._normalizeExportFields(n.concat(this._appendFields),this._excludeFields),s=i.map(function(e){return a.reduce(function(t,i){return t[i.title]=i.value(e),t},{})}),o=JSON.stringify(s,null,2),l=(this._fileName||"export")+".json";we(l,"application/json",o)},_toCsv:function(e){var t=this._csvSeparator,i=this._exportFields,r=e.getData(),n=e.getDataDims(),a=i.length?i:Object.keys(n),s=this._normalizeExportFields(a.concat(this._appendFields),this._excludeFields),o=r.reduce(function(e,i){return e.concat(s.reduce(function(e,t){var r=t.value(i),n=JSON.stringify(r);if(!ue.isDate(r)&&ue.isObject(r))n='"'+n.replace(/"/g,'""')+'"';else{var a=pe(n,'"').replace(/"/g,'""');n=Boolean(['"',",",";","\n","\r"].find(function(e){return a.indexOf(e)>=0}))?'"'+a+'"':a}return e.concat(n)},[]).join(t))},[s.map(function(e){return e.title}).join(t)]).join("\r\n"),l=(this._fileName||"export")+".csv";we(l,"text/csv",o)},_renderFillLegend:function(t,i,r,n){var a=function(e,t){var i=e[0],r=e[1],n=(r-i)/(t-1),a=ue.range(t-2).map(function(e){return i+n*(e+1)});return[i].concat(a).concat(r)},s=this._unit.getScale("color"),o=Se(t.guide,"color",s.dim).toUpperCase(),l="text-transform:uppercase;font-weight:600;font-size:"+e.fontSize+"px",c=s.domain().sort(function(e,t){return e-t}),d=s.brewer.length,u=e.fontSize,h=a(c,d).reverse().map(function(e,t){return''}),f=a(c,3).reverse().map(function(e,t,i){return''+e+""}),p=[''," ",' ',h.join("")," "," ",' '+o+"",' ',' '," ",f.join("")," "," Sorry, your browser does not support inline SVG.",""].join(""),g=(new DOMParser).parseFromString(p,"application/xml").documentElement;return document.body.appendChild(g),i.append("g").attr("class","legend").attr("transform","translate("+(n+10)+","+e.paddingTop+")").node().appendChild(g),{h:120,w:0}},_renderColorLegend:function(t,i,r,n){var a=this._unit.getScale("color"),s=Se(t.guide,"color",a.dim).toUpperCase(),o=this._getColorMap(r.getChartModelData({excludeFilter:["legend"]}),a,a.dim).values,l=i.append("g").attr("class","legend").attr("transform","translate("+(n+10)+","+e.paddingTop+")");return l.append("text").text(s.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":e.fontSize+"px"}),l.selectAll("g").data(o).enter().append("g").call(function(t){t.attr("transform",function(e,t){return"translate(5,"+20*(t+1)+")"}),t.append("circle").attr("r",6).attr("fill",function(e){return a.toColor(e.color)}).attr("class",function(e){return a.toClass(e.color)}),t.append("text").attr("x",12).attr("y",5).text(function(e){return ue.escape(me(e.label)?"No "+s:e.label)}).style({"font-size":e.fontSize+"px"})}),{h:20*o.length,w:0}},_renderSizeLegend:function(t,i,r,n,a){var s,o,l=this._unit.getScale("size"),c=Se(t.guide,"size",l.dim).toUpperCase(),d=r.getChartModelData().sort(function(e,t){return l(e[l.dim])-l(t[l.dim])}),u=d.length,h=d[0][l.dim],f=d[u-1][l.dim];if(f-h){var p=(o=f-h,Math.log(o)/Math.LN10),g=4-p<0?0:Math.round(4-p),m=Math.pow(10,g),b=(f-h)/5;s=ue.unique([h,h+b,h+2*b,h+3*b,f].map(function(e){return e===f||e===h?e:Math.round(e*m)/m}))}else s=[h];var y=s.map(function(e){var i=l(e),r=i/2;return{diameter:ge(i+2),radius:r,value:e,className:t.color?"color-definite":""}}.bind(this)).reverse(),v=Math.max.apply(null,y.map(function(e){return e.diameter})),x=e.fontSize,_=0,w=i.append("g").attr("class","legend").attr("transform","translate("+(n+10)+","+(e.paddingTop+a.h+20)+")");w.append("text").text(c.toUpperCase()).style({"text-transform":"uppercase","font-weight":"600","font-size":x+"px"}),w.selectAll("g").data(y).enter().append("g").call(function(e){e.attr("transform",function(){var e="translate(5,"+(_+=v)+")";return _+=10,e}),e.append("circle").attr("r",function(e){return e.radius}).attr("class",function(e){return e.className}).style({opacity:.4}),e.append("g").attr("transform",function(){return"translate("+v+","+x/2+")"}).append("text").attr("x",0).attr("y",0).text(function(e){return e.value}).style({"font-size":x+"px"})})},_renderAdditionalInfo:function(e,t){var i=this._findUnit(t);if(i){var r={h:0,w:0};e=f.select(e);var n=parseInt(e.attr("width"),10);e.attr("height");e.attr("width",n+160);var a=t.getScaleInfo(i.color);if(a.dim&&!a.discrete){var s=this._renderFillLegend(i,e,t,n);r.h=s.h+20,r.w=s.w}if(a.dim&&a.discrete){var o=this._renderColorLegend(i,e,t,n);r.h=o.h+20,r.w=o.w}var l=t.getScaleInfo(i.size);l.dim&&!l.discrete&&this._renderSizeLegend(i,e,t,n,r)}},_addBackground:function(e,t){if(t&&"transparent"!==t){var i=document.createElementNS("http://www.w3.org/2000/svg","rect");i.setAttribute("fill",t),i.setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",e.getAttribute("width")),i.setAttribute("height",e.getAttribute("height")),e.insertBefore(i,e.firstChild)}},onUnitDraw:function(e,t){r.default.api.isChartElement(t)&&"chart"===t.config.namespace&&(this._unit=t)},_getColorMap:function(e,t,i){return ue.unique(e.map(function(e){var r=e[i];return{color:t(r),value:r,label:r}}),function(e){return e.value}).reduce(function(e,t){return e.brewer[t.value]=t.color,e.values.push(t),e},{brewer:{},values:[]})},_select:function(e,t){var i=this["_to"+(e=e||"").charAt(0).toUpperCase()+e.slice(1)];i&&i.call(this,t)},_handleMenu:function(e,t,i){e.addEventListener("click",function(e){if("a"===e.target.tagName.toLowerCase()){var r=e.target.getAttribute("data-value");this._select(r,t),i.hide()}}.bind(this)),e.addEventListener("mouseover",function(e){"a"===e.target.tagName.toLowerCase()&&e.target.focus()}.bind(this)),e.addEventListener("keydown",function(e){if(e.keyCode===ye.ESCAPE&&i.hide(),e.keyCode===ye.DOWN&&(e.target.parentNode.nextSibling?e.target.parentNode.nextSibling.childNodes[0].focus():e.target.parentNode.parentNode.firstChild.childNodes[0].focus()),e.keyCode===ye.UP&&(e.target.parentNode.previousSibling?e.target.parentNode.previousSibling.childNodes[0].focus():e.target.parentNode.parentNode.lastChild.childNodes[0].focus()),e.keyCode===ye.ENTER){var r=e.target.getAttribute("data-value");this._select(r,t)}e.preventDefault()}.bind(this));var r=null,n=function(){r=setTimeout(function(){i.hide()},100)},a=function(){clearTimeout(r)},s=function(){i.toggle(),i.hidden||e.querySelectorAll("a")[0].focus()};e.addEventListener("blur",n,!0),e.addEventListener("focus",a,!0),this._container.addEventListener("click",s),this._onDestroy(function(){e.removeEventListener("blur",n,!0),e.removeEventListener("focus",a,!0),this._container.removeEventListener("click",s),clearTimeout(r)})},init:function(t){e=e||{},e=ue.defaults(e,{backgroundColor:"white",visible:!0,fontSize:13,paddingTop:30}),this._chart=t,this._info={},this._cssPaths=e.cssPaths,this._fileName=e.fileName,this._backgroundColor=e.backgroundColor||"white",this._destroyListeners=[],this._csvSeparator=e.csvSeparator||",",this._exportFields=e.exportFields||[],this._appendFields=e.appendFields||[],this._excludeFields=e.excludeFields||[],this._cssPaths||(this._cssPaths=[],r.default.api.globalSettings.log('[export plugin]: the "cssPath" parameter should be specified for correct operation',"warn"));var i=e.visible?"":"display:none";this._container=t.insertToHeader('Export');var n=t.addBalloon({place:"bottom-left"});n.content(['"].join("")),n.attach(this._container);var a=n.getElement();a.setAttribute("tabindex","-1"),this._handleMenu(a,t,n);const s=t.on("export-to",function(e,{type:t,fileName:i}){this._fileName=i||this._fileName,this._select(t,e)}.bind(this)),o=t.on("exportTo",function(e,t){r.default.api.globalSettings.log([de,"`exportTo` event is deprecated, use `export-to` instead."],"warn"),this._select(t,e)}.bind(this));this._onDestroy(function(){n.destroy(),t.removeHandler(s),t.removeHandler(o)})},_onDestroy:function(e){this._destroyListeners.push(e)},destroy:function(){this._destroyListeners.forEach(function(e){e.call(this)},this);(e=>e&&e.parentElement&&e.parentElement.removeChild(e))(this._container)}}}r.default.api.plugins.add("export-to",Te);const Me={...f},Ce=r.default.api.domUtils;var ke=r.default.api.utils,Ae=16,Pe="#E5E7EB",Oe="#FFFFFF",Ne=1,Le=0,Re="__transitionAttrs__",Fe="__floatingAxesSrcParent__",De="__floatingAxesSrcTransform__",$e=0,ze=function(){return++$e};function Be(e){var t=ke.defaults(e||{},{detectBackground:!0,bgcolor:"#fff"});return{init:function(e){this.instanceId=ze(),this.chart=e,this.rootNode=e.getLayout().contentContainer,this.beforeExportHandler=e.on("beforeExportSVGNode",function(){this.removeFloatingLayout()},this),this.afterExportHandler=e.on("afterExportSVGNode",function(){this.createFloatingLayout()},this)},onBeforeRender:function(){this.removeFloatingLayout()},onRender:function(){if(t.detectBackground){var e=this.detectChartBackgroundColor();e&&(t.bgcolor=e)}Oe=t.bgcolor;var i=!0;this.chart.traverseSpec(this.chart.getSpec(),function(e){e&&0===e.type.indexOf("COORDS.")&&("COORDS.RECT"!==e.type?i=!1:"extract-axes"!==(e.guide||{}).autoLayout&&(i=!1))}),i&&this.createFloatingLayout()},destroy:function(){this.removeFloatingLayout(),this.chart.removeHandler(this.beforeExportHandler,this),this.chart.removeHandler(this.afterExportHandler,this)},createFloatingLayout:function(){var e,i,n=this.instanceId,a=this.rootNode,s=this.chart.getSVG(),o=Me.select(s),l=this.chart.configGPL.settings.animationSpeed,c=this.scrollManager=new He(a),d=(e=function(e){var t="> ."+e+".axis.tau-active";return[".frame-root.tau-active "+t,".frame-root.tau-active .cell.tau-active "+t].join(", ")},{x:Array.from(s.querySelectorAll(e("x"))),y:Array.from(s.querySelectorAll(e("y")))}),u=function(){function e(e){return{axis:e,parentTransform:function(e){var t,i={translate0:{x:0,y:0},translate:{x:0,y:0}},r=e;for(;r&&"SVG"!==r.nodeName.toUpperCase();)t=Ve(r),i.translate0.x+=t.translate0.x,i.translate0.y+=t.translate0.y,i.translate.x+=t.translate.x,i.translate.y+=t.translate.y,r=r.parentNode;return i}(e.parentNode),axisTransform:Ve(e)}}return{x:d.x.map(e),y:d.y.map(e)}}(),h=(i=u.y.map(function(e){return e.axisTransform.translate.x+e.parentTransform.translate.x}),Math.max.apply(null,i)+1),p=function(e){return Math.min.apply(null,e)}(u.x.map(function(e){return e.axisTransform.translate.y+e.parentTransform.translate.y}))-1,g=r.default.api.globalSettings.getScrollbarSize(a);var m={scrollLeft:a.scrollLeft,scrollTop:a.scrollTop,visibleWidth:a.clientWidth,visibleHeight:a.clientHeight,scrollbarWidth:g.width,scrollbarHeight:g.height,svgWidth:Number(o.attr("width")),svgHeight:Number(o.attr("height")),minXAxesY:p,maxYAxesX:h},b=function(){var e=o.append("defs").attr("class","floating-axes floating-axes__defs"),t={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(t).forEach(function(i){var r=t[i],a=e.append("linearGradient").attr("id","shadow-gradient-"+i+"-"+n).attr("x1",r.x1).attr("y1",r.y1).attr("x2",r.x2).attr("y2",r.y2);a.append("stop").attr("class","floating-axes__shadow-start").attr("offset","0%").attr("stop-color",Pe).attr("stop-opacity",Ne),a.append("stop").attr("class","floating-axes__shadow-end").attr("offset","100%").attr("stop-color",Oe).attr("stop-opacity",Le)}),e}();function y(e,t){t.forEach(function(t){t.axis[Fe]=t.axis.parentNode;var i=e.append("g");l?i.attr("transform",Ie(t.parentTransform.translate0.x,t.parentTransform.translate0.y)).transition().duration(l).attr("transform",Ie(t.parentTransform.translate.x,t.parentTransform.translate.y)):i.attr("transform",Ie(t.parentTransform.translate.x,t.parentTransform.translate.y)),i.node().appendChild(t.axis),Array.prototype.forEach.call(t.axis.querySelectorAll(".label"),function(e){e[De]=e.getAttribute("transform")})})}var v,x,_=function(){var e=m.svgHeight-m.minXAxesY+1+m.scrollbarHeight,t=o.append("g").attr("class","floating-axes floating-axes__x").call(S,m.svgWidth,e,0,m.minXAxesY);y(t,u.x);var i=t.selectAll(".label");return c.handleVisibilityFor(t,"y").handleVisibilityFor(i,"x").onScroll(function(e,r){var n=Math.min(m.visibleHeight+r-m.svgHeight-m.scrollbarHeight,0);t.attr("transform",Ie(0,n)),i.each(function(){var t=je(this[De]),i=-m.svgWidth+m.visibleWidth+e-10;this.setAttribute("transform","translate("+(t.x+i)+","+t.y+") rotate("+t.r+")")})}),t}(),w=function(){var e=o.append("g").attr("class","floating-axes floating-axes__y").call(S,m.maxYAxesX,m.svgHeight);y(e,u.y);var t=e.selectAll(".label");return c.handleVisibilityFor(e,"x").handleVisibilityFor(t,"y").onScroll(function(i,r){var n=Math.max(i,0);e.attr("transform",Ie(n,0)),t.each(function(){var e=je(this[De]);const t=r+10;this.setAttribute("transform","translate("+e.x+","+(e.y+t)+") rotate("+e.r+")")})}),e}(),E=(v=m.svgHeight-m.minXAxesY+m.scrollbarHeight,x=o.append("g").attr("class","floating-axes floating-axes__corner").call(S,m.maxYAxesX,v),c.handleVisibilityFor(x,"xy").onScroll(function(e,t){var i=Math.max(e,0),r=m.minXAxesY,n=Math.min(t+m.visibleHeight-v,r);x.attr("transform",Ie(i,n))}),x);function S(e,i,r,n,a){n=n||0,a=a||0,e.append("rect").attr("class","i-role-bg").attr("x",n-1).attr("y",a-1).attr("width",Math.max(0,i+2)).attr("height",Math.max(0,r+2)).attr("fill",t.bgcolor)}var T=function(){var e=m.maxYAxesX,t=m.svgHeight-m.minXAxesY+m.scrollbarHeight,i=o.append("g").attr("class","floating-axes floating-axes__shadows").attr("pointer-events","none"),r=function(e,t,r,a,s){return i.append("rect").attr("fill","url(#shadow-gradient-"+e+"-"+n+")").attr("x",t).attr("y",r).attr("width",Math.max(0,a)).attr("height",Math.max(0,s))},a=r("ns",0,0,e,Ae),s=r("ew",m.visibleWidth-Ae,m.visibleHeight-t,Ae,t),l=r("sn",0,m.visibleHeight-t-Ae,e,Ae),d=r("we",e,m.visibleHeight-t,Ae,t);c.handleVisibilityFor(a,"xy").handleVisibilityFor(s,"xy").handleVisibilityFor(l,"xy").handleVisibilityFor(d,"xy").onScroll(function(e,t){var r=e,n=t;i.attr("transform",Ie(r,n));var o=function(e,t){e.style("visibility",t?"":"hidden")};o(a,t>0&&m.svgHeight>m.visibleHeight),o(s,e+m.visibleWidthm.visibleWidth),o(l,t+m.visibleHeightm.visibleHeight),o(d,e>0&&m.svgWidth>m.visibleWidth)})}(),M=_.node(),C=w.node(),k=E.node();c.onScroll(function(e){s.insertBefore(M,0===e?k.nextElementSibling:C)}),c.fireScroll(),this.floatingLayout={defs:b,xAxes:_,yAxes:w,shadows:T},o.selectAll(".floating-axes").on("mouseenter",function(){Ce.dispatchMouseEvent(s,"mouseleave")}).on("mousemove",function(){f.event.stopPropagation()}).on("click",function(){f.event.stopPropagation()})},removeFloatingLayout:function(){function e(e){e.selectAll(".axis").each(function(){this[Fe].appendChild(this),delete this[Fe],Array.prototype.forEach.call(this.querySelectorAll(".label"),function(e){e.setAttribute("transform",e[De]),delete e[De]})})}this.floatingLayout&&(this.floatingLayout.xAxes.call(e),this.floatingLayout.yAxes.call(e),this.scrollManager.destroy(),this.floatingLayout=null),Me.select(this.chart.getSVG()).selectAll(".floating-axes").remove()},detectChartBackgroundColor:function(){var e,t=this.chart.getLayout().layout;do{if("none"!==(e=window.getComputedStyle(t)).backgroundImage)return null;if("transparent"!==e.backgroundColor&&"rgba(0, 0, 0, 0)"!==e.backgroundColor)return e.backgroundColor}while(t=t.parentElement);return null}}}function Ie(e,t){return"translate("+e+","+t+")"}function je(e){var t={x:0,y:0,r:0};if(!e)return t;var i=e.indexOf("translate(");if(i>=0){var r=e.indexOf(")",i+10),n=e.substring(i+10,r).trim().replace(","," ").replace(/\s+/," ").split(" ");t.x=parseFloat(n[0]),n.length>1&&(t.y=parseFloat(n[1]))}var a=e.indexOf("rotate(");if(a>=0){var s=e.indexOf(")",a+7),o=e.substring(a+7,s);t.r=parseFloat(o.trim())}return t}function Ve(e){var t=e[Re]&&e[Re].transform,i=je(e.getAttribute("transform"));return{translate0:i,translate:t?je(e[Re].transform):i}}function He(e){var t={x:[],y:[]},i={x:0,y:0},r={x:null,y:null},n=e,a=[];this.onScroll=function(e){return a.push(e),this},this.handleVisibilityFor=function(e,i){return i.indexOf("x")>=0&&t.x.push(e),i.indexOf("y")>=0&&t.y.push(e),this};var s=function(){var e=n.scrollLeft,s=n.scrollTop;a.forEach(function(t){t.call(null,e,s)});var l=function(n){var a="x"===n?e:s;a!==i[n]&&(clearTimeout(r[n]),o(t[n],function(e){e.transition("floatingAxes_scrollVisibility"),e.attr("opacity",1e-6)}),r[n]=setTimeout(function(){o(t[n],function(e){r[n]=null,e.transition("floatingAxes_scrollVisibility").duration(256).attr("opacity",1)})},128)),i[n]=a};l("x"),l("y")};function o(e,t,i){e.forEach(function(e){t.call(i,e)})}n.addEventListener("scroll",s),this.fireScroll=function(){s.call(null,n.scrollLeft,n.scrollTop)},this.destroy=function(){n.removeEventListener("scroll",s)}}r.default.api.plugins.add("floating-axes",Be);var We=r.default.api.utils;function Ue(e){We.defaults(e||{},{});var t=function(e,t,i,r){e.addEventListener(t,function(e){for(var t=e.target;t!==e.currentTarget&&null!==t;)t.classList.contains(i)&&r(e,t),t=t.parentNode})};return{init:function(e){this._chart=e,this._currentFilters={},this._legendColorByScaleId={};var i=this._chart.getSpec(),r=function(e){return function(t,r){var n=i.scales[r];return n.type===e&&n.dim&&t.push(r),t}};this._color=Object.keys(i.scales).reduce(r("color"),[]),this._fill=Object.keys(i.scales).reduce(r("fill"),[]);var n=this._color.length>0,a=this._fill.length>0;(n||a)&&(this._container=this._chart.insertToRightSidebar(this._containerTemplate),n&&(t(this._container,"click","tau-chart__legend__item-color",function(e,t){this._toggleLegendItem(t)}.bind(this)),t(this._container,"mouseover","tau-chart__legend__item-color",function(e,t){this._highlightToggle(t,!0)}.bind(this)),t(this._container,"mouseout","tau-chart__legend__item-color",function(e,t){this._highlightToggle(t,!1)}.bind(this))))},onSpecReady:function(){this._assignStaticBrewersOrEx()},onRender:function(){this._clearPanel(),this._drawColorLegend(),this._drawFillLegend()},_containerTemplate:'
',_template:We.template('
<%=name%>
<%=items%>
'),_itemTemplate:We.template(["
\">",'
','
',"
","<%=label%>","
"].join("")),_itemFillTemplate:We.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 e=this;e._color.forEach(function(t){var i=e._chart.select(function(e){return e.config.color===t})[0];if(i){var r=i.getScale("color"),n=e._chart.getDataSources({excludeFilter:["legend"]}),a=We.unique(n[r.source].data.map(function(e){return e[r.dim]})).map(function(i){var n=We.escape(i),a=r.dim+n;return{scaleId:t,dim:r.dim,color:r(i),disabled:e._currentFilters.hasOwnProperty(a),label:i,value:n}});e._legendColorByScaleId[t]=a,e._container.insertAdjacentHTML("beforeend",e._template({items:a.map(function(t){return e._itemTemplate({scaleId:t.scaleId,dim:t.dim,color:t.color,classDisabled:t.disabled?"disabled":"",label:t.label,value:t.value})}).join(""),name:(((i.guide||{}).color||{}).label||{}).text||r.dim}))}})},_drawFillLegend:function(){var e=this;e._fill.forEach(function(t){var i=e._chart.select(function(e){return"COORDS.MAP"===e.config.type&&e.config.fill===t});if(i.length>0){var r=i[0].getScale("fill"),n=r.brewer,a=r.domain(),s=(a[1]-a[0])/n.length,o=We.range(n.length).map(function(t){var i=a[0]+t*s,o="";return 0===t&&(o=a[0]),t===n.length-1&&(o=a[1]),e._itemFillTemplate({color:r(i),label:o,value:We.escape(i)})});e._container.insertAdjacentHTML("beforeend",e._template({items:o.join(""),name:(((i[0].guide||{}).fill||{}).label||{}).text||r.dim}))}})},_toggleLegendItem:function(e){var t=e.getAttribute("data-scale-id"),i=e.getAttribute("data-dim"),r=e.getAttribute("data-value"),n=i+r,a=this._legendColorByScaleId[t].filter(function(e){return!e.disabled});if(1!==a.length||t!==a[0].scaleId||r!==a[0].value){var s=this._currentFilters;if(s.hasOwnProperty(n)){var o=s[n];delete s[n],e.classList.remove("disabled"),this._chart.removeFilter(o)}else e.classList.add("disabled"),s[n]=this._chart.addFilter({tag:"legend",predicate:function(e){return e[i]!=r}});this._chart.refresh()}},_highlightToggle:function(e,t){var i=e.getAttribute("data-scale-id"),r=e.getAttribute("data-dim"),n=e.getAttribute("data-value");this._chart.select(function(e){return e.config.color===i}).forEach(function(e){e.fire("highlight",function(e){return!t||e[r]==n})})},_generateColorMap:function(e){var t=We.range(20).map(function(e){return"color20-"+(1+e)});return e.reduce(function(e,i,r){return e[i]=t[r%20],e},{})},_assignStaticBrewersOrEx:function(){var e=this;e._color.forEach(function(t){var i=e._chart.getSpec().scales[t],r=e._chart.getDataSources({excludeFilter:["legend"]}),n=e._chart.getScaleFactory(r).createScaleInfoByName(t).domain();i.brewer||(i.brewer="measure"!==i.dimType?e._generateColorMap(n):["#e5f5e0","#a1d99b","#31a354"])})}}}r.default.api.plugins.add("geomap-legend",Ue);var Xe=r.default.api.utils;function Ge(e){Xe.defaults(e||{},{});var t=function(){return!1};return{init:function(e){this._currNode=null,this._currData=null,this._chart=e,this._tooltip=e.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(e){for(var t=e.target;t!==e.currentTarget&&null!==t;)t.classList.contains("i-role-exclude")&&(i._exclude(),i._tooltip.hide(),i._blurSelection()),t=t.parentNode},!1);var t,i=this;this._showTooltip=function(e){clearTimeout(t),i._currData=e.data;var r="No data";null!==e.data&&(r=Object.keys(e.data).map(function(t){return i.itemTemplate({label:t,value:e.data[t]})}).join(""));var n=i._tooltip.getElement().querySelectorAll(".i-role-content");n[0]&&(n[0].innerHTML=r);var a=i._tooltip.getElement().querySelectorAll(".i-role-exclude");if(a[0]){var s=e.data&&i._chart.getChartModelData().length>1;a[0].style.visibility=s?"visible":"hidden"}i._tooltip.show(e.event.pageX,e.event.pageY).updateSize()},this._hideTooltip=function(e){t=setTimeout(function(){i._tooltip.hide()},e?0:1e3)},this._tooltip.getElement().addEventListener("mouseover",function(e){clearTimeout(t)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(e){i._hideTooltip(!0),i._blurSelection()},!1)},onRender:function(){var e=this;this._chart.select(function(e){return"COORDS.MAP"===e.config.type}).forEach(function(t){e._subscribeToPoints(t),e._subscribeToArea(t)})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:Xe.template(['
','
<%=label%>
','
<%=value%>
',"
"].join("")),_exclude:function(){var e;this._chart.addFilter({tag:"exclude",predicate:(e=this._currData,function(t){return JSON.stringify(t)!==JSON.stringify(e)})}),this._chart.refresh()},_blurSelection:function(){this._chart.select(function(e){return"COORDS.MAP"===e.config.type}).forEach(function(e){e.fire("highlight-area",t)}),this._currNode=null,this._currData=null},_subscribeToPoints:function(e){var t=this;e.on("point-mouseover",function(e,i){t._showTooltip(i)}),e.on("point-mouseout",function(e,i){t._hideTooltip()})},_subscribeToArea:function(e){var t=this;!e.getScale("code").dim||e.on("area-click",function(i,r){var n,a;t._currNode=i,r.data?t._currData===r.data?(t._hideTooltip(!0),t._blurSelection()):(e.fire("highlight-area",(n=r.data,a=JSON.stringify(n),function(e){return JSON.stringify(e)===a})),t._showTooltip(r)):(t._showTooltip(r),t._hideTooltip(!1),t._blurSelection())})}}}r.default.api.plugins.add("geomap-tooltip",Ge);var qe=i(2),Ye=r.default.api.utils,Ke=r.default.api.pluginsSDK,Je=Ke.tokens();function Qe(e){var t=Ye.defaults(e||{},{title:"Layers",label:"Layer Type",showPanel:!0,showLayers:!0,mode:"merge",axisWidth:45,layers:[]});t.layers.forEach(function(e){e.guide=Ye.defaults(e.guide||{},{scaleOrient:"left",textAnchor:"end",hide:!1})});var i=function(e){return function(t){return Object.assign(t,e)}},r={line:i({type:"ELEMENT.LINE"}),area:i({type:"ELEMENT.AREA"}),dots:i({type:"ELEMENT.POINT"}),scatterplot:i({type:"ELEMENT.POINT"}),bar:i({type:"ELEMENT.INTERVAL"}),"stacked-bar":i({type:"ELEMENT.INTERVAL",stack:!0})};return{init:function(e){this._chart=e;var i=Ke.spec(this._chart.getSpec()),r=this.checkIfApplicable(i);if(this._isApplicable=0===r.length,i.addTransformation("defined-only",function(e,t){var i=t.key;return e.filter(function(e){return null!==e[i]&&void 0!==e[i]})}),this._isApplicable){this.isFacet=this.checkIsFacet(i),this.primaryY=this.findPrimaryLayer(i);var n=this.getLayersText(),a=this.getLayersGroup(),s=t.label;this.fieldColorScale=s,i.setSettings("excludeNull",!1).setSettings("fitModel",null).addScale(s,{type:"color",source:"/",dim:s,brewer:t.brewer}).addTransformation("slice-layer",function(e,t){var i=t.key,r=t.group;return r?e.filter(function(e){var t=e[r],i=e[t];return t&&null!=i}):e.filter(function(e){return e[s]===n[i]&&null!==e[i]&&void 0!==e[i]})});var o=[this.primaryY].concat(t.layers).reduce(function(e,t){return e.concat(t.y)},[]);e.setupChartSourceModel(function(e){var t={};t[s]={type:"category"};var i={"/":{dims:t,data:[]}};return i["/"].dims=Object.assign(t,e["/"].dims),i["/"].data=e["/"].data.reduce(function(e,t){return e.concat(o.map(function(e){var i={};i[s]=n[e];var r=a[e];return r&&(i[r]=t[e],i.subLayer=r),Object.assign(i,t)}))},[]),Object.assign(i,Ye.omit(e,"/"))}),t.showPanel&&(this._container=e.insertToRightSidebar(this.containerTemplate),this._container.classList.add("applicable-true"),this.uiChangeEventsDispatcher=function(e){var i=e.target,r=i.classList;r.contains("i-role-show-layers")&&(t.showLayers=i.checked),r.contains("i-role-change-mode")&&(t.mode=i.value),this._chart.refresh()}.bind(this),this._container.addEventListener("change",this.uiChangeEventsDispatcher,!1))}else{i.getSettings("log")("[layers plugin]: is not applicable. "+r.join(" / "))}},getLayersText:function(){return[this.primaryY].concat(t.layers).reduce(function(e,t){return(Array.isArray(t.y)?t.y:[t.y]).reduce(function(e,i){return e[i]=this.extractLabelForKey(t,i),e}.bind(this),e)}.bind(this),{})},getLayersGroup:function(){return[this.primaryY].concat(t.layers).reduce(function(e,t){var i=null;return Array.isArray(t.y)&&(i=t.y.join(", ")),Ye.flatten([t.y]).reduce(function(e,t){return e[t]=i,e},e)}.bind(this),{})},checkIsFacet:function(e){return e.unit().reduce(function(e,t,i){return e||(i&&"COORDS.RECT"===i.type&&"COORDS.RECT"===t.type?e=!0:e)},!1)},checkIfApplicable:function(e){return e.unit().reduce(function(t,i,r){if(r&&"COORDS.RECT"!==r.type)return t.concat("Chart specification contains non-rectangular coordinates");if(r&&"COORDS.RECT"===r.type&&"COORDS.RECT"!==i.type){var n=e.getScale(i.y);if("measure"!==e.getSourceDim(n.source,n.dim).type)return t.concat("Y scale is not a measure")}return t},[])},isLeafElement:function(e,t){return t&&"COORDS.RECT"===t.type&&"COORDS.RECT"!==e.type},isFirstCoordNode:function(e,t){return!t&&e&&"COORDS.RECT"===e.type},isFinalCoordNode:function(e,t){return e&&"COORDS.RECT"===e.type&&e.units.every(function(e){return"COORDS.RECT"!==e.type})},buildLayersLayout:function(e){return e.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(e){var t=this,i=e.unit().reduce(function(i,r){return i.concat(t.isFinalCoordNode(r)?{y:e.getScale(r.y).dim,isPrimary:!0,guide:r.guide.y,scaleName:r.y}:[])},[]);return Ke.cloneObject(i[0])},createPrimaryUnitReducer:function(e,i,r,n){var a=this;return function(s,o,l){var c=function(e){return!0!==e.guide.hide};if(a.isFacet&&a.isFirstCoordNode(o,l)){o.guide.y.label=o.guide.y.label||{};var d=o.guide.y.label._original_text||o.guide.y.label.text;o.guide.y.label.text=[d,i.filter(c).map(a.extractLayerLabel.bind(a)).join(", ")].join(e.getSettings("facetLabelDelimiter")),"dock"===t.mode&&(o.guide.y.label.padding-=15,o.guide.y.padding+=15,o.guide.y.rotate=-90,o.guide.y.textAnchor="middle")}return a.isLeafElement(o,l)&&(l.units=l.units.filter(function(e){return e!==o})),a.isFinalCoordNode(o)&&(o.guide.y.label=o.guide.y.label||{},"dock"===t.mode&&(o.guide.padding.l=r,o.guide.padding.r=n,o.guide.y.hide=!0),"merge"===t.mode&&(o.guide.y.label.text=a.isFacet?"":i.filter(c).map(a.extractLayerLabel.bind(a)).join(", "))),s}},createSecondaryUnitReducer:function(e,i,n,a,s,o,l,c){var d=this,u=d.getScaleName(i.scaleName||i.y),h=i.guide.scaleOrient,f=Array.isArray(i.y),p=i.isPrimary;return function(g,m,b){if(d.isFacet&&d.isFirstCoordNode(m,b)&&(m.guide.y.label.text="",m.guide.x.hide=!0,m.guide.y.hide=!0),d.isLeafElement(m,b)){(i.type?r[i.type]:function(e){return e})(m),m.y=u;var y=e.getScale(m.size).dim;if(p&&y);else{var v="size_null"+c;e.addScale(v,{type:"size",source:"?",mid:1}),m.size=v}var x=e.getScale(m.color).dim;p&&x||(m.color=d.fieldColorScale,m.expression.operator="groupBy",m.expression.params=f?["subLayer"]:[d.fieldColorScale]);var _=f?{group:"subLayer"}:{key:i.y};Ke.unit(m).addTransformation("slice-layer",_)}if(d.isFinalCoordNode(m)){if(m.y=u,m.guide.y=Object.assign(m.guide.y,i.guide||{}),m.guide.y.label=m.guide.y.label||{},m.guide.y.label.text=d.extractLayerLabel(i),m.guide.x.hide=!0,"dock"===t.mode){m.guide.showGridLines="",m.guide.padding.l=n,m.guide.padding.r=a,m.guide.y.label.textAnchor="end",m.guide.y.label.dock="right",m.guide.y.label.padding="right"===h?1:-10,m.guide.y.label.cssClass="label inline";var w="right"===h?l:o;m.guide.y.padding+=s*w}"merge"===t.mode&&(m.guide.showGridLines="",m.guide.y.hide=!0)}return g}},getScaleName:function(e){return Array.isArray(e)?e.join(", "):e},extractLabelForKey:function(e,t){var i=e.guide||{};i.label="string"==typeof i.label?{text:i.label}:i.label;var r=i.label||{},n=r.byKeys||{};return Array.isArray(e.y)?n[t]||t:r.text||r._original_text||e.y},extractLayerLabel:function(e){var t=this;return(Array.isArray(e.y)?e.y:[e.y]).map(function(i){return t.extractLabelForKey(e,i)}).join(", ")},onSpecReady:function(e,i){var r=this,n=Ke.spec(i);if(t.showLayers&&r._isApplicable){n=t.layers.reduce(function(e,t){var i=r.getScaleName(t.y);return e.addScale(i,Object.assign({type:"linear",source:"/",dim:i,autoScale:!0},Ye.pick(t.guide||{},"min","max","autoScale","nice","niceInterval")))},n);var a,s=[this.primaryY].concat(t.layers).sort(function(e,t){return(e.guide.zIndex||0)-(t.guide.zIndex||0)}),o=n.unit(),l=t.axisWidth,c=function(e){return function(t){var i=t.guide.scaleOrient||"left";return!0!==t.guide.hide&&i===e}},d=c("left"),u=c("right"),h=s.filter(d).length*l,f=s.filter(u).length*l,p=r.buildLayersLayout(n).addFrame({key:{x:1,y:1},units:[(a=Ke.unit(o.clone())).reduce(r.createPrimaryUnitReducer(n,s,h,f),a).value()]}),g=-1,m=-1;s.reduce(function(e,t,i){return g=d(t)?g+1:g,m=u(t)?m+1:m,e.addFrame({key:{x:1,y:1},units:[(a=Ke.unit(o.clone())).reduce(r.createSecondaryUnitReducer(n,t,h,f,l,g,m,i),a).value()]})},p)}else n.unit().traverse(function(e,t){r.isLeafElement(e,t)&&Ke.unit(e).addTransformation("defined-only",{key:n.getScale(e.y).dim})})},onUnitsStructureExpanded:function(){var e=this;if(e._isApplicable&&"merge"===t.mode){var i=Ke.spec(e._chart.getSpec()),r=e.primaryY.scaleName,n=t.layers.map(function(t){return e.getScaleName(t.y)}).filter(function(e){return i.getScale(e)}).concat(r),a=n.reduce(function(t,i){var r=e._chart.getScaleInfo(i);return t[i]=r.domain().filter(function(e){return Number.isFinite(e)}),t},{}),s=qe.extent(Ye.flatten(Object.keys(a).map(function(e){return a[e]})));n.forEach(function(e){var t=i.getScale(e);t.min=s[0],t.max=s[1],t.nice=!1})}},containerTemplate:'
',template:Ye.template(['","
",'","
"].join("")),onRender:function(){this._isApplicable&&t.showPanel&&(this._container.innerHTML=this.template({title:t.title,mode:t.mode,showLayers:t.showLayers}))}}}r.default.api.plugins.add("layers",Qe);var Ze=i(6);const et=r.default.api.utils,tt=r.default.api.pluginsSDK,it=".tau-chart__legend__reset",rt=".tau-chart__legend__item-color",nt=".tau-chart__legend__guide--color__overlay",at=4,st=13;let ot=0;const lt=()=>++ot,ct=r.default.api.utils.xml,dt=(e,t)=>{const i=e[0],r=e[1],n=(r-i)/(t-1),a=et.range(t-2).map(e=>i+n*(e+1));return[i].concat(a).concat(r)},ut=(e,t,i)=>{if(e.length<3)return e.slice(0);if(t<3)return[e[0],e[e.length-1]];const r=e[0]<0?Math.abs(e[0]):0,n=e=>e,a="sqrt"===i?e=>Math.sqrt(e+r):n,s="sqrt"===i?e=>e**2-r:n;let o=[(e=e.map(a))[0]];const l=e[e.length-1]-e[0],c=.5*l/(t-1),d=et.range(1,t-1).map(e=>{const i=l*e/(t-1);return{min:i-c,mid:i,max:i+c,diff:Number.MAX_VALUE,closest:null}});let u,h=0;const f=()=>{if(h===d.length)return;const e=u;(u=d[h++]).min=Math.max(u.min,(e&&null!==e.closest?e.closest:o[0])+c)};return f(),e.forEach(e=>{if(eu.max&&f();const t=Math.abs(e-u.mid);t{null!==e.closest&&o.push(e.closest)}),o.push(e[e.length-1]),o=o.map(s)},ht=e=>Math.log(e)/Math.LN10,ft=e=>0===e?0:Math.floor(ht(Math.abs(e))),pt=(()=>{const e=/\.0+([^\d].*)?$/,t=/(\.\d+?)0+([^\d].*)?$/;return i=>i.replace(e,"$1").replace(t,"$1$2")})(),gt=Ze.format(".3s"),mt=e=>pt(gt(e)),bt=(e,t)=>{const i=Math.max(Math.abs(e),Math.abs(t)),r=ft(i),n=e*t>0?Math.abs(t-e):i,a=ft(n),s=Math.abs(r-a);return Math.abs(r)>3&&s<=3?mt:e=>{const t=ft(i-e),r=Math.min((a<0?Math.abs(a):0)+(t{}}),r=e=>null===e||""===e||void 0===e,n=e=>e.every(e=>et.isDate(e)),a=(e,t)=>i=>{const n=i[e],a=JSON.stringify(r(n)?null:n);return t===a},s=(e,t,i,r)=>{e.addEventListener(t,e=>{let t=e.target;for(;t!==e.currentTarget&&null!==t;)t.matches(i)&&r(e,t),t=t.parentNode})};return{init(e){this.instanceId=lt(),this._chart=e,this._currentFilters={},this._legendColorByScaleId={},this._legendOrderState={};const t=this._chart.getSpec(),r=e=>(i,r)=>{const n=t.scales[r];return n.type===e&&n.dim&&i.push(r),i};this._color=Object.keys(t.scales).reduce(r("color"),[]).filter(t=>e.getScaleInfo(t).discrete),this._fill=Object.keys(t.scales).reduce(r("color"),[]).filter(t=>!e.getScaleInfo(t).discrete),this._size=Object.keys(t.scales).reduce(r("size"),[]);const n=this._color.length>0,a=this._fill.length>0,o=this._size.length>0;if(this._assignStaticBrewersOrEx(),n||a||o){switch(i.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)}n&&(s(this._container,"click",it,(e,t)=>{this._toggleLegendItem(t,"reset")}),s(this._container,"click",rt,(e,t)=>{const i=e.ctrlKey||e.target.matches(nt)?"leave-others":"focus-single";this._toggleLegendItem(t,i)}),s(this._container,"mouseover",rt,(e,t)=>{this._highlightToggle(t,!0)}),s(this._container,"mouseout",rt,(e,t)=>{this._highlightToggle(t,!1)}))}},destroy(){const e=this._currentFilters,t=this._chart;Object.keys(e).forEach(i=>t.removeFilter(e[i])),this._container&&this._container.parentElement&&(this._clearPanel(),this._container.parentElement.removeChild(this._container))},onSpecReady(e,t){this._formatters=tt.getFieldFormatters(t,i.formatters)},_getFormat(e){return this._formatters[e]?this._formatters[e].format:e=>String(e)},onRender(){if(t&&i.selectedCategories&&0!==i.selectedCategories.length){let e=this._getLegendColorByScales();return Object.keys(e).forEach(t=>{e[t].legendColorItems.forEach(({value:e,dim:t})=>{if(-1===i.selectedCategories.indexOf(JSON.parse(e))){const i=t+e,r=a(t,e);this._currentFilters[i]=this._chart.addFilter({tag:"legend",predicate:e=>!r(e)})}})}),t=!1,void this._chart.refresh()}this._clearPanel(),this._drawColorLegend(),this._drawFillLegend(),this._drawSizeLegend()},_containerTemplate:'
',_template:et.template(['
',"<%=top%>",'
<%=name%>
',"<%=items%>","
"].join("")),_itemTemplate:et.template(["
\">",'
','
','
',"
","
","
",' <%=label%>',"
"].join("")),_resetTemplate:et.template(['
','
Reset
',"
"].join("")),_clearPanel(){this._container&&(clearTimeout(this._scrollTimeout),this._getScrollContainer().removeEventListener("scroll",this._scrollListener),this._container.innerHTML="")},_drawFillLegend(){const e=this;e._fill.forEach(t=>{const i=e._chart.select(e=>e.config.color===t)[0];if(i){const t=i.config.guide||{},r=i.getScale("color"),a=r.domain().sort((e,t)=>e-t),s=n(a),o=s?a.map(Number):a,l=bt(o[0],o[o.length-1]),c=(()=>{const t=e._chart.getSpec();let i=tt.extractFieldsFormatInfo(t)[r.dim].format;return i||(i=(e=>new Date(e))),e=>String(i(e))})(),d=s?c:l,u=r.brewer.length,h=((t.color||{}).label||{}).text||r.dim,f=e=>e.length*st*.618,p=r.isInteger?(o[1]-o[0])%3==0?4:(o[1]-o[0])%2==0?3:2:3,g=dt(o,p);let m=(s?g.map(e=>new Date(e)):g).map(d);m[0]===m[m.length-1]&&(m=[m[0]]),e._container.insertAdjacentHTML("beforeend",e._template({name:et.escape(h),top:null,items:'
'}));const b=e._container.lastElementChild.querySelector(".tau-chart__legend__gradient-wrapper"),y=b.getBoundingClientRect().width;let v=!1;m.reduce((e,t)=>e+f(t),0)>y&&(m.length>1&&f(m[0])+f(m[m.length-1])>y?v=!0:m=[m[0],m[m.length-1]]);const x=20,_=v?(()=>{const e=-.382*st/2;return{width:y,height:120,barX:0,barY:0,barWidth:x,barHeight:120,textAnchor:"start",textX:et.range(p).map(()=>25),textY:1===m.length?60+.618*st:m.map((t,i)=>{const r=(m.length-1-i)/(m.length-1);return st*(1-r)+120*r+e})}})():(()=>{const e=f(m[0])/2,t=f(m[m.length-1])/2;return{width:y,height:x+8+st,barX:0,barY:0,barWidth:y,barHeight:x,textAnchor:"middle",textX:1===m.length?[y/2]:m.map((i,r)=>{const n=r/(m.length-1);return e*(1-n)+(y-t)*n}),textY:et.range(p).map(()=>x+8+st)}})(),w=dt(o,u).map((e,t)=>{return ct("stop",{offset:`${t/(u-1)*100}%`,style:`stop-color:${r(e)};stop-opacity:1"`})}),E=`legend-gradient-${e.instanceId}`,S=ct("svg",{class:"tau-chart__legend__gradient",width:_.width,height:_.height},ct("defs",ct("linearGradient",{id:E,x1:"0%",y1:v?"100%":"0%",x2:v?"0%":"100%",y2:"0%"},...w)),ct("rect",{class:"tau-chart__legend__gradient__bar",x:_.barX,y:_.barY,width:_.barWidth,height:_.barHeight,fill:`url(#${E})`}),...m.map((e,t)=>ct("text",{x:_.textX[t],y:_.textY[t],"text-anchor":_.textAnchor},e)));b.insertAdjacentHTML("beforeend",S)}})},_drawSizeLegend(){const e=this;e._size.forEach(t=>{const i=e._chart.select(e=>e.config.size===t)[0];if(i){const t=i.config.guide||{},r=i.getScale("size"),n=r.domain().sort((e,t)=>e-t);if(!Array.isArray(n)||!n.every(isFinite))return;const a=((t.size||{}).label||{}).text||r.dim,s=n[0],o=n[n.length-1];let l=[s];if(o-s){const t=ht(o-s),i=10**Math.round(4-t),n=et.unique(e._chart.getDataSources({excludeFilter:["legend"]})[r.source].data.map(e=>e[r.dim]).filter(e=>e>=s&&e<=o)).sort((e,t)=>e-t),a=ut(n,at,r.funcType);l=et.unique(a.map(e=>Math.round(e*i)/i))}const c=bt(l[0],l[l.length-1]),d=e=>e.length*st*.618;l.reverse();const u=l.map(r),h=Math.max.apply(null,u),f=l.map(c);e._container.insertAdjacentHTML("beforeend",e._template({name:et.escape(a),top:null,items:'
'}));const p=e._container.lastElementChild.querySelector(".tau-chart__legend__size-wrapper"),g=p.getBoundingClientRect().width;let m=!1;(Math.max.apply(null,f.map(d))>g/4||1===f.length)&&(m=!0);const b=m?(()=>{const e=st,t=u[0]/2,i=u[u.length-1]/2,r=[t];for(let t,i,n=1;nh/2),circleY:r,textAnchor:"start",textX:et.range(f.length).map(()=>h+8),textY:r.map(e=>e+n)}})():(()=>{const e=Math.max(d(f[0])/2,u[0]/2),t=Math.max(d(f[f.length-1])/2,u[u.length-1]/2),i=(g-u.reduce((e,t,i)=>e+(0===i||i===u.length-1?t/2:t),0)-e-t)/(at-1),r=[e];for(let e,t,n=1;nh-e/2);return{width:g,height:h+8+st,circleX:r,circleY:n,textAnchor:"middle",textX:r,textY:et.range(f.length).map(()=>h+8+st)}})(),y=ct("svg",{class:"tau-chart__legend__size",width:b.width,height:b.height},...u.map((e,t)=>ct("circle",{class:`tau-chart__legend__size__item__circle ${i.config.color?"color-definite":"color-default-size"}`,cx:b.circleX[t],cy:b.circleY[t],r:e/2})),...f.map((e,t)=>ct("text",{class:"tau-chart__legend__size__item__label",x:b.textX[t],y:b.textY[t],"text-anchor":b.textAnchor},e)));p.insertAdjacentHTML("beforeend",y)}})},_getLegendColorByScales(){const e=this;return e._color.reduce((t,i)=>{const a=e._chart.select(e=>e.config.color===i)[0];if(a){const s=a.config.guide||{},o=a.getScale("color"),l=e._chart.getDataSources({excludeFilter:["legend"]});let c=et.unique(l[o.source].data.map(e=>e[o.dim]));const d=e._chart.getSpec().scales[i],u=n(c);if(d.order)c=et.union(et.intersection(d.order,c),c);else if("order"===d.dimType&&u)c=c.sort((e,t)=>new Date(e)-new Date(t));else{const t=e._legendOrderState[i];c=c.sort((e,i)=>{const r=t[e]-t[i];return r&&r/Math.abs(r)})}const h=((s.color||{}).label||{}).text||o.dim,f=(s.color||{}).tickFormatNullAlias||`No ${h}`,p=e._getFormat(o.dim);let g=c.map(t=>{const n=JSON.stringify(r(t)?null:t),a=o.dim+n;return{scaleId:i,dim:o.dim,color:o(t),disabled:e._currentFilters.hasOwnProperty(a),label:p(t),value:n}});t[i]={legendColorItems:g,title:h,colorScale:o,noVal:f}}return t},{})},_drawColorLegend(){const e=this,t=this._getLegendColorByScales();Object.keys(t).forEach(i=>{const{legendColorItems:n,title:a,colorScale:s,noVal:o}=t[i];e._container.insertAdjacentHTML("beforeend",e._template({name:et.escape(a),top:e._resetTemplate({classDisabled:n.some(function(e){return e.disabled})?"":"disabled"}),items:n.map(function(t){return e._itemTemplate({scaleId:t.scaleId,dim:et.escape(t.dim),color:t.color,cssClass:s.toClass(t.color),cssColor:t.disabled?"transparent":s.toColor(t.color),borderColor:s.toColor(t.color),classDisabled:t.disabled?"disabled":"",label:et.escape(r(t.label)?o:t.label),value:et.escape(t.value)})}).join("")}))}),e._color.length>0&&(e._updateResetButtonPosition(),e._scrollTimeout=null,e._scrollListener=(()=>{const t=e._container.querySelector(it);t.style.display="none",e._scrollTimeout&&clearTimeout(e._scrollTimeout),e._scrollTimeout=setTimeout(()=>{e._updateResetButtonPosition(),t.style.display="",e._scrollTimeout=null},250)}),e._getScrollContainer().addEventListener("scroll",e._scrollListener))},_toggleLegendItem(e,t){const r=this._currentFilters,n=e?Array.prototype.filter.call(e.parentNode.childNodes,e=>e.matches(rt)):null,s=e=>{const t=e.getAttribute("data-dim"),i=e.getAttribute("data-value");return{sid:e.getAttribute("data-scale-id"),dim:t,val:i,key:t+i}},o=e=>e in r,l=(e,t)=>{const i=s(e);if(o(i.key)===t)if(t){const t=r[i.key];delete r[i.key],e.classList.remove("disabled"),this._chart.removeFilter(t)}else{e.classList.add("disabled");const t=a(i.dim,i.val);r[i.key]=this._chart.addFilter({tag:"legend",predicate:e=>!t(e)})}},c=t=>t===e,d=!!e&&o(s(e).key),u=(e,t)=>{e.querySelector(".tau-chart__legend__guide").style.backgroundColor=t?"":"transparent"};if("reset"===t)n.forEach(e=>{l(e,!0),u(e,!0)});else if("leave-others"===t)n.forEach(e=>{c(e)&&l(e,d)}),u(e,d);else if("focus-single"===t){const t=!d&&n.every(e=>c(e)||o(s(e).key));n.forEach(e=>{const i=c(e)||t;l(e,i)}),d&&u(e,!0)}const h=n.filter(e=>!o(s(e).key)).map(e=>JSON.parse(s(e).val));i.onSelect({type:t,selectedCategories:h}),this._chart.refresh()},_highlightToggle(e,t){if(e.matches(".disabled"))return;const i=e.getAttribute("data-dim"),r=e.getAttribute("data-value"),n=t?a(i,r):e=>null;this._chart.select(e=>!0).forEach(e=>{e.fire("highlight",n)})},_getScrollContainer(){return this._container.parentNode.parentNode},_updateResetButtonPosition(){this._container.querySelector(it).style.top=`${this._getScrollContainer().scrollTop}px`},_generateColorMap(e,t){const i=t.length;return e.reduce((e,r,n)=>(e[r]=t[n%i],e),{})},_assignStaticBrewersOrEx(){const e=this;e._color.forEach(t=>{const i=e._chart.getSpec().scales[t],r=e._chart.getDataSources({excludeFilter:["legend"]}),n=e._chart.getScaleFactory(r).createScaleInfoByName(t).domain();if(!i.brewer||Array.isArray(i.brewer)){const t=i.brewer||et.range(20).map(e=>`color20-${1+e}`);i.brewer=e._generateColorMap(n,t)}e._legendOrderState[t]=n.reduce((e,t,i)=>(e[t]=i,e),{})})}}}r.default.api.plugins.add("legend",yt);var vt=r.default.api.utils;function xt(e){var t=vt.defaults(e||{},{verbose:!1,forceBrush:{}}),i={init:function(e){t.verbose&&(this.panel=e.insertToRightSidebar(this.template())),e.traverseSpec(e.getSpec(),function(e){e&&"COORDS.PARALLEL"===e.type&&(e.guide=e.guide||{},e.guide.enableBrushing=!0)}),i.forceBrush=t.forceBrush||{}},onRender:function(e){var r=e.getSpec().scales,n=Object.keys(r).reduce(function(e,t){var n=r[t].dim;return i.forceBrush[n]&&(e[t]=i.forceBrush[n]),e},{}),a=e.select(function(e){return"PARALLEL/ELEMENT.LINE"===e.config.type});a.forEach(function(e,r){e.parentUnit.on("brush",function(n,a){i.forceBrush={};var s=a.map(function(e){var t=e.dim,r=e.func,n=e.args;i.forceBrush[t]=n;var a=function(){return!0};return"between"===r&&(a=function(e){return e[t]>=n[0]&&n[1]>=e[t]}),"inset"===r&&(a=function(e){return n.indexOf(e[t])>=0}),a}),o=0;if(e.fire("highlight",function(e){var t=s.every(function(t){return t(e)});return o+=t?1:0,t}),t.verbose){var l=i.panel.getElementsByClassName("i-"+r);if(0===l.length){var c=document.createElement("div");c.className="i-"+r,i.panel.appendChild(c),l[0]=c}l[0].innerHTML=a.reduce(function(e,t){return e+"
"+t.dim+": ["+t.args.join(",")+"]
"},"
Matched: "+o+"
")}})}),a.forEach(function(e){e.parentUnit.fire("force-brush",n)})},template:vt.template('
')};return i}r.default.api.plugins.add("parallel-brushing",xt);var _t=r.default.api.utils;function wt(e){_t.defaults(e||{},{});return{init:function(e){this._cursor=null,this._chart=e,this._tooltip=e.addBalloon({spacing:3,auto:!0,effectClass:"fade"}),this._tooltip.content(this.template),this._tooltip.getElement().addEventListener("click",function(e){for(var t=e.target;t!==e.currentTarget&&null!==t;)t.classList.contains("i-role-exclude")&&i._exclude(),t=t.parentNode;i._tooltip.hide()},!1);var t,i=this;this.showTooltip=function(e){clearTimeout(t),i._cursor=e.data;var r=i._tooltip.getElement().querySelectorAll(".i-role-content");r[0]&&(r[0].innerHTML=Object.keys(e.data).map(function(t){return i.itemTemplate({label:t,value:e.data[t]})}).join("")),i._tooltip.show(e.event.pageX,e.event.pageY).updateSize()},this.hideTooltip=function(e){t=setTimeout(function(){i._tooltip.hide()},1e3)},this._tooltip.getElement().addEventListener("mouseover",function(e){clearTimeout(t)},!1),this._tooltip.getElement().addEventListener("mouseleave",function(e){i._tooltip.hide()},!1)},_exclude:function(){var e;this._chart.addFilter({tag:"exclude",predicate:(e=this._cursor,function(t){return JSON.stringify(t)!==JSON.stringify(e)})}),this._chart.refresh()},onRender:function(e){var t=this;e.select(function(e){return"PARALLEL/ELEMENT.LINE"===e.config.type}).forEach(function(e){e.on("mouseout",function(e,i){t.hideTooltip(i)}),e.on("mouseover",function(e,i){t.showTooltip(i)})})},template:['
','
','
','',"Exclude","
","
","
",'
'].join(""),itemTemplate:_t.template(['
','
<%=label%>
','
<%=value%>
',"
"].join(""))}}r.default.api.plugins.add("parallel-tooltip",wt);var Et=i(8),St=i(3),Tt=i(7);const Mt={...qe,...Et,...St,...f,...Tt};var Ct=r.default.api.utils,kt=0;function At(e={}){return{init:function(t){this._chart=t,this._currentFilters={},this._data={},this._bounds={},this._filter={},this._container={},this._layout=this._chart.getLayout().layout;var i=this,r=this._chart.getSpec(),n=r.sources["/"],a=e.fields||e;this._fields=Array.isArray(a)&&a.length>0?a:Object.keys(n.dims),this._fieldBounds=e.fieldBounds||{},this._applyImmediately=Boolean(e.applyImmediately);var s=i._chart.getChartModelData();this._filtersContainer=i._chart.insertToRightSidebar(i._filtersContainer),this._filtersContainer.style.maxHeight="0px",i._fields.filter(function(e){var t="measure"===n.dims[e].type;return t||r.settings.log("The ["+e+"] isn't measure so Quick Filter plugin skipped it"),t}).forEach(function(e){i._data[e]=s.map(function(t){return t[e]});const t=i._fieldBounds[e];i._bounds[e]=t?[t.min,t.max]:Mt.extent(i._data[e]),i._filter[e]=i._bounds[e],i._filtersContainer.insertAdjacentHTML("beforeend",i._filterWrapper({name:e})),i._container[e]=i._filtersContainer.lastChild,i._drawFilter(e)})},onRender:function(){this._filtersContainer.style.maxHeight="none"},_filtersContainer:'
',_filterWrapper:Ct.template('
<%=name%>
'),_drawFilter:function(e){var t=this._data[e],i=this._bounds[e],r=this._filter[e],n=Ct.isDate(i[0])||Ct.isDate(i[1]),a=this,s=0,o=24,l=21,c=12,d=180-c-o,u=41-s-l-8,h=Mt.scaleLinear().domain(i).range([0,d]),p=Mt.brushX().extent([[0,0],[d,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=Mt.select(this._container[e]).append("svg").attr("width",d+c+o).attr("height",u+s+l+4).append("g").attr("transform","translate("+c+","+s+")"),m=(g.append("g").selectAll("rect").data(t).enter().append("rect").attr("transform",function(e){return"translate("+h(e)+","+(s+4)+")"}).attr("height",u).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",u+8),m.selectAll(".resize").append("text").attr("x",0).attr("y",2*(u+4)),m.selectAll("rect").attr("height",u+8);var b=g.append("text").attr("x",d/2).attr("y",2*(u+4)).attr("class","date-label"),y=function(e){return Math.log(e)/Math.LN10}(a._filter[e][1]-a._filter[e][0]),v=Math.round(3-y),x=Math.pow(10,v);if(n){var _=function(e){var t=e.findIndex(function(e){var t=Mt.timeFormat(e);return t(new Date(i[0]))!==t(new Date(i[1]))});return t=t<0?e.length:t,{comm:e.slice(0,t),diff:e.slice(t)}}(["’%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(){const t=f.event;if(t&&Array.isArray(t.selection)){const i=t.selection.map(h.invert);r=i,a._filter[e]=i}else r=a._filter[e];var i=n?new Date(r[0]).getTime():r[0],s=n?new Date(r[1]).getTime():r[1],o=Math.round(parseFloat(i)*x)/x,l=Math.round(parseFloat(s)*x)/x;m.select(".handle--w"),m.select(".handle--e");m.select(".resize.w").attr("transform",`translate(${h(r[0])},0)`),m.select(".resize.e").attr("transform",`translate(${h(r[1])},0)`);var c=m.selectAll(".w text"),d=m.selectAll(".e text");if(n){var u=Mt.timeFormat(_.comm.join("")),p=Mt.timeFormat(_.diff.join(""));b.html(p(new Date(o))+" .. "+p(new Date(l))+' '+u(new Date(l))+"")}else c.text(o),d.text(l)}function E(){w(),a._applyFilter(e)}E(),p.move(m,r.map(h))},destroy(){const e=this._currentFilters,t=this._chart;Object.keys(e).forEach(i=>t.removeFilter(e[i]));(e=>e&&e.parentElement&&e.parentElement.removeChild(e))(this._filtersContainer)},_applyFilter:function(e){var t=this._currentFilters,i=function(e,t,i){return function(r){var n=r[e];return ni}}(e,this._filter[e][0],this._filter[e][1]),r=t[e];delete t[e],this._chart.removeFilter(r),t[e]=this._chart.addFilter({tag:"quick-filter",predicate:function(e){return!i(e)}}),kt<0?this._chart.refresh():(this._refreshRequestId&&clearTimeout(this._refreshRequestId),this._refreshRequestId=setTimeout(function(){this._refreshRequestId=null,this._chart.refresh()}.bind(this),kt))}}}r.default.api.plugins.add("quick-filter",At);var Pt=r.default.api.utils;function Ot(e){var t=Pt.defaults(e||{},{show:!0,modes:["normal","entire-view","fit-width","fit-height","minimal"]});return{init:function(e){t.show&&(t.selectedMode=e.getSpec().settings.fitModel,e.insertToHeader(this.template({modes:t.modes.map(function(e){return""})})).addEventListener("change",function(i){var r=i.target;r.classList.contains("i-role-fit-model")&&(t.selectedMode=r.value,e.getSpec().settings.fitModel=t.selectedMode,e.refresh())},!1))},template:Pt.template(['
',"
"," View Mode: ",' ","
","
"].join(""))}}r.default.api.plugins.add("settings",Ot);function Nt(e){return new q(e)}r.default.api.plugins.add("tooltip",Nt);var Lt,Rt=(Lt={linear:function(e){for(var t=[0,0,0,0,0],i=0,r=[];iMath.abs(e[i][a])&&(a=r);for(n=i;n=i;n--)e[n][r]-=e[n][i]*e[i][r]/e[i][i]}for(r=o-1;r>=0;r--){for(s=0,n=r+1;n=0;o--)m+=o>1?Math.round(100*f[o])/100+"x^"+o+" + ":1==o?Math.round(100*f[o])/100+"x + ":Math.round(100*f[o])/100;return{equation:f,points:n,string:m}},lastvalue:function(e){for(var t=[],i=null,r=0;r0&&se[s]-e[o]?a:s;for(var d=Math.abs(1/(e[l]-c)),u=0,h=0,f=0,p=0,g=0,m=a;m<=s;){var b=e[m],y=t[m],v=r((m1&&(a||o)&&(h=[h[0],h[h.length-1]]),e.concat(h.length>1?h:[])},[])},e.traverseSpec(i,function(e,r){if(n.predicateIsApplicable(i,e,r)){var a=i.scales[e.x],s=i.scales[e.y],o=i.scales[e.color]||{},l=JSON.parse(JSON.stringify(e));l.type="ELEMENT.LINE",l.size="size_null",l.namespace="trendline",l.transformation=l.transformation||[],l.transformation.push({type:"regression",args:{type:t.type,x:a,y:s,g:o}});l.guide=Ft.defaults({},l.guide||{}),l.guide.interpolate="linear",l.guide.showAnchors="never",l.guide.cssClass="tau-chart__trendline",l.guide.widthCssClass="tau-chart__line-width-1",l.guide.x=l.guide.x||{},l.guide.x.fillGaps=!1,delete l.guide.label,delete l.label,r.units.push(l)}})}},containerTemplate:'
',template:Ft.template(['","
",'","
",'
<%= error %>
'].join("")),onRender:function(e){if(this._container){this._container.innerHTML=this.template({title:"Trend line",error:this._error,showTrend:t.showTrend&&this._isApplicable?"checked":"",models:t.models.map(function(e){return""})});var i=function(e){return function(){f.select(this).classed({active:e,"tau-chart__line-width-1":!e,"tau-chart__line-width-3":e})}};f.select(e.getSVG()).selectAll(".tau-chart__trendline").on("mouseenter",i(!0)).on("mouseleave",i(!1))}}}}r.default.api.plugins.add("trendline",Dt);var $t={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"]}},zt=function(e,t){return $t[e][t].map(function(i,r){return e+" q"+r+"-"+t})};r.default.api.colorBrewers.add("tauBrewer",zt);i.d(t,"GPL",function(){return Bt}),i.d(t,"Plot",function(){return It}),i.d(t,"Chart",function(){return jt}),i.d(t,"api",function(){return Vt}),i.d(t,"version",function(){return Ht});const{GPL:Bt,Plot:It,Chart:jt,api:Vt,version:Ht}=r.default}])}); \ No newline at end of file diff --git a/examples/playground.html b/examples/playground.html index dd756a58a..0819e6409 100644 --- a/examples/playground.html +++ b/examples/playground.html @@ -20,7 +20,8 @@ + - \ No newline at end of file + diff --git a/examples/playground.js b/examples/playground.js index c67dd991a..75a57789e 100644 --- a/examples/playground.js +++ b/examples/playground.js @@ -1,6 +1,7 @@ var now = new Date(); + var chart = new Taucharts.Chart({ type: 'scatterplot', settings:{ @@ -8,6 +9,7 @@ var chart = new Taucharts.Chart({ }, x: 'x', y: 'y', + color: 'color', // autoResize: false, /*dimensions: { @@ -20,7 +22,9 @@ var chart = new Taucharts.Chart({ scale: `linear`, } },*/ - plugins: [Taucharts.api.plugins.get('quick-filter')()], + plugins: [Taucharts.api.plugins.get('quick-filter')(), Taucharts.api.plugins.get('tooltip')({onExclude(raw) { + console.log(raw); + }})], settings: { $maxTickTextW: 1000, $maxTickTextH: 1000, @@ -43,7 +47,8 @@ var chart = new Taucharts.Chart({ let date = new Date(now - days(i)); return memo.concat([{ x: date, //new Intl.DateTimeFormat('ru', {year:"numeric", month:"short", day: "numeric"}).format(date), - y: Math.random() * 100 + y: Math.random() * 100, + color: i%2 ? `red`: `blue` }]); }, []) }); diff --git a/package.json b/package.json index fd15a8454..6854eca66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taucharts", - "version": "2.6.5", + "version": "2.7.0", "homepage": "https://github.com/TargetProcess/taucharts", "description": "Data-focused charting library based on D3", "author": { @@ -26,18 +26,18 @@ ], "dependencies": { "d3-array": "^1.2.1", - "d3-axis": "^1.0.8", - "d3-brush": "^1.0.4", - "d3-color": "^1.0.3", - "d3-format": "^1.2.0", - "d3-geo": "^1.9.0", - "d3-quadtree": "^1.0.3", + "d3-axis": "^1.0.12", + "d3-brush": "^1.0.6", + "d3-color": "^1.2.3", + "d3-format": "^1.3.2", + "d3-geo": "^1.11.3", + "d3-quadtree": "^1.0.6", "d3-scale": "^1.0.6", - "d3-selection": "^1.1.0", - "d3-shape": "^1.2.0", - "d3-time": "^1.0.7", - "d3-time-format": "^2.1.0", - "d3-transition": "^1.1.0", + "d3-selection": "^1.4.0", + "d3-shape": "^1.3.4", + "d3-time": "^1.0.11", + "d3-time-format": "^2.1.3", + "d3-transition": "^1.2.0", "topojson-client": "^3.0.0" }, "repository": { @@ -56,40 +56,41 @@ "publishToReleaseBranch": "node tasks/publishToReleaseBranch.js" }, "devDependencies": { - "@types/d3": "5.0.0", - "canvg": "1.5.2", - "chai": "4.1.2", - "css-loader": "1.0.0", - "d3": "5.6.0", - "file-saver": "1.3.8", - "fs-extra": "7.0.0", - "gh-pages": "1.2.0", - "istanbul-instrumenter-loader": "3.0.1", + "@babel/core": "^7.3.4", + "@babel/plugin-proposal-class-properties": "^7.3.4", + "@babel/preset-typescript": "^7.3.3", + "@types/d3": "^5.7.1", + "babel-loader": "^8.0.5", + "babel-plugin-istanbul": "^5.1.1", + "canvg": "^1.5.3", + "chai": "^4.2.0", + "css-loader": "^2.1.0", + "d3": "^5.9.1", + "file-saver": "^2.0.1", + "fs-extra": "^7.0.1", + "gh-pages": "^2.0.1", "jquery": "3.3.1", "js-schema": "1.0.1", - "karma": "3.0.0", + "karma": "^4.0.0", "karma-chrome-launcher": "2.2.0", - "karma-coverage": "1.1.2", - "karma-coveralls": "2.0.0", + "karma-coverage-istanbul-reporter": "^2.0.5", + "karma-coveralls": "^2.1.0", "karma-mocha": "1.3.0", - "karma-remap-coverage": "0.1.5", - "karma-sourcemap-loader": "0.3.7", "karma-spec-reporter": "0.0.32", - "karma-webpack": "3.0.0", - "less": "3.8.1", + "karma-webpack": "^4.0.0-rc.6", + "less": "^3.9.0", "less-loader": "4.1.0", - "mini-css-extract-plugin": "^0.4.2", - "mocha": "5.2.0", - "style-loader": "0.22.1", + "mini-css-extract-plugin": "^0.5.0", + "mocha": "^6.0.2", + "style-loader": "^0.23.1", "tau-tooltip": "1.1.3", - "ts-loader": "4.5.0", - "tslint": "5.11.0", + "tslint": "^5.13.0", "tslint-eslint-rules": "5.4.0", - "typescript": "3.0.1", - "webpack": "4.19.1", - "webpack-bundle-analyzer": "2.13.1", - "webpack-cli": "3.1.0", - "webpack-dev-server": "3.1.14" + "typescript": "^3.3.3333", + "webpack": "^4.29.5", + "webpack-bundle-analyzer": "^3.0.4", + "webpack-cli": "^3.2.3", + "webpack-dev-server": "^3.2.1" }, "types": "./types/index.d.ts" }