@carbon/charts 1.27.8 → 1.27.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { h as e, k as r, X as o, A as t, a8 as i, F as l, B as n, o as d, p as h, C as p, f as u, e as S, r as C, s as c, q as g, a9 as B, D as m, z as T, a7 as L, G as b, v as k, E as A, H as x, I as P, Y as R, b as w, L as G, j as H, K as v, O as M, N as f, M as D, P as Z, Q as j, R as q, l as y, w as z, m as E, J as W, S as F, x as I, t as J, u as K, y as N, g as O, T as Q, a as U, d as V, U as X, V as Y, i as _, W as $, n as aa, Z as sa, _ as ea, $ as ra, a0 as oa, a1 as ta, a2 as ia, a3 as la, a4 as na, a5 as da, a6 as ha } from "../choropleth-DQATcCWY.mjs";
1
+ import { h as e, k as r, X as o, A as t, a8 as i, F as l, B as n, o as d, p as h, C as p, f as u, e as S, r as C, s as c, q as g, a9 as B, D as m, z as T, a7 as L, G as b, v as k, E as A, H as x, I as P, Y as R, b as w, L as G, j as H, K as v, O as M, N as f, M as D, P as Z, Q as j, R as q, l as y, w as z, m as E, J as W, S as F, x as I, t as J, u as K, y as N, g as O, T as Q, a as U, d as V, U as X, V as Y, i as _, W as $, n as aa, Z as sa, _ as ea, $ as ra, a0 as oa, a1 as ta, a2 as ia, a3 as la, a4 as na, a5 as da, a6 as ha } from "../choropleth-TkZkP8Rn.mjs";
2
2
  export {
3
3
  e as Alluvial,
4
4
  r as Area,
package/dist/index.mjs CHANGED
@@ -4,8 +4,8 @@ import { i as So } from "./index-CLdAL6df.mjs";
4
4
  import { ChartModel as Re, ChartModelCartesian as Te, AlluvialChartModel as be, BoxplotChartModel as Oe, BulletChartModel as fe, ChoroplethModel as Se, CirclePackChartModel as Ae, PieChartModel as xe, GaugeChartModel as De, HeatmapModel as ye, ChartModelBinned as Le, MeterChartModel as Fe, RadarChartModel as Pe, TreeChartModel as Me, TreemapChartModel as ke, WordCloudModel as Be } from "./model/index.mjs";
5
5
  import { a0 as j, r as i, L as Z, q as h, z as A, u as N, e as $, S as Ie, v as K, H as p, l as R } from "./axis-scales-CFRGPXH8.mjs";
6
6
  import { A as xo, a as Do, b as yo, c as Lo, d as Fo, f as Po, B as Mo, g as ko, C as Bo, h as Io, i as Ho, j as Go, k as Vo, m as No, n as Uo, D as Zo, o as _o, G as zo, p as Wo, s as jo, t as $o, w as Ko, M as Jo, x as Xo, P as qo, y as Qo, R as Yo, F as en, I as sn, T as tn, J as on, K as nn, N as rn, O as an, Q as hn, U as cn, V as mn, W as ln, X as pn, Y as dn, Z as un, _ as Cn, $ as vn } from "./axis-scales-CFRGPXH8.mjs";
7
- import { c as He, L as ee, C as Ge, T as _, a as z, b as g, S as L, d as se, M as W, e as Ve, f as Ne, g as Ue, H as Ze, Z as _e, A as te, h as ze, i as d, G as w, R as B, j as k, k as oe, l as M, m as u, B as We, n as I, o as je, p as $e, q as ne, r as Ke, s as Je, t as ie, u as U, v as re, w as ae, x as he, y as ce, P as Xe, D as qe, z as Qe, E as Ye, F as es, I as ss, J as ts, K as os, N as ns, O as is, Q as rs, U as as, V as hs, W as cs } from "./choropleth-DQATcCWY.mjs";
8
- import { X as wn, a8 as En, a9 as Rn, a7 as Tn, Y as bn, _ as On, $ as fn, a0 as Sn, a1 as An, a2 as xn, a3 as Dn, a4 as yn, a5 as Ln, a6 as Fn } from "./choropleth-DQATcCWY.mjs";
7
+ import { c as He, L as ee, C as Ge, T as _, a as z, b as g, S as L, d as se, M as W, e as Ve, f as Ne, g as Ue, H as Ze, Z as _e, A as te, h as ze, i as d, G as w, R as B, j as k, k as oe, l as M, m as u, B as We, n as I, o as je, p as $e, q as ne, r as Ke, s as Je, t as ie, u as U, v as re, w as ae, x as he, y as ce, P as Xe, D as qe, z as Qe, E as Ye, F as es, I as ss, J as ts, K as os, N as ns, O as is, Q as rs, U as as, V as hs, W as cs } from "./choropleth-TkZkP8Rn.mjs";
8
+ import { X as wn, a8 as En, a9 as Rn, a7 as Tn, Y as bn, _ as On, $ as fn, a0 as Sn, a1 as An, a2 as xn, a3 as Dn, a4 as yn, a5 as Ln, a6 as Fn } from "./choropleth-TkZkP8Rn.mjs";
9
9
  import { b as ms, T as ls, F as ps, E as ds, C as us, Z as Cs, a as vs, c as gs, f as ws } from "./index-CHbrPDmO.mjs";
10
10
  import { G as Es, D as Rs } from "./angle-utils-Dy0Gf7Eb.mjs";
11
11
  import { S as Mn, d as kn, a as Bn, p as In, b as Hn, r as Gn } from "./angle-utils-Dy0Gf7Eb.mjs";
@@ -63,7 +63,7 @@
63
63
  <svg xmlns="http://www.w3.org/2000/svg" class="arrow-right" width="32" height="32" viewBox="0 0 32 32">
64
64
  <polygon points="18 6 16.57 7.393 24.15 15 4 15 4 17 24.15 17 16.57 24.573 18 26 28 16 18 6"/>
65
65
  <rect width="32" height="32"/>
66
- </svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class Rk extends Ze{constructor(t,n){super(t,n),this.model=new hk(this.services),this.model.setOptions(It(At.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new Lk(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}const or=class or extends vt{constructor(){super(...arguments),this.type="grid-brush",this.renderType=st.SVG,this.selectionSelector="rect.selection",this.frontSelectionSelector="rect.frontSelection"}render(t=!0){const n=this.parent,i=this.getComponentContainer({isPresentational:!0});if(!n)throw new Error("SVG was not defined");const r=k.appendOrSelect(n,"svg.chart-grid-backdrop"),s=k.appendOrSelect(r,`g.${this.type}`),a=k.appendOrSelect(s,this.selectionSelector),{width:o,height:l}=k.getSVGElementSize(r,{useAttrs:!0}),{cartesianScales:c}=this.services,u=c.getMainXScaleType(),d=c.getMainXScale(),[h]=d.range();i.attr("transform",`translate(${h},0)`);const f=k.appendOrSelect(i,this.frontSelectionSelector);if(d&&u===it.TIME){let p=this.model.get("zoomDomain");p===void 0&&(p=this.services.zoom.getDefaultZoomBarDomain(),p&&this.model.set({zoomDomain:p},{animate:!1}));const g=x=>{const _=x[1]-x[0];let C="0,"+_.toString();const D=Math.floor(l/or.DASH_LENGTH),$=D*or.DASH_LENGTH;for(let P=0;P<D;P++)C+=","+or.DASH_LENGTH;C+=","+(l-$),D%2===1&&(C+=",0"),C+=","+_.toString(),C+=","+l.toString(),f.attr("stroke-dasharray",C)},m=x=>{const _=x.selection;_===null||_[0]===_[1]||(f.attr("x",parseFloat(a.attr("x"))+parseFloat(r.attr("x"))).attr("y",a.attr("y")).attr("width",a.attr("width")).attr("height",a.attr("height")).style("cursor","pointer").style("display",null),g(_))},v=(x,_)=>{const C=_f().range([0,o]).domain(p);let D=[C.invert(x),C.invert(_)],$="manual";D[0].valueOf()===D[1].valueOf()?(D=this.services.zoom.getDefaultZoomBarDomain(),$="reset"):$="manual",(p[0].valueOf()!==D[0].valueOf()||p[1].valueOf()!==D[1].valueOf())&&this.services.zoom.handleDomainChange(D,{dispatchEvent:!0,type:$})};let S;const E=x=>{const _=x.selection;_!==null&&(v(_[0],_[1]),s.call(S.move,null),f.style("display","none"))};l!=0&&o!=0&&(S=Gh().extent([[0,0],[o-1,l]]).on("start brush end",m).on("end.brushed",E),s.call(S));const b=this.services.zoom.getZoomRatio();r.on("click",function(x){if(x.shiftKey){const _=this.services.domUtils.getHolder(),C=Yn(s.node(),_)[0];let D=C-o*b/2;D<0&&(D=0);let $=C+o*b/2;$>o&&($=o),v(D,$)}})}}};or.DASH_LENGTH=4;let Ou=or;class Ik extends vt{constructor(){super(...arguments),this.type="zoom-bar",this.renderType=st.SVG,this.MIN_SELECTION_DIFF=9e-10,this.brushSelector="g.zoom-bar-brush",this.clipId="zoomBarClip-"+Math.floor(Math.random()*99999999999),this.brush=Gh(),this.highlightStrokeWidth=1}init(){this.services.events.addEventListener(T.ZoomBar.UPDATE,this.render.bind(this));const t=y(this.getOptions(),"zoomBar",z.TOP,"data");this.model.setZoomBarData(t)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"zoom bar"}),i=this.services.zoom.isZoomBarLoading(z.TOP),r=this.services.zoom.isZoomBarLocked(z.TOP),s=y(this.getOptions(),"zoomBar",z.TOP,"type"),a=y(this.getOptions(),"axes",z.BOTTOM,"highlights"),o=_e.height[s],{width:l}=k.getSVGElementSize(this.parent,{useAttrs:!0});if(l===0)return;let c=0;const u=this.model.get("axesMargins");u&&u.left&&(c=u.left);const d=k.appendOrSelect(n,"svg.zoom-container").attr("width","100%").attr("height",o).attr("opacity",1).attr("role","presentation");if(k.appendOrSelect(n,"rect.zoom-spacer").attr("x",0).attr("y",o).attr("width","100%").attr("height",_e.spacerHeight).attr("opacity",1).attr("fill","none"),s===qe.GRAPH_VIEW?k.appendOrSelect(d,"rect.zoom-bg").attr("x",c).attr("y",0).attr("width",l-c).attr("height","100%").classed("zoom-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null):s===qe.SLIDER_VIEW&&k.appendOrSelect(d,"rect.zoom-slider-bg").attr("x",c).attr("y",o/2-1).attr("width",l-c).attr("height",2).classed("zoom-slider-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null),i){this.renderSkeleton(d,c,l);return}const{cartesianScales:h}=this.services,f=h.getMainXScale(),p=h.getMainYScale(),g=h.getMainXScaleType();if(f&&g===it.TIME){let m=this.services.zoom.getZoomBarData();if(Ye(m)||m.length===1)return;this.xScale=f.copy(),this.yScale=p.copy();const v=this.services.zoom.getDefaultZoomBarDomain(m);m=this.compensateDataForDefaultDomain(m,v);const S=this.model.get("initialZoomDomain"),E=y(this.getOptions(),"zoomBar",z.TOP,"initialZoomDomain");E&&E[0]&&E[1]&&(E[0]=new Date(E[0]),E[1]=new Date(E[1])),E&&!(S&&S[0].valueOf()===E[0].valueOf()&&S[1].valueOf()===E[1].valueOf())?this.model.set({initialZoomDomain:ut([],E),zoomDomain:E?ut([],E):v},{skipUpdate:!0}):E===null&&S!==null&&this.model.set({initialZoomDomain:null,zoomDomain:ut([],v)},{skipUpdate:!0}),this.xScale.range([c,l]).domain(v),this.maxSelectionRange=this.xScale.range(),this.yScale.range([0,o-6]).domain(Ue(m,_=>_.value));const b=this.model.get("zoomDomain");if(s===qe.GRAPH_VIEW&&(this.renderZoomBarArea(d,"path.zoom-graph-area-unselected",m,null),this.updateClipPath(n,this.clipId,0,0,0,0),this.renderZoomBarArea(d,"path.zoom-graph-area",m,this.clipId),this.renderZoomBarBaseline(d,c,l),a)){const _=a.highlightStartMapsTo,C=a.highlightEndMapsTo,D=a.color,$=a.labelMapsTo;a.data.forEach((P,w)=>{k.appendOrSelect(d,`rect.highlight-${w}`).attr("height",o-2*this.highlightStrokeWidth).attr("y",this.highlightStrokeWidth).attr("x",this.xScale(P[_])).attr("width",this.xScale(P[C])-this.xScale(P[_])).style("fill",D&&D.scale[P[$]]?D.scale[P[$]]:null).style("fill-opacity",.1).style("stroke",D&&D.scale[P[$]]?D.scale[P[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width","1px")})}this.addBrushEventListener(b,c,l);const x=k.appendOrSelect(n,this.brushSelector).call(this.brush);if(b!==void 0)if(b[0].valueOf()===b[1].valueOf())x.call(this.brush.move,this.xScale.range()),this.updateBrushHandle(this.getComponentContainer(),this.xScale.range());else{const _=b.map(C=>this.xScale(C));_[1]-_[0]<this.MIN_SELECTION_DIFF||(x.call(this.brush.move,_),this.updateBrushHandle(this.getComponentContainer(),_))}r&&(this.brush.filter(()=>!1),x.selectAll("rect").attr("cursor","auto"))}}addBrushEventListener(t,n,i){const r=o=>{const l=o.selection;l===null?this.handleBrushedEvent(o,t,this.xScale,this.xScale.range()):l[0]===l[1]||this.handleBrushedEvent(o,t,this.xScale,l)},s=y(this.getOptions(),"zoomBar",z.TOP,"type"),a=_e.height[s];this.brush.extent([[n,0],[i,a]]).on("start brush end",null).on("start brush end",r)}handleBrushedEvent(t,n,i,r){const s=[i.invert(r[0]),i.invert(r[1])];if(this.updateBrushHandle(this.getComponentContainer(),r),t.sourceEvent!=null&&(t.sourceEvent.type==="mousemove"||t.sourceEvent.type==="mouseup"||t.sourceEvent.type==="mousedown"||t.sourceEvent.type==="touchstart"||t.sourceEvent.type==="touchmove"||t.sourceEvent.type==="touchend")){let a="manual";if(n&&n[0]&&n[1]){const l=this.services.zoom.getDefaultZoomBarDomain();s[0].valueOf()===l[0].valueOf()&&s[1].valueOf()===l[1].valueOf()?a="reset":a="manual"}(n===void 0||n[0]!==s[0]||n[1]!==s[1])&&this.services.zoom.handleDomainChange(s,{dispatchEvent:!1,type:a});let o;t.type==="start"?o=T.ZoomBar.SELECTION_START:t.type==="brush"?o=T.ZoomBar.SELECTION_IN_PROGRESS:t.type==="end"&&(o=T.ZoomBar.SELECTION_END,this.services.events.dispatchEvent(T.ZoomDomain.CHANGE,{newDomain:s,type:a})),this.services.events.dispatchEvent(o,{selection:r,newDomain:s})}}updateBrushHandle(t,n){const i=this,r=_e.handleWidth,s=y(this.getOptions(),"zoomBar",z.TOP,"type"),a=_e.height[s],o=-r/2,l=_e.handleBarWidth,c=s===qe.GRAPH_VIEW?_e.handleBarHeight:6,u=-l/2,d=(a-c)/2;t.select(this.brushSelector).selectAll("rect.handle").data([{type:"w"},{type:"e"}]).attr("x",function(f){if(f.type==="w")return Math.max(n[0]+o,i.maxSelectionRange[0]);if(f.type==="e")return Math.min(n[1]+o,i.maxSelectionRange[1]-r)}).attr("y",0).attr("width",r).attr("height",a).attr("cursor","ew-resize").style("display",null);const h=t.select(this.brushSelector).selectAll("rect.handle-bar").data([{type:"w"},{type:"e"}]);h.enter().append("rect").attr("class",function(f){return"handle-bar handle-bar--"+f.type}),h.attr("x",function(f){if(f.type==="w")return Math.max(n[0]+u,i.maxSelectionRange[0]-o+u);if(f.type==="e")return Math.min(n[1]+u,i.maxSelectionRange[1]+o+u)}).attr("y",d).attr("width",l).attr("height",c).attr("cursor","ew-resize"),s===qe.SLIDER_VIEW&&this.updateSliderSelectedArea(n),this.updateClipPath(t,this.clipId,n[0],0,n[1]-n[0],a)}updateSliderSelectedArea(t){const n=y(this.getOptions(),"zoomBar",z.TOP,"type"),i=_e.height[n],s=this.getComponentContainer().select("svg.zoom-container");k.appendOrSelect(s,"rect.zoom-slider-selected-area").attr("x",t[0]).attr("y",i/2-1).attr("width",t[1]-t[0]).attr("height",2)}renderZoomBarArea(t,n,i,r){const{cartesianScales:s}=this.services,a=s.getMainXAxisPosition(),o=s.getMainYAxisPosition(),l=s.getMainXScaleType(),c=s.getMainYScaleType(),u=(v,S,E)=>b=>s.getValueFromScale(v,S,E,b),d=u(this.xScale,l,a),h=u(this.yScale,c,o),f=y(this.getOptions(),"zoomBar",z.TOP,"type"),p=_e.height[f],g=Xl().x(v=>d(v)).y0(p).y1(v=>p-h(v)),m=k.appendOrSelect(t,n).datum(i).attr("d",g);r&&m.attr("clip-path",`url(#${r})`)}updateClipPath(t,n,i,r,s,a){const o=k.appendOrSelect(t,"clipPath").attr("id",n);k.appendOrSelect(o,"rect").attr("x",i).attr("y",r).attr("width",s).attr("height",a)}compensateDataForDefaultDomain(t,n){if(!t||t.length<2)return;const i=Tn(t),r=this.services.cartesianScales.getDomainIdentifier(),s=this.services.cartesianScales.getRangeIdentifier();if(Number(n[0])<Number(i[0][r])){const a={};a[r]=n[0],a[s]=0,i.unshift(a)}if(Number(n[1])>Number(i[i.length-1][r])){const a={};a[r]=n[1],a[s]=0,i.push(a)}return i}renderZoomBarBaseline(t,n,i,r=!1){const s=y(this.model.getOptions(),"zoomBar",z.TOP,"type"),a=_e.height[s],o=Wr()([[n,a],[i,a]]);k.appendOrSelect(t,"path.zoom-bg-baseline").attr("d",o).classed("zoom-bg-baseline-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}renderSkeleton(t,n,i){this.renderZoomBarArea(t,"path.zoom-graph-area-unselected",[],null),this.renderZoomBarArea(t,"path.zoom-graph-area",[],this.clipId),this.brush.on("start brush end",null),k.appendOrSelect(this.getComponentContainer(),this.brushSelector).html(null),y(this.getOptions(),"zoomBar",z.TOP,"type")===qe.GRAPH_VIEW&&this.renderZoomBarBaseline(t,n,i,!0)}destroy(){this.brush.on("start brush end",null),this.services.events.removeEventListener(T.ZoomBar.UPDATE,this.render.bind(this))}}class kk extends vt{constructor(t,n){super(t,n),this.type="threshold",this.renderType=st.SVG,this.positionService=new ho}render(t=!1){const n=y(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(h=>{if(Object.values(z).includes(h)){const f=n[h];f.thresholds&&f.thresholds.length>0&&i.push({axisPosition:h,thresholds:f.thresholds,correspondingDatasets:f?.correspondingDatasets,mapsTo:f?.mapsTo})}});const s=this.getComponentContainer({ariaLabel:"threshold lines",withinChartClip:!0}).selectAll("g.axis-thresholds").data(i,h=>h.axisPosition);s.exit().attr("opacity",0).remove();const o=s.enter().append("g").merge(s);o.attr("class",h=>`axis-thresholds ${h.axisPosition}`);const l=o.selectAll("g.threshold-group").data(h=>h.thresholds.map(f=>(f.axisPosition=h.axisPosition,f.datum=this.constructDatumObj(h,f),f)));l.exit().attr("opacity",0).remove();const c=l.enter().append("g");c.append("line").attr("class","threshold-line"),c.append("rect").attr("class","threshold-hoverable-area"),c.merge(l).attr("class","threshold-group");const d=this;o.each(function({axisPosition:h}){const f=d.services.cartesianScales.getScaleByPosition(h),p=d.services.cartesianScales.getScaleTypeByPosition(h);let g=null,m=null;h===z.LEFT||h===z.RIGHT?(m=f,g=d.services.cartesianScales.getMainXScale()):(g=f,m=d.services.cartesianScales.getMainYScale());const v=p===it.LABELS,[S,E]=g.range(),[b,x]=m.range(),{cartesianScales:_}=d.services,C=_.getOrientation(),D=N=>_.getDomainValue(N),$=N=>_.getRangeValue(N),[P,w]=Cn(D,$,C),H=I(this);h===z.TOP||h===z.BOTTOM?(H.selectAll("line.threshold-line").transition().call(N=>d.services.transitions.setupTransition({transition:N,name:"threshold-line-update",animate:t})).attr("y1",x).attr("y2",b).attr("x1",({datum:N})=>P(N)+(v?f.step()/2:0)).attr("x2",({datum:N})=>P(N)+(v?f.step()/2:0)).style("stroke",({fillColor:N})=>N),H.selectAll("rect.threshold-hoverable-area").attr("x",0).attr("y",({datum:N})=>-P(N)).attr("width",Math.abs(b-x)).classed("rotate",!0)):(H.selectAll("line.threshold-line").transition().call(N=>d.services.transitions.setupTransition({transition:N,name:"threshold-line-update",animate:t})).attr("x1",S).attr("x2",E).attr("y1",({datum:N})=>w(N)+(v?f.step()/2:0)).attr("y2",({datum:N})=>w(N)+(v?f.step()/2:0)).style("stroke",({fillColor:N})=>N),H.selectAll("rect.threshold-hoverable-area").attr("x",S).attr("y",({datum:N})=>w(N)).attr("width",Math.abs(E-S)).classed("rotate",!1))}),this.services.events.addEventListener(T.Threshold.SHOW,h=>{this.setThresholdLabelPosition(h.detail),this.label.classed("hidden",!1)}),this.services.events.addEventListener(T.Threshold.HIDE,()=>{this.label.classed("hidden",!0)}),this.appendThresholdLabel(),this.addEventListeners()}getFormattedValue(t){const{value:n,axisPosition:i}=t,r=this.getOptions(),s=this.services.cartesianScales.getScaleTypeByPosition(i),{code:a,number:o}=y(r,"locale");if(s===it.TIME){const l=[z.LEFT,z.RIGHT].includes(i),c=this.services.cartesianScales.getMainXScale(),u=this.services.cartesianScales.getMainYScale(),d=l?u:c,h=y(r,"timeScale"),f=ru(d.ticks(),y(h,"timeInterval"));return iu(n,0,d.ticks(),f,h,r.locale)}return o(n,a)}appendThresholdLabel(){const t=I(this.services.domUtils.getHolder()),n=y(this.getOptions(),"style","prefix");this.label=k.appendOrSelect(t,`div.${pe}--${n}--threshold--label`).classed("hidden",!0)}setThresholdLabelPosition({event:t,datum:n}){const i=this.services.domUtils.getHolder(),r=Yn(t,i),s=n.valueFormatter?n.valueFormatter(n.value):this.getFormattedValue(n);this.label.html(ln(`${n.label||"Threshold"}: ${s}`)).style("background-color",n.fillColor);const a=this.label.node(),o=this.positionService.findBestPlacementAt({left:r[0],top:r[1]},a,[Bt.RIGHT,Bt.LEFT,Bt.TOP,Bt.BOTTOM],()=>({top:void 0,left:void 0,width:i.offsetWidth,height:i.offsetHeight})),l=this.positionService.findPositionAt({left:r[0],top:r[1]},a,o);this.positionService.setElement(a,l)}constructDatumObj(t,n){const i={};return t.correspondingDatasets&&(i.group=y(t,"correspondingDatasets",0)),i[t.mapsTo]=n.value,i}addEventListeners(){const t=this;this.getComponentContainer({withinChartClip:!0}).selectAll("rect.threshold-hoverable-area").on("mouseover mousemove",function(i){I(this.parentNode).select("line.threshold-line").classed("active",!0),t.services.events.dispatchEvent(T.Threshold.SHOW,{event:i,hoveredElement:I(this),datum:I(this).datum()})}).on("mouseout",function(i){I(this.parentNode).select("line.threshold-line").classed("active",!1),t.services.events.dispatchEvent(T.Threshold.HIDE,{event:i,hoveredElement:I(this),datum:I(this).datum()})})}}class Pk extends vt{constructor(t,n){super(t,n),this.type="highlight",this.renderType=st.SVG,this.positionService=new ho,this.highlightStrokeWidth=1}render(t=!1){const n=y(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(h=>{if(Object.values(z).includes(h)){const f=n[h];f.highlights&&f.highlights.data.length>0&&i.push({axisPosition:h,highlightStartMapsTo:f.highlights.highlightStartMapsTo,highlightEndMapsTo:f.highlights.highlightEndMapsTo,labelMapsTo:f.highlights.labelMapsTo,highlight:f.highlights.data,color:f.highlights.color})}});const s=this.getComponentContainer({ariaLabel:"highlight areas",withinChartClip:!0}).selectAll("g.axis-highlight").data(i,h=>h.axisPosition);s.exit().attr("opacity",0).remove();const o=s.enter().append("g").merge(s);o.attr("class",h=>`axis-highlight ${h.axisPosition}`);const l=o.selectAll("g.highlight-group").data(h=>h.highlight.map(f=>(f.axisPosition=h.axisPosition,f.highlightStartMapsTo=h.highlightStartMapsTo,f.labelMapsTo=h.labelMapsTo,f.color=h.color,f.highlightEndMapsTo=h.highlightEndMapsTo,f)));l.exit().attr("opacity",0).remove();const c=l.enter().append("g");c.append("rect").attr("class","highlight-bar"),c.append("line").attr("class","highlight-line"),c.merge(l).attr("class","highlight-group");const d=this;o.each(function({axisPosition:h}){const f=d.services.cartesianScales.getMainXScale(),p=d.services.cartesianScales.getMainYScale(),[g,m]=f.range(),[v,S]=p.range(),{cartesianScales:E}=d.services,b=E.getOrientation(),x=P=>E.getDomainValue(P),_=P=>E.getRangeValue(P),[C,D]=Cn(x,_,b),$=I(this);h===z.TOP||h===z.BOTTOM?$.selectAll("rect.highlight-bar").transition().call(P=>d.services.transitions.setupTransition({transition:P,name:"highlight-bar-update",animate:t})).attr("y",Math.max(S+d.highlightStrokeWidth,0)).attr("height",Math.max(v-2*d.highlightStrokeWidth,0)).attr("x",({highlightStartMapsTo:P,...w})=>C(w[P])).attr("width",({highlightStartMapsTo:P,highlightEndMapsTo:w,...H})=>Math.max(C(H[w])-C(H[P]),0)).style("stroke",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",d.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null):$.selectAll("rect.highlight-bar").transition().call(P=>d.services.transitions.setupTransition({transition:P,name:"highlight-bar-update",animate:t})).attr("x",g).attr("width",Math.max(m-g,0)).attr("y",({highlightEndMapsTo:P,...w})=>D(w[P])).attr("height",({highlightStartMapsTo:P,highlightEndMapsTo:w,...H})=>Math.max(D(H[P])-D(H[w]),0)).style("stroke",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",d.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null)})}}class Qm extends Eu{getItems(t){if(t.detail.items)return t.detail.items;const{data:n}=t.detail;if(!n||!n.length||!n[0])return[];const i=this.getOptions(),{cartesianScales:r}=this.services,s=r.getDomainIdentifier(),a=r.isDualAxes(),{groupMapsTo:o}=i.data,l=r.getDomainLabel();let c=r.getRangeLabel();const u=n[0][s];let d;if(n.length===1){const h=n[0],f=r.getRangeIdentifier(h);if(a){const g=r.getRangeAxisPosition({datum:h,groups:[h[o]]});c=r.getScaleLabel(g)}const p=h[f];d=[{label:l,value:u},...Array.isArray(p)&&p.length===2?[{label:"Start",value:p[0]},{label:"End",value:p[1]}]:[{label:c,value:h[f]}]],t.detail.additionalItems&&t.detail.additionalItems.forEach(g=>d.push({label:g.label,value:g.value})),d.push({label:Et(i,"locale.translations.group")||Et(i,"tooltip.groupLabel"),value:h[o],color:this.model.getFillColor(h[o]),class:this.model.getColorClassName({classNameTypes:[lt.TOOLTIP],dataGroupName:h[o]})})}else if(n.length>1&&(d=[{label:l,value:u}],d=d.concat(n.map(h=>{const f=h[r.getRangeIdentifier(h)];return{label:h[o],value:Array.isArray(f)&&f.length===2?`${f[0]} - ${f[1]}`:f,color:this.model.getFillColor(h[o]),class:this.model.getColorClassName({classNameTypes:[lt.TOOLTIP],dataGroupName:h[o]})}}).sort((h,f)=>f.value-h.value)),!a&&y(i,"tooltip","showTotal")===!0)){const h=r.getRangeIdentifier(),f=y(i,"tooltip","customTotalCalculation");let p;f?p=f(n):p=n.reduce((g,m)=>g+m[h],0),d.push({label:Et(i,"tooltip.totalLabel")||Et(i,"locale.translations.total")||"Total",value:p,bold:!0})}return d}}function Ts(e,t){const n=+$t(e)-+$t(t);return n<0?-1:n>0?1:n}function Nk(e,t,n){const[i,r]=di(n?.in,e,t);return i.getFullYear()-r.getFullYear()}function $k(e,t,n){const[i,r]=di(n?.in,e,t),s=Ts(i,r),a=Math.abs(Nk(i,r));i.setFullYear(1584),r.setFullYear(1584);const o=Ts(i,r)===-s,l=s*(a-+o);return l===0?0:l}function wu(e,t,n){const i=$t(e,n?.in);if(isNaN(t))return Pe(e,NaN);if(!t)return i;const r=i.getDate(),s=Pe(e,i.getTime());s.setMonth(i.getMonth()+t+1,0);const a=s.getDate();return r>=a?s:(i.setFullYear(s.getFullYear(),s.getMonth(),r),i)}function Jm(e,t,n){return wu(e,t*12,n)}function Fk(e,t,n){return Jm(e,-t,n)}function Uk(e,t,n){const[i,r]=di(n?.in,e,t),s=i.getFullYear()-r.getFullYear(),a=i.getMonth()-r.getMonth();return s*12+a}function Bk(e,t){const n=$t(e,t?.in);return n.setHours(23,59,59,999),n}function Hk(e,t){const n=$t(e,t?.in),i=n.getMonth();return n.setFullYear(n.getFullYear(),i+1,0),n.setHours(23,59,59,999),n}function Gk(e,t){const n=$t(e,t?.in);return+Bk(n,t)==+Hk(n,t)}function Vk(e,t,n){const[i,r,s]=di(n?.in,e,e,t),a=Ts(r,s),o=Math.abs(Uk(r,s));if(o<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*o);let l=Ts(r,s)===-a;Gk(i)&&o===1&&Ts(i,s)===1&&(l=!1);const c=a*(o-+l);return c===0?0:c}function zk(e,t,n){return wu(e,-t,n)}function Wk(e,t,n){const[i,r]=di(n?.in,e,t),s=tv(i,r),a=Math.abs(rm(i,r));i.setDate(i.getDate()-s*a);const o=+(tv(i,r)===-s),l=s*(a-o);return l===0?0:l}function tv(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function ev(e,t,n){const i=$t(e,n?.in);return isNaN(t)?Pe(e,NaN):(t&&i.setDate(i.getDate()+t),i)}function Yk(e,t,n){return ev(e,-t,n)}function Mu(e){return t=>{const i=(e?Math[e]:Math.trunc)(t);return i===0?0:i}}function qk(e,t,n){const[i,r]=di(n?.in,e,t),s=(+i-+r)/zg;return Mu(n?.roundingMethod)(s)}function nv(e,t,n){return Pe(e,+$t(e)+t)}function iv(e,t,n){return nv(e,t*zg)}function Xk(e,t,n){return iv(e,-t)}function rv(e,t){return+$t(e)-+$t(t)}function sv(e,t,n){const i=rv(e,t)/Vg;return Mu(n?.roundingMethod)(i)}function Cu(e,t,n){const i=$t(e,n?.in);return i.setTime(i.getTime()+t*Vg),i}function av(e,t,n){return Cu(e,-t,n)}function ov(e,t,n){const i=rv(e,t)/1e3;return Mu(n?.roundingMethod)(i)}function Au(e,t,n){return nv(e,t*1e3)}function lv(e,t,n){return Au(e,-t)}class Zk extends Dn{constructor(){super(...arguments),this.scaleTypes={top:null,right:null,bottom:null,left:null},this.scales={top:null,right:null,bottom:null,left:null}}getDomainAxisPosition({datum:t=null}={}){if(this.dualAxes&&t){const n=this.model.getOptions(),{groupMapsTo:i}=n.data,r=y(n,"axes",this.secondaryDomainAxisPosition),s=t[i];if(r?.correspondingDatasets&&r.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const i=this.model.getOptions(),{groupMapsTo:r}=i.data,s=y(i,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[r]:n&&n.length>0&&(a=n[0]),s?.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return y(this.model.getOptions(),"axes",t)}getDomainAxisOptions(){const t=this.getDomainAxisPosition();return this.getAxisOptions(t)}getRangeAxisOptions(){const t=this.getRangeAxisPosition();return this.getAxisOptions(t)}getScaleLabel(t){const i=this.getAxisOptions(t).title;return i||(t===z.BOTTOM||t===z.TOP?"x-value":"y-value")}getDomainLabel(){return this.getScaleLabel(this.getDomainAxisPosition())}getRangeLabel(){return this.getScaleLabel(this.getRangeAxisPosition())}update(){this.determineAxisDuality(),this.findDomainAndRangeAxes(),this.determineOrientation(),Object.keys(z).map(n=>z[n]).forEach(n=>{this.scales[n]=this.createScale(n)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),i=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=i.primaryDomainAxisPosition,this.rangeAxisPosition=i.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=i.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=i.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===z.LEFT||this.rangeAxisPosition===z.RIGHT)&&(this.domainAxisPosition===z.BOTTOM||this.domainAxisPosition===z.TOP)?this.orientation=Ht.VERTICAL:this.orientation=Ht.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){const t=this.model.getOptions(),n=y(t,"axes");(n[z.LEFT]?.correspondingDatasets&&n[z.RIGHT]||n[z.RIGHT]?.correspondingDatasets&&n[z.LEFT]||n[z.TOP]?.correspondingDatasets&&n[z.BOTTOM]||n[z.BOTTOM]?.correspondingDatasets&&n[z.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=y(this.model.getOptions(),"axes",t,"domain");if(n&&!Array.isArray(n))throw new Error(`Domain in ${t} axis is not a valid array`);if(Array.isArray(n)&&(this.scaleTypes[t]===it.LINEAR||this.scaleTypes[t]===it.TIME)&&n.length!==2)throw new Error(`There can only be 2 elements in domain for scale type: ${this.scaleTypes[t]}`);return n}getOrientation(){return this.orientation}getScaleByPosition(t){return this.scales[t]}getScaleTypeByPosition(t){return this.scaleTypes[t]}getDomainAxisScaleType(){const t=this.getDomainAxisPosition();return this.getScaleTypeByPosition(t)}getRangeAxisScaleType(){const t=this.getRangeAxisPosition();return this.getScaleTypeByPosition(t)}getDomainScale(){return this.scales[this.domainAxisPosition]}getRangeScale(){return this.scales[this.rangeAxisPosition]}getMainXAxisPosition(){const t=[z.BOTTOM,z.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[z.LEFT,z.RIGHT];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainXScale(){return this.scales[this.getMainXAxisPosition()]}getMainYScale(){return this.scales[this.getMainYAxisPosition()]}getValueFromScale(t,n,i,r){const s=this.model.getOptions(),o=y(s,"axes")[i],{mapsTo:l}=o,c=y(r,l)!==null?r[l]:r;let u;switch(n){case it.LABELS:u=t(c)+t.step()/2;break;case it.TIME:u=t(new Date(c));break;default:u=t(c)}return u}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),i=this.getRangeAxisPosition({datum:t}),r=this.scales[i],s=this.model.getOptions(),o=y(s,"axes")[i],{mapsTo:l}=o,c=t[l]!==void 0?t[l]:t;return[r(y(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:c),r(y(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:c)]}getValueThroughAxisPosition(t,n){const i=this.scaleTypes[t],r=this.scales[t];return this.getValueFromScale(r,i,t,n)}getDomainValue(t){const n=this.getDomainAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getRangeValue(t){const n=this.getRangeAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getMainXScaleType(){return this.getScaleTypeByPosition(this.getMainXAxisPosition())}getMainYScaleType(){return this.getScaleTypeByPosition(this.getMainYAxisPosition())}getDomainIdentifier(t){const n=this.model.getOptions();return y(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return y(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const i=this.model.getOptions(),r=y(i,"axes",t);if(r.scaleType===it.TIME){const s=y(i,"timeScale","addSpaceOnEdges");return jk(n,s)}else return Kk(n,Un.paddingRatio,r.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),i=this.isDualAxes();return y(n,z.LEFT)===null&&y(n,z.RIGHT)!==null||y(n,z.RIGHT,"main")===!0||i&&y(n,z.LEFT,"correspondingDatasets")?{primary:z.RIGHT,secondary:z.LEFT}:{primary:z.LEFT,secondary:z.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),i=this.isDualAxes();return y(n,z.BOTTOM)===null&&y(n,z.TOP)!==null||y(n,z.TOP,"main")===!0||i&&y(n,z.BOTTOM,"correspondingDatasets")?{primary:z.TOP,secondary:z.BOTTOM}:{primary:z.BOTTOM,secondary:z.TOP}}findDomainAndRangeAxesPositions(t,n){const i=this.model.getOptions(),r=y(i,"axes",t.primary),s=y(i,"axes",n.primary),a=r.scaleType||it.LINEAR,o=s.scaleType||it.LINEAR,l={primaryDomainAxisPosition:null,secondaryDomainAxisPosition:null,primaryRangeAxisPosition:null,secondaryRangeAxisPosition:null};return l.primaryDomainAxisPosition=n.primary,l.primaryRangeAxisPosition=t.primary,l.secondaryDomainAxisPosition=n.secondary,l.secondaryRangeAxisPosition=t.secondary,(!(o===it.LABELS||o===it.TIME)&&a===it.LABELS||a===it.TIME)&&(l.primaryDomainAxisPosition=t.primary,l.primaryRangeAxisPosition=n.primary,l.secondaryDomainAxisPosition=t.secondary,l.secondaryRangeAxisPosition=n.secondary),l}getScaleDomain(t){const n=this.model.getOptions(),i=y(n,"axes",t),r=y(n,"bounds"),{includeZero:s}=i,a=y(i,"scaleType")||it.LINEAR;if(this.model.isDataEmpty())return[];if(i.binned){const{bins:v}=this.model.getBinConfigurations();return[0,Wn(v,S=>S.length)]}else if(i.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),S=this.model.getStackKeys({bins:v});return[S[0].split(":")[0],S[S.length-1].split(":")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:d}=i,{reference:h,compareTo:f}=Un.ratio;if(i.domain)return a===it.LABELS?i.domain:(a===it.TIME&&(i.domain=i.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,i.domain));if(u)return[0,100];if(i&&a===it.LABELS)return rs(o.map(v=>v[c]));let p,g;const m=this.model.getDataGroupNames();if(a===it.LABELS_RATIO)return o.map(v=>`${v[h]}/${v[f]}`);if(a===it.TIME)g=o.map(v=>+new Date(v[c]));else if(r&&n.axes)g=[],o.forEach(v=>{g.push(v[c]),v[r.upperBoundMapsTo]&&g.push(v[r.upperBoundMapsTo]),v[r.lowerBoundMapsTo]&&g.push(v[r.lowerBoundMapsTo])});else if(i.stacked===!0&&m&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,S=this.model.getDataValuesGroupedByKeys({groups:m}),E=o.filter(x=>!m.includes(x[v])),b=[];S.forEach(x=>{const{..._}=x;let C=0,D=0;Object.values(aL(_,"sharedStackKey")).forEach($=>{isNaN($)||($<0?D+=$:C+=$)}),b.push([D,C])}),g=[...gc(b),...E.map(x=>x[c])]}else g=[],o.forEach(v=>{const S=v[c];Array.isArray(S)&&S.length===2?(g.push(S[0]),g.push(S[1])):(l&&g.push(Math.max(v[c],v[l])),g.push(S))});return a!==it.TIME&&a!==it.LOG&&s&&g.push(0),d&&d.length>0&&d.forEach(v=>{const S=y(v,"value");S!==null&&g.push(S)}),p=Ue(g),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),i=y(n,"axes",t);if(!i)return null;const r=y(i,"scaleType")||it.LINEAR;this.scaleTypes[t]=r;let s;return r===it.TIME?s=_f():r===it.LOG?s=rf().base(i.base||10):r===it.LABELS||r===it.LABELS_RATIO?s=Li():s=Ve(),s.domain(this.getScaleDomain(t)),s}getDomainLowerBound(t){let n,i=0;return this.getOrientation()===Ht.VERTICAL?n=this.getMainYScale().domain():n=this.getMainXScale().domain(),y(this.model.getOptions(),"axes",t,"includeZero")===!1&&n[0]>0&&n[1]>0&&(i=n[0]),i}getHighestDomainThreshold(){const t=y(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getDomainScale(),s=i.sort((o,l)=>l.value-o.value)[0];return this.getScaleTypeByPosition(n)===it.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:r(s.value)}}getHighestRangeThreshold(){const t=y(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getRangeScale(),s=i.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:r(s.value)}}}function jk(e,t){const n=new Date(e[0]),i=new Date(e[1]);return $k(i,n)>1?[Fk(n,t),Jm(i,t)]:Vk(i,n)>1?[zk(n,t),wu(i,t)]:Wk(i,n)>1?[Yk(n,t),ev(i,t)]:qk(i,n)>1?[Xk(n,t),iv(i,t)]:sv(i,n)>30?[av(n,t*30),Cu(i,t*30)]:sv(i,n)>1?[av(n,t),Cu(i,t)]:ov(i,n)>15?[lv(n,t*15),Au(i,t*15)]:ov(i,n)>1?[lv(n,t),Au(i,t)]:[n,i]}function Kk([e,t],n,i){const s=(t-e)*n,a=t<=0&&t+s>0?0:t+s;let o=e>=0&&e-s<0?0:e-s;if(i===it.LOG&&o<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");o=e}return[o,a]}class Qk extends Dn{constructor(){super(...arguments),this.curveTypes={curveLinear:Ca,curveLinearClosed:Nf,curveBasis:J_,curveBasisClosed:tT,curveBasisOpen:eT,curveBundle:nT,curveCardinal:iT,curveCardinalClosed:rT,curveCardinalOpen:sT,curveCatmullRom:aT,curveCatmullRomClosed:oT,curveCatmullRomOpen:lT,curveMonotoneX:cT,curveMonotoneY:uT,curveNatural:hT,curveStep:dT,curveStepAfter:pT,curveStepBefore:fT}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let i=this.curveTypes[t];return n&&Object.keys(n).forEach(r=>{i[r]&&(i=i[r](n[r]))}),i}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}}class Jk extends Dn{isZoomBarEnabled(){if(!this.services.cartesianScales||!y(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=y(this.model.getOptions(),"axes",t,"scaleType");return t===z.BOTTOM&&n===it.TIME}getZoomBarData(){const t=this.model.getZoomBarData();return t&&t.length>1?t:this.model.getDisplayData()}getDefaultZoomBarDomain(t){if(!this.services.zoom)throw new Error("Services zoom not defined");const n=t||this.services.zoom.getZoomBarData(),{cartesianScales:i}=this.services;if(!i)throw new Error("Services cartesianScales undefined");const r=i.getMainXAxisPosition(),s=i.getDomainIdentifier(),a=y(this.model.getOptions(),"axes",r,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!r)throw new Error("Not defined: mainXAxisPosition");return i.extendsDomain(r,Ue(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0,type:"manual"}){this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&this.services.events?.dispatchEvent(T.ZoomDomain.CHANGE,{newDomain:t,type:n.type})}getZoomRatio(){return y(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){const i=this.model.get("zoomDomain"),r=Object.assign({stacked:!1},n),s=y(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&s&&i){const a=r.stacked?"sharedStackKey":this.services.cartesianScales?.getDomainIdentifier(),o=t.filter(l=>new Date(l[a])>=i[0]&&new Date(l[a])<=i[1]);if(o.length>0)return o}return t}zoomIn(t=this.getZoomRatio()){const n=this.model.get("zoomDomain"),i=_e.handleWidth,r=this.services.cartesianScales?.getMainXScale().copy();r.domain(this.getDefaultZoomBarDomain());const s=r(n[0]),a=r(n[1]);if(a-s<i+1)return;const o=r.range(),l=a-s,c=Math.min((o[1]-o[0])/2*(t/2),l/2);let u=s+c,d=a-c;u>=d&&(u=s+l/2-i/2,d=a-l/2+i/2);const h=[r.invert(u),r.invert(d)];(n[0].valueOf()!==h[0].valueOf()||n[1].valueOf()!==h[1].valueOf())&&this.handleDomainChange(h,{dispatchEvent:!0,type:"in"})}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const i=this.services.cartesianScales.getMainXScale().copy();i.domain(this.getDefaultZoomBarDomain());const r=i(n[0]),s=i(n[1]),a=i.range(),o=(a[1]-a[0])/2*(t/2),l=Math.max(r-o,a[0]),c=Math.min(s+o,a[1]),u=[i.invert(l),i.invert(c)];(n[0].valueOf()!==u[0].valueOf()||n[1].valueOf()!==u[1].valueOf())&&this.handleDomainChange(u,{dispatchEvent:!0,type:"out"})}resetZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();(t[0].valueOf()!==n[0].valueOf()||t[1].valueOf()!==n[1].valueOf())&&this.handleDomainChange(n,{dispatchEvent:!0,type:"reset"})}isMinZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();if(!t||!n)return!1;const i=t[1].valueOf()-t[0].valueOf(),r=n[1].valueOf()-n[0].valueOf(),s=y(this.model.getOptions(),"zoomBar","minZoomRatio");return i/r<s}isMaxZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();return!!(t&&n&&t[0].valueOf()===n[0].valueOf()&&t[1].valueOf()===n[1].valueOf())}isEmptyState(){return this.getZoomBarData().length===0}isZoomBarLoading(t){return y(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return y(this.model.getOptions(),"zoomBar",t,"locked")}}class me extends Ze{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:Zk,curves:Qk,zoom:Jk}),this.model=new gi(this.services)}getAxisChartComponents(t,n){const i=this.model.getOptions(),r=y(i,"zoomBar",z.TOP,"enabled"),s=y(i,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=y(i,"axes",a,"scaleType"),l=r&&a===z.BOTTOM&&o===it.TIME,c=this.services.zoom.isZoomBarLocked(z.TOP),u=!!this.model.getOptions().title,d={id:"title",components:[new Ss(this.model,this.services)],growth:dt.STRETCH},h={id:"toolbar",components:[new nr(this.model,this.services)],growth:dt.PREFERRED},f={id:"header",components:[new ce(this.model,this.services,[d,...s?[h]:[]],{direction:Ct.ROW,alignItems:ci.CENTER})],growth:dt.PREFERRED},p={id:"legend",components:[new yu(this.model,this.services)],growth:dt.PREFERRED};l&&!c&&t.push(new Hm(this.model,this.services),new Ou(this.model,this.services)),t.push(new kk(this.model,this.services)),t.push(new Pk(this.model,this.services));const g={id:"graph-frame",components:t,growth:dt.STRETCH,renderType:st.SVG},m=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Ct.COLUMN;if(m){const _=y(this.model.getOptions(),"legend","position");_===Zi.LEFT?(v=Ct.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=ji.VERTICAL)):_===Zi.RIGHT?(v=Ct.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=ji.VERTICAL)):_===Zi.BOTTOM&&(v=Ct.COLUMN_REVERSE)}const S={id:"spacer",components:[new Ln(this.model,this.services)],growth:dt.PREFERRED},E={id:"full-frame",components:[new ce(this.model,this.services,[...m?[p]:[],...m?[S]:[],g],{direction:v})],growth:dt.STRETCH},b={id:"zoom-bar",components:[new Ik(this.model,this.services)],growth:dt.PREFERRED,renderType:st.SVG},x=[];if(u||s){x.push(f);const _={id:"spacer",components:[new Ln(this.model,this.services,s?{size:15}:void 0)],growth:dt.PREFERRED};x.push(_)}return l&&x.push(b),x.push(E),[new Qm(this.model,this.services),new uo(this.model,this.services),new ce(this.model,this.services,x,{direction:Ct.COLUMN})]}}class we extends vt{constructor(){super(...arguments),this.type="grid",this.renderType=st.SVG}render(t=!0){const n=y(this.getOptions(),"grid","x","enabled"),i=y(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,i),!(!n&&!i)&&(n&&(k.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),i&&(k.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,i=this.backdrop.attr("height"),r=this.services.cartesianScales.getMainXScale(),s=Ao(r).tickSizeInner(-i).tickSizeOuter(0);if(y(this.getOptions(),"grid","x","alignWithAxisTicks")){const l=this.services.cartesianScales.getDomainAxisPosition(),c=y(this.getOptions(),"axes",l,"ticks","values");c&&s.tickValues(c)}else{const l=y(this.getOptions(),"grid","x","numberOfTicks");s.ticks(l)}const o=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${i})`);t?o.transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"grid-update",animate:t})).call(s):o.call(s),this.cleanGrid(o)}drawYGrid(t){const n=this.parent,i=this.backdrop.attr("width"),r=this.services.cartesianScales.getMainYScale(),s=Yu(r).tickSizeInner(-i).tickSizeOuter(0);if(y(this.getOptions(),"grid","y","alignWithAxisTicks")){const l=this.services.cartesianScales.getRangeAxisPosition(),c=y(this.getOptions(),"axes",l,"ticks","values");c&&s.tickValues(c)}else{const l=y(this.getOptions(),"grid","y","numberOfTicks");s.ticks(l)}const o=n.select(".y.grid").attr("transform",`translate(0, ${-this.backdrop.attr("y")})`);t?o.transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"grid-update",animate:t})).call(s):o.call(s),this.cleanGrid(o)}getGridlineThreshold(t){const n=this.parent,i=n.selectAll(".x.grid .tick").nodes().sort((u,d)=>Number(Mn(u).tx)-Number(Mn(d).tx));let r=-1;if(!i.length)return;i.forEach(u=>{t[0]>=+Mn(u).tx&&r++});const s=r+1<i.length?r+1:i.length,a=i[r],o=i[s];let l;if(!a)l=+Mn(o).tx;else if(o)l=+Mn(o).tx-+Mn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();l=k.getSVGElementSize(u).width-+Mn(a).tx}const{threshold:c}=this.getOptions().tooltip.gridline;return l*c}getActiveGridline(t){const n=y(this.getOptions,"tooltip","gridline","threshold"),i=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const a=Mn(this),o={min:Number(a.tx)-i,max:Number(a.tx)+i};return o.min<=t[0]&&t[0]<=o.max})}drawBackdrop(t,n){const i=this.parent,r=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=r.range(),[l,c]=s.range();this.backdrop=k.appendOrSelect(i,"svg.chart-grid-backdrop").attr("role","presentation");const u=k.appendOrSelect(this.backdrop,t||n?"rect.chart-grid-backdrop.stroked":"rect.chart-grid-backdrop");this.backdrop.merge(u).attr("x",a).attr("y",c).attr("width",Math.abs(o-a)).attr("height",Math.abs(l-c)).lower(),u.attr("width","100%").attr("height","100%")}cleanGrid(t){t.selectAll("text").remove(),t.select(".domain").remove()}}class cv extends vt{constructor(){super(...arguments),this.type="area",this.renderType=st.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999),this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.area").transition("legend-hover-area").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-area"})).attr("opacity",i=>i.name!==n.datum().name?On.opacity.unselected:On.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.area").transition("legend-mouseout-area").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-area"})).attr("opacity",On.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"area graphs",withinChartClip:!0}),i=this.getOptions();let r=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=Xl().curve(this.services.curves.getD3Curve()).defined(x=>{const _=s.getRangeIdentifier(),C=x[_];return C!=null}),l=this.model.getGroupedData(this.configs.groups),c=y(i,"bounds"),u=c&&l&&l.length===1;!u&&c&&console.warn(`Bounds can only be shown when having 1 single datagroup, you've supplied ${l.length}`);let d=0;const h=(x,_)=>{y(i,"axes",x,"includeZero")===!1&&_[0]>0&&_[1]>0&&(d=_[0])},f=x=>u?s.getBoundedScaledValues(x)[0]:s.getRangeValue(d),p=x=>u?s.getBoundedScaledValues(x)[1]:s.getRangeValue(x);a===Ht.VERTICAL?(r=s.getMainYScale().domain(),h(s.getMainYAxisPosition(),r),o.x(x=>s.getDomainValue(x)).y0(x=>f(x)).y1(x=>p(x))):(r=s.getMainXScale().domain(),h(s.getMainXAxisPosition(),r),o.x0(x=>f(x)).x1(x=>p(x)).y(x=>s.getDomainValue(x)));const g=y(i,"color","gradient","enabled"),m=l&&l.length===1&&g;l.length>1&&g&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(l,x=>x.name),S=I(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!l.length)return;if(m){const x=S.select(`path.${this.model.getColorClassName({classNameTypes:[lt.STROKE],dataGroupName:l[0].name})}`).node();let _;if(x)_=getComputedStyle(x,null).getPropertyValue("stroke");else{const C=y(this.model.getOptions(),"color","scale");if(C!==null){const D=Object.keys(C);_=C[D[0]]}}_s.appendOrUpdateLinearGradient({svg:this.parent,id:this.services.domUtils.generateElementIDString(`${l[0].name.replace(" ","")}_${this.gradient_id}`),x1:"0%",x2:"0%",y1:"0%",y2:"100%",stops:_s.getStops(r,_)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const E=this,b=v.enter().append("path");m?b.merge(v).style("fill",x=>`url(#${this.services.domUtils.generateElementIDString(`${x.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",x=>this.model.getColorClassName({classNameTypes:[lt.FILL],dataGroupName:x.name,originalClassName:"area"})).attr("d",x=>{const{data:_}=x;return o(_)}):(b.attr("opacity",0).merge(v).attr("class","area").attr("class",x=>this.model.getColorClassName({classNameTypes:[lt.FILL,lt.STROKE],dataGroupName:x.name,originalClassName:"area"})).style("fill",x=>E.model.getFillColor(x.name,null,x.data)).transition().call(x=>this.services.transitions.setupTransition({transition:x,name:"area-update-enter",animate:t})).attr("opacity",u?1:On.opacity.selected).attr("d",x=>{const{data:_}=x;return o(_)}),u&&b.attr("fill-opacity",On.opacity.selected).style("stroke",x=>E.model.getStrokeColor(x.name,null,x.data)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class rr extends vt{constructor(){super(...arguments),this.type="line",this.renderType=st.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-line"})).attr("opacity",i=>i.name!==n.datum().name?wn.opacity.unselected:wn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",wn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,i=this.model.get("zoomDomain")!==void 0,r=n&&i?this.getComponentContainer({ariaLabel:"lines",withinChartClip:!1}):this.getComponentContainer({ariaLabel:"lines",withinChartClip:!0}),{cartesianScales:s,curves:a}=this.services,o=v=>s.getDomainValue(v),l=v=>s.getRangeValue(v),[c,u]=Cn(o,l,s.getOrientation()),d=this.getOptions(),h=Wr().x(c).y(u).curve(a.getD3Curve()).defined(v=>{const S=s.getRangeIdentifier(v),E=v[S];return E!=null});let f=[];if(this.configs.stacked){const v=Object.keys(d.axes).some(b=>d.axes[b].percentage),{groupMapsTo:S}=d.data;f=this.model.getStackedData({groups:this.configs.groups,percentage:v}).map(b=>{const x=this.services.cartesianScales.getDomainIdentifier(b),_=this.services.cartesianScales.getRangeIdentifier(b);return{name:y(b,0,S),data:b.map(C=>({[x]:C.data.sharedStackKey,[S]:C[S],[_]:C[1]})),hidden:!lL(b,C=>C[0]!==C[1])}})}else f=this.model.getGroupedData(this.configs.groups);const p=r.selectAll("path.line").data(f,v=>v.name);p.exit().attr("opacity",0).remove();const m=p.enter().append("path").classed("line",!0).attr("opacity",0).merge(p).data(f,v=>v.name).attr("class",v=>this.model.getColorClassName({classNameTypes:[lt.STROKE],dataGroupName:v.name,originalClassName:"line"})).style("stroke",v=>this.model.getStrokeColor(v.name,null,v.data)).attr("role",ft.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",v=>{const{data:S}=v;return S.map(E=>{const b=this.services.cartesianScales.getRangeIdentifier(E);return E[b]}).join(",")});if(n&&i){const v=s.getMainXScale(),S=s.getMainYScale();if(v&&S){const[E,b]=v.range(),[x,_]=S.range();r.style("overflow","hidden").style("clip",`rect(${_}px, ${b}px, ${x}px, ${E}px)`)}}m.transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"line-update-enter",animate:t})).attr("opacity",v=>v.hidden?0:1).attr("d",v=>{const{data:S}=v;return h(S)})}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const uv=5;function t2(e,t){return e>t-uv&&e<t+uv}class Gn extends vt{constructor(){super(...arguments),this.type="ruler",this.renderType=st.SVG,this.isXGridEnabled=y(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=y(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!1){const n=y(this.getOptions(),"ruler","enabled"),i=y(this.getOptions(),"tooltip","alwaysShowRulerTooltip"),r=n||i;this.drawBackdrop(),r&&!this.isEventListenerAdded?this.addBackdropEventListeners():!r&&this.isEventListenerAdded&&this.removeBackdropEventListeners()}removeBackdropEventListeners(){this.isEventListenerAdded=!1,this.backdrop.on("mousemove mouseover mouseout",null)}formatTooltipData(t){return t}showRuler(t,[n,i]){const r=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[l,c]=o.range(),u=s===Ht.HORIZONTAL?i:n,d=k.appendOrSelect(r,"g.ruler").attr("aria-label","ruler"),h=k.appendOrSelect(d,"line.ruler-line"),f=r.selectAll("[role=graphics-symbol]"),p=a.map(m=>({domainValue:this.services.cartesianScales.getDomainValue(m),originalData:m})).filter(m=>t2(m.domainValue,u));if(this.pointsWithinLine&&p.length===this.pointsWithinLine.length&&p.map(m=>m.domainValue).join()===this.pointsWithinLine.map(m=>m.domainValue).join())return this.pointsWithinLine=p,this.services.events.dispatchEvent(T.Tooltip.MOVE,{mousePosition:[n,i]});this.pointsWithinLine=p;const g=this.pointsWithinLine.reduce((m,v)=>{if(m.length===0)return m.push(v),m;const S=m[0].domainValue,E=Math.abs(u-v.domainValue),b=Math.abs(u-S);return E>b||(E<b?m=[v]:m.push(v)),m},[]);if(g.length>0){const m=g.map(b=>b.originalData).filter(b=>{const x=this.services.cartesianScales.getRangeIdentifier(b),_=b[x];return _!=null}),v=g.map(b=>b.domainValue),S=f.filter(b=>{const x=this.services.cartesianScales.getDomainValue(b);return v.includes(x)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Cg(this.elementsToHighlight,S)&&this.hideRuler(),S.dispatch("mouseover"),this.elementsToHighlight=S,this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:t,mousePosition:[n,i],hoveredElement:h,data:this.formatTooltipData(m)}),d.attr("opacity",1);const E=g[0];s==="horizontal"?h.attr("x1",c).attr("x2",l).attr("y1",E.domainValue).attr("y2",E.domainValue):h.attr("y1",c).attr("y2",l).attr("x1",E.domainValue).attr("x2",E.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=k.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(T.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),i=this.model.getDisplayData();let r=function(s){const a=Yn(s,t.parent.node());t.showRuler(s,a)};if(i.length>100){const s=i.length%50*12.5;r=gL(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",r).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=k.appendOrSelect(t,"svg.chart-grid-backdrop")}}class cn extends vt{constructor(){super(...arguments),this.type="scatter",this.renderType=st.SVG,this.handleChartHolderOnHover=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-hover-scatter").call(t=>this.services.transitions?.setupTransition({transition:t,name:"chart-holder-hover-scatter"})).attr("opacity",1)},this.handleChartHolderOnMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-mouseout-scatter").call(t=>this.services.transitions?.setupTransition({transition:t,name:"chart-holder-mouseout-scatter"})).attr("opacity",0)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(r=>this.services.transitions?.setupTransition({transition:r,name:"legend-hover-scatter"})).attr("opacity",r=>r[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-mouseout-scatter").call(t=>this.services.transitions?.setupTransition({transition:t,name:"legend-mouseout-scatter"})).attr("opacity",1)}}init(){const{events:t}=this.services;if(!t)throw new Error("Services events are undefined.");t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const i=n.getDomainIdentifier(t),r=this.model.get("zoomDomain");return r!==void 0?t.filter(s=>s[i].getTime()>=r[0].getTime()&&s[i].getTime()<=r[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let i;if(n){const r=Object.keys(t.axes).some(s=>t.axes[s].percentage);i=this.model.getStackedData({groups:this.configs.groups,percentage:r})}else{const{cartesianScales:r}=this.services;if(!r)throw new Error("Services cartesianScales are undefined.");i=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=r.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(i)}render(t){if(!(y(this.getOptions(),"points","enabled")||y(this.getOptions(),"bubble","enabled")))return;const i=this.services.zoom?.isZoomBarEnabled()||!1,r=this.getComponentContainer({ariaLabel:"scatter points",withinChartClip:i}),s=this.getOptions(),{groupMapsTo:a}=s.data,{cartesianScales:o}=this.services;if(!o)throw new Error("Services cartesianScales are undefined.");const l=o.getDomainIdentifier(),c=r.selectAll("circle.dot").data(this.getScatterData(),h=>`${h[a]}-${h[l]}`);c.exit().attr("opacity",0).remove();const d=c.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(c);this.styleCircles(d,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:i}=this.services;if(!i)throw new Error("Cartesian scales service is undefined");const r=i.getOrientation(),[s,a]=Cn(i.getHighestDomainThreshold(),i.getHighestRangeThreshold(),r),[o,l]=Cn(d=>i.getDomainValue(d),d=>i.getRangeValue(d),r),c=o(t),u=l(t);return a&&s?u<=a.scaleValue&&c>=s.scaleValue:a?u<=a.scaleValue:s?c>=s.scaleValue:!1}styleCircles(t,n){const i=this.getOptions(),{filled:r,fillOpacity:s}=i.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=i.data,l=f=>a.getDomainValue(f),c=f=>a.getRangeValue(f),[u,d]=Cn(l,c,a.getOrientation()),{fadeInOnChartHolderMouseover:h}=this.configs;t.raise().classed("dot",!0).attr("class",f=>{const p=a.getDomainIdentifier(f),m=this.model.getIsFilled(f[o],f[p],f,r)?[lt.FILL,lt.STROKE]:[lt.STROKE];return this.model.getColorClassName({classNameTypes:m,dataGroupName:f[o],originalClassName:"dot"})||""}).classed("threshold-anomaly",f=>this.isDatapointThresholdAnomaly(f)).classed("filled",f=>{const p=a.getDomainIdentifier(f);return this.model.getIsFilled(f[o],f[p],f,r)}).classed("unfilled",f=>{const p=a.getDomainIdentifier(f);return!this.model.getIsFilled(f[o],f[p],f,r)}).transition().call(f=>this.services.transitions?.setupTransition({transition:f,name:"scatter-update-enter",animate:n})).attr("cx",u).attr("cy",d).attr("r",i.points.radius).style("fill",f=>{const p=a.getDomainIdentifier(f);if(this.model.getIsFilled(f[o],f[p],f,r))return this.model.getFillColor(f[o],f[p],f)}).style("stroke",f=>{const p=a.getDomainIdentifier(f);return this.model.getStrokeColor(f[o],f[p],f)}).attr("fill-opacity",r?s:1).attr("opacity",h?0:1).attr("role",ft.GRAPHICS_SYMBOL).attr("aria-roledescription","point").attr("aria-label",f=>{const p=a.getRangeIdentifier(f);return f[p]}),this.addEventListeners()}getTooltipAdditionalItems(t){return null}addEventListeners(){const t=this,{groupMapsTo:n}=t.getOptions().data,i=y(this.getOptions(),"tooltip","alwaysShowRulerTooltip");if(!this.parent)throw new Error("Parent not defined");const r=this.parent.selectAll("circle");i?r.style("pointer-events","none"):r.style("pointer-events",null),r.on("mouseover",function(s,a){const o=I(this);o.classed("hovered",!0).attr("class",l=>t.model.getColorClassName({classNameTypes:[lt.FILL],dataGroupName:l[n],originalClassName:o.attr("class")})).style("fill",l=>{const c=t.services.cartesianScales?.getDomainIdentifier(l);return t.model.getFillColor(l[n],l[c],l)}).classed("unfilled",!1),i||t.services.events?.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,data:[a],additionalItems:t.getTooltipAdditionalItems(a)}),t.services.events?.dispatchEvent(T.Scatter.SCATTER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=I(this);t.services.events?.dispatchEvent(T.Scatter.SCATTER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events?.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events?.dispatchEvent(T.Scatter.SCATTER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);if(o.classed("hovered",!1),!t.configs.filled){const{filled:l}=t.getOptions().points,c=t.services.cartesianScales?.getDomainIdentifier(a),u=t.model.getIsFilled(a[n],a[c],a,l);o.classed("unfilled",!u).style("fill",d=>u||l?t.model.getFillColor(d[n],d[c],d):null)}t.services.events?.dispatchEvent(T.Scatter.SCATTER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events?.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}destroy(){this.parent?.selectAll("circle").on("mousemove",null).on("mouseout",null);const{events:t}=this.services;if(!t)throw new Error("Services events undefined");t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.removeEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}}class hv extends vt{constructor(t,n,i){super(t,n,i),this.type="axes",this.renderType=st.SVG,this.truncation={[z.LEFT]:!1,[z.RIGHT]:!1,[z.TOP]:!1,[z.BOTTOM]:!1},i&&(this.configs=i),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,i=this.getOptions(),r=y(i,"axes",n,"visible"),s=this.getComponentContainer({ariaLabel:"axes"}),{width:a,height:o}=k.getSVGElementSize(s,{useAttrs:!0}),l=k.appendOrSelect(s,`g.axis.${n}`);let c,u;if(n===z.BOTTOM||n===z.TOP?(c=this.configs.axes[z.LEFT]?this.margins.left:0,u=this.configs.axes[z.RIGHT]?a-this.margins.right:a):(c=o-this.margins.bottom,u=this.margins.top),!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const d=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===it.LABELS||this.scaleType===it.LABELS_RATIO?d.rangeRound([c,u]):d.range([c,u]);let h;switch(n){case z.LEFT:h=Yu;break;case z.BOTTOM:h=Ao;break;case z.RIGHT:h=S0;break;case z.TOP:h=b0;break}l.attr("aria-label",`${n} axis`);const f=!l.select("g.ticks").empty();let p=k.appendOrSelect(l,"g.ticks");f||(p.attr("role",`${ft.GRAPHICS_OBJECT} ${ft.GROUP}`),p.attr("aria-label",`${n} ticks`));const g=k.appendOrSelect(l,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),m=y(i,"axes",n),v=this.scaleType===it.TIME||m.scaleType===it.TIME,S=n===z.LEFT||n===z.RIGHT,E=this.model.get("zoomDomain");if(E&&v&&!S&&d.domain(E),!r){p.attr("aria-hidden",!0);return}const b=y(m,"scaleType"),x=y(i,"data","loading"),_=y(m,"ticks","number"),C=y(m,"ticks","values"),D=y(m,"truncation","type"),$=y(m,"truncation","threshold"),P=y(m,"truncation","numCharacter"),w=_!==null,H=y(i,"timeScale"),N=k.appendOrSelect(g,"g.tick"),M=k.appendOrSelect(N,"text").text("0"),O=k.getSVGElementSize(M.node(),{useBBox:!0}).height;N.remove();const F=this.scaleType||m.scaleType||it.LINEAR,U=h(d).tickSizeOuter(0);if(d.ticks){let K;if(w?K=_:(K=Un.ticks.number,S&&(K=this.getNumberOfFittingTicks(o,O,Un.ticks.verticalSpaceRatio))),d.ticks().length===1&&d.ticks()[0]===0&&(K=0),U.ticks(K),v)if(!d.ticks(K).length)U.tickValues([]);else{const nt=y(i,"timeScale","addSpaceOnEdges"),ct=y(i,"axes",n,"domain"),W=d.copy();nt&&!ct&&W.nice(K);const j=W.ticks(K);nt&&j.length>2&&!ct&&(j.splice(j.length-1,1),j.splice(0,1)),U.tickValues(j)}}let R;const B=y(m,"ticks","formatter"),{code:tt,number:Z}=y(i,"locale");if(v){const K=ru(U.tickValues(),y(i,"timeScale","timeInterval"));B===null?R=(nt,ct)=>iu(nt,ct,U.tickValues(),K,H,i.locale):R=(nt,ct)=>{const W=iu(nt,ct,U.tickValues(),K,H,i.locale);return B(nt,ct,W)}}else B===null?F===it.LINEAR&&(R=K=>Z(K,tt)):R=B;U.tickFormat(R);const[Y,Q]=this.services.cartesianScales.getScaleByPosition(n).domain();let ht;if(C){if(v)C.forEach((K,nt)=>{K.getTime===void 0&&(C[nt]=new Date(K))}),ht=C.filter(K=>{const nt=K.getTime();return nt>=new Date(Y).getTime()&&nt<=new Date(Q).getTime()});else if(b===it.LABELS){const K=this.services.cartesianScales.getScaleByPosition(n).domain();ht=C.filter(nt=>K.includes(nt))}else ht=C.filter(K=>K>=Y&&K<=Q);U.tickValues(ht)}switch(n){case z.LEFT:p.attr("transform",`translate(${this.margins.left}, 0)`);break;case z.BOTTOM:p.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case z.RIGHT:p.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case z.TOP:p.attr("transform",`translate(0, ${this.margins.top})`);break}const et=this.model.isDataEmpty();if(m.title){const K=k.appendOrSelect(l,"text.axis-title").html(et||x?"":ln(m.title)),nt=y(m,"titleOrientation");let ct;switch(n){case z.LEFT:nt===Za.RIGHT?K.attr("transform","rotate(90)").attr("y",0).attr("x",d.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):K.attr("transform","rotate(-90)").attr("y",0).attr("x",-(d.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case z.BOTTOM:const W=o-qg;K.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${W})`);break;case z.RIGHT:nt===Za.LEFT?K.attr("transform","rotate(-90)").attr("y",a).attr("x",-(d.range()[0]/2)).style("text-anchor","middle"):K.attr("transform","rotate(90)").attr("y",-a).attr("x",d.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case z.TOP:ct=k.getSVGElementSize(K,{useBBox:!0}).height,K.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${ct/2})`).style("text-anchor","middle");break}}if(v){const K=ru(U.tickValues(),y(i,"timeScale","timeInterval")),nt=H.showDayName,ct=p;t&&(p=p.transition().call(j=>this.services.transitions.setupTransition({transition:j,name:"axis-update",animate:t}))),p=p.call(U),ct.selectAll(".tick").data(U.tickValues(),d).order().select("text").attr("class",(j,J)=>fm(j,J,U.tickValues(),K,nt)?"tick-label--primary":"tick-label")}else!t||!f?p=p.call(U):p=p.transition().call(K=>this.services.transitions.setupTransition({transition:K,name:"axis-update",animate:t})).call(U);if(g.call(U),n===z.BOTTOM||n===z.TOP){let K=!1;const nt=y(m,"ticks","rotation");if(nt===os.ALWAYS)K=!0;else if(nt===os.NEVER)K=!1;else if(!nt||nt===os.AUTO)if(d.step)K=g.selectAll("g.tick text").nodes().some(W=>k.getSVGElementSize(W,{useBBox:!0}).width>=d.step());else{K=!1;const ct=g.append("text").text("A"),W=k.getSVGElementSize(ct.node(),{useBBox:!0}).width;let j;g.selectAll("g.tick").each(function(){const J=I(this),L=parseFloat(y(Mn(this),"tx"));L!==null&&j+J.text().length*W*.8>=L&&(K=!0),j=L}),ct.remove()}K?(w||(U.ticks(this.getNumberOfFittingTicks(a,O,Un.ticks.horizontalSpaceRatio)),g.call(U),p.call(U)),l.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===z.TOP?"start":"end")):l.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(x?l.attr("opacity",0):l.attr("opacity",1),p.selectAll("g.tick").attr("aria-label",K=>K),g.selectAll("g.tick").attr("aria-label",K=>K),D!==Ie.NONE&&b===it.LABELS&&!C){const K=this.services.cartesianScales.getScaleDomain(n);if(K.length>0){const nt=s.select(`g.axis.${n} g.ticks g.tick`).html();l.selectAll("g.ticks g.tick").html(nt);const ct=this;l.selectAll("g.tick text").data(K).text(function(W){return W.length>$?(ct.truncation[n]=!0,hs(W,D,P)):W}),this.getInvisibleAxisRef().selectAll("g.tick text").data(K).text(function(W){return W.length>$?hs(W,D,P):W}),l.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),l.selectAll("g.tick text").data(K)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=k.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=y(r,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;i.selectAll("g.tick text").on("mouseover",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:I(this),datum:u}),a===it.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,hoveredElement:I(this),content:u})}).on("mousemove",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:I(this),datum:u}),a===it.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this),datum:u}),a===it.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)})}getInvisibleAxisRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} g.ticks.invisible`)}getTitleRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} text.axis-title`)}getNumberOfFittingTicks(t,n,i){const r=Math.floor(t/(n*i));return Wp(r,2,Un.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;k.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}}class e2 extends hv{constructor(t,n,i){super(t,n,i)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,i=this.getComponentContainer({ariaLabel:"axes"}),r=k.appendOrSelect(i,`g.axis.${n}`),s=this;r.selectAll("g.tick").each(function(a,o){const l=I(this);l.classed("tick-hover",!0).attr("tabindex",o===0?0:-1);const c=l.select("text"),{width:u,height:d}=k.getSVGElementSize(c,{useBBox:!0}),h=k.appendOrSelect(l,"rect.axis-holder");let f=0,p=0;switch(n){case z.LEFT:f=-u+Number(c.attr("x")),p=-(d/2);break;case z.RIGHT:f=Math.abs(Number(c.attr("x"))),p=-(d/2);break;case z.TOP:f=-(u/2),p=-d+Number(c.attr("y"))/2,s.truncation[n]&&(f=0,h.attr("transform","rotate(-45)"));break;case z.BOTTOM:f=-(u/2),p=d/2-2,s.truncation[n]&&(f=-u,h.attr("transform","rotate(-45)"));break}h.attr("x",f-Un.hover.rectanglePadding).attr("y",p).attr("width",u+Un.hover.rectanglePadding*2).attr("height",d).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=k.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=y(r,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;i.selectAll("g.tick.tick-hover").on("mouseover",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:u,datum:d}),a===it.LABELS&&d.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,element:u,datum:d})}).on("mousemove",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:u,datum:d}),l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()})}).on("mouseout",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()}),a===it.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)}).on("focus",function(c){const u={clientX:0,clientY:0};if(c.target){c.target.focus();const d=c.target.getBoundingClientRect();u.clientX=d.x,u.clientY=d.y}l.services.events.dispatchEvent(T.Axis.LABEL_FOCUS,{event:{...c,...u},element:I(this),datum:I(this).select("text").datum()})}).on("blur",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})}).on("keydown",function(c){c.key&&c.key==="Escape"&&(l.services.events.dispatchEvent(T.Tooltip.HIDE),l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})),n===z.LEFT||n===z.RIGHT?c.key&&c.key==="ArrowUp"?l.goNext(this,c):c.key&&c.key==="ArrowDown"&&l.goPrevious(this,c):c.key&&c.key==="ArrowLeft"?l.goPrevious(this,c):c.key&&c.key==="ArrowRight"&&l.goNext(this,c)})}goNext(t,n){t.nextElementSibling&&t.nextElementSibling.tagName!=="path"&&t.nextElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}goPrevious(t,n){t.previousElementSibling&&t.previousElementSibling.tagName!=="path"&&t.previousElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;k.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick.tick-hover").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("focus",null).on("blur",null)}}class ve extends vt{constructor(){super(...arguments),this.type="2D-axes",this.renderType=st.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},i=Object.keys(z),r=y(this.getOptions(),"axes");i.forEach(o=>{r[z[o]]&&(n[z[o]]=!0)}),this.configs.axes=n,i.forEach(o=>{const l=z[o];if(this.configs.axes[l]&&!this.children[l]){const c={position:l,axes:this.configs.axes,margins:this.margins},u=this.model.axisFlavor===cs.DEFAULT?new hv(this.model,this.services,c):new e2(this.model,this.services,c);u.setModel(this.model),u.setServices(this.services),u.setParent(this.parent),this.children[l]=u}}),Object.keys(this.children).forEach(o=>{this.children[o].render(t)});const s={};Object.keys(this.children).forEach(o=>{const l=this.children[o],c=l.configs.position,u=l.getInvisibleAxisRef(),{width:d,height:h}=k.getSVGElementSize(u,{useBBox:!0});let f=0;if(!l.getTitleRef().empty()){const m=k.getSVGElementSize(l.getTitleRef(),{useBBox:!0}).height;c===z.LEFT||c===z.RIGHT?f=m+5:c===z.BOTTOM?f=m+qg:f=m}const p=d,g=h;switch(c){case z.TOP:s.top=g+f;break;case z.BOTTOM:s.bottom=g+f;break;case z.LEFT:s.left=p+f;break;case z.RIGHT:s.right=p+f;break}}),this.services.events.dispatchEvent(T.Axis.RENDER_COMPLETE),Object.keys(s).some(o=>this.margins[o]!==s[o])&&(this.margins=Object.assign(this.margins,s),this.model.set({axesMargins:this.margins},{skipUpdate:!0}),this.services.events.dispatchEvent(T.ZoomBar.UPDATE),Object.keys(this.children).forEach(o=>{const l=this.children[o];l.margins=this.margins}),this.render(!0))}}class ue extends vt{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=y(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Vt.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Vt.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Vt.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Vt.DONUT)this.renderDonutSkeleton(t);else throw new Error(`"${this.configs.skeleton}" is not a valid Skeleton type.`)}renderGridSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawXGrid(t),this.drawYGrid(t),t&&this.setShimmerEffect("shimmer-lines")}renderVertOrHorizSkeleton(t){const n=this.services.cartesianScales.getOrientation();this.setScales(),this.drawBackdrop(t),n===Ht.VERTICAL&&this.drawYGrid(t),n===Ht.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius();this.drawRing(n,0,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),i=this.computeInnerRadius();this.drawRing(n,i,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=Ve().domain([0,1]).range(t),this.yScale=Ve().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:i,height:r}=k.getSVGElementSize(n,{useAttrs:!0});this.backdrop=k.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("role","presentation").attr("width",i).attr("height",r);const s=k.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop");s.attr("width","100%").attr("height","100%");const[a]=this.xScale.range(),[,o]=this.yScale.range();this.backdrop.merge(s).attr("x",a).attr("y",o),s.classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawXGrid(t){const n=+this.backdrop.attr("width"),i=y(this.getOptions(),"grid","x","numberOfTicks"),r=this.xScale.ticks(i).map(o=>o*n),s=k.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(r);a.enter().append("line").merge(a).attr("x1",o=>o).attr("x2",o=>o).attr("y1",0).attr("y2","100%"),s.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawYGrid(t){const n=+this.backdrop.attr("height"),i=this.backdrop.attr("width"),r=y(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(r).map(l=>l*n),a=k.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",i).attr("y1",l=>l).attr("y2",l=>l),a.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawRing(t,n,i=!0){const r=this.parent,{width:s,height:a}=k.getSVGElementSize(r,{useAttrs:!0}),o=k.appendOrSelect(r,"svg.chart-skeleton").attr("width",s).attr("height",a).attr("role","presentation"),l=n===0?"pie":"donut",c=y(this.getOptions(),l,"alignment");k.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=zr().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),d=t+Math.abs(Lt.radiusOffset),h=t+(Math.min(s,a)-t*2)/2,f=k.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${d}, ${h})`).attr("d",u).classed("shimmer-effect-areas",i).classed("empty-state-areas",!i).style("fill",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let p=t+Lt.xOffset;c===Gt.CENTER?p=s/2:c===Gt.RIGHT&&(p=s-t-Lt.xOffset);const g=t+Lt.yOffset;f.attr("transform",`translate(${p}, ${g})`)}computeOuterRadius(){const{width:t,height:n}=k.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+Lt.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const s="stop-bg-shimmer",a="stop-shimmer",o=this.parent.select(".chart-skeleton"),{width:l}=k.getSVGElementSize(this.parent,{useAttrs:!0}),c=0,u=l,d=k.appendOrSelect(o,"defs").lower(),h=k.appendOrSelect(d,"linearGradient").attr("id",this.services.domUtils.generateElementIDString(t)).attr("class",t).attr("x1",c-3*.2*l).attr("x2",u).attr("y1",0).attr("y2",0).attr("gradientUnits","userSpaceOnUse").attr("gradientTransform","translate(0, 0)"),f=`
66
+ </svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class Rk extends Ze{constructor(t,n){super(t,n),this.model=new hk(this.services),this.model.setOptions(It(At.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new Lk(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}const or=class or extends vt{constructor(){super(...arguments),this.type="grid-brush",this.renderType=st.SVG,this.selectionSelector="rect.selection",this.frontSelectionSelector="rect.frontSelection"}render(t=!0){const n=this.parent,i=this.getComponentContainer({isPresentational:!0});if(!n)throw new Error("SVG was not defined");const r=k.appendOrSelect(n,"svg.chart-grid-backdrop"),s=k.appendOrSelect(r,`g.${this.type}`),a=k.appendOrSelect(s,this.selectionSelector),{width:o,height:l}=k.getSVGElementSize(r,{useAttrs:!0}),{cartesianScales:c}=this.services,u=c.getMainXScaleType(),d=c.getMainXScale(),[h]=d.range();i.attr("transform",`translate(${h},0)`);const f=k.appendOrSelect(i,this.frontSelectionSelector);if(d&&u===it.TIME){let p=this.model.get("zoomDomain");p===void 0&&(p=this.services.zoom.getDefaultZoomBarDomain(),p&&this.model.set({zoomDomain:p},{animate:!1}));const g=x=>{const _=x[1]-x[0];let C="0,"+_.toString();const D=Math.floor(l/or.DASH_LENGTH),$=D*or.DASH_LENGTH;for(let P=0;P<D;P++)C+=","+or.DASH_LENGTH;C+=","+(l-$),D%2===1&&(C+=",0"),C+=","+_.toString(),C+=","+l.toString(),f.attr("stroke-dasharray",C)},m=x=>{const _=x.selection;_===null||_[0]===_[1]||(f.attr("x",parseFloat(a.attr("x"))+parseFloat(r.attr("x"))).attr("y",a.attr("y")).attr("width",a.attr("width")).attr("height",a.attr("height")).style("cursor","pointer").style("display",null),g(_))},v=(x,_)=>{const C=_f().range([0,o]).domain(p);let D=[C.invert(x),C.invert(_)],$="manual";D[0].valueOf()===D[1].valueOf()?(D=this.services.zoom.getDefaultZoomBarDomain(),$="reset"):$="manual",(p[0].valueOf()!==D[0].valueOf()||p[1].valueOf()!==D[1].valueOf())&&this.services.zoom.handleDomainChange(D,{dispatchEvent:!0,type:$})};let S;const E=x=>{const _=x.selection;_!==null&&(v(_[0],_[1]),s.call(S.move,null),f.style("display","none"))};l!=0&&o!=0&&(S=Gh().extent([[0,0],[o-1,l]]).on("start brush end",m).on("end.brushed",E),s.call(S));const b=this.services.zoom.getZoomRatio();r.on("click",function(x){if(x.shiftKey){const _=this.services.domUtils.getHolder(),C=Yn(s.node(),_)[0];let D=C-o*b/2;D<0&&(D=0);let $=C+o*b/2;$>o&&($=o),v(D,$)}})}}};or.DASH_LENGTH=4;let Ou=or;class Ik extends vt{constructor(){super(...arguments),this.type="zoom-bar",this.renderType=st.SVG,this.MIN_SELECTION_DIFF=9e-10,this.brushSelector="g.zoom-bar-brush",this.clipId="zoomBarClip-"+Math.floor(Math.random()*99999999999),this.brush=Gh(),this.highlightStrokeWidth=1}init(){this.services.events.addEventListener(T.ZoomBar.UPDATE,this.render.bind(this));const t=y(this.getOptions(),"zoomBar",z.TOP,"data");this.model.setZoomBarData(t)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"zoom bar"}),i=this.services.zoom.isZoomBarLoading(z.TOP),r=this.services.zoom.isZoomBarLocked(z.TOP),s=y(this.getOptions(),"zoomBar",z.TOP,"type"),a=y(this.getOptions(),"axes",z.BOTTOM,"highlights"),o=_e.height[s],{width:l}=k.getSVGElementSize(this.parent,{useAttrs:!0});if(l===0)return;let c=0;const u=this.model.get("axesMargins");u&&u.left&&(c=u.left);const d=k.appendOrSelect(n,"svg.zoom-container").attr("width","100%").attr("height",o).attr("opacity",1).attr("role","presentation");if(k.appendOrSelect(n,"rect.zoom-spacer").attr("x",0).attr("y",o).attr("width","100%").attr("height",_e.spacerHeight).attr("opacity",1).attr("fill","none"),s===qe.GRAPH_VIEW?k.appendOrSelect(d,"rect.zoom-bg").attr("x",c).attr("y",0).attr("width",l-c).attr("height","100%").classed("zoom-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null):s===qe.SLIDER_VIEW&&k.appendOrSelect(d,"rect.zoom-slider-bg").attr("x",c).attr("y",o/2-1).attr("width",l-c).attr("height",2).classed("zoom-slider-bg-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null),i){this.renderSkeleton(d,c,l);return}const{cartesianScales:h}=this.services,f=h.getMainXScale(),p=h.getMainYScale(),g=h.getMainXScaleType();if(f&&g===it.TIME){let m=this.services.zoom.getZoomBarData();if(Ye(m)||m.length===1)return;this.xScale=f.copy(),this.yScale=p.copy();const v=this.services.zoom.getDefaultZoomBarDomain(m);m=this.compensateDataForDefaultDomain(m,v);const S=this.model.get("initialZoomDomain"),E=y(this.getOptions(),"zoomBar",z.TOP,"initialZoomDomain");E&&E[0]&&E[1]&&(E[0]=new Date(E[0]),E[1]=new Date(E[1])),E&&!(S&&S[0].valueOf()===E[0].valueOf()&&S[1].valueOf()===E[1].valueOf())?this.model.set({initialZoomDomain:ut([],E),zoomDomain:E?ut([],E):v},{skipUpdate:!0}):E===null&&S!==null&&this.model.set({initialZoomDomain:null,zoomDomain:ut([],v)},{skipUpdate:!0}),this.xScale.range([c,l]).domain(v),this.maxSelectionRange=this.xScale.range(),this.yScale.range([0,o-6]).domain(Ue(m,_=>_.value));const b=this.model.get("zoomDomain");if(s===qe.GRAPH_VIEW&&(this.renderZoomBarArea(d,"path.zoom-graph-area-unselected",m,null),this.updateClipPath(n,this.clipId,0,0,0,0),this.renderZoomBarArea(d,"path.zoom-graph-area",m,this.clipId),this.renderZoomBarBaseline(d,c,l),a)){const _=a.highlightStartMapsTo,C=a.highlightEndMapsTo,D=a.color,$=a.labelMapsTo;a.data.forEach((P,w)=>{k.appendOrSelect(d,`rect.highlight-${w}`).attr("height",o-2*this.highlightStrokeWidth).attr("y",this.highlightStrokeWidth).attr("x",this.xScale(P[_])).attr("width",this.xScale(P[C])-this.xScale(P[_])).style("fill",D&&D.scale[P[$]]?D.scale[P[$]]:null).style("fill-opacity",.1).style("stroke",D&&D.scale[P[$]]?D.scale[P[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width","1px")})}this.addBrushEventListener(b,c,l);const x=k.appendOrSelect(n,this.brushSelector).call(this.brush);if(b!==void 0)if(b[0].valueOf()===b[1].valueOf())x.call(this.brush.move,this.xScale.range()),this.updateBrushHandle(this.getComponentContainer(),this.xScale.range());else{const _=b.map(C=>this.xScale(C));_[1]-_[0]<this.MIN_SELECTION_DIFF||(x.call(this.brush.move,_),this.updateBrushHandle(this.getComponentContainer(),_))}r&&(this.brush.filter(()=>!1),x.selectAll("rect").attr("cursor","auto"))}}addBrushEventListener(t,n,i){const r=o=>{const l=o.selection;l===null?this.handleBrushedEvent(o,t,this.xScale,this.xScale.range()):l[0]===l[1]||this.handleBrushedEvent(o,t,this.xScale,l)},s=y(this.getOptions(),"zoomBar",z.TOP,"type"),a=_e.height[s];this.brush.extent([[n,0],[i,a]]).on("start brush end",null).on("start brush end",r)}handleBrushedEvent(t,n,i,r){const s=[i.invert(r[0]),i.invert(r[1])];if(this.updateBrushHandle(this.getComponentContainer(),r),t.sourceEvent!=null&&(t.sourceEvent.type==="mousemove"||t.sourceEvent.type==="mouseup"||t.sourceEvent.type==="mousedown"||t.sourceEvent.type==="touchstart"||t.sourceEvent.type==="touchmove"||t.sourceEvent.type==="touchend")){let a="manual";if(n&&n[0]&&n[1]){const l=this.services.zoom.getDefaultZoomBarDomain();s[0].valueOf()===l[0].valueOf()&&s[1].valueOf()===l[1].valueOf()?a="reset":a="manual"}(n===void 0||n[0]!==s[0]||n[1]!==s[1])&&this.services.zoom.handleDomainChange(s,{dispatchEvent:!1,type:a});let o;t.type==="start"?o=T.ZoomBar.SELECTION_START:t.type==="brush"?o=T.ZoomBar.SELECTION_IN_PROGRESS:t.type==="end"&&(o=T.ZoomBar.SELECTION_END,this.services.events.dispatchEvent(T.ZoomDomain.CHANGE,{newDomain:s,type:a})),this.services.events.dispatchEvent(o,{selection:r,newDomain:s})}}updateBrushHandle(t,n){const i=this,r=_e.handleWidth,s=y(this.getOptions(),"zoomBar",z.TOP,"type"),a=_e.height[s],o=-r/2,l=_e.handleBarWidth,c=s===qe.GRAPH_VIEW?_e.handleBarHeight:6,u=-l/2,d=(a-c)/2;t.select(this.brushSelector).selectAll("rect.handle").data([{type:"w"},{type:"e"}]).attr("x",function(f){if(f.type==="w")return Math.max(n[0]+o,i.maxSelectionRange[0]);if(f.type==="e")return Math.min(n[1]+o,i.maxSelectionRange[1]-r)}).attr("y",0).attr("width",r).attr("height",a).attr("cursor","ew-resize").style("display",null);const h=t.select(this.brushSelector).selectAll("rect.handle-bar").data([{type:"w"},{type:"e"}]);h.enter().append("rect").attr("class",function(f){return"handle-bar handle-bar--"+f.type}),h.attr("x",function(f){if(f.type==="w")return Math.max(n[0]+u,i.maxSelectionRange[0]-o+u);if(f.type==="e")return Math.min(n[1]+u,i.maxSelectionRange[1]+o+u)}).attr("y",d).attr("width",l).attr("height",c).attr("cursor","ew-resize"),s===qe.SLIDER_VIEW&&this.updateSliderSelectedArea(n),this.updateClipPath(t,this.clipId,n[0],0,n[1]-n[0],a)}updateSliderSelectedArea(t){const n=y(this.getOptions(),"zoomBar",z.TOP,"type"),i=_e.height[n],s=this.getComponentContainer().select("svg.zoom-container");k.appendOrSelect(s,"rect.zoom-slider-selected-area").attr("x",t[0]).attr("y",i/2-1).attr("width",t[1]-t[0]).attr("height",2)}renderZoomBarArea(t,n,i,r){const{cartesianScales:s}=this.services,a=s.getMainXAxisPosition(),o=s.getMainYAxisPosition(),l=s.getMainXScaleType(),c=s.getMainYScaleType(),u=(v,S,E)=>b=>s.getValueFromScale(v,S,E,b),d=u(this.xScale,l,a),h=u(this.yScale,c,o),f=y(this.getOptions(),"zoomBar",z.TOP,"type"),p=_e.height[f],g=Xl().x(v=>d(v)).y0(p).y1(v=>p-h(v)),m=k.appendOrSelect(t,n).datum(i).attr("d",g);r&&m.attr("clip-path",`url(#${r})`)}updateClipPath(t,n,i,r,s,a){const o=k.appendOrSelect(t,"clipPath").attr("id",n);k.appendOrSelect(o,"rect").attr("x",i).attr("y",r).attr("width",s).attr("height",a)}compensateDataForDefaultDomain(t,n){if(!t||t.length<2)return;const i=Tn(t),r=this.services.cartesianScales.getDomainIdentifier(),s=this.services.cartesianScales.getRangeIdentifier();if(Number(n[0])<Number(i[0][r])){const a={};a[r]=n[0],a[s]=0,i.unshift(a)}if(Number(n[1])>Number(i[i.length-1][r])){const a={};a[r]=n[1],a[s]=0,i.push(a)}return i}renderZoomBarBaseline(t,n,i,r=!1){const s=y(this.model.getOptions(),"zoomBar",z.TOP,"type"),a=_e.height[s],o=Wr()([[n,a],[i,a]]);k.appendOrSelect(t,"path.zoom-bg-baseline").attr("d",o).classed("zoom-bg-baseline-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}renderSkeleton(t,n,i){this.renderZoomBarArea(t,"path.zoom-graph-area-unselected",[],null),this.renderZoomBarArea(t,"path.zoom-graph-area",[],this.clipId),this.brush.on("start brush end",null),k.appendOrSelect(this.getComponentContainer(),this.brushSelector).html(null),y(this.getOptions(),"zoomBar",z.TOP,"type")===qe.GRAPH_VIEW&&this.renderZoomBarBaseline(t,n,i,!0)}destroy(){this.brush.on("start brush end",null),this.services.events.removeEventListener(T.ZoomBar.UPDATE,this.render.bind(this))}}class kk extends vt{constructor(t,n){super(t,n),this.type="threshold",this.renderType=st.SVG,this.positionService=new ho}render(t=!1){const n=y(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(h=>{if(Object.values(z).includes(h)){const f=n[h];f.thresholds&&f.thresholds.length>0&&i.push({axisPosition:h,thresholds:f.thresholds,correspondingDatasets:f?.correspondingDatasets,mapsTo:f?.mapsTo})}});const s=this.getComponentContainer({ariaLabel:"threshold lines",withinChartClip:!0}).selectAll("g.axis-thresholds").data(i,h=>h.axisPosition);s.exit().attr("opacity",0).remove();const o=s.enter().append("g").merge(s);o.attr("class",h=>`axis-thresholds ${h.axisPosition}`);const l=o.selectAll("g.threshold-group").data(h=>h.thresholds.map(f=>(f.axisPosition=h.axisPosition,f.datum=this.constructDatumObj(h,f),f)));l.exit().attr("opacity",0).remove();const c=l.enter().append("g");c.append("line").attr("class","threshold-line"),c.append("rect").attr("class","threshold-hoverable-area"),c.merge(l).attr("class","threshold-group");const d=this;o.each(function({axisPosition:h}){const f=d.services.cartesianScales.getScaleByPosition(h),p=d.services.cartesianScales.getScaleTypeByPosition(h);let g=null,m=null;h===z.LEFT||h===z.RIGHT?(m=f,g=d.services.cartesianScales.getMainXScale()):(g=f,m=d.services.cartesianScales.getMainYScale());const v=p===it.LABELS,[S,E]=g.range(),[b,x]=m.range(),{cartesianScales:_}=d.services,C=_.getOrientation(),D=N=>_.getDomainValue(N),$=N=>_.getRangeValue(N),[P,w]=Cn(D,$,C),H=I(this);h===z.TOP||h===z.BOTTOM?(H.selectAll("line.threshold-line").transition().call(N=>d.services.transitions.setupTransition({transition:N,name:"threshold-line-update",animate:t})).attr("y1",x).attr("y2",b).attr("x1",({datum:N})=>P(N)+(v?f.step()/2:0)).attr("x2",({datum:N})=>P(N)+(v?f.step()/2:0)).style("stroke",({fillColor:N})=>N),H.selectAll("rect.threshold-hoverable-area").attr("x",0).attr("y",({datum:N})=>-P(N)).attr("width",Math.abs(b-x)).classed("rotate",!0)):(H.selectAll("line.threshold-line").transition().call(N=>d.services.transitions.setupTransition({transition:N,name:"threshold-line-update",animate:t})).attr("x1",S).attr("x2",E).attr("y1",({datum:N})=>w(N)+(v?f.step()/2:0)).attr("y2",({datum:N})=>w(N)+(v?f.step()/2:0)).style("stroke",({fillColor:N})=>N),H.selectAll("rect.threshold-hoverable-area").attr("x",S).attr("y",({datum:N})=>w(N)).attr("width",Math.abs(E-S)).classed("rotate",!1))}),this.services.events.addEventListener(T.Threshold.SHOW,h=>{this.setThresholdLabelPosition(h.detail),this.label.classed("hidden",!1)}),this.services.events.addEventListener(T.Threshold.HIDE,()=>{this.label.classed("hidden",!0)}),this.appendThresholdLabel(),this.addEventListeners()}getFormattedValue(t){const{value:n,axisPosition:i}=t,r=this.getOptions(),s=this.services.cartesianScales.getScaleTypeByPosition(i),{code:a,number:o}=y(r,"locale");if(s===it.TIME){const l=[z.LEFT,z.RIGHT].includes(i),c=this.services.cartesianScales.getMainXScale(),u=this.services.cartesianScales.getMainYScale(),d=l?u:c,h=y(r,"timeScale"),f=ru(d.ticks(),y(h,"timeInterval"));return iu(n,0,d.ticks(),f,h,r.locale)}return o(n,a)}appendThresholdLabel(){const t=I(this.services.domUtils.getHolder()),n=y(this.getOptions(),"style","prefix");this.label=k.appendOrSelect(t,`div.${pe}--${n}--threshold--label`).classed("hidden",!0)}setThresholdLabelPosition({event:t,datum:n}){const i=this.services.domUtils.getHolder(),r=Yn(t,i),s=n.valueFormatter?n.valueFormatter(n.value):this.getFormattedValue(n);this.label.html(ln(`${n.label||"Threshold"}: ${s}`)).style("background-color",n.fillColor);const a=this.label.node(),o=this.positionService.findBestPlacementAt({left:r[0],top:r[1]},a,[Bt.RIGHT,Bt.LEFT,Bt.TOP,Bt.BOTTOM],()=>({top:void 0,left:void 0,width:i.offsetWidth,height:i.offsetHeight})),l=this.positionService.findPositionAt({left:r[0],top:r[1]},a,o);this.positionService.setElement(a,l)}constructDatumObj(t,n){const i={};return t.correspondingDatasets&&(i.group=y(t,"correspondingDatasets",0)),i[t.mapsTo]=n.value,i}addEventListeners(){const t=this;this.getComponentContainer({withinChartClip:!0}).selectAll("rect.threshold-hoverable-area").on("mouseover mousemove",function(i){I(this.parentNode).select("line.threshold-line").classed("active",!0),t.services.events.dispatchEvent(T.Threshold.SHOW,{event:i,hoveredElement:I(this),datum:I(this).datum()})}).on("mouseout",function(i){I(this.parentNode).select("line.threshold-line").classed("active",!1),t.services.events.dispatchEvent(T.Threshold.HIDE,{event:i,hoveredElement:I(this),datum:I(this).datum()})})}}class Pk extends vt{constructor(t,n){super(t,n),this.type="highlight",this.renderType=st.SVG,this.positionService=new ho,this.highlightStrokeWidth=1}render(t=!1){const n=y(this.getOptions(),"axes"),i=[];Object.keys(n).forEach(h=>{if(Object.values(z).includes(h)){const f=n[h];f.highlights&&f.highlights.data.length>0&&i.push({axisPosition:h,highlightStartMapsTo:f.highlights.highlightStartMapsTo,highlightEndMapsTo:f.highlights.highlightEndMapsTo,labelMapsTo:f.highlights.labelMapsTo,highlight:f.highlights.data,color:f.highlights.color})}});const s=this.getComponentContainer({ariaLabel:"highlight areas",withinChartClip:!0}).selectAll("g.axis-highlight").data(i,h=>h.axisPosition);s.exit().attr("opacity",0).remove();const o=s.enter().append("g").merge(s);o.attr("class",h=>`axis-highlight ${h.axisPosition}`);const l=o.selectAll("g.highlight-group").data(h=>h.highlight.map(f=>(f.axisPosition=h.axisPosition,f.highlightStartMapsTo=h.highlightStartMapsTo,f.labelMapsTo=h.labelMapsTo,f.color=h.color,f.highlightEndMapsTo=h.highlightEndMapsTo,f)));l.exit().attr("opacity",0).remove();const c=l.enter().append("g");c.append("rect").attr("class","highlight-bar"),c.append("line").attr("class","highlight-line"),c.merge(l).attr("class","highlight-group");const d=this;o.each(function({axisPosition:h}){const f=d.services.cartesianScales.getMainXScale(),p=d.services.cartesianScales.getMainYScale(),[g,m]=f.range(),[v,S]=p.range(),{cartesianScales:E}=d.services,b=E.getOrientation(),x=P=>E.getDomainValue(P),_=P=>E.getRangeValue(P),[C,D]=Cn(x,_,b),$=I(this);h===z.TOP||h===z.BOTTOM?$.selectAll("rect.highlight-bar").transition().call(P=>d.services.transitions.setupTransition({transition:P,name:"highlight-bar-update",animate:t})).attr("y",Math.max(S+d.highlightStrokeWidth,0)).attr("height",Math.max(v-2*d.highlightStrokeWidth,0)).attr("x",({highlightStartMapsTo:P,...w})=>C(w[P])).attr("width",({highlightStartMapsTo:P,highlightEndMapsTo:w,...H})=>Math.max(C(H[w])-C(H[P]),0)).style("stroke",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",d.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null):$.selectAll("rect.highlight-bar").transition().call(P=>d.services.transitions.setupTransition({transition:P,name:"highlight-bar-update",animate:t})).attr("x",g).attr("width",Math.max(m-g,0)).attr("y",({highlightEndMapsTo:P,...w})=>D(w[P])).attr("height",({highlightStartMapsTo:P,highlightEndMapsTo:w,...H})=>Math.max(D(H[P])-D(H[w]),0)).style("stroke",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",d.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:P,labelMapsTo:w,...H})=>P&&P.scale[H[w]]?P.scale[H[w]]:null)})}}class Qm extends Eu{getItems(t){if(t.detail.items)return t.detail.items;const{data:n}=t.detail;if(!n||!n.length||!n[0])return[];const i=this.getOptions(),{cartesianScales:r}=this.services,s=r.getDomainIdentifier(),a=r.isDualAxes(),{groupMapsTo:o}=i.data,l=r.getDomainLabel();let c=r.getRangeLabel();const u=n[0][s];let d;if(n.length===1){const h=n[0],f=r.getRangeIdentifier(h);if(a){const g=r.getRangeAxisPosition({datum:h,groups:[h[o]]});c=r.getScaleLabel(g)}const p=h[f];d=[{label:l,value:u},...Array.isArray(p)&&p.length===2?[{label:"Start",value:p[0]},{label:"End",value:p[1]}]:[{label:c,value:h[f]}]],t.detail.additionalItems&&t.detail.additionalItems.forEach(g=>d.push({label:g.label,value:g.value})),d.push({label:Et(i,"locale.translations.group")||Et(i,"tooltip.groupLabel"),value:h[o],color:this.model.getFillColor(h[o]),class:this.model.getColorClassName({classNameTypes:[lt.TOOLTIP],dataGroupName:h[o]})})}else if(n.length>1&&(d=[{label:l,value:u}],d=d.concat(n.map(h=>{const f=h[r.getRangeIdentifier(h)];return{label:h[o],value:Array.isArray(f)&&f.length===2?`${f[0]} - ${f[1]}`:f,color:this.model.getFillColor(h[o]),class:this.model.getColorClassName({classNameTypes:[lt.TOOLTIP],dataGroupName:h[o]})}}).sort((h,f)=>f.value-h.value)),!a&&y(i,"tooltip","showTotal")===!0)){const h=r.getRangeIdentifier(),f=y(i,"tooltip","customTotalCalculation");let p;f?p=f(n):p=n.reduce((g,m)=>g+m[h],0),d.push({label:Et(i,"tooltip.totalLabel")||Et(i,"locale.translations.total")||"Total",value:p,bold:!0})}return d}}function Ts(e,t){const n=+$t(e)-+$t(t);return n<0?-1:n>0?1:n}function Nk(e,t,n){const[i,r]=di(n?.in,e,t);return i.getFullYear()-r.getFullYear()}function $k(e,t,n){const[i,r]=di(n?.in,e,t),s=Ts(i,r),a=Math.abs(Nk(i,r));i.setFullYear(1584),r.setFullYear(1584);const o=Ts(i,r)===-s,l=s*(a-+o);return l===0?0:l}function wu(e,t,n){const i=$t(e,n?.in);if(isNaN(t))return Pe(e,NaN);if(!t)return i;const r=i.getDate(),s=Pe(e,i.getTime());s.setMonth(i.getMonth()+t+1,0);const a=s.getDate();return r>=a?s:(i.setFullYear(s.getFullYear(),s.getMonth(),r),i)}function Jm(e,t,n){return wu(e,t*12,n)}function Fk(e,t,n){return Jm(e,-t,n)}function Uk(e,t,n){const[i,r]=di(n?.in,e,t),s=i.getFullYear()-r.getFullYear(),a=i.getMonth()-r.getMonth();return s*12+a}function Bk(e,t){const n=$t(e,t?.in);return n.setHours(23,59,59,999),n}function Hk(e,t){const n=$t(e,t?.in),i=n.getMonth();return n.setFullYear(n.getFullYear(),i+1,0),n.setHours(23,59,59,999),n}function Gk(e,t){const n=$t(e,t?.in);return+Bk(n,t)==+Hk(n,t)}function Vk(e,t,n){const[i,r,s]=di(n?.in,e,e,t),a=Ts(r,s),o=Math.abs(Uk(r,s));if(o<1)return 0;r.getMonth()===1&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-a*o);let l=Ts(r,s)===-a;Gk(i)&&o===1&&Ts(i,s)===1&&(l=!1);const c=a*(o-+l);return c===0?0:c}function zk(e,t,n){return wu(e,-t,n)}function Wk(e,t,n){const[i,r]=di(n?.in,e,t),s=tv(i,r),a=Math.abs(rm(i,r));i.setDate(i.getDate()-s*a);const o=+(tv(i,r)===-s),l=s*(a-o);return l===0?0:l}function tv(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function ev(e,t,n){const i=$t(e,n?.in);return isNaN(t)?Pe(e,NaN):(t&&i.setDate(i.getDate()+t),i)}function Yk(e,t,n){return ev(e,-t,n)}function Mu(e){return t=>{const i=(e?Math[e]:Math.trunc)(t);return i===0?0:i}}function qk(e,t,n){const[i,r]=di(n?.in,e,t),s=(+i-+r)/zg;return Mu(n?.roundingMethod)(s)}function nv(e,t,n){return Pe(e,+$t(e)+t)}function iv(e,t,n){return nv(e,t*zg)}function Xk(e,t,n){return iv(e,-t)}function rv(e,t){return+$t(e)-+$t(t)}function sv(e,t,n){const i=rv(e,t)/Vg;return Mu(n?.roundingMethod)(i)}function Cu(e,t,n){const i=$t(e,n?.in);return i.setTime(i.getTime()+t*Vg),i}function av(e,t,n){return Cu(e,-t,n)}function ov(e,t,n){const i=rv(e,t)/1e3;return Mu(n?.roundingMethod)(i)}function Au(e,t,n){return nv(e,t*1e3)}function lv(e,t,n){return Au(e,-t)}class Zk extends Dn{constructor(){super(...arguments),this.scaleTypes={top:null,right:null,bottom:null,left:null},this.scales={top:null,right:null,bottom:null,left:null}}getDomainAxisPosition({datum:t=null}={}){if(this.dualAxes&&t){const n=this.model.getOptions(),{groupMapsTo:i}=n.data,r=y(n,"axes",this.secondaryDomainAxisPosition),s=t[i];if(r?.correspondingDatasets&&r.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const i=this.model.getOptions(),{groupMapsTo:r}=i.data,s=y(i,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[r]:n&&n.length>0&&(a=n[0]),s?.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return y(this.model.getOptions(),"axes",t)}getDomainAxisOptions(){const t=this.getDomainAxisPosition();return this.getAxisOptions(t)}getRangeAxisOptions(){const t=this.getRangeAxisPosition();return this.getAxisOptions(t)}getScaleLabel(t){const i=this.getAxisOptions(t).title;return i||(t===z.BOTTOM||t===z.TOP?"x-value":"y-value")}getDomainLabel(){return this.getScaleLabel(this.getDomainAxisPosition())}getRangeLabel(){return this.getScaleLabel(this.getRangeAxisPosition())}update(){this.determineAxisDuality(),this.findDomainAndRangeAxes(),this.determineOrientation(),Object.keys(z).map(n=>z[n]).forEach(n=>{this.scales[n]=this.createScale(n)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),i=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=i.primaryDomainAxisPosition,this.rangeAxisPosition=i.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=i.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=i.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===z.LEFT||this.rangeAxisPosition===z.RIGHT)&&(this.domainAxisPosition===z.BOTTOM||this.domainAxisPosition===z.TOP)?this.orientation=Ht.VERTICAL:this.orientation=Ht.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){const t=this.model.getOptions(),n=y(t,"axes");(n[z.LEFT]?.correspondingDatasets&&n[z.RIGHT]||n[z.RIGHT]?.correspondingDatasets&&n[z.LEFT]||n[z.TOP]?.correspondingDatasets&&n[z.BOTTOM]||n[z.BOTTOM]?.correspondingDatasets&&n[z.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=y(this.model.getOptions(),"axes",t,"domain");if(n&&!Array.isArray(n))throw new Error(`Domain in ${t} axis is not a valid array`);if(Array.isArray(n)&&(this.scaleTypes[t]===it.LINEAR||this.scaleTypes[t]===it.TIME)&&n.length!==2)throw new Error(`There can only be 2 elements in domain for scale type: ${this.scaleTypes[t]}`);return n}getOrientation(){return this.orientation}getScaleByPosition(t){return this.scales[t]}getScaleTypeByPosition(t){return this.scaleTypes[t]}getDomainAxisScaleType(){const t=this.getDomainAxisPosition();return this.getScaleTypeByPosition(t)}getRangeAxisScaleType(){const t=this.getRangeAxisPosition();return this.getScaleTypeByPosition(t)}getDomainScale(){return this.scales[this.domainAxisPosition]}getRangeScale(){return this.scales[this.rangeAxisPosition]}getMainXAxisPosition(){const t=[z.BOTTOM,z.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[z.LEFT,z.RIGHT];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainXScale(){return this.scales[this.getMainXAxisPosition()]}getMainYScale(){return this.scales[this.getMainYAxisPosition()]}getValueFromScale(t,n,i,r){const s=this.model.getOptions(),o=y(s,"axes")[i],{mapsTo:l}=o,c=y(r,l)!==null?r[l]:r;let u;switch(n){case it.LABELS:u=t(c)+t.step()/2;break;case it.TIME:u=t(new Date(c));break;default:u=t(c)}return u}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),i=this.getRangeAxisPosition({datum:t}),r=this.scales[i],s=this.model.getOptions(),o=y(s,"axes")[i],{mapsTo:l}=o,c=t[l]!==void 0?t[l]:t;return[r(y(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:c),r(y(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:c)]}getValueThroughAxisPosition(t,n){const i=this.scaleTypes[t],r=this.scales[t];return this.getValueFromScale(r,i,t,n)}getDomainValue(t){const n=this.getDomainAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getRangeValue(t){const n=this.getRangeAxisPosition({datum:t});return this.getValueThroughAxisPosition(n,t)}getMainXScaleType(){return this.getScaleTypeByPosition(this.getMainXAxisPosition())}getMainYScaleType(){return this.getScaleTypeByPosition(this.getMainYAxisPosition())}getDomainIdentifier(t){const n=this.model.getOptions();return y(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return y(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const i=this.model.getOptions(),r=y(i,"axes",t);if(r.scaleType===it.TIME){const s=y(i,"timeScale","addSpaceOnEdges");return jk(n,s)}else return Kk(n,Un.paddingRatio,r.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),i=this.isDualAxes();return y(n,z.LEFT)===null&&y(n,z.RIGHT)!==null||y(n,z.RIGHT,"main")===!0||i&&y(n,z.LEFT,"correspondingDatasets")?{primary:z.RIGHT,secondary:z.LEFT}:{primary:z.LEFT,secondary:z.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=y(t,"axes"),i=this.isDualAxes();return y(n,z.BOTTOM)===null&&y(n,z.TOP)!==null||y(n,z.TOP,"main")===!0||i&&y(n,z.BOTTOM,"correspondingDatasets")?{primary:z.TOP,secondary:z.BOTTOM}:{primary:z.BOTTOM,secondary:z.TOP}}findDomainAndRangeAxesPositions(t,n){const i=this.model.getOptions(),r=y(i,"axes",t.primary),s=y(i,"axes",n.primary),a=r.scaleType||it.LINEAR,o=s.scaleType||it.LINEAR,l={primaryDomainAxisPosition:null,secondaryDomainAxisPosition:null,primaryRangeAxisPosition:null,secondaryRangeAxisPosition:null};return l.primaryDomainAxisPosition=n.primary,l.primaryRangeAxisPosition=t.primary,l.secondaryDomainAxisPosition=n.secondary,l.secondaryRangeAxisPosition=t.secondary,(!(o===it.LABELS||o===it.TIME)&&a===it.LABELS||a===it.TIME)&&(l.primaryDomainAxisPosition=t.primary,l.primaryRangeAxisPosition=n.primary,l.secondaryDomainAxisPosition=t.secondary,l.secondaryRangeAxisPosition=n.secondary),l}getScaleDomain(t){const n=this.model.getOptions(),i=y(n,"axes",t),r=y(n,"bounds"),{includeZero:s}=i,a=y(i,"scaleType")||it.LINEAR;if(this.model.isDataEmpty())return[];if(i.binned){const{bins:v}=this.model.getBinConfigurations();return[0,Wn(v,S=>S.length)]}else if(i.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),S=this.model.getStackKeys({bins:v});return[S[0].split(":")[0],S[S.length-1].split(":")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:d}=i,{reference:h,compareTo:f}=Un.ratio;if(i.domain)return a===it.LABELS?i.domain:(a===it.TIME&&(i.domain=i.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,i.domain));if(u)return[0,100];if(i&&a===it.LABELS)return rs(o.map(v=>v[c]));let p,g;const m=this.model.getDataGroupNames();if(a===it.LABELS_RATIO)return o.map(v=>`${v[h]}/${v[f]}`);if(a===it.TIME)g=o.map(v=>+new Date(v[c]));else if(r&&n.axes)g=[],o.forEach(v=>{g.push(v[c]),v[r.upperBoundMapsTo]&&g.push(v[r.upperBoundMapsTo]),v[r.lowerBoundMapsTo]&&g.push(v[r.lowerBoundMapsTo])});else if(i.stacked===!0&&m&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,S=this.model.getDataValuesGroupedByKeys({groups:m}),E=o.filter(x=>!m.includes(x[v])),b=[];S.forEach(x=>{const{..._}=x;let C=0,D=0;Object.values(aL(_,"sharedStackKey")).forEach($=>{isNaN($)||($<0?D+=$:C+=$)}),b.push([D,C])}),g=[...gc(b),...E.map(x=>x[c])]}else g=[],o.forEach(v=>{const S=v[c];Array.isArray(S)&&S.length===2?(g.push(S[0]),g.push(S[1])):(l&&g.push(Math.max(v[c],v[l])),g.push(S))});return a!==it.TIME&&a!==it.LOG&&s&&g.push(0),d&&d.length>0&&d.forEach(v=>{const S=y(v,"value");S!==null&&g.push(S)}),p=Ue(g),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),i=y(n,"axes",t);if(!i)return null;const r=y(i,"scaleType")||it.LINEAR;this.scaleTypes[t]=r;let s;return r===it.TIME?s=_f():r===it.LOG?s=rf().base(i.base||10):r===it.LABELS||r===it.LABELS_RATIO?s=Li():s=Ve(),s.domain(this.getScaleDomain(t)),s}getDomainLowerBound(t){let n,i=0;return this.getOrientation()===Ht.VERTICAL?n=this.getMainYScale().domain():n=this.getMainXScale().domain(),y(this.model.getOptions(),"axes",t,"includeZero")===!1&&n[0]>0&&n[1]>0&&(i=n[0]),i}getHighestDomainThreshold(){const t=y(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getDomainScale(),s=i.sort((o,l)=>l.value-o.value)[0];return this.getScaleTypeByPosition(n)===it.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:r(s.value)}}getHighestRangeThreshold(){const t=y(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:i}=t[n];if(!Array.isArray(i)||Array.isArray(i)&&!i.length)return null;const r=this.getRangeScale(),s=i.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:r(s.value)}}}function jk(e,t){const n=new Date(e[0]),i=new Date(e[1]);return $k(i,n)>1?[Fk(n,t),Jm(i,t)]:Vk(i,n)>1?[zk(n,t),wu(i,t)]:Wk(i,n)>1?[Yk(n,t),ev(i,t)]:qk(i,n)>1?[Xk(n,t),iv(i,t)]:sv(i,n)>30?[av(n,t*30),Cu(i,t*30)]:sv(i,n)>1?[av(n,t),Cu(i,t)]:ov(i,n)>15?[lv(n,t*15),Au(i,t*15)]:ov(i,n)>1?[lv(n,t),Au(i,t)]:[n,i]}function Kk([e,t],n,i){const s=(t-e)*n,a=t<=0&&t+s>0?0:t+s;let o=e>=0&&e-s<0?0:e-s;if(i===it.LOG&&o<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");o=e}return[o,a]}class Qk extends Dn{constructor(){super(...arguments),this.curveTypes={curveLinear:Ca,curveLinearClosed:Nf,curveBasis:J_,curveBasisClosed:tT,curveBasisOpen:eT,curveBundle:nT,curveCardinal:iT,curveCardinalClosed:rT,curveCardinalOpen:sT,curveCatmullRom:aT,curveCatmullRomClosed:oT,curveCatmullRomOpen:lT,curveMonotoneX:cT,curveMonotoneY:uT,curveNatural:hT,curveStep:dT,curveStepAfter:pT,curveStepBefore:fT}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let i=this.curveTypes[t];return n&&Object.keys(n).forEach(r=>{i[r]&&(i=i[r](n[r]))}),i}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}}class Jk extends Dn{isZoomBarEnabled(){if(!this.services.cartesianScales||!y(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=y(this.model.getOptions(),"axes",t,"scaleType");return t===z.BOTTOM&&n===it.TIME}getZoomBarData(){const t=this.model.getZoomBarData();return t&&t.length>1?t:this.model.getDisplayData()}getDefaultZoomBarDomain(t){if(!this.services.zoom)throw new Error("Services zoom not defined");const n=t||this.services.zoom.getZoomBarData(),{cartesianScales:i}=this.services;if(!i)throw new Error("Services cartesianScales undefined");const r=i.getMainXAxisPosition(),s=i.getDomainIdentifier(),a=y(this.model.getOptions(),"axes",r,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!r)throw new Error("Not defined: mainXAxisPosition");return i.extendsDomain(r,Ue(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0,type:"manual"}){this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&this.services.events?.dispatchEvent(T.ZoomDomain.CHANGE,{newDomain:t,type:n.type})}getZoomRatio(){return y(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){const i=this.model.get("zoomDomain"),r=Object.assign({stacked:!1},n),s=y(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&s&&i){const a=r.stacked?"sharedStackKey":this.services.cartesianScales?.getDomainIdentifier(),o=t.filter(l=>new Date(l[a])>=i[0]&&new Date(l[a])<=i[1]);if(o.length>0)return o}return t}zoomIn(t=this.getZoomRatio()){const n=this.model.get("zoomDomain"),i=_e.handleWidth,r=this.services.cartesianScales?.getMainXScale().copy();r.domain(this.getDefaultZoomBarDomain());const s=r(n[0]),a=r(n[1]);if(a-s<i+1)return;const o=r.range(),l=a-s,c=Math.min((o[1]-o[0])/2*(t/2),l/2);let u=s+c,d=a-c;u>=d&&(u=s+l/2-i/2,d=a-l/2+i/2);const h=[r.invert(u),r.invert(d)];(n[0].valueOf()!==h[0].valueOf()||n[1].valueOf()!==h[1].valueOf())&&this.handleDomainChange(h,{dispatchEvent:!0,type:"in"})}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const i=this.services.cartesianScales.getMainXScale().copy();i.domain(this.getDefaultZoomBarDomain());const r=i(n[0]),s=i(n[1]),a=i.range(),o=(a[1]-a[0])/2*(t/2),l=Math.max(r-o,a[0]),c=Math.min(s+o,a[1]),u=[i.invert(l),i.invert(c)];(n[0].valueOf()!==u[0].valueOf()||n[1].valueOf()!==u[1].valueOf())&&this.handleDomainChange(u,{dispatchEvent:!0,type:"out"})}resetZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();(t[0].valueOf()!==n[0].valueOf()||t[1].valueOf()!==n[1].valueOf())&&this.handleDomainChange(n,{dispatchEvent:!0,type:"reset"})}isMinZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();if(!t||!n)return!1;const i=t[1].valueOf()-t[0].valueOf(),r=n[1].valueOf()-n[0].valueOf(),s=y(this.model.getOptions(),"zoomBar","minZoomRatio");return i/r<s}isMaxZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();return!!(t&&n&&t[0].valueOf()===n[0].valueOf()&&t[1].valueOf()===n[1].valueOf())}isEmptyState(){return this.getZoomBarData().length===0}isZoomBarLoading(t){return y(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return y(this.model.getOptions(),"zoomBar",t,"locked")}}class me extends Ze{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:Zk,curves:Qk,zoom:Jk}),this.model=new gi(this.services)}getAxisChartComponents(t,n){const i=this.model.getOptions(),r=y(i,"zoomBar",z.TOP,"enabled"),s=y(i,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=y(i,"axes",a,"scaleType"),l=r&&a===z.BOTTOM&&o===it.TIME,c=this.services.zoom.isZoomBarLocked(z.TOP),u=!!this.model.getOptions().title,d={id:"title",components:[new Ss(this.model,this.services)],growth:dt.STRETCH},h={id:"toolbar",components:[new nr(this.model,this.services)],growth:dt.PREFERRED},f={id:"header",components:[new ce(this.model,this.services,[d,...s?[h]:[]],{direction:Ct.ROW,alignItems:ci.CENTER})],growth:dt.PREFERRED},p={id:"legend",components:[new yu(this.model,this.services)],growth:dt.PREFERRED};l&&!c&&t.push(new Hm(this.model,this.services),new Ou(this.model,this.services)),t.push(new kk(this.model,this.services)),t.push(new Pk(this.model,this.services));const g={id:"graph-frame",components:t,growth:dt.STRETCH,renderType:st.SVG},m=y(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Ct.COLUMN;if(m){const _=y(this.model.getOptions(),"legend","position");_===Zi.LEFT?(v=Ct.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=ji.VERTICAL)):_===Zi.RIGHT?(v=Ct.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=ji.VERTICAL)):_===Zi.BOTTOM&&(v=Ct.COLUMN_REVERSE)}const S={id:"spacer",components:[new Ln(this.model,this.services)],growth:dt.PREFERRED},E={id:"full-frame",components:[new ce(this.model,this.services,[...m?[p]:[],...m?[S]:[],g],{direction:v})],growth:dt.STRETCH},b={id:"zoom-bar",components:[new Ik(this.model,this.services)],growth:dt.PREFERRED,renderType:st.SVG},x=[];if(u||s){x.push(f);const _={id:"spacer",components:[new Ln(this.model,this.services,s?{size:15}:void 0)],growth:dt.PREFERRED};x.push(_)}return l&&x.push(b),x.push(E),[new Qm(this.model,this.services),new uo(this.model,this.services),new ce(this.model,this.services,x,{direction:Ct.COLUMN})]}}class we extends vt{constructor(){super(...arguments),this.type="grid",this.renderType=st.SVG}render(t=!0){const n=y(this.getOptions(),"grid","x","enabled"),i=y(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,i),!(!n&&!i)&&(n&&(k.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),i&&(k.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,i=this.backdrop.attr("height"),r=this.services.cartesianScales.getMainXScale(),s=Ao(r).tickSizeInner(-i).tickSizeOuter(0);if(y(this.getOptions(),"grid","x","alignWithAxisTicks")){const l=this.services.cartesianScales.getDomainAxisPosition(),c=y(this.getOptions(),"axes",l,"ticks","values");c&&s.tickValues(c)}else{const l=y(this.getOptions(),"grid","x","numberOfTicks");s.ticks(l)}const o=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${i})`);t?o.transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"grid-update",animate:t})).call(s):o.call(s),this.cleanGrid(o)}drawYGrid(t){const n=this.parent,i=this.backdrop.attr("width"),r=this.services.cartesianScales.getMainYScale(),s=Yu(r).tickSizeInner(-i).tickSizeOuter(0);if(y(this.getOptions(),"grid","y","alignWithAxisTicks")){const l=this.services.cartesianScales.getRangeAxisPosition(),c=y(this.getOptions(),"axes",l,"ticks","values");c&&s.tickValues(c)}else{const l=y(this.getOptions(),"grid","y","numberOfTicks");s.ticks(l)}const o=n.select(".y.grid").attr("transform",`translate(0, ${-this.backdrop.attr("y")})`);t?o.transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"grid-update",animate:t})).call(s):o.call(s),this.cleanGrid(o)}getGridlineThreshold(t){const n=this.parent,i=n.selectAll(".x.grid .tick").nodes().sort((u,d)=>Number(Mn(u).tx)-Number(Mn(d).tx));let r=-1;if(!i.length)return;i.forEach(u=>{t[0]>=+Mn(u).tx&&r++});const s=r+1<i.length?r+1:i.length,a=i[r],o=i[s];let l;if(!a)l=+Mn(o).tx;else if(o)l=+Mn(o).tx-+Mn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();l=k.getSVGElementSize(u).width-+Mn(a).tx}const{threshold:c}=this.getOptions().tooltip.gridline;return l*c}getActiveGridline(t){const n=y(this.getOptions,"tooltip","gridline","threshold"),i=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const a=Mn(this),o={min:Number(a.tx)-i,max:Number(a.tx)+i};return o.min<=t[0]&&t[0]<=o.max})}drawBackdrop(t,n){const i=this.parent,r=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=r.range(),[l,c]=s.range();this.backdrop=k.appendOrSelect(i,"svg.chart-grid-backdrop").attr("role","presentation");const u=k.appendOrSelect(this.backdrop,t||n?"rect.chart-grid-backdrop.stroked":"rect.chart-grid-backdrop");this.backdrop.merge(u).attr("x",a).attr("y",c).attr("width",Math.abs(o-a)).attr("height",Math.abs(l-c)).lower(),u.attr("width","100%").attr("height","100%")}cleanGrid(t){t.selectAll("text").remove(),t.select(".domain").remove()}}class cv extends vt{constructor(){super(...arguments),this.type="area",this.renderType=st.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999),this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.area").transition("legend-hover-area").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-area"})).attr("opacity",i=>i.name!==n.datum().name?On.opacity.unselected:On.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.area").transition("legend-mouseout-area").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-area"})).attr("opacity",On.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({ariaLabel:"area graphs",withinChartClip:!0}),i=this.getOptions();let r=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=Xl().curve(this.services.curves.getD3Curve()).defined(x=>{const _=s.getRangeIdentifier(),C=x[_];return C!=null}),l=this.model.getGroupedData(this.configs.groups),c=y(i,"bounds"),u=c&&l&&l.length===1;!u&&c&&console.warn(`Bounds can only be shown when having 1 single datagroup, you've supplied ${l.length}`);let d=0;const h=(x,_)=>{y(i,"axes",x,"includeZero")===!1&&_[0]>0&&_[1]>0&&(d=_[0])},f=x=>u?s.getBoundedScaledValues(x)[0]:s.getRangeValue(d),p=x=>u?s.getBoundedScaledValues(x)[1]:s.getRangeValue(x);a===Ht.VERTICAL?(r=s.getMainYScale().domain(),h(s.getMainYAxisPosition(),r),o.x(x=>s.getDomainValue(x)).y0(x=>f(x)).y1(x=>p(x))):(r=s.getMainXScale().domain(),h(s.getMainXAxisPosition(),r),o.x0(x=>f(x)).x1(x=>p(x)).y(x=>s.getDomainValue(x)));const g=y(i,"color","gradient","enabled"),m=l&&l.length===1&&g;l.length>1&&g&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(l,x=>x.name),S=I(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!l.length)return;if(m){const x=S.select(`path.${this.model.getColorClassName({classNameTypes:[lt.STROKE],dataGroupName:l[0].name})}`).node();let _;if(x)_=getComputedStyle(x,null).getPropertyValue("stroke");else{const C=y(this.model.getOptions(),"color","scale");if(C!==null){const D=Object.keys(C);_=C[D[0]]}}_s.appendOrUpdateLinearGradient({svg:this.parent,id:this.services.domUtils.generateElementIDString(`${l[0].name.replace(" ","")}_${this.gradient_id}`),x1:"0%",x2:"0%",y1:"0%",y2:"100%",stops:_s.getStops(r,_)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const E=this,b=v.enter().append("path");m?b.merge(v).style("fill",x=>`url(#${this.services.domUtils.generateElementIDString(`${x.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",x=>this.model.getColorClassName({classNameTypes:[lt.FILL],dataGroupName:x.name,originalClassName:"area"})).attr("d",x=>{const{data:_}=x;return o(_)}):(b.attr("opacity",0).merge(v).attr("class","area").attr("class",x=>this.model.getColorClassName({classNameTypes:[lt.FILL,lt.STROKE],dataGroupName:x.name,originalClassName:"area"})).style("fill",x=>E.model.getFillColor(x.name,null,x.data)).transition().call(x=>this.services.transitions.setupTransition({transition:x,name:"area-update-enter",animate:t})).attr("opacity",u?1:On.opacity.selected).attr("d",x=>{const{data:_}=x;return o(_)}),u&&b.attr("fill-opacity",On.opacity.selected).style("stroke",x=>E.model.getStrokeColor(x.name,null,x.data)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class rr extends vt{constructor(){super(...arguments),this.type="line",this.renderType=st.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-line"})).attr("opacity",i=>i.name!==n.datum().name?wn.opacity.unselected:wn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",wn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,i=this.model.get("zoomDomain")!==void 0,r=n&&i?this.getComponentContainer({ariaLabel:"lines",withinChartClip:!1}):this.getComponentContainer({ariaLabel:"lines",withinChartClip:!0}),{cartesianScales:s,curves:a}=this.services,o=v=>s.getDomainValue(v),l=v=>s.getRangeValue(v),[c,u]=Cn(o,l,s.getOrientation()),d=this.getOptions(),h=Wr().x(c).y(u).curve(a.getD3Curve()).defined(v=>{const S=s.getRangeIdentifier(v),E=v[S];return E!=null});let f=[];if(this.configs.stacked){const v=Object.keys(d.axes).some(b=>d.axes[b].percentage),{groupMapsTo:S}=d.data;f=this.model.getStackedData({groups:this.configs.groups,percentage:v}).map(b=>{const x=this.services.cartesianScales.getDomainIdentifier(b),_=this.services.cartesianScales.getRangeIdentifier(b);return{name:y(b,0,S),data:b.map(C=>({[x]:C.data.sharedStackKey,[S]:C[S],[_]:C[1]})),hidden:!lL(b,C=>C[0]!==C[1])}})}else f=this.model.getGroupedData(this.configs.groups);const p=r.selectAll("path.line").data(f,v=>v.name);p.exit().attr("opacity",0).remove();const m=p.enter().append("path").classed("line",!0).attr("opacity",0).merge(p).data(f,v=>v.name).attr("class",v=>this.model.getColorClassName({classNameTypes:[lt.STROKE],dataGroupName:v.name,originalClassName:"line"})).style("stroke",v=>this.model.getStrokeColor(v.name,null,v.data)).attr("role",ft.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",v=>{const{data:S}=v;return S.map(E=>{const b=this.services.cartesianScales.getRangeIdentifier(E);return E[b]}).join(",")});if(n&&i){const v=s.getMainXScale(),S=s.getMainYScale();if(v&&S){const[E,b]=v.range(),[x,_]=S.range();r.style("overflow","hidden").style("clip",`rect(${_}px, ${b}px, ${x}px, ${E}px)`)}}m.transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"line-update-enter",animate:t})).attr("opacity",v=>v.hidden?0:1).attr("d",v=>{const{data:S}=v;return h(S)})}destroy(){const t=this.services.events;t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const uv=5;function t2(e,t){return e>t-uv&&e<t+uv}class Gn extends vt{constructor(){super(...arguments),this.type="ruler",this.renderType=st.SVG,this.isXGridEnabled=y(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=y(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!1){const n=y(this.getOptions(),"ruler","enabled"),i=y(this.getOptions(),"tooltip","alwaysShowRulerTooltip"),r=n||i;this.drawBackdrop(),r&&!this.isEventListenerAdded?this.addBackdropEventListeners():!r&&this.isEventListenerAdded&&this.removeBackdropEventListeners()}removeBackdropEventListeners(){this.isEventListenerAdded=!1,this.backdrop.on("mousemove mouseover mouseout",null)}formatTooltipData(t){return t}showRuler(t,[n,i]){const r=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[l,c]=o.range(),u=s===Ht.HORIZONTAL?i:n,d=k.appendOrSelect(r,"g.ruler").attr("aria-label","ruler"),h=k.appendOrSelect(d,"line.ruler-line"),f=r.selectAll("[role=graphics-symbol]"),p=a.map(m=>({domainValue:this.services.cartesianScales.getDomainValue(m),originalData:m})).filter(m=>t2(m.domainValue,u));if(this.pointsWithinLine&&p.length===this.pointsWithinLine.length&&p.map(m=>m.domainValue).join()===this.pointsWithinLine.map(m=>m.domainValue).join())return this.pointsWithinLine=p,this.services.events.dispatchEvent(T.Tooltip.MOVE,{mousePosition:[n,i]});this.pointsWithinLine=p;const g=this.pointsWithinLine.reduce((m,v)=>{if(m.length===0)return m.push(v),m;const S=m[0].domainValue,E=Math.abs(u-v.domainValue),b=Math.abs(u-S);return E>b||(E<b?m=[v]:m.push(v)),m},[]);if(g.length>0){const m=g.map(b=>b.originalData).filter(b=>{const x=this.services.cartesianScales.getRangeIdentifier(b),_=b[x];return _!=null}),v=g.map(b=>b.domainValue),S=f.filter(b=>{const x=this.services.cartesianScales.getDomainValue(b);return v.includes(x)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!Cg(this.elementsToHighlight,S)&&this.hideRuler(),S.dispatch("mouseover"),this.elementsToHighlight=S,this.services.events.dispatchEvent(T.Tooltip.SHOW,{event:t,mousePosition:[n,i],hoveredElement:h,data:this.formatTooltipData(m)}),d.attr("opacity",1);const E=g[0];s==="horizontal"?h.attr("x1",c).attr("x2",l).attr("y1",E.domainValue).attr("y2",E.domainValue):h.attr("y1",c).attr("y2",l).attr("x1",E.domainValue).attr("x2",E.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=k.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(T.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),i=this.model.getDisplayData();let r=function(s){const a=Yn(s,t.parent.node());t.showRuler(s,a)};if(i.length>100){const s=i.length%50*12.5;r=gL(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",r).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=k.appendOrSelect(t,"svg.chart-grid-backdrop")}}class cn extends vt{constructor(){super(...arguments),this.type="scatter",this.renderType=st.SVG,this.handleChartHolderOnHover=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-hover-scatter").call(t=>this.services.transitions?.setupTransition({transition:t,name:"chart-holder-hover-scatter"})).attr("opacity",1)},this.handleChartHolderOnMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-mouseout-scatter").call(t=>this.services.transitions?.setupTransition({transition:t,name:"chart-holder-mouseout-scatter"})).attr("opacity",0)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:i}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(r=>this.services.transitions?.setupTransition({transition:r,name:"legend-hover-scatter"})).attr("opacity",r=>r[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-mouseout-scatter").call(t=>this.services.transitions?.setupTransition({transition:t,name:"legend-mouseout-scatter"})).attr("opacity",1)}}init(){const{events:t}=this.services;if(!t)throw new Error("Services events are undefined.");t.addEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const i=n.getDomainIdentifier(t),r=this.model.get("zoomDomain");return r!==void 0?t.filter(s=>s[i].getTime()>=r[0].getTime()&&s[i].getTime()<=r[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let i;if(n){const r=Object.keys(t.axes).some(s=>t.axes[s].percentage);i=this.model.getStackedData({groups:this.configs.groups,percentage:r})}else{const{cartesianScales:r}=this.services;if(!r)throw new Error("Services cartesianScales are undefined.");i=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=r.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(i)}render(t){if(!(y(this.getOptions(),"points","enabled")||y(this.getOptions(),"bubble","enabled")))return;const i=this.services.zoom?.isZoomBarEnabled()||!1,r=this.getComponentContainer({ariaLabel:"scatter points",withinChartClip:i}),s=this.getOptions(),{groupMapsTo:a}=s.data,{cartesianScales:o}=this.services;if(!o)throw new Error("Services cartesianScales are undefined.");const l=o.getDomainIdentifier(),c=r.selectAll("circle.dot").data(this.getScatterData(),h=>`${h[a]}-${h[l]}`);c.exit().attr("opacity",0).remove();const d=c.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(c);this.styleCircles(d,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:i}=this.services;if(!i)throw new Error("Cartesian scales service is undefined");const r=i.getOrientation(),[s,a]=Cn(i.getHighestDomainThreshold(),i.getHighestRangeThreshold(),r),[o,l]=Cn(d=>i.getDomainValue(d),d=>i.getRangeValue(d),r),c=o(t),u=l(t);return a&&s?u<=a.scaleValue&&c>=s.scaleValue:a?u<=a.scaleValue:s?c>=s.scaleValue:!1}styleCircles(t,n){const i=this.getOptions(),{filled:r,fillOpacity:s}=i.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=i.data,l=f=>a.getDomainValue(f),c=f=>a.getRangeValue(f),[u,d]=Cn(l,c,a.getOrientation()),{fadeInOnChartHolderMouseover:h}=this.configs;t.raise().classed("dot",!0).attr("class",f=>{const p=a.getDomainIdentifier(f),m=this.model.getIsFilled(f[o],f[p],f,r)?[lt.FILL,lt.STROKE]:[lt.STROKE];return this.model.getColorClassName({classNameTypes:m,dataGroupName:f[o],originalClassName:"dot"})||""}).classed("threshold-anomaly",f=>this.isDatapointThresholdAnomaly(f)).classed("filled",f=>{const p=a.getDomainIdentifier(f);return this.model.getIsFilled(f[o],f[p],f,r)}).classed("unfilled",f=>{const p=a.getDomainIdentifier(f);return!this.model.getIsFilled(f[o],f[p],f,r)}).transition().call(f=>this.services.transitions?.setupTransition({transition:f,name:"scatter-update-enter",animate:n})).attr("cx",u).attr("cy",d).attr("r",i.points.radius).style("fill",f=>{const p=a.getDomainIdentifier(f);if(this.model.getIsFilled(f[o],f[p],f,r))return this.model.getFillColor(f[o],f[p],f)}).style("stroke",f=>{const p=a.getDomainIdentifier(f);return this.model.getStrokeColor(f[o],f[p],f)}).attr("fill-opacity",r?s:1).attr("opacity",h?0:1).attr("role",ft.GRAPHICS_SYMBOL).attr("aria-roledescription","point").attr("aria-label",f=>{const p=a.getRangeIdentifier(f);return f[p]}),this.addEventListeners()}getTooltipAdditionalItems(t){return null}addEventListeners(){const t=this,{groupMapsTo:n}=t.getOptions().data,i=y(this.getOptions(),"tooltip","alwaysShowRulerTooltip");if(!this.parent)throw new Error("Parent not defined");const r=this.parent.selectAll("circle");i?r.style("pointer-events","none"):r.style("pointer-events",null),r.on("mouseover",function(s,a){const o=I(this);o.classed("hovered",!0).attr("class",l=>t.model.getColorClassName({classNameTypes:[lt.FILL],dataGroupName:l[n],originalClassName:o.attr("class")})).style("fill",l=>{const c=t.services.cartesianScales?.getDomainIdentifier(l);return t.model.getFillColor(l[n],l[c],l)}).classed("unfilled",!1),i||t.services.events?.dispatchEvent(T.Tooltip.SHOW,{event:s,hoveredElement:o,data:[a],additionalItems:t.getTooltipAdditionalItems(a)}),t.services.events?.dispatchEvent(T.Scatter.SCATTER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=I(this);t.services.events?.dispatchEvent(T.Scatter.SCATTER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events?.dispatchEvent(T.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events?.dispatchEvent(T.Scatter.SCATTER_CLICK,{event:s,element:I(this),datum:a})}).on("mouseout",function(s,a){const o=I(this);if(o.classed("hovered",!1),!t.configs.filled){const{filled:l}=t.getOptions().points,c=t.services.cartesianScales?.getDomainIdentifier(a),u=t.model.getIsFilled(a[n],a[c],a,l);o.classed("unfilled",!u).style("fill",d=>u||l?t.model.getFillColor(d[n],d[c],d):null)}t.services.events?.dispatchEvent(T.Scatter.SCATTER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events?.dispatchEvent(T.Tooltip.HIDE,{hoveredElement:o})})}destroy(){this.parent?.selectAll("circle").on("mousemove",null).on("mouseout",null);const{events:t}=this.services;if(!t)throw new Error("Services events undefined");t.removeEventListener(T.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(T.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(T.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.removeEventListener(T.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}}class hv extends vt{constructor(t,n,i){super(t,n,i),this.type="axes",this.renderType=st.SVG,this.truncation={[z.LEFT]:!1,[z.RIGHT]:!1,[z.TOP]:!1,[z.BOTTOM]:!1},i&&(this.configs=i),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,i=this.getOptions(),r=y(i,"axes",n,"visible"),s=this.getComponentContainer({ariaLabel:"axes"}),{width:a,height:o}=k.getSVGElementSize(s,{useAttrs:!0}),l=k.appendOrSelect(s,`g.axis.${n}`);let c,u;if(n===z.BOTTOM||n===z.TOP?(c=this.configs.axes[z.LEFT]?this.margins.left:0,u=this.configs.axes[z.RIGHT]?a-this.margins.right:a):(c=o-this.margins.bottom,u=this.margins.top),!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const d=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===it.LABELS||this.scaleType===it.LABELS_RATIO?d.rangeRound([c,u]):d.range([c,u]);let h;switch(n){case z.LEFT:h=Yu;break;case z.BOTTOM:h=Ao;break;case z.RIGHT:h=S0;break;case z.TOP:h=b0;break}l.attr("aria-label",`${n} axis`);const f=!l.select("g.ticks").empty();let p=k.appendOrSelect(l,"g.ticks");f||(p.attr("role",`${ft.GRAPHICS_OBJECT} ${ft.GROUP}`),p.attr("aria-label",`${n} ticks`));const g=k.appendOrSelect(l,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),m=y(i,"axes",n),v=this.scaleType===it.TIME||m.scaleType===it.TIME,S=n===z.LEFT||n===z.RIGHT,E=this.model.get("zoomDomain");if(E&&v&&!S&&d.domain(E),!r){p.attr("aria-hidden",!0);return}const b=y(m,"scaleType"),x=y(i,"data","loading"),_=y(m,"ticks","number"),C=y(m,"ticks","values"),D=y(m,"truncation","type"),$=y(m,"truncation","threshold"),P=y(m,"truncation","numCharacter"),w=_!==null,H=y(i,"timeScale"),N=k.appendOrSelect(g,"g.tick"),M=k.appendOrSelect(N,"text").text("0"),O=k.getSVGElementSize(M.node(),{useBBox:!0}).height;N.remove();const F=this.scaleType||m.scaleType||it.LINEAR,U=h(d).tickSizeOuter(0);if(d.ticks){let K;if(w?K=_:(K=Un.ticks.number,S&&(K=this.getNumberOfFittingTicks(o,O,Un.ticks.verticalSpaceRatio))),d.ticks().length===1&&d.ticks()[0]===0&&(K=0),U.ticks(K),v)if(!d.ticks(K).length)U.tickValues([]);else{const nt=y(i,"timeScale","addSpaceOnEdges"),ct=y(i,"axes",n,"domain"),W=d.copy();nt&&!ct&&W.nice(K);const j=W.ticks(K);nt&&j.length>2&&!ct&&(j.splice(j.length-1,1),j.splice(0,1)),U.tickValues(j)}}let R;const B=y(m,"ticks","formatter"),{code:tt,number:Z}=y(i,"locale");if(v){const K=ru(U.tickValues(),y(i,"timeScale","timeInterval"));B===null?R=(nt,ct)=>iu(nt,ct,U.tickValues(),K,H,i.locale):R=(nt,ct)=>{const W=iu(nt,ct,U.tickValues(),K,H,i.locale);return B(nt,ct,W)}}else B===null?F===it.LINEAR&&(R=K=>Z(K,tt)):R=B;U.tickFormat(R);const[Y,Q]=this.services.cartesianScales.getScaleByPosition(n).domain();let ht;if(C){if(v)C.forEach((K,nt)=>{K.getTime===void 0&&(C[nt]=new Date(K))}),ht=C.filter(K=>{const nt=K.getTime();return nt>=new Date(Y).getTime()&&nt<=new Date(Q).getTime()});else if(b===it.LABELS){const K=this.services.cartesianScales.getScaleByPosition(n).domain();ht=C.filter(nt=>K.includes(nt))}else ht=C.filter(K=>K>=Y&&K<=Q);U.tickValues(ht)}switch(n){case z.LEFT:p.attr("transform",`translate(${this.margins.left}, 0)`);break;case z.BOTTOM:p.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case z.RIGHT:p.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case z.TOP:p.attr("transform",`translate(0, ${this.margins.top})`);break}const et=this.model.isDataEmpty();if(m.title){const K=k.appendOrSelect(l,"text.axis-title").html(et||x?"":ln(m.title)),nt=y(m,"titleOrientation");let ct;switch(n){case z.LEFT:nt===Za.RIGHT?K.attr("transform","rotate(90)").attr("y",0).attr("x",d.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):K.attr("transform","rotate(-90)").attr("y",0).attr("x",-(d.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case z.BOTTOM:const W=o-qg;K.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${W})`);break;case z.RIGHT:nt===Za.LEFT?K.attr("transform","rotate(-90)").attr("y",a).attr("x",-(d.range()[0]/2)).style("text-anchor","middle"):K.attr("transform","rotate(90)").attr("y",-a).attr("x",d.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case z.TOP:ct=k.getSVGElementSize(K,{useBBox:!0}).height,K.attr("transform",`translate(${this.margins.left/2+d.range()[1]/2}, ${ct/2})`).style("text-anchor","middle");break}}if(v){const K=ru(U.tickValues(),y(i,"timeScale","timeInterval")),nt=H.showDayName,ct=p;t&&(p=p.transition().call(j=>this.services.transitions.setupTransition({transition:j,name:"axis-update",animate:t}))),p=p.call(U),ct.selectAll(".tick").data(U.tickValues(),d).order().select("text").attr("class",(j,J)=>fm(j,J,U.tickValues(),K,nt)?"tick-label--primary":"tick-label")}else!t||!f?p=p.call(U):p=p.transition().call(K=>this.services.transitions.setupTransition({transition:K,name:"axis-update",animate:t})).call(U);if(g.call(U),n===z.BOTTOM||n===z.TOP){let K=!1;const nt=y(m,"ticks","rotation");if(nt===os.ALWAYS)K=!0;else if(nt===os.NEVER)K=!1;else if(!nt||nt===os.AUTO)if(d.step)K=g.selectAll("g.tick text").nodes().some(W=>k.getSVGElementSize(W,{useBBox:!0}).width>=d.step());else{K=!1;const ct=g.append("text").text("A"),W=k.getSVGElementSize(ct.node(),{useBBox:!0}).width;let j;g.selectAll("g.tick").each(function(){const J=I(this),L=parseFloat(y(Mn(this),"tx"));L!==null&&j+J.text().length*W*.8>=L&&(K=!0),j=L}),ct.remove()}K?(w||(U.ticks(this.getNumberOfFittingTicks(a,O,Un.ticks.horizontalSpaceRatio)),g.call(U),p.call(U)),l.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===z.TOP?"start":"end")):l.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(x?l.attr("opacity",0):l.attr("opacity",1),p.selectAll("g.tick").attr("aria-label",K=>K),g.selectAll("g.tick").attr("aria-label",K=>K),D!==Ie.NONE&&b===it.LABELS&&!C){const K=this.services.cartesianScales.getScaleDomain(n);if(K.length>0){const nt=s.select(`g.axis.${n} g.ticks g.tick`).html();l.selectAll("g.ticks g.tick").html(nt);const ct=this;l.selectAll("g.tick text").data(K).text(function(W){return W.length>$?(ct.truncation[n]=!0,hs(W,D,P)):W}),this.getInvisibleAxisRef().selectAll("g.tick text").data(K).text(function(W){return W.length>$?hs(W,D,P):W}),l.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),l.selectAll("g.tick text").data(K)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=k.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=y(r,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;i.selectAll("g.tick text").on("mouseover",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:I(this),datum:u}),a===it.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,hoveredElement:I(this),content:u})}).on("mousemove",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:I(this),datum:u}),a===it.LABELS&&u.length>o&&l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this),datum:u})}).on("mouseout",function(c,u){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this),datum:u}),a===it.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)})}getInvisibleAxisRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} g.ticks.invisible`)}getTitleRef(){const{position:t}=this.configs;return this.getComponentContainer().select(`g.axis.${t} text.axis-title`)}getNumberOfFittingTicks(t,n,i){const r=Math.floor(t/(n*i));return Wp(r,2,Un.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;k.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}}class e2 extends hv{constructor(t,n,i){super(t,n,i)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,i=this.getComponentContainer({ariaLabel:"axes"}),r=k.appendOrSelect(i,`g.axis.${n}`),s=this;r.selectAll("g.tick").each(function(a,o){const l=I(this);l.classed("tick-hover",!0).attr("role","button").attr("tabindex",o===0?0:-1);const c=l.select("text"),{width:u,height:d}=k.getSVGElementSize(c,{useBBox:!0}),h=k.appendOrSelect(l,"rect.axis-holder");let f=0,p=0;switch(n){case z.LEFT:f=-u+Number(c.attr("x")),p=-(d/2);break;case z.RIGHT:f=Math.abs(Number(c.attr("x"))),p=-(d/2);break;case z.TOP:f=-(u/2),p=-d+Number(c.attr("y"))/2,s.truncation[n]&&(f=0,h.attr("transform","rotate(-45)"));break;case z.BOTTOM:f=-(u/2),p=d/2-2,s.truncation[n]&&(f=-u,h.attr("transform","rotate(-45)"));break}h.attr("x",f-Un.hover.rectanglePadding).attr("y",p).attr("width",u+Un.hover.rectanglePadding*2).attr("height",d).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,i=k.appendOrSelect(t,`g.axis.${n}`),r=this.getOptions(),s=y(r,"axes",n),a=y(s,"scaleType"),o=y(s,"truncation","threshold"),l=this;i.selectAll("g.tick.tick-hover").on("mouseover",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOVER,{event:c,element:u,datum:d}),a===it.LABELS&&d.length>o&&l.services.events.dispatchEvent(T.Tooltip.SHOW,{event:c,element:u,datum:d})}).on("mousemove",function(c){const u=I(this).select("text"),d=u.datum();l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEMOVE,{event:c,element:u,datum:d}),l.services.events.dispatchEvent(T.Tooltip.MOVE,{event:c})}).on("click",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_CLICK,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()})}).on("mouseout",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_MOUSEOUT,{event:c,element:I(this).select("text"),datum:I(this).select("text").datum()}),a===it.LABELS&&l.services.events.dispatchEvent(T.Tooltip.HIDE)}).on("focus",function(c){const u={clientX:0,clientY:0};if(c.target){c.target.focus();const d=c.target.getBoundingClientRect();u.clientX=d.x,u.clientY=d.y}l.services.events.dispatchEvent(T.Axis.LABEL_FOCUS,{event:{...c,...u},element:I(this),datum:I(this).select("text").datum()})}).on("blur",function(c){l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})}).on("keydown",function(c){c.key&&c.key==="Escape"&&(l.services.events.dispatchEvent(T.Tooltip.HIDE),l.services.events.dispatchEvent(T.Axis.LABEL_BLUR,{event:c,element:I(this),datum:I(this).select("text").datum()})),n===z.LEFT||n===z.RIGHT?c.key&&c.key==="ArrowUp"?l.goNext(this,c):c.key&&c.key==="ArrowDown"&&l.goPrevious(this,c):c.key&&c.key==="ArrowLeft"?l.goPrevious(this,c):c.key&&c.key==="ArrowRight"&&l.goNext(this,c)})}goNext(t,n){t.nextElementSibling&&t.nextElementSibling.tagName!=="path"&&t.nextElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}goPrevious(t,n){t.previousElementSibling&&t.previousElementSibling.tagName!=="path"&&t.previousElementSibling.dispatchEvent(new Event("focus")),n.preventDefault()}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;k.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick.tick-hover").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("focus",null).on("blur",null)}}class ve extends vt{constructor(){super(...arguments),this.type="2D-axes",this.renderType=st.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},i=Object.keys(z),r=y(this.getOptions(),"axes");i.forEach(o=>{r[z[o]]&&(n[z[o]]=!0)}),this.configs.axes=n,i.forEach(o=>{const l=z[o];if(this.configs.axes[l]&&!this.children[l]){const c={position:l,axes:this.configs.axes,margins:this.margins},u=this.model.axisFlavor===cs.DEFAULT?new hv(this.model,this.services,c):new e2(this.model,this.services,c);u.setModel(this.model),u.setServices(this.services),u.setParent(this.parent),this.children[l]=u}}),Object.keys(this.children).forEach(o=>{this.children[o].render(t)});const s={};Object.keys(this.children).forEach(o=>{const l=this.children[o],c=l.configs.position,u=l.getInvisibleAxisRef(),{width:d,height:h}=k.getSVGElementSize(u,{useBBox:!0});let f=0;if(!l.getTitleRef().empty()){const m=k.getSVGElementSize(l.getTitleRef(),{useBBox:!0}).height;c===z.LEFT||c===z.RIGHT?f=m+5:c===z.BOTTOM?f=m+qg:f=m}const p=d,g=h;switch(c){case z.TOP:s.top=g+f;break;case z.BOTTOM:s.bottom=g+f;break;case z.LEFT:s.left=p+f;break;case z.RIGHT:s.right=p+f;break}}),this.services.events.dispatchEvent(T.Axis.RENDER_COMPLETE),Object.keys(s).some(o=>this.margins[o]!==s[o])&&(this.margins=Object.assign(this.margins,s),this.model.set({axesMargins:this.margins},{skipUpdate:!0}),this.services.events.dispatchEvent(T.ZoomBar.UPDATE),Object.keys(this.children).forEach(o=>{const l=this.children[o];l.margins=this.margins}),this.render(!0))}}class ue extends vt{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=y(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Vt.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Vt.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Vt.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Vt.DONUT)this.renderDonutSkeleton(t);else throw new Error(`"${this.configs.skeleton}" is not a valid Skeleton type.`)}renderGridSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawXGrid(t),this.drawYGrid(t),t&&this.setShimmerEffect("shimmer-lines")}renderVertOrHorizSkeleton(t){const n=this.services.cartesianScales.getOrientation();this.setScales(),this.drawBackdrop(t),n===Ht.VERTICAL&&this.drawYGrid(t),n===Ht.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius();this.drawRing(n,0,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),i=this.computeInnerRadius();this.drawRing(n,i,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=Ve().domain([0,1]).range(t),this.yScale=Ve().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:i,height:r}=k.getSVGElementSize(n,{useAttrs:!0});this.backdrop=k.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("role","presentation").attr("width",i).attr("height",r);const s=k.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop");s.attr("width","100%").attr("height","100%");const[a]=this.xScale.range(),[,o]=this.yScale.range();this.backdrop.merge(s).attr("x",a).attr("y",o),s.classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawXGrid(t){const n=+this.backdrop.attr("width"),i=y(this.getOptions(),"grid","x","numberOfTicks"),r=this.xScale.ticks(i).map(o=>o*n),s=k.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(r);a.enter().append("line").merge(a).attr("x1",o=>o).attr("x2",o=>o).attr("y1",0).attr("y2","100%"),s.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawYGrid(t){const n=+this.backdrop.attr("height"),i=this.backdrop.attr("width"),r=y(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(r).map(l=>l*n),a=k.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",i).attr("y1",l=>l).attr("y2",l=>l),a.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}drawRing(t,n,i=!0){const r=this.parent,{width:s,height:a}=k.getSVGElementSize(r,{useAttrs:!0}),o=k.appendOrSelect(r,"svg.chart-skeleton").attr("width",s).attr("height",a).attr("role","presentation"),l=n===0?"pie":"donut",c=y(this.getOptions(),l,"alignment");k.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=zr().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),d=t+Math.abs(Lt.radiusOffset),h=t+(Math.min(s,a)-t*2)/2,f=k.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${d}, ${h})`).attr("d",u).classed("shimmer-effect-areas",i).classed("empty-state-areas",!i).style("fill",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let p=t+Lt.xOffset;c===Gt.CENTER?p=s/2:c===Gt.RIGHT&&(p=s-t-Lt.xOffset);const g=t+Lt.yOffset;f.attr("transform",`translate(${p}, ${g})`)}computeOuterRadius(){const{width:t,height:n}=k.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+Lt.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const s="stop-bg-shimmer",a="stop-shimmer",o=this.parent.select(".chart-skeleton"),{width:l}=k.getSVGElementSize(this.parent,{useAttrs:!0}),c=0,u=l,d=k.appendOrSelect(o,"defs").lower(),h=k.appendOrSelect(d,"linearGradient").attr("id",this.services.domUtils.generateElementIDString(t)).attr("class",t).attr("x1",c-3*.2*l).attr("x2",u).attr("y1",0).attr("y2",0).attr("gradientUnits","userSpaceOnUse").attr("gradientTransform","translate(0, 0)"),f=`
67
67
  <stop class="${s}" offset="${c}"></stop>
68
68
  <stop class="${a}" offset="${c+.2}"></stop>
69
69
  <stop class="${s}" offset="${c+2*.2}"></stop>