@carbon/charts-react 1.11.2 → 1.11.3
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.
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<circle cx="16" cy="16" r="2"></circle>
|
|
12
12
|
<circle cx="16" cy="24" r="2"></circle>`},clickFunction:t=>this.toggleOverflowMenu(t)}}getControlConfigByType(t){const n=this.services.zoom&&this.services.zoom.isZoomBarEnabled()&&!this.services.zoom.isEmptyState(),r=this.model.getDisplayData();let i;switch(t){case Bt.ZOOM_IN:n&&(i={id:"toolbar-zoomIn",title:"Zoom in",shouldBeDisabled:()=>this.services.zoom.isMinZoomDomain(),iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.zoom.zoomIn()});break;case Bt.ZOOM_OUT:n&&(i={id:"toolbar-zoomOut",title:"Zoom out",shouldBeDisabled:()=>this.services.zoom.isMaxZoomDomain(),iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.zoom.zoomOut()});break;case Bt.RESET_ZOOM:n&&(i={id:"toolbar-resetZoom",title:"Reset zoom",shouldBeDisabled:()=>this.services.zoom.isMaxZoomDomain(),iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.zoom.resetZoomDomain()});break;case Bt.MAKE_FULLSCREEN:i={id:"toolbar-makefullscreen",iconSVG:{content:this.getControlIconByType(t),width:"15px",height:"15px"},title:"Make fullscreen",shouldBeDisabled:()=>!1,clickFunction:()=>{this.services.domUtils.toggleFullscreen()}};break;case Bt.SHOW_AS_DATATABLE:i={id:"toolbar-showasdatatable",iconSVG:{content:this.getControlIconByType(t)},title:"Show as table",shouldBeDisabled:()=>r.length===0,clickFunction:()=>this.services.events.dispatchEvent(A.Modal.SHOW)};break;case Bt.EXPORT_CSV:i={id:"toolbar-export-CSV",title:"Export as CSV",shouldBeDisabled:()=>!1,iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.model.exportToCSV()};break;case Bt.EXPORT_PNG:i={id:"toolbar-export-PNG",title:"Export as PNG",shouldBeDisabled:()=>!1,iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.domUtils.exportToPNG()};break;case Bt.EXPORT_JPG:i={id:"toolbar-export-JPG",title:"Export as JPG",shouldBeDisabled:()=>!1,iconSVG:{content:this.getControlIconByType(t)},clickFunction:()=>this.services.domUtils.exportToJPG()};break;default:throw Error("Not supported toolbar control type: "+t)}return i}getControlIconByType(t){switch(t){case Bt.ZOOM_IN:return`<polygon points="19 13 15 13 15 9 13 9 13 13 9 13 9 15 13 15 13 19 15 19 15 15 19 15 19 13"/>
|
|
13
13
|
<path d="M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z"/>`;case Bt.ZOOM_OUT:return`<rect x="9" y="13" width="10" height="2"/>
|
|
14
|
-
<path d="M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z"/>`;case Bt.RESET_ZOOM:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case Bt.MAKE_FULLSCREEN:return'<polygon points="21 2 21 4 26.59 4 17 13.58 18.41 15 28 5.41 28 11 30 11 30 2 21 2"/><polygon points="15 18.42 13.59 17 4 26.59 4 21 2 21 2 30 11 30 11 28 5.41 28 15 18.42"/>';case Bt.SHOW_AS_DATATABLE:return'<rect x="4" y="6" width="18" height="2"/><rect x="4" y="12" width="18" height="2"/><rect x="4" y="18" width="18" height="2"/><rect x="4" y="24" width="18" height="2"/><rect x="26" y="6" width="2" height="2"/><rect x="26" y="12" width="2" height="2"/><rect x="26" y="18" width="2" height="2"/><rect x="26" y="24" width="2" height="2"/>';case Bt.EXPORT_CSV:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case Bt.EXPORT_JPG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case Bt.EXPORT_PNG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';default:throw Error("Not supported toolbar control type: "+t)}}};let Qi=im;Qi.buttonID=0;const sm=class extends gt{constructor(t,n,r,i){super(t,n,i),this.type="layout",this.configs=i,this.children=r,this._instanceID=sm.instanceID++,this.init()}init(){this.children.forEach(t=>{t.components.forEach(n=>{n.init()})})}getPreferedAndFixedSizeSum(){const t=this.parent;let n=0;return t.selectAll(`div.layout-child-${this._instanceID}`).filter(r=>{const i=_(r,"growth");return i===ut.PREFERRED||i===ut.FIXED}).each(function(r){n+=r.size}),n}getNumOfStretchChildren(){return this.parent.selectAll(`div.layout-child-${this._instanceID}`).filter(t=>_(t,"growth")===ut.STRETCH).size()}render(t=!0){const n=this.parent,{width:r,height:i}=P.getHTMLElementSize(n.node()),s=this.configs.direction===Lt.ROW||this.configs.direction===Lt.ROW_REVERSE,a=_(this.model.getOptions(),"style","prefix"),o=n.classed(`${ge}--${a}--layout-row`,this.configs.direction===Lt.ROW).classed(`${ge}--${a}--layout-row-reverse`,this.configs.direction===Lt.ROW_REVERSE).classed(`${ge}--${a}--layout-column`,this.configs.direction===Lt.COLUMN).classed(`${ge}--${a}--layout-column-reverse`,this.configs.direction===Lt.COLUMN_REVERSE).classed(`${ge}--${a}--layout-alignitems-center`,this.configs.alignItems===Cr.CENTER).selectAll(`div.layout-child-${this._instanceID}`).data(this.children,c=>c.id);o.enter().append("div").merge(n.selectAll(`div.layout-child-${this._instanceID}`)).attr("class",c=>`layout-child layout-child-${this._instanceID} ${c.id}`).each(function(c){c.components.forEach(u=>{const h=N(this),d=_(c,"renderType")===nt.SVG;u.setParent(d?P.appendOrSelect(h,"svg.layout-svg-wrapper").attr("width","100%").attr("height","100%"):h);const f=_(c,"growth");(f===ut.PREFERRED||f===ut.FIXED)&&u.render(t)})}),n.selectAll(`div.layout-child-${this._instanceID}`).style("height",null).style("width",null).each(function(c){const u=_(c,"growth"),h=_(c,"renderType")===nt.SVG?P.getSVGElementSize(N(this).select("svg.layout-svg-wrapper"),{useBBox:!0}):P.getHTMLElementSize(this);if(u===ut.PREFERRED){const d=s?h.width:h.height,f=s?r:i;c.size=d/f*100}}),o.exit().remove(),this.children.filter(c=>_(c,"growth")===ut.STRETCH).forEach(c=>{c.size=(100-+this.getPreferedAndFixedSizeSum())/+this.getNumOfStretchChildren()});const l=n.selectAll(`div.layout-child-${this._instanceID}`).data(this.children,c=>c.id);s?l.style("width",c=>`${c.size/100*r}px`).style("height","100%"):l.style("height",c=>`${c.size/100*i}px`).style("width","100%"),l.each(function(c){c.components.forEach(u=>{_(c,"growth")===ut.STRETCH&&u.render(t)})})}setModel(t){super.setModel(t),this.children.forEach(n=>{n.components.forEach(r=>r.setModel(t))})}setServices(t){super.setServices(t),this.children.forEach(n=>{n.components.forEach(r=>r.setServices(t))})}destroy(){this.children.forEach(t=>{t.components.forEach(n=>n.destroy())})}};let me=sm;me.instanceID=Math.floor(Math.random()*99999999999);class _n extends gt{constructor(){super(...arguments),this.type="spacer"}render(t=!
|
|
14
|
+
<path d="M22.45,21A10.87,10.87,0,0,0,25,14,11,11,0,1,0,14,25a10.87,10.87,0,0,0,7-2.55L28.59,30,30,28.59ZM14,23a9,9,0,1,1,9-9A9,9,0,0,1,14,23Z"/>`;case Bt.RESET_ZOOM:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case Bt.MAKE_FULLSCREEN:return'<polygon points="21 2 21 4 26.59 4 17 13.58 18.41 15 28 5.41 28 11 30 11 30 2 21 2"/><polygon points="15 18.42 13.59 17 4 26.59 4 21 2 21 2 30 11 30 11 28 5.41 28 15 18.42"/>';case Bt.SHOW_AS_DATATABLE:return'<rect x="4" y="6" width="18" height="2"/><rect x="4" y="12" width="18" height="2"/><rect x="4" y="18" width="18" height="2"/><rect x="4" y="24" width="18" height="2"/><rect x="26" y="6" width="2" height="2"/><rect x="26" y="12" width="2" height="2"/><rect x="26" y="18" width="2" height="2"/><rect x="26" y="24" width="2" height="2"/>';case Bt.EXPORT_CSV:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case Bt.EXPORT_JPG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';case Bt.EXPORT_PNG:return'<path d="M22.4478,21A10.855,10.855,0,0,0,25,14,10.99,10.99,0,0,0,6,6.4658V2H4v8h8V8H7.332a8.9768,8.9768,0,1,1-2.1,8H3.1912A11.0118,11.0118,0,0,0,14,25a10.855,10.855,0,0,0,7-2.5522L28.5859,30,30,28.5859Z"/>';default:throw Error("Not supported toolbar control type: "+t)}}};let Qi=im;Qi.buttonID=0;const sm=class extends gt{constructor(t,n,r,i){super(t,n,i),this.type="layout",this.configs=i,this.children=r,this._instanceID=sm.instanceID++,this.init()}init(){this.children.forEach(t=>{t.components.forEach(n=>{n.init()})})}getPreferedAndFixedSizeSum(){const t=this.parent;let n=0;return t.selectAll(`div.layout-child-${this._instanceID}`).filter(r=>{const i=_(r,"growth");return i===ut.PREFERRED||i===ut.FIXED}).each(function(r){n+=r.size}),n}getNumOfStretchChildren(){return this.parent.selectAll(`div.layout-child-${this._instanceID}`).filter(t=>_(t,"growth")===ut.STRETCH).size()}render(t=!0){const n=this.parent,{width:r,height:i}=P.getHTMLElementSize(n.node()),s=this.configs.direction===Lt.ROW||this.configs.direction===Lt.ROW_REVERSE,a=_(this.model.getOptions(),"style","prefix"),o=n.classed(`${ge}--${a}--layout-row`,this.configs.direction===Lt.ROW).classed(`${ge}--${a}--layout-row-reverse`,this.configs.direction===Lt.ROW_REVERSE).classed(`${ge}--${a}--layout-column`,this.configs.direction===Lt.COLUMN).classed(`${ge}--${a}--layout-column-reverse`,this.configs.direction===Lt.COLUMN_REVERSE).classed(`${ge}--${a}--layout-alignitems-center`,this.configs.alignItems===Cr.CENTER).selectAll(`div.layout-child-${this._instanceID}`).data(this.children,c=>c.id);o.enter().append("div").merge(n.selectAll(`div.layout-child-${this._instanceID}`)).attr("class",c=>`layout-child layout-child-${this._instanceID} ${c.id}`).each(function(c){c.components.forEach(u=>{const h=N(this),d=_(c,"renderType")===nt.SVG;u.setParent(d?P.appendOrSelect(h,"svg.layout-svg-wrapper").attr("width","100%").attr("height","100%"):h);const f=_(c,"growth");(f===ut.PREFERRED||f===ut.FIXED)&&u.render(t)})}),n.selectAll(`div.layout-child-${this._instanceID}`).style("height",null).style("width",null).each(function(c){const u=_(c,"growth"),h=_(c,"renderType")===nt.SVG?P.getSVGElementSize(N(this).select("svg.layout-svg-wrapper"),{useBBox:!0}):P.getHTMLElementSize(this);if(u===ut.PREFERRED){const d=s?h.width:h.height,f=s?r:i;c.size=d/f*100}}),o.exit().remove(),this.children.filter(c=>_(c,"growth")===ut.STRETCH).forEach(c=>{c.size=(100-+this.getPreferedAndFixedSizeSum())/+this.getNumOfStretchChildren()});const l=n.selectAll(`div.layout-child-${this._instanceID}`).data(this.children,c=>c.id);s?l.style("width",c=>`${c.size/100*r}px`).style("height","100%"):l.style("height",c=>`${c.size/100*i}px`).style("width","100%"),l.each(function(c){c.components.forEach(u=>{_(c,"growth")===ut.STRETCH&&u.render(t)})})}setModel(t){super.setModel(t),this.children.forEach(n=>{n.components.forEach(r=>r.setModel(t))})}setServices(t){super.setServices(t),this.children.forEach(n=>{n.components.forEach(r=>r.setServices(t))})}destroy(){this.children.forEach(t=>{t.components.forEach(n=>n.destroy())})}};let me=sm;me.instanceID=Math.floor(Math.random()*99999999999);class _n extends gt{constructor(){super(...arguments),this.type="spacer"}render(t=!1){this.getComponentContainer().style("width",`${this.configs.size||Yf.default.size}px`).style("height",`${this.configs.size||Yf.default.size}px`).attr("opacity",0)}}var kD={prefix:"bx",selectorTabbable:`
|
|
15
15
|
a[href], area[href], input:not([disabled]):not([tabindex='-1']),
|
|
16
16
|
button:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),
|
|
17
17
|
textarea:not([disabled]):not([tabindex='-1']),
|
|
@@ -59,7 +59,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
59
59
|
<div class="${ge}--${n}-modal-footer-spacer"></div>
|
|
60
60
|
<button class="cds--btn cds--btn--primary cds--btn cds--btn--primary" type="button" data-modal-primary-focus>Download as CSV</button>
|
|
61
61
|
</div>
|
|
62
|
-
</div>`}render(t=!0){const n=this.model.getOptions();if(!this.isEventListenerAdded){const r=N(this.services.domUtils.getHolder()),i=_(n,"style","prefix");this.modal=P.appendOrSelect(r,`div.${ge}--${i}--modal`),this.addEventListeners(),this.isEventListenerAdded=!0,this.modal.attr("data-modal",!0).attr("class","cds--modal cds--modal").attr("role","dialog").attr("aria-modal",!0).attr("aria-labelledby","modal-title").attr("aria-describedby","modal-description").attr("tabindex",-1)}}destroy(){this.removeEventListeners(),this.isEventListenerAdded=!1}}class ts extends gt{constructor(){super(...arguments),this.type="title",this.renderType=nt.HTML}render(t=!0){const n=this.getComponentContainer(),r=_(this.getOptions(),"title"),i=n.selectAll("p.title").data([r]);if(i.enter().append("p").classed("title",!0).attr("role","heading").attr("aria-level",2).merge(i).html(s=>s),i.node()&&i.node().offsetWidth<i.node().scrollWidth){const s=this;i.on("mouseover",function(a){s.services.events.dispatchEvent(A.Tooltip.SHOW,{event:a,hoveredElement:i,content:i.text()})}).on("mousemove",function(a){s.services.events.dispatchEvent(A.Tooltip.MOVE,{event:a})}).on("mouseout",function(){s.services.events.dispatchEvent(A.Tooltip.HIDE)})}i.exit().remove()}truncateTitle(t,n){if(n<=0)return;const r=t.text();if(t.node().getComputedTextLength()>n){t.append("tspan").text("...");const i=P.appendOrSelect(t,"tspan").node().getComputedTextLength(),s=t.text(),a=this.getSubstringIndex(t.node(),0,s.length-1,n-i);t.html(s.substring(0,a-1)).append("tspan").text("...");const o=this;t.on("mouseover",function(l){o.services.events.dispatchEvent(A.Tooltip.SHOW,{event:l,hoveredElement:t,content:r})}).on("mousemove",function(l){o.services.events.dispatchEvent(A.Tooltip.MOVE,{event:l})}).on("mouseout",function(){o.services.events.dispatchEvent(A.Tooltip.HIDE)})}}getMaxTitleWidth(){return P.getSVGElementSize(this.parent.node(),{useAttrs:!0}).width}getSubstringIndex(t,n,r,i){const s=Math.floor((r+n)/2);return t.getSubStringLength(0,s)>i?this.getSubstringIndex(t,n,s,i):t.getSubStringLength(0,s)<i?t.getSubStringLength(0,s+1)>i?s:this.getSubstringIndex(t,s,r,i):s}}class Bc extends gt{constructor(){super(...arguments),this.type="legend",this.renderType=nt.HTML}render(t=!0){const n=this.getOptions(),r=_(n,"legend"),i=_(r,"alignment"),s=_(n,"legend","orientation");let a=this.model.getDataGroups();const{DISABLED:o}=Vt.items.status,l=a.some(b=>b.status===o),c=_(r,"order"),u=this.getComponentContainer().classed("center-aligned",i===Yt.CENTER).classed("right-aligned",i===Yt.RIGHT).classed(s,!0).classed("has-deactivated-items",l).attr("role",dt.GROUP).attr("aria-label","Data groups").attr("data-name","legend-items");c&&(a=this.sortDataGroups(a,c));const h=u.selectAll("div.legend-item").data(a,b=>b.name),d=h.enter().append("div").attr("class","legend-item");d.merge(u.selectAll("div.legend-item")).classed("active",function(b){return b.status===Vt.items.status.ACTIVE});const f=_(this.getOptions(),"legend","clickable");u.classed("clickable",f&&a.length>1);const p=Vt.checkbox.radius,m=d.append("div").classed("checkbox",!0),g=m.merge(h.select("div.checkbox")).attr("role",dt.CHECKBOX).attr("tabindex",f?0:-1).attr("aria-labelledby",(b,w)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${w}-title`)).attr("aria-checked",({status:b})=>b===Vt.items.status.ACTIVE).attr("width",p*2).attr("height",p*2).attr("class",b=>this.model.getColorClassName({classNameTypes:[st.BACKGROUND],dataGroupName:b.name,originalClassName:"checkbox"})).style("background",b=>b.status===Vt.items.status.ACTIVE?this.model.getFillColor(b.name)||this.model.getStrokeColor(b.name):null).classed("active",function(b){return b.status===Vt.items.status.ACTIVE});m.append("svg").attr("focusable",!1).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").attr("width","11").attr("height","11").attr("viewBox","0 0 31 28").attr("aria-hidden",!0).style("will-change","transform").append("path").attr("d","M13 21.2l-7.1-7.1-1.4 1.4 7.1 7.1L13 24 27.1 9.9l-1.4-1.5z"),d.append("p").merge(h.select("p"));const v=_(n,"legend","additionalItems");if(v&&a.length){const b=this,w=u.selectAll("div.additional-item").data(v);w.exit().remove();const O=w.enter().append("div").merge(w).classed("legend-item",!0).classed("additional",!0).attr("aria-labelledby",(S,$)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${g.size()+$}-title`));O.selectAll("*").remove();let E,T=1;O.append("svg").classed("icon",!0).each(function(S){const $=N(this);!E||E!=S.type?(E=S.type,T=1):T++,b.addAdditionalItem($,S,T)}),O.append("p").merge(O.select("p")),this.truncateLegendText()}h.exit().on("mouseover",null).on("click",null).on("mouseout",null).remove(),f&&d.size()>1&&this.addEventListeners()}sortDataGroups(t,n){if(t.sort((r,i)=>n.indexOf(r.name)-n.indexOf(i.name)),n.length<t.length){const r=t.length-n.length;return t.slice(r).concat(t.slice(0,r))}return t}addAdditionalItem(t,n,r){const{width:i,height:s}=Vt.area;if(n.type===Zt.RADIUS?t.style("width",`${s}px`).style("height",`${s}px`):t.style("width",`${i}px`).style("height",`${s}px`),n.type===Zt.RADIUS){const{iconData:a,fill:o,stroke:l}=Vt.radius;t.attr("fill","none").selectAll("circle").data(a).enter().append("circle").classed("radius",!0).attr("role",dt.IMG).attr("aria-label","radius").attr("cx",c=>c.cx).attr("cy",c=>c.cy).attr("r",c=>c.r).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:l)}else if(n.type===Zt.LINE){const a=Vt.line;t.select("line.line").empty()&&t.append("line").classed(`line-${r}`,!0).attr("role",dt.IMG).attr("aria-label","line").attr("x1",0).attr("y1",a.yPosition).attr("x2",i).attr("y2",a.yPosition).style("stroke",n.stroke?n.stroke:a.stroke).style("stroke-width",a.strokeWidth)}else if(n.type===Zt.AREA)t.select("rect.area").empty()&&t.append("rect").classed(`area-${r}`,!0).attr("role",dt.IMG).attr("aria-label","area").attr("width",i).attr("height",s).style("fill",r>3&&!n.fill?Vt.area.fill:n.fill).style("stroke",n.stroke);else if(n.type===Zt.SIZE){const{iconData:a,fill:o,stroke:l}=Vt.size;t.attr("fill","none").attr("role",dt.IMG).attr("aria-label","size").selectAll("rect").data(a).enter().append("rect").classed("size",!0).attr("width",c=>c.width).attr("height",c=>c.height).attr("y",()=>0).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:l).style("stroke-width",1)}else if(n.type===Zt.QUARTILE){const{iconData:a}=Vt.quartile;t.selectAll("rect").attr("role",dt.IMG).attr("aria-label","quartile").data(a).enter().append("rect").attr("class",(o,l)=>`quartile-${l===0?"wrapper":"line"}`).attr("x",o=>o.x).attr("y",o=>o.y).attr("width",o=>o.width).attr("height",o=>o.height)}else if(n.type===Zt.ZOOM){const{iconData:a,color:o}=_(Vt,"zoom"),l=t.attr("role",dt.IMG).attr("aria-label","zoom").selectAll("g.icon").data(a).enter();l.append("g").attr("x",c=>c.x).attr("y",c=>c.y).attr("width",c=>c.width).attr("height",c=>c.height).append("polygon").attr("points","7.7 4.82 5.78 4.82 5.78 2.89 4.82 2.89 4.82 4.82 2.89 4.82 2.89 5.78 4.82 5.78 4.82 7.7 5.78 7.7 5.78 5.78 7.7 5.78 7.7 4.82").attr("fill",()=>n.color?n.color:o),l.append("path").attr("d","M9.36,8.67A5.22,5.22,0,0,0,10.59,5.3,5.3,5.3,0,1,0,5.3,10.59,5.22,5.22,0,0,0,8.67,9.36L12.32,13l.68-.68Zm-4.06,1A4.34,4.34,0,1,1,9.63,5.3,4.33,4.33,0,0,1,5.3,9.63Z").attr("fill",()=>n.color?n.color:o)}}truncateLegendText(){const t=this.getComponentContainer(),n=_(this.getOptions(),"legend","truncation"),r=_(n,"type"),i=_(n,"threshold"),s=_(n,"numCharacter"),a=t.selectAll("div.legend-item p");a.attr("id",function(){return(this.parentNode.querySelector("div.checkbox")||this.parentNode).getAttribute("aria-labelledby")}),r!==Ve.NONE?a.html(function(o){return o.name.length>i?qi(o.name,r,s):o.name}):a.html(o=>o.name)}addEventListeners(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=_(r,"legend"),s=_(i,"truncation");n.selectAll("div.legend-item").on("mouseover",function(a){t.services.events.dispatchEvent(A.Legend.ITEM_HOVER,{hoveredElement:N(this)});const o=N(this);o.select("div.checkbox").classed("hovered",!0);const l=o.datum();l.name.length>s.threshold&&s.type!==Ve.NONE&&t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:a,hoveredElement:o,content:l.name})}).on("mousemove",function(a){N(this).datum().name.length>s.threshold&&s.type!==Ve.NONE&&t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:a})}).on("click",function(){t.services.events.dispatchEvent(A.Legend.ITEM_CLICK,{clickedElement:N(this)});const a=N(this).datum();t.model.toggleDataLabel(a.name)}).on("mouseout",function(){const a=N(this);a.select("div.checkbox").classed("hovered",!1),a.datum().name.length>s.threshold&&s.type!==Ve.NONE&&t.services.events.dispatchEvent(A.Tooltip.HIDE),t.services.events.dispatchEvent(A.Legend.ITEM_MOUSEOUT,{hoveredElement:a})}),n.selectAll("div.legend-item div.checkbox").on("keyup",function(a){a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(A.Legend.ITEM_HOVER,{hoveredElement:N(this)})}),n.selectAll("div.legend-item div.checkbox").on("keydown",function(a,o){a.key&&a.key===" "?(a.preventDefault(),t.model.toggleDataLabel(o.name)):a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(A.Legend.ITEM_MOUSEOUT,{hoveredElement:N(this)})}),n.selectAll("g.additional-item").on("mouseover",function(a){const o=N(this),l=o.datum();l.name.length>s.threshold&&t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:a,hoveredElement:o,content:l.name})})}}class vm extends gt{constructor(t,n,r){super(t,n,r),this.type="chart-clip",this.renderType=nt.SVG,this.chartClipId="chart-clip-id-"+Math.floor(Math.random()*99999999999),this.init()}init(){this.model.set({chartClipId:this.chartClipId},{skipUpdate:!0})}render(t=!0){this.createClipPath()}createClipPath(){const t=this.parent,{cartesianScales:n}=this.services;if(!n)throw new Error("Service cartesianScales was undefined");const r=n.getMainXScale(),i=n.getMainYScale(),[s,a]=r.range(),[o,l]=i.range();if(!t)throw new Error("svg is undefined");this.chartClipPath=P.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const c=P.appendOrSelect(this.chartClipPath,`rect.${this.type}`);a-s>0&&c.attr("x",s).attr("y",l).attr("width",a-s).attr("height",o-l),this.chartClipPath.merge(c).lower()}}class Wk extends vm{constructor(){super(...arguments),this.type="canvas-chart-clip",this.chartClipId="canvas-chart-clip-id-"+Math.floor(Math.random()*99999999999)}createClipPath(){const t=this.parent,{width:n,height:r}=P.getSVGElementSize(this.parent,{useAttrs:!0});this.chartClipPath=P.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const i=P.appendOrSelect(this.chartClipPath,`rect.${this.type}`);i.attr("x",0).attr("y",0).attr("width",n).attr("height",r),this.chartClipPath.merge(i).lower()}}var Gr,ne;(function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top",e.BOTTOM="bottom"})(ne||(ne={}));var ym=(Gr={},Gr[ne.LEFT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left-t.offsetWidth)}},Gr[ne.RIGHT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left+n.width)}},Gr[ne.TOP]=function(e,t,n){return{top:Math.round(e.top-t.offsetHeight),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Gr[ne.BOTTOM]=function(e,t,n){return{top:Math.round(e.top+n.height),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Gr),bm=typeof window<"u"?window:{innerHeight:0,scrollY:0,innerWidth:0,scrollX:0},Ja=function(){function e(t){t===void 0&&(t={}),this.positions=ym,this.positions=Object.assign({},ym,t)}return e.prototype.getRelativeOffset=function(t){for(var n={left:t.offsetLeft,top:t.offsetTop};t.offsetParent&&getComputedStyle(t.offsetParent).position==="static";)n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;return n},e.prototype.getAbsoluteOffset=function(t){for(var n=t,r={top:0,left:0};n.offsetParent;){var i=getComputedStyle(n.offsetParent);i.position==="static"&&i.marginLeft&&i.marginTop&&(parseInt(i.marginTop,10)&&(r.top+=parseInt(i.marginTop,10)),parseInt(i.marginLeft,10)&&(r.left+=parseInt(i.marginLeft,10))),n=n.offsetParent}var s=t.getBoundingClientRect(),a=document.body.getBoundingClientRect();return{top:s.top-a.top+r.top,left:s.left-a.left+r.left}},e.prototype.findRelative=function(t,n,r){var i=this.getRelativeOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(i,s,n,r)},e.prototype.findAbsolute=function(t,n,r){var i=this.getAbsoluteOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(i,s,n,r)},e.prototype.findPosition=function(t,n,r,i){i===void 0&&(i=this.getAbsoluteOffset.bind(this));var s=i(t),a=t.getBoundingClientRect();return this.calculatePosition(s,a,n,r)},e.prototype.findPositionAt=function(t,n,r){return this.calculatePosition(t,{top:0,left:0,height:0,width:0},n,r)},e.prototype.getPlacementBox=function(t,n){var r=t.offsetHeight+n.top,i=t.offsetWidth+n.left;return{top:n.top,bottom:r,left:n.left,right:i}},e.prototype.addOffset=function(t,n,r){return n===void 0&&(n=0),r===void 0&&(r=0),Object.assign({},t,{top:t.top+n,left:t.left+r})},e.prototype.setElement=function(t,n){t.style.top=n.top+"px",t.style.left=n.left+"px"},e.prototype.findBestPlacement=function(t,n,r,i,s){var a=this;i===void 0&&(i=this.defaultContainerFunction.bind(this)),s===void 0&&(s=this.findPosition.bind(this));var o=r.map(function(l){var c=s(t,n,l),u=a.getPlacementBox(n,c),h=0,d=0,f=i();u.top<f.top?h=f.top-u.top:u.bottom>f.height&&(h=u.bottom-f.height),u.left<f.left?d=f.left-u.left:u.right>f.width&&(d=u.right-f.width),h&&!d?d=1:d&&!h&&(h=1);var p=n.offsetHeight*n.offsetWidth,m=h*d,g=p-m,v=g/p;return{placement:l,weight:v}});return o.sort(function(l,c){return c.weight-l.weight}),o[0].placement},e.prototype.findBestPlacementAt=function(t,n,r,i){var s=this;i===void 0&&(i=this.defaultContainerFunction.bind(this));var a=function(o,l,c){return s.findPositionAt(t,l,c)};return this.findBestPlacement(null,n,r,i,a)},e.prototype.defaultContainerFunction=function(){return{top:0,left:0,height:bm.innerHeight,width:bm.innerWidth}},e.prototype.calculatePosition=function(t,n,r,i){return this.positions[i]?this.positions[i](t,r,n):(console.error("No function found for placement, defaulting to 0,0"),{left:0,top:0})},e}();new Ja;class Vc extends gt{constructor(t,n,r){super(t,n,r),this.type="tooltip",this.renderType=nt.HTML,this.isEventListenerAdded=!1,this.positionService=new Ja,this.handleShowTooltip=i=>{const s=i.detail.data||i.detail.items;let a;const o=this.formatItems(this.getItems(i));i.detail.content?a=`<div class="title-tooltip"><p>${i.detail.content}</p></div>`:a=this.getTooltipHTML(o);const l=P.appendOrSelect(this.tooltip,"div.content-box");if(_(this.getOptions(),"tooltip","customHTML"))if(i.detail.content){const c=`<div class="title-tooltip"><p>${i.detail.content}</p></div>`;l.html(c)}else l.html(this.model.getOptions().tooltip.customHTML(s,a));else l.html(a);l.selectAll(".datapoint-tooltip").each(function(c,u){const h=o[u];o[u]&&o[u].color&&N(this).select(".tooltip-color").attr("class","tooltip-color").style("background-color",h.color)}),this.positionTooltip(i),this.tooltip.classed("hidden",!1).attr("aria-hidden",!1)},this.handleHideTooltip=()=>{this.tooltip.classed("hidden",!0).attr("aria-hidden",!0)},this.init()}addTooltipEventListener(){this.services.events.addEventListener(A.Tooltip.MOVE,t=>{this.tooltip.classed("hidden")===!1&&this.positionTooltip(t)}),this.services.events.addEventListener(A.Tooltip.SHOW,this.handleShowTooltip),this.services.events.addEventListener(A.Tooltip.HIDE,this.handleHideTooltip),this.services.events.addEventListener(A.Chart.MOUSEOUT,this.handleHideTooltip)}removeTooltipEventListener(){this.services.events.removeEventListener(A.Tooltip.MOVE,null),this.services.events.removeEventListener(A.Tooltip.SHOW,this.handleShowTooltip),this.services.events.removeEventListener(A.Tooltip.HIDE,this.handleHideTooltip),this.services.events.removeEventListener(A.Chart.MOUSEOUT,this.handleHideTooltip)}getItems(t){return t.detail.items?t.detail.items:[]}formatItems(t){const n=this.getOptions(),r=_(n,"tooltip","truncation","type"),i=_(n,"tooltip","truncation","threshold"),s=_(n,"tooltip","truncation","numCharacter");return r!==Ve.NONE?t.map(a=>{const o=a.labelIcon?12:0;return a.value=a.value?this.valueFormatter(a.value,a.label):a.value,a.label&&a.label.length+o>i&&(a.label=qi(a.label,r,s)),a.value&&a.value.length>i&&(a.value=qi(a.value,r,s)),a}):t}getTooltipHTML(t){return'<ul class="multi-tooltip">'+t.map(n=>`<li>
|
|
62
|
+
</div>`}render(t=!1){const n=this.model.getOptions();if(!this.isEventListenerAdded){const r=N(this.services.domUtils.getHolder()),i=_(n,"style","prefix");this.modal=P.appendOrSelect(r,`div.${ge}--${i}--modal`),this.addEventListeners(),this.isEventListenerAdded=!0,this.modal.attr("data-modal",!0).attr("class","cds--modal cds--modal").attr("role","dialog").attr("aria-modal",!0).attr("aria-labelledby","modal-title").attr("aria-describedby","modal-description").attr("tabindex",-1)}}destroy(){this.removeEventListeners(),this.isEventListenerAdded=!1}}class ts extends gt{constructor(){super(...arguments),this.type="title",this.renderType=nt.HTML}render(t=!1){const n=this.getComponentContainer(),r=_(this.getOptions(),"title"),i=n.selectAll("p.title").data([r]);if(i.enter().append("p").classed("title",!0).attr("role","heading").attr("aria-level",2).merge(i).html(s=>s),i.node()&&i.node().offsetWidth<i.node().scrollWidth){const s=this;i.on("mouseover",function(a){s.services.events.dispatchEvent(A.Tooltip.SHOW,{event:a,hoveredElement:i,content:i.text()})}).on("mousemove",function(a){s.services.events.dispatchEvent(A.Tooltip.MOVE,{event:a})}).on("mouseout",function(){s.services.events.dispatchEvent(A.Tooltip.HIDE)})}i.exit().remove()}truncateTitle(t,n){if(n<=0)return;const r=t.text();if(t.node().getComputedTextLength()>n){t.append("tspan").text("...");const i=P.appendOrSelect(t,"tspan").node().getComputedTextLength(),s=t.text(),a=this.getSubstringIndex(t.node(),0,s.length-1,n-i);t.html(s.substring(0,a-1)).append("tspan").text("...");const o=this;t.on("mouseover",function(l){o.services.events.dispatchEvent(A.Tooltip.SHOW,{event:l,hoveredElement:t,content:r})}).on("mousemove",function(l){o.services.events.dispatchEvent(A.Tooltip.MOVE,{event:l})}).on("mouseout",function(){o.services.events.dispatchEvent(A.Tooltip.HIDE)})}}getMaxTitleWidth(){return P.getSVGElementSize(this.parent.node(),{useAttrs:!0}).width}getSubstringIndex(t,n,r,i){const s=Math.floor((r+n)/2);return t.getSubStringLength(0,s)>i?this.getSubstringIndex(t,n,s,i):t.getSubStringLength(0,s)<i?t.getSubStringLength(0,s+1)>i?s:this.getSubstringIndex(t,s,r,i):s}}class Bc extends gt{constructor(){super(...arguments),this.type="legend",this.renderType=nt.HTML}render(t=!1){const n=this.getOptions(),r=_(n,"legend"),i=_(r,"alignment"),s=_(n,"legend","orientation");let a=this.model.getDataGroups();const{DISABLED:o}=Vt.items.status,l=a.some(b=>b.status===o),c=_(r,"order"),u=this.getComponentContainer().classed("center-aligned",i===Yt.CENTER).classed("right-aligned",i===Yt.RIGHT).classed(s,!0).classed("has-deactivated-items",l).attr("role",dt.GROUP).attr("aria-label","Data groups").attr("data-name","legend-items");c&&(a=this.sortDataGroups(a,c));const h=u.selectAll("div.legend-item").data(a,b=>b.name),d=h.enter().append("div").attr("class","legend-item");d.merge(u.selectAll("div.legend-item")).classed("active",function(b){return b.status===Vt.items.status.ACTIVE});const f=_(this.getOptions(),"legend","clickable");u.classed("clickable",f&&a.length>1);const p=Vt.checkbox.radius,m=d.append("div").classed("checkbox",!0),g=m.merge(h.select("div.checkbox")).attr("role",dt.CHECKBOX).attr("tabindex",f?0:-1).attr("aria-labelledby",(b,w)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${w}-title`)).attr("aria-checked",({status:b})=>b===Vt.items.status.ACTIVE).attr("width",p*2).attr("height",p*2).attr("class",b=>this.model.getColorClassName({classNameTypes:[st.BACKGROUND],dataGroupName:b.name,originalClassName:"checkbox"})).style("background",b=>b.status===Vt.items.status.ACTIVE?this.model.getFillColor(b.name)||this.model.getStrokeColor(b.name):null).classed("active",function(b){return b.status===Vt.items.status.ACTIVE});m.append("svg").attr("focusable",!1).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").attr("width","11").attr("height","11").attr("viewBox","0 0 31 28").attr("aria-hidden",!0).style("will-change","transform").append("path").attr("d","M13 21.2l-7.1-7.1-1.4 1.4 7.1 7.1L13 24 27.1 9.9l-1.4-1.5z"),d.append("p").merge(h.select("p"));const v=_(n,"legend","additionalItems");if(v&&a.length){const b=this,w=u.selectAll("div.additional-item").data(v);w.exit().remove();const O=w.enter().append("div").merge(w).classed("legend-item",!0).classed("additional",!0).attr("aria-labelledby",(S,$)=>this.services.domUtils.generateElementIDString(`legend-datagroup-${g.size()+$}-title`));O.selectAll("*").remove();let E,T=1;O.append("svg").classed("icon",!0).each(function(S){const $=N(this);!E||E!=S.type?(E=S.type,T=1):T++,b.addAdditionalItem($,S,T)}),O.append("p").merge(O.select("p")),this.truncateLegendText()}h.exit().on("mouseover",null).on("click",null).on("mouseout",null).remove(),f&&d.size()>1&&this.addEventListeners()}sortDataGroups(t,n){if(t.sort((r,i)=>n.indexOf(r.name)-n.indexOf(i.name)),n.length<t.length){const r=t.length-n.length;return t.slice(r).concat(t.slice(0,r))}return t}addAdditionalItem(t,n,r){const{width:i,height:s}=Vt.area;if(n.type===Zt.RADIUS?t.style("width",`${s}px`).style("height",`${s}px`):t.style("width",`${i}px`).style("height",`${s}px`),n.type===Zt.RADIUS){const{iconData:a,fill:o,stroke:l}=Vt.radius;t.attr("fill","none").selectAll("circle").data(a).enter().append("circle").classed("radius",!0).attr("role",dt.IMG).attr("aria-label","radius").attr("cx",c=>c.cx).attr("cy",c=>c.cy).attr("r",c=>c.r).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:l)}else if(n.type===Zt.LINE){const a=Vt.line;t.select("line.line").empty()&&t.append("line").classed(`line-${r}`,!0).attr("role",dt.IMG).attr("aria-label","line").attr("x1",0).attr("y1",a.yPosition).attr("x2",i).attr("y2",a.yPosition).style("stroke",n.stroke?n.stroke:a.stroke).style("stroke-width",a.strokeWidth)}else if(n.type===Zt.AREA)t.select("rect.area").empty()&&t.append("rect").classed(`area-${r}`,!0).attr("role",dt.IMG).attr("aria-label","area").attr("width",i).attr("height",s).style("fill",r>3&&!n.fill?Vt.area.fill:n.fill).style("stroke",n.stroke);else if(n.type===Zt.SIZE){const{iconData:a,fill:o,stroke:l}=Vt.size;t.attr("fill","none").attr("role",dt.IMG).attr("aria-label","size").selectAll("rect").data(a).enter().append("rect").classed("size",!0).attr("width",c=>c.width).attr("height",c=>c.height).attr("y",()=>0).style("fill",n.fill?n.fill:o).style("stroke",n.stroke?n.stroke:l).style("stroke-width",1)}else if(n.type===Zt.QUARTILE){const{iconData:a}=Vt.quartile;t.selectAll("rect").attr("role",dt.IMG).attr("aria-label","quartile").data(a).enter().append("rect").attr("class",(o,l)=>`quartile-${l===0?"wrapper":"line"}`).attr("x",o=>o.x).attr("y",o=>o.y).attr("width",o=>o.width).attr("height",o=>o.height)}else if(n.type===Zt.ZOOM){const{iconData:a,color:o}=_(Vt,"zoom"),l=t.attr("role",dt.IMG).attr("aria-label","zoom").selectAll("g.icon").data(a).enter();l.append("g").attr("x",c=>c.x).attr("y",c=>c.y).attr("width",c=>c.width).attr("height",c=>c.height).append("polygon").attr("points","7.7 4.82 5.78 4.82 5.78 2.89 4.82 2.89 4.82 4.82 2.89 4.82 2.89 5.78 4.82 5.78 4.82 7.7 5.78 7.7 5.78 5.78 7.7 5.78 7.7 4.82").attr("fill",()=>n.color?n.color:o),l.append("path").attr("d","M9.36,8.67A5.22,5.22,0,0,0,10.59,5.3,5.3,5.3,0,1,0,5.3,10.59,5.22,5.22,0,0,0,8.67,9.36L12.32,13l.68-.68Zm-4.06,1A4.34,4.34,0,1,1,9.63,5.3,4.33,4.33,0,0,1,5.3,9.63Z").attr("fill",()=>n.color?n.color:o)}}truncateLegendText(){const t=this.getComponentContainer(),n=_(this.getOptions(),"legend","truncation"),r=_(n,"type"),i=_(n,"threshold"),s=_(n,"numCharacter"),a=t.selectAll("div.legend-item p");a.attr("id",function(){return(this.parentNode.querySelector("div.checkbox")||this.parentNode).getAttribute("aria-labelledby")}),r!==Ve.NONE?a.html(function(o){return o.name.length>i?qi(o.name,r,s):o.name}):a.html(o=>o.name)}addEventListeners(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=_(r,"legend"),s=_(i,"truncation");n.selectAll("div.legend-item").on("mouseover",function(a){t.services.events.dispatchEvent(A.Legend.ITEM_HOVER,{hoveredElement:N(this)});const o=N(this);o.select("div.checkbox").classed("hovered",!0);const l=o.datum();l.name.length>s.threshold&&s.type!==Ve.NONE&&t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:a,hoveredElement:o,content:l.name})}).on("mousemove",function(a){N(this).datum().name.length>s.threshold&&s.type!==Ve.NONE&&t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:a})}).on("click",function(){t.services.events.dispatchEvent(A.Legend.ITEM_CLICK,{clickedElement:N(this)});const a=N(this).datum();t.model.toggleDataLabel(a.name)}).on("mouseout",function(){const a=N(this);a.select("div.checkbox").classed("hovered",!1),a.datum().name.length>s.threshold&&s.type!==Ve.NONE&&t.services.events.dispatchEvent(A.Tooltip.HIDE),t.services.events.dispatchEvent(A.Legend.ITEM_MOUSEOUT,{hoveredElement:a})}),n.selectAll("div.legend-item div.checkbox").on("keyup",function(a){a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(A.Legend.ITEM_HOVER,{hoveredElement:N(this)})}),n.selectAll("div.legend-item div.checkbox").on("keydown",function(a,o){a.key&&a.key===" "?(a.preventDefault(),t.model.toggleDataLabel(o.name)):a.key&&a.key==="Tab"&&t.services.events.dispatchEvent(A.Legend.ITEM_MOUSEOUT,{hoveredElement:N(this)})}),n.selectAll("g.additional-item").on("mouseover",function(a){const o=N(this),l=o.datum();l.name.length>s.threshold&&t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:a,hoveredElement:o,content:l.name})})}}class vm extends gt{constructor(t,n,r){super(t,n,r),this.type="chart-clip",this.renderType=nt.SVG,this.chartClipId="chart-clip-id-"+Math.floor(Math.random()*99999999999),this.init()}init(){this.model.set({chartClipId:this.chartClipId},{skipUpdate:!0})}render(t=!0){this.createClipPath()}createClipPath(){const t=this.parent,{cartesianScales:n}=this.services;if(!n)throw new Error("Service cartesianScales was undefined");const r=n.getMainXScale(),i=n.getMainYScale(),[s,a]=r.range(),[o,l]=i.range();if(!t)throw new Error("svg is undefined");this.chartClipPath=P.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const c=P.appendOrSelect(this.chartClipPath,`rect.${this.type}`);a-s>0&&c.attr("x",s).attr("y",l).attr("width",a-s).attr("height",o-l),this.chartClipPath.merge(c).lower()}}class Wk extends vm{constructor(){super(...arguments),this.type="canvas-chart-clip",this.chartClipId="canvas-chart-clip-id-"+Math.floor(Math.random()*99999999999)}createClipPath(){const t=this.parent,{width:n,height:r}=P.getSVGElementSize(this.parent,{useAttrs:!0});this.chartClipPath=P.appendOrSelect(t,`clipPath.${this.type}`).attr("id",this.chartClipId);const i=P.appendOrSelect(this.chartClipPath,`rect.${this.type}`);i.attr("x",0).attr("y",0).attr("width",n).attr("height",r),this.chartClipPath.merge(i).lower()}}var Gr,ne;(function(e){e.LEFT="left",e.RIGHT="right",e.TOP="top",e.BOTTOM="bottom"})(ne||(ne={}));var ym=(Gr={},Gr[ne.LEFT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left-t.offsetWidth)}},Gr[ne.RIGHT]=function(e,t,n){return{top:e.top-Math.round(t.offsetHeight/2)+Math.round(n.height/2),left:Math.round(e.left+n.width)}},Gr[ne.TOP]=function(e,t,n){return{top:Math.round(e.top-t.offsetHeight),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Gr[ne.BOTTOM]=function(e,t,n){return{top:Math.round(e.top+n.height),left:e.left-Math.round(t.offsetWidth/2)+Math.round(n.width/2)}},Gr),bm=typeof window<"u"?window:{innerHeight:0,scrollY:0,innerWidth:0,scrollX:0},Ja=function(){function e(t){t===void 0&&(t={}),this.positions=ym,this.positions=Object.assign({},ym,t)}return e.prototype.getRelativeOffset=function(t){for(var n={left:t.offsetLeft,top:t.offsetTop};t.offsetParent&&getComputedStyle(t.offsetParent).position==="static";)n.left+=t.offsetLeft,n.top+=t.offsetTop,t=t.offsetParent;return n},e.prototype.getAbsoluteOffset=function(t){for(var n=t,r={top:0,left:0};n.offsetParent;){var i=getComputedStyle(n.offsetParent);i.position==="static"&&i.marginLeft&&i.marginTop&&(parseInt(i.marginTop,10)&&(r.top+=parseInt(i.marginTop,10)),parseInt(i.marginLeft,10)&&(r.left+=parseInt(i.marginLeft,10))),n=n.offsetParent}var s=t.getBoundingClientRect(),a=document.body.getBoundingClientRect();return{top:s.top-a.top+r.top,left:s.left-a.left+r.left}},e.prototype.findRelative=function(t,n,r){var i=this.getRelativeOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(i,s,n,r)},e.prototype.findAbsolute=function(t,n,r){var i=this.getAbsoluteOffset(t),s=t.getBoundingClientRect();return this.calculatePosition(i,s,n,r)},e.prototype.findPosition=function(t,n,r,i){i===void 0&&(i=this.getAbsoluteOffset.bind(this));var s=i(t),a=t.getBoundingClientRect();return this.calculatePosition(s,a,n,r)},e.prototype.findPositionAt=function(t,n,r){return this.calculatePosition(t,{top:0,left:0,height:0,width:0},n,r)},e.prototype.getPlacementBox=function(t,n){var r=t.offsetHeight+n.top,i=t.offsetWidth+n.left;return{top:n.top,bottom:r,left:n.left,right:i}},e.prototype.addOffset=function(t,n,r){return n===void 0&&(n=0),r===void 0&&(r=0),Object.assign({},t,{top:t.top+n,left:t.left+r})},e.prototype.setElement=function(t,n){t.style.top=n.top+"px",t.style.left=n.left+"px"},e.prototype.findBestPlacement=function(t,n,r,i,s){var a=this;i===void 0&&(i=this.defaultContainerFunction.bind(this)),s===void 0&&(s=this.findPosition.bind(this));var o=r.map(function(l){var c=s(t,n,l),u=a.getPlacementBox(n,c),h=0,d=0,f=i();u.top<f.top?h=f.top-u.top:u.bottom>f.height&&(h=u.bottom-f.height),u.left<f.left?d=f.left-u.left:u.right>f.width&&(d=u.right-f.width),h&&!d?d=1:d&&!h&&(h=1);var p=n.offsetHeight*n.offsetWidth,m=h*d,g=p-m,v=g/p;return{placement:l,weight:v}});return o.sort(function(l,c){return c.weight-l.weight}),o[0].placement},e.prototype.findBestPlacementAt=function(t,n,r,i){var s=this;i===void 0&&(i=this.defaultContainerFunction.bind(this));var a=function(o,l,c){return s.findPositionAt(t,l,c)};return this.findBestPlacement(null,n,r,i,a)},e.prototype.defaultContainerFunction=function(){return{top:0,left:0,height:bm.innerHeight,width:bm.innerWidth}},e.prototype.calculatePosition=function(t,n,r,i){return this.positions[i]?this.positions[i](t,r,n):(console.error("No function found for placement, defaulting to 0,0"),{left:0,top:0})},e}();new Ja;class Vc extends gt{constructor(t,n,r){super(t,n,r),this.type="tooltip",this.renderType=nt.HTML,this.isEventListenerAdded=!1,this.positionService=new Ja,this.handleShowTooltip=i=>{const s=i.detail.data||i.detail.items;let a;const o=this.formatItems(this.getItems(i));i.detail.content?a=`<div class="title-tooltip"><p>${i.detail.content}</p></div>`:a=this.getTooltipHTML(o);const l=P.appendOrSelect(this.tooltip,"div.content-box");if(_(this.getOptions(),"tooltip","customHTML"))if(i.detail.content){const c=`<div class="title-tooltip"><p>${i.detail.content}</p></div>`;l.html(c)}else l.html(this.model.getOptions().tooltip.customHTML(s,a));else l.html(a);l.selectAll(".datapoint-tooltip").each(function(c,u){const h=o[u];o[u]&&o[u].color&&N(this).select(".tooltip-color").attr("class","tooltip-color").style("background-color",h.color)}),this.positionTooltip(i),this.tooltip.classed("hidden",!1).attr("aria-hidden",!1)},this.handleHideTooltip=()=>{this.tooltip.classed("hidden",!0).attr("aria-hidden",!0)},this.init()}addTooltipEventListener(){this.services.events.addEventListener(A.Tooltip.MOVE,t=>{this.tooltip.classed("hidden")===!1&&this.positionTooltip(t)}),this.services.events.addEventListener(A.Tooltip.SHOW,this.handleShowTooltip),this.services.events.addEventListener(A.Tooltip.HIDE,this.handleHideTooltip),this.services.events.addEventListener(A.Chart.MOUSEOUT,this.handleHideTooltip)}removeTooltipEventListener(){this.services.events.removeEventListener(A.Tooltip.MOVE,null),this.services.events.removeEventListener(A.Tooltip.SHOW,this.handleShowTooltip),this.services.events.removeEventListener(A.Tooltip.HIDE,this.handleHideTooltip),this.services.events.removeEventListener(A.Chart.MOUSEOUT,this.handleHideTooltip)}getItems(t){return t.detail.items?t.detail.items:[]}formatItems(t){const n=this.getOptions(),r=_(n,"tooltip","truncation","type"),i=_(n,"tooltip","truncation","threshold"),s=_(n,"tooltip","truncation","numCharacter");return r!==Ve.NONE?t.map(a=>{const o=a.labelIcon?12:0;return a.value=a.value?this.valueFormatter(a.value,a.label):a.value,a.label&&a.label.length+o>i&&(a.label=qi(a.label,r,s)),a.value&&a.value.length>i&&(a.value=qi(a.value,r,s)),a}):t}getTooltipHTML(t){return'<ul class="multi-tooltip">'+t.map(n=>`<li>
|
|
63
63
|
<div class="datapoint-tooltip${n.bold?" bold":""}">
|
|
64
64
|
${n.class||n.color?`<div class="tooltip-color ${n.class}"></div>`:""}
|
|
65
65
|
<div class="label">
|
|
@@ -68,19 +68,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
68
68
|
</div>
|
|
69
69
|
${n.value===void 0||n.value===null?"":`<p class="value"/>${n.value}</p>`}
|
|
70
70
|
</div>
|
|
71
|
-
</li>`).join("")+"</ul>"}valueFormatter(t,n){const r=this.getOptions(),i=_(r,"tooltip","valueFormatter");if(i)return i(t,n);if(typeof t.getTime=="function")return Lr(t,"MMM d, yyyy");try{if(typeof t=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))return Lr(Date.parse(t),"MMM d, yyyy")}catch{}return t.toLocaleString()}render(t=!0){const n=this.getOptions(),r=_(n,"tooltip","enabled");if(r){const i=N(this.services.domUtils.getHolder()),s=_(n,"style","prefix");this.tooltip=P.appendOrSelect(i,`div.${ge}--${s}--tooltip`),this.tooltip.style("max-width",null).attr("role","tooltip"),this.isEventListenerAdded||(this.addTooltipEventListener(),this.isEventListenerAdded=!0),this.tooltip.classed("hidden",!0)}else!r&&this.isEventListenerAdded&&(this.removeTooltipEventListener(),this.isEventListenerAdded=!1)}positionTooltip(t){const n=this.services.domUtils.getHolder(),r=this.tooltip.node(),i=this.getOptions(),s=_(i,"zoomBar","top","enabled");let a=_(t,"detail","mousePosition");if(!a)a=Un(_(t,"detail","event"),n);else{const d=_(i,"zoomBar","top","type"),f=Ee.height[d];s&&(a[1]+=f+Ee.spacerHeight)}const o=n.offsetWidth,l=n.offsetHeight;let c;a[0]/o>.9?c=ne.LEFT:a[0]/o<.1?c=ne.RIGHT:c=this.positionService.findBestPlacementAt({left:a[0],top:a[1]},r,[ne.RIGHT,ne.LEFT,ne.TOP,ne.BOTTOM],()=>({top:void 0,left:void 0,width:o,height:l}));let{horizontalOffset:u}=eO;c===ne.LEFT&&(u*=-1);const h=this.positionService.findPositionAt({left:a[0]+u,top:a[1]},r,c);this.positionService.setElement(r,h)}}const to=class extends gt{constructor(){super(...arguments),this.type="grid-brush",this.renderType=nt.SVG,this.selectionSelector="rect.selection",this.frontSelectionSelector="rect.frontSelection"}render(t=!0){const n=this.parent,r=this.getComponentContainer();if(!n)throw new Error("SVG was not defined");const i=P.appendOrSelect(n,"svg.chart-grid-backdrop"),s=P.appendOrSelect(i,`g.${this.type}`),a=P.appendOrSelect(s,this.selectionSelector),{width:o,height:l}=P.getSVGElementSize(i,{useAttrs:!0}),{cartesianScales:c}=this.services,u=c.getMainXScaleType(),h=c.getMainXScale(),[d]=h.range();r.attr("transform",`translate(${d},0)`);const f=P.appendOrSelect(r,this.frontSelectionSelector);if(h&&u===tt.TIME){let p=this.model.get("zoomDomain");p===void 0&&(p=this.services.zoom.getDefaultZoomBarDomain(),p&&this.model.set({zoomDomain:p},{animate:!1}));const m=E=>{const T=E[1]-E[0];let S="0,"+T.toString();const $=Math.floor(l/to.DASH_LENGTH),k=$*to.DASH_LENGTH;for(let L=0;L<$;L++)S+=","+to.DASH_LENGTH;S+=","+(l-k),$%2===1&&(S+=",0"),S+=","+T.toString(),S+=","+l.toString(),f.attr("stroke-dasharray",S)},g=E=>{const T=E.selection;T===null||T[0]===T[1]||(f.attr("x",parseFloat(a.attr("x"))+parseFloat(i.attr("x"))).attr("y",a.attr("y")).attr("width",a.attr("width")).attr("height",a.attr("height")).style("cursor","pointer").style("display",null),m(T))},v=(E,T)=>{const S=Fd().range([0,o]).domain(p);let $=[S.invert(E),S.invert(T)];$[0].valueOf()===$[1].valueOf()&&($=this.services.zoom.getDefaultZoomBarDomain()),(p[0].valueOf()!==$[0].valueOf()||p[1].valueOf()!==$[1].valueOf())&&this.services.zoom.handleDomainChange($)};let b;const w=E=>{const T=E.selection;T!==null&&(v(T[0],T[1]),s.call(b.move,null),f.style("display","none"))};l!=0&&o!=0&&(b=ih().extent([[0,0],[o-1,l]]).on("start brush end",g).on("end.brushed",w),s.call(b));const O=this.services.zoom.getZoomRatio();i.on("click",function(E){if(E.shiftKey){const T=this.services.domUtils.getHolder(),S=Un(s.node(),T)[0];let $=S-o*O/2;$<0&&($=0);let k=S+o*O/2;k>o&&(k=o),v($,k)}})}}};let xm=to;xm.DASH_LENGTH=4;class qk extends gt{constructor(){super(...arguments),this.type="zoom-bar",this.renderType=nt.SVG,this.MIN_SELECTION_DIFF=9e-10,this.brushSelector="g.zoom-bar-brush",this.clipId="zoomBarClip-"+Math.floor(Math.random()*99999999999),this.brush=ih(),this.highlightStrokeWidth=1}init(){this.services.events.addEventListener(A.ZoomBar.UPDATE,this.render.bind(this));const t=_(this.getOptions(),"zoomBar",H.TOP,"data");this.model.setZoomBarData(t)}render(t=!0){const n=this.getComponentContainer(),r=this.services.zoom.isZoomBarLoading(H.TOP),i=this.services.zoom.isZoomBarLocked(H.TOP),s=_(this.getOptions(),"zoomBar",H.TOP,"type"),a=_(this.getOptions(),"axes",H.BOTTOM,"highlights"),o=Ee.height[s],{width:l}=P.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 h=P.appendOrSelect(n,"svg.zoom-container").attr("width","100%").attr("height",o).attr("opacity",1);if(P.appendOrSelect(n,"rect.zoom-spacer").attr("x",0).attr("y",o).attr("width","100%").attr("height",Ee.spacerHeight).attr("opacity",1).attr("fill","none"),s===Ke.GRAPH_VIEW?P.appendOrSelect(h,"rect.zoom-bg").attr("x",c).attr("y",0).attr("width",l-c).attr("height","100%").classed("zoom-bg-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null):s===Ke.SLIDER_VIEW&&P.appendOrSelect(h,"rect.zoom-slider-bg").attr("x",c).attr("y",o/2-1).attr("width",l-c).attr("height",2).classed("zoom-slider-bg-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null),r){this.renderSkeleton(h,c,l);return}const{cartesianScales:d}=this.services,f=d.getMainXScale(),p=d.getMainYScale(),m=d.getMainXScaleType();if(f&&m===tt.TIME){let g=this.services.zoom.getZoomBarData();if(ze(g)||g.length===1)return;this.xScale=f.copy(),this.yScale=p.copy();const v=this.services.zoom.getDefaultZoomBarDomain(g);g=this.compensateDataForDefaultDomain(g,v);const b=this.model.get("initialZoomDomain"),w=_(this.getOptions(),"zoomBar",H.TOP,"initialZoomDomain");w&&w[0]&&w[1]&&(w[0]=new Date(w[0]),w[1]=new Date(w[1])),w&&!(b&&b[0].valueOf()===w[0].valueOf()&&b[1].valueOf()===w[1].valueOf())?this.model.set({initialZoomDomain:at([],w),zoomDomain:w?at([],w):v},{skipUpdate:!0}):w===null&&b!==null&&this.model.set({initialZoomDomain:null,zoomDomain:at([],v)},{skipUpdate:!0}),this.xScale.range([c,l]).domain(v),this.maxSelectionRange=this.xScale.range(),this.yScale.range([0,o-6]).domain(Re(g,T=>T.value));const O=this.model.get("zoomDomain");if(s===Ke.GRAPH_VIEW&&(this.renderZoomBarArea(h,"path.zoom-graph-area-unselected",g,null),this.updateClipPath(n,this.clipId,0,0,0,0),this.renderZoomBarArea(h,"path.zoom-graph-area",g,this.clipId),this.renderZoomBarBaseline(h,c,l),a)){const T=a.highlightStartMapsTo,S=a.highlightEndMapsTo,$=a.color,k=a.labelMapsTo;a.data.forEach((L,M)=>{P.appendOrSelect(h,`rect.highlight-${M}`).attr("height",o-2*this.highlightStrokeWidth).attr("y",this.highlightStrokeWidth).attr("x",this.xScale(L[T])).attr("width",this.xScale(L[S])-this.xScale(L[T])).style("fill",$&&$.scale[L[k]]?$.scale[L[k]]:null).style("fill-opacity",.1).style("stroke",$&&$.scale[L[k]]?$.scale[L[k]]:null).style("stroke-dasharray","2, 2").attr("stroke-width","1px")})}this.addBrushEventListener(O,c,l);const E=P.appendOrSelect(n,this.brushSelector).call(this.brush);if(O!==void 0)if(O[0].valueOf()===O[1].valueOf())E.call(this.brush.move,this.xScale.range()),this.updateBrushHandle(this.getComponentContainer(),this.xScale.range());else{const T=O.map(S=>this.xScale(S));T[1]-T[0]<this.MIN_SELECTION_DIFF||(E.call(this.brush.move,T),this.updateBrushHandle(this.getComponentContainer(),T))}i&&(this.brush.filter(()=>!1),E.selectAll("rect").attr("cursor","auto"))}}addBrushEventListener(t,n,r){const i=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=_(this.getOptions(),"zoomBar",H.TOP,"type"),a=Ee.height[s];this.brush.extent([[n,0],[r,a]]).on("start brush end",null).on("start brush end",i)}handleBrushedEvent(t,n,r,i){const s=[r.invert(i[0]),r.invert(i[1])];if(this.updateBrushHandle(this.getComponentContainer(),i),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")){(n===void 0||n[0]!==s[0]||n[1]!==s[1])&&this.services.zoom.handleDomainChange(s,{dispatchEvent:!1});let a;t.type==="start"?a=A.ZoomBar.SELECTION_START:t.type==="brush"?a=A.ZoomBar.SELECTION_IN_PROGRESS:t.type==="end"&&(a=A.ZoomBar.SELECTION_END,this.services.events.dispatchEvent(A.ZoomDomain.CHANGE,{newDomain:s})),this.services.events.dispatchEvent(a,{selection:i,newDomain:s})}}updateBrushHandle(t,n){const r=this,i=Ee.handleWidth,s=_(this.getOptions(),"zoomBar",H.TOP,"type"),a=Ee.height[s],o=-i/2,l=Ee.handleBarWidth,c=s===Ke.GRAPH_VIEW?Ee.handleBarHeight:6,u=-l/2,h=(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,r.maxSelectionRange[0]);if(f.type==="e")return Math.min(n[1]+o,r.maxSelectionRange[1]-i)}).attr("y",0).attr("width",i).attr("height",a).attr("cursor","ew-resize").style("display",null);const d=t.select(this.brushSelector).selectAll("rect.handle-bar").data([{type:"w"},{type:"e"}]);d.enter().append("rect").attr("class",function(f){return"handle-bar handle-bar--"+f.type}),d.attr("x",function(f){if(f.type==="w")return Math.max(n[0]+u,r.maxSelectionRange[0]-o+u);if(f.type==="e")return Math.min(n[1]+u,r.maxSelectionRange[1]+o+u)}).attr("y",h).attr("width",l).attr("height",c).attr("cursor","ew-resize"),s===Ke.SLIDER_VIEW&&this.updateSliderSelectedArea(n),this.updateClipPath(t,this.clipId,n[0],0,n[1]-n[0],a)}updateSliderSelectedArea(t){const n=_(this.getOptions(),"zoomBar",H.TOP,"type"),r=Ee.height[n],i=this.getComponentContainer().select("svg.zoom-container");P.appendOrSelect(i,"rect.zoom-slider-selected-area").attr("x",t[0]).attr("y",r/2-1).attr("width",t[1]-t[0]).attr("height",2)}renderZoomBarArea(t,n,r,i){const{cartesianScales:s}=this.services,a=s.getMainXAxisPosition(),o=s.getMainYAxisPosition(),l=s.getMainXScaleType(),c=s.getMainYScaleType(),u=(v,b,w)=>O=>s.getValueFromScale(v,b,w,O),h=u(this.xScale,l,a),d=u(this.yScale,c,o),f=_(this.getOptions(),"zoomBar",H.TOP,"type"),p=Ee.height[f],m=Al().x(v=>h(v)).y0(p).y1(v=>p-d(v)),g=P.appendOrSelect(t,n).datum(r).attr("d",m);i&&g.attr("clip-path",`url(#${i})`)}updateClipPath(t,n,r,i,s,a){const o=P.appendOrSelect(t,"clipPath").attr("id",n);P.appendOrSelect(o,"rect").attr("x",r).attr("y",i).attr("width",s).attr("height",a)}compensateDataForDefaultDomain(t,n){if(!t||t.length<2)return;const r=yn(t),i=this.services.cartesianScales.getDomainIdentifier(),s=this.services.cartesianScales.getRangeIdentifier();if(Number(n[0])<Number(r[0][i])){const a={};a[i]=n[0],a[s]=0,r.unshift(a)}if(Number(n[1])>Number(r[r.length-1][i])){const a={};a[i]=n[1],a[s]=0,r.push(a)}return r}renderZoomBarBaseline(t,n,r,i=!1){const s=_(this.model.getOptions(),"zoomBar",H.TOP,"type"),a=Ee.height[s],o=Mi()([[n,a],[r,a]]);P.appendOrSelect(t,"path.zoom-bg-baseline").attr("d",o).classed("zoom-bg-baseline-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}renderSkeleton(t,n,r){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),P.appendOrSelect(this.getComponentContainer(),this.brushSelector).html(null),_(this.getOptions(),"zoomBar",H.TOP,"type")===Ke.GRAPH_VIEW&&this.renderZoomBarBaseline(t,n,r,!0)}destroy(){this.brush.on("start brush end",null),this.services.events.removeEventListener(A.ZoomBar.UPDATE,this.render.bind(this))}}class Yk extends gt{constructor(t,n){super(t,n),this.type="threshold",this.renderType=nt.SVG,this.positionService=new Ja}render(t=!1){const n=_(this.getOptions(),"axes"),r=[];Object.keys(n).forEach(c=>{if(Object.values(H).includes(c)){const u=n[c];u.thresholds&&u.thresholds.length>0&&r.push({axisPosition:c,thresholds:u.thresholds,correspondingDatasets:u==null?void 0:u.correspondingDatasets,mapsTo:u==null?void 0:u.mapsTo})}});const i=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-thresholds").data(r,c=>c.axisPosition);i.exit().attr("opacity",0).remove();const s=i.enter().append("g").merge(i);s.attr("class",c=>`axis-thresholds ${c.axisPosition}`);const a=s.selectAll("g.threshold-group").data(c=>c.thresholds.map(u=>(u.axisPosition=c.axisPosition,u.datum=this.constructDatumObj(c,u),u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("line").attr("class","threshold-line"),o.append("rect").attr("class","threshold-hoverable-area"),o.merge(a).attr("class","threshold-group");const l=this;s.each(function({axisPosition:c}){const u=l.services.cartesianScales.getScaleByPosition(c),h=l.services.cartesianScales.getScaleTypeByPosition(c);let d=null,f=null;c===H.LEFT||c===H.RIGHT?(f=u,d=l.services.cartesianScales.getMainXScale()):(d=u,f=l.services.cartesianScales.getMainYScale());const p=h===tt.LABELS,[m,g]=d.range(),[v,b]=f.range(),{cartesianScales:w}=l.services,O=w.getOrientation(),E=L=>w.getDomainValue(L),T=L=>w.getRangeValue(L),[S,$]=xn(E,T,O),k=N(this);c===H.TOP||c===H.BOTTOM?(k.selectAll("line.threshold-line").transition().call(L=>l.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("y1",b).attr("y2",v).attr("x1",({datum:L})=>S(L)+(p?u.step()/2:0)).attr("x2",({datum:L})=>S(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),k.selectAll("rect.threshold-hoverable-area").attr("x",0).attr("y",({datum:L})=>-S(L)).attr("width",Math.abs(v-b)).classed("rotate",!0)):(k.selectAll("line.threshold-line").transition().call(L=>l.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("x1",m).attr("x2",g).attr("y1",({datum:L})=>$(L)+(p?u.step()/2:0)).attr("y2",({datum:L})=>$(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),k.selectAll("rect.threshold-hoverable-area").attr("x",m).attr("y",({datum:L})=>$(L)).attr("width",Math.abs(g-m)).classed("rotate",!1))}),this.services.events.addEventListener(A.Threshold.SHOW,c=>{this.setThresholdLabelPosition(c.detail),this.label.classed("hidden",!1)}),this.services.events.addEventListener(A.Threshold.HIDE,()=>{this.label.classed("hidden",!0)}),this.appendThresholdLabel(),this.addEventListeners()}getFormattedValue(t){const{value:n,axisPosition:r}=t,i=this.getOptions();if(this.services.cartesianScales.getScaleTypeByPosition(r)===tt.TIME){const s=[H.LEFT,H.RIGHT].includes(r),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),l=s?o:a,c=_(i,"timeScale"),u=fc(l.ticks(),_(c,"timeInterval"));return dc(n,0,l.ticks(),u,c)}return n.toLocaleString("en")}appendThresholdLabel(){const t=N(this.services.domUtils.getHolder()),n=_(this.getOptions(),"style","prefix");this.label=P.appendOrSelect(t,`div.${ge}--${n}--threshold--label`).classed("hidden",!0)}setThresholdLabelPosition({event:t,datum:n}){const r=this.services.domUtils.getHolder(),i=Un(t,r),s=n.valueFormatter?n.valueFormatter(n.value):this.getFormattedValue(n);this.label.html(`${n.label||"Threshold"}: ${s}`).style("background-color",n.fillColor);const a=this.label.node(),o=this.positionService.findBestPlacementAt({left:i[0],top:i[1]},a,[ne.RIGHT,ne.LEFT,ne.TOP,ne.BOTTOM],()=>({top:void 0,left:void 0,width:r.offsetWidth,height:r.offsetHeight})),l=this.positionService.findPositionAt({left:i[0],top:i[1]},a,o);this.positionService.setElement(a,l)}constructDatumObj(t,n){const r={};return t.correspondingDatasets&&(r.group=_(t,"correspondingDatasets",0)),r[t.mapsTo]=n.value,r}addEventListeners(){const t=this;this.getComponentContainer({withinChartClip:!0}).selectAll("rect.threshold-hoverable-area").on("mouseover mousemove",function(n){N(this.parentNode).select("line.threshold-line").classed("active",!0),t.services.events.dispatchEvent(A.Threshold.SHOW,{event:n,hoveredElement:N(this),datum:N(this).datum()})}).on("mouseout",function(n){N(this.parentNode).select("line.threshold-line").classed("active",!1),t.services.events.dispatchEvent(A.Threshold.HIDE,{event:n,hoveredElement:N(this),datum:N(this).datum()})})}}class Xk extends gt{constructor(t,n){super(t,n),this.type="highlight",this.renderType=nt.SVG,this.positionService=new Ja,this.highlightStrokeWidth=1}render(t=!1){const n=_(this.getOptions(),"axes"),r=[];Object.keys(n).forEach(c=>{if(Object.values(H).includes(c)){const u=n[c];u.highlights&&u.highlights.data.length>0&&r.push({axisPosition:c,highlightStartMapsTo:u.highlights.highlightStartMapsTo,highlightEndMapsTo:u.highlights.highlightEndMapsTo,labelMapsTo:u.highlights.labelMapsTo,highlight:u.highlights.data,color:u.highlights.color})}});const i=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-highlight").data(r,c=>c.axisPosition);i.exit().attr("opacity",0).remove();const s=i.enter().append("g").merge(i);s.attr("class",c=>`axis-highlight ${c.axisPosition}`);const a=s.selectAll("g.highlight-group").data(c=>c.highlight.map(u=>(u.axisPosition=c.axisPosition,u.highlightStartMapsTo=c.highlightStartMapsTo,u.labelMapsTo=c.labelMapsTo,u.color=c.color,u.highlightEndMapsTo=c.highlightEndMapsTo,u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("rect").attr("class","highlight-bar"),o.append("line").attr("class","highlight-line"),o.merge(a).attr("class","highlight-group");const l=this;s.each(function({axisPosition:c}){const u=l.services.cartesianScales.getMainXScale(),h=l.services.cartesianScales.getMainYScale(),[d,f]=u.range(),[p,m]=h.range(),{cartesianScales:g}=l.services,v=g.getOrientation(),b=S=>g.getDomainValue(S),w=S=>g.getRangeValue(S),[O,E]=xn(b,w,v),T=N(this);c===H.TOP||c===H.BOTTOM?T.selectAll("rect.highlight-bar").transition().call(S=>l.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("y",Math.max(m+l.highlightStrokeWidth,0)).attr("height",Math.max(p-2*l.highlightStrokeWidth,0)).attr("x",({highlightStartMapsTo:S,...$})=>O($[S])).attr("width",({highlightStartMapsTo:S,highlightEndMapsTo:$,...k})=>Math.max(O(k[$])-O(k[S]),0)).style("stroke",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",l.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null):T.selectAll("rect.highlight-bar").transition().call(S=>l.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("x",d).attr("width",Math.max(f-d,0)).attr("y",({highlightEndMapsTo:S,...$})=>E($[S])).attr("height",({highlightStartMapsTo:S,highlightEndMapsTo:$,...k})=>Math.max(E(k[S])-E(k[$]),0)).style("stroke",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",l.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null)})}}class wm extends Vc{getItems(t){if(t.detail.items)return t.detail.items;const n=t.detail.data;if(!n.length||!n[0])return[];const r=this.getOptions(),{cartesianScales:i}=this.services,s=i.getDomainIdentifier(),a=i.isDualAxes(),{groupMapsTo:o}=r.data,l=i.getDomainLabel();let c=i.getRangeLabel();const u=n[0][s];let h;if(n.length===1){const d=n[0],f=i.getRangeIdentifier(d);if(a){const m=i.getRangeAxisPosition({datum:d,groups:[d[o]]});c=i.getScaleLabel(m)}const p=d[f];h=[{label:l,value:u},...Array.isArray(p)&&p.length===2?[{label:"Start",value:p[0]},{label:"End",value:p[1]}]:[{label:c,value:d[f]}]],t.detail.additionalItems&&t.detail.additionalItems.forEach(m=>h.push({label:m.label,value:m.value})),h.push({label:r.tooltip.groupLabel,value:d[o],color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:d[o]})})}else if(n.length>1&&(h=[{label:l,value:u}],h=h.concat(n.map(d=>{const f=d[i.getRangeIdentifier(d)];return{label:d[o],value:Array.isArray(f)&&f.length===2?`${f[0]} - ${f[1]}`:f,color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:d[o]})}}).sort((d,f)=>f.value-d.value)),!a&&_(r,"tooltip","showTotal")===!0)){const d=i.getRangeIdentifier();h.push({label:kt(r,"tooltip.totalLabel")||"Total",value:n.reduce((f,p)=>f+p[d],0),bold:!0})}return h}}class Zk extends gt{constructor(){super(...arguments),this.type="alluvial",this.renderType=nt.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.html("");const{width:r,height:i}=P.getSVGElementSize(n,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=_(this.getOptions(),"color","gradient","enabled");let l=He.minNodePadding;s.alluvial.nodePadding>He.minNodePadding&&(l=s.alluvial.nodePadding);const c=_(s,"alluvial","nodeAlignment");let u=Tg;c===Yt.LEFT?u=Q$:c===Yt.RIGHT&&(u=J$);const h=rL().nodeId(g=>g.name).nodeWidth(He.nodeWidth).nodePadding(l).nodeAlign(u).extent([[2,30],[r-2,i]]);this.graph=h({nodes:s.alluvial.nodes.map(g=>Object.assign({},g)),links:a.map(g=>Object.assign({},g))}),this.graph.nodes=this.graph.nodes.filter(g=>g.value!==0);const d={};this.graph.nodes.forEach(g=>{const v=g.x0;g.category&&(d[v]=g==null?void 0:g.category)}),n.append("g").classed("header-arrows",!0).selectAll("g").data(Object.keys(d)).join("g").attr("transform",g=>`translate(${g}, 0)`).append("text").attr("id",(g,v)=>this.services.domUtils.generateElementIDString(`alluvial-category-${v}`)).style("font-size","14px").text(g=>d[g]?d[g]:"").attr("y",20).attr("x",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-category-${v}`),{width:w}=P.getSVGElementSize(N(`text#${b}`),{useBBox:!0});let O=0;return g+O>=w&&(O=-w+4),O});const f=n.append("g").attr("fill","none").selectAll("g").data(this.graph.links);if(f.exit().remove(),o){const g=_(this.getOptions(),"color","scale");g&&f.enter().append("linearGradient").attr("id",v=>`${this.gradient_id}-link-${v.index}`).attr("gradientUnits","userSpaceOnUse").call(v=>v.append("stop").attr("offset","0%").attr("stop-color",b=>g[b.source.name])).call(v=>v.append("stop").attr("offset","100%").attr("stop-color",b=>g[b.target.name])),f.exit().remove()}f.enter().append("path").classed("link",!0).attr("d",gL()).attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-line-${g.index}`)).attr("class",g=>s.alluvial.monochrome?this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:0,originalClassName:"link"}):this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:g.source.index,originalClassName:"link"})).style("stroke",g=>o?`url(#${this.gradient_id}-link-${g.index})`:this.model.getFillColor(g.source.name)).attr("stroke-width",g=>Math.max(1,g.width)).style("stroke-opacity",He.opacity.default).attr("aria-label",g=>`${g.source.name} → ${g.target.name} (${g.value}${s.alluvial.units?" "+s.alluvial.units:""})`);const p=n.append("g").selectAll("g").data(this.graph.nodes).enter().append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-${g.index}`)).classed("node-group",!0).attr("transform",g=>`translate(${g.x0}, ${g.y0})`);p.append("rect").classed("node",!0).attr("height",g=>g.y1-g.y0).attr("width",g=>g.x1-g.x0).attr("fill","black");const m=p.append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-title-${g.index}`));m.append("text").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-text-${g.index}`)).attr("class","node-text").style("font-size","12px").attr("text-anchor","start").attr("fill","white").attr("x",4).attr("dy",13).text(g=>`${g.name} (${g.value})`).attr("aria-label",g=>`${g.name} (${g.value})`),m.append("rect").classed("node-text-bg",!0).attr("width",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=P.getSVGElementSize(N(`text#${b}`),{useBBox:!0});return w+8}).attr("height",18).attr("stroke-width",2).lower(),m.attr("transform",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=P.getSVGElementSize(N(`text#${b}`),{useBBox:!0}),O=(g.y1-g.y0)/2-9;let E=g.x1-g.x0;return g.x1>=w?E=E-(w+16):E+=4,`translate(${E}, ${O})`}),this.addLineEventListener(),this.addNodeEventListener()}addLineEventListener(){const t=this.getOptions(),n=this,r=Ha((i,s="mouseover")=>{const a=n.parent.selectAll("path.link").transition().call(o=>n.services.transitions.setupTransition({transition:o,name:"alluvial-links-mouse-highlight"}));s==="mouseout"?(N(i).lower(),a.style("stroke-opacity",He.opacity.default)):a.style("stroke-opacity",function(){return i===this?(N(this).raise(),He.opacity.selected):He.opacity.unfocus})},33);this.parent.selectAll("path.link").on("mouseover",function(i,s){const a=N(this);r(this,"mouseover"),a.classed("link-hovered",!0);const o=getComputedStyle(this).getPropertyValue("stroke");n.services.events.dispatchEvent(A.Alluvial.LINE_MOUSEOVER,{event:i,element:a,datum:s}),n.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:s.target.name,value:s.value+(t.alluvial.units?` ${t.alluvial.units}`:""),color:o,labelIcon:n.getRightArrowIcon()}]})}).on("mousemove",function(i,s){n.services.events.dispatchEvent(A.Alluvial.LINE_MOUSEMOVE,{event:i,element:N(this),datum:s}),n.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("click",function(i,s){n.services.events.dispatchEvent(A.Alluvial.LINE_CLICK,{event:i,element:N(this),datum:s})}).on("mouseout",function(i,s){const a=N(this);r(this,"mouseout"),a.classed("link-hovered",!1),n.services.events.dispatchEvent(A.Alluvial.LINE_MOUSEOUT,{event:i,element:a,datum:s}),n.services.events.dispatchEvent(A.Tooltip.HIDE,{event:i,hoveredElement:a})})}addNodeEventListener(){const t=this,n=Ha((r=[],i="mouseover")=>{if(i==="mouseout"||r.length===0){t.parent.selectAll("path.link").classed("link-hovered",!1).data(this.graph.links,s=>s.index).order().style("stroke-opacity",He.opacity.default);return}t.parent.selectAll("path.link").transition().call(s=>this.services.transitions.setupTransition({transition:s,name:"alluvial-link-mouse-highlight"})).style("stroke-opacity",function(s){return r.some(a=>a===s.index)?(N(this).classed("link-hovered",!0).raise(),He.opacity.selected):He.opacity.unfocus})},66);t.parent.selectAll(".node-group").on("mouseover",function(r,i){const s=N(this),a=[];if(t.traverse({link:"sourceLinks",node:"target"},i,a),t.traverse({link:"targetLinks",node:"source"},i,a),a.length){const o=Wi(s.attr("transform"));if(s.attr("transform",`translate(${o.x-2}, ${o.y})`),s.classed("node-hovered",!0).selectAll("rect.node").attr("width",8),i.x0-2===0){const c=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),u=t.parent.select(`g#${c}`),h=Wi(u.attr("transform"));u.attr("transform",`translate(${h.x+4},${h.y})`)}const l=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${l}`).style("font-weight","bold"),n(a,"mouseover"),t.services.events.dispatchEvent(A.Alluvial.NODE_MOUSEOVER,{event:r,element:s,datum:i})}}).on("mousemove",function(r,i){t.services.events.dispatchEvent(A.Alluvial.NODE_MOUSEMOVE,{event:r,element:N(this),datum:i}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(A.Alluvial.NODE_CLICK,{event:r,element:N(this),datum:i})}).on("mouseout",function(r,i){const s=N(this),a=Wi(s.attr("transform"));if(s.classed("node-hovered",!1).attr("transform",`translate(${a.x+2}, ${a.y})`).select("rect.node").attr("width",He.nodeWidth),i.x0-2===0){const l=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),c=t.parent.select(`g#${l}`),u=Wi(c.attr("transform"));c.attr("transform",`translate(${u.x-4},${u.y})`)}const o=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${o}`).style("font-weight","normal"),n([],"mouseout"),t.services.events.dispatchEvent(A.Alluvial.NODE_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:s})})}traverse(t,n,r=[]){n[t.link].map(i=>(r.push(i.index),i[t.node])).forEach(i=>this.traverse(t,i,r))}getRightArrowIcon(){return`
|
|
71
|
+
</li>`).join("")+"</ul>"}valueFormatter(t,n){const r=this.getOptions(),i=_(r,"tooltip","valueFormatter");if(i)return i(t,n);if(typeof t.getTime=="function")return Lr(t,"MMM d, yyyy");try{if(typeof t=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))return Lr(Date.parse(t),"MMM d, yyyy")}catch{}return t.toLocaleString()}render(t=!1){const n=this.getOptions(),r=_(n,"tooltip","enabled");if(r){const i=N(this.services.domUtils.getHolder()),s=_(n,"style","prefix");this.tooltip=P.appendOrSelect(i,`div.${ge}--${s}--tooltip`),this.tooltip.style("max-width",null).attr("role","tooltip"),this.isEventListenerAdded||(this.addTooltipEventListener(),this.isEventListenerAdded=!0),this.tooltip.classed("hidden",!0)}else!r&&this.isEventListenerAdded&&(this.removeTooltipEventListener(),this.isEventListenerAdded=!1)}positionTooltip(t){const n=this.services.domUtils.getHolder(),r=this.tooltip.node(),i=this.getOptions(),s=_(i,"zoomBar","top","enabled");let a=_(t,"detail","mousePosition");if(!a)a=Un(_(t,"detail","event"),n);else{const d=_(i,"zoomBar","top","type"),f=Ee.height[d];s&&(a[1]+=f+Ee.spacerHeight)}const o=n.offsetWidth,l=n.offsetHeight;let c;a[0]/o>.9?c=ne.LEFT:a[0]/o<.1?c=ne.RIGHT:c=this.positionService.findBestPlacementAt({left:a[0],top:a[1]},r,[ne.RIGHT,ne.LEFT,ne.TOP,ne.BOTTOM],()=>({top:void 0,left:void 0,width:o,height:l}));let{horizontalOffset:u}=eO;c===ne.LEFT&&(u*=-1);const h=this.positionService.findPositionAt({left:a[0]+u,top:a[1]},r,c);this.positionService.setElement(r,h)}}const to=class extends gt{constructor(){super(...arguments),this.type="grid-brush",this.renderType=nt.SVG,this.selectionSelector="rect.selection",this.frontSelectionSelector="rect.frontSelection"}render(t=!0){const n=this.parent,r=this.getComponentContainer();if(!n)throw new Error("SVG was not defined");const i=P.appendOrSelect(n,"svg.chart-grid-backdrop"),s=P.appendOrSelect(i,`g.${this.type}`),a=P.appendOrSelect(s,this.selectionSelector),{width:o,height:l}=P.getSVGElementSize(i,{useAttrs:!0}),{cartesianScales:c}=this.services,u=c.getMainXScaleType(),h=c.getMainXScale(),[d]=h.range();r.attr("transform",`translate(${d},0)`);const f=P.appendOrSelect(r,this.frontSelectionSelector);if(h&&u===tt.TIME){let p=this.model.get("zoomDomain");p===void 0&&(p=this.services.zoom.getDefaultZoomBarDomain(),p&&this.model.set({zoomDomain:p},{animate:!1}));const m=E=>{const T=E[1]-E[0];let S="0,"+T.toString();const $=Math.floor(l/to.DASH_LENGTH),k=$*to.DASH_LENGTH;for(let L=0;L<$;L++)S+=","+to.DASH_LENGTH;S+=","+(l-k),$%2===1&&(S+=",0"),S+=","+T.toString(),S+=","+l.toString(),f.attr("stroke-dasharray",S)},g=E=>{const T=E.selection;T===null||T[0]===T[1]||(f.attr("x",parseFloat(a.attr("x"))+parseFloat(i.attr("x"))).attr("y",a.attr("y")).attr("width",a.attr("width")).attr("height",a.attr("height")).style("cursor","pointer").style("display",null),m(T))},v=(E,T)=>{const S=Fd().range([0,o]).domain(p);let $=[S.invert(E),S.invert(T)];$[0].valueOf()===$[1].valueOf()&&($=this.services.zoom.getDefaultZoomBarDomain()),(p[0].valueOf()!==$[0].valueOf()||p[1].valueOf()!==$[1].valueOf())&&this.services.zoom.handleDomainChange($)};let b;const w=E=>{const T=E.selection;T!==null&&(v(T[0],T[1]),s.call(b.move,null),f.style("display","none"))};l!=0&&o!=0&&(b=ih().extent([[0,0],[o-1,l]]).on("start brush end",g).on("end.brushed",w),s.call(b));const O=this.services.zoom.getZoomRatio();i.on("click",function(E){if(E.shiftKey){const T=this.services.domUtils.getHolder(),S=Un(s.node(),T)[0];let $=S-o*O/2;$<0&&($=0);let k=S+o*O/2;k>o&&(k=o),v($,k)}})}}};let xm=to;xm.DASH_LENGTH=4;class qk extends gt{constructor(){super(...arguments),this.type="zoom-bar",this.renderType=nt.SVG,this.MIN_SELECTION_DIFF=9e-10,this.brushSelector="g.zoom-bar-brush",this.clipId="zoomBarClip-"+Math.floor(Math.random()*99999999999),this.brush=ih(),this.highlightStrokeWidth=1}init(){this.services.events.addEventListener(A.ZoomBar.UPDATE,this.render.bind(this));const t=_(this.getOptions(),"zoomBar",H.TOP,"data");this.model.setZoomBarData(t)}render(t=!0){const n=this.getComponentContainer(),r=this.services.zoom.isZoomBarLoading(H.TOP),i=this.services.zoom.isZoomBarLocked(H.TOP),s=_(this.getOptions(),"zoomBar",H.TOP,"type"),a=_(this.getOptions(),"axes",H.BOTTOM,"highlights"),o=Ee.height[s],{width:l}=P.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 h=P.appendOrSelect(n,"svg.zoom-container").attr("width","100%").attr("height",o).attr("opacity",1);if(P.appendOrSelect(n,"rect.zoom-spacer").attr("x",0).attr("y",o).attr("width","100%").attr("height",Ee.spacerHeight).attr("opacity",1).attr("fill","none"),s===Ke.GRAPH_VIEW?P.appendOrSelect(h,"rect.zoom-bg").attr("x",c).attr("y",0).attr("width",l-c).attr("height","100%").classed("zoom-bg-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null):s===Ke.SLIDER_VIEW&&P.appendOrSelect(h,"rect.zoom-slider-bg").attr("x",c).attr("y",o/2-1).attr("width",l-c).attr("height",2).classed("zoom-slider-bg-skeleton",r).style("stroke",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null),r){this.renderSkeleton(h,c,l);return}const{cartesianScales:d}=this.services,f=d.getMainXScale(),p=d.getMainYScale(),m=d.getMainXScaleType();if(f&&m===tt.TIME){let g=this.services.zoom.getZoomBarData();if(ze(g)||g.length===1)return;this.xScale=f.copy(),this.yScale=p.copy();const v=this.services.zoom.getDefaultZoomBarDomain(g);g=this.compensateDataForDefaultDomain(g,v);const b=this.model.get("initialZoomDomain"),w=_(this.getOptions(),"zoomBar",H.TOP,"initialZoomDomain");w&&w[0]&&w[1]&&(w[0]=new Date(w[0]),w[1]=new Date(w[1])),w&&!(b&&b[0].valueOf()===w[0].valueOf()&&b[1].valueOf()===w[1].valueOf())?this.model.set({initialZoomDomain:at([],w),zoomDomain:w?at([],w):v},{skipUpdate:!0}):w===null&&b!==null&&this.model.set({initialZoomDomain:null,zoomDomain:at([],v)},{skipUpdate:!0}),this.xScale.range([c,l]).domain(v),this.maxSelectionRange=this.xScale.range(),this.yScale.range([0,o-6]).domain(Re(g,T=>T.value));const O=this.model.get("zoomDomain");if(s===Ke.GRAPH_VIEW&&(this.renderZoomBarArea(h,"path.zoom-graph-area-unselected",g,null),this.updateClipPath(n,this.clipId,0,0,0,0),this.renderZoomBarArea(h,"path.zoom-graph-area",g,this.clipId),this.renderZoomBarBaseline(h,c,l),a)){const T=a.highlightStartMapsTo,S=a.highlightEndMapsTo,$=a.color,k=a.labelMapsTo;a.data.forEach((L,M)=>{P.appendOrSelect(h,`rect.highlight-${M}`).attr("height",o-2*this.highlightStrokeWidth).attr("y",this.highlightStrokeWidth).attr("x",this.xScale(L[T])).attr("width",this.xScale(L[S])-this.xScale(L[T])).style("fill",$&&$.scale[L[k]]?$.scale[L[k]]:null).style("fill-opacity",.1).style("stroke",$&&$.scale[L[k]]?$.scale[L[k]]:null).style("stroke-dasharray","2, 2").attr("stroke-width","1px")})}this.addBrushEventListener(O,c,l);const E=P.appendOrSelect(n,this.brushSelector).call(this.brush);if(O!==void 0)if(O[0].valueOf()===O[1].valueOf())E.call(this.brush.move,this.xScale.range()),this.updateBrushHandle(this.getComponentContainer(),this.xScale.range());else{const T=O.map(S=>this.xScale(S));T[1]-T[0]<this.MIN_SELECTION_DIFF||(E.call(this.brush.move,T),this.updateBrushHandle(this.getComponentContainer(),T))}i&&(this.brush.filter(()=>!1),E.selectAll("rect").attr("cursor","auto"))}}addBrushEventListener(t,n,r){const i=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=_(this.getOptions(),"zoomBar",H.TOP,"type"),a=Ee.height[s];this.brush.extent([[n,0],[r,a]]).on("start brush end",null).on("start brush end",i)}handleBrushedEvent(t,n,r,i){const s=[r.invert(i[0]),r.invert(i[1])];if(this.updateBrushHandle(this.getComponentContainer(),i),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")){(n===void 0||n[0]!==s[0]||n[1]!==s[1])&&this.services.zoom.handleDomainChange(s,{dispatchEvent:!1});let a;t.type==="start"?a=A.ZoomBar.SELECTION_START:t.type==="brush"?a=A.ZoomBar.SELECTION_IN_PROGRESS:t.type==="end"&&(a=A.ZoomBar.SELECTION_END,this.services.events.dispatchEvent(A.ZoomDomain.CHANGE,{newDomain:s})),this.services.events.dispatchEvent(a,{selection:i,newDomain:s})}}updateBrushHandle(t,n){const r=this,i=Ee.handleWidth,s=_(this.getOptions(),"zoomBar",H.TOP,"type"),a=Ee.height[s],o=-i/2,l=Ee.handleBarWidth,c=s===Ke.GRAPH_VIEW?Ee.handleBarHeight:6,u=-l/2,h=(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,r.maxSelectionRange[0]);if(f.type==="e")return Math.min(n[1]+o,r.maxSelectionRange[1]-i)}).attr("y",0).attr("width",i).attr("height",a).attr("cursor","ew-resize").style("display",null);const d=t.select(this.brushSelector).selectAll("rect.handle-bar").data([{type:"w"},{type:"e"}]);d.enter().append("rect").attr("class",function(f){return"handle-bar handle-bar--"+f.type}),d.attr("x",function(f){if(f.type==="w")return Math.max(n[0]+u,r.maxSelectionRange[0]-o+u);if(f.type==="e")return Math.min(n[1]+u,r.maxSelectionRange[1]+o+u)}).attr("y",h).attr("width",l).attr("height",c).attr("cursor","ew-resize"),s===Ke.SLIDER_VIEW&&this.updateSliderSelectedArea(n),this.updateClipPath(t,this.clipId,n[0],0,n[1]-n[0],a)}updateSliderSelectedArea(t){const n=_(this.getOptions(),"zoomBar",H.TOP,"type"),r=Ee.height[n],i=this.getComponentContainer().select("svg.zoom-container");P.appendOrSelect(i,"rect.zoom-slider-selected-area").attr("x",t[0]).attr("y",r/2-1).attr("width",t[1]-t[0]).attr("height",2)}renderZoomBarArea(t,n,r,i){const{cartesianScales:s}=this.services,a=s.getMainXAxisPosition(),o=s.getMainYAxisPosition(),l=s.getMainXScaleType(),c=s.getMainYScaleType(),u=(v,b,w)=>O=>s.getValueFromScale(v,b,w,O),h=u(this.xScale,l,a),d=u(this.yScale,c,o),f=_(this.getOptions(),"zoomBar",H.TOP,"type"),p=Ee.height[f],m=Al().x(v=>h(v)).y0(p).y1(v=>p-d(v)),g=P.appendOrSelect(t,n).datum(r).attr("d",m);i&&g.attr("clip-path",`url(#${i})`)}updateClipPath(t,n,r,i,s,a){const o=P.appendOrSelect(t,"clipPath").attr("id",n);P.appendOrSelect(o,"rect").attr("x",r).attr("y",i).attr("width",s).attr("height",a)}compensateDataForDefaultDomain(t,n){if(!t||t.length<2)return;const r=yn(t),i=this.services.cartesianScales.getDomainIdentifier(),s=this.services.cartesianScales.getRangeIdentifier();if(Number(n[0])<Number(r[0][i])){const a={};a[i]=n[0],a[s]=0,r.unshift(a)}if(Number(n[1])>Number(r[r.length-1][i])){const a={};a[i]=n[1],a[s]=0,r.push(a)}return r}renderZoomBarBaseline(t,n,r,i=!1){const s=_(this.model.getOptions(),"zoomBar",H.TOP,"type"),a=Ee.height[s],o=Mi()([[n,a],[r,a]]);P.appendOrSelect(t,"path.zoom-bg-baseline").attr("d",o).classed("zoom-bg-baseline-skeleton",i).style("stroke",i?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}renderSkeleton(t,n,r){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),P.appendOrSelect(this.getComponentContainer(),this.brushSelector).html(null),_(this.getOptions(),"zoomBar",H.TOP,"type")===Ke.GRAPH_VIEW&&this.renderZoomBarBaseline(t,n,r,!0)}destroy(){this.brush.on("start brush end",null),this.services.events.removeEventListener(A.ZoomBar.UPDATE,this.render.bind(this))}}class Yk extends gt{constructor(t,n){super(t,n),this.type="threshold",this.renderType=nt.SVG,this.positionService=new Ja}render(t=!1){const n=_(this.getOptions(),"axes"),r=[];Object.keys(n).forEach(c=>{if(Object.values(H).includes(c)){const u=n[c];u.thresholds&&u.thresholds.length>0&&r.push({axisPosition:c,thresholds:u.thresholds,correspondingDatasets:u==null?void 0:u.correspondingDatasets,mapsTo:u==null?void 0:u.mapsTo})}});const i=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-thresholds").data(r,c=>c.axisPosition);i.exit().attr("opacity",0).remove();const s=i.enter().append("g").merge(i);s.attr("class",c=>`axis-thresholds ${c.axisPosition}`);const a=s.selectAll("g.threshold-group").data(c=>c.thresholds.map(u=>(u.axisPosition=c.axisPosition,u.datum=this.constructDatumObj(c,u),u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("line").attr("class","threshold-line"),o.append("rect").attr("class","threshold-hoverable-area"),o.merge(a).attr("class","threshold-group");const l=this;s.each(function({axisPosition:c}){const u=l.services.cartesianScales.getScaleByPosition(c),h=l.services.cartesianScales.getScaleTypeByPosition(c);let d=null,f=null;c===H.LEFT||c===H.RIGHT?(f=u,d=l.services.cartesianScales.getMainXScale()):(d=u,f=l.services.cartesianScales.getMainYScale());const p=h===tt.LABELS,[m,g]=d.range(),[v,b]=f.range(),{cartesianScales:w}=l.services,O=w.getOrientation(),E=L=>w.getDomainValue(L),T=L=>w.getRangeValue(L),[S,$]=xn(E,T,O),k=N(this);c===H.TOP||c===H.BOTTOM?(k.selectAll("line.threshold-line").transition().call(L=>l.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("y1",b).attr("y2",v).attr("x1",({datum:L})=>S(L)+(p?u.step()/2:0)).attr("x2",({datum:L})=>S(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),k.selectAll("rect.threshold-hoverable-area").attr("x",0).attr("y",({datum:L})=>-S(L)).attr("width",Math.abs(v-b)).classed("rotate",!0)):(k.selectAll("line.threshold-line").transition().call(L=>l.services.transitions.setupTransition({transition:L,name:"threshold-line-update",animate:t})).attr("x1",m).attr("x2",g).attr("y1",({datum:L})=>$(L)+(p?u.step()/2:0)).attr("y2",({datum:L})=>$(L)+(p?u.step()/2:0)).style("stroke",({fillColor:L})=>L),k.selectAll("rect.threshold-hoverable-area").attr("x",m).attr("y",({datum:L})=>$(L)).attr("width",Math.abs(g-m)).classed("rotate",!1))}),this.services.events.addEventListener(A.Threshold.SHOW,c=>{this.setThresholdLabelPosition(c.detail),this.label.classed("hidden",!1)}),this.services.events.addEventListener(A.Threshold.HIDE,()=>{this.label.classed("hidden",!0)}),this.appendThresholdLabel(),this.addEventListeners()}getFormattedValue(t){const{value:n,axisPosition:r}=t,i=this.getOptions();if(this.services.cartesianScales.getScaleTypeByPosition(r)===tt.TIME){const s=[H.LEFT,H.RIGHT].includes(r),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),l=s?o:a,c=_(i,"timeScale"),u=fc(l.ticks(),_(c,"timeInterval"));return dc(n,0,l.ticks(),u,c)}return n.toLocaleString("en")}appendThresholdLabel(){const t=N(this.services.domUtils.getHolder()),n=_(this.getOptions(),"style","prefix");this.label=P.appendOrSelect(t,`div.${ge}--${n}--threshold--label`).classed("hidden",!0)}setThresholdLabelPosition({event:t,datum:n}){const r=this.services.domUtils.getHolder(),i=Un(t,r),s=n.valueFormatter?n.valueFormatter(n.value):this.getFormattedValue(n);this.label.html(`${n.label||"Threshold"}: ${s}`).style("background-color",n.fillColor);const a=this.label.node(),o=this.positionService.findBestPlacementAt({left:i[0],top:i[1]},a,[ne.RIGHT,ne.LEFT,ne.TOP,ne.BOTTOM],()=>({top:void 0,left:void 0,width:r.offsetWidth,height:r.offsetHeight})),l=this.positionService.findPositionAt({left:i[0],top:i[1]},a,o);this.positionService.setElement(a,l)}constructDatumObj(t,n){const r={};return t.correspondingDatasets&&(r.group=_(t,"correspondingDatasets",0)),r[t.mapsTo]=n.value,r}addEventListeners(){const t=this;this.getComponentContainer({withinChartClip:!0}).selectAll("rect.threshold-hoverable-area").on("mouseover mousemove",function(n){N(this.parentNode).select("line.threshold-line").classed("active",!0),t.services.events.dispatchEvent(A.Threshold.SHOW,{event:n,hoveredElement:N(this),datum:N(this).datum()})}).on("mouseout",function(n){N(this.parentNode).select("line.threshold-line").classed("active",!1),t.services.events.dispatchEvent(A.Threshold.HIDE,{event:n,hoveredElement:N(this),datum:N(this).datum()})})}}class Xk extends gt{constructor(t,n){super(t,n),this.type="highlight",this.renderType=nt.SVG,this.positionService=new Ja,this.highlightStrokeWidth=1}render(t=!1){const n=_(this.getOptions(),"axes"),r=[];Object.keys(n).forEach(c=>{if(Object.values(H).includes(c)){const u=n[c];u.highlights&&u.highlights.data.length>0&&r.push({axisPosition:c,highlightStartMapsTo:u.highlights.highlightStartMapsTo,highlightEndMapsTo:u.highlights.highlightEndMapsTo,labelMapsTo:u.highlights.labelMapsTo,highlight:u.highlights.data,color:u.highlights.color})}});const i=this.getComponentContainer({withinChartClip:!0}).selectAll("g.axis-highlight").data(r,c=>c.axisPosition);i.exit().attr("opacity",0).remove();const s=i.enter().append("g").merge(i);s.attr("class",c=>`axis-highlight ${c.axisPosition}`);const a=s.selectAll("g.highlight-group").data(c=>c.highlight.map(u=>(u.axisPosition=c.axisPosition,u.highlightStartMapsTo=c.highlightStartMapsTo,u.labelMapsTo=c.labelMapsTo,u.color=c.color,u.highlightEndMapsTo=c.highlightEndMapsTo,u)));a.exit().attr("opacity",0).remove();const o=a.enter().append("g");o.append("rect").attr("class","highlight-bar"),o.append("line").attr("class","highlight-line"),o.merge(a).attr("class","highlight-group");const l=this;s.each(function({axisPosition:c}){const u=l.services.cartesianScales.getMainXScale(),h=l.services.cartesianScales.getMainYScale(),[d,f]=u.range(),[p,m]=h.range(),{cartesianScales:g}=l.services,v=g.getOrientation(),b=S=>g.getDomainValue(S),w=S=>g.getRangeValue(S),[O,E]=xn(b,w,v),T=N(this);c===H.TOP||c===H.BOTTOM?T.selectAll("rect.highlight-bar").transition().call(S=>l.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("y",Math.max(m+l.highlightStrokeWidth,0)).attr("height",Math.max(p-2*l.highlightStrokeWidth,0)).attr("x",({highlightStartMapsTo:S,...$})=>O($[S])).attr("width",({highlightStartMapsTo:S,highlightEndMapsTo:$,...k})=>Math.max(O(k[$])-O(k[S]),0)).style("stroke",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",l.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null):T.selectAll("rect.highlight-bar").transition().call(S=>l.services.transitions.setupTransition({transition:S,name:"highlight-bar-update",animate:t})).attr("x",d).attr("width",Math.max(f-d,0)).attr("y",({highlightEndMapsTo:S,...$})=>E($[S])).attr("height",({highlightStartMapsTo:S,highlightEndMapsTo:$,...k})=>Math.max(E(k[S])-E(k[$]),0)).style("stroke",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null).style("stroke-dasharray","2, 2").attr("stroke-width",l.highlightStrokeWidth+"px").style("fill-opacity",.1).style("fill",({color:S,labelMapsTo:$,...k})=>S&&S.scale[k[$]]?S.scale[k[$]]:null)})}}class wm extends Vc{getItems(t){if(t.detail.items)return t.detail.items;const n=t.detail.data;if(!n.length||!n[0])return[];const r=this.getOptions(),{cartesianScales:i}=this.services,s=i.getDomainIdentifier(),a=i.isDualAxes(),{groupMapsTo:o}=r.data,l=i.getDomainLabel();let c=i.getRangeLabel();const u=n[0][s];let h;if(n.length===1){const d=n[0],f=i.getRangeIdentifier(d);if(a){const m=i.getRangeAxisPosition({datum:d,groups:[d[o]]});c=i.getScaleLabel(m)}const p=d[f];h=[{label:l,value:u},...Array.isArray(p)&&p.length===2?[{label:"Start",value:p[0]},{label:"End",value:p[1]}]:[{label:c,value:d[f]}]],t.detail.additionalItems&&t.detail.additionalItems.forEach(m=>h.push({label:m.label,value:m.value})),h.push({label:r.tooltip.groupLabel,value:d[o],color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:d[o]})})}else if(n.length>1&&(h=[{label:l,value:u}],h=h.concat(n.map(d=>{const f=d[i.getRangeIdentifier(d)];return{label:d[o],value:Array.isArray(f)&&f.length===2?`${f[0]} - ${f[1]}`:f,color:this.model.getFillColor(d[o]),class:this.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:d[o]})}}).sort((d,f)=>f.value-d.value)),!a&&_(r,"tooltip","showTotal")===!0)){const d=i.getRangeIdentifier();h.push({label:kt(r,"tooltip.totalLabel")||"Total",value:n.reduce((f,p)=>f+p[d],0),bold:!0})}return h}}class Zk extends gt{constructor(){super(...arguments),this.type="alluvial",this.renderType=nt.SVG,this.gradient_id="gradient-id-"+Math.floor(Math.random()*99999999999)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.html("");const{width:r,height:i}=P.getSVGElementSize(n,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=_(this.getOptions(),"color","gradient","enabled");let l=He.minNodePadding;s.alluvial.nodePadding>He.minNodePadding&&(l=s.alluvial.nodePadding);const c=_(s,"alluvial","nodeAlignment");let u=Tg;c===Yt.LEFT?u=Q$:c===Yt.RIGHT&&(u=J$);const h=rL().nodeId(g=>g.name).nodeWidth(He.nodeWidth).nodePadding(l).nodeAlign(u).extent([[2,30],[r-2,i]]);this.graph=h({nodes:s.alluvial.nodes.map(g=>Object.assign({},g)),links:a.map(g=>Object.assign({},g))}),this.graph.nodes=this.graph.nodes.filter(g=>g.value!==0);const d={};this.graph.nodes.forEach(g=>{const v=g.x0;g.category&&(d[v]=g==null?void 0:g.category)}),n.append("g").classed("header-arrows",!0).selectAll("g").data(Object.keys(d)).join("g").attr("transform",g=>`translate(${g}, 0)`).append("text").attr("id",(g,v)=>this.services.domUtils.generateElementIDString(`alluvial-category-${v}`)).style("font-size","14px").text(g=>d[g]?d[g]:"").attr("y",20).attr("x",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-category-${v}`),{width:w}=P.getSVGElementSize(N(`text#${b}`),{useBBox:!0});let O=0;return g+O>=w&&(O=-w+4),O});const f=n.append("g").attr("fill","none").selectAll("g").data(this.graph.links);if(f.exit().remove(),o){const g=_(this.getOptions(),"color","scale");g&&f.enter().append("linearGradient").attr("id",v=>`${this.gradient_id}-link-${v.index}`).attr("gradientUnits","userSpaceOnUse").call(v=>v.append("stop").attr("offset","0%").attr("stop-color",b=>g[b.source.name])).call(v=>v.append("stop").attr("offset","100%").attr("stop-color",b=>g[b.target.name])),f.exit().remove()}f.enter().append("path").classed("link",!0).attr("d",gL()).attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-line-${g.index}`)).attr("class",g=>s.alluvial.monochrome?this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:0,originalClassName:"link"}):this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:g.source.index,originalClassName:"link"})).style("stroke",g=>o?`url(#${this.gradient_id}-link-${g.index})`:this.model.getFillColor(g.source.name)).attr("stroke-width",g=>Math.max(1,g.width)).style("stroke-opacity",He.opacity.default).attr("aria-label",g=>`${g.source.name} → ${g.target.name} (${g.value}${s.alluvial.units?" "+s.alluvial.units:""})`);const p=n.append("g").selectAll("g").data(this.graph.nodes).enter().append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-${g.index}`)).classed("node-group",!0).attr("transform",g=>`translate(${g.x0}, ${g.y0})`);p.append("rect").classed("node",!0).attr("height",g=>g.y1-g.y0).attr("width",g=>g.x1-g.x0).attr("fill","black");const m=p.append("g").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-title-${g.index}`));m.append("text").attr("id",g=>this.services.domUtils.generateElementIDString(`alluvial-node-text-${g.index}`)).attr("class","node-text").style("font-size","12px").attr("text-anchor","start").attr("fill","white").attr("x",4).attr("dy",13).text(g=>`${g.name} (${g.value})`).attr("aria-label",g=>`${g.name} (${g.value})`),m.append("rect").classed("node-text-bg",!0).attr("width",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=P.getSVGElementSize(N(`text#${b}`),{useBBox:!0});return w+8}).attr("height",18).attr("stroke-width",2).lower(),m.attr("transform",(g,v)=>{const b=this.services.domUtils.generateElementIDString(`alluvial-node-text-${v}`),{width:w}=P.getSVGElementSize(N(`text#${b}`),{useBBox:!0}),O=(g.y1-g.y0)/2-9;let E=g.x1-g.x0;return g.x1>=w?E=E-(w+16):E+=4,`translate(${E}, ${O})`}),this.addLineEventListener(),this.addNodeEventListener()}addLineEventListener(){const t=this.getOptions(),n=this,r=Ha((i,s="mouseover")=>{const a=n.parent.selectAll("path.link").transition().call(o=>n.services.transitions.setupTransition({transition:o,name:"alluvial-links-mouse-highlight"}));s==="mouseout"?(N(i).lower(),a.style("stroke-opacity",He.opacity.default)):a.style("stroke-opacity",function(){return i===this?(N(this).raise(),He.opacity.selected):He.opacity.unfocus})},33);this.parent.selectAll("path.link").on("mouseover",function(i,s){const a=N(this);r(this,"mouseover"),a.classed("link-hovered",!0);const o=getComputedStyle(this).getPropertyValue("stroke");n.services.events.dispatchEvent(A.Alluvial.LINE_MOUSEOVER,{event:i,element:a,datum:s}),n.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:s.target.name,value:s.value+(t.alluvial.units?` ${t.alluvial.units}`:""),color:o,labelIcon:n.getRightArrowIcon()}]})}).on("mousemove",function(i,s){n.services.events.dispatchEvent(A.Alluvial.LINE_MOUSEMOVE,{event:i,element:N(this),datum:s}),n.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("click",function(i,s){n.services.events.dispatchEvent(A.Alluvial.LINE_CLICK,{event:i,element:N(this),datum:s})}).on("mouseout",function(i,s){const a=N(this);r(this,"mouseout"),a.classed("link-hovered",!1),n.services.events.dispatchEvent(A.Alluvial.LINE_MOUSEOUT,{event:i,element:a,datum:s}),n.services.events.dispatchEvent(A.Tooltip.HIDE,{event:i,hoveredElement:a})})}addNodeEventListener(){const t=this,n=Ha((r=[],i="mouseover")=>{if(i==="mouseout"||r.length===0){t.parent.selectAll("path.link").classed("link-hovered",!1).data(this.graph.links,s=>s.index).order().style("stroke-opacity",He.opacity.default);return}t.parent.selectAll("path.link").transition().call(s=>this.services.transitions.setupTransition({transition:s,name:"alluvial-link-mouse-highlight"})).style("stroke-opacity",function(s){return r.some(a=>a===s.index)?(N(this).classed("link-hovered",!0).raise(),He.opacity.selected):He.opacity.unfocus})},66);t.parent.selectAll(".node-group").on("mouseover",function(r,i){const s=N(this),a=[];if(t.traverse({link:"sourceLinks",node:"target"},i,a),t.traverse({link:"targetLinks",node:"source"},i,a),a.length){const o=Wi(s.attr("transform"));if(s.attr("transform",`translate(${o.x-2}, ${o.y})`),s.classed("node-hovered",!0).selectAll("rect.node").attr("width",8),i.x0-2===0){const c=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),u=t.parent.select(`g#${c}`),h=Wi(u.attr("transform"));u.attr("transform",`translate(${h.x+4},${h.y})`)}const l=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${l}`).style("font-weight","bold"),n(a,"mouseover"),t.services.events.dispatchEvent(A.Alluvial.NODE_MOUSEOVER,{event:r,element:s,datum:i})}}).on("mousemove",function(r,i){t.services.events.dispatchEvent(A.Alluvial.NODE_MOUSEMOVE,{event:r,element:N(this),datum:i}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(A.Alluvial.NODE_CLICK,{event:r,element:N(this),datum:i})}).on("mouseout",function(r,i){const s=N(this),a=Wi(s.attr("transform"));if(s.classed("node-hovered",!1).attr("transform",`translate(${a.x+2}, ${a.y})`).select("rect.node").attr("width",He.nodeWidth),i.x0-2===0){const l=t.services.domUtils.generateElementIDString(`alluvial-node-title-${i.index}`),c=t.parent.select(`g#${l}`),u=Wi(c.attr("transform"));c.attr("transform",`translate(${u.x-4},${u.y})`)}const o=t.services.domUtils.generateElementIDString(`alluvial-node-text-${i.index}`);t.parent.select(`text#${o}`).style("font-weight","normal"),n([],"mouseout"),t.services.events.dispatchEvent(A.Alluvial.NODE_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:s})})}traverse(t,n,r=[]){n[t.link].map(i=>(r.push(i.index),i[t.node])).forEach(i=>this.traverse(t,i,r))}getRightArrowIcon(){return`
|
|
72
72
|
<svg xmlns="http://www.w3.org/2000/svg" class="arrow-right" width="32" height="32" viewBox="0 0 32 32">
|
|
73
73
|
<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"/>
|
|
74
74
|
<rect width="32" height="32"/>
|
|
75
|
-
</svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class Se extends gt{constructor(){super(...arguments),this.type="grid",this.renderType=nt.SVG}render(t=!0){const n=_(this.getOptions(),"grid","x","enabled"),r=_(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,r),!(!n&&!r)&&(n&&(P.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),r&&(P.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,r=this.backdrop.attr("height"),i=this.services.cartesianScales.getMainXScale(),s=lo(i).tickSizeInner(-r).tickSizeOuter(0);if(_(this.getOptions(),"grid","x","alignWithAxisTicks")){const o=this.services.cartesianScales.getDomainAxisPosition(),l=_(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=_(this.getOptions(),"grid","x","numberOfTicks");s.ticks(o)}const a=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${r})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}drawYGrid(t){const n=this.parent,r=this.backdrop.attr("width"),i=this.services.cartesianScales.getMainYScale(),s=cu(i).tickSizeInner(-r).tickSizeOuter(0);if(_(this.getOptions(),"grid","y","alignWithAxisTicks")){const o=this.services.cartesianScales.getRangeAxisPosition(),l=_(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=_(this.getOptions(),"grid","y","numberOfTicks");s.ticks(o)}const a=n.select(".y.grid").attr("transform",`translate(0, ${-this.backdrop.attr("y")})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}getGridlineThreshold(t){const n=this.parent,r=n.selectAll(".x.grid .tick").nodes().sort((u,h)=>Number(bn(u).tx)-Number(bn(h).tx));let i=-1;if(!r.length)return;r.forEach(u=>{t[0]>=+bn(u).tx&&i++});const s=i+1<r.length?i+1:r.length,a=r[i],o=r[s];let l;if(!a)l=+bn(o).tx;else if(o)l=+bn(o).tx-+bn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();l=P.getSVGElementSize(u).width-+bn(a).tx}const{threshold:c}=this.getOptions().tooltip.gridline;return l*c}getActiveGridline(t){const n=_(this.getOptions,"tooltip","gridline","threshold"),r=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const i=bn(this),s={min:Number(i.tx)-r,max:Number(i.tx)+r};return s.min<=t[0]&&t[0]<=s.max})}drawBackdrop(t,n){const r=this.parent,i=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=i.range(),[l,c]=s.range();this.backdrop=P.appendOrSelect(r,"svg.chart-grid-backdrop");const u=P.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 _m extends gt{constructor(){super(...arguments),this.type="area",this.renderType=nt.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(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-area"})).attr("opacity",r=>r.name!==n.datum().name?pn.opacity.unselected:pn.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",pn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions();let i=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=Al().curve(this.services.curves.getD3Curve()).defined(E=>{const T=s.getRangeIdentifier();return E[T]!=null}),l=this.model.getGroupedData(this.configs.groups),c=_(r,"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 h=0;const d=(E,T)=>{_(r,"axes",E,"includeZero")===!1&&T[0]>0&&T[1]>0&&(h=T[0])},f=E=>u?s.getBoundedScaledValues(E)[0]:s.getRangeValue(h),p=E=>u?s.getBoundedScaledValues(E)[1]:s.getRangeValue(E);a===Jt.VERTICAL?(i=s.getMainYScale().domain(),d(s.getMainYAxisPosition(),i),o.x(E=>s.getDomainValue(E)).y0(E=>f(E)).y1(E=>p(E))):(i=s.getMainXScale().domain(),d(s.getMainXAxisPosition(),i),o.x0(E=>f(E)).x1(E=>p(E)).y(E=>s.getDomainValue(E)));const m=_(r,"color","gradient","enabled"),g=l&&l.length===1&&m;l.length>1&&m&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(l,E=>E.name),b=N(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!l.length)return;if(g){const E=b.select(`path.${this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:l[0].name})}`).node();let T;if(E)T=getComputedStyle(E,null).getPropertyValue("stroke");else{const S=_(this.model.getOptions(),"color","scale");if(S!==null){const $=Object.keys(S);T=S[$[0]]}}mc.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:mc.getStops(i,T)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const w=this,O=v.enter().append("path");g?O.merge(v).style("fill",E=>`url(#${this.services.domUtils.generateElementIDString(`${E.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",E=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:E.name,originalClassName:"area"})).attr("d",E=>{const{data:T}=E;return o(T)}):(O.attr("opacity",0).merge(v).attr("class","area").attr("class",E=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:E.name,originalClassName:"area"})).style("fill",E=>w.model.getFillColor(E.name)).transition().call(E=>this.services.transitions.setupTransition({transition:E,name:"area-update-enter",animate:t})).attr("opacity",u?1:pn.opacity.selected).attr("d",E=>{const{data:T}=E;return o(T)}),u&&O.attr("fill-opacity",pn.opacity.selected).style("stroke",E=>w.model.getStrokeColor(E.name)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class zr extends gt{constructor(){super(...arguments),this.type="line",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-line"})).attr("opacity",r=>r.name!==n.datum().name?gn.opacity.unselected:gn.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",gn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{cartesianScales:r,curves:i}=this.services,s=f=>r.getDomainValue(f),a=f=>r.getRangeValue(f),[o,l]=xn(s,a,r.getOrientation()),c=this.getOptions(),u=Mi().x(o).y(l).curve(i.getD3Curve()).defined(f=>{const p=r.getRangeIdentifier(f);return f[p]!=null});let h=[];if(this.configs.stacked){const f=Object.keys(c.axes).some(m=>c.axes[m].percentage),{groupMapsTo:p}=c.data;h=this.model.getStackedData({groups:this.configs.groups,percentage:f}).map(m=>{const g=this.services.cartesianScales.getDomainIdentifier(m),v=this.services.cartesianScales.getRangeIdentifier(m);return{name:_(m,0,p),data:m.map(b=>({[g]:b.data.sharedStackKey,[p]:b[p],[v]:b[1]})),hidden:!DD(m,b=>b[0]!==b[1])}})}else h=this.model.getGroupedData(this.configs.groups);const d=n.selectAll("path.line").data(h,f=>f.name);d.exit().attr("opacity",0).remove(),d.enter().append("path").classed("line",!0).attr("opacity",0).merge(d).data(h,f=>f.name).attr("class",f=>this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:f.name,originalClassName:"line"})).style("stroke",f=>this.model.getStrokeColor(f.name)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",f=>{const{data:p}=f;return p.map(m=>{const g=this.services.cartesianScales.getRangeIdentifier(m);return m[g]}).join(",")}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"line-update-enter",animate:t})).attr("opacity",f=>f.hidden?0:1).attr("d",f=>{const{data:p}=f;return u(p)})}destroy(){const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const Em=5;function Kk(e,t){return e>t-Em&&e<t+Em}let kn=class extends gt{constructor(){super(...arguments),this.type="ruler",this.renderType=nt.SVG,this.isXGridEnabled=_(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=_(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!0){const n=_(this.getOptions(),"ruler","enabled");this.drawBackdrop(),n&&!this.isEventListenerAdded?this.addBackdropEventListeners():!n&&this.isEventListenerAdded&&this.removeBackdropEventListeners()}removeBackdropEventListeners(){this.isEventListenerAdded=!1,this.backdrop.on("mousemove mouseover mouseout",null)}formatTooltipData(t){return t}showRuler(t,[n,r]){const i=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[l,c]=o.range(),u=s===Jt.HORIZONTAL?r:n,h=P.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),d=P.appendOrSelect(h,"line.ruler-line"),f=i.selectAll("[role=graphics-symbol]"),p=a.map(g=>({domainValue:this.services.cartesianScales.getDomainValue(g),originalData:g})).filter(g=>Kk(g.domainValue,u));if(this.pointsWithinLine&&p.length===this.pointsWithinLine.length&&p.map(g=>g.domainValue).join()===this.pointsWithinLine.map(g=>g.domainValue).join())return this.pointsWithinLine=p,this.services.events.dispatchEvent(A.Tooltip.MOVE,{mousePosition:[n,r]});this.pointsWithinLine=p;const m=this.pointsWithinLine.reduce((g,v)=>{if(g.length===0)return g.push(v),g;const b=g[0].domainValue,w=Math.abs(u-v.domainValue),O=Math.abs(u-b);return w>O||(w<O?g=[v]:g.push(v)),g},[]);if(m.length>0){const g=m.map(O=>O.originalData).filter(O=>{const E=this.services.cartesianScales.getRangeIdentifier(O);return O[E]!=null}),v=m.map(O=>O.domainValue),b=f.filter(O=>{const E=this.services.cartesianScales.getDomainValue(O);return v.includes(E)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!rm(this.elementsToHighlight,b)&&this.hideRuler(),b.dispatch("mouseover"),this.elementsToHighlight=b,this.services.events.dispatchEvent(A.Tooltip.SHOW,{mousePosition:[n,r],hoveredElement:d,data:this.formatTooltipData(g)}),h.attr("opacity",1);const w=m[0];s==="horizontal"?d.attr("x1",c).attr("x2",l).attr("y1",w.domainValue).attr("y2",w.domainValue):d.attr("y1",c).attr("y2",l).attr("x1",w.domainValue).attr("x2",w.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=P.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(A.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),r=this.model.getDisplayData();let i=function(s){const a=Un(s,t.parent.node());t.showRuler(s,a)};if(r.length>100){const s=r.length%50*12.5;i=I2(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",i).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=P.appendOrSelect(t,"svg.chart-grid-backdrop")}};class tn extends gt{constructor(){super(...arguments),this.type="scatter",this.renderType=nt.SVG,this.handleChartHolderOnHover=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-hover-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.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=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"chart-holder-mouseout-scatter"})}).attr("opacity",0)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(i=>{var s;return(s=this.services.transitions)==null?void 0:s.setupTransition({transition:i,name:"legend-hover-scatter"})}).attr("opacity",i=>i[r]!==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=>{var n;return(n=this.services.transitions)==null?void 0:n.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(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(A.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(A.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const r=n.getDomainIdentifier(t),i=this.model.get("zoomDomain");return i!==void 0?t.filter(s=>s[r].getTime()>=i[0].getTime()&&s[r].getTime()<=i[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let r;if(n){const i=Object.keys(t.axes).some(s=>t.axes[s].percentage);r=this.model.getStackedData({groups:this.configs.groups,percentage:i})}else{const{cartesianScales:i}=this.services;if(!i)throw new Error("Services cartesianScales are undefined.");r=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=i.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(r)}render(t){if(!(_(this.getOptions(),"points","enabled")||_(this.getOptions(),"bubble","enabled")))return;const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services;if(!s)throw new Error("Services cartesianScales are undefined.");const a=s.getDomainIdentifier(),o=n.selectAll("circle.dot").data(this.getScatterData(),c=>`${c[i]}-${c[a]}`);o.exit().attr("opacity",0).remove();const l=o.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(o);this.styleCircles(l,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:r}=this.services;if(!r)throw new Error("Cartesian scales service is undefined");const i=r.getOrientation(),[s,a]=xn(r.getHighestDomainThreshold(),r.getHighestRangeThreshold(),i),[o,l]=xn(h=>r.getDomainValue(h),h=>r.getRangeValue(h),i),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 r=this.getOptions(),{filled:i,fillOpacity:s}=r.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=r.data,l=f=>a.getDomainValue(f),c=f=>a.getRangeValue(f),[u,h]=xn(l,c,a.getOrientation()),{fadeInOnChartHolderMouseover:d}=this.configs;t.raise().classed("dot",!0).attr("class",f=>{const p=a.getDomainIdentifier(f),m=this.model.getIsFilled(f[o],f[p],f,i)?[st.FILL,st.STROKE]:[st.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,i)}).classed("unfilled",f=>{const p=a.getDomainIdentifier(f);return!this.model.getIsFilled(f[o],f[p],f,i)}).transition().call(f=>{var p;return(p=this.services.transitions)==null?void 0:p.setupTransition({transition:f,name:"scatter-update-enter",animate:n})}).attr("cx",u).attr("cy",h).attr("r",r.points.radius).style("fill",f=>{const p=a.getDomainIdentifier(f);if(this.model.getIsFilled(f[o],f[p],f,i))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",i?s:1).attr("opacity",d?0:1).attr("role",dt.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;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle").on("mouseover",function(r,i){var s,a;const o=N(this);o.classed("hovered",!0).attr("class",l=>t.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:l[n],originalClassName:o.attr("class")})).style("fill",l=>{var c;const u=(c=t.services.cartesianScales)==null?void 0:c.getDomainIdentifier(l);return t.model.getFillColor(l[n],l[u],l)}).classed("unfilled",!1),(s=t.services.events)==null||s.dispatchEvent(A.Tooltip.SHOW,{event:r,hoveredElement:o,data:[i],additionalItems:t.getTooltipAdditionalItems(i)}),(a=t.services.events)==null||a.dispatchEvent(A.Scatter.SCATTER_MOUSEOVER,{event:r,element:o,datum:i})}).on("mousemove",function(r,i){var s,a;const o=N(this);(s=t.services.events)==null||s.dispatchEvent(A.Scatter.SCATTER_MOUSEMOVE,{event:r,element:o,datum:i}),(a=t.services.events)==null||a.dispatchEvent(A.Tooltip.MOVE,{event:r})}).on("click",function(r,i){var s;(s=t.services.events)==null||s.dispatchEvent(A.Scatter.SCATTER_CLICK,{event:r,element:N(this),datum:i})}).on("mouseout",function(r,i){var s,a,o;const l=N(this);if(l.classed("hovered",!1),!t.configs.filled){const{filled:c}=t.getOptions().points,u=(s=t.services.cartesianScales)==null?void 0:s.getDomainIdentifier(i),h=t.model.getIsFilled(i[n],i[u],i,c);l.classed("unfilled",!h).style("fill",d=>h||c?t.model.getFillColor(d[n],d[u],d):null)}(a=t.services.events)==null||a.dispatchEvent(A.Scatter.SCATTER_MOUSEOUT,{event:r,element:l,datum:i}),(o=t.services.events)==null||o.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:l})})}destroy(){var t;(t=this.parent)==null||t.selectAll("circle").on("mousemove",null).on("mouseout",null);const{events:n}=this.services;if(!n)throw new Error("Services events undefined");n.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),n.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),n.removeEventListener(A.Chart.MOUSEOVER,this.handleChartHolderOnHover),n.removeEventListener(A.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}}let Sm=class extends gt{constructor(t,n,r){super(t,n,r),this.type="axes",this.renderType=nt.SVG,this.truncation={[H.LEFT]:!1,[H.RIGHT]:!1,[H.TOP]:!1,[H.BOTTOM]:!1},r&&(this.configs=r),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,r=this.getOptions(),i=_(r,"axes",n,"visible"),s=this.getComponentContainer(),{width:a,height:o}=P.getSVGElementSize(s,{useAttrs:!0}),l=P.appendOrSelect(s,`g.axis.${n}`);let c,u;if(n===H.BOTTOM||n===H.TOP?(c=this.configs.axes[H.LEFT]?this.margins.left:0,u=this.configs.axes[H.RIGHT]?a-this.margins.right:a):(c=o-this.margins.bottom,u=this.margins.top),!this.services.cartesianScales)throw new Error("Services cartesianScales undefineds");const h=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===tt.LABELS||this.scaleType===tt.LABELS_RATIO?h.rangeRound([c,u]):h.range([c,u]);let d;switch(n){case H.LEFT:d=cu;break;case H.BOTTOM:d=lo;break;case H.RIGHT:d=Wv;break;case H.TOP:d=jv;break}l.attr("aria-label",`${n} axis`);const f=!l.select("g.ticks").empty();let p=P.appendOrSelect(l,"g.ticks");f||(p.attr("role",`${dt.GRAPHICS_OBJECT} ${dt.GROUP}`),p.attr("aria-label",`${n} ticks`));const m=P.appendOrSelect(l,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),g=_(r,"axes",n),v=this.scaleType===tt.TIME||g.scaleType===tt.TIME,b=n===H.LEFT||n===H.RIGHT,w=this.model.get("zoomDomain");if(w&&v&&!b&&h.domain(w),!i){p.attr("aria-hidden",!0);return}const O=_(g,"scaleType"),E=_(r,"data","loading"),T=_(g,"ticks","number"),S=_(g,"ticks","values"),$=_(g,"truncation","type"),k=_(g,"truncation","threshold"),L=_(g,"truncation","numCharacter"),M=T!==null,V=_(r,"timeScale"),x=P.appendOrSelect(m,"g.tick"),C=P.appendOrSelect(x,"text").text("0"),y=P.getSVGElementSize(C.node(),{useBBox:!0}).height;x.remove();const R=this.scaleType||g.scaleType||tt.LINEAR,I=d(h).tickSizeOuter(0);if(h.ticks){let q;if(M?q=T:(q=An.ticks.number,b&&(q=this.getNumberOfFittingTicks(o,y,An.ticks.verticalSpaceRatio))),h.ticks().length===1&&h.ticks()[0]===0&&(q=0),I.ticks(q),v)if(!h.ticks(q).length)I.tickValues([]);else{const Q=_(r,"timeScale","addSpaceOnEdges"),lt=_(r,"axes",n,"domain"),rt=h.copy();Q&&!lt&&rt.nice(q);const ot=rt.ticks(q);Q&&ot.length>2&&!lt&&(ot.splice(ot.length-1,1),ot.splice(0,1)),I.tickValues(ot)}}let B;const U=_(g,"ticks","formatter");if(v){const q=fc(I.tickValues(),_(r,"timeScale","timeInterval"));U===null?B=(Q,lt)=>dc(Q,lt,I.tickValues(),q,V):B=(Q,lt)=>{const rt=dc(Q,lt,I.tickValues(),q,V);return U(Q,lt,rt)}}else U===null?R===tt.LINEAR&&(B=q=>q.toLocaleString()):B=U;I.tickFormat(B);const[z,j]=this.services.cartesianScales.getScaleByPosition(n).domain();let G;if(S){if(v)S.forEach((q,Q)=>{q.getTime===void 0&&(S[Q]=new Date(q))}),G=S.filter(q=>{const Q=q.getTime();return Q>=new Date(z).getTime()&&Q<=new Date(j).getTime()});else if(O===tt.LABELS){const q=this.services.cartesianScales.getScaleByPosition(n).domain();G=S.filter(Q=>q.includes(Q))}else G=S.filter(q=>q>=z&&q<=j);I.tickValues(G)}switch(n){case H.LEFT:p.attr("transform",`translate(${this.margins.left}, 0)`);break;case H.BOTTOM:p.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case H.RIGHT:p.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case H.TOP:p.attr("transform",`translate(0, ${this.margins.top})`);break}const et=this.model.isDataEmpty();if(g.title){const q=P.appendOrSelect(l,"text.axis-title").html(et||E?"":g.title),Q=_(g,"titleOrientation");let lt;switch(n){case H.LEFT:Q===Ul.RIGHT?q.attr("transform","rotate(90)").attr("y",0).attr("x",h.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):q.attr("transform","rotate(-90)").attr("y",0).attr("x",-(h.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case H.BOTTOM:q.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${o+4})`).style("text-anchor","middle");break;case H.RIGHT:Q===Ul.LEFT?q.attr("transform","rotate(-90)").attr("y",a).attr("x",-(h.range()[0]/2)).style("text-anchor","middle"):q.attr("transform","rotate(90)").attr("y",-a).attr("x",h.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case H.TOP:lt=P.getSVGElementSize(q,{useBBox:!0}).height,q.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${lt/2})`).style("text-anchor","middle");break}}if(v){const q=fc(I.tickValues(),_(r,"timeScale","timeInterval")),Q=V.showDayName,lt=p;t&&(p=p.transition().call(rt=>this.services.transitions.setupTransition({transition:rt,name:"axis-update",animate:t}))),p=p.call(I),lt.selectAll(".tick").data(I.tickValues(),h).order().select("text").style("font-weight",(rt,ot)=>gg(rt,ot,I.tickValues(),q,Q)?"bold":"normal")}else!t||!f?p=p.call(I):p=p.transition().call(q=>this.services.transitions.setupTransition({transition:q,name:"axis-update",animate:t})).call(I);if(m.call(I),n===H.BOTTOM||n===H.TOP){let q=!1;const Q=_(g,"ticks","rotation");if(Q===ma.ALWAYS)q=!0;else if(Q===ma.NEVER)q=!1;else if(!Q||Q===ma.AUTO)if(h.step)q=m.selectAll("g.tick text").nodes().some(lt=>P.getSVGElementSize(lt,{useBBox:!0}).width>=h.step());else{q=!1;const lt=m.append("text").text("A"),rt=P.getSVGElementSize(lt.node(),{useBBox:!0}).width;let ot;m.selectAll("g.tick").each(function(){const Y=N(this),X=parseFloat(_(bn(this),"tx"));X!==null&&ot+Y.text().length*rt*.8>=X&&(q=!0),ot=X}),lt.remove()}q?(M||(I.ticks(this.getNumberOfFittingTicks(a,y,An.ticks.horizontalSpaceRatio)),m.call(I),p.call(I)),l.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===H.TOP?"start":"end")):l.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(E?l.attr("opacity",0):l.attr("opacity",1),p.selectAll("g.tick").attr("aria-label",q=>q),m.selectAll("g.tick").attr("aria-label",q=>q),$!==Ve.NONE&&O===tt.LABELS&&!S){const q=this.services.cartesianScales.getScaleDomain(n);if(q.length>0){const Q=s.select(`g.axis.${n} g.ticks g.tick`).html();l.selectAll("g.ticks g.tick").html(Q);const lt=this;l.selectAll("g.tick text").data(q).text(function(rt){return rt.length>k?(lt.truncation[n]=!0,qi(rt,$,L)):rt}),this.getInvisibleAxisRef().selectAll("g.tick text").data(q).text(function(rt){return rt.length>k?qi(rt,$,L):rt}),l.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),l.selectAll("g.tick text").data(q)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=P.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=_(i,"axes",n),a=_(s,"scaleType"),o=_(s,"truncation","threshold"),l=this;r.selectAll("g.tick text").on("mouseover",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOVER,{event:c,element:N(this),datum:u}),a===tt.LABELS&&u.length>o&&l.services.events.dispatchEvent(A.Tooltip.SHOW,{event:c,hoveredElement:N(this),content:u})}).on("mousemove",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEMOVE,{event:c,element:N(this),datum:u}),a===tt.LABELS&&u.length>o&&l.services.events.dispatchEvent(A.Tooltip.MOVE,{event:c})}).on("click",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_CLICK,{event:c,element:N(this),datum:u})}).on("mouseout",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOUT,{event:c,element:N(this),datum:u}),a===tt.LABELS&&l.services.events.dispatchEvent(A.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,r){const i=Math.floor(t/(n*r));return nm(i,2,An.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;P.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}};class Qk extends Sm{constructor(t,n,r){super(t,n,r)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,r=this.getComponentContainer(),i=P.appendOrSelect(r,`g.axis.${n}`),s=this;i.selectAll("g.tick").each(function(a,o){const l=N(this);l.classed("tick-hover",!0).attr("tabindex",o===0?0:-1);const c=l.select("text"),{width:u,height:h}=P.getSVGElementSize(c,{useBBox:!0}),d=P.appendOrSelect(l,"rect.axis-holder");let f=0,p=0;switch(n){case H.LEFT:f=-u+Number(c.attr("x")),p=-(h/2);break;case H.RIGHT:f=Math.abs(Number(c.attr("x"))),p=-(h/2);break;case H.TOP:f=-(u/2),p=-h+Number(c.attr("y"))/2,s.truncation[n]&&(f=0,d.attr("transform","rotate(-45)"));break;case H.BOTTOM:f=-(u/2),p=h/2-2,s.truncation[n]&&(f=-u,d.attr("transform","rotate(-45)"));break}d.attr("x",f-An.hover.rectanglePadding).attr("y",p).attr("width",u+An.hover.rectanglePadding*2).attr("height",h).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=P.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=_(i,"axes",n),a=_(s,"scaleType"),o=_(s,"truncation","threshold"),l=this;r.selectAll("g.tick.tick-hover").on("mouseover",function(c){const u=N(this).select("text"),h=u.datum();l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOVER,{event:c,element:u,datum:h}),a===tt.LABELS&&h.length>o&&l.services.events.dispatchEvent(A.Tooltip.SHOW,{event:c,element:u,datum:h})}).on("mousemove",function(c){const u=N(this).select("text"),h=u.datum();l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEMOVE,{event:c,element:u,datum:h}),l.services.events.dispatchEvent(A.Tooltip.MOVE,{event:c})}).on("click",function(c){l.services.events.dispatchEvent(A.Axis.LABEL_CLICK,{event:c,element:N(this).select("text"),datum:N(this).select("text").datum()})}).on("mouseout",function(c){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOUT,{event:c,element:N(this).select("text"),datum:N(this).select("text").datum()}),a===tt.LABELS&&l.services.events.dispatchEvent(A.Tooltip.HIDE)}).on("focus",function(c){const u={clientX:0,clientY:0};if(c.target){c.target.focus();const h=c.target.getBoundingClientRect();u.clientX=h.x,u.clientY=h.y}l.services.events.dispatchEvent(A.Axis.LABEL_FOCUS,{event:{...c,...u},element:N(this),datum:N(this).select("text").datum()})}).on("blur",function(c){l.services.events.dispatchEvent(A.Axis.LABEL_BLUR,{event:c,element:N(this),datum:N(this).select("text").datum()})}).on("keydown",function(c){c.key&&c.key==="Escape"&&(l.services.events.dispatchEvent(A.Tooltip.HIDE),l.services.events.dispatchEvent(A.Axis.LABEL_BLUR,{event:c,element:N(this),datum:N(this).select("text").datum()})),n===H.LEFT||n===H.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;P.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 gt{constructor(){super(...arguments),this.type="2D-axes",this.renderType=nt.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},r=Object.keys(H),i=_(this.getOptions(),"axes");r.forEach(a=>{i[H[a]]&&(n[H[a]]=!0)}),this.configs.axes=n,r.forEach(a=>{const o=H[a];if(this.configs.axes[o]&&!this.children[o]){const l={position:o,axes:this.configs.axes,margins:this.margins},c=this.model.axisFlavor===ya.DEFAULT?new Sm(this.model,this.services,l):new Qk(this.model,this.services,l);c.setModel(this.model),c.setServices(this.services),c.setParent(this.parent),this.children[o]=c}}),Object.keys(this.children).forEach(a=>{this.children[a].render(t)});const s={};Object.keys(this.children).forEach(a=>{const o=this.children[a],l=o.configs.position,c=o.getInvisibleAxisRef(),{width:u,height:h}=P.getSVGElementSize(c,{useBBox:!0});let d;switch(o.getTitleRef().empty()?d=0:(d=P.getSVGElementSize(o.getTitleRef(),{useBBox:!0}).height,(l===H.LEFT||l===H.RIGHT)&&(d+=5)),l){case H.TOP:s.top=h+d;break;case H.BOTTOM:s.bottom=h+d;break;case H.LEFT:s.left=u+d;break;case H.RIGHT:s.right=u+d;break}}),this.services.events.dispatchEvent(A.Axis.RENDER_COMPLETE),Object.keys(s).some(a=>this.margins[a]!==s[a])&&(this.margins=Object.assign(this.margins,s),this.model.set({axesMargins:this.margins},{skipUpdate:!0}),this.services.events.dispatchEvent(A.ZoomBar.UPDATE),Object.keys(this.children).forEach(a=>{const o=this.children[a];o.margins=this.margins}),this.render(!0))}}class he extends gt{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=_(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Xt.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Xt.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Xt.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Xt.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===Jt.VERTICAL&&this.drawYGrid(t),n===Jt.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius(),r=0;this.drawRing(n,r,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),r=this.computeInnerRadius();this.drawRing(n,r,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=Be().domain([0,1]).range(t),this.yScale=Be().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:r,height:i}=P.getSVGElementSize(n,{useAttrs:!0});this.backdrop=P.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("width",r).attr("height",i);const s=P.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"),r=_(this.getOptions(),"grid","x","numberOfTicks"),i=this.xScale.ticks(r).map(o=>o*n),s=P.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(i);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"),r=this.backdrop.attr("width"),i=_(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(i).map(l=>l*n),a=P.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",r).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,r=!0){const i=this.parent,{width:s,height:a}=P.getSVGElementSize(i,{useAttrs:!0}),o=P.appendOrSelect(i,"svg.chart-skeleton").attr("width",s).attr("height",a),l=n===0?"pie":"donut",c=_(this.getOptions(),l,"alignment");P.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=Ti().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),h=t+Math.abs(Dt.radiusOffset),d=t+(Math.min(s,a)-t*2)/2,f=P.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${h}, ${d})`).attr("d",u).classed("shimmer-effect-areas",r).classed("empty-state-areas",!r).style("fill",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let p=t+Dt.xOffset;c===Yt.CENTER?p=s/2:c===Yt.RIGHT&&(p=s-t-Dt.xOffset);const m=t+Dt.yOffset;f.attr("transform",`translate(${p}, ${m})`)}computeOuterRadius(){const{width:t,height:n}=P.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+Dt.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const n="stop-bg-shimmer",r="stop-shimmer",i=this.parent.select(".chart-skeleton"),{width:s}=P.getSVGElementSize(this.parent,{useAttrs:!0}),a=0,o=s,l=P.appendOrSelect(i,"defs").lower(),c=P.appendOrSelect(l,"linearGradient").attr("id",this.services.domUtils.generateElementIDString(t)).attr("class",t).attr("x1",a-3*.2*s).attr("x2",o).attr("y1",0).attr("y2",0).attr("gradientUnits","userSpaceOnUse").attr("gradientTransform","translate(0, 0)"),u=`
|
|
75
|
+
</svg>`}destroy(){this.parent.selectAll("path.line,.node-group").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null)}}class Se extends gt{constructor(){super(...arguments),this.type="grid",this.renderType=nt.SVG}render(t=!0){const n=_(this.getOptions(),"grid","x","enabled"),r=_(this.getOptions(),"grid","y","enabled");this.drawBackdrop(n,r),!(!n&&!r)&&(n&&(P.appendOrSelect(this.backdrop,"g.x.grid"),this.drawXGrid(t)),r&&(P.appendOrSelect(this.backdrop,"g.y.grid"),this.drawYGrid(t)))}drawXGrid(t){const n=this.parent,r=this.backdrop.attr("height"),i=this.services.cartesianScales.getMainXScale(),s=lo(i).tickSizeInner(-r).tickSizeOuter(0);if(_(this.getOptions(),"grid","x","alignWithAxisTicks")){const o=this.services.cartesianScales.getDomainAxisPosition(),l=_(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=_(this.getOptions(),"grid","x","numberOfTicks");s.ticks(o)}const a=n.select(".x.grid").attr("transform",`translate(${-this.backdrop.attr("x")}, ${r})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}drawYGrid(t){const n=this.parent,r=this.backdrop.attr("width"),i=this.services.cartesianScales.getMainYScale(),s=cu(i).tickSizeInner(-r).tickSizeOuter(0);if(_(this.getOptions(),"grid","y","alignWithAxisTicks")){const o=this.services.cartesianScales.getRangeAxisPosition(),l=_(this.getOptions(),"axes",o,"ticks","values");l&&s.tickValues(l)}else{const o=_(this.getOptions(),"grid","y","numberOfTicks");s.ticks(o)}const a=n.select(".y.grid").attr("transform",`translate(0, ${-this.backdrop.attr("y")})`);t?a.transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"grid-update",animate:t})).call(s):a.call(s),this.cleanGrid(a)}getGridlineThreshold(t){const n=this.parent,r=n.selectAll(".x.grid .tick").nodes().sort((u,h)=>Number(bn(u).tx)-Number(bn(h).tx));let i=-1;if(!r.length)return;r.forEach(u=>{t[0]>=+bn(u).tx&&i++});const s=i+1<r.length?i+1:r.length,a=r[i],o=r[s];let l;if(!a)l=+bn(o).tx;else if(o)l=+bn(o).tx-+bn(a).tx;else{const u=n.select("rect.chart-grid-backdrop").node();l=P.getSVGElementSize(u).width-+bn(a).tx}const{threshold:c}=this.getOptions().tooltip.gridline;return l*c}getActiveGridline(t){const n=_(this.getOptions,"tooltip","gridline","threshold"),r=n||this.getGridlineThreshold(t);return this.parent.selectAll(".x.grid .tick").filter(function(){const i=bn(this),s={min:Number(i.tx)-r,max:Number(i.tx)+r};return s.min<=t[0]&&t[0]<=s.max})}drawBackdrop(t,n){const r=this.parent,i=this.services.cartesianScales.getMainXScale(),s=this.services.cartesianScales.getMainYScale(),[a,o]=i.range(),[l,c]=s.range();this.backdrop=P.appendOrSelect(r,"svg.chart-grid-backdrop");const u=P.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 _m extends gt{constructor(){super(...arguments),this.type="area",this.renderType=nt.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(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-area"})).attr("opacity",r=>r.name!==n.datum().name?pn.opacity.unselected:pn.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",pn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions();let i=[0,0];const{cartesianScales:s}=this.services,a=s.getOrientation(),o=Al().curve(this.services.curves.getD3Curve()).defined(E=>{const T=s.getRangeIdentifier();return E[T]!=null}),l=this.model.getGroupedData(this.configs.groups),c=_(r,"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 h=0;const d=(E,T)=>{_(r,"axes",E,"includeZero")===!1&&T[0]>0&&T[1]>0&&(h=T[0])},f=E=>u?s.getBoundedScaledValues(E)[0]:s.getRangeValue(h),p=E=>u?s.getBoundedScaledValues(E)[1]:s.getRangeValue(E);a===Jt.VERTICAL?(i=s.getMainYScale().domain(),d(s.getMainYAxisPosition(),i),o.x(E=>s.getDomainValue(E)).y0(E=>f(E)).y1(E=>p(E))):(i=s.getMainXScale().domain(),d(s.getMainXAxisPosition(),i),o.x0(E=>f(E)).x1(E=>p(E)).y(E=>s.getDomainValue(E)));const m=_(r,"color","gradient","enabled"),g=l&&l.length===1&&m;l.length>1&&m&&console.error("Gradients can only be enabled when having 1 single dataset");const v=n.selectAll("path.area").data(l,E=>E.name),b=N(this.services.domUtils.getMainContainer());if(v.exit().attr("opacity",0).remove(),!l.length)return;if(g){const E=b.select(`path.${this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:l[0].name})}`).node();let T;if(E)T=getComputedStyle(E,null).getPropertyValue("stroke");else{const S=_(this.model.getOptions(),"color","scale");if(S!==null){const $=Object.keys(S);T=S[$[0]]}}mc.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:mc.getStops(i,T)})}else this.parent.selectAll("defs linearGradient").empty()||this.parent.selectAll("defs linearGradient").each(function(){this.parentNode.remove()});const w=this,O=v.enter().append("path");g?O.merge(v).style("fill",E=>`url(#${this.services.domUtils.generateElementIDString(`${E.name.replace(" ","")}_${this.gradient_id}`)})`).attr("class","area").attr("class",E=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:E.name,originalClassName:"area"})).attr("d",E=>{const{data:T}=E;return o(T)}):(O.attr("opacity",0).merge(v).attr("class","area").attr("class",E=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:E.name,originalClassName:"area"})).style("fill",E=>w.model.getFillColor(E.name)).transition().call(E=>this.services.transitions.setupTransition({transition:E,name:"area-update-enter",animate:t})).attr("opacity",u?1:pn.opacity.selected).attr("d",E=>{const{data:T}=E;return o(T)}),u&&O.attr("fill-opacity",pn.opacity.selected).style("stroke",E=>w.model.getStrokeColor(E.name)).style("stroke-dasharray","2, 2").attr("stroke-width",.7+"px"))}destroy(){const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class zr extends gt{constructor(){super(...arguments),this.type="line",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("path.line").transition("legend-hover-line").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-line"})).attr("opacity",r=>r.name!==n.datum().name?gn.opacity.unselected:gn.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",gn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{cartesianScales:r,curves:i}=this.services,s=f=>r.getDomainValue(f),a=f=>r.getRangeValue(f),[o,l]=xn(s,a,r.getOrientation()),c=this.getOptions(),u=Mi().x(o).y(l).curve(i.getD3Curve()).defined(f=>{const p=r.getRangeIdentifier(f);return f[p]!=null});let h=[];if(this.configs.stacked){const f=Object.keys(c.axes).some(m=>c.axes[m].percentage),{groupMapsTo:p}=c.data;h=this.model.getStackedData({groups:this.configs.groups,percentage:f}).map(m=>{const g=this.services.cartesianScales.getDomainIdentifier(m),v=this.services.cartesianScales.getRangeIdentifier(m);return{name:_(m,0,p),data:m.map(b=>({[g]:b.data.sharedStackKey,[p]:b[p],[v]:b[1]})),hidden:!DD(m,b=>b[0]!==b[1])}})}else h=this.model.getGroupedData(this.configs.groups);const d=n.selectAll("path.line").data(h,f=>f.name);d.exit().attr("opacity",0).remove(),d.enter().append("path").classed("line",!0).attr("opacity",0).merge(d).data(h,f=>f.name).attr("class",f=>this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:f.name,originalClassName:"line"})).style("stroke",f=>this.model.getStrokeColor(f.name)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","line").attr("aria-label",f=>{const{data:p}=f;return p.map(m=>{const g=this.services.cartesianScales.getRangeIdentifier(m);return m[g]}).join(",")}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"line-update-enter",animate:t})).attr("opacity",f=>f.hidden?0:1).attr("d",f=>{const{data:p}=f;return u(p)})}destroy(){const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}const Em=5;function Kk(e,t){return e>t-Em&&e<t+Em}let kn=class extends gt{constructor(){super(...arguments),this.type="ruler",this.renderType=nt.SVG,this.isXGridEnabled=_(this.getOptions(),"grid","x","enabled"),this.isYGridEnabled=_(this.getOptions(),"grid","y","enabled"),this.isEventListenerAdded=!1}render(t=!1){const n=_(this.getOptions(),"ruler","enabled");this.drawBackdrop(),n&&!this.isEventListenerAdded?this.addBackdropEventListeners():!n&&this.isEventListenerAdded&&this.removeBackdropEventListeners()}removeBackdropEventListeners(){this.isEventListenerAdded=!1,this.backdrop.on("mousemove mouseover mouseout",null)}formatTooltipData(t){return t}showRuler(t,[n,r]){const i=this.parent,s=this.services.cartesianScales.getOrientation(),a=this.model.getDisplayData(),o=this.services.cartesianScales.getRangeScale(),[l,c]=o.range(),u=s===Jt.HORIZONTAL?r:n,h=P.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),d=P.appendOrSelect(h,"line.ruler-line"),f=i.selectAll("[role=graphics-symbol]"),p=a.map(g=>({domainValue:this.services.cartesianScales.getDomainValue(g),originalData:g})).filter(g=>Kk(g.domainValue,u));if(this.pointsWithinLine&&p.length===this.pointsWithinLine.length&&p.map(g=>g.domainValue).join()===this.pointsWithinLine.map(g=>g.domainValue).join())return this.pointsWithinLine=p,this.services.events.dispatchEvent(A.Tooltip.MOVE,{mousePosition:[n,r]});this.pointsWithinLine=p;const m=this.pointsWithinLine.reduce((g,v)=>{if(g.length===0)return g.push(v),g;const b=g[0].domainValue,w=Math.abs(u-v.domainValue),O=Math.abs(u-b);return w>O||(w<O?g=[v]:g.push(v)),g},[]);if(m.length>0){const g=m.map(O=>O.originalData).filter(O=>{const E=this.services.cartesianScales.getRangeIdentifier(O);return O[E]!=null}),v=m.map(O=>O.domainValue),b=f.filter(O=>{const E=this.services.cartesianScales.getDomainValue(O);return v.includes(E)});this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!rm(this.elementsToHighlight,b)&&this.hideRuler(),b.dispatch("mouseover"),this.elementsToHighlight=b,this.services.events.dispatchEvent(A.Tooltip.SHOW,{mousePosition:[n,r],hoveredElement:d,data:this.formatTooltipData(g)}),h.attr("opacity",1);const w=m[0];s==="horizontal"?d.attr("x1",c).attr("x2",l).attr("y1",w.domainValue).attr("y2",w.domainValue):d.attr("y1",c).attr("y2",l).attr("x1",w.domainValue).attr("x2",w.domainValue)}else this.hideRuler()}hideRuler(){const t=this.parent,n=P.appendOrSelect(t,"g.ruler");t.selectAll("[role=graphics-symbol]").dispatch("mouseout"),this.services.events.dispatchEvent(A.Tooltip.HIDE),n.attr("opacity",0)}addBackdropEventListeners(){this.isEventListenerAdded=!0;const t=this,n=this.services.domUtils.getHolder(),r=this.model.getDisplayData();let i=function(s){const a=Un(s,t.parent.node());t.showRuler(s,a)};if(r.length>100){const s=r.length%50*12.5;i=I2(function(a){const{mousePosition:o}=this;t.showRuler(a,o)},s,n)}this.backdrop.on("mousemove mouseover",i).on("mouseout",this.hideRuler.bind(this))}drawBackdrop(){const t=this.parent;this.backdrop=P.appendOrSelect(t,"svg.chart-grid-backdrop")}};class tn extends gt{constructor(){super(...arguments),this.type="scatter",this.renderType=nt.SVG,this.handleChartHolderOnHover=()=>{if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("chart-holder-hover-scatter").call(t=>{var n;return(n=this.services.transitions)==null?void 0:n.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=>{var n;return(n=this.services.transitions)==null?void 0:n.setupTransition({transition:t,name:"chart-holder-mouseout-scatter"})}).attr("opacity",0)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle.dot").transition("legend-hover-scatter").call(i=>{var s;return(s=this.services.transitions)==null?void 0:s.setupTransition({transition:i,name:"legend-hover-scatter"})}).attr("opacity",i=>i[r]!==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=>{var n;return(n=this.services.transitions)==null?void 0:n.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(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut);const{fadeInOnChartHolderMouseover:n}=this.configs;n&&(t.addEventListener(A.Chart.MOUSEOVER,this.handleChartHolderOnHover),t.addEventListener(A.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut))}filterBasedOnZoomDomain(t){const{cartesianScales:n}=this.services;if(!n)throw new Error("Services cartesianScales are undefined.");const r=n.getDomainIdentifier(t),i=this.model.get("zoomDomain");return i!==void 0?t.filter(s=>s[r].getTime()>=i[0].getTime()&&s[r].getTime()<=i[1].getTime()):t}getScatterData(){const t=this.getOptions(),{stacked:n}=this.configs;let r;if(n){const i=Object.keys(t.axes).some(s=>t.axes[s].percentage);r=this.model.getStackedData({groups:this.configs.groups,percentage:i})}else{const{cartesianScales:i}=this.services;if(!i)throw new Error("Services cartesianScales are undefined.");r=this.model.getDisplayData(this.configs.groups).filter(s=>{const a=i.getRangeIdentifier(s);return s[a]!==void 0&&s[a]!==null})}return this.filterBasedOnZoomDomain(r)}render(t){if(!(_(this.getOptions(),"points","enabled")||_(this.getOptions(),"bubble","enabled")))return;const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services;if(!s)throw new Error("Services cartesianScales are undefined.");const a=s.getDomainIdentifier(),o=n.selectAll("circle.dot").data(this.getScatterData(),c=>`${c[i]}-${c[a]}`);o.exit().attr("opacity",0).remove();const l=o.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(o);this.styleCircles(l,t),this.addEventListeners()}isDatapointThresholdAnomaly(t){const{handleThresholds:n}=this.configs;if(!n)return!1;const{cartesianScales:r}=this.services;if(!r)throw new Error("Cartesian scales service is undefined");const i=r.getOrientation(),[s,a]=xn(r.getHighestDomainThreshold(),r.getHighestRangeThreshold(),i),[o,l]=xn(h=>r.getDomainValue(h),h=>r.getRangeValue(h),i),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 r=this.getOptions(),{filled:i,fillOpacity:s}=r.points,{cartesianScales:a}=this.services;if(!a)throw new Error("Cartesian scales service is undefined");const{groupMapsTo:o}=r.data,l=f=>a.getDomainValue(f),c=f=>a.getRangeValue(f),[u,h]=xn(l,c,a.getOrientation()),{fadeInOnChartHolderMouseover:d}=this.configs;t.raise().classed("dot",!0).attr("class",f=>{const p=a.getDomainIdentifier(f),m=this.model.getIsFilled(f[o],f[p],f,i)?[st.FILL,st.STROKE]:[st.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,i)}).classed("unfilled",f=>{const p=a.getDomainIdentifier(f);return!this.model.getIsFilled(f[o],f[p],f,i)}).transition().call(f=>{var p;return(p=this.services.transitions)==null?void 0:p.setupTransition({transition:f,name:"scatter-update-enter",animate:n})}).attr("cx",u).attr("cy",h).attr("r",r.points.radius).style("fill",f=>{const p=a.getDomainIdentifier(f);if(this.model.getIsFilled(f[o],f[p],f,i))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",i?s:1).attr("opacity",d?0:1).attr("role",dt.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;if(!this.parent)throw new Error("Parent not defined");this.parent.selectAll("circle").on("mouseover",function(r,i){var s,a;const o=N(this);o.classed("hovered",!0).attr("class",l=>t.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:l[n],originalClassName:o.attr("class")})).style("fill",l=>{var c;const u=(c=t.services.cartesianScales)==null?void 0:c.getDomainIdentifier(l);return t.model.getFillColor(l[n],l[u],l)}).classed("unfilled",!1),(s=t.services.events)==null||s.dispatchEvent(A.Tooltip.SHOW,{event:r,hoveredElement:o,data:[i],additionalItems:t.getTooltipAdditionalItems(i)}),(a=t.services.events)==null||a.dispatchEvent(A.Scatter.SCATTER_MOUSEOVER,{event:r,element:o,datum:i})}).on("mousemove",function(r,i){var s,a;const o=N(this);(s=t.services.events)==null||s.dispatchEvent(A.Scatter.SCATTER_MOUSEMOVE,{event:r,element:o,datum:i}),(a=t.services.events)==null||a.dispatchEvent(A.Tooltip.MOVE,{event:r})}).on("click",function(r,i){var s;(s=t.services.events)==null||s.dispatchEvent(A.Scatter.SCATTER_CLICK,{event:r,element:N(this),datum:i})}).on("mouseout",function(r,i){var s,a,o;const l=N(this);if(l.classed("hovered",!1),!t.configs.filled){const{filled:c}=t.getOptions().points,u=(s=t.services.cartesianScales)==null?void 0:s.getDomainIdentifier(i),h=t.model.getIsFilled(i[n],i[u],i,c);l.classed("unfilled",!h).style("fill",d=>h||c?t.model.getFillColor(d[n],d[u],d):null)}(a=t.services.events)==null||a.dispatchEvent(A.Scatter.SCATTER_MOUSEOUT,{event:r,element:l,datum:i}),(o=t.services.events)==null||o.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:l})})}destroy(){var t;(t=this.parent)==null||t.selectAll("circle").on("mousemove",null).on("mouseout",null);const{events:n}=this.services;if(!n)throw new Error("Services events undefined");n.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),n.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),n.removeEventListener(A.Chart.MOUSEOVER,this.handleChartHolderOnHover),n.removeEventListener(A.Chart.MOUSEOUT,this.handleChartHolderOnMouseOut)}}let Sm=class extends gt{constructor(t,n,r){super(t,n,r),this.type="axes",this.renderType=nt.SVG,this.truncation={[H.LEFT]:!1,[H.RIGHT]:!1,[H.TOP]:!1,[H.BOTTOM]:!1},r&&(this.configs=r),this.margins=this.configs.margins}render(t=!0){const{position:n}=this.configs,r=this.getOptions(),i=_(r,"axes",n,"visible"),s=this.getComponentContainer(),{width:a,height:o}=P.getSVGElementSize(s,{useAttrs:!0}),l=P.appendOrSelect(s,`g.axis.${n}`);let c,u;if(n===H.BOTTOM||n===H.TOP?(c=this.configs.axes[H.LEFT]?this.margins.left:0,u=this.configs.axes[H.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 h=this.services.cartesianScales.getScaleByPosition(n);this.scaleType===tt.LABELS||this.scaleType===tt.LABELS_RATIO?h.rangeRound([c,u]):h.range([c,u]);let d;switch(n){case H.LEFT:d=cu;break;case H.BOTTOM:d=lo;break;case H.RIGHT:d=Wv;break;case H.TOP:d=jv;break}l.attr("aria-label",`${n} axis`);const f=!l.select("g.ticks").empty();let p=P.appendOrSelect(l,"g.ticks");f||(p.attr("role",`${dt.GRAPHICS_OBJECT} ${dt.GROUP}`),p.attr("aria-label",`${n} ticks`));const m=P.appendOrSelect(l,"g.ticks.invisible").style("opacity","0").style("pointer-events","none").attr("aria-hidden",!0).attr("aria-label",`invisible ${n} ticks`),g=_(r,"axes",n),v=this.scaleType===tt.TIME||g.scaleType===tt.TIME,b=n===H.LEFT||n===H.RIGHT,w=this.model.get("zoomDomain");if(w&&v&&!b&&h.domain(w),!i){p.attr("aria-hidden",!0);return}const O=_(g,"scaleType"),E=_(r,"data","loading"),T=_(g,"ticks","number"),S=_(g,"ticks","values"),$=_(g,"truncation","type"),k=_(g,"truncation","threshold"),L=_(g,"truncation","numCharacter"),M=T!==null,V=_(r,"timeScale"),x=P.appendOrSelect(m,"g.tick"),C=P.appendOrSelect(x,"text").text("0"),y=P.getSVGElementSize(C.node(),{useBBox:!0}).height;x.remove();const R=this.scaleType||g.scaleType||tt.LINEAR,I=d(h).tickSizeOuter(0);if(h.ticks){let q;if(M?q=T:(q=An.ticks.number,b&&(q=this.getNumberOfFittingTicks(o,y,An.ticks.verticalSpaceRatio))),h.ticks().length===1&&h.ticks()[0]===0&&(q=0),I.ticks(q),v)if(!h.ticks(q).length)I.tickValues([]);else{const Q=_(r,"timeScale","addSpaceOnEdges"),lt=_(r,"axes",n,"domain"),rt=h.copy();Q&&!lt&&rt.nice(q);const ot=rt.ticks(q);Q&&ot.length>2&&!lt&&(ot.splice(ot.length-1,1),ot.splice(0,1)),I.tickValues(ot)}}let B;const U=_(g,"ticks","formatter");if(v){const q=fc(I.tickValues(),_(r,"timeScale","timeInterval"));U===null?B=(Q,lt)=>dc(Q,lt,I.tickValues(),q,V):B=(Q,lt)=>{const rt=dc(Q,lt,I.tickValues(),q,V);return U(Q,lt,rt)}}else U===null?R===tt.LINEAR&&(B=q=>q.toLocaleString()):B=U;I.tickFormat(B);const[z,j]=this.services.cartesianScales.getScaleByPosition(n).domain();let G;if(S){if(v)S.forEach((q,Q)=>{q.getTime===void 0&&(S[Q]=new Date(q))}),G=S.filter(q=>{const Q=q.getTime();return Q>=new Date(z).getTime()&&Q<=new Date(j).getTime()});else if(O===tt.LABELS){const q=this.services.cartesianScales.getScaleByPosition(n).domain();G=S.filter(Q=>q.includes(Q))}else G=S.filter(q=>q>=z&&q<=j);I.tickValues(G)}switch(n){case H.LEFT:p.attr("transform",`translate(${this.margins.left}, 0)`);break;case H.BOTTOM:p.attr("transform",`translate(0, ${o-this.margins.bottom})`);break;case H.RIGHT:p.attr("transform",`translate(${a-this.margins.right}, 0)`);break;case H.TOP:p.attr("transform",`translate(0, ${this.margins.top})`);break}const et=this.model.isDataEmpty();if(g.title){const q=P.appendOrSelect(l,"text.axis-title").html(et||E?"":g.title),Q=_(g,"titleOrientation");let lt;switch(n){case H.LEFT:Q===Ul.RIGHT?q.attr("transform","rotate(90)").attr("y",0).attr("x",h.range()[0]/2).attr("dy","-0.5em").style("text-anchor","middle"):q.attr("transform","rotate(-90)").attr("y",0).attr("x",-(h.range()[0]/2)).attr("dy","0.75em").style("text-anchor","middle");break;case H.BOTTOM:q.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${o+4})`).style("text-anchor","middle");break;case H.RIGHT:Q===Ul.LEFT?q.attr("transform","rotate(-90)").attr("y",a).attr("x",-(h.range()[0]/2)).style("text-anchor","middle"):q.attr("transform","rotate(90)").attr("y",-a).attr("x",h.range()[0]/2).attr("dy","0.75em").style("text-anchor","middle");break;case H.TOP:lt=P.getSVGElementSize(q,{useBBox:!0}).height,q.attr("transform",`translate(${this.margins.left/2+h.range()[1]/2}, ${lt/2})`).style("text-anchor","middle");break}}if(v){const q=fc(I.tickValues(),_(r,"timeScale","timeInterval")),Q=V.showDayName,lt=p;t&&(p=p.transition().call(rt=>this.services.transitions.setupTransition({transition:rt,name:"axis-update",animate:t}))),p=p.call(I),lt.selectAll(".tick").data(I.tickValues(),h).order().select("text").style("font-weight",(rt,ot)=>gg(rt,ot,I.tickValues(),q,Q)?"bold":"normal")}else!t||!f?p=p.call(I):p=p.transition().call(q=>this.services.transitions.setupTransition({transition:q,name:"axis-update",animate:t})).call(I);if(m.call(I),n===H.BOTTOM||n===H.TOP){let q=!1;const Q=_(g,"ticks","rotation");if(Q===ma.ALWAYS)q=!0;else if(Q===ma.NEVER)q=!1;else if(!Q||Q===ma.AUTO)if(h.step)q=m.selectAll("g.tick text").nodes().some(lt=>P.getSVGElementSize(lt,{useBBox:!0}).width>=h.step());else{q=!1;const lt=m.append("text").text("A"),rt=P.getSVGElementSize(lt.node(),{useBBox:!0}).width;let ot;m.selectAll("g.tick").each(function(){const Y=N(this),X=parseFloat(_(bn(this),"tx"));X!==null&&ot+Y.text().length*rt*.8>=X&&(q=!0),ot=X}),lt.remove()}q?(M||(I.ticks(this.getNumberOfFittingTicks(a,y,An.ticks.horizontalSpaceRatio)),m.call(I),p.call(I)),l.selectAll("g.ticks g.tick text").attr("transform","rotate(-45)").attr("text-anchor",n===H.TOP?"start":"end")):l.selectAll("g.ticks g.tick text").attr("transform",null).attr("text-anchor",null)}if(E?l.attr("opacity",0):l.attr("opacity",1),p.selectAll("g.tick").attr("aria-label",q=>q),m.selectAll("g.tick").attr("aria-label",q=>q),$!==Ve.NONE&&O===tt.LABELS&&!S){const q=this.services.cartesianScales.getScaleDomain(n);if(q.length>0){const Q=s.select(`g.axis.${n} g.ticks g.tick`).html();l.selectAll("g.ticks g.tick").html(Q);const lt=this;l.selectAll("g.tick text").data(q).text(function(rt){return rt.length>k?(lt.truncation[n]=!0,qi(rt,$,L)):rt}),this.getInvisibleAxisRef().selectAll("g.tick text").data(q).text(function(rt){return rt.length>k?qi(rt,$,L):rt}),l.selectAll("g.ticks").html(this.getInvisibleAxisRef().html()),l.selectAll("g.tick text").data(q)}}this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=P.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=_(i,"axes",n),a=_(s,"scaleType"),o=_(s,"truncation","threshold"),l=this;r.selectAll("g.tick text").on("mouseover",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOVER,{event:c,element:N(this),datum:u}),a===tt.LABELS&&u.length>o&&l.services.events.dispatchEvent(A.Tooltip.SHOW,{event:c,hoveredElement:N(this),content:u})}).on("mousemove",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEMOVE,{event:c,element:N(this),datum:u}),a===tt.LABELS&&u.length>o&&l.services.events.dispatchEvent(A.Tooltip.MOVE,{event:c})}).on("click",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_CLICK,{event:c,element:N(this),datum:u})}).on("mouseout",function(c,u){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOUT,{event:c,element:N(this),datum:u}),a===tt.LABELS&&l.services.events.dispatchEvent(A.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,r){const i=Math.floor(t/(n*r));return nm(i,2,An.ticks.number)}destroy(){const t=this.getComponentContainer(),{position:n}=this.configs;P.appendOrSelect(t,`g.axis.${n}`).selectAll("g.tick text").on("mouseover",null).on("mousemove",null).on("mouseout",null)}};class Qk extends Sm{constructor(t,n,r){super(t,n,r)}render(t=!0){super.render(t),super.destroy();const n=this.configs.position,r=this.getComponentContainer(),i=P.appendOrSelect(r,`g.axis.${n}`),s=this;i.selectAll("g.tick").each(function(a,o){const l=N(this);l.classed("tick-hover",!0).attr("tabindex",o===0?0:-1);const c=l.select("text"),{width:u,height:h}=P.getSVGElementSize(c,{useBBox:!0}),d=P.appendOrSelect(l,"rect.axis-holder");let f=0,p=0;switch(n){case H.LEFT:f=-u+Number(c.attr("x")),p=-(h/2);break;case H.RIGHT:f=Math.abs(Number(c.attr("x"))),p=-(h/2);break;case H.TOP:f=-(u/2),p=-h+Number(c.attr("y"))/2,s.truncation[n]&&(f=0,d.attr("transform","rotate(-45)"));break;case H.BOTTOM:f=-(u/2),p=h/2-2,s.truncation[n]&&(f=-u,d.attr("transform","rotate(-45)"));break}d.attr("x",f-An.hover.rectanglePadding).attr("y",p).attr("width",u+An.hover.rectanglePadding*2).attr("height",h).lower()}),this.addEventListeners()}addEventListeners(){const t=this.getComponentContainer(),{position:n}=this.configs,r=P.appendOrSelect(t,`g.axis.${n}`),i=this.getOptions(),s=_(i,"axes",n),a=_(s,"scaleType"),o=_(s,"truncation","threshold"),l=this;r.selectAll("g.tick.tick-hover").on("mouseover",function(c){const u=N(this).select("text"),h=u.datum();l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOVER,{event:c,element:u,datum:h}),a===tt.LABELS&&h.length>o&&l.services.events.dispatchEvent(A.Tooltip.SHOW,{event:c,element:u,datum:h})}).on("mousemove",function(c){const u=N(this).select("text"),h=u.datum();l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEMOVE,{event:c,element:u,datum:h}),l.services.events.dispatchEvent(A.Tooltip.MOVE,{event:c})}).on("click",function(c){l.services.events.dispatchEvent(A.Axis.LABEL_CLICK,{event:c,element:N(this).select("text"),datum:N(this).select("text").datum()})}).on("mouseout",function(c){l.services.events.dispatchEvent(A.Axis.LABEL_MOUSEOUT,{event:c,element:N(this).select("text"),datum:N(this).select("text").datum()}),a===tt.LABELS&&l.services.events.dispatchEvent(A.Tooltip.HIDE)}).on("focus",function(c){const u={clientX:0,clientY:0};if(c.target){c.target.focus();const h=c.target.getBoundingClientRect();u.clientX=h.x,u.clientY=h.y}l.services.events.dispatchEvent(A.Axis.LABEL_FOCUS,{event:{...c,...u},element:N(this),datum:N(this).select("text").datum()})}).on("blur",function(c){l.services.events.dispatchEvent(A.Axis.LABEL_BLUR,{event:c,element:N(this),datum:N(this).select("text").datum()})}).on("keydown",function(c){c.key&&c.key==="Escape"&&(l.services.events.dispatchEvent(A.Tooltip.HIDE),l.services.events.dispatchEvent(A.Axis.LABEL_BLUR,{event:c,element:N(this),datum:N(this).select("text").datum()})),n===H.LEFT||n===H.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;P.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 gt{constructor(){super(...arguments),this.type="2D-axes",this.renderType=nt.SVG,this.children={},this.thresholds=[],this.margins={top:0,right:0,bottom:0,left:0}}render(t=!1){const n={},r=Object.keys(H),i=_(this.getOptions(),"axes");r.forEach(a=>{i[H[a]]&&(n[H[a]]=!0)}),this.configs.axes=n,r.forEach(a=>{const o=H[a];if(this.configs.axes[o]&&!this.children[o]){const l={position:o,axes:this.configs.axes,margins:this.margins},c=this.model.axisFlavor===ya.DEFAULT?new Sm(this.model,this.services,l):new Qk(this.model,this.services,l);c.setModel(this.model),c.setServices(this.services),c.setParent(this.parent),this.children[o]=c}}),Object.keys(this.children).forEach(a=>{this.children[a].render(t)});const s={};Object.keys(this.children).forEach(a=>{const o=this.children[a],l=o.configs.position,c=o.getInvisibleAxisRef(),{width:u,height:h}=P.getSVGElementSize(c,{useBBox:!0});let d;switch(o.getTitleRef().empty()?d=0:(d=P.getSVGElementSize(o.getTitleRef(),{useBBox:!0}).height,(l===H.LEFT||l===H.RIGHT)&&(d+=5)),l){case H.TOP:s.top=h+d;break;case H.BOTTOM:s.bottom=h+d;break;case H.LEFT:s.left=u+d;break;case H.RIGHT:s.right=u+d;break}}),this.services.events.dispatchEvent(A.Axis.RENDER_COMPLETE),Object.keys(s).some(a=>this.margins[a]!==s[a])&&(this.margins=Object.assign(this.margins,s),this.model.set({axesMargins:this.margins},{skipUpdate:!0}),this.services.events.dispatchEvent(A.ZoomBar.UPDATE),Object.keys(this.children).forEach(a=>{const o=this.children[a];o.margins=this.margins}),this.render(!0))}}class he extends gt{constructor(){super(...arguments),this.type="skeleton"}render(t=!0){const n=_(this.getOptions(),"data","loading");n?this.renderSkeleton(n):this.removeSkeleton()}renderSkeleton(t){if(this.configs.skeleton===Xt.GRID)this.renderGridSkeleton(t);else if(this.configs.skeleton===Xt.VERT_OR_HORIZ)this.renderVertOrHorizSkeleton(t);else if(this.configs.skeleton===Xt.PIE)this.renderPieSkeleton(t);else if(this.configs.skeleton===Xt.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===Jt.VERTICAL&&this.drawYGrid(t),n===Jt.HORIZONTAL&&this.drawXGrid(t),this.setShimmerEffect("shimmer-lines")}renderPieSkeleton(t){const n=this.computeOuterRadius(),r=0;this.drawRing(n,r,t),t&&this.setShimmerEffect("shimmer-areas")}renderDonutSkeleton(t){const n=this.computeOuterRadius(),r=this.computeInnerRadius();this.drawRing(n,r,t),t&&this.setShimmerEffect("shimmer-areas")}setScales(){const t=this.services.cartesianScales.getMainXScale().range(),n=this.services.cartesianScales.getMainYScale().range();this.xScale=Be().domain([0,1]).range(t),this.yScale=Be().domain([0,1]).range(n)}drawBackdrop(t){const n=this.parent,{width:r,height:i}=P.getSVGElementSize(n,{useAttrs:!0});this.backdrop=P.appendOrSelect(n,"svg.chart-skeleton.DAII").attr("width",r).attr("height",i);const s=P.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"),r=_(this.getOptions(),"grid","x","numberOfTicks"),i=this.xScale.ticks(r).map(o=>o*n),s=P.appendOrSelect(this.backdrop,"g.x.skeleton"),a=s.selectAll("line").data(i);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"),r=this.backdrop.attr("width"),i=_(this.getOptions(),"grid","y","numberOfTicks"),s=this.xScale.ticks(i).map(l=>l*n),a=P.appendOrSelect(this.backdrop,"g.y.skeleton"),o=a.selectAll("line").data(s);o.enter().append("line").merge(o).attr("x1",0).attr("x2",r).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,r=!0){const i=this.parent,{width:s,height:a}=P.getSVGElementSize(i,{useAttrs:!0}),o=P.appendOrSelect(i,"svg.chart-skeleton").attr("width",s).attr("height",a),l=n===0?"pie":"donut",c=_(this.getOptions(),l,"alignment");P.appendOrSelect(o,"rect.chart-skeleton-area-container").attr("width",s).attr("height",a).attr("fill","none");const u=Ti().innerRadius(n).outerRadius(t).startAngle(0).endAngle(Math.PI*2),h=t+Math.abs(Dt.radiusOffset),d=t+(Math.min(s,a)-t*2)/2,f=P.appendOrSelect(o,"path").attr("class","skeleton-area-shape").attr("transform",`translate(${h}, ${d})`).attr("d",u).classed("shimmer-effect-areas",r).classed("empty-state-areas",!r).style("fill",r?`url(#${this.services.domUtils.generateElementIDString("shimmer-areas")})`:null);let p=t+Dt.xOffset;c===Yt.CENTER?p=s/2:c===Yt.RIGHT&&(p=s-t-Dt.xOffset);const m=t+Dt.yOffset;f.attr("transform",`translate(${p}, ${m})`)}computeOuterRadius(){const{width:t,height:n}=P.getSVGElementSize(this.parent,{useAttrs:!0});return Math.min(t,n)/2+Dt.radiusOffset}computeInnerRadius(){return this.computeOuterRadius()*(3/4)}setShimmerEffect(t){const n="stop-bg-shimmer",r="stop-shimmer",i=this.parent.select(".chart-skeleton"),{width:s}=P.getSVGElementSize(this.parent,{useAttrs:!0}),a=0,o=s,l=P.appendOrSelect(i,"defs").lower(),c=P.appendOrSelect(l,"linearGradient").attr("id",this.services.domUtils.generateElementIDString(t)).attr("class",t).attr("x1",a-3*.2*s).attr("x2",o).attr("y1",0).attr("y2",0).attr("gradientUnits","userSpaceOnUse").attr("gradientTransform","translate(0, 0)"),u=`
|
|
76
76
|
<stop class="${n}" offset="${a}"></stop>
|
|
77
77
|
<stop class="${r}" offset="${a+.2}"></stop>
|
|
78
78
|
<stop class="${n}" offset="${a+2*.2}"></stop>
|
|
79
|
-
`;c.html(u),h();function h(){c.attr("gradientTransform",`translate(${a-3*.2*s}, 0)`).transition().duration(2e3).delay(1e3).ease(ub).attr("gradientTransform",`translate(${o+3*.2*s}, 0)`).on("end",h)}}removeSkeleton(){this.parent.select(".chart-skeleton").remove()}}class Jk extends gt{constructor(){super(...arguments),this.type="boxplot",this.renderType=nt.SVG}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getDataGroupNames(),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),[l,c]=a.range(),[u,h]=o.range(),d=c-l,f=u-h;if(d===0)return;const{cartesianScales:p}=this.services,m=p.getOrientation(),g=m===Jt.VERTICAL,[v,b]=xn(M=>this.services.cartesianScales.getDomainValue(M),M=>this.services.cartesianScales.getRangeValue(M),m),w=Math.floor((g?d:f)/s.length),O=Math.min(w/2,16),E=this.model.getBoxplotData(),T=n.selectAll(".box-group").data(E);T.exit().remove();const S=T.enter().append("g").attr("class","box-group"),$=T.merge(S);S.append("path").merge(T.select("path.vertical-line.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"vertical-line start"})).attr("stroke-width",Ce.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalstartline",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i]),x=V,C=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.quartiles.q_25);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.vertical-line.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"vertical-line end"})).attr("stroke-width",Ce.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalendline",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i]),x=V,C=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.quartiles.q_75);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.box")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],originalClassName:"box"})).attr("fill-opacity",Ce.box.opacity.default).attr("stroke-width",Ce.strokeWidth.default).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","box").attr("aria-label",M=>M[i]).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-quartiles",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/2,x=V+O,C=p.getRangeValue(Math[g?"max":"min"](M.quartiles.q_75,M.quartiles.q_25)),y=C+Math.abs(p.getRangeValue(M.quartiles.q_75)-p.getRangeValue(M.quartiles.q_25));return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.highlight-area")).attr("class","highlight-area").attr("opacity",0).attr("d",M=>{const V=p.getDomainValue(M[i])-O/2,x=V+O,C=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.max);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.whisker.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"whisker start"})).attr("stroke-width",Ce.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-startingwhisker",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/4,x=V+O/2,C=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.min);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.median")).attr("fill","none").attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"median"})).attr("stroke-width",2).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-median",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/2,x=V+O,C=p.getRangeValue(M.quartiles.q_50);return ue({x0:V,x1:x,y0:C,y1:C},m)}),S.append("path").merge(T.select("path.whisker.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"whisker end"})).attr("stroke-width",Ce.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-endingwhisker",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/4,x=V+O/2,C=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.whiskers.max);return ue({x0:V,x1:x,y0:C,y1:y},m)});const k=$.selectAll("circle.outlier").data(M=>M.outliers.map(V=>({min:M.whiskers.min,max:M.whiskers.max,[i]:M[i],value:V})));k.exit().remove();const L=k.enter().append("circle");k.merge(L).attr("r",Ce.circle.radius).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],originalClassName:"outlier"})).attr("fill-opacity",Ce.circle.opacity.default).attr("cx",v).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-circles",animate:t})).attr("cy",b),this.addBoxEventListeners(),this.addCircleEventListeners()}addBoxEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data;this.parent.selectAll("path.highlight-area").on("mouseover",function(i,s){const a=N(this);N(this.parentNode).select("path.box").classed("hovered",!0).attr("fill-opacity",Ce.box.opacity.hovered),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:n.tooltip.groupLabel,value:s[r],class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP]})},{label:"Minimum",value:s.whiskers.min},{label:"Q1",value:s.quartiles.q_25},{label:"Median",value:s.quartiles.q_50},{label:"Q3",value:s.quartiles.q_75},{label:"Maximum",value:s.whiskers.max},{label:"IQR",value:s.quartiles.q_75-s.quartiles.q_25}]}),t.services.events.dispatchEvent(A.Boxplot.BOX_MOUSEOVER,{event:i,element:a,datum:s})}).on("mousemove",function(i,s){const a=N(this);t.services.events.dispatchEvent(A.Boxplot.BOX_MOUSEMOVE,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("click",function(i,s){t.services.events.dispatchEvent(A.Boxplot.BOX_CLICK,{event:i,element:N(this),datum:s})}).on("mouseout",function(i,s){const a=N(this);N(this.parentNode).select("path.box").classed("hovered",!1).attr("fill-opacity",Ce.box.opacity.default),t.services.events.dispatchEvent(A.Boxplot.BOX_MOUSEOUT,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:a})})}addCircleEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("circle").on("mouseover",function(s,a){const o=N(this);o.classed("hovered",!0).attr("fill-opacity",Ce.circle.opacity.hovered).classed("unfilled",!1),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel,value:a[r],class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP]})},{label:"Outlier",value:a[i]}]}),t.services.events.dispatchEvent(A.Boxplot.OUTLIER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=N(this);t.services.events.dispatchEvent(A.Boxplot.OUTLIER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(A.Boxplot.OUTLIER_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);o.classed("hovered",!1).attr("fill-opacity",Ce.circle.opacity.default),t.services.events.dispatchEvent(A.Boxplot.OUTLIER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o})})}}class jr extends gt{constructor(){super(...arguments),this.type="zero-line",this.renderType=nt.SVG}render(t){const n=this.services.cartesianScales.getRangeAxisPosition({groups:this.configs.groups}),r=this.services.cartesianScales.getScaleByPosition(n),[i,s]=r.domain(),a=i>0&&s<0||i<0&&s>0,o=this.getComponentContainer();if(!a){o.selectAll("line.domain").remove();return}const[l,c]=this.services.cartesianScales.getDomainScale().range();let u=+r(0)+.5;u||(u=r.range()[0]);const h=ag({x0:l,x1:c,y0:u,y1:u},this.services.cartesianScales.getOrientation());P.appendOrSelect(o,"line.domain").transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"zero-line-update",animate:t})).attr("y1",h.y0).attr("y2",h.y1).attr("x1",h.x0).attr("x2",h.x1)}}class tR extends tn{constructor(){super(...arguments),this.type="bubble",this.renderType=nt.SVG}getRadiusScale(t){const n=this.getOptions(),{radiusMapsTo:r}=n.bubble,i=t.data(),s=i.map(c=>c[r]).filter(c=>c),a=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),o=s.length>0,l=o?Re(s):[1,1];return Be().domain(l).range(o?n.bubble.radiusRange(a,i):[4,4])}styleCircles(t,n){const r=this.getOptions(),{radiusMapsTo:i}=r.bubble,s=this.getRadiusScale(t),{groupMapsTo:a}=r.data,{cartesianScales:o}=this.services,l=d=>o.getDomainValue(d),c=d=>o.getRangeValue(d),[u,h]=xn(l,c,o.getOrientation());t.raise().classed("dot",!0).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",d=>{const f=o.getRangeIdentifier(d);return d[f]}).transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"bubble-update-enter",animate:n})).attr("cx",u).attr("cy",h).attr("r",d=>s(d[i]||1)).attr("class",d=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:d[a],originalClassName:"dot"})).style("fill",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getFillColor(d[a],d[f],d)}).style("stroke",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getStrokeColor(d[a],d[f],d)}).attr("fill-opacity",r.bubble.fillOpacity).attr("opacity",1)}getTooltipAdditionalItems(t){const n=_(this.getOptions(),"bubble");return[{label:_(n,"radiusLabel"),value:t[_(n,"radiusMapsTo")]}]}}class eR extends gt{constructor(){super(...arguments),this.type="bullet",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getRangeScale(),o=this.services.cartesianScales.getRangeIdentifier(),[l,c]=a.range(),[,u]=a.domain(),h=()=>{const m=[];s.forEach(v=>{v.ranges?v.ranges.forEach((b,w)=>{b!=null&&b<u&&m.push({datum:v,value:b,order:w+1})}):m.push({datum:v,order:1})});const g=P.appendOrSelect(i,"g.range-boxes").selectAll("path.range-box").data(m,v=>`${v[r]}-${v.order}`);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`range-box order-${v.order}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-range-box-update-enter",animate:t})).attr("d",v=>{let b,w,O,E;return v.order===1?(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=c-2,E=l+1):(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=this.services.cartesianScales.getRangeValue(v.value),E=c),ue({x0:b,x1:w,y0:O,y1:E},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},d=()=>{const m=P.appendOrSelect(i,"g.bars").selectAll("path.bar").data(s,g=>g[r]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("bar",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-bar-update-enter",animate:t})).attr("class",g=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:g[r],originalClassName:"bar"})).style("fill",g=>this.model.getFillColor(g[r])).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-4,b=v+8,w=this.services.cartesianScales.getRangeValue(0)+1,O=this.services.cartesianScales.getRangeValue(g);return ue({x0:v,x1:b,y0:w,y1:O},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",g=>g.value)},f=()=>{const m=P.appendOrSelect(i,"g.markers").selectAll("path.marker").data(s.filter(g=>_(g,"marker")!==null),g=>g[r]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("marker",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-marker-update-enter",animate:t})).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-12,b=v+24,w=this.services.cartesianScales.getRangeValue(g.marker);return ue({x0:v,x1:b,y0:w,y1:w},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},p=()=>{let m=[];s.filter(v=>_(v,"marker")!==null).forEach(v=>{const b=v.marker,w=v[o];m=m.concat([{datum:v,value:b*.25,barValue:w},{datum:v,value:b*.5,barValue:w},{datum:v,value:b*.75,barValue:w}])});const g=P.appendOrSelect(i,"g.quartiles").selectAll("path.quartile").data(m,v=>v[r]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`quartile ${v.value<=v.barValue?"over-bar":""}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-quartile-update-enter",animate:t})).attr("d",({datum:v,value:b})=>{let w=4;v.ranges&&v.ranges.indexOf(b)!==-1&&(w=8);const O=this.services.cartesianScales.getDomainValue(v)-w/2,E=O+w,T=this.services.cartesianScales.getRangeValue(b);return ue({x0:O,x1:E,y0:T,y1:T},this.services.cartesianScales.getOrientation())}).attr("opacity",1)};h(),d(),f(),p(),this.addEventListeners()}addEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("path.bar").on("mouseover",function(s,a){const o=N(this);o.classed("hovered",!0),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:s,element:o,datum:a});const l=_(n,"bullet","performanceAreaTitles"),c=t.model.getMatchingRangeIndexForDatapoint(a);t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel||"Group",value:a[r],class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:a[r]})},{label:"Value",value:a[i]},{label:"Target",value:a.marker},{label:"Percentage",value:`${Math.floor(a[i]/a.marker*100)}%`},{label:"Performance",value:l[c]}]})}).on("mousemove",function(s,a){t.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:s,element:N(this),datum:a}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);o.classed("hovered",!1),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}function nR(e){return e}function rR(e){if(e==null)return nR;var t,n,r=e.scale[0],i=e.scale[1],s=e.translate[0],a=e.translate[1];return function(o,l){l||(t=n=0);var c=2,u=o.length,h=new Array(u);for(h[0]=(t+=o[0])*r+s,h[1]=(n+=o[1])*i+a;c<u;)h[c]=o[c],++c;return h}}function iR(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function sR(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Om(e,n)})}:Om(e,t)}function Om(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,s=Hc(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:s}:r==null?{type:"Feature",id:n,properties:i,geometry:s}:{type:"Feature",id:n,bbox:r,properties:i,geometry:s}}function Hc(e,t){var n=rR(e.transform),r=e.arcs;function i(u,h){h.length&&h.pop();for(var d=r[u<0?~u:u],f=0,p=d.length;f<p;++f)h.push(n(d[f],f));u<0&&iR(h,p)}function s(u){return n(u)}function a(u){for(var h=[],d=0,f=u.length;d<f;++d)i(u[d],h);return h.length<2&&h.push(h[0]),h}function o(u){for(var h=a(u);h.length<4;)h.push(h[0]);return h}function l(u){return u.map(o)}function c(u){var h=u.type,d;switch(h){case"GeometryCollection":return{type:h,geometries:u.geometries.map(c)};case"Point":d=s(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(s);break;case"LineString":d=a(u.arcs);break;case"MultiLineString":d=u.arcs.map(a);break;case"Polygon":d=l(u.arcs);break;case"MultiPolygon":d=u.arcs.map(l);break;default:return null}return{type:h,coordinates:d}}return c(t)}function aR(e,t){var n={},r={},i={},s=[],a=-1;t.forEach(function(c,u){var h=e.arcs[c<0?~c:c],d;h.length<3&&!h[1][0]&&!h[1][1]&&(d=t[++a],t[a]=c,t[u]=d)}),t.forEach(function(c){var u=o(c),h=u[0],d=u[1],f,p;if(f=i[h])if(delete i[f.end],f.push(c),f.end=d,p=r[d]){delete r[p.start];var m=p===f?f:f.concat(p);r[m.start=f.start]=i[m.end=p.end]=m}else r[f.start]=i[f.end]=f;else if(f=r[d])if(delete r[f.start],f.unshift(c),f.start=h,p=i[h]){delete i[p.end];var g=p===f?f:p.concat(f);r[g.start=p.start]=i[g.end=f.end]=g}else r[f.start]=i[f.end]=f;else f=[c],r[f.start=h]=i[f.end=d]=f});function o(c){var u=e.arcs[c<0?~c:c],h=u[0],d;return e.transform?(d=[0,0],u.forEach(function(f){d[0]+=f[0],d[1]+=f[1]})):d=u[u.length-1],c<0?[d,h]:[h,d]}function l(c,u){for(var h in c){var d=c[h];delete u[d.start],delete d.start,delete d.end,d.forEach(function(f){n[f<0?~f:f]=1}),s.push(d)}}return l(i,r),l(r,i),t.forEach(function(c){n[c<0?~c:c]||s.push([c])}),s}function oR(e){for(var t=-1,n=e.length,r,i=e[n-1],s=0;++t<n;)r=i,i=e[t],s+=r[0]*i[1]-r[1]*i[0];return Math.abs(s)}function lR(e){return Hc(e,cR.apply(this,arguments))}function cR(e,t){var n={},r=[],i=[];t.forEach(s);function s(l){switch(l.type){case"GeometryCollection":l.geometries.forEach(s);break;case"Polygon":a(l.arcs);break;case"MultiPolygon":l.arcs.forEach(a);break}}function a(l){l.forEach(function(c){c.forEach(function(u){(n[u=u<0?~u:u]||(n[u]=[])).push(l)})}),r.push(l)}function o(l){return oR(Hc(e,{type:"Polygon",arcs:[l]}).coordinates[0])}return r.forEach(function(l){if(!l._){var c=[],u=[l];for(l._=1,i.push(c);l=u.pop();)c.push(l),l.forEach(function(h){h.forEach(function(d){n[d<0?~d:d].forEach(function(f){f._||(f._=1,u.push(f))})})})}}),r.forEach(function(l){delete l._}),{type:"MultiPolygon",arcs:i.map(function(l){var c=[],u;if(l.forEach(function(m){m.forEach(function(g){g.forEach(function(v){n[v<0?~v:v].length<2&&c.push(v)})})}),c=aR(e,c),(u=c.length)>1)for(var h=1,d=o(c[0]),f,p;h<u;++h)(f=o(c[h]))>d&&(p=c[0],c[0]=c[h],c[h]=p,d=f);return c}).filter(function(l){return l.length>0})}}class uR extends kn{constructor(){super(...arguments),this.type="ruler-binned",this.renderType=nt.SVG}showRuler(t,[n,r]){const i=this.parent,s=this.model.getOptions(),{cartesianScales:a}=this.services,o=a.getOrientation(),l=a.getRangeScale(),[c,u]=l.range(),h=a.getDomainScale(),d=h.invert(o===Jt.VERTICAL?n:r),f=P.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),p=P.appendOrSelect(f,"line.ruler-line"),m=i.selectAll("[role=graphics-symbol]").filter(g=>{if(parseFloat(kt(g,"data.x0"))<=d&&parseFloat(kt(g,"data.x1"))>=d)return!0});if(m.size()>0){this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!rm(this.elementsToHighlight,m)&&this.hideRuler(),m.dispatch("mouseover"),this.elementsToHighlight=m;const g=N(m.nodes()[0]).datum(),v=parseFloat(kt(g,"data.x0")),b=parseFloat(kt(g,"data.x1")),w=this.model.getActiveDataGroupNames(),O=w.reverse().map(E=>({label:E,value:kt(g,`data.${E}`),class:this.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:E})})).filter(E=>E.value!==0);if(O.length>0){this.services.events.dispatchEvent(A.Tooltip.SHOW,{mousePosition:[n,r],hoveredElement:p,items:[{label:kt(s,"bins.rangeLabel")||"Range",value:`${v} – ${b}`},...O,..._(s,"tooltip","showTotal")===!0?[{label:kt(s,"tooltip.totalLabel")||"Total",value:w.reduce((T,S)=>T+parseFloat(kt(g,`data.${S}`)),0)}]:[]]}),f.attr("opacity",1);const E=h((v+b)/2);o==="horizontal"?p.attr("x1",u).attr("x2",c).attr("y1",E).attr("y2",E):p.attr("y1",u).attr("y2",c).attr("x1",E).attr("x2",E)}else this.hideRuler()}else this.hideRuler()}}class eo extends kn{formatTooltipData(t){return t.reverse()}}const hR=(e,t)=>{const n=e.x,r=e.y,i=t.x,s=t.y,a=ah();return a.moveTo(n,r),a.lineTo(i,s),a.toString()},dR={d:"M7 0v8L0 4z",height:8,width:7.5,id:"arrowLeft"},fR={d:"M0 0v8l7-4z",height:8,width:7.5,id:"arrowRight"},pR={d:"M5.32 9.513a4.75 4.75 0 100-9.5 4.75 4.75 0 000 9.5z",height:10,width:10,id:"circle"},gR={d:"M5.03517654-1e-7l4.99999996 5-4.99999996 5-5-5L2.4517844 2.58339204z",height:10,width:10,id:"diamond"},mR={d:"M0 .44974747h8v8H0v-3.6830331z",height:9,width:8,id:"square"},vR={d:"M0 0h1.5v8H0z",height:8,width:2,id:"tee"};class Tm extends Bc{constructor(t,n,r){super(t,n,r),this.type="color-legend",this.renderType=nt.SVG,this.gradient_id=`gradient-id-${Math.floor(Math.random()*99999999999)}`,this.handleAxisCompleteEvent=()=>{const i=this.getComponentContainer(),{width:s}=P.getSVGElementSize(i,{useAttrs:!0}),a=_(this.getOptions(),"data","loading");if(s>Vt.color.barWidth&&!a){const o=_(this.getOptions(),"heatmap","colorLegend","title"),{cartesianScales:l}=this.services,c=l.getMainXScale().range();if(c[0]>1&&(i.select("g.legend").attr("transform",`translate(${c[0]}, 0)`),o)){const{width:u}=P.getSVGElementSize(i.select("g.legend-title").select("text"),{useBBox:!0}),h=c[0]-u-9;h>1?i.select("g.legend-title").attr("transform",`translate(${h}, 0)`):(i.select("g.legend").attr("transform",`translate(${c[0]}, 16)`),i.select("g.legend-title").attr("transform",`translate(${c[0]}, 0)`))}}else i.select("g.legend-title").attr("transform","translate(0, 0)")},this.chartType=r.chartType}init(){this.chartType==="heatmap"&&this.services.events.addEventListener(A.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}render(t=!0){const n=this.getOptions(),r=this.getComponentContainer(),{width:i}=P.getSVGElementSize(r,{useAttrs:!0}),s=_(n,"color","gradient","colors"),a=_(n,this.chartType,"colorLegend","type");let o=_(n,"color","pairing","option");const l=_(n,"heatmap","colorLegend","title");if(_(this.getOptions(),"data","loading")){r.html("");return}const c=!ze(s),u=xg(this.model.getDisplayData()),h=!(i<=Vt.color.barWidth),d=h?Vt.color.barWidth:i,f=P.appendOrSelect(r,"g.legend"),p=P.appendOrSelect(f,"g.legend-axis");if(l){const S=P.appendOrSelect(r,"g.legend-title");P.appendOrSelect(S,"text").text(l).attr("dy","0.7em"),f.attr("transform","translate(0, 16)")}const m=u[0]<0&&u[1]>0?"diverge":"mono";(o<1&&o>4&&m==="mono"||o<1&&o>2&&m==="diverge")&&(o=1);let g=[];const v=m==="diverge"?17:11;if(c)g=s;else for(let S=1;S<v+1;S++)g.push(a===va.LINEAR?`stop-color-${m}-${o}-${S}`:`fill-${m}-${o}-${S}`);const b=we(u[0],u[1]),w=n1(b,3),O=Be().domain(u).range([0,d]),E=lo(O).tickSize(0).tickValues(w);let T;switch(a){case va.LINEAR:this.drawLinear(g,f,d);break;case va.QUANTIZE:T=this.drawQuantize(g,m,c,f,d),O.range([T,d]);break;default:throw Error("Entered color legend type is not supported.")}p.attr("transform",`translate(0,${Vt.color.axisYTranslation})`).call(E),p.select(".domain").remove(),p.select("g.tick:last-of-type text").style("text-anchor",h?"middle":"end"),p.select("g.tick:first-of-type text").style("text-anchor",h&&this.chartType!=="choropleth"?"middle":"start")}drawLinear(t,n,r){const i=100/(t.length-1);P.appendOrSelect(n,"linearGradient").attr("id",`${this.gradient_id}-legend`).selectAll("stop").data(t).enter().append("stop").attr("offset",(s,a)=>`${a*i}%`).attr("class",(s,a)=>t[a]).attr("stop-color",s=>s),P.appendOrSelect(n,"rect").attr("width",r).attr("height",Vt.color.barHeight).style("fill",`url(#${this.gradient_id}-legend)`)}drawQuantize(t,n,r,i,s){!r&&n==="diverge"&&t.splice(t.length/2,1);const a=xi().domain(t).range([0,s]);return P.appendOrSelect(i,"g.quantized-rect").selectAll("rect").data(a.domain()).join("rect").attr("x",o=>a(o)).attr("y",0).attr("width",Math.max(0,a.bandwidth()-1)).attr("height",Vt.color.barHeight).attr("class",o=>o).attr("fill",o=>o),(!r&&n)==="mono"?a.bandwidth()-1:0}destroy(){this.chartType==="heatmap"&&this.services.events.removeEventListener(A.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}}class yR extends ts{constructor(){super(...arguments),this.type="meter-title",this.renderType=nt.SVG}render(t=!0){const n=_(this.model.getDisplayData(),0),r=this.getOptions(),i=this.getComponentContainer(),{groupMapsTo:s}=r.data;if(_(r,"meter","proportional"))this.displayTotal(),this.displayBreakdownTitle();else{const l=i.selectAll("text.meter-title").data([n[s]]);l.enter().append("text").classed("meter-title",!0).merge(l).attr("x",0).attr("y","1em").text(c=>c),l.exit().remove(),this.appendPercentage()}this.displayStatus();const a=this.getMaxTitleWidth(),o=P.appendOrSelect(i,"text.meter-title");a>0&&o.node().getComputedTextLength()>a&&this.truncateTitle(o,a)}displayBreakdownTitle(){const t=this.getComponentContainer(),n=this.getOptions(),r=this.model.getMaximumDomain(this.model.getDisplayData()),i=_(n,"meter","proportional","total"),s=_(n,"meter","proportional","unit")?_(n,"meter","proportional","unit"):"";let a;if(r===i)a=null;else{const u=i!==null?i-r:r,h=_(n,"meter","proportional","breakdownFormatter");a=h!==null?h({datasetsTotal:r,total:i}):`${r} ${s} used (${u} ${s} available)`}const o=t.selectAll("text.proportional-meter-title").data([a]);o.enter().append("text").classed("proportional-meter-title",!0).merge(o).attr("x",0).attr("y","1em").text(u=>u),o.exit().remove();const l=this.getMaxTitleWidth(),c=P.appendOrSelect(t,"text.proportional-meter-title");l>0&&c.node().getComputedTextLength()>l&&this.truncateTitle(c,l)}displayTotal(){const t=this.getComponentContainer(),n=this.getOptions(),r=_(n,"meter","proportional","total"),i=r?_(n,"meter","proportional","total"):this.model.getMaximumDomain(this.model.getDisplayData()),s=_(n,"meter","proportional","unit")?_(n,"meter","proportional","unit"):"",a=_(n,"meter","proportional","totalFormatter"),o=a!==null?a(i):`${r} ${s} total`,l=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),c=l.width?l.width:this.parent.node().getAttribute("width"),u=t.selectAll("text.proportional-meter-total").data([o]);u.enter().append("text").classed("proportional-meter-total",!0).merge(u).attr("x",this.model.getStatus()&&typeof c!="string"?c-te.total.paddingRight:c).attr("y","1em").attr("text-anchor","end").text(h=>h),u.exit().remove()}displayStatus(){const t=this,n=this.getComponentContainer(),r=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),i=r.width?r.width:0,s=this.model.getStatus(),a=te.status.indicatorSize/2,o=P.appendOrSelect(n,"g.status-indicator").attr("class",s!==null?`status-indicator status--${s}`:"").attr("transform",`translate(${i-a}, 0)`),l=s?[s]:[],c=o.selectAll("circle.status").data(l);c.enter().append("circle").merge(c).attr("class","status").attr("r",a).attr("cx",0).attr("cy",8);const u=o.selectAll("path.innerFill").data(l);u.enter().append("path").merge(u).attr("d",t.getStatusIconPathString(s)).attr("transform",`translate(-${a}, 0)`).attr("class","innerFill"),u.exit().remove(),c.exit().remove()}appendPercentage(){const t=_(this.model.getDisplayData(),0,"value"),n=this.getComponentContainer(),r=P.appendOrSelect(n,"text.meter-title"),i=_(this.getOptions(),"meter","statusBar","percentageIndicator","enabled")===!0?[t]:[],s=n.selectAll("text.percent-value").data(i),a=te.statusBar.paddingRight;s.enter().append("text").classed("percent-value",!0).merge(s).text(o=>`${o}%`).attr("x",+r.attr("x")+r.node().getComputedTextLength()+a).attr("y",r.attr("y")),s.exit().remove()}truncateTitle(t,n){super.truncateTitle(t,n);const r=P.appendOrSelect(this.parent,"tspan"),i=te.statusBar.paddingRight,s=Math.ceil(r.node().getComputedTextLength());P.appendOrSelect(this.parent,"text.percent-value").attr("x",+t.attr("x")+t.node().getComputedTextLength()+s+i)}getMaxTitleWidth(){const t=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),n=_(this.getOptions(),"meter","proportional"),r=t.width?t.width:this.parent.node().getBoundingClientRect().width;if(n!==null){const i=P.appendOrSelect(this.parent,"text.proportional-meter-total").node(),s=P.getSVGElementSize(i,{useBBox:!0}).width;return r-s-te.total.paddingLeft}else{const i=P.appendOrSelect(this.parent,"text.percent-value"),s=te.statusBar.paddingRight,a=i.node().getComputedTextLength(),o=P.appendOrSelect(this.parent,"g.status-indicator").node(),l=P.getSVGElementSize(o,{useBBox:!0}).width+te.status.paddingLeft;return r-a-s-l}}getStatusIconPathString(t){switch(t){case ga.SUCCESS:return"M6.875 11.3125 3.75 8.1875 4.74375 7.25 6.875 9.34375 11.50625 4.75 12.5 5.7375 Z";case ga.DANGER:return"M10.7 11.5 4.5 5.3 5.3 4.5 11.5 10.7 Z";case ga.WARNING:return"M7.9375,11.125 C7.41973305,11.125 7,11.544733 7,12.0625 C7,12.580267 7.41973305,13 7.9375,13 C8.45526695,13 8.875,12.580267 8.875,12.0625 C8.875,11.544733 8.45526695,11.125 7.9375,11.125 M7.3125, 3 8.5625, 3 8.5625, 9.875 7.3125, 9.875, 7.3125, 3 Z"}}}class Fc extends gt{getBarWidth(){const t=this.getOptions();if(t.bars.width)return t.bars.width;const n=this.model.getDisplayData().length,r=this.services.cartesianScales.getMainXScale(),i=P.getSVGElementSize(this.parent,{useAttrs:!0}).width;if(!r.step){const s=_(t,"bars","spacingFactor");return Math.min(t.bars.maxWidth,i*s/n)}return Math.min(t.bars.maxWidth,r.step()/2)}isOutsideZoomedDomain(t,n){if(this.model.getDisplayData().length<=1)return!1;const r=this.model.get("zoomDomain");if(r!==void 0){const i=this.services.cartesianScales.getDomainScale();return t<i(r[0])||n>i(r[1])}return!1}}class bR extends gt{constructor(){super(...arguments),this.type="circle-pack",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("circle.node").transition("legend-hover-circlepack").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-circlepack"})).attr("opacity",r=>r.data.dataGroupName===n.datum().name?1:kr.circles.fillOpacity)},this.handleLegendMouseOut=()=>{this.parent.selectAll("circle.node").transition("legend-mouseout-circlepack").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-circlepack"})).attr("opacity",1)}}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{width:r,height:i}=P.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;let s=this.model.getDisplayData();const a=this.model.hasParentNode(),o=this.model.getHierarchyLevel(),l=this.getOptions(),c=_(l,"canvasZoom","enabled");a&&_(s,0,"children")&&(s=_(s,0,"children"));const u=vi({children:s}).sum(p=>p.value).sort((p,m)=>m.value-p.value),h=mw().size([r,i]).padding(p=>p.depth>=1?kr.padding.children+3:kr.padding.mainGroup+3)(u).descendants().splice(1).filter(p=>p.depth<=o),d=n.selectAll("circle.node").data(h);d.exit().attr("width",0).attr("height",0).remove();const f=d.enter().append("circle").classed("node",!0);f.merge(d).attr("class",p=>{const m=c&&o===3?this.getZoomClass(p):"";return this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:p.data.dataGroupName,originalClassName:p.children?`node ${m}`:`node node-leaf ${m}`})}).style("fill",p=>this.model.getFillColor(p.data.dataGroupName)).style("stroke",p=>this.model.getFillColor(p.data.dataGroupName)).attr("cx",p=>p.x).attr("cy",p=>p.y).transition("circlepack-leaf-update-enter").call(p=>this.services.transitions.setupTransition({transition:p,name:"circlepack-leaf-update-enter"})).attr("r",p=>p.r).attr("opacity",1).attr("fill-opacity",kr.circles.fillOpacity),c===!0&&this.focal&&(this.services.canvasZoom.zoomIn(this.focal,f,Dr),this.setBackgroundListeners()),a||this.addLegendListeners(),this.addEventListeners()}unhighlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",r=>this.model.getFillColor(r.data.dataGroupName))}highlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",kr.circles.hover.stroke)}getZoomClass(t){return this.model.getHierarchyLevel()===3&&this.focal&&(t.data===this.focal.data||this.focal.children.some(n=>n.data===t.data))?"focal":"non-focal"}addLegendListeners(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}removeBackgroundListeners(){N(this.services.domUtils.getMainContainer()).on("click",()=>null)}setBackgroundListeners(){const t=N(this.services.domUtils.getMainContainer()),n=this,r=this.parent.selectAll("circle.node");t.on("click",()=>{n.focal=null,n.model.updateHierarchyLevel(2),t.classed("zoomed-in",!1),n.services.canvasZoom.zoomOut(r,Dr)})}getZoomIcon(){return`
|
|
79
|
+
`;c.html(u),h();function h(){c.attr("gradientTransform",`translate(${a-3*.2*s}, 0)`).transition().duration(2e3).delay(1e3).ease(ub).attr("gradientTransform",`translate(${o+3*.2*s}, 0)`).on("end",h)}}removeSkeleton(){this.parent.select(".chart-skeleton").remove()}}class Jk extends gt{constructor(){super(...arguments),this.type="boxplot",this.renderType=nt.SVG}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getDataGroupNames(),a=this.services.cartesianScales.getMainXScale(),o=this.services.cartesianScales.getMainYScale(),[l,c]=a.range(),[u,h]=o.range(),d=c-l,f=u-h;if(d===0)return;const{cartesianScales:p}=this.services,m=p.getOrientation(),g=m===Jt.VERTICAL,[v,b]=xn(M=>this.services.cartesianScales.getDomainValue(M),M=>this.services.cartesianScales.getRangeValue(M),m),w=Math.floor((g?d:f)/s.length),O=Math.min(w/2,16),E=this.model.getBoxplotData(),T=n.selectAll(".box-group").data(E);T.exit().remove();const S=T.enter().append("g").attr("class","box-group"),$=T.merge(S);S.append("path").merge(T.select("path.vertical-line.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"vertical-line start"})).attr("stroke-width",Ce.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalstartline",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i]),x=V,C=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.quartiles.q_25);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.vertical-line.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"vertical-line end"})).attr("stroke-width",Ce.strokeWidth.default).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-verticalendline",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i]),x=V,C=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.quartiles.q_75);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.box")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],originalClassName:"box"})).attr("fill-opacity",Ce.box.opacity.default).attr("stroke-width",Ce.strokeWidth.default).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","box").attr("aria-label",M=>M[i]).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-quartiles",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/2,x=V+O,C=p.getRangeValue(Math[g?"max":"min"](M.quartiles.q_75,M.quartiles.q_25)),y=C+Math.abs(p.getRangeValue(M.quartiles.q_75)-p.getRangeValue(M.quartiles.q_25));return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.highlight-area")).attr("class","highlight-area").attr("opacity",0).attr("d",M=>{const V=p.getDomainValue(M[i])-O/2,x=V+O,C=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.max);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.whisker.start")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"whisker start"})).attr("stroke-width",Ce.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-startingwhisker",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/4,x=V+O/2,C=p.getRangeValue(M.whiskers.min),y=p.getRangeValue(M.whiskers.min);return ue({x0:V,x1:x,y0:C,y1:y},m)}),S.append("path").merge(T.select("path.median")).attr("fill","none").attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"median"})).attr("stroke-width",2).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-median",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/2,x=V+O,C=p.getRangeValue(M.quartiles.q_50);return ue({x0:V,x1:x,y0:C,y1:C},m)}),S.append("path").merge(T.select("path.whisker.end")).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.STROKE],originalClassName:"whisker end"})).attr("stroke-width",Ce.strokeWidth.thicker).attr("fill","none").transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-endingwhisker",animate:t})).attr("d",M=>{const V=p.getDomainValue(M[i])-O/4,x=V+O/2,C=p.getRangeValue(M.whiskers.max),y=p.getRangeValue(M.whiskers.max);return ue({x0:V,x1:x,y0:C,y1:y},m)});const k=$.selectAll("circle.outlier").data(M=>M.outliers.map(V=>({min:M.whiskers.min,max:M.whiskers.max,[i]:M[i],value:V})));k.exit().remove();const L=k.enter().append("circle");k.merge(L).attr("r",Ce.circle.radius).attr("class",()=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],originalClassName:"outlier"})).attr("fill-opacity",Ce.circle.opacity.default).attr("cx",v).transition().call(M=>this.services.transitions.setupTransition({transition:M,name:"boxplot-update-circles",animate:t})).attr("cy",b),this.addBoxEventListeners(),this.addCircleEventListeners()}addBoxEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data;this.parent.selectAll("path.highlight-area").on("mouseover",function(i,s){const a=N(this);N(this.parentNode).select("path.box").classed("hovered",!0).attr("fill-opacity",Ce.box.opacity.hovered),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:n.tooltip.groupLabel,value:s[r],class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP]})},{label:"Minimum",value:s.whiskers.min},{label:"Q1",value:s.quartiles.q_25},{label:"Median",value:s.quartiles.q_50},{label:"Q3",value:s.quartiles.q_75},{label:"Maximum",value:s.whiskers.max},{label:"IQR",value:s.quartiles.q_75-s.quartiles.q_25}]}),t.services.events.dispatchEvent(A.Boxplot.BOX_MOUSEOVER,{event:i,element:a,datum:s})}).on("mousemove",function(i,s){const a=N(this);t.services.events.dispatchEvent(A.Boxplot.BOX_MOUSEMOVE,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("click",function(i,s){t.services.events.dispatchEvent(A.Boxplot.BOX_CLICK,{event:i,element:N(this),datum:s})}).on("mouseout",function(i,s){const a=N(this);N(this.parentNode).select("path.box").classed("hovered",!1).attr("fill-opacity",Ce.box.opacity.default),t.services.events.dispatchEvent(A.Boxplot.BOX_MOUSEOUT,{event:i,element:a,datum:s}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:a})})}addCircleEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("circle").on("mouseover",function(s,a){const o=N(this);o.classed("hovered",!0).attr("fill-opacity",Ce.circle.opacity.hovered).classed("unfilled",!1),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel,value:a[r],class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP]})},{label:"Outlier",value:a[i]}]}),t.services.events.dispatchEvent(A.Boxplot.OUTLIER_MOUSEOVER,{event:s,element:o,datum:a})}).on("mousemove",function(s,a){const o=N(this);t.services.events.dispatchEvent(A.Boxplot.OUTLIER_MOUSEMOVE,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(A.Boxplot.OUTLIER_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);o.classed("hovered",!1).attr("fill-opacity",Ce.circle.opacity.default),t.services.events.dispatchEvent(A.Boxplot.OUTLIER_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o})})}}class jr extends gt{constructor(){super(...arguments),this.type="zero-line",this.renderType=nt.SVG}render(t){const n=this.services.cartesianScales.getRangeAxisPosition({groups:this.configs.groups}),r=this.services.cartesianScales.getScaleByPosition(n),[i,s]=r.domain(),a=i>0&&s<0||i<0&&s>0,o=this.getComponentContainer();if(!a){o.selectAll("line.domain").remove();return}const[l,c]=this.services.cartesianScales.getDomainScale().range();let u=+r(0)+.5;u||(u=r.range()[0]);const h=ag({x0:l,x1:c,y0:u,y1:u},this.services.cartesianScales.getOrientation());P.appendOrSelect(o,"line.domain").transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"zero-line-update",animate:t})).attr("y1",h.y0).attr("y2",h.y1).attr("x1",h.x0).attr("x2",h.x1)}}class tR extends tn{constructor(){super(...arguments),this.type="bubble",this.renderType=nt.SVG}getRadiusScale(t){const n=this.getOptions(),{radiusMapsTo:r}=n.bubble,i=t.data(),s=i.map(c=>c[r]).filter(c=>c),a=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),o=s.length>0,l=o?Re(s):[1,1];return Be().domain(l).range(o?n.bubble.radiusRange(a,i):[4,4])}styleCircles(t,n){const r=this.getOptions(),{radiusMapsTo:i}=r.bubble,s=this.getRadiusScale(t),{groupMapsTo:a}=r.data,{cartesianScales:o}=this.services,l=d=>o.getDomainValue(d),c=d=>o.getRangeValue(d),[u,h]=xn(l,c,o.getOrientation());t.raise().classed("dot",!0).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",d=>{const f=o.getRangeIdentifier(d);return d[f]}).transition().call(d=>this.services.transitions.setupTransition({transition:d,name:"bubble-update-enter",animate:n})).attr("cx",u).attr("cy",h).attr("r",d=>s(d[i]||1)).attr("class",d=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:d[a],originalClassName:"dot"})).style("fill",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getFillColor(d[a],d[f],d)}).style("stroke",d=>{const f=this.services.cartesianScales.getDomainIdentifier(d);return this.model.getStrokeColor(d[a],d[f],d)}).attr("fill-opacity",r.bubble.fillOpacity).attr("opacity",1)}getTooltipAdditionalItems(t){const n=_(this.getOptions(),"bubble");return[{label:_(n,"radiusLabel"),value:t[_(n,"radiusMapsTo")]}]}}class eR extends gt{constructor(){super(...arguments),this.type="bullet",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getRangeScale(),o=this.services.cartesianScales.getRangeIdentifier(),[l,c]=a.range(),[,u]=a.domain(),h=()=>{const m=[];s.forEach(v=>{v.ranges?v.ranges.forEach((b,w)=>{b!=null&&b<u&&m.push({datum:v,value:b,order:w+1})}):m.push({datum:v,order:1})});const g=P.appendOrSelect(i,"g.range-boxes").selectAll("path.range-box").data(m,v=>`${v[r]}-${v.order}`);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`range-box order-${v.order}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-range-box-update-enter",animate:t})).attr("d",v=>{let b,w,O,E;return v.order===1?(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=c-2,E=l+1):(b=this.services.cartesianScales.getDomainValue(v.datum)-16/2,w=b+16,O=this.services.cartesianScales.getRangeValue(v.value),E=c),ue({x0:b,x1:w,y0:O,y1:E},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},d=()=>{const m=P.appendOrSelect(i,"g.bars").selectAll("path.bar").data(s,g=>g[r]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("bar",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-bar-update-enter",animate:t})).attr("class",g=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:g[r],originalClassName:"bar"})).style("fill",g=>this.model.getFillColor(g[r])).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-4,b=v+8,w=this.services.cartesianScales.getRangeValue(0)+1,O=this.services.cartesianScales.getRangeValue(g);return ue({x0:v,x1:b,y0:w,y1:O},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",g=>g.value)},f=()=>{const m=P.appendOrSelect(i,"g.markers").selectAll("path.marker").data(s.filter(g=>_(g,"marker")!==null),g=>g[r]);m.exit().attr("opacity",0).remove(),m.enter().append("path").attr("opacity",0).merge(m).classed("marker",!0).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"bullet-marker-update-enter",animate:t})).attr("d",g=>{const v=this.services.cartesianScales.getDomainValue(g)-12,b=v+24,w=this.services.cartesianScales.getRangeValue(g.marker);return ue({x0:v,x1:b,y0:w,y1:w},this.services.cartesianScales.getOrientation())}).attr("opacity",1)},p=()=>{let m=[];s.filter(v=>_(v,"marker")!==null).forEach(v=>{const b=v.marker,w=v[o];m=m.concat([{datum:v,value:b*.25,barValue:w},{datum:v,value:b*.5,barValue:w},{datum:v,value:b*.75,barValue:w}])});const g=P.appendOrSelect(i,"g.quartiles").selectAll("path.quartile").data(m,v=>v[r]);g.exit().attr("opacity",0).remove(),g.enter().append("path").attr("opacity",0).merge(g).attr("class",v=>`quartile ${v.value<=v.barValue?"over-bar":""}`).transition().call(v=>this.services.transitions.setupTransition({transition:v,name:"bullet-quartile-update-enter",animate:t})).attr("d",({datum:v,value:b})=>{let w=4;v.ranges&&v.ranges.indexOf(b)!==-1&&(w=8);const O=this.services.cartesianScales.getDomainValue(v)-w/2,E=O+w,T=this.services.cartesianScales.getRangeValue(b);return ue({x0:O,x1:E,y0:T,y1:T},this.services.cartesianScales.getOrientation())}).attr("opacity",1)};h(),d(),f(),p(),this.addEventListeners()}addEventListeners(){const t=this,n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.services.cartesianScales.getRangeIdentifier();this.parent.selectAll("path.bar").on("mouseover",function(s,a){const o=N(this);o.classed("hovered",!0),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:s,element:o,datum:a});const l=_(n,"bullet","performanceAreaTitles"),c=t.model.getMatchingRangeIndexForDatapoint(a);t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:n.tooltip.groupLabel||"Group",value:a[r],class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:a[r]})},{label:"Value",value:a[i]},{label:"Target",value:a.marker},{label:"Percentage",value:`${Math.floor(a[i]/a.marker*100)}%`},{label:"Performance",value:l[c]}]})}).on("mousemove",function(s,a){t.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:s,element:N(this),datum:a}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){t.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);o.classed("hovered",!1),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:s,element:o,datum:a}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}function nR(e){return e}function rR(e){if(e==null)return nR;var t,n,r=e.scale[0],i=e.scale[1],s=e.translate[0],a=e.translate[1];return function(o,l){l||(t=n=0);var c=2,u=o.length,h=new Array(u);for(h[0]=(t+=o[0])*r+s,h[1]=(n+=o[1])*i+a;c<u;)h[c]=o[c],++c;return h}}function iR(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function sR(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return Om(e,n)})}:Om(e,t)}function Om(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,s=Hc(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:s}:r==null?{type:"Feature",id:n,properties:i,geometry:s}:{type:"Feature",id:n,bbox:r,properties:i,geometry:s}}function Hc(e,t){var n=rR(e.transform),r=e.arcs;function i(u,h){h.length&&h.pop();for(var d=r[u<0?~u:u],f=0,p=d.length;f<p;++f)h.push(n(d[f],f));u<0&&iR(h,p)}function s(u){return n(u)}function a(u){for(var h=[],d=0,f=u.length;d<f;++d)i(u[d],h);return h.length<2&&h.push(h[0]),h}function o(u){for(var h=a(u);h.length<4;)h.push(h[0]);return h}function l(u){return u.map(o)}function c(u){var h=u.type,d;switch(h){case"GeometryCollection":return{type:h,geometries:u.geometries.map(c)};case"Point":d=s(u.coordinates);break;case"MultiPoint":d=u.coordinates.map(s);break;case"LineString":d=a(u.arcs);break;case"MultiLineString":d=u.arcs.map(a);break;case"Polygon":d=l(u.arcs);break;case"MultiPolygon":d=u.arcs.map(l);break;default:return null}return{type:h,coordinates:d}}return c(t)}function aR(e,t){var n={},r={},i={},s=[],a=-1;t.forEach(function(c,u){var h=e.arcs[c<0?~c:c],d;h.length<3&&!h[1][0]&&!h[1][1]&&(d=t[++a],t[a]=c,t[u]=d)}),t.forEach(function(c){var u=o(c),h=u[0],d=u[1],f,p;if(f=i[h])if(delete i[f.end],f.push(c),f.end=d,p=r[d]){delete r[p.start];var m=p===f?f:f.concat(p);r[m.start=f.start]=i[m.end=p.end]=m}else r[f.start]=i[f.end]=f;else if(f=r[d])if(delete r[f.start],f.unshift(c),f.start=h,p=i[h]){delete i[p.end];var g=p===f?f:p.concat(f);r[g.start=p.start]=i[g.end=f.end]=g}else r[f.start]=i[f.end]=f;else f=[c],r[f.start=h]=i[f.end=d]=f});function o(c){var u=e.arcs[c<0?~c:c],h=u[0],d;return e.transform?(d=[0,0],u.forEach(function(f){d[0]+=f[0],d[1]+=f[1]})):d=u[u.length-1],c<0?[d,h]:[h,d]}function l(c,u){for(var h in c){var d=c[h];delete u[d.start],delete d.start,delete d.end,d.forEach(function(f){n[f<0?~f:f]=1}),s.push(d)}}return l(i,r),l(r,i),t.forEach(function(c){n[c<0?~c:c]||s.push([c])}),s}function oR(e){for(var t=-1,n=e.length,r,i=e[n-1],s=0;++t<n;)r=i,i=e[t],s+=r[0]*i[1]-r[1]*i[0];return Math.abs(s)}function lR(e){return Hc(e,cR.apply(this,arguments))}function cR(e,t){var n={},r=[],i=[];t.forEach(s);function s(l){switch(l.type){case"GeometryCollection":l.geometries.forEach(s);break;case"Polygon":a(l.arcs);break;case"MultiPolygon":l.arcs.forEach(a);break}}function a(l){l.forEach(function(c){c.forEach(function(u){(n[u=u<0?~u:u]||(n[u]=[])).push(l)})}),r.push(l)}function o(l){return oR(Hc(e,{type:"Polygon",arcs:[l]}).coordinates[0])}return r.forEach(function(l){if(!l._){var c=[],u=[l];for(l._=1,i.push(c);l=u.pop();)c.push(l),l.forEach(function(h){h.forEach(function(d){n[d<0?~d:d].forEach(function(f){f._||(f._=1,u.push(f))})})})}}),r.forEach(function(l){delete l._}),{type:"MultiPolygon",arcs:i.map(function(l){var c=[],u;if(l.forEach(function(m){m.forEach(function(g){g.forEach(function(v){n[v<0?~v:v].length<2&&c.push(v)})})}),c=aR(e,c),(u=c.length)>1)for(var h=1,d=o(c[0]),f,p;h<u;++h)(f=o(c[h]))>d&&(p=c[0],c[0]=c[h],c[h]=p,d=f);return c}).filter(function(l){return l.length>0})}}class uR extends kn{constructor(){super(...arguments),this.type="ruler-binned",this.renderType=nt.SVG}showRuler(t,[n,r]){const i=this.parent,s=this.model.getOptions(),{cartesianScales:a}=this.services,o=a.getOrientation(),l=a.getRangeScale(),[c,u]=l.range(),h=a.getDomainScale(),d=h.invert(o===Jt.VERTICAL?n:r),f=P.appendOrSelect(i,"g.ruler").attr("aria-label","ruler"),p=P.appendOrSelect(f,"line.ruler-line"),m=i.selectAll("[role=graphics-symbol]").filter(g=>{if(parseFloat(kt(g,"data.x0"))<=d&&parseFloat(kt(g,"data.x1"))>=d)return!0});if(m.size()>0){this.elementsToHighlight&&this.elementsToHighlight.size()>0&&!rm(this.elementsToHighlight,m)&&this.hideRuler(),m.dispatch("mouseover"),this.elementsToHighlight=m;const g=N(m.nodes()[0]).datum(),v=parseFloat(kt(g,"data.x0")),b=parseFloat(kt(g,"data.x1")),w=this.model.getActiveDataGroupNames(),O=w.reverse().map(E=>({label:E,value:kt(g,`data.${E}`),class:this.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:E})})).filter(E=>E.value!==0);if(O.length>0){this.services.events.dispatchEvent(A.Tooltip.SHOW,{mousePosition:[n,r],hoveredElement:p,items:[{label:kt(s,"bins.rangeLabel")||"Range",value:`${v} – ${b}`},...O,..._(s,"tooltip","showTotal")===!0?[{label:kt(s,"tooltip.totalLabel")||"Total",value:w.reduce((T,S)=>T+parseFloat(kt(g,`data.${S}`)),0)}]:[]]}),f.attr("opacity",1);const E=h((v+b)/2);o==="horizontal"?p.attr("x1",u).attr("x2",c).attr("y1",E).attr("y2",E):p.attr("y1",u).attr("y2",c).attr("x1",E).attr("x2",E)}else this.hideRuler()}else this.hideRuler()}}class eo extends kn{formatTooltipData(t){return t.reverse()}}const hR=(e,t)=>{const n=e.x,r=e.y,i=t.x,s=t.y,a=ah();return a.moveTo(n,r),a.lineTo(i,s),a.toString()},dR={d:"M7 0v8L0 4z",height:8,width:7.5,id:"arrowLeft"},fR={d:"M0 0v8l7-4z",height:8,width:7.5,id:"arrowRight"},pR={d:"M5.32 9.513a4.75 4.75 0 100-9.5 4.75 4.75 0 000 9.5z",height:10,width:10,id:"circle"},gR={d:"M5.03517654-1e-7l4.99999996 5-4.99999996 5-5-5L2.4517844 2.58339204z",height:10,width:10,id:"diamond"},mR={d:"M0 .44974747h8v8H0v-3.6830331z",height:9,width:8,id:"square"},vR={d:"M0 0h1.5v8H0z",height:8,width:2,id:"tee"};class Tm extends Bc{constructor(t,n,r){super(t,n,r),this.type="color-legend",this.renderType=nt.SVG,this.gradient_id=`gradient-id-${Math.floor(Math.random()*99999999999)}`,this.handleAxisCompleteEvent=()=>{const i=this.getComponentContainer(),{width:s}=P.getSVGElementSize(i,{useAttrs:!0}),a=_(this.getOptions(),"data","loading");if(s>Vt.color.barWidth&&!a){const o=_(this.getOptions(),"heatmap","colorLegend","title"),{cartesianScales:l}=this.services,c=l.getMainXScale().range();if(c[0]>1&&(i.select("g.legend").attr("transform",`translate(${c[0]}, 0)`),o)){const{width:u}=P.getSVGElementSize(i.select("g.legend-title").select("text"),{useBBox:!0}),h=c[0]-u-9;h>1?i.select("g.legend-title").attr("transform",`translate(${h}, 0)`):(i.select("g.legend").attr("transform",`translate(${c[0]}, 16)`),i.select("g.legend-title").attr("transform",`translate(${c[0]}, 0)`))}}else i.select("g.legend-title").attr("transform","translate(0, 0)")},this.chartType=r.chartType}init(){this.chartType==="heatmap"&&this.services.events.addEventListener(A.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}render(t=!1){const n=this.getOptions(),r=this.getComponentContainer(),{width:i}=P.getSVGElementSize(r,{useAttrs:!0}),s=_(n,"color","gradient","colors"),a=_(n,this.chartType,"colorLegend","type");let o=_(n,"color","pairing","option");const l=_(n,"heatmap","colorLegend","title");if(_(this.getOptions(),"data","loading")){r.html("");return}const c=!ze(s),u=xg(this.model.getDisplayData()),h=!(i<=Vt.color.barWidth),d=h?Vt.color.barWidth:i,f=P.appendOrSelect(r,"g.legend"),p=P.appendOrSelect(f,"g.legend-axis");if(l){const S=P.appendOrSelect(r,"g.legend-title");P.appendOrSelect(S,"text").text(l).attr("dy","0.7em"),f.attr("transform","translate(0, 16)")}const m=u[0]<0&&u[1]>0?"diverge":"mono";(o<1&&o>4&&m==="mono"||o<1&&o>2&&m==="diverge")&&(o=1);let g=[];const v=m==="diverge"?17:11;if(c)g=s;else for(let S=1;S<v+1;S++)g.push(a===va.LINEAR?`stop-color-${m}-${o}-${S}`:`fill-${m}-${o}-${S}`);const b=we(u[0],u[1]),w=n1(b,3),O=Be().domain(u).range([0,d]),E=lo(O).tickSize(0).tickValues(w);let T;switch(a){case va.LINEAR:this.drawLinear(g,f,d);break;case va.QUANTIZE:T=this.drawQuantize(g,m,c,f,d),O.range([T,d]);break;default:throw Error("Entered color legend type is not supported.")}p.attr("transform",`translate(0,${Vt.color.axisYTranslation})`).call(E),p.select(".domain").remove(),p.select("g.tick:last-of-type text").style("text-anchor",h?"middle":"end"),p.select("g.tick:first-of-type text").style("text-anchor",h&&this.chartType!=="choropleth"?"middle":"start")}drawLinear(t,n,r){const i=100/(t.length-1);P.appendOrSelect(n,"linearGradient").attr("id",`${this.gradient_id}-legend`).selectAll("stop").data(t).enter().append("stop").attr("offset",(s,a)=>`${a*i}%`).attr("class",(s,a)=>t[a]).attr("stop-color",s=>s),P.appendOrSelect(n,"rect").attr("width",r).attr("height",Vt.color.barHeight).style("fill",`url(#${this.gradient_id}-legend)`)}drawQuantize(t,n,r,i,s){!r&&n==="diverge"&&t.splice(t.length/2,1);const a=xi().domain(t).range([0,s]);return P.appendOrSelect(i,"g.quantized-rect").selectAll("rect").data(a.domain()).join("rect").attr("x",o=>a(o)).attr("y",0).attr("width",Math.max(0,a.bandwidth()-1)).attr("height",Vt.color.barHeight).attr("class",o=>o).attr("fill",o=>o),(!r&&n)==="mono"?a.bandwidth()-1:0}destroy(){this.chartType==="heatmap"&&this.services.events.removeEventListener(A.Axis.RENDER_COMPLETE,this.handleAxisCompleteEvent)}}class yR extends ts{constructor(){super(...arguments),this.type="meter-title",this.renderType=nt.SVG}render(t=!1){const n=_(this.model.getDisplayData(),0),r=this.getOptions(),i=this.getComponentContainer(),{groupMapsTo:s}=r.data;if(_(r,"meter","proportional"))this.displayTotal(),this.displayBreakdownTitle();else{const l=i.selectAll("text.meter-title").data([n[s]]);l.enter().append("text").classed("meter-title",!0).merge(l).attr("x",0).attr("y","1em").text(c=>c),l.exit().remove(),this.appendPercentage()}this.displayStatus();const a=this.getMaxTitleWidth(),o=P.appendOrSelect(i,"text.meter-title");a>0&&o.node().getComputedTextLength()>a&&this.truncateTitle(o,a)}displayBreakdownTitle(){const t=this.getComponentContainer(),n=this.getOptions(),r=this.model.getMaximumDomain(this.model.getDisplayData()),i=_(n,"meter","proportional","total"),s=_(n,"meter","proportional","unit")?_(n,"meter","proportional","unit"):"";let a;if(r===i)a=null;else{const u=i!==null?i-r:r,h=_(n,"meter","proportional","breakdownFormatter");a=h!==null?h({datasetsTotal:r,total:i}):`${r} ${s} used (${u} ${s} available)`}const o=t.selectAll("text.proportional-meter-title").data([a]);o.enter().append("text").classed("proportional-meter-title",!0).merge(o).attr("x",0).attr("y","1em").text(u=>u),o.exit().remove();const l=this.getMaxTitleWidth(),c=P.appendOrSelect(t,"text.proportional-meter-title");l>0&&c.node().getComputedTextLength()>l&&this.truncateTitle(c,l)}displayTotal(){const t=this.getComponentContainer(),n=this.getOptions(),r=_(n,"meter","proportional","total"),i=r?_(n,"meter","proportional","total"):this.model.getMaximumDomain(this.model.getDisplayData()),s=_(n,"meter","proportional","unit")?_(n,"meter","proportional","unit"):"",a=_(n,"meter","proportional","totalFormatter"),o=a!==null?a(i):`${r} ${s} total`,l=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),c=l.width?l.width:this.parent.node().getAttribute("width"),u=t.selectAll("text.proportional-meter-total").data([o]);u.enter().append("text").classed("proportional-meter-total",!0).merge(u).attr("x",this.model.getStatus()&&typeof c!="string"?c-te.total.paddingRight:c).attr("y","1em").attr("text-anchor","end").text(h=>h),u.exit().remove()}displayStatus(){const t=this,n=this.getComponentContainer(),r=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),i=r.width?r.width:0,s=this.model.getStatus(),a=te.status.indicatorSize/2,o=P.appendOrSelect(n,"g.status-indicator").attr("class",s!==null?`status-indicator status--${s}`:"").attr("transform",`translate(${i-a}, 0)`),l=s?[s]:[],c=o.selectAll("circle.status").data(l);c.enter().append("circle").merge(c).attr("class","status").attr("r",a).attr("cx",0).attr("cy",8);const u=o.selectAll("path.innerFill").data(l);u.enter().append("path").merge(u).attr("d",t.getStatusIconPathString(s)).attr("transform",`translate(-${a}, 0)`).attr("class","innerFill"),u.exit().remove(),c.exit().remove()}appendPercentage(){const t=_(this.model.getDisplayData(),0,"value"),n=this.getComponentContainer(),r=P.appendOrSelect(n,"text.meter-title"),i=_(this.getOptions(),"meter","statusBar","percentageIndicator","enabled")===!0?[t]:[],s=n.selectAll("text.percent-value").data(i),a=te.statusBar.paddingRight;s.enter().append("text").classed("percent-value",!0).merge(s).text(o=>`${o}%`).attr("x",+r.attr("x")+r.node().getComputedTextLength()+a).attr("y",r.attr("y")),s.exit().remove()}truncateTitle(t,n){super.truncateTitle(t,n);const r=P.appendOrSelect(this.parent,"tspan"),i=te.statusBar.paddingRight,s=Math.ceil(r.node().getComputedTextLength());P.appendOrSelect(this.parent,"text.percent-value").attr("x",+t.attr("x")+t.node().getComputedTextLength()+s+i)}getMaxTitleWidth(){const t=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),n=_(this.getOptions(),"meter","proportional"),r=t.width?t.width:this.parent.node().getBoundingClientRect().width;if(n!==null){const i=P.appendOrSelect(this.parent,"text.proportional-meter-total").node(),s=P.getSVGElementSize(i,{useBBox:!0}).width;return r-s-te.total.paddingLeft}else{const i=P.appendOrSelect(this.parent,"text.percent-value"),s=te.statusBar.paddingRight,a=i.node().getComputedTextLength(),o=P.appendOrSelect(this.parent,"g.status-indicator").node(),l=P.getSVGElementSize(o,{useBBox:!0}).width+te.status.paddingLeft;return r-a-s-l}}getStatusIconPathString(t){switch(t){case ga.SUCCESS:return"M6.875 11.3125 3.75 8.1875 4.74375 7.25 6.875 9.34375 11.50625 4.75 12.5 5.7375 Z";case ga.DANGER:return"M10.7 11.5 4.5 5.3 5.3 4.5 11.5 10.7 Z";case ga.WARNING:return"M7.9375,11.125 C7.41973305,11.125 7,11.544733 7,12.0625 C7,12.580267 7.41973305,13 7.9375,13 C8.45526695,13 8.875,12.580267 8.875,12.0625 C8.875,11.544733 8.45526695,11.125 7.9375,11.125 M7.3125, 3 8.5625, 3 8.5625, 9.875 7.3125, 9.875, 7.3125, 3 Z"}}}class Fc extends gt{getBarWidth(){const t=this.getOptions();if(t.bars.width)return t.bars.width;const n=this.model.getDisplayData().length,r=this.services.cartesianScales.getMainXScale(),i=P.getSVGElementSize(this.parent,{useAttrs:!0}).width;if(!r.step){const s=_(t,"bars","spacingFactor");return Math.min(t.bars.maxWidth,i*s/n)}return Math.min(t.bars.maxWidth,r.step()/2)}isOutsideZoomedDomain(t,n){if(this.model.getDisplayData().length<=1)return!1;const r=this.model.get("zoomDomain");if(r!==void 0){const i=this.services.cartesianScales.getDomainScale();return t<i(r[0])||n>i(r[1])}return!1}}class bR extends gt{constructor(){super(...arguments),this.type="circle-pack",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("circle.node").transition("legend-hover-circlepack").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-circlepack"})).attr("opacity",r=>r.data.dataGroupName===n.datum().name?1:kr.circles.fillOpacity)},this.handleLegendMouseOut=()=>{this.parent.selectAll("circle.node").transition("legend-mouseout-circlepack").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-circlepack"})).attr("opacity",1)}}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),{width:r,height:i}=P.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;let s=this.model.getDisplayData();const a=this.model.hasParentNode(),o=this.model.getHierarchyLevel(),l=this.getOptions(),c=_(l,"canvasZoom","enabled");a&&_(s,0,"children")&&(s=_(s,0,"children"));const u=vi({children:s}).sum(p=>p.value).sort((p,m)=>m.value-p.value),h=mw().size([r,i]).padding(p=>p.depth>=1?kr.padding.children+3:kr.padding.mainGroup+3)(u).descendants().splice(1).filter(p=>p.depth<=o),d=n.selectAll("circle.node").data(h);d.exit().attr("width",0).attr("height",0).remove();const f=d.enter().append("circle").classed("node",!0);f.merge(d).attr("class",p=>{const m=c&&o===3?this.getZoomClass(p):"";return this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:p.data.dataGroupName,originalClassName:p.children?`node ${m}`:`node node-leaf ${m}`})}).style("fill",p=>this.model.getFillColor(p.data.dataGroupName)).style("stroke",p=>this.model.getFillColor(p.data.dataGroupName)).attr("cx",p=>p.x).attr("cy",p=>p.y).transition("circlepack-leaf-update-enter").call(p=>this.services.transitions.setupTransition({transition:p,name:"circlepack-leaf-update-enter"})).attr("r",p=>p.r).attr("opacity",1).attr("fill-opacity",kr.circles.fillOpacity),c===!0&&this.focal&&(this.services.canvasZoom.zoomIn(this.focal,f,Dr),this.setBackgroundListeners()),a||this.addLegendListeners(),this.addEventListeners()}unhighlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",r=>this.model.getFillColor(r.data.dataGroupName))}highlightChildren(t){const n=t.map(r=>r.data);this.parent.selectAll("circle.node").filter(r=>n.some(i=>i===r.data)&&r.depth>1).style("stroke",kr.circles.hover.stroke)}getZoomClass(t){return this.model.getHierarchyLevel()===3&&this.focal&&(t.data===this.focal.data||this.focal.children.some(n=>n.data===t.data))?"focal":"non-focal"}addLegendListeners(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}removeBackgroundListeners(){N(this.services.domUtils.getMainContainer()).on("click",()=>null)}setBackgroundListeners(){const t=N(this.services.domUtils.getMainContainer()),n=this,r=this.parent.selectAll("circle.node");t.on("click",()=>{n.focal=null,n.model.updateHierarchyLevel(2),t.classed("zoomed-in",!1),n.services.canvasZoom.zoomOut(r,Dr)})}getZoomIcon(){return`
|
|
80
80
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
|
|
81
81
|
<polygon points="5.93 3.71 4.45 3.71 4.45 2.23 3.71 2.23 3.71 3.71 2.23 3.71 2.23 4.45 3.71 4.45 3.71 5.93 4.45 5.93 4.45 4.45 5.93 4.45 5.93 3.71"/>
|
|
82
82
|
<path d="M7.2,6.67a4,4,0,0,0,1-2.59A4.08,4.08,0,1,0,4.07,8.15h0a4,4,0,0,0,2.59-1L9.48,10,10,9.48Zm-3.12.77A3.34,3.34,0,1,1,7.41,4.08,3.34,3.34,0,0,1,4.08,7.44Z"/>
|
|
83
|
-
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=_(t.model.getOptions(),"canvasZoom","enabled");let l=!1;if(!a){let c=[],u=[],h=null;if(r.children){r.depth>1&&o&&(l=!0,i.classed("clickable",!0)),c=r.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:kt(f,"tooltip.totalLabel")||"Total",value:r.value,bold:!0}],t.highlightChildren(r.children)}else h=r.value;const d=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:d,label:r.data.name,labelIcon:l&&o&&s<=2?t.getZoomIcon():null,value:h},...c,...u]})}t.services.events.dispatchEvent(A.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(A.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=N(this),s=i.classed("non-focal"),a=_(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");N(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,Dr)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");N(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,Dr),n.stopPropagation()}t.services.events.dispatchEvent(A.CirclePack.CIRCLE_CLICK,{event:n,element:i,datum:r})})}destroy(){this.parent.selectAll("circle.node").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function xR(e,t){const n=ei(this._current,e);return r=>(this._current=n(r),t(this._current))}class Mm extends gt{constructor(){super(...arguments),this.type="pie",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i.data[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.slice").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Dt.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie,o=this.model.getDisplayData().filter(S=>S[a]>0),l=this.computeRadius();this.arc=Ti().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=Ti().innerRadius(this.getInnerRadius()).outerRadius(l+Dt.hoverArc.outerRadiusOffset);const c=fE().value(S=>S[a]).sort(_(i,"pie","sortFunction")).padAngle(Dt.padAngle)(o),u=P.appendOrSelect(r,"g.slices").attr("role",dt.GROUP).attr("data-name","slices").selectAll("path.slice").data(c,S=>S.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",S=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:S.data[s],originalClassName:"slice"})).style("fill",S=>n.model.getFillColor(S.data[s])).attr("d",this.arc).transition().call(S=>this.services.transitions.setupTransition({transition:S,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",S=>`${S[a]}, ${sg(S.data[a],o,a)+"%"}`).attrTween("d",function(S){return xR.bind(this)(S,n.arc)});const h=i.pie.labels.enabled,d=h?c.filter(S=>S.data[a]>0):[],f=P.appendOrSelect(r,"g.labels").attr("role",dt.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(d,S=>S.data[s]);f.exit().attr("opacity",0).remove();const p=f.enter().append("text").classed("pie-label",!0),m=[];p.merge(f).style("text-anchor","middle").text(S=>i.pie.labels.formatter?i.pie.labels.formatter(S):sg(S.data[a],o,a)+"%").datum(function(S){const $=l+7,k=(S.endAngle-S.startAngle)/2+S.startAngle,L=k/Math.PI*180,M=this.getComputedTextLength();return S.textOffsetX=M/2,S.textOffsetY=L>90&&L<270?10:0,S.xPosition=(S.textOffsetX+$)*Math.sin(k),S.yPosition=(S.textOffsetY+$)*-Math.cos(k),S}).attr("transform",function(S,$){const k=d.length,L=(S.endAngle-S.startAngle)*(180/Math.PI);if($>=k-2&&L<Dt.callout.minSliceDegree){let M,V;return S.index===k-1?(M=S.xPosition+Dt.callout.offsetX+Dt.callout.textMargin+S.textOffsetX,V=S.yPosition-Dt.callout.offsetY,S.direction=pa.RIGHT,m.push(S)):(M=S.xPosition-Dt.callout.offsetX-S.textOffsetX-Dt.callout.textMargin,V=S.yPosition-Dt.callout.offsetY,S.direction=pa.LEFT,m.push(S)),`translate(${M}, ${V})`}return`translate(${S.xPosition}, ${S.yPosition})`}),this.renderCallouts(m);const g=_(i,"donut")?"donut":"pie",v=_(i,g,"alignment"),{width:b}=P.getSVGElementSize(this.getParent(),{useAttrs:!0}),w=h?Dt.xOffset:0,O=h?Dt.yOffset:0;let E=l+w;v===Yt.CENTER?E=b/2:v===Yt.RIGHT&&(E=b-l-Dt.xOffset);let T=l+O;m.length>0&&(T+=Dt.yOffsetCallout),r.attr("x",E+7).attr("y",T),this.addEventListeners()}renderCallouts(t){const n=P.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",dt.GROUP).attr("data-name","callouts"),r=n.selectAll("g.callout").data(t);r.exit().remove();const i=r.enter().append("g").classed("callout",!0).attr("role",dt.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(s){const{xPosition:a,yPosition:o,direction:l}=s;return l===pa.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+Dt.callout.offsetX,y:o-Dt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-Dt.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-Dt.callout.offsetX,y:o-Dt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+Dt.callout.horizontalLineLength),s}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return N(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.startPos.x).attr("y1",s=>s.startPos.y).attr("x2",s=>s.intersectPointX).attr("y2",s=>s.endPos.y),i.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return N(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.intersectPointX).attr("y1",s=>s.endPos.y).attr("x2",s=>s.endPos.x).attr("y2",s=>s.endPos.y)}addEventListeners(){const t=this;this.parent.selectAll("path.slice").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0).transition("pie_slice_mouseover").call(o=>t.services.transitions.setupTransition({transition:o,name:"pie_slice_mouseover"})).attr("d",t.hoverArc),t.services.events.dispatchEvent(A.Pie.SLICE_MOUSEOVER,{event:n,element:N(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Pie.SLICE_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc),t.services.events.dispatchEvent(A.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}computeRadius(){const{width:t,height:n}=P.getSVGElementSize(this.parent,{useAttrs:!0}),r=this.getOptions(),i=Math.min(t,n)/2;return r.pie.labels.enabled?i+Dt.radiusOffset:i}}class wR extends Mm{constructor(){super(...arguments),this.type="donut",this.renderType=nt.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const r=P.appendOrSelect(this.getComponentContainer(),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=_(i,"donut","center","label");P.appendOrSelect(r,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>i.donut.center.numberFontSize(s)).transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"donut-figure-enter-update",animate:t})).tween("text",function(){return n.centerNumberTween(N(this))}),a!==null&&a!==""&&P.appendOrSelect(r,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>i.donut.center.titleFontSize(s)).attr("y",i.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let r=_(n,"donut","center","number");r===null&&(r=this.model.getDisplayData().reduce((o,l)=>o+l[n.pie.valueMapsTo],0));const i=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;i%1===0&&r%1===0?s=Pu:s=we;const a=s(i,r);return o=>{const{numberFormatter:l}=n.donut.center;t.text(l(a(o)))}}}const Cm="4,10 8,6 12,10",Am="12,6 8,10 4,6";class _R extends gt{constructor(){super(...arguments),this.type="gauge",this.renderType=nt.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return nm(this.getValue(),0,100)/100}getDelta(){var t;return((t=this.model.getData().find(n=>n.group==="delta"))==null?void 0:t.value)??null}getArcRatio(){const t=this.getOptions();return _(t,"gauge","type")===Ar.FULL?1:.5}getArcSize(){return this.getArcRatio()*Math.PI*2}getStartAngle(){const t=this.getArcSize();return t===2*Math.PI?0:-t/2}getArrow(t){const n=this.getOptions();switch(_(n,"gauge","deltaArrow","direction")){case Nl.UP:return Cm;case Nl.DOWN:return Am;default:return t>0?Cm:Am}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.getOptions(),i=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),l=s*a,c=o+l,u=o+a,h=this.computeRadius(),d=this.getInnerRadius();this.backgroundArc=Ti().innerRadius(d).outerRadius(h).startAngle(c).endAngle(u),this.arc=Ti().innerRadius(d).outerRadius(h).startAngle(o).endAngle(c),P.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([i]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>_(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",v=>v),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const p=_(r,"gauge","alignment"),{width:m}=P.getSVGElementSize(this.getParent(),{useAttrs:!0});let g=h;p===Yt.CENTER?g=m/2:p===Yt.RIGHT&&(g=m-h),n.attr("x",g).attr("y",h),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=_(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=_(n,"gauge","valueFontSize"),l=_(n,"gauge","deltaFontSize"),c=_(n,"gauge","numberSpacing"),u=_(n,"gauge","showPercentageSymbol");let h=0;r===Ar.FULL&&!s?h=l(a):r===Ar.SEMI&&s&&(h=-(l(a)+c));const d=P.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${h})`),f=o(a),p=P.appendOrSelect(d,"g.gauge-value-number"),m=_(n,"gauge","numberFormatter"),g=p.selectAll("text.gauge-value-number").data([i]);g.enter().append("text").attr("class","gauge-value-number").merge(g).style("font-size",`${f}px`).attr("text-anchor","middle").text(S=>m(S));const{width:v}=P.getSVGElementSize(P.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),b=f/2,w=u?"%":"",O=P.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${b}px`).attr("x",v/2).text(w),{width:E,height:T}=P.getSVGElementSize(O,{useBBox:!0});O.attr("y",`-${T/2}px`),p.attr("transform",`translate(-${E/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta();if(i){const s=this.computeRadius(),a=i?_(r,"gauge","deltaFontSize"):()=>0,o=i?_(r,"gauge","numberFormatter"):()=>null,l=_(r,"gauge","deltaArrow","size"),c=_(r,"gauge","numberSpacing"),u=_(r,"gauge","showPercentageSymbol"),h=P.appendOrSelect(n,"g.gauge-numbers"),d=P.appendOrSelect(h,"g.gauge-delta").attr("transform",`translate(0, ${a(s)+c})`),f=P.appendOrSelect(d,"text.gauge-delta-number"),p=u?"%":"";f.data(i===null?[]:[i]),f.enter().append("text").classed("gauge-delta-number",!0).merge(f).attr("text-anchor","middle").style("font-size",`${a(s)}px`).text(b=>`${o(b)}${p}`);const{width:m}=P.getSVGElementSize(P.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),g=_(r,"gauge","deltaArrow","enabled"),v=d.selectAll("svg.gauge-delta-arrow").data(i!==null&&g?[i]:[]);v.enter().append("svg").merge(v).attr("class","gauge-delta-arrow").attr("x",-l(s)-m/2).attr("y",-l(s)/2-a(s)*.35).attr("width",l(s)).attr("height",l(s)).attr("viewBox","0 0 16 16").each(function(){const b=N(this);P.appendOrSelect(b,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const w=_(r,"gauge","status");P.appendOrSelect(b,"polygon.gauge-delta-arrow").attr("class",w!==null?`gauge-delta-arrow status--${w}`:"").attr("points",t.getArrow(i))}),v.exit().remove(),f.exit().remove()}else{const s=n.select("g.gauge-delta");s.empty()||s.remove()}}getInnerRadius(){const t=this.computeRadius(),n=_(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,r){t.services.events.dispatchEvent(A.Gauge.ARC_MOUSEOVER,{event:n,element:N(this),datum:r})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Gauge.ARC_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=_(t,"gauge","type"),{width:r,height:i}=P.getSVGElementSize(this.parent,{useAttrs:!0});return n===Ar.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class $m extends Fc{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=nt.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),r=this.getOptions(),{groupMapsTo:i}=r.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=ji(n.map(u=>{const h=this.services.cartesianScales.getDomainIdentifier(u);return u[h]&&typeof u[h].toString=="function"?u[h].toString():u[h]})),o=s.selectAll("g.bars").data(a,u=>u);o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars").merge(o);l.transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-group-update-enter",animate:t})).attr("transform",u=>{const h=this.services.cartesianScales.getDomainValue(u)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Jt.VERTICAL?`translate(${h}, 0)`:`translate(0, ${h})`});const c=l.selectAll("path.bar").data(u=>this.getDataCorrespondingToLabel(u),u=>u[i]);c.exit().attr("opacity",0).remove(),c.enter().append("path").attr("opacity",0).merge(c).classed("bar",!0).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:u[i],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[i])).attr("d",u=>{const h=this.groupScale(u[i]),d=this.getBarWidth(),f=h,p=h+d,m=this.services.cartesianScales.getRangeAxisPosition({datum:u}),g=this.services.cartesianScales.getValueThroughAxisPosition(m,0),v=this.services.cartesianScales.getRangeValue(u),b=this.services.cartesianScales.getDomainValue(u)-d/2,w=b+d;if(!this.isOutsideZoomedDomain(b,w))return ue({x0:f,x1:p,y0:g,y1:v},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>u.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(n=>{const r=this.services.cartesianScales.getDomainIdentifier(n);return n[r].toString()===t})}getGroupWidth(){const t=this.model.getGroupedData(this.configs.groups),n=this.getTotalGroupPadding();return this.getBarWidth()*t.length+n}getDomainScaleStep(){const t=this.services.cartesianScales.getDomainScale(),n=this.model.getGroupedData(this.configs.groups);let r=this.defaultStepFactor;if(typeof t.step=="function")r=t.step();else if(n.length>0){const i=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(i){const s=this.services.cartesianScales.getDomainIdentifier(i.data[0]);r=Math.abs(t(i.data[1][s])-t(i.data[0][s]))}}return r}getTotalGroupPadding(){const t=this.model.getGroupedData(this.configs.groups);return t.length===1?0:Math.min(5,5*(this.getDomainScaleStep()/this.defaultStepFactor))*(t.length-1)}getBarWidth(){const t=this.getOptions(),n=_(t,"bars","width"),r=_(t,"bars","maxWidth");if(n!==null&&(r===null||n<=r))return n;const i=this.model.getGroupedData(this.configs.groups).length,s=this.getTotalGroupPadding();return Math.min(r,(this.getDomainScaleStep()-s)/i)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=xi().domain(t).rangeRound([0,this.getGroupWidth()])}}class ER extends gt{constructor(){super(...arguments),this.type="heatmap",this.renderType=nt.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:r}=n,i=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),l=this.services.cartesianScales.getMainXScale(),c=this.services.cartesianScales.getMainYScale();let u="",h=null,d=null,f=null;this.matrix[r]!==void 0?(u=a,i.forEach(p=>{if(typeof this.matrix[r][p].value=="number"){const m=this.matrix[r][p].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][r].value=="number"){const m=this.matrix[p][r].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${Sn(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${Sn(l.range())},${c(r)})`),this.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n.event,hoveredElement:N(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:d!==null?d:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:h!==null?h/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(A.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(A.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(A.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(A.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(A.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),_(this.getOptions(),"data","loading"))return;const i=r.getMainXScale(),s=r.getMainYScale(),a=r.getDomainIdentifier(),o=r.getRangeIdentifier(),l=this.model.getUniqueDomain(),c=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),h=i.range(),d=s.range();this.xBandwidth=Math.abs((h[1]-h[0])/l.length),this.yBandwidth=Math.abs((d[1]-d[0])/c.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",m=>`heat-${m.index}`).classed("cell",!0).attr("transform",m=>`translate(${i(m[a])}, ${s(m[o])})`).append("rect").attr("class",m=>this.model.getColorClassName({value:m.value,originalClassName:`heat-${m.index}`})).classed("heat",!0).classed("null-state",m=>m.index===-1||m.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",m=>m.index===-1||m.value===null?`url(#${f})`:this.model.getFillColor(Number(m.value))).attr("aria-label",m=>m.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(d[1]-d[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(h[1]-h[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,r){const i=P.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);P.appendOrSelect(i,"line.top").attr("x1",-1).attr("x2",n+1),P.appendOrSelect(i,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",r+1),P.appendOrSelect(i,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",r).attr("y2",r),P.appendOrSelect(i,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",r+1)}determineDividerStatus(){const t=_(this.getOptions(),"heatmap","divider","state");return t!==Di.OFF&&(t===Di.AUTO&&qf.minCellDividerDimension<=this.xBandwidth&&qf.minCellDividerDimension<=this.yBandwidth||t===Di.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=kt(r,"tooltip.totalLabel"),s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),l=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(c,u){const h=N(this),d=h.select("rect.heat");if(!d.classed("null-state")){const f=Wi(h.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${f.x+t.translationUnits.x}, ${f.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(A.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:d,datum:u}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:c,items:[{label:o,value:u[s]},{label:l,value:u[a]},{label:i||"Total",value:u.value,color:d.style("fill")}]})}}).on("mousemove",function(c,u){t.services.events.dispatchEvent(A.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:N(this),datum:u}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(A.Heatmap.HEATMAP_CLICK,{event:c,element:N(this),datum:u})}).on("mouseout",function(c,u){const h=N(this).select("rect.heat"),d=h.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),d||(t.services.events.dispatchEvent(A.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{event:c,hoveredElement:h}))})}destroy(){this.parent.selectAll("rect.heat").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class SR extends gt{constructor(){super(...arguments),this.type="histogram",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-bar"})).attr("opacity",s=>s[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),r=this.model.getOptions(),{groupIdentifier:i}=r,{groupMapsTo:s}=r.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),l=n.selectAll("g.bars").data(a,u=>kt(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",dt.GROUP);const c=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).attr(i,(u,h)=>h).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s])).attr("d",u=>{const h=kt(u,"data");if(!h)return;const d=o(h.x1)-o(h.x0)-1,f=this.services.cartesianScales.getDomainValue(h.x0),p=f+d,m=this.services.cartesianScales.getRangeValue(u[0]);let g=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(g-m)>0&&Math.abs(g-m)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?g+=1:g-=1),ue({x0:f,x1:p,y0:m,y1:g},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>_(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=N(this);a.classed("hovered",!0);const o=parseFloat(kt(s,"data.x0")),l=parseFloat(kt(s,"data.x1")),c=r.services.cartesianScales.getRangeAxisPosition(),u=r.services.cartesianScales.getScaleLabel(c);r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:kt(t,"bins.rangeLabel")||"Range",value:`${o} – ${l}`},{label:t.tooltip.groupLabel||"Group",value:s[n],class:r.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:s[n]})},{label:u,value:kt(s,`data.${s[n]}`)}]})}).on("mousemove",function(i){r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("mouseout",function(){N(this).classed("hovered",!1),r.services.events.dispatchEvent(A.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class OR extends tn{constructor(){super(...arguments),this.type="lollipop",this.renderType=nt.SVG,this.handleScatterOnHover=t=>{const n=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[i]!==n.datum[i]?gn.weight.unselected:gn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",gn.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").transition("legend-hover-line").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-line"})).attr("opacity",s=>s[i]!==n.datum().name?gn.opacity.unselected:gn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("line.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",gn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.model.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),l=s.getDomainIdentifier(),c=g=>s.getDomainValue(g),u=g=>s.getRangeValue(g),h=s.getOrientation(),[d,f]=xn(c,u,h),p=n.selectAll("line.line").data(this.getScatterData(),g=>`${g[i]}-${g[l]}`);p.exit().attr("opacity",0).remove();const m=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",g=>this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:g[i],originalClassName:"line"})).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"lollipop-line-update-enter",animate:t})).style("stroke",g=>this.model.getFillColor(g[i],g[l],g)).attr("opacity",1);h===Jt.HORIZONTAL?m.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",g=>d(g)-r.points.radius):m.attr("x1",d).attr("x2",d).attr("y1",o.range()[0]).attr("y2",g=>f(g)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(A.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(A.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(A.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(A.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class TR extends gt{constructor(){super(...arguments),this.type="meter",this.renderType=nt.SVG}getStackedBounds(t,n){let r=0;return t.map((i,s)=>s!==0?(r+=n(i.value),{...i,width:Math.abs(n(i.value)-te.dividerWidth),x:r-n(i.value)}):(r=n(i.value),{...i,width:Math.abs(n(i.value)-te.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),s=_(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=P.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;_(i,"meter","proportional")===null?u=100:u=_(i,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const h=Be().domain([0,u]).range([0,l]),d=this.getStackedBounds(a,h),f=_(i,"meter","height");P.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",f||(s?te.height.proportional:te.height.default)),P.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",f||(s?te.height.proportional:te.height.default));const p=r.selectAll("rect.value").data(d),m=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",w=>w.x).attr("y",0).attr("height",()=>f||(s?te.height.proportional:te.height.default)).attr("class",w=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:w[c],originalClassName:m})).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"meter-bar-update",animate:t})).attr("width",w=>w.value>u?h(u):w.width).style("fill",w=>n.model.getFillColor(w[c])).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",w=>w.value),p.exit().remove();const g=_(i,"meter","peak");let v=g;g!==null&&(g>u?v=u:g<a[0].value&&(v=a[0].value>u?u:a[0].value));const b=r.selectAll("line.peak").data(v==null?[]:[v]);b.enter().append("line").classed("peak",!0).merge(b).attr("y1",0).attr("y2",()=>f||(s?te.height.proportional:te.height.default)).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"peak-line-update",animate:t})).attr("x1",w=>h(w)).attr("x2",w=>h(w)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",w=>w),b.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=_(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(A.Meter.METER_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class MR extends gt{constructor(){super(...arguments),this.type="radar",this.renderType=nt.SVG,this.getLabelDimensions=t=>{const n=P.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),r=P.appendOrSelect(n,"text").text(t),{width:i,height:s}=P.getSVGElementSize(r.node(),{useBBox:!0});return n.remove(),{width:i,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:r,value:i}=_(n,"radar","axes"),s=_(n,"data","groupMapsTo"),a=AD(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return at(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=_(n,"radar","axes"),s=_(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const l=this.uniqueKeys.map(c=>({[s]:a,[r]:c,[i]:null}));return{name:a,data:at(l,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-blob"})).style("fill-opacity",r=>r.name!==n.datum().name?Kn.opacity.unselected:Kn.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?Kn.opacity.unselected:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g.blobs path").transition("legend-mouseout-blob").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-blob"})).style("fill-opacity",Kn.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:r,height:i}=P.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=_(o,"data","groupMapsTo"),c=_(o,"radar","axes","value"),{angle:u,value:h}=_(o,"radar","axes"),{xLabelPadding:d,yLabelPadding:f,yTicksNumber:p,minRange:m,xAxisRectHeight:g}=Kn;this.uniqueKeys=Array.from(new Set(s.map(x=>x[u]))),this.uniqueGroups=Array.from(new Set(s.map(x=>x[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const v=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),b=(Math.min(r,i)-v)/2;if(b<=0)return;const w=xi().domain(this.fullDataNormalized.map(x=>x[u])).range([0,2*Math.PI].map(x=>x-Math.PI/2)),O=Sn(this.fullDataNormalized.map(x=>x[h])),E=Be().domain([O>=0?0:O,Nn(this.fullDataNormalized.map(x=>x[h]))]).range([m,b]).nice(p),T=E.ticks(p),S=x=>this.model.getFillColor(x),$=mE().angle(x=>w(x[u])+Math.PI/2).radius(x=>E(x[h])).curve(ef),k=this.uniqueKeys.map(x=>{const C=this.getLabelDimensions(x).width,y=Z$(w(x),b);return C+y}),L={x:Nn(k)+d,y:i/2},M=P.appendOrSelect(n,"g.y-axes").attr("role",dt.GROUP).selectAll("path").data(T,x=>x),V=x=>this.uniqueKeys.map(C=>({[u]:C,[h]:x}));M.join(x=>x.append("path").attr("opacity",0).attr("transform",`translate(${L.x}, ${L.y})`).attr("fill","none").call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",y=>$(V(y)))),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(V(y)))),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_exit",animate:t})).attr("d",y=>$(V(y))).attr("opacity",0).remove())),P.appendOrSelect(n,"g.x-axes").attr("role",dt.GROUP).selectAll("line").data(this.uniqueKeys,x=>x).join(x=>x.append("line").attr("opacity",0).attr("class",C=>`x-axis-${Hr(C)}`).attr("stroke-dasharray","0").attr("x1",C=>Gt(w(C),0,L).x).attr("y1",C=>Gt(w(C),0,L).y).attr("x2",C=>Gt(w(C),0,L).x).attr("y2",C=>Gt(w(C),0,L).y).call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",y=>Gt(w(y),E.range()[0],L).x).attr("y1",y=>Gt(w(y),E.range()[0],L).y).attr("x2",y=>Gt(w(y),E.range()[1],L).x).attr("y2",y=>Gt(w(y),E.range()[1],L).y)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",y=>Gt(w(y),E.range()[0],L).x).attr("y1",y=>Gt(w(y),E.range()[0],L).y).attr("x2",y=>Gt(w(y),E.range()[1],L).x).attr("y2",y=>Gt(w(y),E.range()[1],L).y)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),P.appendOrSelect(n,"g.x-labels").attr("role",dt.GROUP).selectAll("text").data(this.uniqueKeys).join(x=>x.append("text").text(C=>C).attr("opacity",0).attr("x",C=>Gt(w(C),E.range()[1]+d,L).x).attr("y",C=>Gt(w(C),E.range()[1]+d,L).y).style("text-anchor",C=>Eg(w(C)).textAnchor).style("dominant-baseline",C=>Eg(w(C)).dominantBaseline).call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",y=>Gt(w(y),E.range()[1]+d,L).x).attr("y",y=>Gt(w(y),E.range()[1]+d,L).y).end().finally(()=>{const y=_(o,"radar","alignment"),R=this.getAlignmentXOffset(y,n,this.getParent());n.attr("x",R)})),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),P.appendOrSelect(n,"g.blobs").attr("role",dt.GROUP).selectAll("path").data(this.groupedDataNormalized,x=>x.name).join(x=>x.append("path").attr("class",C=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:C.name,originalClassName:"blob"})).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",C=>C.name).attr("opacity",0).attr("transform",t?()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`:`translate(${L.x}, ${L.y})`).style("fill",C=>S(C.name)).style("fill-opacity",Kn.opacity.selected).style("stroke",C=>S(C.name)).call(C=>{const y=C.transition().call(R=>this.services.transitions.setupTransition({transition:R,name:"radar_blobs_enter",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",`translate(${L.x}, ${L.y})`),y.attr("opacity",1).attr("d",R=>$(R.data))}),x=>(x.attr("class",C=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:C.name,originalClassName:"blob"})).style("fill",C=>S(C.name)).style("stroke",C=>S(C.name)),x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(y.data))),x),x=>x.call(C=>{const y=C.transition().call(R=>this.services.transitions.setupTransition({transition:R,name:"radar_blobs_exit",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`),y.attr("opacity",0).remove()})),P.appendOrSelect(n,"g.dots").attr("role",dt.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(x=>_(x,h)!==null)).join(x=>x.append("circle").attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",C=>C[c]),x=>x,x=>x.remove()).attr("class",x=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:x[l],originalClassName:Hr(x[u])})).attr("cx",x=>Gt(w(x[u]),E(x[h]),L).x).attr("cy",x=>Gt(w(x[u]),E(x[h]),L).y).attr("r",0).attr("opacity",0).style("fill",x=>S(x[l])),P.appendOrSelect(n,"g.x-axes-rect").attr("role",dt.GROUP).selectAll("rect").data(this.uniqueKeys).join(x=>x.append("rect"),x=>x,x=>x.remove()).attr("x",L.x).attr("y",L.y-g/2).attr("width",E.range()[1]).attr("height",g).style("fill","red").style("fill-opacity",0).attr("transform",x=>`rotate(${Sg(w(x))}, ${L.x}, ${L.y})`),P.appendOrSelect(n,"g.y-labels").attr("role",dt.GROUP).selectAll("text").data(Re(T)).join(x=>x.append("text").attr("opacity",0).text(C=>C).attr("x",C=>Gt(-Math.PI/2,E(C),L).x+f).attr("y",C=>Gt(-Math.PI/2,E(C),L).y).style("text-anchor","start").style("dominant-baseline","middle").call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_update",animate:t})).text(y=>y).attr("opacity",1).attr("x",y=>Gt(-Math.PI/2,E(y),L).x+f).attr("y",y=>Gt(-Math.PI/2,E(y),L).y)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,r){const i=P.getSVGElementSize(n,{useBBox:!0}),{width:s}=P.getSVGElementSize(r,{useAttrs:!0});let a=0;return t===Yt.CENTER?a=Math.floor((s-i.width)/2):t===Yt.RIGHT&&(a=s-i.width),a}destroy(){this.parent.selectAll(".x-axes-rect > rect").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=_(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=N(this);t.services.events.dispatchEvent(A.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,h=_(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>l.indexOf(f[u])!==-1?1:0).attr("r",Kn.dotsRadius);const d=t.fullDataNormalized.filter(f=>f[n]===i&&l.indexOf(f[u])!==-1);t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:r,hoveredElement:s,items:d.filter(f=>typeof f[h]=="number").map(f=>({label:f[u],value:f[h],color:t.model.getFillColor(f[u]),class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(r,i){const s=N(this);t.services.events.dispatchEvent(A.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(A.Radar.X_AXIS_CLICK,{event:r,element:N(this),datum:i})}).on("mouseout",function(r,i){const s=N(this),a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(A.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(A.Tooltip.HIDE)})}}class Lm extends Fc{constructor(){super(...arguments),this.type="simple-bar",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=i.selectAll("path.bar").data(s,l=>l[r]);o.exit().attr("opacity",0).remove(),o.enter().append("path").attr("opacity",0).merge(o).classed("bar",!0).attr("width",this.getBarWidth.bind(this)).transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"bar-update-enter",animate:t})).attr("class",l=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:l[r],originalClassName:"bar"})).style("fill",l=>this.model.getFillColor(l[r])).attr("d",l=>{const c=this.services.cartesianScales.getRangeIdentifier(),u=this.getBarWidth(),h=l[c],d=this.services.cartesianScales.getDomainValue(l)-u/2,f=d+u;let p,m;if(Array.isArray(h)&&h.length===2)p=this.services.cartesianScales.getRangeValue(h[0]),m=this.services.cartesianScales.getRangeValue(h[1]);else{const v=this.services.cartesianScales.getRangeScale().domain()[0];p=this.services.cartesianScales.getRangeValue(Math.max(0,v)),m=this.services.cartesianScales.getRangeValue(l)}const g=Math.abs(m-p);if(g!==0&&g<2&&(h>0&&a===Jt.VERTICAL||h<0&&a===Jt.HORIZONTAL?m=p-2:m=p+2),!this.isOutsideZoomedDomain(d,f))return ue({x0:d,x1:f,y0:p,y1:m},a)}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",l=>l.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:n,element:N(this),datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class CR extends he{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=_(this.getOptions(),"data","loading"),r=!_(this.getOptions(),"grid","x","enabled")&&!_(this.getOptions(),"grid","y","enabled")&&!_(this.getOptions(),"axes","bottom","visible")&&!_(this.getOptions(),"axes","left","visible");n&&!r?super.renderGridSkeleton(n):n&&r?this.renderSparklineSkeleton(n):this.removeSkeleton()}renderSparklineSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawSparkline(t),this.updateBackdropStyle(),t&&this.setShimmerEffect("shimmer-lines")}drawSparkline(t){const n=this.backdrop.attr("width"),r=[100],i=P.appendOrSelect(this.backdrop,"g.y.skeleton"),s=i.selectAll("line").data(r);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),i.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}updateBackdropStyle(){const t=this.parent;this.backdrop=P.appendOrSelect(t,"svg.chart-skeleton.DAII"),P.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop").classed("shimmer-effect-lines",!1).classed("shimmer-effect-sparkline",!0).style("stroke",null)}}class Dm extends gt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.area").transition("legend-hover-area").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-area"})).attr("opacity",s=>_(s,0,i)!==n.datum().name?pn.opacity.unselected:pn.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",pn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(f=>i.axes[f].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=_(o,0,0),c=this.services.cartesianScales.getDomainAxisPosition({datum:l}),u=this.services.cartesianScales.getRangeAxisPosition({datum:l}),h=this.services.cartesianScales.getScaleByPosition(u),d=n.selectAll("path.area").data(o,f=>_(f,0,s));this.areaGenerator=Al().x(f=>this.services.cartesianScales.getValueThroughAxisPosition(c,f.data.sharedStackKey)).y0(f=>h(f[0])).y1(f=>h(f[1])).curve(this.services.curves.getD3Curve()),d.exit().attr("opacity",0).remove(),d.enter().append("path").attr("opacity",0).merge(d).data(o,f=>_(f,0,s)).attr("class","area").attr("class",f=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:_(f,0,s),originalClassName:"area"})).style("fill",f=>r.model.getFillColor(_(f,0,s))).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",f=>_(f,0,s)).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"area-update-enter",animate:t})).attr("opacity",pn.opacity.selected).attr("d",this.areaGenerator)}}class km extends Fc{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,c=>_(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars");const l=n.selectAll("g.bars").selectAll("path.bar").data(c=>c,c=>c.data.sharedStackKey);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i])).attr("d",c=>{const u=c.data.sharedStackKey,h=this.getBarWidth(),d=this.services.cartesianScales.getDomainValue(u)-h/2,f=d+h,p=this.services.cartesianScales.getRangeValue(c[0]);let m=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(d,f)){if(Math.abs(m-p)>0&&Math.abs(m-p)>r.bars.dividerSize){const g=c[0]<0&&c[1]<=0;g&&a.length>1?this.services.cartesianScales.getOrientation()===Jt.VERTICAL?m+=c[1]===0?2:1:m-=1:g||(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?m+=1:m-=1)}return ue({x0:d,x1:f,y0:p,y1:m},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c[1]-c[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=N(this);a.classed("hovered",!0),r.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:i,element:a,datum:s});let o=r.model.getDisplayData(r.configs.groups).find(l=>{const c=r.services.cartesianScales.getDomainIdentifier(l),u=r.services.cartesianScales.getRangeIdentifier(l);return l[u]===s.data[s[n]]&&l[c].toString()===s.data.sharedStackKey&&l[n]===s[n]});if(o===void 0){const l=r.services.cartesianScales.getDomainIdentifier(),c=r.services.cartesianScales.getRangeIdentifier();o={[l]:s.data.sharedStackKey,[c]:s.data[s[n]],[n]:s[n]}}r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,data:[o]})}).on("mousemove",function(i,s){const a=N(this);r.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:i,element:N(this),datum:s})}).on("mouseout",function(i,s){const a=N(this);a.classed("hovered",!1),r.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(_(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),r=P.getSVGElementSize(this.parent,{useAttrs:!0}).width,i=this.model.getStackKeys().length,s=_(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,r*s/i)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Rm extends tn{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=nt.SVG}render(t){if(!_(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(u=>r.axes[u].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=n.selectAll("g.dots").data(a,u=>_(u,0,i));o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("dots",!0).attr("role",dt.GROUP).merge(o).selectAll("circle.dot").data(u=>u);l.exit().attr("opacity",0).remove();const c=l.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(l).datum(u=>{const h=u[i],d=this.services.cartesianScales.getDomainIdentifier(u),f=this.services.cartesianScales.getRangeIdentifier(u);return{[i]:h,[d]:u.data.sharedStackKey,[f]:u[1]}});this.styleCircles(c,t),this.addEventListeners()}getTooltipData(t,n){const r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(l=>r.axes[l].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((l,c)=>{l.forEach((u,h)=>{const d=u[i],f=u.data.sharedStackKey;let p=u.data[d];const m=u[1],g=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(m)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[c][h].data[d]),p!==null&&o.push({[i]:d,[g]:f,[v]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(l=>{const c=this.services.cartesianScales.getDomainIdentifier(l),u=this.services.cartesianScales.getRangeIdentifier(l);return o.find(h=>h[i]==l[i]&&h[c]==l[c]&&h[u]==l[u])!==void 0})}}const Wr=6;class AR extends gt{constructor(){super(...arguments),this.type="tree",this.renderType=nt.SVG}getLongestLabel(t){let n="";return t.forEach(r=>{const i=r.children?this.getLongestLabel(r.children):"";(i.length>n.length||r.name.length>n.length)&&(n=i.length>r.name.length?i:r.name)}),n}getMockLabelWidth(t,n){const r=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:i}=P.getSVGElementSize(r.node(),{useBBox:!0});return r.remove(),i}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:r,height:i}=P.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=_(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),h={top:0,right:0,bottom:0,left:l>0?l+Wr:30-Wr},d=vi({name:o,children:a}),f=10,p=r/6,m=T=>{const S=d.descendants().reverse(),$=d.links();let k=d,L=d;d.eachBefore(B=>{B.x<k.x&&(k=B),B.x>L.x&&(L=B)});const M=L.x-k.x,V=n.transition().call(B=>this.services.transitions.setupTransition({transition:B,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-h.left,k.x,r,M].join(" ")),x=E.selectAll("g").data(S,B=>B.id),C=this,y=x.enter().append("g").attr("transform",()=>`translate(${T.y0},${T.x0})`).attr("class",B=>B.depth!==0&&B.children&&B.children.length>0?"clickable":null).on("mouseover",function(B,U){C.services.events.dispatchEvent(A.Tree.NODE_MOUSEOVER,{event:B,element:N(this),datum:U})}).on("click",function(B,U){U.depth!==0&&(U.children=U.children?null:U._children,m(U)),C.services.events.dispatchEvent(A.Tree.NODE_CLICK,{event:B,element:N(this),datum:U})}).on("mouseout",function(B,U){C.services.events.dispatchEvent(A.Tree.NODE_MOUSEOUT,{event:B,element:N(this),datum:U})});y.append("circle").attr("r",2.5).attr("class",B=>B._children?"parent":"child").attr("stroke-width",10),y.append("text").attr("dy","0.31em").attr("x",B=>B._children?-Wr:Wr).attr("text-anchor",B=>B._children?"end":"start").text(B=>B.data.name).clone(!0).attr("class","text-stroke").lower(),x.merge(y).transition(V).attr("transform",B=>`translate(${B.y},${B.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),x.exit().transition(V).remove().attr("transform",()=>`translate(${T.y},${T.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const R=O.selectAll("path").data($,B=>B.target.id),I=R.enter().append("path").attr("d",()=>{const B={x:T.x0,y:T.y0};return w({source:B,target:B})});R.merge(I).transition(V).attr("d",w),R.exit().transition(V).remove().attr("d",()=>{const B={x:T.x,y:T.y};return w({source:B,target:B})}),d.eachBefore(B=>{B.x0=B.x,B.y0=B.y})},g=d.descendants(),v=g[g.length-1].depth,b=_(s,"tree","type")===Pl.DENDROGRAM?Nx().size([i,r-u-v*Wr-l]):Sw().nodeSize([f,p]).size([i,r-u-v*Wr-l]),w=_E().x(T=>T.y).y(T=>T.x);d.x0=p/2,d.y0=0,d.descendants().forEach((T,S)=>{T.id=S,T._children=T.children}),b(d),n.attr("viewBox",[-h.left,-h.top,r,f]).style("user-select","none");const O=n.append("g").attr("class","links"),E=n.append("g").attr("class","nodes");m(d)}}var $R="#000000",LR="#ffffff",DR="#fcf4d6",kR="#fddc69",RR="#f1c21b",IR="#d2a106",PR="#b28600",NR="#8e6a00",UR="#684e00",BR="#483700",VR="#302400",HR="#1c1500",FR={10:DR,20:kR,30:RR,40:IR,50:PR,60:NR,70:UR,80:BR,90:VR,100:HR},GR="#fff2e8",zR="#ffd9be",jR="#ffb784",WR="#ff832b",qR="#eb6200",YR="#ba4e00",XR="#8a3800",ZR="#5e2900",KR="#3e1a00",QR="#231000",JR={10:GR,20:zR,30:jR,40:WR,50:qR,60:YR,70:XR,80:ZR,90:KR,100:QR},tI="#fff1f1",eI="#ffd7d9",nI="#ffb3b8",rI="#ff8389",iI="#fa4d56",sI="#da1e28",aI="#a2191f",oI="#750e13",lI="#520408",cI="#2d0709",uI={10:tI,20:eI,30:nI,40:rI,50:iI,60:sI,70:aI,80:oI,90:lI,100:cI},hI="#fff0f7",dI="#ffd6e8",fI="#ffafd2",pI="#ff7eb6",gI="#ee5396",mI="#d02670",vI="#9f1853",yI="#740937",bI="#510224",xI="#2a0a18",wI={10:hI,20:dI,30:fI,40:pI,50:gI,60:mI,70:vI,80:yI,90:bI,100:xI},_I="#f6f2ff",EI="#e8daff",SI="#d4bbff",OI="#be95ff",TI="#a56eff",MI="#8a3ffc",CI="#6929c4",AI="#491d8b",$I="#31135e",LI="#1c0f30",DI={10:_I,20:EI,30:SI,40:OI,50:TI,60:MI,70:CI,80:AI,90:$I,100:LI},kI="#edf5ff",RI="#d0e2ff",II="#a6c8ff",PI="#78a9ff",NI="#4589ff",UI="#0f62fe",BI="#0043ce",VI="#002d9c",HI="#001d6c",FI="#001141",GI={10:kI,20:RI,30:II,40:PI,50:NI,60:UI,70:BI,80:VI,90:HI,100:FI},zI="#e5f6ff",jI="#bae6ff",WI="#82cfff",qI="#33b1ff",YI="#1192e8",XI="#0072c3",ZI="#00539a",KI="#003a6d",QI="#012749",JI="#061727",tP={10:zI,20:jI,30:WI,40:qI,50:YI,60:XI,70:ZI,80:KI,90:QI,100:JI},eP="#d9fbfb",nP="#9ef0f0",rP="#3ddbd9",iP="#08bdba",sP="#009d9a",aP="#007d79",oP="#005d5d",lP="#004144",cP="#022b30",uP="#081a1c",hP={10:eP,20:nP,30:rP,40:iP,50:sP,60:aP,70:oP,80:lP,90:cP,100:uP},dP="#defbe6",fP="#a7f0ba",pP="#6fdc8c",gP="#42be65",mP="#24a148",vP="#198038",yP="#0e6027",bP="#044317",xP="#022d0d",wP="#071908",_P={10:dP,20:fP,30:pP,40:gP,50:mP,60:vP,70:yP,80:bP,90:xP,100:wP},EP="#f2f4f8",SP="#dde1e6",OP="#c1c7cd",TP="#a2a9b0",MP="#878d96",CP="#697077",AP="#4d5358",$P="#343a3f",LP="#21272a",DP="#121619",kP={10:EP,20:SP,30:OP,40:TP,50:MP,60:CP,70:AP,80:$P,90:LP,100:DP},RP="#f4f4f4",IP="#e0e0e0",PP="#c6c6c6",NP="#a8a8a8",UP="#8d8d8d",BP="#6f6f6f",VP="#525252",HP="#393939",FP="#262626",GP="#161616",zP={10:RP,20:IP,30:PP,40:NP,50:UP,60:BP,70:VP,80:HP,90:FP,100:GP},jP="#f7f3f2",WP="#e5e0df",qP="#cac5c4",YP="#ada8a8",XP="#8f8b8b",ZP="#726e6e",KP="#565151",QP="#3c3838",JP="#272525",tN="#171414",eN={10:jP,20:WP,30:qP,40:YP,50:XP,60:ZP,70:KP,80:QP,90:JP,100:tN},Im={black:{100:$R},blue:GI,coolGray:kP,cyan:tP,gray:zP,green:_P,magenta:wI,orange:JR,purple:DI,red:uI,teal:hP,warmGray:eN,white:{0:LR},yellow:FR};const nN=e=>{if(!e)return null;for(const t of Object.keys(Im)){const n=Im[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},Pm=function(){const e=N(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=en(t);let r;if(n&&(r=nN(n?n.hex():null)),r==null){const i=yo(n).l;r=Math.abs(i*100-100)}return r>50?"white":"black"};let rN=0;class iN extends gt{constructor(){super(...arguments),this.type="treemap",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-treemap"})).attr("opacity",r=>r.parent.data.name===n.datum().name?1:.3)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g[data-name='leaf']").transition("legend-mouseout-treemap").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-treemap"})).attr("opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=_(window,"location"),{width:a,height:o}=P.getSVGElementSize(n,{useAttrs:!0}),l=vi({name:i.title||"Treemap",children:r}).sum(f=>f.value).sort((f,p)=>p.value-f.value),c=Aw().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),f=>f.data.name);u.exit().attr("opacity",0).remove();const h=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>rN++).merge(u);h.attr("data-name","leaf").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-group-update",animate:t})).attr("transform",f=>`translate(${f.x0},${f.y0})`);const d=h.selectAll("rect.leaf").data(f=>[f]);d.exit().attr("width",0).attr("height",0).remove(),d.enter().append("rect").classed("leaf",!0).merge(d).attr("width",0).attr("height",0).attr("id",function(){const f=N(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${f}`}).attr("class",f=>{for(;f.depth>1;)f=f.parent;return this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:f.data.name,originalClassName:"leaf"})}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-leaf-update-enter",animate:t})).attr("width",f=>f.x1-f.x0).attr("height",f=>f.y1-f.y0).style("fill",f=>{for(;f.depth>1;)f=f.parent;return this.model.getFillColor(f.data.name)}),h.selectAll("clipPath").data(f=>f.data.showLabel!==!0?[]:[1],f=>f).join(f=>f.append("clipPath").attr("id",function(){const p=N(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${p}`}).append("use").attr("xlink:href",function(){const p=N(this.parentNode.parentNode).attr("data-uid"),m=`${i.style.prefix}-leaf-${p}`;return new URL(`#${m}`,s)+""}),f=>null,f=>f.remove()),h.selectAll("text").data(f=>{if(f.data.showLabel!==!0)return[];let p=f;for(;p.depth>1;)p=p.parent;const m=yo(this.model.getFillColor(p.data.name));return[{text:f.data.name,color:m.l<.5?"white":"black"}]},f=>f).join(f=>{const p=f.append("text").text(m=>m.text).style("fill",Pm).attr("x",7).attr("y",18);return s&&p.attr("clip-path",function(){const m=N(this.parentNode).attr("data-uid"),g=`${i.style.prefix}-clip-${m}`;return`url(${new URL(`#${g}`,s)+""})`}),p},f=>f.text(p=>p.text).style("fill",Pm),f=>f.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=N(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=r;for(;a.depth>1;)a=a.parent;i.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const l=t.model.getFillColor(o.parent.data.name);return l&&(s=l),en(s).darker(.7).toString()}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:s,label:a.data.name,bold:!0},{label:r.data.name,value:r.data.value}]}),t.services.events.dispatchEvent(A.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Treemap.LEAF_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1);let s=r;for(;s.depth>1;)s=s.parent;i.transition().call(a=>t.services.transitions.setupTransition({transition:a,name:"graph_element_mouseout_fill_update"})).style("fill",a=>t.model.getFillColor(a.parent.data.name)),t.services.events.dispatchEvent(A.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}}class sN extends gt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-wordcloud"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("text.word").transition("legend-mouseout-wordcloud").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-wordcloud"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.model.getDisplayData(),s=this.getFontSizeScale(i),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:l}=a.wordCloud,{groupMapsTo:c}=a.data,{width:u,height:h}=P.getSVGElementSize(r,{useAttrs:!0});if(u===0||h===0)return;const d=IL().size([u,h]).words(i.map(function(p){const m=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:p[c],text:p[l],size:m,value:m}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);d.start();function f(p){const m=P.appendOrSelect(r,"g.words");m.attr("transform",`translate(${d.size()[0]/2}, ${d.size()[1]/2})`);const g=m.selectAll("text").data(p,v=>`${v[c]}-${v.text}`);g.exit().attr("opacity",0).remove(),g.enter().append("text").attr("opacity",0).merge(g).style("font-size",v=>`${v.size}px`).text(function(v){return v.text}).attr("class",v=>n.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:v[c],originalClassName:`word ${v.size>32?"light":""}`})).style("fill",v=>n.model.getFillColor(v[c],v.text,v)).attr("text-anchor","middle").transition().call(v=>n.services.transitions.setupTransition({transition:v,name:"wordcloud-text-update-enter",animate:t})).attr("transform",v=>`translate(${v.x}, ${v.y})`).attr("opacity",1)}this.addEventListeners()}getFontSizeScale(t){const n=this.getOptions(),{fontSizeMapsTo:r}=n.wordCloud,i=t.map(l=>l[r]).filter(l=>l),s=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=i.length>0,o=a?Re(i):[1,1];return Be().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=Ha(s=>{const a=r.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>r.services.transitions.setupTransition({transition:o,name:"wordcloud-word-mouse-highlight"}));s===null?a.attr("opacity",1):a.attr("opacity",function(){return s===this?1:.3})},6);this.parent.selectAll("text.word").on("mouseover",function(s,a){const o=this;i(o),r.services.events.dispatchEvent(A.WordCloud.WORD_MOUSEOVER,{event:s,element:N(this),datum:a}),r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:t.tooltip.groupLabel,value:a[n],class:r.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(A.WordCloud.WORD_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);i(null),r.services.events.dispatchEvent(A.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o})})}}class aN extends gt{constructor(){super(...arguments),this.type="geo",this.renderType=nt.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:r}=P.getSVGElementSize(t,{useAttrs:!0});if(n<1||r<1)return;const i=this.getProjection(),s=_(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},l={};Object.keys(a).forEach(g=>{typeof a[g].value=="number"?o[g]=a[g]:l[g]=a[g]});const c=lR(s,Object.values(l)),u=sR(s,{type:"GeometryCollection",geometries:Object.values(o)}),h=i.fitSize([n,r],u),d=cx().projection(h);P.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",d);const f=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),p=P.appendOrSelect(t,"defs");P.appendOrSelect(p,"pattern").attr("id",f).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",Mi()([[0,0],[0,10]]));const m=P.appendOrSelect(t,"g.missing-data");P.appendOrSelect(m,"path").datum(c).attr("d",d).style("fill",`url(#${f})`)}getProjection(){let t=null;switch(_(this.getOptions(),"thematic","projection")){case fn.geoEqualEarth:t=Cx();break;case fn.geoAlbers:t=wx();break;case fn.geoConicEqualArea:t=nd();break;case fn.geoConicEquidistant:t=Tx();break;case fn.geoEquirectangular:t=Sx();break;case fn.geoMercator:t=_x();break;case fn.geoNaturalEarth1:t=Ax();break;default:throw new Error("Projection is not supported.")}return t}}class oN extends aN{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData();this.getComponentContainer({withinChartClip:!0}).select("g.geo").selectAll("path").classed("border",!0).attr("class",r=>this.model.getColorClassName({value:n[r.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=N(this);t.services.events.dispatchEvent(Mr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Ai.SHOW,{event:r,hoveredElement:s,items:[{label:i.properties.NAME,value:n[i.properties.NAME].value}]})}).on("mousemove",function(r,i){t.services.events.dispatchEvent(Mr.CHOROPLETH_MOUSEMOVE,{event:r,element:N(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Ai.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(Mr.CHOROPLETH_CLICK,{event:r,element:N(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=N(this);t.services.events.dispatchEvent(Mr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Ai.HIDE,{event:r,hoveredElement:s})})}}function Nm(e,t){ht(2,arguments);var n=xt(e),r=Kt(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Gc(e,t){ht(2,arguments);var n=xt(e),r=Kt(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var i=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+r+1,0);var a=s.getDate();return i>=a?s:(n.setFullYear(s.getFullYear(),s.getMonth(),i),n)}var lN=36e5;function Um(e,t){ht(2,arguments);var n=Kt(t);return xa(e,n*lN)}function Bm(e){ht(1,arguments);var t=xt(e);return t.setHours(0,0,0,0),t}var cN=864e5;function uN(e,t){ht(2,arguments);var n=Bm(e),r=Bm(t),i=n.getTime()-Vl(n),s=r.getTime()-Vl(r);return Math.round((i-s)/cN)}var hN=6e4;function zc(e,t){ht(2,arguments);var n=Kt(t);return xa(e,n*hN)}function jc(e,t){ht(2,arguments);var n=Kt(t);return xa(e,n*1e3)}function Vm(e,t){ht(2,arguments);var n=Kt(t);return Gc(e,n*12)}function es(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}var dN=6e4,fN=36e5;function pN(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function gN(e,t){ht(2,arguments);var n=xt(e),r=xt(t);return n.getFullYear()-r.getFullYear()}function Hm(e,t){var 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 mN(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=Hm(n,r),s=Math.abs(uN(n,r));n.setDate(n.getDate()-i*s);var a=+(Hm(n,r)===-i),o=i*(s-a);return o===0?0:o}function Wc(e,t){return ht(2,arguments),xt(e).getTime()-xt(t).getTime()}var Fm={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},vN="trunc";function qc(e){return e?Fm[e]:Fm[vN]}function yN(e,t,n){ht(2,arguments);var r=Wc(e,t)/fN;return qc(n==null?void 0:n.roundingMethod)(r)}function Gm(e,t,n){ht(2,arguments);var r=Wc(e,t)/dN;return qc(n==null?void 0:n.roundingMethod)(r)}function bN(e){ht(1,arguments);var t=xt(e);return t.setHours(23,59,59,999),t}function xN(e){ht(1,arguments);var t=xt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function wN(e){ht(1,arguments);var t=xt(e);return bN(t).getTime()===xN(t).getTime()}function _N(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=es(n,r),s=Math.abs(pN(n,r)),a;if(s<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);var o=es(n,r)===-i;wN(xt(e))&&s===1&&es(e,r)===1&&(o=!1),a=i*(s-Number(o))}return a===0?0:a}function zm(e,t,n){ht(2,arguments);var r=Wc(e,t)/1e3;return qc(n==null?void 0:n.roundingMethod)(r)}function EN(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=es(n,r),s=Math.abs(gN(n,r));n.setFullYear(1584),r.setFullYear(1584);var a=es(n,r)===-i,o=i*(s-Number(a));return o===0?0:o}function SN(e,t){ht(2,arguments);var n=Kt(t);return Nm(e,-n)}function ON(e,t){ht(2,arguments);var n=Kt(t);return Gc(e,-n)}function TN(e,t){ht(2,arguments);var n=Kt(t);return Um(e,-n)}function jm(e,t){ht(2,arguments);var n=Kt(t);return zc(e,-n)}function Wm(e,t){ht(2,arguments);var n=Kt(t);return jc(e,-n)}function MN(e,t){ht(2,arguments);var n=Kt(t);return Vm(e,-n)}function qm(e){var t=e==null?0:e.length;return t?Da(e,1):[]}class CN extends wn{zoomIn(t,n,r){let i,s,a;const o=r||Dr;t&&(i=t.x,s=t.y,a=2);const{width:l,height:c}=P.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${l/2}, ${c/2}) scale(${a}) translate(${-i},${-s})`),this.services.events.dispatchEvent(A.CanvasZoom.CANVAS_ZOOM_IN,{element:N(t)})}zoomOut(t,n){const r=n||Dr;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(A.CanvasZoom.CANVAS_ZOOM_OUT)}}class AN extends wn{init(){this.documentFragment=document.createDocumentFragment()}addEventListener(t,n){this.documentFragment.addEventListener(t,n)}removeEventListener(t,n){this.documentFragment.removeEventListener(t,n)}dispatchEvent(t,n){let r;n?r=new CustomEvent(t,{detail:n}):(r=document.createEvent("Event"),r.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(r)}}class $N extends wn{constructor(t,n){super(t,n)}downloadCSV(t,n){const r=document.createElement("a"),i="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:i}),n);else if(URL&&"download"in r){const s=URL.createObjectURL(new Blob([t],{type:i}));r.href=s,r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const r=document.createElement("a");r.download=n,r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}class LN extends wn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(A.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:r}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||r===!1?t.duration(0):t.duration(_(Xf,n,"duration")||Xf.default.duration)}getPendingTransitions(){return this.pendingTransitions}}let DN=class extends wn{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:r}=n.data,i=_(n,"axes",this.secondaryDomainAxisPosition),s=t[r];if(i!=null&&i.correspondingDatasets&&i.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const r=this.model.getOptions(),{groupMapsTo:i}=r.data,s=_(r,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[i]:n&&n.length>0&&(a=n[0]),s!=null&&s.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return _(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){return this.getAxisOptions(t).title||(t===H.BOTTOM||t===H.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(H).map(t=>H[t]).forEach(t=>{this.scales[t]=this.createScale(t)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),r=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=r.primaryDomainAxisPosition,this.rangeAxisPosition=r.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=r.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=r.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===H.LEFT||this.rangeAxisPosition===H.RIGHT)&&(this.domainAxisPosition===H.BOTTOM||this.domainAxisPosition===H.TOP)?this.orientation=Jt.VERTICAL:this.orientation=Jt.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,r,i;const s=this.model.getOptions(),a=_(s,"axes");((t=a[H.LEFT])!=null&&t.correspondingDatasets&&a[H.RIGHT]||(n=a[H.RIGHT])!=null&&n.correspondingDatasets&&a[H.LEFT]||(r=a[H.TOP])!=null&&r.correspondingDatasets&&a[H.BOTTOM]||(i=a[H.BOTTOM])!=null&&i.correspondingDatasets&&a[H.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=_(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]===tt.LINEAR||this.scaleTypes[t]===tt.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=[H.BOTTOM,H.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[H.LEFT,H.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,r,i){const s=this.model.getOptions(),a=_(s,"axes")[r],{mapsTo:o}=a,l=_(i,o)!==null?i[o]:i;let c;switch(n){case tt.LABELS:c=t(l)+t.step()/2;break;case tt.TIME:c=t(new Date(l));break;default:c=t(l)}return c}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),r=this.getRangeAxisPosition({datum:t}),i=this.scales[r],s=this.model.getOptions(),a=_(s,"axes")[r],{mapsTo:o}=a,l=t[o]!==void 0?t[o]:t;return[i(_(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:l),i(_(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:l)]}getValueThroughAxisPosition(t,n){const r=this.scaleTypes[t],i=this.scales[t];return this.getValueFromScale(i,r,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 _(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return _(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const r=this.model.getOptions(),i=_(r,"axes",t);if(i.scaleType===tt.TIME){const s=_(r,"timeScale","addSpaceOnEdges");return kN(n,s)}else return RN(n,An.paddingRatio,i.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=_(t,"axes"),r=this.isDualAxes();return _(n,H.LEFT)===null&&_(n,H.RIGHT)!==null||_(n,H.RIGHT,"main")===!0||r&&_(n,H.LEFT,"correspondingDatasets")?{primary:H.RIGHT,secondary:H.LEFT}:{primary:H.LEFT,secondary:H.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=_(t,"axes"),r=this.isDualAxes();return _(n,H.BOTTOM)===null&&_(n,H.TOP)!==null||_(n,H.TOP,"main")===!0||r&&_(n,H.BOTTOM,"correspondingDatasets")?{primary:H.TOP,secondary:H.BOTTOM}:{primary:H.BOTTOM,secondary:H.TOP}}findDomainAndRangeAxesPositions(t,n){const r=this.model.getOptions(),i=_(r,"axes",t.primary),s=_(r,"axes",n.primary),a=i.scaleType||tt.LINEAR,o=s.scaleType||tt.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===tt.LABELS||o===tt.TIME)&&a===tt.LABELS||a===tt.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(),r=_(n,"axes",t),i=_(n,"bounds"),{includeZero:s}=r,a=_(r,"scaleType")||tt.LINEAR;if(this.model.isDataEmpty())return[];if(r.binned){const{bins:v}=this.model.getBinConfigurations();return[0,Nn(v,b=>b.length)]}else if(r.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),b=this.model.getStackKeys({bins:v});return[b[0].split("-")[0],b[b.length-1].split("-")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:h}=r,{reference:d,compareTo:f}=An.ratio;if(r.domain)return a===tt.LABELS?r.domain:(a===tt.TIME&&(r.domain=r.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,r.domain));if(u)return[0,100];if(r&&a===tt.LABELS)return ji(o.map(v=>v[c]));let p,m;const g=this.model.getDataGroupNames();if(a===tt.LABELS_RATIO)return o.map(v=>`${v[d]}/${v[f]}`);if(a===tt.TIME)m=o.map(v=>+new Date(v[c]));else if(i&&n.axes)m=[],o.forEach(v=>{m.push(v[c]),v[i.upperBoundMapsTo]&&m.push(v[i.upperBoundMapsTo]),v[i.lowerBoundMapsTo]&&m.push(v[i.lowerBoundMapsTo])});else if(r.stacked===!0&&g&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,b=this.model.getDataValuesGroupedByKeys({groups:g}),w=o.filter(E=>!g.includes(E[v])),O=[];b.forEach(E=>{const{...T}=E;let S=0,$=0;Object.values(T).forEach(k=>{isNaN(k)||(k<0?$+=k:S+=k)}),O.push([$,S])}),m=[...qm(O),...w.map(E=>E[c])]}else m=[],o.forEach(v=>{const b=v[c];Array.isArray(b)&&b.length===2?(m.push(b[0]),m.push(b[1])):(l&&m.push(Math.max(v[c],v[l])),m.push(b))});return a!==tt.TIME&&a!==tt.LOG&&s&&m.push(0),h&&h.length>0&&h.forEach(v=>{const b=_(v,"value");b!==null&&m.push(b)}),p=Re(m),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),r=_(n,"axes",t);if(!r)return null;const i=_(r,"scaleType")||tt.LINEAR;this.scaleTypes[t]=i;let s;return i===tt.TIME?s=Fd():i===tt.LOG?s=Ed().base(r.base||10):i===tt.LABELS||i===tt.LABELS_RATIO?s=xi():s=Be(),s.domain(this.getScaleDomain(t)),s}getHighestDomainThreshold(){const t=_(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getDomainScale(),s=r.sort((a,o)=>o.value-a.value)[0];return this.getScaleTypeByPosition(n)===tt.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:i(s.value)}}getHighestRangeThreshold(){const t=_(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getRangeScale(),s=r.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:i(s.value)}}};function kN(e,t){const n=new Date(e[0]),r=new Date(e[1]);return EN(r,n)>1?[MN(n,t),Vm(r,t)]:_N(r,n)>1?[ON(n,t),Gc(r,t)]:mN(r,n)>1?[SN(n,t),Nm(r,t)]:yN(r,n)>1?[TN(n,t),Um(r,t)]:Gm(r,n)>30?[jm(n,t*30),zc(r,t*30)]:Gm(r,n)>1?[jm(n,t),zc(r,t)]:zm(r,n)>15?[Wm(n,t*15),jc(r,t*15)]:zm(r,n)>1?[Wm(n,t),jc(r,t)]:[n,r]}function RN([e,t],n,r){const i=(t-e)*n,s=t<=0&&t+i>0?0:t+i;let a=e>=0&&e-i<0?0:e-i;if(r===tt.LOG&&a<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");a=e}return[a,s]}let IN=class extends wn{constructor(){super(...arguments),this.curveTypes={curveLinear:la,curveLinearClosed:ef,curveBasis:EE,curveBasisClosed:SE,curveBasisOpen:OE,curveBundle:TE,curveCardinal:ME,curveCardinalClosed:CE,curveCardinalOpen:AE,curveCatmullRom:$E,curveCatmullRomClosed:LE,curveCatmullRomOpen:DE,curveMonotoneX:kE,curveMonotoneY:RE,curveNatural:IE,curveStep:PE,curveStepAfter:UE,curveStepBefore:NE}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let r=this.curveTypes[t];return n&&Object.keys(n).forEach(i=>{r[i]&&(r=r[i](n[i]))}),r}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}};class PN extends wn{isZoomBarEnabled(){if(!this.services.cartesianScales||!_(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=_(this.model.getOptions(),"axes",t,"scaleType");return t===H.BOTTOM&&n===tt.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:r}=this.services;if(!r)throw new Error("Services cartesianScales undefined");const i=r.getMainXAxisPosition(),s=r.getDomainIdentifier(),a=_(this.model.getOptions(),"axes",i,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!i)throw new Error("Not defined: mainXAxisPosition");return r.extendsDomain(i,Re(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0}){var r;this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&((r=this.services.events)==null||r.dispatchEvent(A.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return _(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var r;const i=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=_(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&a&&i){const o=s.stacked?"sharedStackKey":(r=this.services.cartesianScales)==null?void 0:r.getDomainIdentifier(),l=t.filter(c=>new Date(c[o])>=i[0]&&new Date(c[o])<=i[1]);if(l.length>0)return l}return t}zoomIn(t=this.getZoomRatio()){var n;const r=this.model.get("zoomDomain"),i=Ee.handleWidth,s=(n=this.services.cartesianScales)==null?void 0:n.getMainXScale().copy();s.domain(this.getDefaultZoomBarDomain());const a=s(r[0]),o=s(r[1]);if(o-a<i+1)return;const l=s.range(),c=o-a,u=Math.min((l[1]-l[0])/2*(t/2),c/2);let h=a+u,d=o-u;h>=d&&(h=a+c/2-i/2,d=o-c/2+i/2);const f=[s.invert(h),s.invert(d)];(r[0].valueOf()!==f[0].valueOf()||r[1].valueOf()!==f[1].valueOf())&&this.handleDomainChange(f)}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const r=this.services.cartesianScales.getMainXScale().copy();r.domain(this.getDefaultZoomBarDomain());const i=r(n[0]),s=r(n[1]),a=r.range(),o=(a[1]-a[0])/2*(t/2),l=Math.max(i-o,a[0]),c=Math.min(s+o,a[1]),u=[r.invert(l),r.invert(c)];(n[0].valueOf()!==u[0].valueOf()||n[1].valueOf()!==u[1].valueOf())&&this.handleDomainChange(u)}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)}isMinZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();if(!t||!n)return!1;const r=t[1].valueOf()-t[0].valueOf(),i=n[1].valueOf()-n[0].valueOf(),s=_(this.model.getOptions(),"zoomBar","minZoomRatio");return r/i<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 _(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return _(this.model.getOptions(),"zoomBar",t,"locked")}}function NN(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}function UN(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:NN(e,t,n)}var BN="\\ud800-\\udfff",VN="\\u0300-\\u036f",HN="\\ufe20-\\ufe2f",FN="\\u20d0-\\u20ff",GN=VN+HN+FN,zN="\\ufe0e\\ufe0f",jN="\\u200d",WN=RegExp("["+jN+BN+GN+zN+"]");function Ym(e){return WN.test(e)}function qN(e){return e.split("")}var Xm="\\ud800-\\udfff",YN="\\u0300-\\u036f",XN="\\ufe20-\\ufe2f",ZN="\\u20d0-\\u20ff",KN=YN+XN+ZN,QN="\\ufe0e\\ufe0f",JN="["+Xm+"]",Yc="["+KN+"]",Xc="\\ud83c[\\udffb-\\udfff]",tU="(?:"+Yc+"|"+Xc+")",Zm="[^"+Xm+"]",Km="(?:\\ud83c[\\udde6-\\uddff]){2}",Qm="[\\ud800-\\udbff][\\udc00-\\udfff]",eU="\\u200d",Jm=tU+"?",tv="["+QN+"]?",nU="(?:"+eU+"(?:"+[Zm,Km,Qm].join("|")+")"+tv+Jm+")*",rU=tv+Jm+nU,iU="(?:"+[Zm+Yc+"?",Yc,Km,Qm,JN].join("|")+")",sU=RegExp(Xc+"(?="+Xc+")|"+iU+rU,"g");function aU(e){return e.match(sU)||[]}function oU(e){return Ym(e)?aU(e):qN(e)}function lU(e){return function(t){t=Gi(t);var n=Ym(t)?oU(t):void 0,r=n?n[0]:t.charAt(0),i=n?UN(n,1).join(""):t.slice(1);return r[e]()+i}}var cU=lU("toUpperCase");const uU=cU;function hU(e){return uU(Gi(e).toLowerCase())}var dU=em(function(e,t,n){return t=t.toLowerCase(),e+(n?hU(t):t)});const fU=dU;class je{constructor(t,n){this.components=[],this.services={canvasZoom:CN,domUtils:P,events:AN,files:$N,gradientUtils:mc,transitions:LN},this.model=new Je(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(r=>{const i=this.services[r];this.services[r]=new i(this.model,this.services)}),this.services.events.addEventListener(A.Model.UPDATE,()=>{this.update()}),this.model.setData(n.data),this.services.events.addEventListener(A.Chart.RESIZE,()=>{this.update()}),this.components=this.getComponents(),this.update()}getComponents(){return console.error("getComponents() method is not implemented"),[]}update(){if(!this.components)return;Object.keys(this.services).forEach(r=>{this.services[r].update()}),this.components.forEach(r=>r.render(!0));const t=this.services.transitions.getPendingTransitions(),n=Object.keys(t).map(r=>t[r].end().catch(i=>i));Promise.all(n).then(()=>this.services.events.dispatchEvent(A.Chart.RENDER_FINISHED))}destroy(){this.components.forEach(t=>t.destroy()),this.services.domUtils.getHolder().remove(),this.model.set({destroyed:!0},{skipUpdate:!0})}getChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"toolbar","enabled"),s={id:"legend",components:[new Bc(this.model,this.services)],growth:ut.PREFERRED},a=_(r,"canvasZoom","enabled");a&&a===!0&&t.push(new Wk(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},c={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},u={id:"header",components:[new me(this.model,this.services,[l,...i?[c]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},h={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:_(n,"graphFrameRenderType")||nt.SVG},d=_(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let f=Lt.COLUMN;if(d){const v=_(r,"legend","position");v==="left"?(f=Lt.ROW,r.legend.orientation||(r.legend.orientation=Li.VERTICAL)):v==="right"?(f=Lt.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=Li.VERTICAL)):v==="bottom"&&(f=Lt.COLUMN_REVERSE)}const p={id:"spacer",components:[new _n(this.model,this.services)],growth:ut.PREFERRED},m={id:"full-frame",components:[new me(this.model,this.services,[...d?[s]:[],...d?[p]:[],h],{direction:f})],growth:ut.STRETCH},g=[];if(o||i){g.push(u);const v={id:"spacer",components:[new _n(this.model,this.services,i?{size:15}:void 0)],growth:ut.PREFERRED};g.push(v)}return g.push(m),[new Vc(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,g,{direction:Lt.COLUMN})]}}class ye extends je{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:DN,curves:IN,zoom:PN}),this.model=new sr(this.services)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"zoomBar",H.TOP,"enabled"),s=_(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=_(r,"axes",a,"scaleType"),l=i&&a===H.BOTTOM&&o===tt.TIME,c=this.services.zoom.isZoomBarLocked(H.TOP),u=!!this.model.getOptions().title,h={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},d={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},f={id:"header",components:[new me(this.model,this.services,[h,...s?[d]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},p={id:"legend",components:[new Bc(this.model,this.services)],growth:ut.PREFERRED};l&&!c&&t.push(new vm(this.model,this.services),new xm(this.model,this.services)),t.push(new Yk(this.model,this.services)),t.push(new Xk(this.model,this.services));const m={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:nt.SVG},g=_(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Lt.COLUMN;if(g){const T=_(this.model.getOptions(),"legend","position");T===$i.LEFT?(v=Lt.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Li.VERTICAL)):T===$i.RIGHT?(v=Lt.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Li.VERTICAL)):T===$i.BOTTOM&&(v=Lt.COLUMN_REVERSE)}const b={id:"spacer",components:[new _n(this.model,this.services)],growth:ut.PREFERRED},w={id:"full-frame",components:[new me(this.model,this.services,[...g?[p]:[],...g?[b]:[],m],{direction:v})],growth:ut.STRETCH},O={id:"zoom-bar",components:[new qk(this.model,this.services)],growth:ut.PREFERRED,renderType:nt.SVG},E=[];if(u||s){E.push(f);const T={id:"spacer",components:[new _n(this.model,this.services,s?{size:15}:void 0)],growth:ut.PREFERRED};E.push(T)}return l&&E.push(O),E.push(w),[new wm(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,E,{direction:Lt.COLUMN})]}}class pU extends je{constructor(t,n){super(t,n),this.model=new _$(this.services),this.model.setOptions(Nt(Ct.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new Zk(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class gU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(yn(Ct.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new zr(this.model,this.services),new _m(this.model,this.services),new tn(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class mU extends ye{constructor(t,n){super(t,n),this.model=new E$(this.services),this.model.setOptions(Nt(Ct.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new Jk(this.model,this.services),new jr(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class vU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new tR(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class yU extends ye{constructor(t,n){super(t,n),this.model=new S$(this.services),this.model.setOptions(Nt(Ct.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new eR(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class bU extends je{constructor(t,n){super(t,n),this.model=new O$(this.services),this.model.setOptions(Nt(Ct.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},o={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},l={id:"header",components:[new me(this.model,this.services,[a,...i?[o]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},c={id:"legend",components:[new Tm(this.model,this.services,{chartType:"choropleth"})],growth:ut.PREFERRED,renderType:nt.SVG},u={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:nt.SVG},h=_(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Lt.COLUMN_REVERSE,f={id:"spacer",components:[new _n(this.model,this.services,{size:15})],growth:ut.PREFERRED},p={id:"full-frame",components:[new me(this.model,this.services,[...h?[c]:[],...h?[f]:[],u],{direction:d})],growth:ut.STRETCH},m=[];if(s||i){m.push(l);const g={id:"spacer",components:[new _n(this.model,this.services,i?{size:15}:void 0)],growth:ut.PREFERRED};m.push(g)}return m.push(p),[new Vc(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,m,{direction:Lt.COLUMN})]}getComponents(){const t=[new oN(this.model,this.services)];return this.getChartComponents(t)}}class xU extends je{constructor(t,n){super(t,n),this.model=new T$(this.services),this.model.setOptions(Nt(Ct.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new bR(this.model,this.services)];return this.getChartComponents(t)}}const ev={[Me.LINE]:[zr,tn],[Me.SCATTER]:[tn],[Me.AREA]:[_m,zr,tn],[Me.STACKED_AREA]:[Dm,zr,Rm,eo],[Me.SIMPLE_BAR]:[Lm],[Me.GROUPED_BAR]:[$m,jr],[Me.STACKED_BAR]:[km,eo]};class wU extends ye{constructor(t,n){super(t,n);const r=Nt(Ct.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:Me.LINE,correspondingDatasets:[]}]),this.model.setOptions(r),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const r=t.map(i=>{const s=i.type;let a;if(typeof i.type=="string"){if(!Object.keys(ev).includes(i.type))return console.error(`Invalid chart type "${i.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const l=`${fU(i.type)}Chart`;return a=at({},Ct[l],this.model.getOptions(),i.options),i.type===Me.STACKED_AREA&&(o=!0),ev[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=at({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return qm(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(i=>i.type===Me.STACKED_BAR||i.type===Me.STACKED_AREA),r=[new ve(this.model,this.services),new Se(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID}),...n?[]:[new kn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class nv extends je{constructor(t,n,r=!1){super(t,n),this.model=new M$(this.services),!r&&(this.model.setOptions(Nt(Ct.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new Mm(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.PIE})];return this.getChartComponents(t)}}class _U extends nv{constructor(t,n){super(t,n,!0),this.model.setOptions(Nt(Ct.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new wR(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.DONUT})];return this.getChartComponents(t)}}class EU extends je{constructor(t,n){super(t,n),this.model=new C$(this.services),this.model.setOptions(Nt(Ct.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new _R(this.model,this.services)];return this.getChartComponents(t)}}class SU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new $m(this.model,this.services),new jr(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class OU extends ye{constructor(t,n){super(t,n),this.model=new A$(this.services),this.model.setOptions(Nt(Ct.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const s=!!this.model.getOptions().title,a={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},o={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},l={id:"header",components:[new me(this.model,this.services,[a,...i?[o]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},c={id:"legend",components:[new Tm(this.model,this.services,{chartType:"heatmap"})],growth:ut.PREFERRED,renderType:nt.SVG},u={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:nt.SVG},h=_(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Lt.COLUMN_REVERSE,f={id:"spacer",components:[new _n(this.model,this.services,{size:15})],growth:ut.PREFERRED},p={id:"full-frame",components:[new me(this.model,this.services,[...h?[c]:[],...h?[f]:[],u],{direction:d})],growth:ut.STRETCH},m=[];if(s||i){m.push(l);const g={id:"spacer",components:[new _n(this.model,this.services,i?{size:15}:void 0)],growth:ut.PREFERRED};m.push(g)}return m.push(p),[new wm(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,m,{direction:Lt.COLUMN})]}getComponents(){const t=[new ve(this.model,this.services),new ER(this.model,this.services)];return this.getAxisChartComponents(t)}}class TU extends ye{constructor(t,n){super(t,n),this.model=new $$(this.services),this.model.setOptions(Nt(Ct.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new uR(this.model,this.services),new SR(this.model,this.services)];return this.getAxisChartComponents(t)}}class MU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new zr(this.model,this.services),new tn(this.model,this.services,{handleThresholds:!0}),new CR(this.model,this.services),new jr(this.model,this.services)];return this.getAxisChartComponents(t)}}class CU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new OR(this.model,this.services),new tn(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class AU extends je{constructor(t,n){var r;super(t,n),this.model=new L$(this.services);const i=(r=n.options.meter)!=null&&r.proportional?at(yn(Ct.proportionalMeterChart),n.options):at(yn(Ct.meterChart),n.options);this.model.setOptions(i),this.init(t,n)}getComponents(){const t=[..._(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new yR(this.model,this.services)],growth:ut.STRETCH,renderType:nt.SVG},{id:"spacer",components:[new _n(this.model,this.services,{size:8})],growth:ut.STRETCH}]:[],{id:"meter-graph",components:[new TR(this.model,this.services)],growth:ut.STRETCH,renderType:nt.SVG}],n=[new me(this.model,this.services,t,{direction:Lt.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:nt.HTML})}}class $U extends je{constructor(t,n){super(t,n),this.model=new D$(this.services),this.model.setOptions(Nt(Ct.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new MR(this.model,this.services)];return this.getChartComponents(t)}}class LU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new tn(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class DU extends je{constructor(t,n){super(t,n),this.model=new k$(this.services),this.model.setOptions(Nt(Ct.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new AR(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class kU extends je{constructor(t,n){super(t,n),this.model=new R$(this.services),this.model.setOptions(Nt(Ct.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new iN(this.model,this.services)];return this.getChartComponents(t)}}class RU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new Lm(this.model,this.services),new jr(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class IU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new eo(this.model,this.services),new Dm(this.model,this.services),new zr(this.model,this.services,{stacked:!0}),new Rm(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class PU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new eo(this.model,this.services),new km(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ}),new jr(this.model,this.services)];return this.getAxisChartComponents(t)}}class NU extends je{constructor(t,n){super(t,n),this.model=new I$(this.services),this.model.setOptions(Nt(Ct.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new sN(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.PIE})];return this.getChartComponents(t)}}var Zc={exports:{}},ns={};/**
|
|
83
|
+
</svg>`}addEventListeners(){const t=this;this.parent.selectAll("circle.node").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0);const s=t.model.getHierarchyLevel(),a=s>2&&!i.classed("focal"),o=_(t.model.getOptions(),"canvasZoom","enabled");let l=!1;if(!a){let c=[],u=[],h=null;if(r.children){r.depth>1&&o&&(l=!0,i.classed("clickable",!0)),c=r.children.map(p=>{if(p!==null)return typeof p.data.value=="number"?{label:p.data.name,value:p.data.value}:{label:p.data.name,labelIcon:o&&s<=2?t.getZoomIcon():null,value:p.value}});const f=t.model.getOptions();u=[{label:kt(f,"tooltip.totalLabel")||"Total",value:r.value,bold:!0}],t.highlightChildren(r.children)}else h=r.value;const d=getComputedStyle(this,null).getPropertyValue("fill");t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:d,label:r.data.name,labelIcon:l&&o&&s<=2?t.getZoomIcon():null,value:h},...c,...u]})}t.services.events.dispatchEvent(A.CirclePack.CIRCLE_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.CirclePack.CIRCLE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1),r.children&&t.unhighlightChildren(r.children),t.services.events.dispatchEvent(A.CirclePack.CIRCLE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})}).on("click",function(n,r){const i=N(this),s=i.classed("non-focal"),a=_(t.model.getOptions(),"canvasZoom","enabled");if(a&&t.model.getHierarchyLevel()>2){const o=t.parent.selectAll("circle.node");N(t.services.domUtils.getMainContainer()).classed("zoomed-in",!1),t.focal=null,t.model.updateHierarchyLevel(2),t.services.canvasZoom.zoomOut(o,Dr)}else if(r.depth===2&&r.children&&!s&&a){const o=t.parent.selectAll("circle.node");N(t.services.domUtils.getMainContainer()).classed("zoomed-in",!0),t.focal=r,t.model.updateHierarchyLevel(3),t.services.canvasZoom.zoomIn(r,o,Dr),n.stopPropagation()}t.services.events.dispatchEvent(A.CirclePack.CIRCLE_CLICK,{event:n,element:i,datum:r})})}destroy(){this.parent.selectAll("circle.node").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),this.removeBackgroundListeners()}}function xR(e,t){const n=ei(this._current,e);return r=>(this._current=n(r),t(this._current))}class Mm extends gt{constructor(){super(...arguments),this.type="pie",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.slice").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i.data[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.slice").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getInnerRadius(){return Dt.innerRadius}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),{groupMapsTo:s}=i.data,{valueMapsTo:a}=i.pie,o=this.model.getDisplayData().filter(S=>S[a]>0),l=this.computeRadius();this.arc=Ti().innerRadius(this.getInnerRadius()).outerRadius(l),this.hoverArc=Ti().innerRadius(this.getInnerRadius()).outerRadius(l+Dt.hoverArc.outerRadiusOffset);const c=fE().value(S=>S[a]).sort(_(i,"pie","sortFunction")).padAngle(Dt.padAngle)(o),u=P.appendOrSelect(r,"g.slices").attr("role",dt.GROUP).attr("data-name","slices").selectAll("path.slice").data(c,S=>S.data[s]);u.exit().attr("opacity",0).remove(),u.enter().append("path").classed("slice",!0).attr("opacity",0).merge(u).attr("class",S=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:S.data[s],originalClassName:"slice"})).style("fill",S=>n.model.getFillColor(S.data[s])).attr("d",this.arc).transition().call(S=>this.services.transitions.setupTransition({transition:S,name:"pie_slice_enter_update",animate:t})).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","slice").attr("aria-label",S=>`${S[a]}, ${sg(S.data[a],o,a)+"%"}`).attrTween("d",function(S){return xR.bind(this)(S,n.arc)});const h=i.pie.labels.enabled,d=h?c.filter(S=>S.data[a]>0):[],f=P.appendOrSelect(r,"g.labels").attr("role",dt.GROUP).attr("data-name","labels").selectAll("text.pie-label").data(d,S=>S.data[s]);f.exit().attr("opacity",0).remove();const p=f.enter().append("text").classed("pie-label",!0),m=[];p.merge(f).style("text-anchor","middle").text(S=>i.pie.labels.formatter?i.pie.labels.formatter(S):sg(S.data[a],o,a)+"%").datum(function(S){const $=l+7,k=(S.endAngle-S.startAngle)/2+S.startAngle,L=k/Math.PI*180,M=this.getComputedTextLength();return S.textOffsetX=M/2,S.textOffsetY=L>90&&L<270?10:0,S.xPosition=(S.textOffsetX+$)*Math.sin(k),S.yPosition=(S.textOffsetY+$)*-Math.cos(k),S}).attr("transform",function(S,$){const k=d.length,L=(S.endAngle-S.startAngle)*(180/Math.PI);if($>=k-2&&L<Dt.callout.minSliceDegree){let M,V;return S.index===k-1?(M=S.xPosition+Dt.callout.offsetX+Dt.callout.textMargin+S.textOffsetX,V=S.yPosition-Dt.callout.offsetY,S.direction=pa.RIGHT,m.push(S)):(M=S.xPosition-Dt.callout.offsetX-S.textOffsetX-Dt.callout.textMargin,V=S.yPosition-Dt.callout.offsetY,S.direction=pa.LEFT,m.push(S)),`translate(${M}, ${V})`}return`translate(${S.xPosition}, ${S.yPosition})`}),this.renderCallouts(m);const g=_(i,"donut")?"donut":"pie",v=_(i,g,"alignment"),{width:b}=P.getSVGElementSize(this.getParent(),{useAttrs:!0}),w=h?Dt.xOffset:0,O=h?Dt.yOffset:0;let E=l+w;v===Yt.CENTER?E=b/2:v===Yt.RIGHT&&(E=b-l-Dt.xOffset);let T=l+O;m.length>0&&(T+=Dt.yOffsetCallout),r.attr("x",E+7).attr("y",T),this.addEventListeners()}renderCallouts(t){const n=P.appendOrSelect(this.getComponentContainer(),"g.callouts").attr("role",dt.GROUP).attr("data-name","callouts"),r=n.selectAll("g.callout").data(t);r.exit().remove();const i=r.enter().append("g").classed("callout",!0).attr("role",dt.GROUP).attr("aria-roledescription","label callout");i.merge(r).datum(function(s){const{xPosition:a,yPosition:o,direction:l}=s;return l===pa.RIGHT?(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a+Dt.callout.offsetX,y:o-Dt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x-Dt.callout.horizontalLineLength):(s.startPos={x:a,y:o+s.textOffsetY},s.endPos={x:a-Dt.callout.offsetX,y:o-Dt.callout.offsetY+s.textOffsetY},s.intersectPointX=s.endPos.x+Dt.callout.horizontalLineLength),s}),i.append("line").classed("vertical-line",!0).merge(n.selectAll("line.vertical-line")).datum(function(){return N(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.startPos.x).attr("y1",s=>s.startPos.y).attr("x2",s=>s.intersectPointX).attr("y2",s=>s.endPos.y),i.append("line").classed("horizontal-line",!0).merge(n.selectAll("line.horizontal-line")).datum(function(){return N(this.parentNode).datum()}).style("stroke-width","1px").attr("x1",s=>s.intersectPointX).attr("y1",s=>s.endPos.y).attr("x2",s=>s.endPos.x).attr("y2",s=>s.endPos.y)}addEventListeners(){const t=this;this.parent.selectAll("path.slice").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0).transition("pie_slice_mouseover").call(o=>t.services.transitions.setupTransition({transition:o,name:"pie_slice_mouseover"})).attr("d",t.hoverArc),t.services.events.dispatchEvent(A.Pie.SLICE_MOUSEOVER,{event:n,element:N(this),datum:r});const{groupMapsTo:s}=t.getOptions().data,{valueMapsTo:a}=t.getOptions().pie;t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{label:r.data[s],value:r.data[a]}]})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Pie.SLICE_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Pie.SLICE_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1).transition("pie_slice_mouseout").call(s=>t.services.transitions.setupTransition({transition:s,name:"pie_slice_mouseout"})).attr("d",t.arc),t.services.events.dispatchEvent(A.Pie.SLICE_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}computeRadius(){const{width:t,height:n}=P.getSVGElementSize(this.parent,{useAttrs:!0}),r=this.getOptions(),i=Math.min(t,n)/2;return r.pie.labels.enabled?i+Dt.radiusOffset:i}}class wR extends Mm{constructor(){super(...arguments),this.type="donut",this.renderType=nt.SVG}render(t=!0){super.render(t);const n=this;if(this.model.isDataEmpty()){this.getComponentContainer().select("g.center").remove();return}const r=P.appendOrSelect(this.getComponentContainer(),"g.center"),i=this.getOptions(),s=this.computeRadius(),a=_(i,"donut","center","label");P.appendOrSelect(r,"text.donut-figure").attr("text-anchor","middle").style("dominant-baseline",()=>a===null||a===""?"central":"initial").style("font-size",()=>i.donut.center.numberFontSize(s)).transition().call(o=>this.services.transitions.setupTransition({transition:o,name:"donut-figure-enter-update",animate:t})).tween("text",function(){return n.centerNumberTween(N(this))}),a!==null&&a!==""&&P.appendOrSelect(r,"text.donut-title").attr("text-anchor","middle").style("font-size",()=>i.donut.center.titleFontSize(s)).attr("y",i.donut.center.titleYPosition(s)).text(a)}getInnerRadius(){return this.computeRadius()*(3/4)}centerNumberTween(t){const n=this.getOptions();let r=_(n,"donut","center","number");r===null&&(r=this.model.getDisplayData().reduce((o,l)=>o+l[n.pie.valueMapsTo],0));const i=parseInt(t.text().replace(/[, ]+/g,""),10)||0;let s;i%1===0&&r%1===0?s=Pu:s=we;const a=s(i,r);return o=>{const{numberFormatter:l}=n.donut.center;t.text(l(a(o)))}}}const Cm="4,10 8,6 12,10",Am="12,6 8,10 4,6";class _R extends gt{constructor(){super(...arguments),this.type="gauge",this.renderType=nt.SVG}getValue(){var t;return((t=this.model.getData().find(n=>n.group==="value"))==null?void 0:t.value)??null}getValueRatio(){return nm(this.getValue(),0,100)/100}getDelta(){var t;return((t=this.model.getData().find(n=>n.group==="delta"))==null?void 0:t.value)??null}getArcRatio(){const t=this.getOptions();return _(t,"gauge","type")===Ar.FULL?1:.5}getArcSize(){return this.getArcRatio()*Math.PI*2}getStartAngle(){const t=this.getArcSize();return t===2*Math.PI?0:-t/2}getArrow(t){const n=this.getOptions();switch(_(n,"gauge","deltaArrow","direction")){case Nl.UP:return Cm;case Nl.DOWN:return Am;default:return t>0?Cm:Am}}render(t=!0){const n=this.getComponentContainer().attr("width","100%").attr("height","100%"),r=this.getOptions(),i=this.getValue(),s=this.getValueRatio(),a=this.getArcSize(),o=this.getStartAngle(),l=s*a,c=o+l,u=o+a,h=this.computeRadius(),d=this.getInnerRadius();this.backgroundArc=Ti().innerRadius(d).outerRadius(h).startAngle(c).endAngle(u),this.arc=Ti().innerRadius(d).outerRadius(h).startAngle(o).endAngle(c),P.appendOrSelect(n,"path.arc-background").attr("d",this.backgroundArc);const f=n.selectAll("path.arc-foreground").data([i]);f.enter().append("path").merge(f).attr("class",this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:"value",originalClassName:"arc-foreground"})).style("fill",()=>_(this.getOptions(),"color","scale","value")).attr("d",this.arc).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",v=>v),this.drawValueNumber(),this.drawDelta(),f.exit().remove();const p=_(r,"gauge","alignment"),{width:m}=P.getSVGElementSize(this.getParent(),{useAttrs:!0});let g=h;p===Yt.CENTER?g=m/2:p===Yt.RIGHT&&(g=m-h),n.attr("x",g).attr("y",h),this.addEventListeners()}drawValueNumber(){const t=this.getComponentContainer(),n=this.getOptions(),r=_(n,"gauge","type"),i=this.getValue(),s=this.getDelta(),a=this.computeRadius(),o=_(n,"gauge","valueFontSize"),l=_(n,"gauge","deltaFontSize"),c=_(n,"gauge","numberSpacing"),u=_(n,"gauge","showPercentageSymbol");let h=0;r===Ar.FULL&&!s?h=l(a):r===Ar.SEMI&&s&&(h=-(l(a)+c));const d=P.appendOrSelect(t,"g.gauge-numbers").attr("transform",`translate(0, ${h})`),f=o(a),p=P.appendOrSelect(d,"g.gauge-value-number"),m=_(n,"gauge","numberFormatter"),g=p.selectAll("text.gauge-value-number").data([i]);g.enter().append("text").attr("class","gauge-value-number").merge(g).style("font-size",`${f}px`).attr("text-anchor","middle").text(S=>m(S));const{width:v}=P.getSVGElementSize(P.appendOrSelect(t,"text.gauge-value-number"),{useBBox:!0}),b=f/2,w=u?"%":"",O=P.appendOrSelect(p,"text.gauge-value-symbol").style("font-size",`${b}px`).attr("x",v/2).text(w),{width:E,height:T}=P.getSVGElementSize(O,{useBBox:!0});O.attr("y",`-${T/2}px`),p.attr("transform",`translate(-${E/2}, 0)`)}drawDelta(){const t=this,n=this.getComponentContainer(),r=this.getOptions(),i=this.getDelta();if(i){const s=this.computeRadius(),a=i?_(r,"gauge","deltaFontSize"):()=>0,o=i?_(r,"gauge","numberFormatter"):()=>null,l=_(r,"gauge","deltaArrow","size"),c=_(r,"gauge","numberSpacing"),u=_(r,"gauge","showPercentageSymbol"),h=P.appendOrSelect(n,"g.gauge-numbers"),d=P.appendOrSelect(h,"g.gauge-delta").attr("transform",`translate(0, ${a(s)+c})`),f=P.appendOrSelect(d,"text.gauge-delta-number"),p=u?"%":"";f.data(i===null?[]:[i]),f.enter().append("text").classed("gauge-delta-number",!0).merge(f).attr("text-anchor","middle").style("font-size",`${a(s)}px`).text(b=>`${o(b)}${p}`);const{width:m}=P.getSVGElementSize(P.appendOrSelect(n,".gauge-delta-number"),{useBBox:!0}),g=_(r,"gauge","deltaArrow","enabled"),v=d.selectAll("svg.gauge-delta-arrow").data(i!==null&&g?[i]:[]);v.enter().append("svg").merge(v).attr("class","gauge-delta-arrow").attr("x",-l(s)-m/2).attr("y",-l(s)/2-a(s)*.35).attr("width",l(s)).attr("height",l(s)).attr("viewBox","0 0 16 16").each(function(){const b=N(this);P.appendOrSelect(b,"rect.gauge-delta-arrow-backdrop").attr("width","16").attr("height","16").attr("fill","none");const w=_(r,"gauge","status");P.appendOrSelect(b,"polygon.gauge-delta-arrow").attr("class",w!==null?`gauge-delta-arrow status--${w}`:"").attr("points",t.getArrow(i))}),v.exit().remove(),f.exit().remove()}else{const s=n.select("g.gauge-delta");s.empty()||s.remove()}}getInnerRadius(){const t=this.computeRadius(),n=_(this.getOptions(),"gauge","arcWidth");return t-n}addEventListeners(){const t=this;this.parent.selectAll("path.arc-foreground").on("mouseover",function(n,r){t.services.events.dispatchEvent(A.Gauge.ARC_MOUSEOVER,{event:n,element:N(this),datum:r})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Gauge.ARC_MOUSEMOVE,{event:n,element:i,datum:r})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Gauge.ARC_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Gauge.ARC_MOUSEOUT,{event:n,element:i,datum:r})})}computeRadius(){const t=this.getOptions(),n=_(t,"gauge","type"),{width:r,height:i}=P.getSVGElementSize(this.parent,{useAttrs:!0});return n===Ar.SEMI?Math.min(r/2,i):Math.min(r/2,i/2)}}class $m extends Fc{constructor(){super(...arguments),this.type="grouped-bar",this.renderType=nt.SVG,this.padding=5,this.defaultStepFactor=70,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.model.getDisplayData(this.configs.groups),r=this.getOptions(),{groupMapsTo:i}=r.data;this.setGroupScale();const s=this.getComponentContainer({withinChartClip:!0}),a=ji(n.map(u=>{const h=this.services.cartesianScales.getDomainIdentifier(u);return u[h]&&typeof u[h].toString=="function"?u[h].toString():u[h]})),o=s.selectAll("g.bars").data(a,u=>u);o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars").merge(o);l.transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-group-update-enter",animate:t})).attr("transform",u=>{const h=this.services.cartesianScales.getDomainValue(u)-this.getGroupWidth()/2;return this.services.cartesianScales.getOrientation()===Jt.VERTICAL?`translate(${h}, 0)`:`translate(0, ${h})`});const c=l.selectAll("path.bar").data(u=>this.getDataCorrespondingToLabel(u),u=>u[i]);c.exit().attr("opacity",0).remove(),c.enter().append("path").attr("opacity",0).merge(c).classed("bar",!0).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:u[i],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[i])).attr("d",u=>{const h=this.groupScale(u[i]),d=this.getBarWidth(),f=h,p=h+d,m=this.services.cartesianScales.getRangeAxisPosition({datum:u}),g=this.services.cartesianScales.getValueThroughAxisPosition(m,0),v=this.services.cartesianScales.getRangeValue(u),b=this.services.cartesianScales.getDomainValue(u)-d/2,w=b+d;if(!this.isOutsideZoomedDomain(b,w))return ue({x0:f,x1:p,y0:g,y1:v},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>u.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}getDataCorrespondingToLabel(t){return this.model.getDisplayData(this.configs.groups).filter(n=>{const r=this.services.cartesianScales.getDomainIdentifier(n);return n[r].toString()===t})}getGroupWidth(){const t=this.model.getGroupedData(this.configs.groups),n=this.getTotalGroupPadding();return this.getBarWidth()*t.length+n}getDomainScaleStep(){const t=this.services.cartesianScales.getDomainScale(),n=this.model.getGroupedData(this.configs.groups);let r=this.defaultStepFactor;if(typeof t.step=="function")r=t.step();else if(n.length>0){const i=n.find(s=>{var a;return((a=s.data)==null?void 0:a.length)>1});if(i){const s=this.services.cartesianScales.getDomainIdentifier(i.data[0]);r=Math.abs(t(i.data[1][s])-t(i.data[0][s]))}}return r}getTotalGroupPadding(){const t=this.model.getGroupedData(this.configs.groups);return t.length===1?0:Math.min(5,5*(this.getDomainScaleStep()/this.defaultStepFactor))*(t.length-1)}getBarWidth(){const t=this.getOptions(),n=_(t,"bars","width"),r=_(t,"bars","maxWidth");if(n!==null&&(r===null||n<=r))return n;const i=this.model.getGroupedData(this.configs.groups).length,s=this.getTotalGroupPadding();return Math.min(r,(this.getDomainScaleStep()-s)/i)}setGroupScale(){const t=this.model.getActiveDataGroupNames(this.configs.groups);this.groupScale=xi().domain(t).rangeRound([0,this.getGroupWidth()])}}class ER extends gt{constructor(){super(...arguments),this.type="heatmap",this.renderType=nt.SVG,this.matrix={},this.xBandwidth=0,this.yBandwidth=0,this.translationUnits={x:0,y:0},this.handleAxisOnHover=t=>{const{detail:n}=t,{datum:r}=n,i=this.model.getUniqueRanges(),s=this.model.getUniqueDomain(),a=this.services.cartesianScales.getDomainLabel(),o=this.services.cartesianScales.getRangeLabel(),l=this.services.cartesianScales.getMainXScale(),c=this.services.cartesianScales.getMainYScale();let u="",h=null,d=null,f=null;this.matrix[r]!==void 0?(u=a,i.forEach(p=>{if(typeof this.matrix[r][p].value=="number"){const m=this.matrix[r][p].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})):(u=o,s.forEach(p=>{if(typeof this.matrix[p][r].value=="number"){const m=this.matrix[p][r].value;if(h===null){h=m,d=m,f=m;return}h+=m,d=m<d?m:d,f=m>f?m:f}})),l(r)!==void 0?this.parent.select("g.multi-cell.column-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${l(r)}, ${Sn(c.range())})`):c(r)!==void 0&&this.parent.select("g.multi-cell.row-highlight").classed("highlighter-hidden",!1).attr("transform",`translate(${Sn(l.range())},${c(r)})`),this.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n.event,hoveredElement:N(t.detail.element),items:[{label:u,value:r,bold:!0},{label:"Min",value:d!==null?d:"-"},{label:"Max",value:f!==null?f:"-"},{label:"Average",value:h!==null?h/s.length:"-"}]})},this.handleAxisMouseOut=t=>{this.parent.selectAll("g.multi-cell").classed("highlighter-hidden",!0),this.services.events.dispatchEvent(A.Tooltip.HIDE,{event:t})}}init(){const t=this.services.events;t.addEventListener(A.Axis.LABEL_MOUSEOVER,this.handleAxisOnHover),t.addEventListener(A.Axis.LABEL_MOUSEOUT,this.handleAxisMouseOut),t.addEventListener(A.Axis.LABEL_FOCUS,this.handleAxisOnHover),t.addEventListener(A.Axis.LABEL_BLUR,this.handleAxisMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0});n.lower();const{cartesianScales:r}=this.services;if(this.matrix=this.model.getMatrix(),n.html(""),_(this.getOptions(),"data","loading"))return;const i=r.getMainXScale(),s=r.getMainYScale(),a=r.getDomainIdentifier(),o=r.getRangeIdentifier(),l=this.model.getUniqueDomain(),c=this.model.getUniqueRanges(),u=this.model.getMatrixAsArray(),h=i.range(),d=s.range();this.xBandwidth=Math.abs((h[1]-h[0])/l.length),this.yBandwidth=Math.abs((d[1]-d[0])/c.length);const f=this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");n.append("defs").append("pattern").attr("id",f).attr("width",3).attr("height",3).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("rect").classed("pattern-fill",!0).attr("width",.5).attr("height",8);const p=n.selectAll().data(u).enter().append("g").attr("class",m=>`heat-${m.index}`).classed("cell",!0).attr("transform",m=>`translate(${i(m[a])}, ${s(m[o])})`).append("rect").attr("class",m=>this.model.getColorClassName({value:m.value,originalClassName:`heat-${m.index}`})).classed("heat",!0).classed("null-state",m=>m.index===-1||m.value===null).attr("width",this.xBandwidth).attr("height",this.yBandwidth).style("fill",m=>m.index===-1||m.value===null?`url(#${f})`:this.model.getFillColor(Number(m.value))).attr("aria-label",m=>m.value);this.createOuterBox("g.cell-highlight",this.xBandwidth,this.yBandwidth),this.createOuterBox("g.multi-cell.column-highlight",this.xBandwidth,Math.abs(d[1]-d[0])),this.createOuterBox("g.multi-cell.row-highlight",Math.abs(h[1]-h[0]),this.yBandwidth),this.determineDividerStatus()&&(p.style("stroke-width","1px"),this.parent.select("g.cell-highlight").classed("cell-2",!0)),this.addEventListener()}createOuterBox(t,n,r){const i=P.appendOrSelect(this.parent,t).classed("shadows",!0).classed("highlighter-hidden",!0);P.appendOrSelect(i,"line.top").attr("x1",-1).attr("x2",n+1),P.appendOrSelect(i,"line.left").attr("x1",0).attr("y1",-1).attr("x2",0).attr("y2",r+1),P.appendOrSelect(i,"line.down").attr("x1",-1).attr("x2",n+1).attr("y1",r).attr("y2",r),P.appendOrSelect(i,"line.right").attr("x1",n).attr("x2",n).attr("y1",-1).attr("y2",r+1)}determineDividerStatus(){const t=_(this.getOptions(),"heatmap","divider","state");return t!==Di.OFF&&(t===Di.AUTO&&qf.minCellDividerDimension<=this.xBandwidth&&qf.minCellDividerDimension<=this.yBandwidth||t===Di.ON)}addEventListener(){const t=this,{cartesianScales:n}=this.services,r=this.getOptions(),i=kt(r,"tooltip.totalLabel"),s=n.getDomainIdentifier(),a=n.getRangeIdentifier(),o=n.getDomainLabel(),l=n.getRangeLabel();this.parent.selectAll("g.cell").on("mouseover",function(c,u){const h=N(this),d=h.select("rect.heat");if(!d.classed("null-state")){const f=Wi(h.attr("transform"));t.parent.select("g.cell-highlight").attr("transform",`translate(${f.x+t.translationUnits.x}, ${f.y+t.translationUnits.y})`).classed("highlighter-hidden",!1),t.services.events.dispatchEvent(A.Heatmap.HEATMAP_MOUSEOVER,{event:c,element:d,datum:u}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:c,items:[{label:o,value:u[s]},{label:l,value:u[a]},{label:i||"Total",value:u.value,color:d.style("fill")}]})}}).on("mousemove",function(c,u){t.services.events.dispatchEvent(A.Heatmap.HEATMAP_MOUSEMOVE,{event:c,element:N(this),datum:u}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:c})}).on("click",function(c,u){t.services.events.dispatchEvent(A.Heatmap.HEATMAP_CLICK,{event:c,element:N(this),datum:u})}).on("mouseout",function(c,u){const h=N(this).select("rect.heat"),d=h.classed("null-state");t.parent.select("g.cell-highlight").classed("highlighter-hidden",!0),d||(t.services.events.dispatchEvent(A.Heatmap.HEATMAP_MOUSEOUT,{event:c,element:h,datum:u}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{event:c,hoveredElement:h}))})}destroy(){this.parent.selectAll("rect.heat").on("mouseover",null).on("mousemove",null).on("click",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleAxisOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleAxisMouseOut)}}class SR extends gt{constructor(){super(...arguments),this.type="histogram",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-bar"})).attr("opacity",s=>s[i]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer(),r=this.model.getOptions(),{groupIdentifier:i}=r,{groupMapsTo:s}=r.data,a=this.model.getBinnedStackedData(),o=this.services.cartesianScales.getMainXScale(),l=n.selectAll("g.bars").data(a,u=>kt(u,`0.${s}`));l.exit().attr("opacity",0).remove(),l.enter().append("g").classed("bars",!0).attr("role",dt.GROUP);const c=n.selectAll("g.bars").selectAll("path.bar").data(u=>u);c.exit().remove(),c.enter().append("path").merge(c).classed("bar",!0).attr(i,(u,h)=>h).transition().call(u=>this.services.transitions.setupTransition({transition:u,name:"histogram-bar-update-enter",animate:t})).attr("class",u=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:u[s],originalClassName:"bar"})).style("fill",u=>this.model.getFillColor(u[s])).attr("d",u=>{const h=kt(u,"data");if(!h)return;const d=o(h.x1)-o(h.x0)-1,f=this.services.cartesianScales.getDomainValue(h.x0),p=f+d,m=this.services.cartesianScales.getRangeValue(u[0]);let g=this.services.cartesianScales.getRangeValue(u[1]);return Math.abs(g-m)>0&&Math.abs(g-m)>r.bars.dividerSize&&(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?g+=1:g-=1),ue({x0:f,x1:p,y0:m,y1:g},this.services.cartesianScales.getOrientation())}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",u=>_(u,"data",u[s])),this.addEventListeners()}addEventListeners(){const t=this.model.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=N(this);a.classed("hovered",!0);const o=parseFloat(kt(s,"data.x0")),l=parseFloat(kt(s,"data.x1")),c=r.services.cartesianScales.getRangeAxisPosition(),u=r.services.cartesianScales.getScaleLabel(c);r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,items:[{label:kt(t,"bins.rangeLabel")||"Range",value:`${o} – ${l}`},{label:t.tooltip.groupLabel||"Group",value:s[n],class:r.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:s[n]})},{label:u,value:kt(s,`data.${s[n]}`)}]})}).on("mousemove",function(i){r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("mouseout",function(){N(this).classed("hovered",!1),r.services.events.dispatchEvent(A.Tooltip.HIDE)})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class OR extends tn{constructor(){super(...arguments),this.type="lollipop",this.renderType=nt.SVG,this.handleScatterOnHover=t=>{const n=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").attr("stroke-width",s=>s[i]!==n.datum[i]?gn.weight.unselected:gn.weight.selected)},this.handleScatterOnMouseOut=()=>{this.parent.selectAll("line.line").attr("stroke-width",gn.weight.unselected)},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("line.line").transition("legend-hover-line").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-line"})).attr("opacity",s=>s[i]!==n.datum().name?gn.opacity.unselected:gn.opacity.selected)},this.handleLegendMouseOut=()=>{this.parent.selectAll("line.line").transition("legend-mouseout-line").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-line"})).attr("opacity",gn.opacity.selected)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.model.getOptions(),{groupMapsTo:i}=r.data,{cartesianScales:s}=this.services,a=s.getMainXScale(),o=s.getMainYScale(),l=s.getDomainIdentifier(),c=g=>s.getDomainValue(g),u=g=>s.getRangeValue(g),h=s.getOrientation(),[d,f]=xn(c,u,h),p=n.selectAll("line.line").data(this.getScatterData(),g=>`${g[i]}-${g[l]}`);p.exit().attr("opacity",0).remove();const m=p.enter().append("line").attr("opacity",0).merge(p).classed("line",!0).attr("class",g=>this.model.getColorClassName({classNameTypes:[st.STROKE],dataGroupName:g[i],originalClassName:"line"})).transition().call(g=>this.services.transitions.setupTransition({transition:g,name:"lollipop-line-update-enter",animate:t})).style("stroke",g=>this.model.getFillColor(g[i],g[l],g)).attr("opacity",1);h===Jt.HORIZONTAL?m.attr("y1",f).attr("y2",f).attr("x1",a.range()[0]).attr("x2",g=>d(g)-r.points.radius):m.attr("x1",d).attr("x2",d).attr("y1",o.range()[0]).attr("y2",g=>f(g)+r.points.radius),this.addScatterPointEventListeners()}addScatterPointEventListeners(){this.services.events.addEventListener(A.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),this.services.events.addEventListener(A.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}destroy(){const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut),t.removeEventListener(A.Scatter.SCATTER_MOUSEOVER,this.handleScatterOnHover),t.removeEventListener(A.Scatter.SCATTER_MOUSEOUT,this.handleScatterOnMouseOut)}}class TR extends gt{constructor(){super(...arguments),this.type="meter",this.renderType=nt.SVG}getStackedBounds(t,n){let r=0;return t.map((i,s)=>s!==0?(r+=n(i.value),{...i,width:Math.abs(n(i.value)-te.dividerWidth),x:r-n(i.value)}):(r=n(i.value),{...i,width:Math.abs(n(i.value)-te.dividerWidth),x:0}))}render(t=!0){const n=this,r=this.getComponentContainer(),i=this.getOptions(),s=_(i,"meter","proportional"),a=this.model.getDisplayData(),o=this.model.getStatus(),{width:l}=P.getSVGElementSize(r,{useAttrs:!0}),{groupMapsTo:c}=i.data;let u;_(i,"meter","proportional")===null?u=100:u=_(i,"meter","proportional","total")||this.model.getMaximumDomain(this.model.getDisplayData());const h=Be().domain([0,u]).range([0,l]),d=this.getStackedBounds(a,h),f=_(i,"meter","height");P.appendOrSelect(r,"rect.container").attr("x",0).attr("y",0).attr("width",l).attr("height",f||(s?te.height.proportional:te.height.default)),P.appendOrSelect(r,"line.rangeIndicator").attr("x1",l).attr("x2",l).attr("y1",0).attr("y2",f||(s?te.height.proportional:te.height.default));const p=r.selectAll("rect.value").data(d),m=o!=null&&!n.model.isUserProvidedColorScaleValid()&&!s?`value status--${o}`:"value";p.enter().append("rect").classed("value",!0).merge(p).attr("x",w=>w.x).attr("y",0).attr("height",()=>f||(s?te.height.proportional:te.height.default)).attr("class",w=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:w[c],originalClassName:m})).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"meter-bar-update",animate:t})).attr("width",w=>w.value>u?h(u):w.width).style("fill",w=>n.model.getFillColor(w[c])).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","value").attr("aria-label",w=>w.value),p.exit().remove();const g=_(i,"meter","peak");let v=g;g!==null&&(g>u?v=u:g<a[0].value&&(v=a[0].value>u?u:a[0].value));const b=r.selectAll("line.peak").data(v==null?[]:[v]);b.enter().append("line").classed("peak",!0).merge(b).attr("y1",0).attr("y2",()=>f||(s?te.height.proportional:te.height.default)).transition().call(w=>this.services.transitions.setupTransition({transition:w,name:"peak-line-update",animate:t})).attr("x1",w=>h(w)).attr("x2",w=>h(w)).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","peak").attr("aria-label",w=>w),b.exit().remove(),this.services.domUtils.setSVGMaxHeight(),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=_(t,"meter","proportional");this.parent.selectAll("rect.value").on("mouseover",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.Meter.METER_MOUSEOVER,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!0),r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:a[n],value:a.value}]}))}).on("mousemove",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.Meter.METER_MOUSEMOVE,{event:s,element:o,datum:a}),i&&r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(A.Meter.METER_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.Meter.METER_MOUSEOUT,{event:s,element:o,datum:a}),i&&(o.classed("hovered",!1),r.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o}))})}destroy(){this.parent.selectAll("rect.value").on("mouseover",null).on("mousemove",null).on("mouseout",null).on("click",null)}}class MR extends gt{constructor(){super(...arguments),this.type="radar",this.renderType=nt.SVG,this.getLabelDimensions=t=>{const n=P.appendOrSelect(this.getComponentContainer(),"g.tmp-tick"),r=P.appendOrSelect(n,"text").text(t),{width:i,height:s}=P.getSVGElementSize(r.node(),{useBBox:!0});return n.remove(),{width:i,height:s}},this.normalizeFlatData=t=>{const n=this.getOptions(),{angle:r,value:i}=_(n,"radar","axes"),s=_(n,"data","groupMapsTo"),a=AD(this.uniqueKeys.map(o=>this.uniqueGroups.map(l=>({[r]:o,[s]:l,[i]:null}))));return at(a,t)},this.normalizeGroupedData=t=>{const n=this.getOptions(),{angle:r,value:i}=_(n,"radar","axes"),s=_(n,"data","groupMapsTo");return t.map(({name:a,data:o})=>{const l=this.uniqueKeys.map(c=>({[s]:a,[r]:c,[i]:null}));return{name:a,data:at(l,o)}})},this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g.blobs path").transition("legend-hover-blob").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-blob"})).style("fill-opacity",r=>r.name!==n.datum().name?Kn.opacity.unselected:Kn.opacity.selected).style("stroke-opacity",r=>r.name!==n.datum().name?Kn.opacity.unselected:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g.blobs path").transition("legend-mouseout-blob").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-blob"})).style("fill-opacity",Kn.opacity.selected).style("stroke-opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer(),{width:r,height:i}=P.getSVGElementSize(n,{useAttrs:!0}),s=this.model.getData(),a=this.model.getGroupedData(),o=this.getOptions(),l=_(o,"data","groupMapsTo"),c=_(o,"radar","axes","value"),{angle:u,value:h}=_(o,"radar","axes"),{xLabelPadding:d,yLabelPadding:f,yTicksNumber:p,minRange:m,xAxisRectHeight:g}=Kn;this.uniqueKeys=Array.from(new Set(s.map(x=>x[u]))),this.uniqueGroups=Array.from(new Set(s.map(x=>x[l]))),this.fullDataNormalized=this.normalizeFlatData(s),this.groupedDataNormalized=this.normalizeGroupedData(a);const v=2*(this.getLabelDimensions(this.uniqueKeys[0]).height+f),b=(Math.min(r,i)-v)/2;if(b<=0)return;const w=xi().domain(this.fullDataNormalized.map(x=>x[u])).range([0,2*Math.PI].map(x=>x-Math.PI/2)),O=Sn(this.fullDataNormalized.map(x=>x[h])),E=Be().domain([O>=0?0:O,Nn(this.fullDataNormalized.map(x=>x[h]))]).range([m,b]).nice(p),T=E.ticks(p),S=x=>this.model.getFillColor(x),$=mE().angle(x=>w(x[u])+Math.PI/2).radius(x=>E(x[h])).curve(ef),k=this.uniqueKeys.map(x=>{const C=this.getLabelDimensions(x).width,y=Z$(w(x),b);return C+y}),L={x:Nn(k)+d,y:i/2},M=P.appendOrSelect(n,"g.y-axes").attr("role",dt.GROUP).selectAll("path").data(T,x=>x),V=x=>this.uniqueKeys.map(C=>({[u]:C,[h]:x}));M.join(x=>x.append("path").attr("opacity",0).attr("transform",`translate(${L.x}, ${L.y})`).attr("fill","none").call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_enter",animate:t})).attr("opacity",1).attr("d",y=>$(V(y)))),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(V(y)))),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_axes_exit",animate:t})).attr("d",y=>$(V(y))).attr("opacity",0).remove())),P.appendOrSelect(n,"g.x-axes").attr("role",dt.GROUP).selectAll("line").data(this.uniqueKeys,x=>x).join(x=>x.append("line").attr("opacity",0).attr("class",C=>`x-axis-${Hr(C)}`).attr("stroke-dasharray","0").attr("x1",C=>Gt(w(C),0,L).x).attr("y1",C=>Gt(w(C),0,L).y).attr("x2",C=>Gt(w(C),0,L).x).attr("y2",C=>Gt(w(C),0,L).y).call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_enter",animate:t})).attr("opacity",1).attr("x1",y=>Gt(w(y),E.range()[0],L).x).attr("y1",y=>Gt(w(y),E.range()[0],L).y).attr("x2",y=>Gt(w(y),E.range()[1],L).x).attr("y2",y=>Gt(w(y),E.range()[1],L).y)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_update",animate:t})).attr("opacity",1).attr("x1",y=>Gt(w(y),E.range()[0],L).x).attr("y1",y=>Gt(w(y),E.range()[0],L).y).attr("x2",y=>Gt(w(y),E.range()[1],L).x).attr("y2",y=>Gt(w(y),E.range()[1],L).y)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_axes_exit",animate:t})).attr("opacity",0).remove())),P.appendOrSelect(n,"g.x-labels").attr("role",dt.GROUP).selectAll("text").data(this.uniqueKeys).join(x=>x.append("text").text(C=>C).attr("opacity",0).attr("x",C=>Gt(w(C),E.range()[1]+d,L).x).attr("y",C=>Gt(w(C),E.range()[1]+d,L).y).style("text-anchor",C=>Eg(w(C)).textAnchor).style("dominant-baseline",C=>Eg(w(C)).dominantBaseline).call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_update",animate:t})).attr("opacity",1).attr("x",y=>Gt(w(y),E.range()[1]+d,L).x).attr("y",y=>Gt(w(y),E.range()[1]+d,L).y).end().finally(()=>{const y=_(o,"radar","alignment"),R=this.getAlignmentXOffset(y,n,this.getParent());n.attr("x",R)})),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_x_labels_exit",animate:t})).attr("opacity",0).remove())),P.appendOrSelect(n,"g.blobs").attr("role",dt.GROUP).selectAll("path").data(this.groupedDataNormalized,x=>x.name).join(x=>x.append("path").attr("class",C=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:C.name,originalClassName:"blob"})).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",C=>C.name).attr("opacity",0).attr("transform",t?()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`:`translate(${L.x}, ${L.y})`).style("fill",C=>S(C.name)).style("fill-opacity",Kn.opacity.selected).style("stroke",C=>S(C.name)).call(C=>{const y=C.transition().call(R=>this.services.transitions.setupTransition({transition:R,name:"radar_blobs_enter",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",`translate(${L.x}, ${L.y})`),y.attr("opacity",1).attr("d",R=>$(R.data))}),x=>(x.attr("class",C=>this.model.getColorClassName({classNameTypes:[st.FILL,st.STROKE],dataGroupName:C.name,originalClassName:"blob"})).style("fill",C=>S(C.name)).style("stroke",C=>S(C.name)),x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_blobs_update",animate:t})).attr("opacity",1).attr("transform",`translate(${L.x}, ${L.y})`).attr("d",y=>$(y.data))),x),x=>x.call(C=>{const y=C.transition().call(R=>this.services.transitions.setupTransition({transition:R,name:"radar_blobs_exit",animate:t}));t&&y.delay(()=>Math.random()*30).attr("transform",()=>`translate(${L.x}, ${L.y}) scale(${1+Math.random()*.35})`),y.attr("opacity",0).remove()})),P.appendOrSelect(n,"g.dots").attr("role",dt.GROUP).selectAll("circle").data(this.fullDataNormalized.filter(x=>_(x,h)!==null)).join(x=>x.append("circle").attr("role",dt.GRAPHICS_SYMBOL).attr("aria-label",C=>C[c]),x=>x,x=>x.remove()).attr("class",x=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:x[l],originalClassName:Hr(x[u])})).attr("cx",x=>Gt(w(x[u]),E(x[h]),L).x).attr("cy",x=>Gt(w(x[u]),E(x[h]),L).y).attr("r",0).attr("opacity",0).style("fill",x=>S(x[l])),P.appendOrSelect(n,"g.x-axes-rect").attr("role",dt.GROUP).selectAll("rect").data(this.uniqueKeys).join(x=>x.append("rect"),x=>x,x=>x.remove()).attr("x",L.x).attr("y",L.y-g/2).attr("width",E.range()[1]).attr("height",g).style("fill","red").style("fill-opacity",0).attr("transform",x=>`rotate(${Sg(w(x))}, ${L.x}, ${L.y})`),P.appendOrSelect(n,"g.y-labels").attr("role",dt.GROUP).selectAll("text").data(Re(T)).join(x=>x.append("text").attr("opacity",0).text(C=>C).attr("x",C=>Gt(-Math.PI/2,E(C),L).x+f).attr("y",C=>Gt(-Math.PI/2,E(C),L).y).style("text-anchor","start").style("dominant-baseline","middle").call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_enter",animate:t})).attr("opacity",1)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_update",animate:t})).text(y=>y).attr("opacity",1).attr("x",y=>Gt(-Math.PI/2,E(y),L).x+f).attr("y",y=>Gt(-Math.PI/2,E(y),L).y)),x=>x.call(C=>C.transition().call(y=>this.services.transitions.setupTransition({transition:y,name:"radar_y_labels_exit",animate:t})).attr("opacity",0).remove())),this.addEventListeners()}getAlignmentXOffset(t,n,r){const i=P.getSVGElementSize(n,{useBBox:!0}),{width:s}=P.getSVGElementSize(r,{useAttrs:!0});let a=0;return t===Yt.CENTER?a=Math.floor((s-i.width)/2):t===Yt.RIGHT&&(a=s-i.width),a}destroy(){this.parent.selectAll(".x-axes-rect > rect").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}addEventListeners(){const t=this,{axes:{angle:n}}=_(this.getOptions(),"radar");this.parent.selectAll(".x-axes-rect > rect").on("mouseover",function(r,i){const s=N(this);t.services.events.dispatchEvent(A.Radar.X_AXIS_MOUSEOVER,{event:r,element:s,datum:i});const a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`),l=t.model.getActiveDataGroupNames(),c=t.getOptions(),{groupMapsTo:u}=c.data,h=_(c,"radar","axes","value");a.classed("hovered",!0).attr("stroke-dasharray","4 4"),o.classed("hovered",!0).attr("opacity",f=>l.indexOf(f[u])!==-1?1:0).attr("r",Kn.dotsRadius);const d=t.fullDataNormalized.filter(f=>f[n]===i&&l.indexOf(f[u])!==-1);t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:r,hoveredElement:s,items:d.filter(f=>typeof f[h]=="number").map(f=>({label:f[u],value:f[h],color:t.model.getFillColor(f[u]),class:t.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:f[u]})}))})}).on("mousemove",function(r,i){const s=N(this);t.services.events.dispatchEvent(A.Radar.X_AXIS_MOUSEMOVE,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(A.Radar.X_AXIS_CLICK,{event:r,element:N(this),datum:i})}).on("mouseout",function(r,i){const s=N(this),a=t.parent.select(`.x-axes .x-axis-${Hr(i)}`),o=t.parent.selectAll(`.dots circle.${Hr(i)}`);a.classed("hovered",!1).attr("stroke-dasharray","0"),o.classed("hovered",!1).attr("opacity",0).attr("r",0),t.services.events.dispatchEvent(A.Radar.X_AXIS_MOUSEOUT,{event:r,element:s,datum:i}),t.services.events.dispatchEvent(A.Tooltip.HIDE)})}}class Lm extends Fc{constructor(){super(...arguments),this.type="simple-bar",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-simple-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-simple-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-simple-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-simple-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getOptions(),{groupMapsTo:r}=n.data,i=this.getComponentContainer({withinChartClip:!0}),s=this.model.getDisplayData(this.configs.groups),a=this.services.cartesianScales.getOrientation(),o=i.selectAll("path.bar").data(s,l=>l[r]);o.exit().attr("opacity",0).remove(),o.enter().append("path").attr("opacity",0).merge(o).classed("bar",!0).attr("width",this.getBarWidth.bind(this)).transition().call(l=>this.services.transitions.setupTransition({transition:l,name:"bar-update-enter",animate:t})).attr("class",l=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:l[r],originalClassName:"bar"})).style("fill",l=>this.model.getFillColor(l[r])).attr("d",l=>{const c=this.services.cartesianScales.getRangeIdentifier(),u=this.getBarWidth(),h=l[c],d=this.services.cartesianScales.getDomainValue(l)-u/2,f=d+u;let p,m;if(Array.isArray(h)&&h.length===2)p=this.services.cartesianScales.getRangeValue(h[0]),m=this.services.cartesianScales.getRangeValue(h[1]);else{const v=this.services.cartesianScales.getRangeScale().domain()[0];p=this.services.cartesianScales.getRangeValue(Math.max(0,v)),m=this.services.cartesianScales.getRangeValue(l)}const g=Math.abs(m-p);if(g!==0&&g<2&&(h>0&&a===Jt.VERTICAL||h<0&&a===Jt.HORIZONTAL?m=p-2:m=p+2),!this.isOutsideZoomedDomain(d,f))return ue({x0:d,x1:f,y0:p,y1:m},a)}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",l=>l.value),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("path.bar").on("mouseover",function(n,r){const i=N(this);i.classed("hovered",!0),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,data:[r]})}).on("mousemove",function(n,r){t.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:n,element:N(this),datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1),t.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class CR extends he{constructor(){super(...arguments),this.type="skeleton-lines"}render(t=!0){const n=_(this.getOptions(),"data","loading"),r=!_(this.getOptions(),"grid","x","enabled")&&!_(this.getOptions(),"grid","y","enabled")&&!_(this.getOptions(),"axes","bottom","visible")&&!_(this.getOptions(),"axes","left","visible");n&&!r?super.renderGridSkeleton(n):n&&r?this.renderSparklineSkeleton(n):this.removeSkeleton()}renderSparklineSkeleton(t){this.setScales(),this.drawBackdrop(t),this.drawSparkline(t),this.updateBackdropStyle(),t&&this.setShimmerEffect("shimmer-lines")}drawSparkline(t){const n=this.backdrop.attr("width"),r=[100],i=P.appendOrSelect(this.backdrop,"g.y.skeleton"),s=i.selectAll("line").data(r);s.enter().append("line").merge(s).attr("x1",0).attr("x2",n).attr("y1",a=>a).attr("y2",a=>a),i.selectAll("line").classed("shimmer-effect-lines",t).classed("empty-state-lines",!t).style("stroke",t?`url(#${this.services.domUtils.generateElementIDString("shimmer-lines")})`:null)}updateBackdropStyle(){const t=this.parent;this.backdrop=P.appendOrSelect(t,"svg.chart-skeleton.DAII"),P.appendOrSelect(this.backdrop,"rect.chart-skeleton-backdrop").classed("shimmer-effect-lines",!1).classed("shimmer-effect-sparkline",!0).style("stroke",null)}}class Dm extends gt{constructor(){super(...arguments),this.type="area-stacked",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,r=this.getOptions(),{groupMapsTo:i}=r.data;this.parent.selectAll("path.area").transition("legend-hover-area").call(s=>this.services.transitions.setupTransition({transition:s,name:"legend-hover-area"})).attr("opacity",s=>_(s,0,i)!==n.datum().name?pn.opacity.unselected:pn.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",pn.opacity.selected)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer({withinChartClip:!0}),r=this,i=this.getOptions(),{groupMapsTo:s}=i.data,a=Object.keys(i.axes).some(f=>i.axes[f].percentage),o=this.model.getStackedData({percentage:a,groups:this.configs.groups}),l=_(o,0,0),c=this.services.cartesianScales.getDomainAxisPosition({datum:l}),u=this.services.cartesianScales.getRangeAxisPosition({datum:l}),h=this.services.cartesianScales.getScaleByPosition(u),d=n.selectAll("path.area").data(o,f=>_(f,0,s));this.areaGenerator=Al().x(f=>this.services.cartesianScales.getValueThroughAxisPosition(c,f.data.sharedStackKey)).y0(f=>h(f[0])).y1(f=>h(f[1])).curve(this.services.curves.getD3Curve()),d.exit().attr("opacity",0).remove(),d.enter().append("path").attr("opacity",0).merge(d).data(o,f=>_(f,0,s)).attr("class","area").attr("class",f=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:_(f,0,s),originalClassName:"area"})).style("fill",f=>r.model.getFillColor(_(f,0,s))).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","area").attr("aria-label",f=>_(f,0,s)).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"area-update-enter",animate:t})).attr("opacity",pn.opacity.selected).attr("d",this.areaGenerator)}}class km extends Fc{constructor(){super(...arguments),this.type="stacked-bar",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.model.getOptions().data;this.parent.selectAll("path.bar").transition("legend-hover-bar").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-bar"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("path.bar").transition("legend-mouseout-bar").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-bar"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t){const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=this.model.getStackedData({groups:this.configs.groups,divergent:!0}),a=this.model.getActiveDataGroupNames(),o=n.selectAll("g.bars").data(s,c=>_(c,0,i));o.exit().attr("opacity",0).remove(),o.enter().append("g").classed("bars",!0).attr("role",dt.GROUP).attr("data-name","bars");const l=n.selectAll("g.bars").selectAll("path.bar").data(c=>c,c=>c.data.sharedStackKey);l.exit().remove(),l.enter().append("path").merge(l).classed("bar",!0).transition().call(c=>this.services.transitions.setupTransition({transition:c,name:"bar-update-enter",animate:t})).attr("class",c=>this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:c[i],originalClassName:"bar"})).style("fill",c=>this.model.getFillColor(c[i])).attr("d",c=>{const u=c.data.sharedStackKey,h=this.getBarWidth(),d=this.services.cartesianScales.getDomainValue(u)-h/2,f=d+h,p=this.services.cartesianScales.getRangeValue(c[0]);let m=this.services.cartesianScales.getRangeValue(c[1]);if(!this.isOutsideZoomedDomain(d,f)){if(Math.abs(m-p)>0&&Math.abs(m-p)>r.bars.dividerSize){const g=c[0]<0&&c[1]<=0;g&&a.length>1?this.services.cartesianScales.getOrientation()===Jt.VERTICAL?m+=c[1]===0?2:1:m-=1:g||(this.services.cartesianScales.getOrientation()===Jt.VERTICAL?m+=1:m-=1)}return ue({x0:d,x1:f,y0:p,y1:m},this.services.cartesianScales.getOrientation())}}).attr("opacity",1).attr("role",dt.GRAPHICS_SYMBOL).attr("aria-roledescription","bar").attr("aria-label",c=>c[1]-c[0]),this.addEventListeners()}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this;this.parent.selectAll("path.bar").on("mouseover",function(i,s){const a=N(this);a.classed("hovered",!0),r.services.events.dispatchEvent(A.Bar.BAR_MOUSEOVER,{event:i,element:a,datum:s});let o=r.model.getDisplayData(r.configs.groups).find(l=>{const c=r.services.cartesianScales.getDomainIdentifier(l),u=r.services.cartesianScales.getRangeIdentifier(l);return l[u]===s.data[s[n]]&&l[c].toString()===s.data.sharedStackKey&&l[n]===s[n]});if(o===void 0){const l=r.services.cartesianScales.getDomainIdentifier(),c=r.services.cartesianScales.getRangeIdentifier();o={[l]:s.data.sharedStackKey,[c]:s.data[s[n]],[n]:s[n]}}r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:i,hoveredElement:a,data:[o]})}).on("mousemove",function(i,s){const a=N(this);r.services.events.dispatchEvent(A.Bar.BAR_MOUSEMOVE,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:i})}).on("click",function(i,s){r.services.events.dispatchEvent(A.Bar.BAR_CLICK,{event:i,element:N(this),datum:s})}).on("mouseout",function(i,s){const a=N(this);a.classed("hovered",!1),r.services.events.dispatchEvent(A.Bar.BAR_MOUSEOUT,{event:i,element:a,datum:s}),r.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:a})})}getBarWidth(){const t=this.getOptions();if(_(t,"bars","width"))return t.bars.width;const n=this.services.cartesianScales.getMainXScale(),r=P.getSVGElementSize(this.parent,{useAttrs:!0}).width,i=this.model.getStackKeys().length,s=_(t,"bars","spacingFactor");return n.step?Math.min(t.bars.maxWidth,n.step()/2):Math.min(t.bars.maxWidth,r*s/i)}destroy(){this.parent.selectAll("path.bar").on("mouseover",null).on("mousemove",null).on("mouseout",null);const t=this.services.events;t.removeEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.removeEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}}class Rm extends tn{constructor(){super(...arguments),this.type="scatter-stacked",this.renderType=nt.SVG}render(t){if(!_(this.getOptions(),"points","enabled"))return;const n=this.getComponentContainer({withinChartClip:!0}),r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(u=>r.axes[u].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=n.selectAll("g.dots").data(a,u=>_(u,0,i));o.exit().attr("opacity",0).remove();const l=o.enter().append("g").classed("dots",!0).attr("role",dt.GROUP).merge(o).selectAll("circle.dot").data(u=>u);l.exit().attr("opacity",0).remove();const c=l.enter().append("circle").classed("dot",!0).attr("opacity",0).merge(l).datum(u=>{const h=u[i],d=this.services.cartesianScales.getDomainIdentifier(u),f=this.services.cartesianScales.getRangeIdentifier(u);return{[i]:h,[d]:u.data.sharedStackKey,[f]:u[1]}});this.styleCircles(c,t),this.addEventListeners()}getTooltipData(t,n){const r=this.getOptions(),{groupMapsTo:i}=r.data,s=Object.keys(r.axes).some(l=>r.axes[l].percentage),a=this.model.getStackedData({groups:this.configs.groups,percentage:s}),o=[];return a.forEach((l,c)=>{l.forEach((u,h)=>{const d=u[i],f=u.data.sharedStackKey;let p=u.data[d];const m=u[1],g=this.services.cartesianScales.getDomainIdentifier(u),v=this.services.cartesianScales.getRangeIdentifier(u);p!=null&&t===this.services.cartesianScales.getDomainValue(f)&&n===this.services.cartesianScales.getRangeValue(m)&&(s&&(p=this.model.getStackedData({groups:this.configs.groups})[c][h].data[d]),p!==null&&o.push({[i]:d,[g]:f,[v]:p}))})}),this.model.getDisplayData(this.configs.groups).filter(l=>{const c=this.services.cartesianScales.getDomainIdentifier(l),u=this.services.cartesianScales.getRangeIdentifier(l);return o.find(h=>h[i]==l[i]&&h[c]==l[c]&&h[u]==l[u])!==void 0})}}const Wr=6;class AR extends gt{constructor(){super(...arguments),this.type="tree",this.renderType=nt.SVG}getLongestLabel(t){let n="";return t.forEach(r=>{const i=r.children?this.getLongestLabel(r.children):"";(i.length>n.length||r.name.length>n.length)&&(n=i.length>r.name.length?i:r.name)}),n}getMockLabelWidth(t,n){const r=t.append("text").attr("dy","0.31em").attr("x",0).attr("text-anchor","end").text(n),{width:i}=P.getSVGElementSize(r.node(),{useBBox:!0});return r.remove(),i}render(t=!0){const n=this.getComponentContainer();n.html("");const{width:r,height:i}=P.getSVGElementSize(this.parent,{useAttrs:!0});if(r<1||i<1)return;const s=this.model.getOptions(),a=this.model.getDisplayData(),o=_(s,"tree","rootTitle")||"Tree",l=this.getMockLabelWidth(n,o),c=this.getLongestLabel(a),u=this.getMockLabelWidth(n,c),h={top:0,right:0,bottom:0,left:l>0?l+Wr:30-Wr},d=vi({name:o,children:a}),f=10,p=r/6,m=T=>{const S=d.descendants().reverse(),$=d.links();let k=d,L=d;d.eachBefore(B=>{B.x<k.x&&(k=B),B.x>L.x&&(L=B)});const M=L.x-k.x,V=n.transition().call(B=>this.services.transitions.setupTransition({transition:B,name:"tree-update-viewbox",animate:!0})).attr("viewBox",[-h.left,k.x,r,M].join(" ")),x=E.selectAll("g").data(S,B=>B.id),C=this,y=x.enter().append("g").attr("transform",()=>`translate(${T.y0},${T.x0})`).attr("class",B=>B.depth!==0&&B.children&&B.children.length>0?"clickable":null).on("mouseover",function(B,U){C.services.events.dispatchEvent(A.Tree.NODE_MOUSEOVER,{event:B,element:N(this),datum:U})}).on("click",function(B,U){U.depth!==0&&(U.children=U.children?null:U._children,m(U)),C.services.events.dispatchEvent(A.Tree.NODE_CLICK,{event:B,element:N(this),datum:U})}).on("mouseout",function(B,U){C.services.events.dispatchEvent(A.Tree.NODE_MOUSEOUT,{event:B,element:N(this),datum:U})});y.append("circle").attr("r",2.5).attr("class",B=>B._children?"parent":"child").attr("stroke-width",10),y.append("text").attr("dy","0.31em").attr("x",B=>B._children?-Wr:Wr).attr("text-anchor",B=>B._children?"end":"start").text(B=>B.data.name).clone(!0).attr("class","text-stroke").lower(),x.merge(y).transition(V).attr("transform",B=>`translate(${B.y},${B.x})`).attr("fill-opacity",1).attr("stroke-opacity",1),x.exit().transition(V).remove().attr("transform",()=>`translate(${T.y},${T.x})`).attr("fill-opacity",0).attr("stroke-opacity",0);const R=O.selectAll("path").data($,B=>B.target.id),I=R.enter().append("path").attr("d",()=>{const B={x:T.x0,y:T.y0};return w({source:B,target:B})});R.merge(I).transition(V).attr("d",w),R.exit().transition(V).remove().attr("d",()=>{const B={x:T.x,y:T.y};return w({source:B,target:B})}),d.eachBefore(B=>{B.x0=B.x,B.y0=B.y})},g=d.descendants(),v=g[g.length-1].depth,b=_(s,"tree","type")===Pl.DENDROGRAM?Nx().size([i,r-u-v*Wr-l]):Sw().nodeSize([f,p]).size([i,r-u-v*Wr-l]),w=_E().x(T=>T.y).y(T=>T.x);d.x0=p/2,d.y0=0,d.descendants().forEach((T,S)=>{T.id=S,T._children=T.children}),b(d),n.attr("viewBox",[-h.left,-h.top,r,f]).style("user-select","none");const O=n.append("g").attr("class","links"),E=n.append("g").attr("class","nodes");m(d)}}var $R="#000000",LR="#ffffff",DR="#fcf4d6",kR="#fddc69",RR="#f1c21b",IR="#d2a106",PR="#b28600",NR="#8e6a00",UR="#684e00",BR="#483700",VR="#302400",HR="#1c1500",FR={10:DR,20:kR,30:RR,40:IR,50:PR,60:NR,70:UR,80:BR,90:VR,100:HR},GR="#fff2e8",zR="#ffd9be",jR="#ffb784",WR="#ff832b",qR="#eb6200",YR="#ba4e00",XR="#8a3800",ZR="#5e2900",KR="#3e1a00",QR="#231000",JR={10:GR,20:zR,30:jR,40:WR,50:qR,60:YR,70:XR,80:ZR,90:KR,100:QR},tI="#fff1f1",eI="#ffd7d9",nI="#ffb3b8",rI="#ff8389",iI="#fa4d56",sI="#da1e28",aI="#a2191f",oI="#750e13",lI="#520408",cI="#2d0709",uI={10:tI,20:eI,30:nI,40:rI,50:iI,60:sI,70:aI,80:oI,90:lI,100:cI},hI="#fff0f7",dI="#ffd6e8",fI="#ffafd2",pI="#ff7eb6",gI="#ee5396",mI="#d02670",vI="#9f1853",yI="#740937",bI="#510224",xI="#2a0a18",wI={10:hI,20:dI,30:fI,40:pI,50:gI,60:mI,70:vI,80:yI,90:bI,100:xI},_I="#f6f2ff",EI="#e8daff",SI="#d4bbff",OI="#be95ff",TI="#a56eff",MI="#8a3ffc",CI="#6929c4",AI="#491d8b",$I="#31135e",LI="#1c0f30",DI={10:_I,20:EI,30:SI,40:OI,50:TI,60:MI,70:CI,80:AI,90:$I,100:LI},kI="#edf5ff",RI="#d0e2ff",II="#a6c8ff",PI="#78a9ff",NI="#4589ff",UI="#0f62fe",BI="#0043ce",VI="#002d9c",HI="#001d6c",FI="#001141",GI={10:kI,20:RI,30:II,40:PI,50:NI,60:UI,70:BI,80:VI,90:HI,100:FI},zI="#e5f6ff",jI="#bae6ff",WI="#82cfff",qI="#33b1ff",YI="#1192e8",XI="#0072c3",ZI="#00539a",KI="#003a6d",QI="#012749",JI="#061727",tP={10:zI,20:jI,30:WI,40:qI,50:YI,60:XI,70:ZI,80:KI,90:QI,100:JI},eP="#d9fbfb",nP="#9ef0f0",rP="#3ddbd9",iP="#08bdba",sP="#009d9a",aP="#007d79",oP="#005d5d",lP="#004144",cP="#022b30",uP="#081a1c",hP={10:eP,20:nP,30:rP,40:iP,50:sP,60:aP,70:oP,80:lP,90:cP,100:uP},dP="#defbe6",fP="#a7f0ba",pP="#6fdc8c",gP="#42be65",mP="#24a148",vP="#198038",yP="#0e6027",bP="#044317",xP="#022d0d",wP="#071908",_P={10:dP,20:fP,30:pP,40:gP,50:mP,60:vP,70:yP,80:bP,90:xP,100:wP},EP="#f2f4f8",SP="#dde1e6",OP="#c1c7cd",TP="#a2a9b0",MP="#878d96",CP="#697077",AP="#4d5358",$P="#343a3f",LP="#21272a",DP="#121619",kP={10:EP,20:SP,30:OP,40:TP,50:MP,60:CP,70:AP,80:$P,90:LP,100:DP},RP="#f4f4f4",IP="#e0e0e0",PP="#c6c6c6",NP="#a8a8a8",UP="#8d8d8d",BP="#6f6f6f",VP="#525252",HP="#393939",FP="#262626",GP="#161616",zP={10:RP,20:IP,30:PP,40:NP,50:UP,60:BP,70:VP,80:HP,90:FP,100:GP},jP="#f7f3f2",WP="#e5e0df",qP="#cac5c4",YP="#ada8a8",XP="#8f8b8b",ZP="#726e6e",KP="#565151",QP="#3c3838",JP="#272525",tN="#171414",eN={10:jP,20:WP,30:qP,40:YP,50:XP,60:ZP,70:KP,80:QP,90:JP,100:tN},Im={black:{100:$R},blue:GI,coolGray:kP,cyan:tP,gray:zP,green:_P,magenta:wI,orange:JR,purple:DI,red:uI,teal:hP,warmGray:eN,white:{0:LR},yellow:FR};const nN=e=>{if(!e)return null;for(const t of Object.keys(Im)){const n=Im[t];for(const r of Object.keys(n))if(n[+r]===e)return r}return null},Pm=function(){const e=N(this.parentNode).select("rect.leaf"),t=getComputedStyle(e.node(),null).getPropertyValue("fill"),n=en(t);let r;if(n&&(r=nN(n?n.hex():null)),r==null){const i=yo(n).l;r=Math.abs(i*100-100)}return r>50?"white":"black"};let rN=0;class iN extends gt{constructor(){super(...arguments),this.type="treemap",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail;this.parent.selectAll("g[data-name='leaf']").transition("legend-hover-treemap").call(r=>this.services.transitions.setupTransition({transition:r,name:"legend-hover-treemap"})).attr("opacity",r=>r.parent.data.name===n.datum().name?1:.3)},this.handleLegendMouseOut=()=>{this.parent.selectAll("g[data-name='leaf']").transition("legend-mouseout-treemap").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-treemap"})).attr("opacity",1)}}init(){const{events:t}=this.services;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this.getComponentContainer();this.model.getData();const r=this.model.getDisplayData(),i=this.model.getOptions(),s=_(window,"location"),{width:a,height:o}=P.getSVGElementSize(n,{useAttrs:!0}),l=vi({name:i.title||"Treemap",children:r}).sum(f=>f.value).sort((f,p)=>p.value-f.value),c=Aw().size([a,o]).paddingInner(1).paddingOuter(0).round(!0)(l),u=n.selectAll("g[data-name='leaf']").data(c.leaves(),f=>f.data.name);u.exit().attr("opacity",0).remove();const h=u.enter().append("g").attr("data-name","leaf").attr("data-uid",()=>rN++).merge(u);h.attr("data-name","leaf").transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-group-update",animate:t})).attr("transform",f=>`translate(${f.x0},${f.y0})`);const d=h.selectAll("rect.leaf").data(f=>[f]);d.exit().attr("width",0).attr("height",0).remove(),d.enter().append("rect").classed("leaf",!0).merge(d).attr("width",0).attr("height",0).attr("id",function(){const f=N(this.parentNode).attr("data-uid");return`${i.style.prefix}-leaf-${f}`}).attr("class",f=>{for(;f.depth>1;)f=f.parent;return this.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:f.data.name,originalClassName:"leaf"})}).transition().call(f=>this.services.transitions.setupTransition({transition:f,name:"treemap-leaf-update-enter",animate:t})).attr("width",f=>f.x1-f.x0).attr("height",f=>f.y1-f.y0).style("fill",f=>{for(;f.depth>1;)f=f.parent;return this.model.getFillColor(f.data.name)}),h.selectAll("clipPath").data(f=>f.data.showLabel!==!0?[]:[1],f=>f).join(f=>f.append("clipPath").attr("id",function(){const p=N(this.parentNode).attr("data-uid");return`${i.style.prefix}-clip-${p}`}).append("use").attr("xlink:href",function(){const p=N(this.parentNode.parentNode).attr("data-uid"),m=`${i.style.prefix}-leaf-${p}`;return new URL(`#${m}`,s)+""}),f=>null,f=>f.remove()),h.selectAll("text").data(f=>{if(f.data.showLabel!==!0)return[];let p=f;for(;p.depth>1;)p=p.parent;const m=yo(this.model.getFillColor(p.data.name));return[{text:f.data.name,color:m.l<.5?"white":"black"}]},f=>f).join(f=>{const p=f.append("text").text(m=>m.text).style("fill",Pm).attr("x",7).attr("y",18);return s&&p.attr("clip-path",function(){const m=N(this.parentNode).attr("data-uid"),g=`${i.style.prefix}-clip-${m}`;return`url(${new URL(`#${g}`,s)+""})`}),p},f=>f.text(p=>p.text).style("fill",Pm),f=>f.remove()),this.addEventListeners()}addEventListeners(){const t=this;this.parent.selectAll("rect.leaf").on("mouseover",function(n,r){const i=N(this);let s=getComputedStyle(this,null).getPropertyValue("fill"),a=r;for(;a.depth>1;)a=a.parent;i.transition("graph_element_mouseover_fill_update").call(o=>t.services.transitions.setupTransition({transition:o,name:"graph_element_mouseover_fill_update"})).style("fill",o=>{const l=t.model.getFillColor(o.parent.data.name);return l&&(s=l),en(s).darker(.7).toString()}),t.services.events.dispatchEvent(A.Tooltip.SHOW,{event:n,hoveredElement:i,items:[{color:s,label:a.data.name,bold:!0},{label:r.data.name,value:r.data.value}]}),t.services.events.dispatchEvent(A.Treemap.LEAF_MOUSEOVER,{event:n,element:i,datum:r})}).on("mousemove",function(n,r){const i=N(this);t.services.events.dispatchEvent(A.Treemap.LEAF_MOUSEMOVE,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.MOVE,{event:n})}).on("click",function(n,r){t.services.events.dispatchEvent(A.Treemap.LEAF_CLICK,{event:n,element:N(this),datum:r})}).on("mouseout",function(n,r){const i=N(this);i.classed("hovered",!1);let s=r;for(;s.depth>1;)s=s.parent;i.transition().call(a=>t.services.transitions.setupTransition({transition:a,name:"graph_element_mouseout_fill_update"})).style("fill",a=>t.model.getFillColor(a.parent.data.name)),t.services.events.dispatchEvent(A.Treemap.LEAF_MOUSEOUT,{event:n,element:i,datum:r}),t.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:i})})}}class sN extends gt{constructor(){super(...arguments),this.type="wordcloud",this.renderType=nt.SVG,this.handleLegendOnHover=t=>{const{hoveredElement:n}=t.detail,{groupMapsTo:r}=this.getOptions().data;this.parent.selectAll("text.word").transition("legend-hover-wordcloud").call(i=>this.services.transitions.setupTransition({transition:i,name:"legend-hover-wordcloud"})).attr("opacity",i=>i[r]!==n.datum().name?.3:1)},this.handleLegendMouseOut=()=>{this.parent.selectAll("text.word").transition("legend-mouseout-wordcloud").call(t=>this.services.transitions.setupTransition({transition:t,name:"legend-mouseout-wordcloud"})).attr("opacity",1)}}init(){const t=this.services.events;t.addEventListener(A.Legend.ITEM_HOVER,this.handleLegendOnHover),t.addEventListener(A.Legend.ITEM_MOUSEOUT,this.handleLegendMouseOut)}render(t=!0){const n=this,r=this.getComponentContainer().attr("width","100%").attr("height","100%"),i=this.model.getDisplayData(),s=this.getFontSizeScale(i),a=this.getOptions(),{fontSizeMapsTo:o,wordMapsTo:l}=a.wordCloud,{groupMapsTo:c}=a.data,{width:u,height:h}=P.getSVGElementSize(r,{useAttrs:!0});if(u===0||h===0)return;const d=IL().size([u,h]).words(i.map(function(p){const m=p[o];if(typeof p[o]!="number")throw Error("Badly formatted WordCloud data. `value` should only be an integer or float");return{[c]:p[c],text:p[l],size:m,value:m}})).padding(5).rotate(0).fontSize(p=>s(p.size)).on("end",f);d.start();function f(p){const m=P.appendOrSelect(r,"g.words");m.attr("transform",`translate(${d.size()[0]/2}, ${d.size()[1]/2})`);const g=m.selectAll("text").data(p,v=>`${v[c]}-${v.text}`);g.exit().attr("opacity",0).remove(),g.enter().append("text").attr("opacity",0).merge(g).style("font-size",v=>`${v.size}px`).text(function(v){return v.text}).attr("class",v=>n.model.getColorClassName({classNameTypes:[st.FILL],dataGroupName:v[c],originalClassName:`word ${v.size>32?"light":""}`})).style("fill",v=>n.model.getFillColor(v[c],v.text,v)).attr("text-anchor","middle").transition().call(v=>n.services.transitions.setupTransition({transition:v,name:"wordcloud-text-update-enter",animate:t})).attr("transform",v=>`translate(${v.x}, ${v.y})`).attr("opacity",1)}this.addEventListeners()}getFontSizeScale(t){const n=this.getOptions(),{fontSizeMapsTo:r}=n.wordCloud,i=t.map(l=>l[r]).filter(l=>l),s=P.getHTMLElementSize(this.services.domUtils.getMainContainer()),a=i.length>0,o=a?Re(i):[1,1];return Be().domain(o).range(a?n.wordCloud.fontSizeRange(s,t):[4,4])}addEventListeners(){const t=this.getOptions(),{groupMapsTo:n}=t.data,r=this,i=Ha(s=>{const a=r.parent.selectAll("text.word").transition("wordcloud-word-mouse-highlight").call(o=>r.services.transitions.setupTransition({transition:o,name:"wordcloud-word-mouse-highlight"}));s===null?a.attr("opacity",1):a.attr("opacity",function(){return s===this?1:.3})},6);this.parent.selectAll("text.word").on("mouseover",function(s,a){const o=this;i(o),r.services.events.dispatchEvent(A.WordCloud.WORD_MOUSEOVER,{event:s,element:N(this),datum:a}),r.services.events.dispatchEvent(A.Tooltip.SHOW,{event:s,hoveredElement:o,items:[{label:t.tooltip.wordLabel,value:a.text},{label:t.tooltip.valueLabel,value:a.value},{label:t.tooltip.groupLabel,value:a[n],class:r.model.getColorClassName({classNameTypes:[st.TOOLTIP],dataGroupName:a[n]})}]})}).on("mousemove",function(s,a){const o=N(this);r.services.events.dispatchEvent(A.WordCloud.WORD_MOUSEMOVE,{element:o,datum:a}),r.services.events.dispatchEvent(A.Tooltip.MOVE,{event:s})}).on("click",function(s,a){r.services.events.dispatchEvent(A.WordCloud.WORD_CLICK,{event:s,element:N(this),datum:a})}).on("mouseout",function(s,a){const o=N(this);i(null),r.services.events.dispatchEvent(A.WordCloud.WORD_MOUSEOUT,{event:s,element:o,datum:a}),r.services.events.dispatchEvent(A.Tooltip.HIDE,{hoveredElement:o})})}}class aN extends gt{constructor(){super(...arguments),this.type="geo",this.renderType=nt.SVG}render(){const t=this.getComponentContainer({withinChartClip:!0}),{width:n,height:r}=P.getSVGElementSize(t,{useAttrs:!0});if(n<1||r<1)return;const i=this.getProjection(),s=_(this.getOptions(),"geoData"),a=this.model.getCombinedData(),o={},l={};Object.keys(a).forEach(g=>{typeof a[g].value=="number"?o[g]=a[g]:l[g]=a[g]});const c=lR(s,Object.values(l)),u=sR(s,{type:"GeometryCollection",geometries:Object.values(o)}),h=i.fitSize([n,r],u),d=cx().projection(h);P.appendOrSelect(t,"g.geo").selectAll("path").data(u.features).join("path").attr("d",d);const f=this.services.domUtils.generateElementIDString("geo-pattern-stripes"),p=P.appendOrSelect(t,"defs");P.appendOrSelect(p,"pattern").attr("id",f).attr("width",5).attr("height",10).attr("patternUnits","userSpaceOnUse").attr("patternTransform","rotate(45)").append("path").classed("pattern-fill",!0).attr("d",Mi()([[0,0],[0,10]]));const m=P.appendOrSelect(t,"g.missing-data");P.appendOrSelect(m,"path").datum(c).attr("d",d).style("fill",`url(#${f})`)}getProjection(){let t=null;switch(_(this.getOptions(),"thematic","projection")){case fn.geoEqualEarth:t=Cx();break;case fn.geoAlbers:t=wx();break;case fn.geoConicEqualArea:t=nd();break;case fn.geoConicEquidistant:t=Tx();break;case fn.geoEquirectangular:t=Sx();break;case fn.geoMercator:t=_x();break;case fn.geoNaturalEarth1:t=Ax();break;default:throw new Error("Projection is not supported.")}return t}}class oN extends aN{constructor(){super(...arguments),this.type="choropleth"}render(t=!0){super.render();const n=this.model.getCombinedData();this.getComponentContainer({withinChartClip:!0}).select("g.geo").selectAll("path").classed("border",!0).attr("class",r=>this.model.getColorClassName({value:n[r.properties.NAME].value,originalClassName:"border"})),this.addCountryAreaEventListener()}addCountryAreaEventListener(){const t=this,n=this.model.getCombinedData();this.parent.selectAll("path.border").on("mouseover",function(r,i){const s=N(this);t.services.events.dispatchEvent(Mr.CHOROPLETH_MOUSEOVER,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Ai.SHOW,{event:r,hoveredElement:s,items:[{label:i.properties.NAME,value:n[i.properties.NAME].value}]})}).on("mousemove",function(r,i){t.services.events.dispatchEvent(Mr.CHOROPLETH_MOUSEMOVE,{event:r,element:N(this),datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Ai.MOVE,{event:r})}).on("click",function(r,i){t.services.events.dispatchEvent(Mr.CHOROPLETH_CLICK,{event:r,element:N(this),datum:n[i.properties.NAME]})}).on("mouseout",function(r,i){const s=N(this);t.services.events.dispatchEvent(Mr.CHOROPLETH_MOUSEOUT,{event:r,element:s,datum:n[i.properties.NAME]}),t.services.events.dispatchEvent(Ai.HIDE,{event:r,hoveredElement:s})})}}function Nm(e,t){ht(2,arguments);var n=xt(e),r=Kt(t);return isNaN(r)?new Date(NaN):(r&&n.setDate(n.getDate()+r),n)}function Gc(e,t){ht(2,arguments);var n=xt(e),r=Kt(t);if(isNaN(r))return new Date(NaN);if(!r)return n;var i=n.getDate(),s=new Date(n.getTime());s.setMonth(n.getMonth()+r+1,0);var a=s.getDate();return i>=a?s:(n.setFullYear(s.getFullYear(),s.getMonth(),i),n)}var lN=36e5;function Um(e,t){ht(2,arguments);var n=Kt(t);return xa(e,n*lN)}function Bm(e){ht(1,arguments);var t=xt(e);return t.setHours(0,0,0,0),t}var cN=864e5;function uN(e,t){ht(2,arguments);var n=Bm(e),r=Bm(t),i=n.getTime()-Vl(n),s=r.getTime()-Vl(r);return Math.round((i-s)/cN)}var hN=6e4;function zc(e,t){ht(2,arguments);var n=Kt(t);return xa(e,n*hN)}function jc(e,t){ht(2,arguments);var n=Kt(t);return xa(e,n*1e3)}function Vm(e,t){ht(2,arguments);var n=Kt(t);return Gc(e,n*12)}function es(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=n.getTime()-r.getTime();return i<0?-1:i>0?1:i}var dN=6e4,fN=36e5;function pN(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=n.getFullYear()-r.getFullYear(),s=n.getMonth()-r.getMonth();return i*12+s}function gN(e,t){ht(2,arguments);var n=xt(e),r=xt(t);return n.getFullYear()-r.getFullYear()}function Hm(e,t){var 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 mN(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=Hm(n,r),s=Math.abs(uN(n,r));n.setDate(n.getDate()-i*s);var a=+(Hm(n,r)===-i),o=i*(s-a);return o===0?0:o}function Wc(e,t){return ht(2,arguments),xt(e).getTime()-xt(t).getTime()}var Fm={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},vN="trunc";function qc(e){return e?Fm[e]:Fm[vN]}function yN(e,t,n){ht(2,arguments);var r=Wc(e,t)/fN;return qc(n==null?void 0:n.roundingMethod)(r)}function Gm(e,t,n){ht(2,arguments);var r=Wc(e,t)/dN;return qc(n==null?void 0:n.roundingMethod)(r)}function bN(e){ht(1,arguments);var t=xt(e);return t.setHours(23,59,59,999),t}function xN(e){ht(1,arguments);var t=xt(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function wN(e){ht(1,arguments);var t=xt(e);return bN(t).getTime()===xN(t).getTime()}function _N(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=es(n,r),s=Math.abs(pN(n,r)),a;if(s<1)a=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-i*s);var o=es(n,r)===-i;wN(xt(e))&&s===1&&es(e,r)===1&&(o=!1),a=i*(s-Number(o))}return a===0?0:a}function zm(e,t,n){ht(2,arguments);var r=Wc(e,t)/1e3;return qc(n==null?void 0:n.roundingMethod)(r)}function EN(e,t){ht(2,arguments);var n=xt(e),r=xt(t),i=es(n,r),s=Math.abs(gN(n,r));n.setFullYear(1584),r.setFullYear(1584);var a=es(n,r)===-i,o=i*(s-Number(a));return o===0?0:o}function SN(e,t){ht(2,arguments);var n=Kt(t);return Nm(e,-n)}function ON(e,t){ht(2,arguments);var n=Kt(t);return Gc(e,-n)}function TN(e,t){ht(2,arguments);var n=Kt(t);return Um(e,-n)}function jm(e,t){ht(2,arguments);var n=Kt(t);return zc(e,-n)}function Wm(e,t){ht(2,arguments);var n=Kt(t);return jc(e,-n)}function MN(e,t){ht(2,arguments);var n=Kt(t);return Vm(e,-n)}function qm(e){var t=e==null?0:e.length;return t?Da(e,1):[]}class CN extends wn{zoomIn(t,n,r){let i,s,a;const o=r||Dr;t&&(i=t.x,s=t.y,a=2);const{width:l,height:c}=P.getSVGElementSize(this.services.domUtils.getHolder(),{useClientDimensions:!0});n.transition().duration(o.duration).ease(o.ease).attr("transform",`translate(${l/2}, ${c/2}) scale(${a}) translate(${-i},${-s})`),this.services.events.dispatchEvent(A.CanvasZoom.CANVAS_ZOOM_IN,{element:N(t)})}zoomOut(t,n){const r=n||Dr;t.transition().duration(r.duration).ease(r.ease).attr("transform",""),this.services.events.dispatchEvent(A.CanvasZoom.CANVAS_ZOOM_OUT)}}class AN extends wn{init(){this.documentFragment=document.createDocumentFragment()}addEventListener(t,n){this.documentFragment.addEventListener(t,n)}removeEventListener(t,n){this.documentFragment.removeEventListener(t,n)}dispatchEvent(t,n){let r;n?r=new CustomEvent(t,{detail:n}):(r=document.createEvent("Event"),r.initEvent(t,!1,!0)),this.documentFragment.dispatchEvent(r)}}class $N extends wn{constructor(t,n){super(t,n)}downloadCSV(t,n){const r=document.createElement("a"),i="text/csv;encoding:utf-8";if(navigator.msSaveBlob)navigator.msSaveBlob(new Blob([t],{type:i}),n);else if(URL&&"download"in r){const s=URL.createObjectURL(new Blob([t],{type:i}));r.href=s,r.setAttribute("download",n),document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(s)}else location.href=`data:application/octet-stream,${encodeURIComponent(t)}`}downloadImage(t,n){const r=document.createElement("a");r.download=n,r.href=t,document.body.appendChild(r),r.click(),document.body.removeChild(r)}}class LN extends wn{constructor(){super(...arguments),this.pendingTransitions={}}init(){var t;(t=this.services.events)==null||t.addEventListener(A.Model.UPDATE,()=>{this.pendingTransitions={}})}setupTransition({transition:t,name:n,animate:r}){return this.pendingTransitions[t._id]=t,t.on("end interrupt cancel",()=>{delete this.pendingTransitions[t._id]}),this.model.getOptions().animations===!1||r===!1?t.duration(0):t.duration(_(Xf,n,"duration")||Xf.default.duration)}getPendingTransitions(){return this.pendingTransitions}}let DN=class extends wn{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:r}=n.data,i=_(n,"axes",this.secondaryDomainAxisPosition),s=t[r];if(i!=null&&i.correspondingDatasets&&i.correspondingDatasets.includes(s))return this.secondaryDomainAxisPosition}return this.domainAxisPosition}getRangeAxisPosition({datum:t=null,groups:n=null}={}){if(this.dualAxes){const r=this.model.getOptions(),{groupMapsTo:i}=r.data,s=_(r,"axes",this.secondaryRangeAxisPosition);let a;if(t!==null?a=t[i]:n&&n.length>0&&(a=n[0]),s!=null&&s.correspondingDatasets&&s.correspondingDatasets.includes(a))return this.secondaryRangeAxisPosition}return this.rangeAxisPosition}getAxisOptions(t){return _(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){return this.getAxisOptions(t).title||(t===H.BOTTOM||t===H.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(H).map(t=>H[t]).forEach(t=>{this.scales[t]=this.createScale(t)})}findDomainAndRangeAxes(){const t=this.findVerticalAxesPositions(),n=this.findHorizontalAxesPositions(),r=this.findDomainAndRangeAxesPositions(t,n);this.domainAxisPosition=r.primaryDomainAxisPosition,this.rangeAxisPosition=r.primaryRangeAxisPosition,this.isDualAxes()&&(this.secondaryDomainAxisPosition=r.secondaryDomainAxisPosition,this.secondaryRangeAxisPosition=r.secondaryRangeAxisPosition)}determineOrientation(){(this.rangeAxisPosition===H.LEFT||this.rangeAxisPosition===H.RIGHT)&&(this.domainAxisPosition===H.BOTTOM||this.domainAxisPosition===H.TOP)?this.orientation=Jt.VERTICAL:this.orientation=Jt.HORIZONTAL}isDualAxes(){return this.dualAxes}determineAxisDuality(){var t,n,r,i;const s=this.model.getOptions(),a=_(s,"axes");((t=a[H.LEFT])!=null&&t.correspondingDatasets&&a[H.RIGHT]||(n=a[H.RIGHT])!=null&&n.correspondingDatasets&&a[H.LEFT]||(r=a[H.TOP])!=null&&r.correspondingDatasets&&a[H.BOTTOM]||(i=a[H.BOTTOM])!=null&&i.correspondingDatasets&&a[H.TOP])&&(this.dualAxes=!0)}getCustomDomainValuesByposition(t){const n=_(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]===tt.LINEAR||this.scaleTypes[t]===tt.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=[H.BOTTOM,H.TOP];return[this.domainAxisPosition,this.rangeAxisPosition].find(n=>t.indexOf(n)>-1)}getMainYAxisPosition(){const t=[H.LEFT,H.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,r,i){const s=this.model.getOptions(),a=_(s,"axes")[r],{mapsTo:o}=a,l=_(i,o)!==null?i[o]:i;let c;switch(n){case tt.LABELS:c=t(l)+t.step()/2;break;case tt.TIME:c=t(new Date(l));break;default:c=t(l)}return c}getBoundedScaledValues(t){const{bounds:n}=this.model.getOptions(),r=this.getRangeAxisPosition({datum:t}),i=this.scales[r],s=this.model.getOptions(),a=_(s,"axes")[r],{mapsTo:o}=a,l=t[o]!==void 0?t[o]:t;return[i(_(t,n.upperBoundMapsTo)!==null?t[n.upperBoundMapsTo]:l),i(_(t,n.lowerBoundMapsTo)!==null?t[n.lowerBoundMapsTo]:l)]}getValueThroughAxisPosition(t,n){const r=this.scaleTypes[t],i=this.scales[t];return this.getValueFromScale(i,r,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 _(n,"axes",this.getDomainAxisPosition({datum:t}),"mapsTo")}getRangeIdentifier(t){const n=this.model.getOptions();return _(n,"axes",this.getRangeAxisPosition({datum:t}),"mapsTo")}extendsDomain(t,n){const r=this.model.getOptions(),i=_(r,"axes",t);if(i.scaleType===tt.TIME){const s=_(r,"timeScale","addSpaceOnEdges");return kN(n,s)}else return RN(n,An.paddingRatio,i.scaleType)}findVerticalAxesPositions(){const t=this.model.getOptions(),n=_(t,"axes"),r=this.isDualAxes();return _(n,H.LEFT)===null&&_(n,H.RIGHT)!==null||_(n,H.RIGHT,"main")===!0||r&&_(n,H.LEFT,"correspondingDatasets")?{primary:H.RIGHT,secondary:H.LEFT}:{primary:H.LEFT,secondary:H.RIGHT}}findHorizontalAxesPositions(){const t=this.model.getOptions(),n=_(t,"axes"),r=this.isDualAxes();return _(n,H.BOTTOM)===null&&_(n,H.TOP)!==null||_(n,H.TOP,"main")===!0||r&&_(n,H.BOTTOM,"correspondingDatasets")?{primary:H.TOP,secondary:H.BOTTOM}:{primary:H.BOTTOM,secondary:H.TOP}}findDomainAndRangeAxesPositions(t,n){const r=this.model.getOptions(),i=_(r,"axes",t.primary),s=_(r,"axes",n.primary),a=i.scaleType||tt.LINEAR,o=s.scaleType||tt.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===tt.LABELS||o===tt.TIME)&&a===tt.LABELS||a===tt.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(),r=_(n,"axes",t),i=_(n,"bounds"),{includeZero:s}=r,a=_(r,"scaleType")||tt.LINEAR;if(this.model.isDataEmpty())return[];if(r.binned){const{bins:v}=this.model.getBinConfigurations();return[0,Nn(v,b=>b.length)]}else if(r.limitDomainToBins){const{bins:v}=this.model.getBinConfigurations(),b=this.model.getStackKeys({bins:v});return[b[0].split("-")[0],b[b.length-1].split("-")[1]]}const o=this.model.getDisplayData(),{extendLinearDomainBy:l,mapsTo:c,percentage:u,thresholds:h}=r,{reference:d,compareTo:f}=An.ratio;if(r.domain)return a===tt.LABELS?r.domain:(a===tt.TIME&&(r.domain=r.domain.map(v=>v.getTime===void 0?new Date(v):v)),this.extendsDomain(t,r.domain));if(u)return[0,100];if(r&&a===tt.LABELS)return ji(o.map(v=>v[c]));let p,m;const g=this.model.getDataGroupNames();if(a===tt.LABELS_RATIO)return o.map(v=>`${v[d]}/${v[f]}`);if(a===tt.TIME)m=o.map(v=>+new Date(v[c]));else if(i&&n.axes)m=[],o.forEach(v=>{m.push(v[c]),v[i.upperBoundMapsTo]&&m.push(v[i.upperBoundMapsTo]),v[i.lowerBoundMapsTo]&&m.push(v[i.lowerBoundMapsTo])});else if(r.stacked===!0&&g&&t===this.getRangeAxisPosition()){const{groupMapsTo:v}=n.data,b=this.model.getDataValuesGroupedByKeys({groups:g}),w=o.filter(E=>!g.includes(E[v])),O=[];b.forEach(E=>{const{...T}=E;let S=0,$=0;Object.values(T).forEach(k=>{isNaN(k)||(k<0?$+=k:S+=k)}),O.push([$,S])}),m=[...qm(O),...w.map(E=>E[c])]}else m=[],o.forEach(v=>{const b=v[c];Array.isArray(b)&&b.length===2?(m.push(b[0]),m.push(b[1])):(l&&m.push(Math.max(v[c],v[l])),m.push(b))});return a!==tt.TIME&&a!==tt.LOG&&s&&m.push(0),h&&h.length>0&&h.forEach(v=>{const b=_(v,"value");b!==null&&m.push(b)}),p=Re(m),p=this.extendsDomain(t,p),p}createScale(t){const n=this.model.getOptions(),r=_(n,"axes",t);if(!r)return null;const i=_(r,"scaleType")||tt.LINEAR;this.scaleTypes[t]=i;let s;return i===tt.TIME?s=Fd():i===tt.LOG?s=Ed().base(r.base||10):i===tt.LABELS||i===tt.LABELS_RATIO?s=xi():s=Be(),s.domain(this.getScaleDomain(t)),s}getHighestDomainThreshold(){const t=_(this.model.getOptions(),"axes"),n=this.getDomainAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getDomainScale(),s=r.sort((a,o)=>o.value-a.value)[0];return this.getScaleTypeByPosition(n)===tt.TIME&&(typeof s.value=="string"||s.value.getTime===void 0)&&(s.value=new Date(s.value)),{threshold:s,scaleValue:i(s.value)}}getHighestRangeThreshold(){const t=_(this.model.getOptions(),"axes"),n=this.getRangeAxisPosition(),{thresholds:r}=t[n];if(!Array.isArray(r)||Array.isArray(r)&&!r.length)return null;const i=this.getRangeScale(),s=r.sort((a,o)=>o.value-a.value)[0];return{threshold:s,scaleValue:i(s.value)}}};function kN(e,t){const n=new Date(e[0]),r=new Date(e[1]);return EN(r,n)>1?[MN(n,t),Vm(r,t)]:_N(r,n)>1?[ON(n,t),Gc(r,t)]:mN(r,n)>1?[SN(n,t),Nm(r,t)]:yN(r,n)>1?[TN(n,t),Um(r,t)]:Gm(r,n)>30?[jm(n,t*30),zc(r,t*30)]:Gm(r,n)>1?[jm(n,t),zc(r,t)]:zm(r,n)>15?[Wm(n,t*15),jc(r,t*15)]:zm(r,n)>1?[Wm(n,t),jc(r,t)]:[n,r]}function RN([e,t],n,r){const i=(t-e)*n,s=t<=0&&t+i>0?0:t+i;let a=e>=0&&e-i<0?0:e-i;if(r===tt.LOG&&a<=0){if(e<=0)throw Error("Data must have values greater than 0 if log scale type is used.");a=e}return[a,s]}let IN=class extends wn{constructor(){super(...arguments),this.curveTypes={curveLinear:la,curveLinearClosed:ef,curveBasis:EE,curveBasisClosed:SE,curveBasisOpen:OE,curveBundle:TE,curveCardinal:ME,curveCardinalClosed:CE,curveCardinalOpen:AE,curveCatmullRom:$E,curveCatmullRomClosed:LE,curveCatmullRomOpen:DE,curveMonotoneX:kE,curveMonotoneY:RE,curveNatural:IE,curveStep:PE,curveStepAfter:UE,curveStepBefore:NE}}getD3Curve(){let t="curveLinear";const n=this.model.getOptions().curve;if(n&&(typeof n=="string"?t=n:t=n.name),this.curveTypes[t]){let r=this.curveTypes[t];return n&&Object.keys(n).forEach(i=>{r[i]&&(r=r[i](n[i]))}),r}return console.warn(`The curve type '${t}' is invalid, using 'curveLinear' instead`),this.curveTypes.curveLinear}};class PN extends wn{isZoomBarEnabled(){if(!this.services.cartesianScales||!_(this.model.getOptions(),"zoomBar","top","enabled"))return!1;this.services.cartesianScales.findDomainAndRangeAxes();const t=this.services.cartesianScales.getMainXAxisPosition(),n=_(this.model.getOptions(),"axes",t,"scaleType");return t===H.BOTTOM&&n===tt.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:r}=this.services;if(!r)throw new Error("Services cartesianScales undefined");const i=r.getMainXAxisPosition(),s=r.getDomainIdentifier(),a=_(this.model.getOptions(),"axes",i,"domain");if(Array.isArray(a)&&a.length===2)return a;if(!i)throw new Error("Not defined: mainXAxisPosition");return r.extendsDomain(i,Re(n,o=>o[s]))}handleDomainChange(t,n={dispatchEvent:!0}){var r;this.model.set({zoomDomain:t},{animate:!1}),n.dispatchEvent&&((r=this.services.events)==null||r.dispatchEvent(A.ZoomDomain.CHANGE,{newDomain:t}))}getZoomRatio(){return _(this.model.getOptions(),"zoomBar","zoomRatio")}filterDataForRangeAxis(t,n){var r;const i=this.model.get("zoomDomain"),s=Object.assign({stacked:!1},n),a=_(this.model.getOptions(),"zoomBar","updateRangeAxis");if(this.isZoomBarEnabled()&&a&&i){const o=s.stacked?"sharedStackKey":(r=this.services.cartesianScales)==null?void 0:r.getDomainIdentifier(),l=t.filter(c=>new Date(c[o])>=i[0]&&new Date(c[o])<=i[1]);if(l.length>0)return l}return t}zoomIn(t=this.getZoomRatio()){var n;const r=this.model.get("zoomDomain"),i=Ee.handleWidth,s=(n=this.services.cartesianScales)==null?void 0:n.getMainXScale().copy();s.domain(this.getDefaultZoomBarDomain());const a=s(r[0]),o=s(r[1]);if(o-a<i+1)return;const l=s.range(),c=o-a,u=Math.min((l[1]-l[0])/2*(t/2),c/2);let h=a+u,d=o-u;h>=d&&(h=a+c/2-i/2,d=o-c/2+i/2);const f=[s.invert(h),s.invert(d)];(r[0].valueOf()!==f[0].valueOf()||r[1].valueOf()!==f[1].valueOf())&&this.handleDomainChange(f)}zoomOut(t=this.getZoomRatio()){const n=this.model.get("zoomDomain");if(!this.services.cartesianScales)throw new Error("Services cartesianScales undefined");const r=this.services.cartesianScales.getMainXScale().copy();r.domain(this.getDefaultZoomBarDomain());const i=r(n[0]),s=r(n[1]),a=r.range(),o=(a[1]-a[0])/2*(t/2),l=Math.max(i-o,a[0]),c=Math.min(s+o,a[1]),u=[r.invert(l),r.invert(c)];(n[0].valueOf()!==u[0].valueOf()||n[1].valueOf()!==u[1].valueOf())&&this.handleDomainChange(u)}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)}isMinZoomDomain(){const t=this.model.get("zoomDomain"),n=this.getDefaultZoomBarDomain();if(!t||!n)return!1;const r=t[1].valueOf()-t[0].valueOf(),i=n[1].valueOf()-n[0].valueOf(),s=_(this.model.getOptions(),"zoomBar","minZoomRatio");return r/i<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 _(this.model.getOptions(),"zoomBar",t,"loading")}isZoomBarLocked(t){return _(this.model.getOptions(),"zoomBar",t,"locked")}}function NN(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}function UN(e,t,n){var r=e.length;return n=n===void 0?r:n,!t&&n>=r?e:NN(e,t,n)}var BN="\\ud800-\\udfff",VN="\\u0300-\\u036f",HN="\\ufe20-\\ufe2f",FN="\\u20d0-\\u20ff",GN=VN+HN+FN,zN="\\ufe0e\\ufe0f",jN="\\u200d",WN=RegExp("["+jN+BN+GN+zN+"]");function Ym(e){return WN.test(e)}function qN(e){return e.split("")}var Xm="\\ud800-\\udfff",YN="\\u0300-\\u036f",XN="\\ufe20-\\ufe2f",ZN="\\u20d0-\\u20ff",KN=YN+XN+ZN,QN="\\ufe0e\\ufe0f",JN="["+Xm+"]",Yc="["+KN+"]",Xc="\\ud83c[\\udffb-\\udfff]",tU="(?:"+Yc+"|"+Xc+")",Zm="[^"+Xm+"]",Km="(?:\\ud83c[\\udde6-\\uddff]){2}",Qm="[\\ud800-\\udbff][\\udc00-\\udfff]",eU="\\u200d",Jm=tU+"?",tv="["+QN+"]?",nU="(?:"+eU+"(?:"+[Zm,Km,Qm].join("|")+")"+tv+Jm+")*",rU=tv+Jm+nU,iU="(?:"+[Zm+Yc+"?",Yc,Km,Qm,JN].join("|")+")",sU=RegExp(Xc+"(?="+Xc+")|"+iU+rU,"g");function aU(e){return e.match(sU)||[]}function oU(e){return Ym(e)?aU(e):qN(e)}function lU(e){return function(t){t=Gi(t);var n=Ym(t)?oU(t):void 0,r=n?n[0]:t.charAt(0),i=n?UN(n,1).join(""):t.slice(1);return r[e]()+i}}var cU=lU("toUpperCase");const uU=cU;function hU(e){return uU(Gi(e).toLowerCase())}var dU=em(function(e,t,n){return t=t.toLowerCase(),e+(n?hU(t):t)});const fU=dU;class je{constructor(t,n){this.components=[],this.services={canvasZoom:CN,domUtils:P,events:AN,files:$N,gradientUtils:mc,transitions:LN},this.model=new Je(this.services)}init(t,n){this.model.set({holder:t},{skipUpdate:!0}),Object.keys(this.services).forEach(r=>{const i=this.services[r];this.services[r]=new i(this.model,this.services)}),this.services.events.addEventListener(A.Model.UPDATE,r=>{const i=!!_(r,"detail","animate");this.update(i)}),this.model.setData(n.data),this.services.events.addEventListener(A.Chart.RESIZE,()=>{this.update(!1)}),this.components=this.getComponents(),this.update()}getComponents(){return console.error("getComponents() method is not implemented"),[]}update(t=!0){if(!this.components)return;Object.keys(this.services).forEach(i=>{this.services[i].update()}),this.components.forEach(i=>i.render(t));const n=this.services.transitions.getPendingTransitions(),r=Object.keys(n).map(i=>n[i].end().catch(s=>s));Promise.all(r).then(()=>this.services.events.dispatchEvent(A.Chart.RENDER_FINISHED))}destroy(){this.components.forEach(t=>t.destroy()),this.services.domUtils.getHolder().remove(),this.model.set({destroyed:!0},{skipUpdate:!0})}getChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"toolbar","enabled"),s={id:"legend",components:[new Bc(this.model,this.services)],growth:ut.PREFERRED},a=_(r,"canvasZoom","enabled");a&&a===!0&&t.push(new Wk(this.model,this.services));const o=!!this.model.getOptions().title,l={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},c={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},u={id:"header",components:[new me(this.model,this.services,[l,...i?[c]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},h={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:_(n,"graphFrameRenderType")||nt.SVG},d=_(n,"excludeLegend")!==!0&&r.legend.enabled!==!1;let f=Lt.COLUMN;if(d){const v=_(r,"legend","position");v==="left"?(f=Lt.ROW,r.legend.orientation||(r.legend.orientation=Li.VERTICAL)):v==="right"?(f=Lt.ROW_REVERSE,r.legend.orientation||(r.legend.orientation=Li.VERTICAL)):v==="bottom"&&(f=Lt.COLUMN_REVERSE)}const p={id:"spacer",components:[new _n(this.model,this.services)],growth:ut.PREFERRED},m={id:"full-frame",components:[new me(this.model,this.services,[...d?[s]:[],...d?[p]:[],h],{direction:f})],growth:ut.STRETCH},g=[];if(o||i){g.push(u);const v={id:"spacer",components:[new _n(this.model,this.services,i?{size:15}:void 0)],growth:ut.PREFERRED};g.push(v)}return g.push(m),[new Vc(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,g,{direction:Lt.COLUMN})]}}class ye extends je{constructor(t,n){super(t,n),this.services=Object.assign(this.services,{cartesianScales:DN,curves:IN,zoom:PN}),this.model=new sr(this.services)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"zoomBar",H.TOP,"enabled"),s=_(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const a=this.services.cartesianScales.getMainXAxisPosition(),o=_(r,"axes",a,"scaleType"),l=i&&a===H.BOTTOM&&o===tt.TIME,c=this.services.zoom.isZoomBarLocked(H.TOP),u=!!this.model.getOptions().title,h={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},d={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},f={id:"header",components:[new me(this.model,this.services,[h,...s?[d]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},p={id:"legend",components:[new Bc(this.model,this.services)],growth:ut.PREFERRED};l&&!c&&t.push(new vm(this.model,this.services),new xm(this.model,this.services)),t.push(new Yk(this.model,this.services)),t.push(new Xk(this.model,this.services));const m={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:nt.SVG},g=_(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1;let v=Lt.COLUMN;if(g){const T=_(this.model.getOptions(),"legend","position");T===$i.LEFT?(v=Lt.ROW,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Li.VERTICAL)):T===$i.RIGHT?(v=Lt.ROW_REVERSE,this.model.getOptions().legend.orientation||(this.model.getOptions().legend.orientation=Li.VERTICAL)):T===$i.BOTTOM&&(v=Lt.COLUMN_REVERSE)}const b={id:"spacer",components:[new _n(this.model,this.services)],growth:ut.PREFERRED},w={id:"full-frame",components:[new me(this.model,this.services,[...g?[p]:[],...g?[b]:[],m],{direction:v})],growth:ut.STRETCH},O={id:"zoom-bar",components:[new qk(this.model,this.services)],growth:ut.PREFERRED,renderType:nt.SVG},E=[];if(u||s){E.push(f);const T={id:"spacer",components:[new _n(this.model,this.services,s?{size:15}:void 0)],growth:ut.PREFERRED};E.push(T)}return l&&E.push(O),E.push(w),[new wm(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,E,{direction:Lt.COLUMN})]}}class pU extends je{constructor(t,n){super(t,n),this.model=new _$(this.services),this.model.setOptions(Nt(Ct.alluvialChart,n.options)),this.init(t,n)}getComponents(){const t=[new Zk(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class gU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(yn(Ct.areaChart),n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new zr(this.model,this.services),new _m(this.model,this.services),new tn(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0}),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class mU extends ye{constructor(t,n){super(t,n),this.model=new E$(this.services),this.model.setOptions(Nt(Ct.boxplotChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new Jk(this.model,this.services),new jr(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t,{legend:{enabled:!1}})}}class vU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.bubbleChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new tR(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class yU extends ye{constructor(t,n){super(t,n),this.model=new S$(this.services),this.model.setOptions(Nt(Ct.bulletChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new eR(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class bU extends je{constructor(t,n){super(t,n),this.model=new O$(this.services),this.model.setOptions(Nt(Ct.choroplethChart,n.options)),this.init(t,n)}getChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"toolbar","enabled"),s=!!this.model.getOptions().title,a={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},o={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},l={id:"header",components:[new me(this.model,this.services,[a,...i?[o]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},c={id:"legend",components:[new Tm(this.model,this.services,{chartType:"choropleth"})],growth:ut.PREFERRED,renderType:nt.SVG},u={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:nt.SVG},h=_(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Lt.COLUMN_REVERSE,f={id:"spacer",components:[new _n(this.model,this.services,{size:15})],growth:ut.PREFERRED},p={id:"full-frame",components:[new me(this.model,this.services,[...h?[c]:[],...h?[f]:[],u],{direction:d})],growth:ut.STRETCH},m=[];if(s||i){m.push(l);const g={id:"spacer",components:[new _n(this.model,this.services,i?{size:15}:void 0)],growth:ut.PREFERRED};m.push(g)}return m.push(p),[new Vc(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,m,{direction:Lt.COLUMN})]}getComponents(){const t=[new oN(this.model,this.services)];return this.getChartComponents(t)}}class xU extends je{constructor(t,n){super(t,n),this.model=new T$(this.services),this.model.setOptions(Nt(Ct.circlePackChart,n.options)),this.init(t,n)}getComponents(){const t=[new bR(this.model,this.services)];return this.getChartComponents(t)}}const ev={[Me.LINE]:[zr,tn],[Me.SCATTER]:[tn],[Me.AREA]:[_m,zr,tn],[Me.STACKED_AREA]:[Dm,zr,Rm,eo],[Me.SIMPLE_BAR]:[Lm],[Me.GROUPED_BAR]:[$m,jr],[Me.STACKED_BAR]:[km,eo]};class wU extends ye{constructor(t,n){super(t,n);const r=Nt(Ct.comboChart,n.options);n.options.comboChartTypes||(console.error("No comboChartTypes defined for the Combo Chart!"),r.comboChartTypes=[{type:Me.LINE,correspondingDatasets:[]}]),this.model.setOptions(r),this.init(t,n)}getGraphComponents(){const{comboChartTypes:t}=this.model.getOptions();let n=0;const r=t.map(i=>{const s=i.type;let a;if(typeof i.type=="string"){if(!Object.keys(ev).includes(i.type))return console.error(`Invalid chart type "${i.type}" specified for combo chart. Please refer to the ComboChart tutorial for more guidance.`),null;let o=!1;const l=`${fU(i.type)}Chart`;return a=at({},Ct[l],this.model.getOptions(),i.options),i.type===Me.STACKED_AREA&&(o=!0),ev[i.type].map(c=>new c(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a,stacked:o}))}else return a=at({},this.model.getOptions(),i.options),new s(this.model,this.services,{groups:i.correspondingDatasets,id:n++,options:a})}).filter(i=>i!==null);return qm(r)}getComponents(){const{comboChartTypes:t}=this.model.getOptions(),n=t.some(i=>i.type===Me.STACKED_BAR||i.type===Me.STACKED_AREA),r=[new ve(this.model,this.services),new Se(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID}),...n?[]:[new kn(this.model,this.services)],...this.getGraphComponents()];return this.getAxisChartComponents(r)}}class nv extends je{constructor(t,n,r=!1){super(t,n),this.model=new M$(this.services),!r&&(this.model.setOptions(Nt(Ct.pieChart,n.options)),this.init(t,n))}getComponents(){const t=[new Mm(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.PIE})];return this.getChartComponents(t)}}class _U extends nv{constructor(t,n){super(t,n,!0),this.model.setOptions(Nt(Ct.donutChart,n.options)),this.init(t,n)}getComponents(){const t=[new wR(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.DONUT})];return this.getChartComponents(t)}}class EU extends je{constructor(t,n){super(t,n),this.model=new C$(this.services),this.model.setOptions(Nt(Ct.gaugeChart,n.options)),this.init(t,n)}getComponents(){const t=[new _R(this.model,this.services)];return this.getChartComponents(t)}}class SU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.groupedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new $m(this.model,this.services),new jr(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class OU extends ye{constructor(t,n){super(t,n),this.model=new A$(this.services),this.model.setOptions(Nt(Ct.heatmapChart,n.options)),this.init(t,n)}getAxisChartComponents(t,n){const r=this.model.getOptions(),i=_(r,"toolbar","enabled");this.services.cartesianScales.determineAxisDuality(),this.services.cartesianScales.findDomainAndRangeAxes(),this.services.cartesianScales.determineOrientation();const s=!!this.model.getOptions().title,a={id:"title",components:[new ts(this.model,this.services)],growth:ut.STRETCH},o={id:"toolbar",components:[new Qi(this.model,this.services)],growth:ut.PREFERRED},l={id:"header",components:[new me(this.model,this.services,[a,...i?[o]:[]],{direction:Lt.ROW,alignItems:Cr.CENTER})],growth:ut.PREFERRED},c={id:"legend",components:[new Tm(this.model,this.services,{chartType:"heatmap"})],growth:ut.PREFERRED,renderType:nt.SVG},u={id:"graph-frame",components:t,growth:ut.STRETCH,renderType:nt.SVG},h=_(n,"legend","enabled")!==!1&&this.model.getOptions().legend.enabled!==!1,d=Lt.COLUMN_REVERSE,f={id:"spacer",components:[new _n(this.model,this.services,{size:15})],growth:ut.PREFERRED},p={id:"full-frame",components:[new me(this.model,this.services,[...h?[c]:[],...h?[f]:[],u],{direction:d})],growth:ut.STRETCH},m=[];if(s||i){m.push(l);const g={id:"spacer",components:[new _n(this.model,this.services,i?{size:15}:void 0)],growth:ut.PREFERRED};m.push(g)}return m.push(p),[new wm(this.model,this.services),new Qa(this.model,this.services),new me(this.model,this.services,m,{direction:Lt.COLUMN})]}getComponents(){const t=[new ve(this.model,this.services),new ER(this.model,this.services)];return this.getAxisChartComponents(t)}}class TU extends ye{constructor(t,n){super(t,n),this.model=new $$(this.services),this.model.setOptions(Nt(Ct.histogramChart,n.options)),this.init(t,n),this.update()}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new uR(this.model,this.services),new SR(this.model,this.services)];return this.getAxisChartComponents(t)}}class MU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.lineChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new zr(this.model,this.services),new tn(this.model,this.services,{handleThresholds:!0}),new CR(this.model,this.services),new jr(this.model,this.services)];return this.getAxisChartComponents(t)}}class CU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.lollipopChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new OR(this.model,this.services),new tn(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class AU extends je{constructor(t,n){var r;super(t,n),this.model=new L$(this.services);const i=(r=n.options.meter)!=null&&r.proportional?at(yn(Ct.proportionalMeterChart),n.options):at(yn(Ct.meterChart),n.options);this.model.setOptions(i),this.init(t,n)}getComponents(){const t=[..._(this.model.getOptions(),"meter","showLabels")?[{id:"meter-title",components:[new yR(this.model,this.services)],growth:ut.STRETCH,renderType:nt.SVG},{id:"spacer",components:[new _n(this.model,this.services,{size:8})],growth:ut.STRETCH}]:[],{id:"meter-graph",components:[new TR(this.model,this.services)],growth:ut.STRETCH,renderType:nt.SVG}],n=[new me(this.model,this.services,t,{direction:Lt.COLUMN})];return this.getChartComponents(n,{graphFrameRenderType:nt.HTML})}}class $U extends je{constructor(t,n){super(t,n),this.model=new D$(this.services),this.model.setOptions(Nt(Ct.radarChart,n.options)),this.init(t,n)}getComponents(){const t=[new MR(this.model,this.services)];return this.getChartComponents(t)}}class LU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.scatterChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new kn(this.model,this.services),new tn(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class DU extends je{constructor(t,n){super(t,n),this.model=new k$(this.services),this.model.setOptions(Nt(Ct.treeChart,n.options)),this.init(t,n)}getComponents(){const t=[new AR(this.model,this.services)];return this.getChartComponents(t,{excludeLegend:!0})}}class kU extends je{constructor(t,n){super(t,n),this.model=new R$(this.services),this.model.setOptions(Nt(Ct.treemapChart,n.options)),this.init(t,n)}getComponents(){const t=[new iN(this.model,this.services)];return this.getChartComponents(t)}}class RU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.simpleBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new Lm(this.model,this.services),new jr(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ})];return this.getAxisChartComponents(t)}}class IU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.stackedAreaChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new eo(this.model,this.services),new Dm(this.model,this.services),new zr(this.model,this.services,{stacked:!0}),new Rm(this.model,this.services,{fadeInOnChartHolderMouseover:!0,handleThresholds:!0,stacked:!0}),new he(this.model,this.services,{skeleton:Xt.GRID})];return this.getAxisChartComponents(t)}}class PU extends ye{constructor(t,n){super(t,n),this.model.setOptions(Nt(Ct.stackedBarChart,n.options)),this.init(t,n)}getComponents(){const t=[new ve(this.model,this.services),new Se(this.model,this.services),new eo(this.model,this.services),new km(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.VERT_OR_HORIZ}),new jr(this.model,this.services)];return this.getAxisChartComponents(t)}}class NU extends je{constructor(t,n){super(t,n),this.model=new I$(this.services),this.model.setOptions(Nt(Ct.wordCloudChart,n.options)),this.init(t,n)}getComponents(){const t=[new sN(this.model,this.services),new he(this.model,this.services,{skeleton:Xt.PIE})];return this.getChartComponents(t)}}var Zc={exports:{}},ns={};/**
|
|
84
84
|
* @license React
|
|
85
85
|
* react-jsx-runtime.production.min.js
|
|
86
86
|
*
|